Skip to content

feat(domain): add skill injection system for feature worktrees#509

Open
arielshad wants to merge 15 commits intomainfrom
feat/skill-injector
Open

feat(domain): add skill injection system for feature worktrees#509
arielshad wants to merge 15 commits intomainfrom
feat/skill-injector

Conversation

@arielshad
Copy link
Copy Markdown
Contributor

Summary

  • Skill Injector Service: New ISkillInjectorService port interface and SkillInjectorService infrastructure implementation that copies curated local skills and installs remote skills (via npx skills add) into feature worktrees during creation
  • TypeSpec domain models: SkillInjectionConfig, SkillSource, and SkillSourceType added to settings.tsp with generated types, JSON schema output, and settings factory defaults (7 curated local skills, enabled: false)
  • Settings persistence: SQLite migration (050-add-skill-injection-config) adds skill_injection_enabled and skill_injection_skills columns; settings mapper handles serialization/deserialization of the new config
  • CreateFeatureUseCase integration: Skill injection runs in Phase 2 (after spec init, before agent spawn), guarded by settings + optional injectSkills input override, with full error isolation (failures log warnings, never block feature creation)
  • CLI flag: --inject-skills / --no-inject-skills on shep feat new for per-invocation override of the settings value
  • Idempotency & commit prevention: Skills already present (checked via SKILL.md existence) are skipped; injected skills are appended to the worktree's .gitignore (only if not already git-tracked)
  • Security: Input validation rejects shell injection characters and path traversal in skill source values; uses execFile instead of exec to avoid shell interpolation
  • Cross-platform: All paths use path.join()/path.resolve(); 30-second timeout per remote skill installation

Evidence

Test Suite Result
SkillInjectorService unit tests 21/21 passing — local deep-copy, idempotency, remote npx with timeout, .gitignore management, input validation
TypeSpec generated types tests 8/8 passing — SkillSourceType enum, SkillSource model, SkillInjectionConfig, WorkflowConfig integration
Settings mapper tests 73/73 passing (14 new) — toDatabase/fromDatabase serialization, null handling, round-trip
Settings defaults factory tests 35/35 passing (6 new) — enabled=false default, 7 curated local skills
CreateFeatureUseCase tests 57/57 passing (11 new) — inject when enabled, skip when disabled, settings override, error isolation
CLI flag tests Verified via source inspection — Commander.js option, NewOptions interface, passthrough to input
TypeSpec compilation Success — zero errors with tsp v0.60.1
Build Success — zero TypeScript compilation errors

Spec

specs/081-skill-injector/ — 13 functional requirements, 9 non-functional requirements across 4 architecture layers (TypeSpec → domain → application → infrastructure → presentation).

Test plan

  • All 5331 unit tests pass (pnpm test:unit)
  • Build compiles without errors (pnpm build)
  • Linting passes with zero warnings (pnpm lint:fix)
  • TypeSpec compilation succeeds (pnpm tsp:compile)
  • CI pipeline passes on push

Built with Shep 🐑 Shep Bot

arielshad and others added 15 commits April 1, 2026 16:09
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ctor

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ll-injector

Covers 9 architecture decisions including file copy strategy (fs.cp),
command execution (DI ExecFunction), timeout mechanism (AbortController),
SQLite storage (JSON column), settings location (WorkflowConfig),
port interface design, git tracking detection, idempotency check,
and migration numbering. Includes library analysis, security
considerations, and performance implications.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…injector

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Define SkillSourceType enum (local/remote), SkillSource model, and
SkillInjectionConfig model in settings.tsp. Add optional skillInjection
field to WorkflowConfig. Regenerate domain types and JSON schemas.
Includes unit test verifying generated type exports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…put field

Add ISkillInjectorService port interface with inject() method and
SkillInjectionResult type (injected/skipped/failed arrays). Extend
CreateFeatureInput with optional injectSkills boolean for CLI override.
Export new types from services barrel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
add skill injector infrastructure service with local skill deep-copy
via fs.cp, remote skill installation via npx with 30s abort timeout,
skill.md idempotency checks, gitignore management with git tracking
detection, and input validation against shell injection and path
traversal. register in di container alongside worktree service.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… and mapper

Add SQLite migration 050 for skill_injection_enabled and
skill_injection_skills columns. Update settings mapper with
serialization/deserialization including buildSkillInjectionFromRow
helper. Populate createDefaultSettings() with 7 curated local skills
(disabled by default).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nd cli

Wire ISkillInjectorService into CreateFeatureUseCase via constructor
injection. Add guarded injection call in initializeAndSpawn() after
attachment processing and before feature record update. Guard with
resolved injectSkills flag (input override ?? settings ?? false). Wrap
in try/catch for NFR-3 error isolation.

Add --inject-skills / --no-inject-skills CLI flags to feat new command
following the --fast / --no-fast pattern. Pass resolved value as
injectSkills on CreateFeatureInput. When neither flag is provided,
leave undefined to fall through to settings default.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Windows CI uses backslash path separators, so regex assertions
must accept both / and \ to avoid false negatives on windows-latest.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

Dev Release Published

Artifact Version Install
npm 1.162.0-pr509.4102877 npm install -g @shepai/cli@1.162.0-pr509.4102877

Published from commit b02ee01 | View CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant