@shepai/cli 1.14.1 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +191 -101
- package/dist/eslint.config.mjs +2 -0
- package/dist/src/application/ports/output/external-issue-fetcher.interface.d.ts +69 -0
- package/dist/src/application/ports/output/external-issue-fetcher.interface.d.ts.map +1 -0
- package/dist/src/application/ports/output/external-issue-fetcher.interface.js +46 -0
- package/dist/src/application/ports/output/feature-agent-process.interface.d.ts +44 -0
- package/dist/src/application/ports/output/feature-agent-process.interface.d.ts.map +1 -0
- package/dist/src/application/ports/output/feature-agent-process.interface.js +12 -0
- package/dist/src/application/ports/output/feature-repository.interface.d.ts +76 -0
- package/dist/src/application/ports/output/feature-repository.interface.d.ts.map +1 -0
- package/dist/src/application/ports/output/feature-repository.interface.js +11 -0
- package/dist/src/application/ports/output/index.d.ts +3 -0
- package/dist/src/application/ports/output/index.d.ts.map +1 -1
- package/dist/src/application/ports/output/index.js +1 -1
- package/dist/src/application/ports/output/spec-initializer.interface.d.ts +33 -0
- package/dist/src/application/ports/output/spec-initializer.interface.d.ts.map +1 -0
- package/dist/src/application/ports/output/spec-initializer.interface.js +8 -0
- package/dist/src/application/ports/output/worktree-service.interface.d.ts +83 -0
- package/dist/src/application/ports/output/worktree-service.interface.d.ts.map +1 -0
- package/dist/src/application/ports/output/worktree-service.interface.js +30 -0
- package/dist/src/application/use-cases/agents/approve-agent-run.use-case.d.ts +22 -0
- package/dist/src/application/use-cases/agents/approve-agent-run.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/agents/approve-agent-run.use-case.js +67 -0
- package/dist/src/application/use-cases/agents/delete-agent-run.use-case.d.ts +16 -0
- package/dist/src/application/use-cases/agents/delete-agent-run.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/agents/delete-agent-run.use-case.js +46 -0
- package/dist/src/application/use-cases/agents/get-agent-run.use-case.d.ts +22 -0
- package/dist/src/application/use-cases/agents/get-agent-run.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/agents/get-agent-run.use-case.js +42 -0
- package/dist/src/application/use-cases/agents/list-agent-runs.use-case.d.ts +21 -0
- package/dist/src/application/use-cases/agents/list-agent-runs.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/agents/list-agent-runs.use-case.js +54 -0
- package/dist/src/application/use-cases/agents/reject-agent-run.use-case.d.ts +16 -0
- package/dist/src/application/use-cases/agents/reject-agent-run.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/agents/reject-agent-run.use-case.js +52 -0
- package/dist/src/application/use-cases/agents/show-agent-run.use-case.d.ts +24 -0
- package/dist/src/application/use-cases/agents/show-agent-run.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/agents/show-agent-run.use-case.js +52 -0
- package/dist/src/application/use-cases/agents/stop-agent-run.use-case.d.ts +15 -0
- package/dist/src/application/use-cases/agents/stop-agent-run.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/agents/stop-agent-run.use-case.js +86 -0
- package/dist/src/application/use-cases/features/create-feature.use-case.d.ts +43 -0
- package/dist/src/application/use-cases/features/create-feature.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/features/create-feature.use-case.js +166 -0
- package/dist/src/application/use-cases/features/delete-feature.use-case.d.ts +27 -0
- package/dist/src/application/use-cases/features/delete-feature.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/features/delete-feature.use-case.js +83 -0
- package/dist/src/application/use-cases/features/list-features.use-case.d.ts +17 -0
- package/dist/src/application/use-cases/features/list-features.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/features/list-features.use-case.js +37 -0
- package/dist/src/application/use-cases/features/resume-feature.use-case.d.ts +24 -0
- package/dist/src/application/use-cases/features/resume-feature.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/features/resume-feature.use-case.js +100 -0
- package/dist/src/application/use-cases/features/show-feature.use-case.d.ts +17 -0
- package/dist/src/application/use-cases/features/show-feature.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/features/show-feature.use-case.js +43 -0
- package/dist/src/domain/generated/output.d.ts +26 -1
- package/dist/src/domain/generated/output.d.ts.map +1 -1
- package/dist/src/domain/generated/output.js +1 -0
- package/dist/src/infrastructure/di/container.d.ts.map +1 -1
- package/dist/src/infrastructure/di/container.js +64 -14
- package/dist/src/infrastructure/persistence/sqlite/mappers/agent-run.mapper.d.ts +4 -0
- package/dist/src/infrastructure/persistence/sqlite/mappers/agent-run.mapper.d.ts.map +1 -1
- package/dist/src/infrastructure/persistence/sqlite/mappers/agent-run.mapper.js +8 -0
- package/dist/src/infrastructure/persistence/sqlite/mappers/feature.mapper.d.ts +50 -0
- package/dist/src/infrastructure/persistence/sqlite/mappers/feature.mapper.d.ts.map +1 -0
- package/dist/src/infrastructure/persistence/sqlite/mappers/feature.mapper.js +62 -0
- package/dist/src/infrastructure/persistence/sqlite/migrations.d.ts.map +1 -1
- package/dist/src/infrastructure/persistence/sqlite/migrations.js +49 -0
- package/dist/src/infrastructure/repositories/agent-run.repository.d.ts.map +1 -1
- package/dist/src/infrastructure/repositories/agent-run.repository.js +30 -8
- package/dist/src/infrastructure/repositories/sqlite-feature.repository.d.ts +25 -0
- package/dist/src/infrastructure/repositories/sqlite-feature.repository.d.ts.map +1 -0
- package/dist/src/infrastructure/repositories/sqlite-feature.repository.js +113 -0
- package/dist/src/infrastructure/services/agents/{langgraph → analyze-repo}/analyze-repository-graph.d.ts +0 -22
- package/dist/src/infrastructure/services/agents/analyze-repo/analyze-repository-graph.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/{langgraph → analyze-repo}/analyze-repository-graph.js +4 -11
- package/dist/src/infrastructure/services/agents/analyze-repo/prompts/analyze-repository.prompt.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/{agent-executor-factory.service.d.ts → common/agent-executor-factory.service.d.ts} +3 -3
- package/dist/src/infrastructure/services/agents/common/agent-executor-factory.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/{agent-registry.service.d.ts → common/agent-registry.service.d.ts} +1 -1
- package/dist/src/infrastructure/services/agents/common/agent-registry.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/{agent-registry.service.js → common/agent-registry.service.js} +7 -1
- package/dist/src/infrastructure/services/agents/{agent-runner.service.d.ts → common/agent-runner.service.d.ts} +5 -5
- package/dist/src/infrastructure/services/agents/common/agent-runner.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/{agent-runner.service.js → common/agent-runner.service.js} +4 -4
- package/dist/src/infrastructure/services/agents/{agent-validator.service.d.ts → common/agent-validator.service.d.ts} +2 -2
- package/dist/src/infrastructure/services/agents/common/agent-validator.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/{langgraph → common}/checkpointer.d.ts +1 -0
- package/dist/src/infrastructure/services/agents/common/checkpointer.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/{langgraph → common}/checkpointer.js +6 -0
- package/dist/src/infrastructure/services/agents/{executors → common/executors}/claude-code-executor.service.d.ts +9 -2
- package/dist/src/infrastructure/services/agents/common/executors/claude-code-executor.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/{executors → common/executors}/claude-code-executor.service.js +103 -6
- package/dist/src/infrastructure/services/agents/common/executors/mock-executor-factory.service.d.ts +15 -0
- package/dist/src/infrastructure/services/agents/common/executors/mock-executor-factory.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/common/executors/mock-executor-factory.service.js +16 -0
- package/dist/src/infrastructure/services/agents/common/executors/mock-executor.service.d.ts +17 -0
- package/dist/src/infrastructure/services/agents/common/executors/mock-executor.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/common/executors/mock-executor.service.js +49 -0
- package/dist/src/infrastructure/services/agents/feature-agent/feature-agent-graph.d.ts +244 -0
- package/dist/src/infrastructure/services/agents/feature-agent/feature-agent-graph.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/feature-agent-graph.js +36 -0
- package/dist/src/infrastructure/services/agents/feature-agent/feature-agent-process.service.d.ts +20 -0
- package/dist/src/infrastructure/services/agents/feature-agent/feature-agent-process.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/feature-agent-process.service.js +90 -0
- package/dist/src/infrastructure/services/agents/feature-agent/feature-agent-worker.d.ts +31 -0
- package/dist/src/infrastructure/services/agents/feature-agent/feature-agent-worker.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/feature-agent-worker.js +236 -0
- package/dist/src/infrastructure/services/agents/feature-agent/heartbeat.d.ts +19 -0
- package/dist/src/infrastructure/services/agents/feature-agent/heartbeat.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/heartbeat.js +38 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/analyze.node.d.ts +7 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/analyze.node.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/analyze.node.js +9 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/implement.node.d.ts +11 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/implement.node.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/implement.node.js +23 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.d.ts +40 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.js +114 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/plan.node.d.ts +7 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/plan.node.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/plan.node.js +9 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/analyze.prompt.d.ts +9 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/analyze.prompt.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/analyze.prompt.js +94 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/implement.prompt.d.ts +8 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/implement.prompt.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/implement.prompt.js +18 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/plan.prompt.d.ts +11 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/plan.prompt.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/plan.prompt.js +170 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/requirements.prompt.d.ts +10 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/requirements.prompt.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/requirements.prompt.js +116 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/research.prompt.d.ts +10 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/research.prompt.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/prompts/research.prompt.js +121 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/requirements.node.d.ts +7 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/requirements.node.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/requirements.node.js +9 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/research.node.d.ts +7 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/research.node.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/nodes/research.node.js +9 -0
- package/dist/src/infrastructure/services/agents/feature-agent/state.d.ts +39 -0
- package/dist/src/infrastructure/services/agents/feature-agent/state.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/feature-agent/state.js +27 -0
- package/dist/src/infrastructure/services/external/github-issue.service.d.ts +19 -0
- package/dist/src/infrastructure/services/external/github-issue.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/external/github-issue.service.js +59 -0
- package/dist/src/infrastructure/services/external/jira-ticket.service.d.ts +23 -0
- package/dist/src/infrastructure/services/external/jira-ticket.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/external/jira-ticket.service.js +57 -0
- package/dist/src/infrastructure/services/git/worktree.service.d.ts +28 -0
- package/dist/src/infrastructure/services/git/worktree.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/git/worktree.service.js +112 -0
- package/dist/src/infrastructure/services/spec/spec-initializer.service.d.ts +17 -0
- package/dist/src/infrastructure/services/spec/spec-initializer.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/spec/spec-initializer.service.js +281 -0
- package/dist/src/presentation/cli/commands/agent/approve.command.d.ts +11 -0
- package/dist/src/presentation/cli/commands/agent/approve.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/agent/approve.command.js +42 -0
- package/dist/src/presentation/cli/commands/agent/delete.command.d.ts +11 -0
- package/dist/src/presentation/cli/commands/agent/delete.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/agent/delete.command.js +49 -0
- package/dist/src/presentation/cli/commands/agent/index.d.ts +21 -0
- package/dist/src/presentation/cli/commands/agent/index.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/agent/index.js +38 -0
- package/dist/src/presentation/cli/commands/agent/logs.command.d.ts +13 -0
- package/dist/src/presentation/cli/commands/agent/logs.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/agent/logs.command.js +163 -0
- package/dist/src/presentation/cli/commands/agent/ls.command.d.ts +12 -0
- package/dist/src/presentation/cli/commands/agent/ls.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/agent/ls.command.js +111 -0
- package/dist/src/presentation/cli/commands/agent/reject.command.d.ts +11 -0
- package/dist/src/presentation/cli/commands/agent/reject.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/agent/reject.command.js +43 -0
- package/dist/src/presentation/cli/commands/agent/resolve-run.d.ts +10 -0
- package/dist/src/presentation/cli/commands/agent/resolve-run.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/agent/resolve-run.js +27 -0
- package/dist/src/presentation/cli/commands/agent/show.command.d.ts +12 -0
- package/dist/src/presentation/cli/commands/agent/show.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/agent/show.command.js +202 -0
- package/dist/src/presentation/cli/commands/agent/stop.command.d.ts +11 -0
- package/dist/src/presentation/cli/commands/agent/stop.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/agent/stop.command.js +42 -0
- package/dist/src/presentation/cli/commands/feat/del.command.d.ts +17 -0
- package/dist/src/presentation/cli/commands/feat/del.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/feat/del.command.js +55 -0
- package/dist/src/presentation/cli/commands/feat/index.d.ts +17 -0
- package/dist/src/presentation/cli/commands/feat/index.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/feat/index.js +29 -0
- package/dist/src/presentation/cli/commands/feat/ls.command.d.ts +15 -0
- package/dist/src/presentation/cli/commands/feat/ls.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/feat/ls.command.js +112 -0
- package/dist/src/presentation/cli/commands/feat/new.command.d.ts +17 -0
- package/dist/src/presentation/cli/commands/feat/new.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/feat/new.command.js +64 -0
- package/dist/src/presentation/cli/commands/feat/resume.command.d.ts +11 -0
- package/dist/src/presentation/cli/commands/feat/resume.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/feat/resume.command.js +33 -0
- package/dist/src/presentation/cli/commands/feat/show.command.d.ts +11 -0
- package/dist/src/presentation/cli/commands/feat/show.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/feat/show.command.js +128 -0
- package/dist/src/presentation/cli/index.d.ts +8 -4
- package/dist/src/presentation/cli/index.d.ts.map +1 -1
- package/dist/src/presentation/cli/index.js +12 -4
- package/dist/src/presentation/cli/ui/detail-view.d.ts +43 -0
- package/dist/src/presentation/cli/ui/detail-view.d.ts.map +1 -0
- package/dist/src/presentation/cli/ui/detail-view.js +57 -0
- package/dist/src/presentation/cli/ui/index.d.ts +2 -0
- package/dist/src/presentation/cli/ui/index.d.ts.map +1 -1
- package/dist/src/presentation/cli/ui/index.js +2 -0
- package/dist/src/presentation/cli/ui/list-view.d.ts +34 -0
- package/dist/src/presentation/cli/ui/list-view.d.ts.map +1 -0
- package/dist/src/presentation/cli/ui/list-view.js +65 -0
- package/dist/src/presentation/cli/ui/symbols.d.ts +5 -1
- package/dist/src/presentation/cli/ui/symbols.d.ts.map +1 -1
- package/dist/src/presentation/cli/ui/symbols.js +4 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/cache/.previewinfo +1 -1
- package/web/.next/cache/.rscinfo +1 -1
- package/web/.next/cache/config.json +3 -3
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/required-server-files.js +1 -1
- package/web/.next/required-server-files.json +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.html +2 -2
- package/web/.next/server/app/_not-found.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/index.html +2 -2
- package/web/.next/server/app/index.rsc +1 -1
- package/web/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/version.html +2 -2
- package/web/.next/server/app/version.rsc +1 -1
- package/web/.next/server/app/version.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/version/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/version.segment.rsc +1 -1
- package/web/.next/server/chunks/ssr/_19be0743._.js +1 -1
- package/web/.next/server/pages/404.html +2 -2
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +1 -1
- package/web/.next/trace +1 -1
- package/web/.next/trace-build +1 -1
- package/dist/src/infrastructure/services/agents/agent-executor-factory.service.d.ts.map +0 -1
- package/dist/src/infrastructure/services/agents/agent-registry.service.d.ts.map +0 -1
- package/dist/src/infrastructure/services/agents/agent-runner.service.d.ts.map +0 -1
- package/dist/src/infrastructure/services/agents/agent-validator.service.d.ts.map +0 -1
- package/dist/src/infrastructure/services/agents/executors/claude-code-executor.service.d.ts.map +0 -1
- package/dist/src/infrastructure/services/agents/langgraph/analyze-repository-graph.d.ts.map +0 -1
- package/dist/src/infrastructure/services/agents/langgraph/checkpointer.d.ts.map +0 -1
- package/dist/src/infrastructure/services/agents/langgraph/prompts/analyze-repository.prompt.d.ts.map +0 -1
- /package/dist/src/infrastructure/services/agents/{langgraph → analyze-repo}/prompts/analyze-repository.prompt.d.ts +0 -0
- /package/dist/src/infrastructure/services/agents/{langgraph → analyze-repo}/prompts/analyze-repository.prompt.js +0 -0
- /package/dist/src/infrastructure/services/agents/{agent-executor-factory.service.js → common/agent-executor-factory.service.js} +0 -0
- /package/dist/src/infrastructure/services/agents/{agent-validator.service.js → common/agent-validator.service.js} +0 -0
- /package/web/.next/static/{ozzHAkZyxX7nXyxpqufBs → XV-wYY85Xk9ANCuQDQ6_H}/_buildManifest.js +0 -0
- /package/web/.next/static/{ozzHAkZyxX7nXyxpqufBs → XV-wYY85Xk9ANCuQDQ6_H}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{ozzHAkZyxX7nXyxpqufBs → XV-wYY85Xk9ANCuQDQ6_H}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stop Agent Run Use Case
|
|
3
|
+
*
|
|
4
|
+
* Sends SIGTERM to a running agent's worker process and marks it as cancelled.
|
|
5
|
+
*/
|
|
6
|
+
import type { IAgentRunRepository } from '../../ports/output/agent-run-repository.interface.js';
|
|
7
|
+
export declare class StopAgentRunUseCase {
|
|
8
|
+
private readonly agentRunRepository;
|
|
9
|
+
constructor(agentRunRepository: IAgentRunRepository);
|
|
10
|
+
execute(id: string): Promise<{
|
|
11
|
+
stopped: boolean;
|
|
12
|
+
reason: string;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=stop-agent-run.use-case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop-agent-run.use-case.d.ts","sourceRoot":"","sources":["../../../../../src/application/use-cases/agents/stop-agent-run.use-case.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAGhG,qBACa,mBAAmB;IAG5B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBAAlB,kBAAkB,EAAE,mBAAmB;IAGpD,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CA4DzE"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stop Agent Run Use Case
|
|
3
|
+
*
|
|
4
|
+
* Sends SIGTERM to a running agent's worker process and marks it as cancelled.
|
|
5
|
+
*/
|
|
6
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
13
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
14
|
+
};
|
|
15
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
16
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
17
|
+
};
|
|
18
|
+
import { injectable, inject } from 'tsyringe';
|
|
19
|
+
import { AgentRunStatus } from '../../../domain/generated/output.js';
|
|
20
|
+
let StopAgentRunUseCase = class StopAgentRunUseCase {
|
|
21
|
+
agentRunRepository;
|
|
22
|
+
constructor(agentRunRepository) {
|
|
23
|
+
this.agentRunRepository = agentRunRepository;
|
|
24
|
+
}
|
|
25
|
+
async execute(id) {
|
|
26
|
+
const run = await this.agentRunRepository.findById(id);
|
|
27
|
+
if (!run) {
|
|
28
|
+
return { stopped: false, reason: 'Agent run not found' };
|
|
29
|
+
}
|
|
30
|
+
const terminalStatuses = new Set([
|
|
31
|
+
AgentRunStatus.completed,
|
|
32
|
+
AgentRunStatus.failed,
|
|
33
|
+
AgentRunStatus.interrupted,
|
|
34
|
+
AgentRunStatus.cancelled,
|
|
35
|
+
]);
|
|
36
|
+
if (terminalStatuses.has(run.status)) {
|
|
37
|
+
return { stopped: false, reason: `Agent run already in terminal state: ${run.status}` };
|
|
38
|
+
}
|
|
39
|
+
if (!run.pid) {
|
|
40
|
+
// No PID — just mark as cancelled
|
|
41
|
+
const now = new Date();
|
|
42
|
+
await this.agentRunRepository.updateStatus(id, AgentRunStatus.cancelled, {
|
|
43
|
+
error: 'Cancelled by user (no PID)',
|
|
44
|
+
completedAt: now,
|
|
45
|
+
updatedAt: now,
|
|
46
|
+
});
|
|
47
|
+
return { stopped: true, reason: 'Marked as cancelled (no PID to signal)' };
|
|
48
|
+
}
|
|
49
|
+
// Check if process is alive
|
|
50
|
+
let alive = false;
|
|
51
|
+
try {
|
|
52
|
+
process.kill(run.pid, 0);
|
|
53
|
+
alive = true;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
alive = false;
|
|
57
|
+
}
|
|
58
|
+
if (alive) {
|
|
59
|
+
// Send SIGTERM for graceful shutdown
|
|
60
|
+
try {
|
|
61
|
+
process.kill(run.pid, 'SIGTERM');
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// Process may have died between check and signal
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const now = new Date();
|
|
68
|
+
await this.agentRunRepository.updateStatus(id, AgentRunStatus.cancelled, {
|
|
69
|
+
error: 'Cancelled by user',
|
|
70
|
+
completedAt: now,
|
|
71
|
+
updatedAt: now,
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
stopped: true,
|
|
75
|
+
reason: alive
|
|
76
|
+
? `Sent SIGTERM to PID ${run.pid}`
|
|
77
|
+
: `Process already dead, marked as cancelled`,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
StopAgentRunUseCase = __decorate([
|
|
82
|
+
injectable(),
|
|
83
|
+
__param(0, inject('IAgentRunRepository')),
|
|
84
|
+
__metadata("design:paramtypes", [Object])
|
|
85
|
+
], StopAgentRunUseCase);
|
|
86
|
+
export { StopAgentRunUseCase };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create Feature Use Case
|
|
3
|
+
*
|
|
4
|
+
* Creates a new feature entity with a git worktree for isolated development,
|
|
5
|
+
* initializes the spec directory with YAML templates, then spawns the
|
|
6
|
+
* feature agent to begin autonomous SDLC processing.
|
|
7
|
+
*
|
|
8
|
+
* Business Rules:
|
|
9
|
+
* - AI generates slug/name/description from user's free-text input
|
|
10
|
+
* - Falls back to regex-based slug if AI fails
|
|
11
|
+
* - Full user input is preserved as-is in spec.yaml
|
|
12
|
+
* - Slug must be unique within the repository
|
|
13
|
+
* - A git worktree is created at ~/.shep/repos/HASH/wt/SLUG/
|
|
14
|
+
* - Spec YAML files are scaffolded at WORKTREE/specs/NNN-SLUG/
|
|
15
|
+
* - Feature agent is spawned with the spec dir path
|
|
16
|
+
* - specPath is persisted on the Feature record
|
|
17
|
+
* - Initial lifecycle is Requirements
|
|
18
|
+
*/
|
|
19
|
+
import type { Feature } from '../../../domain/generated/output.js';
|
|
20
|
+
import type { IFeatureRepository } from '../../ports/output/feature-repository.interface.js';
|
|
21
|
+
import type { IWorktreeService } from '../../ports/output/worktree-service.interface.js';
|
|
22
|
+
import type { IFeatureAgentProcessService } from '../../ports/output/feature-agent-process.interface.js';
|
|
23
|
+
import type { IAgentRunRepository } from '../../ports/output/agent-run-repository.interface.js';
|
|
24
|
+
import type { ISpecInitializerService } from '../../ports/output/spec-initializer.interface.js';
|
|
25
|
+
import type { IAgentExecutorFactory } from '../../ports/output/agent-executor-factory.interface.js';
|
|
26
|
+
export interface CreateFeatureInput {
|
|
27
|
+
userInput: string;
|
|
28
|
+
repositoryPath: string;
|
|
29
|
+
approvalMode?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare class CreateFeatureUseCase {
|
|
32
|
+
private readonly featureRepo;
|
|
33
|
+
private readonly worktreeService;
|
|
34
|
+
private readonly agentProcess;
|
|
35
|
+
private readonly runRepository;
|
|
36
|
+
private readonly specInitializer;
|
|
37
|
+
private readonly executorFactory;
|
|
38
|
+
constructor(featureRepo: IFeatureRepository, worktreeService: IWorktreeService, agentProcess: IFeatureAgentProcessService, runRepository: IAgentRunRepository, specInitializer: ISpecInitializerService, executorFactory: IAgentExecutorFactory);
|
|
39
|
+
execute(input: CreateFeatureInput): Promise<Feature>;
|
|
40
|
+
private generateMetadata;
|
|
41
|
+
private toSlug;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=create-feature.use-case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-feature.use-case.d.ts","sourceRoot":"","sources":["../../../../../src/application/use-cases/features/create-feature.use-case.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAEnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACzG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAChG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAChG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAOpG,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAQD,qBACa,oBAAoB;IAG7B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAE5B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAEhC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAE7B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAEhC,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAVf,WAAW,EAAE,kBAAkB,EAE/B,eAAe,EAAE,gBAAgB,EAEjC,YAAY,EAAE,2BAA2B,EAEzC,aAAa,EAAE,mBAAmB,EAElC,eAAe,EAAE,uBAAuB,EAExC,eAAe,EAAE,qBAAqB;IAGnD,OAAO,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;YA8E5C,gBAAgB;IA6C9B,OAAO,CAAC,MAAM;CAQf"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create Feature Use Case
|
|
3
|
+
*
|
|
4
|
+
* Creates a new feature entity with a git worktree for isolated development,
|
|
5
|
+
* initializes the spec directory with YAML templates, then spawns the
|
|
6
|
+
* feature agent to begin autonomous SDLC processing.
|
|
7
|
+
*
|
|
8
|
+
* Business Rules:
|
|
9
|
+
* - AI generates slug/name/description from user's free-text input
|
|
10
|
+
* - Falls back to regex-based slug if AI fails
|
|
11
|
+
* - Full user input is preserved as-is in spec.yaml
|
|
12
|
+
* - Slug must be unique within the repository
|
|
13
|
+
* - A git worktree is created at ~/.shep/repos/HASH/wt/SLUG/
|
|
14
|
+
* - Spec YAML files are scaffolded at WORKTREE/specs/NNN-SLUG/
|
|
15
|
+
* - Feature agent is spawned with the spec dir path
|
|
16
|
+
* - specPath is persisted on the Feature record
|
|
17
|
+
* - Initial lifecycle is Requirements
|
|
18
|
+
*/
|
|
19
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
20
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
21
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
22
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
23
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24
|
+
};
|
|
25
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
26
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
27
|
+
};
|
|
28
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
29
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
30
|
+
};
|
|
31
|
+
import { injectable, inject } from 'tsyringe';
|
|
32
|
+
import { randomUUID } from 'node:crypto';
|
|
33
|
+
import { SdlcLifecycle } from '../../../domain/generated/output.js';
|
|
34
|
+
import { AgentRunStatus } from '../../../domain/generated/output.js';
|
|
35
|
+
import { getSettings } from '../../../infrastructure/services/settings.service.js';
|
|
36
|
+
/** Maximum characters of user input sent to the AI for metadata generation. */
|
|
37
|
+
const MAX_INPUT_FOR_AI = 500;
|
|
38
|
+
let CreateFeatureUseCase = class CreateFeatureUseCase {
|
|
39
|
+
featureRepo;
|
|
40
|
+
worktreeService;
|
|
41
|
+
agentProcess;
|
|
42
|
+
runRepository;
|
|
43
|
+
specInitializer;
|
|
44
|
+
executorFactory;
|
|
45
|
+
constructor(featureRepo, worktreeService, agentProcess, runRepository, specInitializer, executorFactory) {
|
|
46
|
+
this.featureRepo = featureRepo;
|
|
47
|
+
this.worktreeService = worktreeService;
|
|
48
|
+
this.agentProcess = agentProcess;
|
|
49
|
+
this.runRepository = runRepository;
|
|
50
|
+
this.specInitializer = specInitializer;
|
|
51
|
+
this.executorFactory = executorFactory;
|
|
52
|
+
}
|
|
53
|
+
async execute(input) {
|
|
54
|
+
const metadata = await this.generateMetadata(input.userInput);
|
|
55
|
+
const slug = metadata.slug;
|
|
56
|
+
const branch = `feat/${slug}`;
|
|
57
|
+
const existing = await this.featureRepo.findBySlug(slug, input.repositoryPath);
|
|
58
|
+
if (existing) {
|
|
59
|
+
throw new Error(`Feature with slug "${slug}" already exists in this repository`);
|
|
60
|
+
}
|
|
61
|
+
// Determine next feature number for this repo
|
|
62
|
+
const existingFeatures = await this.featureRepo.list({
|
|
63
|
+
repositoryPath: input.repositoryPath,
|
|
64
|
+
});
|
|
65
|
+
const featureNumber = existingFeatures.length + 1;
|
|
66
|
+
const now = new Date();
|
|
67
|
+
const runId = randomUUID();
|
|
68
|
+
// Create git worktree for isolated development
|
|
69
|
+
const worktreePath = this.worktreeService.getWorktreePath(input.repositoryPath, branch);
|
|
70
|
+
await this.worktreeService.create(input.repositoryPath, branch, worktreePath);
|
|
71
|
+
// Initialize spec directory — full user input goes into spec.yaml as-is
|
|
72
|
+
const { specDir } = await this.specInitializer.initialize(worktreePath, slug, featureNumber, input.userInput);
|
|
73
|
+
const feature = {
|
|
74
|
+
id: randomUUID(),
|
|
75
|
+
name: metadata.name,
|
|
76
|
+
slug,
|
|
77
|
+
description: metadata.description,
|
|
78
|
+
repositoryPath: input.repositoryPath,
|
|
79
|
+
branch,
|
|
80
|
+
lifecycle: SdlcLifecycle.Requirements,
|
|
81
|
+
messages: [],
|
|
82
|
+
relatedArtifacts: [],
|
|
83
|
+
agentRunId: runId,
|
|
84
|
+
specPath: specDir,
|
|
85
|
+
createdAt: now,
|
|
86
|
+
updatedAt: now,
|
|
87
|
+
};
|
|
88
|
+
await this.featureRepo.create(feature);
|
|
89
|
+
// Create agent run record and spawn background worker
|
|
90
|
+
const settings = getSettings();
|
|
91
|
+
const agentRun = {
|
|
92
|
+
id: runId,
|
|
93
|
+
agentType: settings.agent.type,
|
|
94
|
+
agentName: 'feature-agent',
|
|
95
|
+
status: AgentRunStatus.pending,
|
|
96
|
+
prompt: input.userInput,
|
|
97
|
+
threadId: randomUUID(),
|
|
98
|
+
featureId: feature.id,
|
|
99
|
+
repositoryPath: input.repositoryPath,
|
|
100
|
+
...(input.approvalMode ? { approvalMode: input.approvalMode } : {}),
|
|
101
|
+
createdAt: now.toISOString(),
|
|
102
|
+
updatedAt: now.toISOString(),
|
|
103
|
+
};
|
|
104
|
+
await this.runRepository.create(agentRun);
|
|
105
|
+
this.agentProcess.spawn(feature.id, runId, input.repositoryPath, specDir, worktreePath, input.approvalMode ? { approvalMode: input.approvalMode } : undefined);
|
|
106
|
+
return feature;
|
|
107
|
+
}
|
|
108
|
+
async generateMetadata(userInput) {
|
|
109
|
+
try {
|
|
110
|
+
const settings = getSettings();
|
|
111
|
+
const executor = this.executorFactory.createExecutor(settings.agent.type, settings.agent);
|
|
112
|
+
const truncated = userInput.length > MAX_INPUT_FOR_AI
|
|
113
|
+
? `${userInput.slice(0, MAX_INPUT_FOR_AI)}...`
|
|
114
|
+
: userInput;
|
|
115
|
+
const prompt = `Generate feature metadata from this user request:
|
|
116
|
+
"${truncated}"
|
|
117
|
+
|
|
118
|
+
Return ONLY a JSON object with these fields:
|
|
119
|
+
- slug: kebab-case identifier, 2-4 words max (e.g., "github-oauth-login")
|
|
120
|
+
- name: short human-readable title (e.g., "GitHub OAuth Login")
|
|
121
|
+
- description: refined 1-2 sentence description
|
|
122
|
+
|
|
123
|
+
JSON only, no markdown fences.`;
|
|
124
|
+
const result = await executor.execute(prompt, {
|
|
125
|
+
maxTurns: 1,
|
|
126
|
+
allowedTools: [],
|
|
127
|
+
});
|
|
128
|
+
const parsed = JSON.parse(result.result);
|
|
129
|
+
if (!parsed.slug || !parsed.name || !parsed.description) {
|
|
130
|
+
throw new Error('Missing required fields in AI response');
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
slug: this.toSlug(parsed.slug),
|
|
134
|
+
name: parsed.name,
|
|
135
|
+
description: parsed.description,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
// Fallback to regex-based slug generation
|
|
140
|
+
return {
|
|
141
|
+
slug: this.toSlug(userInput),
|
|
142
|
+
name: userInput,
|
|
143
|
+
description: userInput,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
toSlug(text) {
|
|
148
|
+
return text
|
|
149
|
+
.toLowerCase()
|
|
150
|
+
.replace(/[^a-z0-9\s-]/g, '')
|
|
151
|
+
.replace(/\s+/g, '-')
|
|
152
|
+
.replace(/-+/g, '-')
|
|
153
|
+
.replace(/^-|-$/g, '');
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
CreateFeatureUseCase = __decorate([
|
|
157
|
+
injectable(),
|
|
158
|
+
__param(0, inject('IFeatureRepository')),
|
|
159
|
+
__param(1, inject('IWorktreeService')),
|
|
160
|
+
__param(2, inject('IFeatureAgentProcessService')),
|
|
161
|
+
__param(3, inject('IAgentRunRepository')),
|
|
162
|
+
__param(4, inject('ISpecInitializerService')),
|
|
163
|
+
__param(5, inject('IAgentExecutorFactory')),
|
|
164
|
+
__metadata("design:paramtypes", [Object, Object, Object, Object, Object, Object])
|
|
165
|
+
], CreateFeatureUseCase);
|
|
166
|
+
export { CreateFeatureUseCase };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete Feature Use Case
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates feature deletion including:
|
|
5
|
+
* - Cancelling any running/pending agent runs
|
|
6
|
+
* - Removing the git worktree
|
|
7
|
+
* - Deleting the feature record
|
|
8
|
+
*
|
|
9
|
+
* Business Rules:
|
|
10
|
+
* - Throws if the feature does not exist
|
|
11
|
+
* - Cancels running/pending agent runs before deletion
|
|
12
|
+
* - Gracefully handles worktree removal failures
|
|
13
|
+
*/
|
|
14
|
+
import type { Feature } from '../../../domain/generated/output.js';
|
|
15
|
+
import type { IFeatureRepository } from '../../ports/output/feature-repository.interface.js';
|
|
16
|
+
import type { IWorktreeService } from '../../ports/output/worktree-service.interface.js';
|
|
17
|
+
import type { IFeatureAgentProcessService } from '../../ports/output/feature-agent-process.interface.js';
|
|
18
|
+
import type { IAgentRunRepository } from '../../ports/output/agent-run-repository.interface.js';
|
|
19
|
+
export declare class DeleteFeatureUseCase {
|
|
20
|
+
private readonly featureRepo;
|
|
21
|
+
private readonly worktreeService;
|
|
22
|
+
private readonly processService;
|
|
23
|
+
private readonly runRepo;
|
|
24
|
+
constructor(featureRepo: IFeatureRepository, worktreeService: IWorktreeService, processService: IFeatureAgentProcessService, runRepo: IAgentRunRepository);
|
|
25
|
+
execute(featureId: string): Promise<Feature>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=delete-feature.use-case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-feature.use-case.d.ts","sourceRoot":"","sources":["../../../../../src/application/use-cases/features/delete-feature.use-case.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAEnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACzG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAEhG,qBACa,oBAAoB;IAEC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAE5D,OAAO,CAAC,QAAQ,CAAC,cAAc;IACA,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAJR,WAAW,EAAE,kBAAkB,EACjC,eAAe,EAAE,gBAAgB,EAE7D,cAAc,EAAE,2BAA2B,EACZ,OAAO,EAAE,mBAAmB;IAGxE,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAyCnD"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete Feature Use Case
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates feature deletion including:
|
|
5
|
+
* - Cancelling any running/pending agent runs
|
|
6
|
+
* - Removing the git worktree
|
|
7
|
+
* - Deleting the feature record
|
|
8
|
+
*
|
|
9
|
+
* Business Rules:
|
|
10
|
+
* - Throws if the feature does not exist
|
|
11
|
+
* - Cancels running/pending agent runs before deletion
|
|
12
|
+
* - Gracefully handles worktree removal failures
|
|
13
|
+
*/
|
|
14
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
};
|
|
20
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
21
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
+
};
|
|
23
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
24
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
25
|
+
};
|
|
26
|
+
import { injectable, inject } from 'tsyringe';
|
|
27
|
+
import { AgentRunStatus } from '../../../domain/generated/output.js';
|
|
28
|
+
let DeleteFeatureUseCase = class DeleteFeatureUseCase {
|
|
29
|
+
featureRepo;
|
|
30
|
+
worktreeService;
|
|
31
|
+
processService;
|
|
32
|
+
runRepo;
|
|
33
|
+
constructor(featureRepo, worktreeService, processService, runRepo) {
|
|
34
|
+
this.featureRepo = featureRepo;
|
|
35
|
+
this.worktreeService = worktreeService;
|
|
36
|
+
this.processService = processService;
|
|
37
|
+
this.runRepo = runRepo;
|
|
38
|
+
}
|
|
39
|
+
async execute(featureId) {
|
|
40
|
+
// 1. Find feature (exact or prefix match)
|
|
41
|
+
const feature = (await this.featureRepo.findById(featureId)) ??
|
|
42
|
+
(await this.featureRepo.findByIdPrefix(featureId));
|
|
43
|
+
if (!feature) {
|
|
44
|
+
throw new Error(`Feature not found: "${featureId}"`);
|
|
45
|
+
}
|
|
46
|
+
// 2. Cancel running/pending agent run if present
|
|
47
|
+
if (feature.agentRunId) {
|
|
48
|
+
const run = await this.runRepo.findById(feature.agentRunId);
|
|
49
|
+
if (run && (run.status === AgentRunStatus.running || run.status === AgentRunStatus.pending)) {
|
|
50
|
+
// Kill the OS process if still alive
|
|
51
|
+
if (run.pid && this.processService.isAlive(run.pid)) {
|
|
52
|
+
try {
|
|
53
|
+
process.kill(run.pid);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// Process may have already exited
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
await this.runRepo.updateStatus(run.id, AgentRunStatus.cancelled);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// 3. Remove worktree (ignore errors if already removed)
|
|
63
|
+
const worktreePath = this.worktreeService.getWorktreePath(feature.repositoryPath, feature.branch);
|
|
64
|
+
try {
|
|
65
|
+
await this.worktreeService.remove(worktreePath);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// Worktree might already be removed - that's fine
|
|
69
|
+
}
|
|
70
|
+
// 4. Delete feature record
|
|
71
|
+
await this.featureRepo.delete(feature.id);
|
|
72
|
+
return feature;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
DeleteFeatureUseCase = __decorate([
|
|
76
|
+
injectable(),
|
|
77
|
+
__param(0, inject('IFeatureRepository')),
|
|
78
|
+
__param(1, inject('IWorktreeService')),
|
|
79
|
+
__param(2, inject('IFeatureAgentProcessService')),
|
|
80
|
+
__param(3, inject('IAgentRunRepository')),
|
|
81
|
+
__metadata("design:paramtypes", [Object, Object, Object, Object])
|
|
82
|
+
], DeleteFeatureUseCase);
|
|
83
|
+
export { DeleteFeatureUseCase };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List Features Use Case
|
|
3
|
+
*
|
|
4
|
+
* Retrieves features with optional filtering by repository path or lifecycle.
|
|
5
|
+
*
|
|
6
|
+
* Business Rules:
|
|
7
|
+
* - Returns all features when no filters are provided
|
|
8
|
+
* - Filters are passed through to the repository
|
|
9
|
+
*/
|
|
10
|
+
import type { Feature } from '../../../domain/generated/output.js';
|
|
11
|
+
import type { IFeatureRepository, FeatureListFilters } from '../../ports/output/feature-repository.interface.js';
|
|
12
|
+
export declare class ListFeaturesUseCase {
|
|
13
|
+
private readonly featureRepo;
|
|
14
|
+
constructor(featureRepo: IFeatureRepository);
|
|
15
|
+
execute(filters?: FeatureListFilters): Promise<Feature[]>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=list-features.use-case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-features.use-case.d.ts","sourceRoot":"","sources":["../../../../../src/application/use-cases/features/list-features.use-case.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,oDAAoD,CAAC;AAE5D,qBACa,mBAAmB;IAG5B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,kBAAkB;IAG5C,OAAO,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAGhE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List Features Use Case
|
|
3
|
+
*
|
|
4
|
+
* Retrieves features with optional filtering by repository path or lifecycle.
|
|
5
|
+
*
|
|
6
|
+
* Business Rules:
|
|
7
|
+
* - Returns all features when no filters are provided
|
|
8
|
+
* - Filters are passed through to the repository
|
|
9
|
+
*/
|
|
10
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
+
};
|
|
19
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
20
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
21
|
+
};
|
|
22
|
+
import { injectable, inject } from 'tsyringe';
|
|
23
|
+
let ListFeaturesUseCase = class ListFeaturesUseCase {
|
|
24
|
+
featureRepo;
|
|
25
|
+
constructor(featureRepo) {
|
|
26
|
+
this.featureRepo = featureRepo;
|
|
27
|
+
}
|
|
28
|
+
async execute(filters) {
|
|
29
|
+
return this.featureRepo.list(filters);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
ListFeaturesUseCase = __decorate([
|
|
33
|
+
injectable(),
|
|
34
|
+
__param(0, inject('IFeatureRepository')),
|
|
35
|
+
__metadata("design:paramtypes", [Object])
|
|
36
|
+
], ListFeaturesUseCase);
|
|
37
|
+
export { ListFeaturesUseCase };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resume Feature Use Case
|
|
3
|
+
*
|
|
4
|
+
* Resumes an interrupted, failed, or waiting_approval feature agent run.
|
|
5
|
+
* Creates a new AgentRun record and spawns a worker with --resume flag.
|
|
6
|
+
*/
|
|
7
|
+
import type { Feature, AgentRun } from '../../../domain/generated/output.js';
|
|
8
|
+
import type { IFeatureRepository } from '../../ports/output/feature-repository.interface.js';
|
|
9
|
+
import type { IAgentRunRepository } from '../../ports/output/agent-run-repository.interface.js';
|
|
10
|
+
import type { IFeatureAgentProcessService } from '../../ports/output/feature-agent-process.interface.js';
|
|
11
|
+
import type { IWorktreeService } from '../../ports/output/worktree-service.interface.js';
|
|
12
|
+
export interface ResumeFeatureResult {
|
|
13
|
+
feature: Feature;
|
|
14
|
+
newRun: AgentRun;
|
|
15
|
+
}
|
|
16
|
+
export declare class ResumeFeatureUseCase {
|
|
17
|
+
private readonly featureRepo;
|
|
18
|
+
private readonly runRepo;
|
|
19
|
+
private readonly processService;
|
|
20
|
+
private readonly worktreeService;
|
|
21
|
+
constructor(featureRepo: IFeatureRepository, runRepo: IAgentRunRepository, processService: IFeatureAgentProcessService, worktreeService: IWorktreeService);
|
|
22
|
+
execute(featureId: string): Promise<ResumeFeatureResult>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=resume-feature.use-case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume-feature.use-case.d.ts","sourceRoot":"","sources":["../../../../../src/application/use-cases/features/resume-feature.use-case.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAChG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACzG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAQzF,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,QAAQ,CAAC;CAClB;AAED,qBACa,oBAAoB;IAG7B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAE5B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAExB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAE/B,OAAO,CAAC,QAAQ,CAAC,eAAe;gBANf,WAAW,EAAE,kBAAkB,EAE/B,OAAO,EAAE,mBAAmB,EAE5B,cAAc,EAAE,2BAA2B,EAE3C,eAAe,EAAE,gBAAgB;IAG9C,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAwE/D"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resume Feature Use Case
|
|
3
|
+
*
|
|
4
|
+
* Resumes an interrupted, failed, or waiting_approval feature agent run.
|
|
5
|
+
* Creates a new AgentRun record and spawns a worker with --resume flag.
|
|
6
|
+
*/
|
|
7
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
8
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12
|
+
};
|
|
13
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
15
|
+
};
|
|
16
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
17
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
18
|
+
};
|
|
19
|
+
import { injectable, inject } from 'tsyringe';
|
|
20
|
+
import { randomUUID } from 'node:crypto';
|
|
21
|
+
import { AgentRunStatus } from '../../../domain/generated/output.js';
|
|
22
|
+
const RESUMABLE_STATUSES = new Set([
|
|
23
|
+
AgentRunStatus.interrupted,
|
|
24
|
+
AgentRunStatus.failed,
|
|
25
|
+
AgentRunStatus.waitingApproval,
|
|
26
|
+
]);
|
|
27
|
+
let ResumeFeatureUseCase = class ResumeFeatureUseCase {
|
|
28
|
+
featureRepo;
|
|
29
|
+
runRepo;
|
|
30
|
+
processService;
|
|
31
|
+
worktreeService;
|
|
32
|
+
constructor(featureRepo, runRepo, processService, worktreeService) {
|
|
33
|
+
this.featureRepo = featureRepo;
|
|
34
|
+
this.runRepo = runRepo;
|
|
35
|
+
this.processService = processService;
|
|
36
|
+
this.worktreeService = worktreeService;
|
|
37
|
+
}
|
|
38
|
+
async execute(featureId) {
|
|
39
|
+
// Resolve feature by exact ID or prefix
|
|
40
|
+
const feature = (await this.featureRepo.findById(featureId)) ??
|
|
41
|
+
(await this.featureRepo.findByIdPrefix(featureId));
|
|
42
|
+
if (!feature) {
|
|
43
|
+
throw new Error(`Feature not found: ${featureId}`);
|
|
44
|
+
}
|
|
45
|
+
// Load the most recent agent run
|
|
46
|
+
if (!feature.agentRunId) {
|
|
47
|
+
throw new Error(`No agent run found for feature "${feature.name}"`);
|
|
48
|
+
}
|
|
49
|
+
const lastRun = await this.runRepo.findById(feature.agentRunId);
|
|
50
|
+
if (!lastRun) {
|
|
51
|
+
throw new Error(`No agent run found for feature "${feature.name}"`);
|
|
52
|
+
}
|
|
53
|
+
// Validate the run is in a resumable state
|
|
54
|
+
if (lastRun.status === AgentRunStatus.running) {
|
|
55
|
+
throw new Error('Agent is still running — stop it first before resuming');
|
|
56
|
+
}
|
|
57
|
+
if (lastRun.status === AgentRunStatus.completed) {
|
|
58
|
+
throw new Error('Agent already completed successfully');
|
|
59
|
+
}
|
|
60
|
+
if (!RESUMABLE_STATUSES.has(lastRun.status)) {
|
|
61
|
+
throw new Error(`Agent run is not in a resumable state (status: ${lastRun.status})`);
|
|
62
|
+
}
|
|
63
|
+
// Create a new agent run record that continues the same thread
|
|
64
|
+
const now = new Date();
|
|
65
|
+
const newRunId = randomUUID();
|
|
66
|
+
const newRun = {
|
|
67
|
+
id: newRunId,
|
|
68
|
+
agentType: lastRun.agentType,
|
|
69
|
+
agentName: lastRun.agentName,
|
|
70
|
+
status: AgentRunStatus.pending,
|
|
71
|
+
prompt: lastRun.prompt,
|
|
72
|
+
threadId: lastRun.threadId, // Same thread for checkpoint continuity
|
|
73
|
+
featureId: feature.id,
|
|
74
|
+
repositoryPath: feature.repositoryPath,
|
|
75
|
+
approvalMode: lastRun.approvalMode,
|
|
76
|
+
createdAt: now,
|
|
77
|
+
updatedAt: now,
|
|
78
|
+
};
|
|
79
|
+
await this.runRepo.create(newRun);
|
|
80
|
+
// Update feature to reference the new run
|
|
81
|
+
await this.featureRepo.update({
|
|
82
|
+
...feature,
|
|
83
|
+
agentRunId: newRunId,
|
|
84
|
+
updatedAt: now,
|
|
85
|
+
});
|
|
86
|
+
// Derive worktree path and spawn resume worker
|
|
87
|
+
const worktreePath = this.worktreeService.getWorktreePath(feature.repositoryPath, feature.branch);
|
|
88
|
+
this.processService.spawn(feature.id, newRunId, feature.repositoryPath, worktreePath, worktreePath, { resume: true, approvalMode: lastRun.approvalMode });
|
|
89
|
+
return { feature, newRun };
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
ResumeFeatureUseCase = __decorate([
|
|
93
|
+
injectable(),
|
|
94
|
+
__param(0, inject('IFeatureRepository')),
|
|
95
|
+
__param(1, inject('IAgentRunRepository')),
|
|
96
|
+
__param(2, inject('IFeatureAgentProcessService')),
|
|
97
|
+
__param(3, inject('IWorktreeService')),
|
|
98
|
+
__metadata("design:paramtypes", [Object, Object, Object, Object])
|
|
99
|
+
], ResumeFeatureUseCase);
|
|
100
|
+
export { ResumeFeatureUseCase };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Show Feature Use Case
|
|
3
|
+
*
|
|
4
|
+
* Retrieves a single feature by its ID.
|
|
5
|
+
*
|
|
6
|
+
* Business Rules:
|
|
7
|
+
* - Throws if the feature does not exist
|
|
8
|
+
* - Error message includes the requested ID for debugging
|
|
9
|
+
*/
|
|
10
|
+
import type { Feature } from '../../../domain/generated/output.js';
|
|
11
|
+
import type { IFeatureRepository } from '../../ports/output/feature-repository.interface.js';
|
|
12
|
+
export declare class ShowFeatureUseCase {
|
|
13
|
+
private readonly featureRepo;
|
|
14
|
+
constructor(featureRepo: IFeatureRepository);
|
|
15
|
+
execute(featureId: string): Promise<Feature>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=show-feature.use-case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show-feature.use-case.d.ts","sourceRoot":"","sources":["../../../../../src/application/use-cases/features/show-feature.use-case.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAE7F,qBACa,kBAAkB;IAG3B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,kBAAkB;IAG5C,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAUnD"}
|