@agentic-sdlc-kit/cli 0.0.0-stage → 0.9.1
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/LICENSE +21 -0
- package/README.md +32 -2
- package/dist/application/agent/execution-store.d.ts +55 -0
- package/dist/application/agent/execution-store.d.ts.map +1 -0
- package/dist/application/agent/execution-store.js +91 -0
- package/dist/application/agent/execution-store.js.map +1 -0
- package/dist/application/agent/gateway.d.ts +74 -0
- package/dist/application/agent/gateway.d.ts.map +1 -0
- package/dist/application/agent/gateway.js +580 -0
- package/dist/application/agent/gateway.js.map +1 -0
- package/dist/application/agent/index.d.ts +6 -0
- package/dist/application/agent/index.d.ts.map +1 -0
- package/dist/application/agent/index.js +18 -0
- package/dist/application/agent/index.js.map +1 -0
- package/dist/application/agent/orchestrator.d.ts +76 -0
- package/dist/application/agent/orchestrator.d.ts.map +1 -0
- package/dist/application/agent/orchestrator.js +422 -0
- package/dist/application/agent/orchestrator.js.map +1 -0
- package/dist/application/agent/providers/claude-code/claude-argv.d.ts +15 -0
- package/dist/application/agent/providers/claude-code/claude-argv.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/claude-argv.js +98 -0
- package/dist/application/agent/providers/claude-code/claude-argv.js.map +1 -0
- package/dist/application/agent/providers/claude-code/index.d.ts +7 -0
- package/dist/application/agent/providers/claude-code/index.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/index.js +13 -0
- package/dist/application/agent/providers/claude-code/index.js.map +1 -0
- package/dist/application/agent/providers/claude-code/mod-parity.d.ts +15 -0
- package/dist/application/agent/providers/claude-code/mod-parity.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/mod-parity.js +41 -0
- package/dist/application/agent/providers/claude-code/mod-parity.js.map +1 -0
- package/dist/application/agent/providers/claude-code/permission-config.d.ts +59 -0
- package/dist/application/agent/providers/claude-code/permission-config.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/permission-config.js +189 -0
- package/dist/application/agent/providers/claude-code/permission-config.js.map +1 -0
- package/dist/application/agent/providers/claude-code/provider.d.ts +38 -0
- package/dist/application/agent/providers/claude-code/provider.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/provider.js +577 -0
- package/dist/application/agent/providers/claude-code/provider.js.map +1 -0
- package/dist/application/agent/providers/claude-code/resume-store.d.ts +25 -0
- package/dist/application/agent/providers/claude-code/resume-store.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/resume-store.js +120 -0
- package/dist/application/agent/providers/claude-code/resume-store.js.map +1 -0
- package/dist/application/agent/providers/claude-code/stream-parser.d.ts +50 -0
- package/dist/application/agent/providers/claude-code/stream-parser.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/stream-parser.js +129 -0
- package/dist/application/agent/providers/claude-code/stream-parser.js.map +1 -0
- package/dist/application/agent/test-fixture.d.ts +15 -0
- package/dist/application/agent/test-fixture.d.ts.map +1 -0
- package/dist/application/agent/test-fixture.js +93 -0
- package/dist/application/agent/test-fixture.js.map +1 -0
- package/dist/application/agent/workspace.d.ts +24 -0
- package/dist/application/agent/workspace.d.ts.map +1 -0
- package/dist/application/agent/workspace.js +139 -0
- package/dist/application/agent/workspace.js.map +1 -0
- package/dist/application/dispatcher.d.ts +13 -0
- package/dist/application/dispatcher.d.ts.map +1 -0
- package/dist/application/dispatcher.js +116 -0
- package/dist/application/dispatcher.js.map +1 -0
- package/dist/application/index.d.ts +5 -0
- package/dist/application/index.d.ts.map +1 -0
- package/dist/application/index.js +6 -0
- package/dist/application/index.js.map +1 -0
- package/dist/application/registry.d.ts +8 -0
- package/dist/application/registry.d.ts.map +1 -0
- package/dist/application/registry.js +17 -0
- package/dist/application/registry.js.map +1 -0
- package/dist/application/version.d.ts +2 -0
- package/dist/application/version.d.ts.map +1 -0
- package/dist/application/version.js +7 -0
- package/dist/application/version.js.map +1 -0
- package/dist/commands/attach-exclude.d.ts +8 -0
- package/dist/commands/attach-exclude.d.ts.map +1 -0
- package/dist/commands/attach-exclude.js +48 -0
- package/dist/commands/attach-exclude.js.map +1 -0
- package/dist/commands/attach-git.d.ts +11 -0
- package/dist/commands/attach-git.d.ts.map +1 -0
- package/dist/commands/attach-git.js +40 -0
- package/dist/commands/attach-git.js.map +1 -0
- package/dist/commands/attach-store.d.ts +10 -0
- package/dist/commands/attach-store.d.ts.map +1 -0
- package/dist/commands/attach-store.js +107 -0
- package/dist/commands/attach-store.js.map +1 -0
- package/dist/commands/attach.d.ts +8 -0
- package/dist/commands/attach.d.ts.map +1 -0
- package/dist/commands/attach.js +124 -0
- package/dist/commands/attach.js.map +1 -0
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +68 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/elicit.d.ts +3 -0
- package/dist/commands/elicit.d.ts.map +1 -0
- package/dist/commands/elicit.js +163 -0
- package/dist/commands/elicit.js.map +1 -0
- package/dist/commands/evolve.d.ts +3 -0
- package/dist/commands/evolve.d.ts.map +1 -0
- package/dist/commands/evolve.js +165 -0
- package/dist/commands/evolve.js.map +1 -0
- package/dist/commands/feature.d.ts +13 -0
- package/dist/commands/feature.d.ts.map +1 -0
- package/dist/commands/feature.js +326 -0
- package/dist/commands/feature.js.map +1 -0
- package/dist/commands/fix.d.ts +4 -0
- package/dist/commands/fix.d.ts.map +1 -0
- package/dist/commands/fix.js +53 -0
- package/dist/commands/fix.js.map +1 -0
- package/dist/commands/help.d.ts +4 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +32 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/host-apply.d.ts +12 -0
- package/dist/commands/host-apply.d.ts.map +1 -0
- package/dist/commands/host-apply.js +43 -0
- package/dist/commands/host-apply.js.map +1 -0
- package/dist/commands/host.d.ts +3 -0
- package/dist/commands/host.d.ts.map +1 -0
- package/dist/commands/host.js +107 -0
- package/dist/commands/host.js.map +1 -0
- package/dist/commands/index.d.ts +25 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +26 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +92 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/inspect.d.ts +3 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +64 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/install.d.ts +3 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +337 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/journal.d.ts +3 -0
- package/dist/commands/journal.d.ts.map +1 -0
- package/dist/commands/journal.js +107 -0
- package/dist/commands/journal.js.map +1 -0
- package/dist/commands/memory.d.ts +3 -0
- package/dist/commands/memory.d.ts.map +1 -0
- package/dist/commands/memory.js +85 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/new.d.ts +3 -0
- package/dist/commands/new.d.ts.map +1 -0
- package/dist/commands/new.js +68 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/commands/next.d.ts +3 -0
- package/dist/commands/next.d.ts.map +1 -0
- package/dist/commands/next.js +107 -0
- package/dist/commands/next.js.map +1 -0
- package/dist/commands/optimize.d.ts +3 -0
- package/dist/commands/optimize.d.ts.map +1 -0
- package/dist/commands/optimize.js +28 -0
- package/dist/commands/optimize.js.map +1 -0
- package/dist/commands/plugin-linker.d.ts +43 -0
- package/dist/commands/plugin-linker.d.ts.map +1 -0
- package/dist/commands/plugin-linker.js +216 -0
- package/dist/commands/plugin-linker.js.map +1 -0
- package/dist/commands/refactor.d.ts +3 -0
- package/dist/commands/refactor.d.ts.map +1 -0
- package/dist/commands/refactor.js +32 -0
- package/dist/commands/refactor.js.map +1 -0
- package/dist/commands/skills-install-commit.d.ts +34 -0
- package/dist/commands/skills-install-commit.d.ts.map +1 -0
- package/dist/commands/skills-install-commit.js +113 -0
- package/dist/commands/skills-install-commit.js.map +1 -0
- package/dist/commands/skills-install-manifest.d.ts +35 -0
- package/dist/commands/skills-install-manifest.d.ts.map +1 -0
- package/dist/commands/skills-install-manifest.js +89 -0
- package/dist/commands/skills-install-manifest.js.map +1 -0
- package/dist/commands/skills-install-report.d.ts +12 -0
- package/dist/commands/skills-install-report.d.ts.map +1 -0
- package/dist/commands/skills-install-report.js +44 -0
- package/dist/commands/skills-install-report.js.map +1 -0
- package/dist/commands/skills-install-secure.d.ts +14 -0
- package/dist/commands/skills-install-secure.d.ts.map +1 -0
- package/dist/commands/skills-install-secure.js +96 -0
- package/dist/commands/skills-install-secure.js.map +1 -0
- package/dist/commands/skills-install.d.ts +15 -0
- package/dist/commands/skills-install.d.ts.map +1 -0
- package/dist/commands/skills-install.js +182 -0
- package/dist/commands/skills-install.js.map +1 -0
- package/dist/commands/skills.d.ts +3 -0
- package/dist/commands/skills.d.ts.map +1 -0
- package/dist/commands/skills.js +217 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/commands/types.d.ts +19 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +7 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/commands/uninstall.d.ts +3 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +113 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/validate-plan.d.ts +3 -0
- package/dist/commands/validate-plan.d.ts.map +1 -0
- package/dist/commands/validate-plan.js +62 -0
- package/dist/commands/validate-plan.js.map +1 -0
- package/dist/commands/validate-spec.d.ts +3 -0
- package/dist/commands/validate-spec.d.ts.map +1 -0
- package/dist/commands/validate-spec.js +62 -0
- package/dist/commands/validate-spec.js.map +1 -0
- package/dist/commands/verify.d.ts +3 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +103 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/commands/version.d.ts +3 -0
- package/dist/commands/version.d.ts.map +1 -0
- package/dist/commands/version.js +12 -0
- package/dist/commands/version.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/output/formatter.d.ts +2 -0
- package/dist/output/formatter.d.ts.map +1 -0
- package/dist/output/formatter.js +10 -0
- package/dist/output/formatter.js.map +1 -0
- package/dist/output/index.d.ts +2 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +3 -0
- package/dist/output/index.js.map +1 -0
- package/package.json +37 -3
- package/src/application/agent/execution-store.ts +163 -0
- package/src/application/agent/gateway.test.ts +529 -0
- package/src/application/agent/gateway.ts +744 -0
- package/src/application/agent/index.ts +18 -0
- package/src/application/agent/orchestrator.test.ts +341 -0
- package/src/application/agent/orchestrator.ts +629 -0
- package/src/application/agent/providers/claude-code/claude-argv.ts +119 -0
- package/src/application/agent/providers/claude-code/claude-code-smoke.test.ts +139 -0
- package/src/application/agent/providers/claude-code/fixtures/fake-claude.mjs +125 -0
- package/src/application/agent/providers/claude-code/index.ts +28 -0
- package/src/application/agent/providers/claude-code/mod-parity.ts +50 -0
- package/src/application/agent/providers/claude-code/permission-config.test.ts +221 -0
- package/src/application/agent/providers/claude-code/permission-config.ts +242 -0
- package/src/application/agent/providers/claude-code/provider.test.ts +378 -0
- package/src/application/agent/providers/claude-code/provider.ts +717 -0
- package/src/application/agent/providers/claude-code/resume-store.test.ts +161 -0
- package/src/application/agent/providers/claude-code/resume-store.ts +157 -0
- package/src/application/agent/providers/claude-code/stream-parser.ts +166 -0
- package/src/application/agent/test-fixture.ts +131 -0
- package/src/application/agent/workspace.test.ts +104 -0
- package/src/application/agent/workspace.ts +156 -0
- package/src/application/dispatcher.test.ts +108 -0
- package/src/application/dispatcher.ts +106 -0
- package/src/application/index.ts +5 -0
- package/src/application/registry.ts +24 -0
- package/src/application/version.ts +7 -0
- package/src/commands/attach-exclude.ts +50 -0
- package/src/commands/attach-git.ts +50 -0
- package/src/commands/attach-store.ts +107 -0
- package/src/commands/attach.test.ts +192 -0
- package/src/commands/attach.ts +143 -0
- package/src/commands/clse.test.ts +181 -0
- package/src/commands/doctor.test.ts +29 -0
- package/src/commands/doctor.ts +78 -0
- package/src/commands/elicit.test.ts +111 -0
- package/src/commands/elicit.ts +188 -0
- package/src/commands/evolve.ts +209 -0
- package/src/commands/feature.test.ts +323 -0
- package/src/commands/feature.ts +405 -0
- package/src/commands/fix.test.ts +118 -0
- package/src/commands/fix.ts +58 -0
- package/src/commands/help.test.ts +33 -0
- package/src/commands/help.ts +35 -0
- package/src/commands/host-apply.ts +61 -0
- package/src/commands/host.test.ts +120 -0
- package/src/commands/host.ts +125 -0
- package/src/commands/index.ts +25 -0
- package/src/commands/init.test.ts +87 -0
- package/src/commands/init.ts +110 -0
- package/src/commands/inspect.test.ts +57 -0
- package/src/commands/inspect.ts +73 -0
- package/src/commands/install.test.ts +92 -0
- package/src/commands/install.ts +389 -0
- package/src/commands/journal.ts +118 -0
- package/src/commands/memory.ts +96 -0
- package/src/commands/new.test.ts +44 -0
- package/src/commands/new.ts +77 -0
- package/src/commands/next.test.ts +241 -0
- package/src/commands/next.ts +124 -0
- package/src/commands/optimize.ts +30 -0
- package/src/commands/plugin-linker.test.ts +219 -0
- package/src/commands/plugin-linker.ts +244 -0
- package/src/commands/refactor.ts +34 -0
- package/src/commands/skills-install-commit.ts +149 -0
- package/src/commands/skills-install-manifest.ts +124 -0
- package/src/commands/skills-install-report.ts +60 -0
- package/src/commands/skills-install-secure.ts +113 -0
- package/src/commands/skills-install.ts +245 -0
- package/src/commands/skills.test.ts +449 -0
- package/src/commands/skills.ts +247 -0
- package/src/commands/stack-commands.test.ts +67 -0
- package/src/commands/tier-c-conformance.test.ts +194 -0
- package/src/commands/types.ts +26 -0
- package/src/commands/uninstall.test.ts +122 -0
- package/src/commands/uninstall.ts +116 -0
- package/src/commands/validate-plan.test.ts +107 -0
- package/src/commands/validate-plan.ts +67 -0
- package/src/commands/validate-spec.test.ts +59 -0
- package/src/commands/validate-spec.ts +68 -0
- package/src/commands/verify.test.ts +117 -0
- package/src/commands/verify.ts +112 -0
- package/src/commands/version.test.ts +11 -0
- package/src/commands/version.ts +14 -0
- package/src/index.ts +30 -0
- package/src/output/formatter.ts +10 -0
- package/src/output/index.ts +2 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { deriveClaudeCodePermissionConfig, inferCapabilityFromBashCommand, inferCapabilityFromToolUse, bashRulesForCapability, BASH_RULE_CAPABILITIES, CLAUDE_CODE_SUPPORTED_CAPABILITIES, type ClaudeCodePermissionConfig, type ClaudeCodePermissionMode, } from './permission-config.js';
|
|
2
|
+
export { buildClaudeArgv, buildClaudeResumeArgv, CLAUDE_VERSION_ARGS, type ClaudeArgv } from './claude-argv.js';
|
|
3
|
+
export { ClaudeStreamParser, capabilityOfToolUse, type ClaudeFinalResult, type StreamObservation } from './stream-parser.js';
|
|
4
|
+
export { generateResumeToken, loadSessionRecord, saveSessionRecord, verifyResumeToken, type StoredSessionRecord, } from './resume-store.js';
|
|
5
|
+
export { ensureRuntimeModsActive, type ModsParityResult } from './mod-parity.js';
|
|
6
|
+
export { ClaudeCodeProvider, type ClaudeCodeProviderOptions } from './provider.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/application/agent/providers/claude-code/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,gCAAgC,EAChC,8BAA8B,EAC9B,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,kCAAkC,EAClC,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,GAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAChH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC7H,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,mBAAmB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,uBAAuB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// packages/cli/src/application/agent/providers/claude-code/index.ts
|
|
2
|
+
//
|
|
3
|
+
// Barrel for the secure Claude Code provider (ADR-0019 PR4). The provider
|
|
4
|
+
// adapter boundary (Kit -> agent) is intentionally SEPARATE from the
|
|
5
|
+
// claude-code-adapter package, which remains the HOST adapter boundary
|
|
6
|
+
// (agent -> Kit); see ADR-0019 §2 and packages/claude-code-adapter/src/index.ts.
|
|
7
|
+
export { deriveClaudeCodePermissionConfig, inferCapabilityFromBashCommand, inferCapabilityFromToolUse, bashRulesForCapability, BASH_RULE_CAPABILITIES, CLAUDE_CODE_SUPPORTED_CAPABILITIES, } from './permission-config.js';
|
|
8
|
+
export { buildClaudeArgv, buildClaudeResumeArgv, CLAUDE_VERSION_ARGS } from './claude-argv.js';
|
|
9
|
+
export { ClaudeStreamParser, capabilityOfToolUse } from './stream-parser.js';
|
|
10
|
+
export { generateResumeToken, loadSessionRecord, saveSessionRecord, verifyResumeToken, } from './resume-store.js';
|
|
11
|
+
export { ensureRuntimeModsActive } from './mod-parity.js';
|
|
12
|
+
export { ClaudeCodeProvider } from './provider.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/application/agent/providers/claude-code/index.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,0EAA0E;AAC1E,qEAAqE;AACrE,uEAAuE;AACvE,iFAAiF;AAEjF,OAAO,EACL,gCAAgC,EAChC,8BAA8B,EAC9B,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,kCAAkC,GAGnC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,EAAmB,MAAM,kBAAkB,CAAC;AAChH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAkD,MAAM,oBAAoB,CAAC;AAC7H,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,GAElB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,uBAAuB,EAAyB,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAkC,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type PluginLinkResult } from '../../../../commands/plugin-linker.js';
|
|
2
|
+
export interface ModsParityResult {
|
|
3
|
+
/** True when every runtime mod is linked into the workspace. */
|
|
4
|
+
readonly active: boolean;
|
|
5
|
+
readonly results: readonly PluginLinkResult[];
|
|
6
|
+
/** Honest human-readable note for the execution record. */
|
|
7
|
+
readonly note: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Ensure the kit's runtime Mods are linked into the execution workspace.
|
|
11
|
+
* Best-effort with honest reporting — see the module header for the
|
|
12
|
+
* fail-open reasoning and its limits.
|
|
13
|
+
*/
|
|
14
|
+
export declare function ensureRuntimeModsActive(workspaceRoot: string): Promise<ModsParityResult>;
|
|
15
|
+
//# sourceMappingURL=mod-parity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod-parity.d.ts","sourceRoot":"","sources":["../../../../../src/application/agent/providers/claude-code/mod-parity.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAElG,MAAM,WAAW,gBAAgB;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAU9F"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// packages/cli/src/application/agent/providers/claude-code/mod-parity.ts
|
|
2
|
+
//
|
|
3
|
+
// Runtime Mods enforcement parity (ADR-0019 PR4; ADR-0020 §2).
|
|
4
|
+
//
|
|
5
|
+
// Two enforcement points derive from ONE canonical policy:
|
|
6
|
+
// 1. Claude Code's own permission system — the GENERATED representation
|
|
7
|
+
// (permission-config.ts) passed as session flags; enforced by Claude
|
|
8
|
+
// Code regardless of anything the kit does.
|
|
9
|
+
// 2. The kit's runtime Mods (sdlc-guard, secret-guard, model-router,
|
|
10
|
+
// run-observer) — Claude Code hook plugins the kit ships and links
|
|
11
|
+
// into the PROJECT's .claude/plugins/ (plugin-linker.ts).
|
|
12
|
+
//
|
|
13
|
+
// For a Mode 1 execution the agent runs inside the run's WORKTREE, so the
|
|
14
|
+
// Mods must be active there too — "parity". This module links them into
|
|
15
|
+
// the worktree (idempotent) and reports the result HONESTLY:
|
|
16
|
+
// - linked/already-linked → the second enforcement point is active;
|
|
17
|
+
// - not-found/incomplete → recorded as a note; the execution continues
|
|
18
|
+
// under enforcement point 1 (which is policy-derived and always
|
|
19
|
+
// present), and the summary states the Mods were NOT active.
|
|
20
|
+
//
|
|
21
|
+
// The linked .claude/plugins/ entries are runtime machinery, never project
|
|
22
|
+
// content: the repository's .gitignore excludes .claude/ so the run's
|
|
23
|
+
// evidence diff (the agent's actual footprint) stays clean.
|
|
24
|
+
import { linkRuntimePlugins } from '../../../../commands/plugin-linker.js';
|
|
25
|
+
/**
|
|
26
|
+
* Ensure the kit's runtime Mods are linked into the execution workspace.
|
|
27
|
+
* Best-effort with honest reporting — see the module header for the
|
|
28
|
+
* fail-open reasoning and its limits.
|
|
29
|
+
*/
|
|
30
|
+
export async function ensureRuntimeModsActive(workspaceRoot) {
|
|
31
|
+
const results = await linkRuntimePlugins(workspaceRoot);
|
|
32
|
+
const bad = results.filter((r) => r.status !== 'linked' && r.status !== 'already-linked');
|
|
33
|
+
const active = bad.length === 0;
|
|
34
|
+
const note = active
|
|
35
|
+
? `runtime Mods active in workspace (${results.map((r) => r.name).join(', ')})`
|
|
36
|
+
: `runtime Mods NOT fully active: ${bad.map((r) => `${r.name} (${r.status})`).join('; ')} — ` +
|
|
37
|
+
`the policy-derived Claude Code permission configuration remains enforced; ` +
|
|
38
|
+
`kit-level Mod guards are absent for this execution`;
|
|
39
|
+
return { active, results, note };
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=mod-parity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod-parity.js","sourceRoot":"","sources":["../../../../../src/application/agent/providers/claude-code/mod-parity.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,+DAA+D;AAC/D,EAAE;AACF,2DAA2D;AAC3D,0EAA0E;AAC1E,0EAA0E;AAC1E,iDAAiD;AACjD,uEAAuE;AACvE,wEAAwE;AACxE,+DAA+D;AAC/D,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,6DAA6D;AAC7D,sEAAsE;AACtE,0EAA0E;AAC1E,oEAAoE;AACpE,iEAAiE;AACjE,EAAE;AACF,2EAA2E;AAC3E,sEAAsE;AACtE,4DAA4D;AAE5D,OAAO,EAAE,kBAAkB,EAAyB,MAAM,uCAAuC,CAAC;AAUlG;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,aAAqB;IACjE,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACxD,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,KAAK,gBAAgB,CAAC,CAAC;IAC1F,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,MAAM;QACjB,CAAC,CAAC,qCAAqC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;QAC/E,CAAC,CAAC,kCAAkC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;YAC3F,4EAA4E;YAC5E,oDAAoD,CAAC;IACzD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type AgentCapability } from '@agentic-sdlc-kit/contracts';
|
|
2
|
+
/** Claude Code permission modes we are willing to generate. */
|
|
3
|
+
export type ClaudeCodePermissionMode = 'default' | 'acceptEdits' | 'plan';
|
|
4
|
+
/**
|
|
5
|
+
* The generated representation of the canonical policy for one execution.
|
|
6
|
+
* Purely derived: same snapshot in, same config out, no hidden state.
|
|
7
|
+
*/
|
|
8
|
+
export interface ClaudeCodePermissionConfig {
|
|
9
|
+
/** Rules pre-approving exactly what the policy granted (Claude Code rule syntax). */
|
|
10
|
+
readonly allowedTools: readonly string[];
|
|
11
|
+
/** Tools explicitly denied regardless of the allowlist. */
|
|
12
|
+
readonly disallowedTools: readonly string[];
|
|
13
|
+
/** Never `bypassPermissions` (ADR-0019 §6.5). */
|
|
14
|
+
readonly permissionMode: ClaudeCodePermissionMode;
|
|
15
|
+
/** Turn bound derived from budget.maxToolCalls (defense in depth; the gateway enforces the real count). */
|
|
16
|
+
readonly maxTurns: number | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Derive the Claude Code permission configuration from the canonical
|
|
20
|
+
* snapshot fields (the same fields the gateway freezes into the request).
|
|
21
|
+
*
|
|
22
|
+
* NOTE: takes the REQUEST's permission fields, which the gateway has already
|
|
23
|
+
* validated equal the canonical snapshot and whose policyHash the events
|
|
24
|
+
* must echo — so this derivation is traceable to the exact policy that
|
|
25
|
+
* authorized the execution.
|
|
26
|
+
*/
|
|
27
|
+
export declare function deriveClaudeCodePermissionConfig(permissions: {
|
|
28
|
+
capabilities: readonly AgentCapability[];
|
|
29
|
+
writablePaths: readonly string[];
|
|
30
|
+
networkAllowed: boolean;
|
|
31
|
+
}, budget: {
|
|
32
|
+
maxToolCalls: number;
|
|
33
|
+
}): ClaudeCodePermissionConfig;
|
|
34
|
+
/**
|
|
35
|
+
* Infer the capability an observed tool call exercises — the reverse
|
|
36
|
+
* direction of the derivation, from the SAME mapping table. Used for
|
|
37
|
+
* `tool.requested` events (observability only; an event never authorizes
|
|
38
|
+
* anything).
|
|
39
|
+
*
|
|
40
|
+
* Unmapped tools return undefined: the provider skips the tool.requested
|
|
41
|
+
* event rather than asserting a capability it cannot honestly name.
|
|
42
|
+
*/
|
|
43
|
+
export declare function inferCapabilityFromToolUse(toolName: string, input: unknown): AgentCapability | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Match a Bash command against the rule table. Longer (more specific)
|
|
46
|
+
* prefixes win, so `tsc --noEmit` resolves to process.typecheck, not the
|
|
47
|
+
* 1-token `tsc` build rule.
|
|
48
|
+
*/
|
|
49
|
+
export declare function inferCapabilityFromBashCommand(command: string): AgentCapability | undefined;
|
|
50
|
+
/** Exported for parity tests: the full rule table for one capability. */
|
|
51
|
+
export declare function bashRulesForCapability(capability: AgentCapability): readonly {
|
|
52
|
+
prefix: string;
|
|
53
|
+
capability: AgentCapability;
|
|
54
|
+
}[];
|
|
55
|
+
/** Exported for parity tests: all capabilities with Bash rules. */
|
|
56
|
+
export declare const BASH_RULE_CAPABILITIES: readonly AgentCapability[];
|
|
57
|
+
/** Capabilities the claude-code provider declares it can exercise. */
|
|
58
|
+
export declare const CLAUDE_CODE_SUPPORTED_CAPABILITIES: readonly AgentCapability[];
|
|
59
|
+
//# sourceMappingURL=permission-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-config.d.ts","sourceRoot":"","sources":["../../../../../src/application/agent/providers/claude-code/permission-config.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEvF,+DAA+D;AAC/D,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,aAAa,GAAG,MAAM,CAAC;AAE1E;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,qFAAqF;IACrF,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,2DAA2D;IAC3D,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,iDAAiD;IACjD,QAAQ,CAAC,cAAc,EAAE,wBAAwB,CAAC;IAClD,2GAA2G;IAC3G,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAsED;;;;;;;;GAQG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE;IACX,YAAY,EAAE,SAAS,eAAe,EAAE,CAAC;IACzC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,cAAc,EAAE,OAAO,CAAC;CACzB,EACD,MAAM,EAAE;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,GAC/B,0BAA0B,CA0C5B;AAMD;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,GACb,eAAe,GAAG,SAAS,CAM7B;AAaD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAU3F;AAED,yEAAyE;AACzE,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,eAAe,GAC1B,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,eAAe,CAAA;CAAE,EAAE,CAE5D;AAED,mEAAmE;AACnE,eAAO,MAAM,sBAAsB,EAAE,SAAS,eAAe,EAE5D,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,kCAAkC,EAAE,SAAS,eAAe,EAExE,CAAC"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
// packages/cli/src/application/agent/providers/claude-code/permission-config.ts
|
|
2
|
+
//
|
|
3
|
+
// The GENERATED runtime policy representation for Claude Code (ADR-0020 §2).
|
|
4
|
+
//
|
|
5
|
+
// ADR-0020 §2: runtime enforcement consumes a representation GENERATED from
|
|
6
|
+
// the canonical ExecutionPolicy snapshot — never a hand-maintained second
|
|
7
|
+
// policy. This module is that generator for the claude-code provider: it
|
|
8
|
+
// derives Claude Code's session permission configuration (tool allowlist,
|
|
9
|
+
// denylist, permission mode, turn bound) from the same snapshot whose hash
|
|
10
|
+
// every event must echo.
|
|
11
|
+
//
|
|
12
|
+
// Parity (ADR-0020 §3) is pinned by permission-config.test.ts: a capability
|
|
13
|
+
// the snapshot did not grant produces NO allowing tool rule (and for network
|
|
14
|
+
// tools an explicit deny), and every Bash prefix rule maps back to exactly
|
|
15
|
+
// the capability that produced it (single mapping table, used for both
|
|
16
|
+
// derivation and event inference — parity by construction).
|
|
17
|
+
//
|
|
18
|
+
// Hard rules enforced here (ADR-0019 §6.5, ADR-0020 §6/§7):
|
|
19
|
+
// - `bypassPermissions` is not representable: the mode type excludes it
|
|
20
|
+
// and the argv builder asserts it is never passed.
|
|
21
|
+
// - File-mutating tools are scoped to the granted writablePaths only.
|
|
22
|
+
// - `networkAllowed: false` denies WebFetch/WebSearch even when the
|
|
23
|
+
// `network.access` capability was granted (fail closed).
|
|
24
|
+
// - The subagent tool (`Task`) is always denied: one execution is ONE
|
|
25
|
+
// bounded agent, not an unbounded subagent tree.
|
|
26
|
+
import { AGENT_CAPABILITIES } from '@agentic-sdlc-kit/contracts';
|
|
27
|
+
const BASH_RULES = [
|
|
28
|
+
// git.read
|
|
29
|
+
{ prefix: 'git log', matchTokens: 2, capability: 'git.read' },
|
|
30
|
+
{ prefix: 'git diff', matchTokens: 2, capability: 'git.read' },
|
|
31
|
+
{ prefix: 'git status', matchTokens: 2, capability: 'git.read' },
|
|
32
|
+
{ prefix: 'git show', matchTokens: 2, capability: 'git.read' },
|
|
33
|
+
{ prefix: 'git blame', matchTokens: 2, capability: 'git.read' },
|
|
34
|
+
// git.write
|
|
35
|
+
{ prefix: 'git add', matchTokens: 2, capability: 'git.write' },
|
|
36
|
+
{ prefix: 'git commit', matchTokens: 2, capability: 'git.write' },
|
|
37
|
+
{ prefix: 'git checkout', matchTokens: 2, capability: 'git.write' },
|
|
38
|
+
{ prefix: 'git switch', matchTokens: 2, capability: 'git.write' },
|
|
39
|
+
{ prefix: 'git branch', matchTokens: 2, capability: 'git.write' },
|
|
40
|
+
{ prefix: 'git restore', matchTokens: 2, capability: 'git.write' },
|
|
41
|
+
{ prefix: 'git stash', matchTokens: 2, capability: 'git.write' },
|
|
42
|
+
// process.test
|
|
43
|
+
{ prefix: 'npm test', matchTokens: 2, capability: 'process.test' },
|
|
44
|
+
{ prefix: 'npm run test', matchTokens: 3, capability: 'process.test' },
|
|
45
|
+
{ prefix: 'pnpm test', matchTokens: 2, capability: 'process.test' },
|
|
46
|
+
{ prefix: 'pnpm run test', matchTokens: 3, capability: 'process.test' },
|
|
47
|
+
{ prefix: 'pnpm vitest', matchTokens: 2, capability: 'process.test' },
|
|
48
|
+
{ prefix: 'npx vitest', matchTokens: 2, capability: 'process.test' },
|
|
49
|
+
{ prefix: 'vitest', matchTokens: 1, capability: 'process.test' },
|
|
50
|
+
{ prefix: 'node --test', matchTokens: 2, capability: 'process.test' },
|
|
51
|
+
// process.build
|
|
52
|
+
{ prefix: 'npm run build', matchTokens: 3, capability: 'process.build' },
|
|
53
|
+
{ prefix: 'pnpm build', matchTokens: 2, capability: 'process.build' },
|
|
54
|
+
{ prefix: 'pnpm run build', matchTokens: 3, capability: 'process.build' },
|
|
55
|
+
{ prefix: 'npx tsc', matchTokens: 2, capability: 'process.build' },
|
|
56
|
+
{ prefix: 'tsc', matchTokens: 1, capability: 'process.build' },
|
|
57
|
+
// process.lint
|
|
58
|
+
{ prefix: 'npm run lint', matchTokens: 3, capability: 'process.lint' },
|
|
59
|
+
{ prefix: 'pnpm lint', matchTokens: 2, capability: 'process.lint' },
|
|
60
|
+
{ prefix: 'pnpm run lint', matchTokens: 3, capability: 'process.lint' },
|
|
61
|
+
{ prefix: 'npx eslint', matchTokens: 2, capability: 'process.lint' },
|
|
62
|
+
{ prefix: 'eslint', matchTokens: 1, capability: 'process.lint' },
|
|
63
|
+
// process.typecheck
|
|
64
|
+
{ prefix: 'npm run typecheck', matchTokens: 3, capability: 'process.typecheck' },
|
|
65
|
+
{ prefix: 'pnpm typecheck', matchTokens: 2, capability: 'process.typecheck' },
|
|
66
|
+
{ prefix: 'pnpm run typecheck', matchTokens: 3, capability: 'process.typecheck' },
|
|
67
|
+
{ prefix: 'tsc --noEmit', matchTokens: 2, capability: 'process.typecheck' },
|
|
68
|
+
];
|
|
69
|
+
/** Capabilities that map to non-Bash Claude Code tools. */
|
|
70
|
+
const READ_TOOLS = ['Read', 'Grep', 'Glob', 'LS'];
|
|
71
|
+
const WRITE_TOOLS = ['Write', 'Edit', 'NotebookEdit'];
|
|
72
|
+
const NETWORK_TOOLS = ['WebFetch', 'WebSearch'];
|
|
73
|
+
/** Always denied: subagents would multiply an execution beyond its bounds. */
|
|
74
|
+
const ALWAYS_DENIED = ['Task'];
|
|
75
|
+
function has(list, value) {
|
|
76
|
+
return list.includes(value);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Derive the Claude Code permission configuration from the canonical
|
|
80
|
+
* snapshot fields (the same fields the gateway freezes into the request).
|
|
81
|
+
*
|
|
82
|
+
* NOTE: takes the REQUEST's permission fields, which the gateway has already
|
|
83
|
+
* validated equal the canonical snapshot and whose policyHash the events
|
|
84
|
+
* must echo — so this derivation is traceable to the exact policy that
|
|
85
|
+
* authorized the execution.
|
|
86
|
+
*/
|
|
87
|
+
export function deriveClaudeCodePermissionConfig(permissions, budget) {
|
|
88
|
+
const granted = permissions.capabilities;
|
|
89
|
+
const allowed = [];
|
|
90
|
+
const disallowed = [...ALWAYS_DENIED];
|
|
91
|
+
// repository.read -> observation tools
|
|
92
|
+
if (has(granted, 'repository.read'))
|
|
93
|
+
allowed.push(...READ_TOOLS);
|
|
94
|
+
// repository.write -> file mutation tools, SCOPED to writablePaths
|
|
95
|
+
if (has(granted, 'repository.write')) {
|
|
96
|
+
for (const tool of WRITE_TOOLS) {
|
|
97
|
+
for (const target of permissions.writablePaths) {
|
|
98
|
+
allowed.push(`${tool}(${target}/**)`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// git.* / process.* -> Bash prefix rules from the single mapping table
|
|
103
|
+
for (const rule of BASH_RULES) {
|
|
104
|
+
if (has(granted, rule.capability))
|
|
105
|
+
allowed.push(`Bash(${rule.prefix}:*)`);
|
|
106
|
+
}
|
|
107
|
+
// network.access -> web tools; networkAllowed=false denies them (fail closed)
|
|
108
|
+
if (has(granted, 'network.access')) {
|
|
109
|
+
if (permissions.networkAllowed)
|
|
110
|
+
allowed.push(...NETWORK_TOOLS);
|
|
111
|
+
else
|
|
112
|
+
disallowed.push(...NETWORK_TOOLS);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
disallowed.push(...NETWORK_TOOLS);
|
|
116
|
+
}
|
|
117
|
+
// external.approval is not a tool: the approval POLICY governs it (the
|
|
118
|
+
// provider blocks autonomously when it requires human approval).
|
|
119
|
+
return {
|
|
120
|
+
allowedTools: dedupe(allowed),
|
|
121
|
+
disallowedTools: dedupe(disallowed),
|
|
122
|
+
// 'default': headless sessions cannot prompt, so anything outside the
|
|
123
|
+
// allowlist is denied by Claude Code itself — which is exactly the
|
|
124
|
+
// fail-closed behavior the policy wants. Never bypassPermissions.
|
|
125
|
+
permissionMode: 'default',
|
|
126
|
+
maxTurns: budget.maxToolCalls > 0 ? budget.maxToolCalls : undefined,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function dedupe(list) {
|
|
130
|
+
return [...new Set(list)];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Infer the capability an observed tool call exercises — the reverse
|
|
134
|
+
* direction of the derivation, from the SAME mapping table. Used for
|
|
135
|
+
* `tool.requested` events (observability only; an event never authorizes
|
|
136
|
+
* anything).
|
|
137
|
+
*
|
|
138
|
+
* Unmapped tools return undefined: the provider skips the tool.requested
|
|
139
|
+
* event rather than asserting a capability it cannot honestly name.
|
|
140
|
+
*/
|
|
141
|
+
export function inferCapabilityFromToolUse(toolName, input) {
|
|
142
|
+
if (READ_TOOLS.includes(toolName))
|
|
143
|
+
return 'repository.read';
|
|
144
|
+
if (WRITE_TOOLS.includes(toolName))
|
|
145
|
+
return 'repository.write';
|
|
146
|
+
if (NETWORK_TOOLS.includes(toolName))
|
|
147
|
+
return 'network.access';
|
|
148
|
+
if (toolName === 'Bash')
|
|
149
|
+
return inferCapabilityFromBashCommand(bashCommandOf(input));
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
function bashCommandOf(input) {
|
|
153
|
+
if (input &&
|
|
154
|
+
typeof input === 'object' &&
|
|
155
|
+
typeof input.command === 'string') {
|
|
156
|
+
return input.command;
|
|
157
|
+
}
|
|
158
|
+
return '';
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Match a Bash command against the rule table. Longer (more specific)
|
|
162
|
+
* prefixes win, so `tsc --noEmit` resolves to process.typecheck, not the
|
|
163
|
+
* 1-token `tsc` build rule.
|
|
164
|
+
*/
|
|
165
|
+
export function inferCapabilityFromBashCommand(command) {
|
|
166
|
+
const trimmed = command.trim();
|
|
167
|
+
let best;
|
|
168
|
+
for (const rule of BASH_RULES) {
|
|
169
|
+
if (trimmed.startsWith(rule.prefix)) {
|
|
170
|
+
const score = rule.matchTokens * 100 - rule.prefix.length;
|
|
171
|
+
if (!best || score > best.score)
|
|
172
|
+
best = { rule, score };
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return best?.rule.capability;
|
|
176
|
+
}
|
|
177
|
+
/** Exported for parity tests: the full rule table for one capability. */
|
|
178
|
+
export function bashRulesForCapability(capability) {
|
|
179
|
+
return BASH_RULES.filter((r) => r.capability === capability);
|
|
180
|
+
}
|
|
181
|
+
/** Exported for parity tests: all capabilities with Bash rules. */
|
|
182
|
+
export const BASH_RULE_CAPABILITIES = [
|
|
183
|
+
...new Set(BASH_RULES.map((r) => r.capability)),
|
|
184
|
+
];
|
|
185
|
+
/** Capabilities the claude-code provider declares it can exercise. */
|
|
186
|
+
export const CLAUDE_CODE_SUPPORTED_CAPABILITIES = [
|
|
187
|
+
...AGENT_CAPABILITIES,
|
|
188
|
+
];
|
|
189
|
+
//# sourceMappingURL=permission-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-config.js","sourceRoot":"","sources":["../../../../../src/application/agent/providers/claude-code/permission-config.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,6EAA6E;AAC7E,EAAE;AACF,4EAA4E;AAC5E,0EAA0E;AAC1E,yEAAyE;AACzE,0EAA0E;AAC1E,2EAA2E;AAC3E,yBAAyB;AACzB,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,uEAAuE;AACvE,4DAA4D;AAC5D,EAAE;AACF,4DAA4D;AAC5D,0EA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,IAAI,CAAC,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK;gBAAE,IAAI,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAC1D,CAAC;IACH,CAAC;IACD,OAAO,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC;AAC/B,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,sBAAsB,CACpC,UAA2B;IAE3B,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC;AAC/D,CAAC;AAED,mEAAmE;AACnE,MAAM,CAAC,MAAM,sBAAsB,GAA+B;IAChE,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;CAChD,CAAC;AAEF,sEAAsE;AACtE,MAAM,CAAC,MAAM,kCAAkC,GAA+B;IAC5E,GAAG,kBAAkB;CACtB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type AgentExecutionHandle, type AgentExecutionRequest, type AgentHealth, type AgentProvider, type AgentProviderCapabilities } from '@agentic-sdlc-kit/contracts';
|
|
2
|
+
export interface ClaudeCodeProviderOptions {
|
|
3
|
+
/** Where the gateway persists execution records (also roots the encrypted resume store). */
|
|
4
|
+
readonly projectRoot: string;
|
|
5
|
+
/** The claude executable. Default 'claude'. */
|
|
6
|
+
readonly cliPath?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Args inserted before the derived claude args (e.g. a fixture script path
|
|
9
|
+
* when cliPath is a runtime binary). Test seam only; default none.
|
|
10
|
+
*/
|
|
11
|
+
readonly cliArgvPrefix?: readonly string[];
|
|
12
|
+
/** Probe timeout for healthCheck (default 3s). */
|
|
13
|
+
readonly healthTimeoutMs?: number;
|
|
14
|
+
/** Bounded output: kill the process past this many stdout+stderr bytes (default 16 MiB). */
|
|
15
|
+
readonly maxOutputBytes?: number;
|
|
16
|
+
/** Grace between SIGTERM and SIGKILL on cancel (default 5s). */
|
|
17
|
+
readonly killGraceMs?: number;
|
|
18
|
+
/** Extra env merged over process.env for the child (test seam). */
|
|
19
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
20
|
+
}
|
|
21
|
+
export declare class ClaudeCodeProvider implements AgentProvider {
|
|
22
|
+
readonly id: "claude-code";
|
|
23
|
+
private readonly opts;
|
|
24
|
+
private readonly inFlight;
|
|
25
|
+
constructor(opts: ClaudeCodeProviderOptions);
|
|
26
|
+
capabilities(): Promise<AgentProviderCapabilities>;
|
|
27
|
+
healthCheck(): Promise<AgentHealth>;
|
|
28
|
+
start(request: AgentExecutionRequest, signal: AbortSignal): Promise<AgentExecutionHandle>;
|
|
29
|
+
resume(executionId: string, resumeToken: string): Promise<AgentExecutionHandle>;
|
|
30
|
+
cancel(executionId: string): Promise<void>;
|
|
31
|
+
private childEnv;
|
|
32
|
+
private probeVersion;
|
|
33
|
+
private spawnAndSettle;
|
|
34
|
+
private buildResult;
|
|
35
|
+
/** Persist the session record for cross-process resume (encrypted at rest). */
|
|
36
|
+
private persistSession;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../src/application/agent/providers/claude-code/provider.ts"],"names":[],"mappings":"AAuCA,OAAO,EAML,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAE1B,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC/B,MAAM,6BAA6B,CAAC;AAarC,MAAM,WAAW,yBAAyB;IACxC,4FAA4F;IAC5F,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,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