@devtrack-solution/codesdd 1.2.2 → 1.2.3
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/.sdd/skills/curated/api-clean-flask-langgraph/SKILL.md +17 -17
- package/.sdd/skills/curated/devtrack-api/SKILL.md +160 -28
- package/.sdd/skills/curated/devtrack-api/agents/openai.yaml +1 -1
- package/.sdd/skills/curated/devtrack-api/references/architecture-governance.md +8 -7
- package/.sdd/skills/curated/devtrack-api/references/consumer-sync-policy.md +93 -0
- package/.sdd/skills/curated/devtrack-api/references/contract-pack.yaml +317 -0
- package/.sdd/skills/curated/devtrack-api/references/field-validation-protocol.md +95 -0
- package/.sdd/skills/curated/devtrack-api/references/foundation-layout.md +295 -0
- package/.sdd/skills/curated/devtrack-api/references/implementation-checklist.md +4 -4
- package/.sdd/skills/curated/devtrack-api/references/imports-lint.md +4 -0
- package/.sdd/skills/curated/devtrack-api/references/testing-validation.md +2 -2
- package/LICENSE +1 -1
- package/README.md +243 -51
- package/bin/codesdd.js +3 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +11 -558
- package/dist/cli/program.d.ts +14 -0
- package/dist/cli/program.js +645 -0
- package/dist/commands/change.js +5 -5
- package/dist/commands/completion.d.ts +1 -1
- package/dist/commands/completion.js +9 -2
- package/dist/commands/config.js +159 -20
- package/dist/commands/feedback.js +1 -1
- package/dist/commands/schema.d.ts +63 -0
- package/dist/commands/schema.js +12 -12
- package/dist/commands/sdd/backlog.d.ts +3 -0
- package/dist/commands/sdd/backlog.js +54 -0
- package/dist/commands/sdd/execution.js +147 -16
- package/dist/commands/sdd/plugin.d.ts +3 -0
- package/dist/commands/sdd/plugin.js +153 -0
- package/dist/commands/sdd/shared.js +2 -23
- package/dist/commands/sdd/skills.js +7 -0
- package/dist/commands/sdd.js +69 -12
- package/dist/commands/spec.js +9 -9
- package/dist/commands/validate.js +6 -6
- package/dist/commands/workflow/instructions.js +6 -6
- package/dist/commands/workflow/new-change.js +3 -3
- package/dist/commands/workflow/shared.d.ts +1 -1
- package/dist/commands/workflow/shared.js +4 -4
- package/dist/core/archive.js +15 -5
- package/dist/core/artifact-graph/instruction-loader.d.ts +1 -1
- package/dist/core/artifact-graph/instruction-loader.js +3 -3
- package/dist/core/artifact-graph/resolver.d.ts +4 -4
- package/dist/core/artifact-graph/resolver.js +6 -6
- package/dist/core/branding.js +3 -3
- package/dist/core/cli/command-matrix.js +10 -1
- package/dist/core/cli-command-quality.d.ts +27 -0
- package/dist/core/cli-command-quality.js +171 -0
- package/dist/core/command-generation/adapters/costrict.d.ts +1 -1
- package/dist/core/command-generation/adapters/costrict.js +2 -2
- package/dist/core/command-generation/types.d.ts +1 -1
- package/dist/core/completions/command-registry.d.ts +1 -1
- package/dist/core/completions/command-registry.js +155 -12
- package/dist/core/completions/completion-provider.d.ts +14 -1
- package/dist/core/completions/completion-provider.js +29 -1
- package/dist/core/completions/generators/bash-generator.d.ts +1 -1
- package/dist/core/completions/generators/bash-generator.js +20 -12
- package/dist/core/completions/generators/fish-generator.d.ts +9 -1
- package/dist/core/completions/generators/fish-generator.js +39 -25
- package/dist/core/completions/generators/powershell-generator.d.ts +1 -1
- package/dist/core/completions/generators/powershell-generator.js +21 -11
- package/dist/core/completions/generators/zsh-generator.d.ts +3 -6
- package/dist/core/completions/generators/zsh-generator.js +21 -42
- package/dist/core/completions/installers/bash-installer.js +6 -6
- package/dist/core/completions/installers/fish-installer.js +1 -1
- package/dist/core/completions/installers/powershell-installer.js +14 -14
- package/dist/core/completions/installers/zsh-installer.d.ts +7 -1
- package/dist/core/completions/installers/zsh-installer.js +36 -8
- package/dist/core/completions/templates/bash-templates.d.ts +1 -1
- package/dist/core/completions/templates/bash-templates.js +12 -6
- package/dist/core/completions/templates/fish-templates.d.ts +2 -2
- package/dist/core/completions/templates/fish-templates.js +20 -9
- package/dist/core/completions/templates/powershell-templates.d.ts +1 -1
- package/dist/core/completions/templates/powershell-templates.js +13 -4
- package/dist/core/completions/templates/zsh-templates.d.ts +1 -1
- package/dist/core/completions/templates/zsh-templates.js +18 -9
- package/dist/core/config-schema.d.ts +3 -1
- package/dist/core/config-schema.js +26 -1
- package/dist/core/config.d.ts +3 -3
- package/dist/core/config.js +4 -4
- package/dist/core/global-config.d.ts +41 -12
- package/dist/core/global-config.js +344 -27
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/init.d.ts +6 -1
- package/dist/core/init.js +99 -77
- package/dist/core/legacy-cleanup.d.ts +17 -17
- package/dist/core/legacy-cleanup.js +96 -79
- package/dist/core/list.js +18 -4
- package/dist/core/migration.d.ts +3 -1
- package/dist/core/migration.js +7 -8
- package/dist/core/parsers/change-parser.js +1 -1
- package/dist/core/parsers/markdown-parser.js +2 -2
- package/dist/core/profile-sync-drift.d.ts +1 -1
- package/dist/core/profile-sync-drift.js +13 -13
- package/dist/core/project-config.d.ts +4 -4
- package/dist/core/project-config.js +11 -11
- package/dist/core/schemas/change.schema.d.ts +1 -1
- package/dist/core/schemas/change.schema.js +1 -1
- package/dist/core/schemas/spec.schema.d.ts +1 -1
- package/dist/core/schemas/spec.schema.js +1 -1
- package/dist/core/sdd/adr.js +23 -1
- package/dist/core/sdd/agent-binding.d.ts +346 -0
- package/dist/core/sdd/agent-binding.js +343 -0
- package/dist/core/sdd/backlog-cli.d.ts +16 -0
- package/dist/core/sdd/backlog-cli.js +146 -0
- package/dist/core/sdd/backlog-conflict-policy.d.ts +58 -0
- package/dist/core/sdd/backlog-conflict-policy.js +230 -0
- package/dist/core/sdd/backlog-projection.d.ts +8 -0
- package/dist/core/sdd/backlog-projection.js +89 -0
- package/dist/core/sdd/backlog-provider-contract.d.ts +252 -0
- package/dist/core/sdd/backlog-provider-contract.js +158 -0
- package/dist/core/sdd/bootstrap.js +2 -2
- package/dist/core/sdd/check.d.ts +42 -0
- package/dist/core/sdd/check.js +22 -22
- package/dist/core/sdd/contract.d.ts +13 -0
- package/dist/core/sdd/contract.js +36 -0
- package/dist/core/sdd/coordination/coordination-adapters.d.ts +38 -0
- package/dist/core/sdd/coordination/coordination-adapters.js +139 -1
- package/dist/core/sdd/deepagent-contracts.d.ts +276 -0
- package/dist/core/sdd/deepagent-contracts.js +173 -0
- package/dist/core/sdd/deepagents/adr-governor.d.ts +2 -0
- package/dist/core/sdd/deepagents/adr-governor.js +30 -0
- package/dist/core/sdd/deepagents/backend.d.ts +63 -0
- package/dist/core/sdd/deepagents/backend.js +174 -0
- package/dist/core/sdd/deepagents/codesdd-tools.d.ts +39 -0
- package/dist/core/sdd/deepagents/codesdd-tools.js +83 -0
- package/dist/core/sdd/deepagents/evidence-mapper.d.ts +86 -0
- package/dist/core/sdd/deepagents/evidence-mapper.js +178 -0
- package/dist/core/sdd/deepagents/model-provider.d.ts +53 -0
- package/dist/core/sdd/deepagents/model-provider.js +379 -0
- package/dist/core/sdd/deepagents/policy-enforcement.d.ts +30 -0
- package/dist/core/sdd/deepagents/policy-enforcement.js +90 -0
- package/dist/core/sdd/deepagents/policy.d.ts +75 -0
- package/dist/core/sdd/deepagents/policy.js +358 -0
- package/dist/core/sdd/deepagents/quality-witness.d.ts +3 -0
- package/dist/core/sdd/deepagents/quality-witness.js +77 -0
- package/dist/core/sdd/deepagents/reversa-subagents.d.ts +75 -0
- package/dist/core/sdd/deepagents/reversa-subagents.js +182 -0
- package/dist/core/sdd/deepagents/runtime-factory.d.ts +90 -0
- package/dist/core/sdd/deepagents/runtime-factory.js +231 -0
- package/dist/core/sdd/deepagents/runtime-loader.d.ts +16 -0
- package/dist/core/sdd/deepagents/runtime-loader.js +65 -0
- package/dist/core/sdd/default-bootstrap-files.d.ts +2 -2
- package/dist/core/sdd/default-bootstrap-files.js +36 -2
- package/dist/core/sdd/default-skills.d.ts +30 -0
- package/dist/core/sdd/default-skills.js +181 -5
- package/dist/core/sdd/devtrack-api-appliance.d.ts +84 -0
- package/dist/core/sdd/devtrack-api-appliance.js +257 -0
- package/dist/core/sdd/devtrack-api-architecture.d.ts +31 -0
- package/dist/core/sdd/devtrack-api-architecture.js +608 -0
- package/dist/core/sdd/devtrack-api-import-boundary.d.ts +19 -0
- package/dist/core/sdd/devtrack-api-import-boundary.js +32 -0
- package/dist/core/sdd/diagnose.d.ts +59 -0
- package/dist/core/sdd/diagnose.js +37 -37
- package/dist/core/sdd/docs-sync.js +33 -5
- package/dist/core/sdd/domain/post-active-validation.d.ts +7 -0
- package/dist/core/sdd/domain/post-active-validation.js +61 -0
- package/dist/core/sdd/domain/transition-engine.js +1 -0
- package/dist/core/sdd/entity-reference.d.ts +5 -0
- package/dist/core/sdd/entity-reference.js +22 -0
- package/dist/core/sdd/governance-backfill.d.ts +31 -0
- package/dist/core/sdd/governance-backfill.js +359 -0
- package/dist/core/sdd/governance-parser.d.ts +21 -0
- package/dist/core/sdd/governance-parser.js +91 -0
- package/dist/core/sdd/governance-schemas.d.ts +245 -0
- package/dist/core/sdd/governance-schemas.js +143 -0
- package/dist/core/sdd/{import-openspec.d.ts → import-legacy-spec.d.ts} +7 -7
- package/dist/core/sdd/{import-openspec.js → import-legacy-spec.js} +21 -29
- package/dist/core/sdd/init.d.ts +3 -0
- package/dist/core/sdd/init.js +6 -3
- package/dist/core/sdd/json-schema.js +100 -6
- package/dist/core/sdd/knowledge-graph.d.ts +45 -0
- package/dist/core/sdd/knowledge-graph.js +288 -0
- package/dist/core/sdd/legacy-operations.js +431 -43
- package/dist/core/sdd/lenses.d.ts +1 -0
- package/dist/core/sdd/lenses.js +29 -1
- package/dist/core/sdd/migrate-workspace.js +56 -2
- package/dist/core/sdd/migrate.d.ts +1 -1
- package/dist/core/sdd/migrate.js +36 -2
- package/dist/core/sdd/package-structure-gate.d.ts +83 -0
- package/dist/core/sdd/package-structure-gate.js +362 -0
- package/dist/core/sdd/parallel-feat-automation.d.ts +152 -0
- package/dist/core/sdd/parallel-feat-automation.js +212 -0
- package/dist/core/sdd/plugin-broker.d.ts +558 -0
- package/dist/core/sdd/plugin-broker.js +482 -0
- package/dist/core/sdd/plugin-certification.d.ts +79 -0
- package/dist/core/sdd/plugin-certification.js +453 -0
- package/dist/core/sdd/plugin-cli.d.ts +109 -0
- package/dist/core/sdd/plugin-cli.js +198 -0
- package/dist/core/sdd/plugin-evidence.d.ts +275 -0
- package/dist/core/sdd/plugin-evidence.js +307 -0
- package/dist/core/sdd/plugin-manifest.d.ts +164 -0
- package/dist/core/sdd/plugin-manifest.js +215 -0
- package/dist/core/sdd/plugin-policy-pack.d.ts +88 -0
- package/dist/core/sdd/plugin-policy-pack.js +236 -0
- package/dist/core/sdd/plugin-policy.d.ts +68 -0
- package/dist/core/sdd/plugin-policy.js +212 -0
- package/dist/core/sdd/plugin-registry.d.ts +311 -0
- package/dist/core/sdd/plugin-registry.js +138 -0
- package/dist/core/sdd/plugin-skill-binding.d.ts +151 -0
- package/dist/core/sdd/plugin-skill-binding.js +339 -0
- package/dist/core/sdd/quality-artifact-manifest-validator.d.ts +28 -0
- package/dist/core/sdd/quality-artifact-manifest-validator.js +167 -0
- package/dist/core/sdd/quality-evidence-renderer.d.ts +65 -0
- package/dist/core/sdd/quality-evidence-renderer.js +218 -0
- package/dist/core/sdd/quality-scenario-runner.d.ts +42 -0
- package/dist/core/sdd/quality-scenario-runner.js +613 -0
- package/dist/core/sdd/quality-validation.d.ts +547 -0
- package/dist/core/sdd/quality-validation.js +239 -0
- package/dist/core/sdd/resolve-project-root.d.ts +2 -2
- package/dist/core/sdd/resolve-project-root.js +11 -5
- package/dist/core/sdd/sanitize.d.ts +30 -1
- package/dist/core/sdd/sanitize.js +23 -23
- package/dist/core/sdd/services/agent-run.service.d.ts +65 -0
- package/dist/core/sdd/services/agent-run.service.js +189 -0
- package/dist/core/sdd/services/breakdown.service.js +2 -1
- package/dist/core/sdd/services/context.service.js +18 -16
- package/dist/core/sdd/services/debate.service.js +15 -2
- package/dist/core/sdd/services/feature-lint.service.d.ts +22 -0
- package/dist/core/sdd/services/feature-lint.service.js +105 -5
- package/dist/core/sdd/services/finalize.service.d.ts +80 -0
- package/dist/core/sdd/services/finalize.service.js +323 -24
- package/dist/core/sdd/services/frontend-gap.service.js +22 -7
- package/dist/core/sdd/services/governance-control-plane-runtime-adapters.d.ts +17 -0
- package/dist/core/sdd/services/governance-control-plane-runtime-adapters.js +38 -0
- package/dist/core/sdd/services/governance-control-plane.service.d.ts +66 -0
- package/dist/core/sdd/services/governance-control-plane.service.js +134 -0
- package/dist/core/sdd/services/ingest-deposito.service.js +1 -1
- package/dist/core/sdd/services/legacy-capability.service.d.ts +10 -7
- package/dist/core/sdd/services/legacy-capability.service.js +38 -21
- package/dist/core/sdd/services/mcp-runtime.service.d.ts +123 -8
- package/dist/core/sdd/services/mcp-runtime.service.js +1085 -33
- package/dist/core/sdd/services/onboard.service.js +2 -1
- package/dist/core/sdd/services/rebuild.service.js +6 -1
- package/dist/core/sdd/services/skills-sync.service.d.ts +17 -5
- package/dist/core/sdd/services/skills-sync.service.js +55 -2
- package/dist/core/sdd/services/start.service.js +6 -4
- package/dist/core/sdd/skill-bundles-curation-schema.d.ts +66 -0
- package/dist/core/sdd/skill-bundles-curation-schema.js +52 -0
- package/dist/core/sdd/skill-evidence.d.ts +19 -0
- package/dist/core/sdd/skill-evidence.js +38 -0
- package/dist/core/sdd/skill-policy-pool.d.ts +46 -0
- package/dist/core/sdd/skill-policy-pool.js +185 -0
- package/dist/core/sdd/state.d.ts +22 -0
- package/dist/core/sdd/state.js +66 -41
- package/dist/core/sdd/structural-health.d.ts +42 -42
- package/dist/core/sdd/types.d.ts +33 -7
- package/dist/core/sdd/types.js +17 -0
- package/dist/core/sdd/upgrade-to-codesdd.d.ts +45 -0
- package/dist/core/sdd/upgrade-to-codesdd.js +179 -0
- package/dist/core/sdd/workspace-schemas.d.ts +285 -14
- package/dist/core/sdd/workspace-schemas.js +148 -0
- package/dist/core/sdd/write-manifest.js +22 -4
- package/dist/core/shared/skill-generation.d.ts +1 -1
- package/dist/core/shared/skill-generation.js +15 -15
- package/dist/core/shared/tool-detection.d.ts +3 -3
- package/dist/core/shared/tool-detection.js +14 -14
- package/dist/core/specs-apply.js +6 -6
- package/dist/core/templates/index.d.ts +1 -1
- package/dist/core/templates/index.js +1 -1
- package/dist/core/templates/workflows/apply-change.js +14 -14
- package/dist/core/templates/workflows/archive-change.js +32 -32
- package/dist/core/templates/workflows/bulk-archive-change.js +25 -25
- package/dist/core/templates/workflows/continue-change.js +12 -12
- package/dist/core/templates/workflows/explore.js +29 -29
- package/dist/core/templates/workflows/feedback.js +6 -6
- package/dist/core/templates/workflows/ff-change.js +24 -24
- package/dist/core/templates/workflows/new-change.js +20 -20
- package/dist/core/templates/workflows/onboard.js +33 -33
- package/dist/core/templates/workflows/propose.js +23 -23
- package/dist/core/templates/workflows/sdd.js +8 -8
- package/dist/core/templates/workflows/sync-specs.js +19 -19
- package/dist/core/templates/workflows/verify-change.js +17 -17
- package/dist/core/update.d.ts +2 -2
- package/dist/core/update.js +16 -15
- package/dist/core/validation/constants.d.ts +1 -1
- package/dist/core/validation/constants.js +1 -1
- package/dist/core/view.js +11 -11
- package/dist/telemetry/config.d.ts +2 -1
- package/dist/telemetry/config.js +17 -8
- package/dist/telemetry/index.d.ts +10 -2
- package/dist/telemetry/index.js +40 -7
- package/dist/ui/ascii-patterns.d.ts +2 -2
- package/dist/ui/ascii-patterns.js +2 -2
- package/dist/ui/welcome-screen.js +2 -2
- package/dist/utils/change-metadata.d.ts +4 -4
- package/dist/utils/change-metadata.js +6 -6
- package/dist/utils/change-utils.d.ts +3 -3
- package/dist/utils/change-utils.js +5 -5
- package/dist/utils/file-system.js +1 -1
- package/dist/utils/interactive.js +1 -1
- package/dist/utils/item-discovery.js +4 -4
- package/dist/utils/legacy-spec-compat.d.ts +2 -0
- package/dist/utils/legacy-spec-compat.js +2 -0
- package/dist/utils/shell-detection.d.ts +1 -0
- package/dist/utils/shell-detection.js +16 -0
- package/package.json +27 -17
- package/schemas/sdd/1-spec.schema.json +1 -1
- package/schemas/sdd/2-plan.schema.json +73 -1
- package/schemas/sdd/3-tasks.schema.json +73 -1
- package/schemas/sdd/4-changelog.schema.json +1 -1
- package/schemas/sdd/5-quality.schema.json +442 -2
- package/schemas/sdd/adr.schema.json +148 -0
- package/schemas/sdd/agent-binding-adapter.schema.json +210 -0
- package/schemas/sdd/agent-binding-resolution.schema.json +338 -0
- package/schemas/sdd/backlog-projection-plan.schema.json +180 -0
- package/schemas/sdd/backlog-provider-contract.schema.json +260 -0
- package/schemas/sdd/codesdd-plugin.schema.json +474 -0
- package/schemas/sdd/debate.schema.json +244 -0
- package/schemas/sdd/deepagent-decision-evidence.schema.json +58 -0
- package/schemas/sdd/deepagent-env-contract.schema.json +143 -0
- package/schemas/sdd/deepagent-quality-evidence.schema.json +108 -0
- package/schemas/sdd/deepagent-run-evidence.schema.json +192 -0
- package/schemas/sdd/deepagent-run-plan.schema.json +197 -0
- package/schemas/sdd/deepagent-run-request.schema.json +321 -0
- package/schemas/sdd/deepagent-subagent-evidence.schema.json +110 -0
- package/schemas/sdd/deepagent-tool-call-evidence.schema.json +78 -0
- package/schemas/sdd/discarded.schema.json +127 -0
- package/schemas/sdd/epic.schema.json +147 -0
- package/schemas/sdd/insight.schema.json +136 -0
- package/schemas/sdd/parallel-feat-automation-plan.schema.json +215 -0
- package/schemas/sdd/parallel-feat-automation-request.schema.json +109 -0
- package/schemas/sdd/plugin-artifact-manifest.schema.json +150 -0
- package/schemas/sdd/plugin-compliance-index.schema.json +136 -0
- package/schemas/sdd/plugin-dry-run-plan.schema.json +260 -0
- package/schemas/sdd/plugin-evidence-manifest.schema.json +569 -0
- package/schemas/sdd/plugin-policy-evaluation.schema.json +92 -0
- package/schemas/sdd/plugin-policy-pack-evaluation.schema.json +94 -0
- package/schemas/sdd/plugin-policy-pack.schema.json +196 -0
- package/schemas/sdd/plugin-registry.schema.json +558 -0
- package/schemas/sdd/plugin-rollback-manifest.schema.json +87 -0
- package/schemas/sdd/plugin-runtime-invocation-plan.schema.json +845 -0
- package/schemas/sdd/plugin-skill-binding-resolution.schema.json +305 -0
- package/schemas/sdd/plugin-skill-binding.schema.json +88 -0
- package/schemas/sdd/plugin-validation-manifest.schema.json +123 -0
- package/schemas/sdd/quality-architecture-schema.schema.json +216 -0
- package/schemas/sdd/quality-evidence-bundle.schema.json +1228 -0
- package/schemas/sdd/quality-run.schema.json +197 -0
- package/schemas/sdd/quality-scenario.schema.json +252 -0
- package/schemas/sdd/workspace-catalog.schema.json +9841 -22
- package/schemas/spec-driven/schema.yaml +4 -4
- package/schemas/spec-driven/templates/proposal.md +1 -1
- package/dist/utils/openspec-compat.d.ts +0 -2
- package/dist/utils/openspec-compat.js +0 -2
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const FEATURE_REF_PATTERN = /^FEAT-\d{4}$/;
|
|
3
|
+
const ADAPTER_ID_PATTERN = /^codesdd-agent-[a-z0-9][a-z0-9-]*$/;
|
|
4
|
+
const agentProviderSchema = z.enum([
|
|
5
|
+
'codex',
|
|
6
|
+
'opencode',
|
|
7
|
+
'claude-code',
|
|
8
|
+
'cloudcode',
|
|
9
|
+
'deepagents',
|
|
10
|
+
'fake',
|
|
11
|
+
]);
|
|
12
|
+
const agentTaskKindSchema = z.enum([
|
|
13
|
+
'planning',
|
|
14
|
+
'review',
|
|
15
|
+
'validation',
|
|
16
|
+
'implementation',
|
|
17
|
+
'reverse-engineering',
|
|
18
|
+
'plugin-execution',
|
|
19
|
+
'adr-governance',
|
|
20
|
+
'quality-witness',
|
|
21
|
+
'documentation-sync',
|
|
22
|
+
]);
|
|
23
|
+
const adapterStatusSchema = z.enum(['active', 'disabled', 'experimental']);
|
|
24
|
+
const trustTierSchema = z.enum(['enterprise-approved', 'local-dev', 'experimental', 'blocked']);
|
|
25
|
+
const riskTierSchema = z.enum(['low', 'medium', 'high', 'critical']);
|
|
26
|
+
const TRUST_RANK = {
|
|
27
|
+
'enterprise-approved': 3,
|
|
28
|
+
'local-dev': 2,
|
|
29
|
+
experimental: 1,
|
|
30
|
+
blocked: 0,
|
|
31
|
+
};
|
|
32
|
+
const RISK_RANK = {
|
|
33
|
+
low: 4,
|
|
34
|
+
medium: 3,
|
|
35
|
+
high: 2,
|
|
36
|
+
critical: 1,
|
|
37
|
+
};
|
|
38
|
+
export const agentBindingCapabilitySchema = z.object({
|
|
39
|
+
task_kind: agentTaskKindSchema,
|
|
40
|
+
description: z.string().min(20),
|
|
41
|
+
read_only: z.boolean(),
|
|
42
|
+
edits: z.boolean(),
|
|
43
|
+
background: z.boolean(),
|
|
44
|
+
worktree_isolation: z.boolean(),
|
|
45
|
+
mcp: z.boolean(),
|
|
46
|
+
skills: z.boolean(),
|
|
47
|
+
structured_evidence: z.boolean(),
|
|
48
|
+
risk_tier: riskTierSchema.default('medium'),
|
|
49
|
+
});
|
|
50
|
+
export const agentBindingAdapterSchema = z
|
|
51
|
+
.object({
|
|
52
|
+
schema_version: z.literal(1).default(1),
|
|
53
|
+
id: z.string().regex(ADAPTER_ID_PATTERN),
|
|
54
|
+
provider: agentProviderSchema,
|
|
55
|
+
label: z.string().min(2),
|
|
56
|
+
status: adapterStatusSchema.default('active'),
|
|
57
|
+
execution: z.object({
|
|
58
|
+
mode: z.enum(['local-cli', 'cloud', 'test-double']),
|
|
59
|
+
command: z.string().min(1).optional(),
|
|
60
|
+
args: z.array(z.string()).default([]),
|
|
61
|
+
network: z.enum(['disabled', 'restricted', 'enabled']).default('disabled'),
|
|
62
|
+
evidence_contract: z.string().min(1).default('agent-evidence/v1'),
|
|
63
|
+
}),
|
|
64
|
+
capabilities: z.array(agentBindingCapabilitySchema).min(1),
|
|
65
|
+
governance: z.object({
|
|
66
|
+
owner: z.string().min(2),
|
|
67
|
+
trust_tier: trustTierSchema,
|
|
68
|
+
approval: z.enum(['none', 'maintainer', 'architecture-board', 'security']).default('maintainer'),
|
|
69
|
+
notes: z.array(z.string()).default([]),
|
|
70
|
+
}),
|
|
71
|
+
})
|
|
72
|
+
.superRefine((adapter, context) => {
|
|
73
|
+
const seen = new Set();
|
|
74
|
+
for (const [index, capability] of adapter.capabilities.entries()) {
|
|
75
|
+
if (seen.has(capability.task_kind)) {
|
|
76
|
+
context.addIssue({
|
|
77
|
+
code: 'custom',
|
|
78
|
+
path: ['capabilities', index, 'task_kind'],
|
|
79
|
+
message: `Duplicate agent capability: ${capability.task_kind}.`,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
seen.add(capability.task_kind);
|
|
83
|
+
}
|
|
84
|
+
if (adapter.execution.mode !== 'test-double' && !adapter.execution.command) {
|
|
85
|
+
context.addIssue({
|
|
86
|
+
code: 'custom',
|
|
87
|
+
path: ['execution', 'command'],
|
|
88
|
+
message: 'Non-test agent adapters must declare an execution command.',
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
export const agentBindingResolutionRequestSchema = z.object({
|
|
93
|
+
schema_version: z.literal(1).default(1),
|
|
94
|
+
feature_ref: z.string().regex(FEATURE_REF_PATTERN),
|
|
95
|
+
task_kind: agentTaskKindSchema,
|
|
96
|
+
provider: agentProviderSchema.optional(),
|
|
97
|
+
allowed_providers: z
|
|
98
|
+
.array(agentProviderSchema)
|
|
99
|
+
.default(['codex', 'opencode', 'claude-code', 'cloudcode', 'deepagents', 'fake']),
|
|
100
|
+
statuses: z.array(adapterStatusSchema).default(['active']),
|
|
101
|
+
trust_tiers: z.array(trustTierSchema).default(['enterprise-approved', 'local-dev', 'experimental']),
|
|
102
|
+
require_edits: z.boolean().default(false),
|
|
103
|
+
require_background: z.boolean().default(false),
|
|
104
|
+
require_worktree_isolation: z.boolean().default(false),
|
|
105
|
+
require_mcp: z.boolean().default(false),
|
|
106
|
+
require_skills: z.boolean().default(false),
|
|
107
|
+
require_structured_evidence: z.boolean().default(true),
|
|
108
|
+
created_at: z.string().datetime().optional(),
|
|
109
|
+
});
|
|
110
|
+
export const agentBindingCandidateSchema = z.object({
|
|
111
|
+
adapter_ref: z.object({
|
|
112
|
+
id: z.string().regex(ADAPTER_ID_PATTERN),
|
|
113
|
+
provider: agentProviderSchema,
|
|
114
|
+
label: z.string().min(2),
|
|
115
|
+
}),
|
|
116
|
+
task_kind: agentTaskKindSchema,
|
|
117
|
+
rank: z.number().int().nonnegative(),
|
|
118
|
+
reasons: z.array(z.string()).default([]),
|
|
119
|
+
});
|
|
120
|
+
export const agentBindingResolutionSchema = z.object({
|
|
121
|
+
schema_version: z.literal(1),
|
|
122
|
+
created_at: z.string().datetime(),
|
|
123
|
+
status: z.enum(['resolved', 'fallback']),
|
|
124
|
+
request: agentBindingResolutionRequestSchema,
|
|
125
|
+
selected: agentBindingCandidateSchema.optional(),
|
|
126
|
+
candidates: z.array(agentBindingCandidateSchema).default([]),
|
|
127
|
+
reasons: z.array(z.string()).default([]),
|
|
128
|
+
fallback: z
|
|
129
|
+
.object({
|
|
130
|
+
strategy: z.enum(['manual-agent-selection', 'local-human-execution', 'no-compatible-agent']),
|
|
131
|
+
message: z.string().min(1),
|
|
132
|
+
})
|
|
133
|
+
.optional(),
|
|
134
|
+
});
|
|
135
|
+
export function builtInAgentBindingAdapters() {
|
|
136
|
+
return [
|
|
137
|
+
createAdapter('codesdd-agent-codex-local', 'codex', 'Codex Local', 'local-cli', 'codex', {
|
|
138
|
+
background: true,
|
|
139
|
+
worktree_isolation: true,
|
|
140
|
+
mcp: true,
|
|
141
|
+
trust_tier: 'enterprise-approved',
|
|
142
|
+
}),
|
|
143
|
+
createAdapter('codesdd-agent-opencode-cli', 'opencode', 'OpenCode CLI', 'local-cli', 'opencode', {
|
|
144
|
+
background: false,
|
|
145
|
+
worktree_isolation: false,
|
|
146
|
+
mcp: false,
|
|
147
|
+
trust_tier: 'local-dev',
|
|
148
|
+
}),
|
|
149
|
+
createAdapter('codesdd-agent-claude-code-cli', 'claude-code', 'Claude Code CLI', 'local-cli', 'claude', {
|
|
150
|
+
background: false,
|
|
151
|
+
worktree_isolation: false,
|
|
152
|
+
mcp: true,
|
|
153
|
+
trust_tier: 'local-dev',
|
|
154
|
+
}),
|
|
155
|
+
createAdapter('codesdd-agent-cloudcode', 'cloudcode', 'Claude Code CloudCode', 'cloud', 'cloudcode', {
|
|
156
|
+
background: true,
|
|
157
|
+
worktree_isolation: true,
|
|
158
|
+
mcp: true,
|
|
159
|
+
trust_tier: 'enterprise-approved',
|
|
160
|
+
network: 'restricted',
|
|
161
|
+
}),
|
|
162
|
+
createAdapter('codesdd-agent-deepagents', 'deepagents', 'DeepAgents Governed Runtime', 'local-cli', 'codesdd-agent-run', {
|
|
163
|
+
background: true,
|
|
164
|
+
worktree_isolation: true,
|
|
165
|
+
mcp: true,
|
|
166
|
+
trust_tier: 'enterprise-approved',
|
|
167
|
+
network: 'restricted',
|
|
168
|
+
}),
|
|
169
|
+
createAdapter('codesdd-agent-fake-test', 'fake', 'Fake Deterministic Agent', 'test-double', undefined, {
|
|
170
|
+
background: false,
|
|
171
|
+
worktree_isolation: true,
|
|
172
|
+
mcp: false,
|
|
173
|
+
trust_tier: 'experimental',
|
|
174
|
+
}),
|
|
175
|
+
];
|
|
176
|
+
}
|
|
177
|
+
export function resolveAgentBindingAdapter(adapters, request) {
|
|
178
|
+
const parsedAdapters = adapters.map((adapter) => agentBindingAdapterSchema.parse(adapter));
|
|
179
|
+
const parsedRequest = agentBindingResolutionRequestSchema.parse(request);
|
|
180
|
+
const createdAt = parsedRequest.created_at ?? new Date().toISOString();
|
|
181
|
+
const reasons = [];
|
|
182
|
+
const candidates = parsedAdapters.flatMap((adapter) => buildCandidate(adapter, parsedRequest, reasons));
|
|
183
|
+
const sortedCandidates = candidates.sort(compareCandidates);
|
|
184
|
+
const [selected] = sortedCandidates;
|
|
185
|
+
if (!selected) {
|
|
186
|
+
return agentBindingResolutionSchema.parse({
|
|
187
|
+
schema_version: 1,
|
|
188
|
+
created_at: createdAt,
|
|
189
|
+
status: 'fallback',
|
|
190
|
+
request: {
|
|
191
|
+
...parsedRequest,
|
|
192
|
+
created_at: createdAt,
|
|
193
|
+
},
|
|
194
|
+
reasons: reasons.length > 0 ? reasons : ['No compatible agent adapter was found.'],
|
|
195
|
+
candidates: [],
|
|
196
|
+
fallback: {
|
|
197
|
+
strategy: 'no-compatible-agent',
|
|
198
|
+
message: 'Continue with manual execution or configure a compatible agent adapter before delegating work.',
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
return agentBindingResolutionSchema.parse({
|
|
203
|
+
schema_version: 1,
|
|
204
|
+
created_at: createdAt,
|
|
205
|
+
status: 'resolved',
|
|
206
|
+
request: {
|
|
207
|
+
...parsedRequest,
|
|
208
|
+
created_at: createdAt,
|
|
209
|
+
},
|
|
210
|
+
selected,
|
|
211
|
+
candidates: sortedCandidates,
|
|
212
|
+
reasons: [
|
|
213
|
+
`Resolved ${parsedRequest.task_kind} to ${selected.adapter_ref.id} (${selected.adapter_ref.provider}).`,
|
|
214
|
+
...selected.reasons,
|
|
215
|
+
],
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
function createAdapter(id, provider, label, mode, command, options) {
|
|
219
|
+
return agentBindingAdapterSchema.parse({
|
|
220
|
+
schema_version: 1,
|
|
221
|
+
id,
|
|
222
|
+
provider,
|
|
223
|
+
label,
|
|
224
|
+
execution: {
|
|
225
|
+
mode,
|
|
226
|
+
command,
|
|
227
|
+
args: [],
|
|
228
|
+
network: options.network ?? 'disabled',
|
|
229
|
+
evidence_contract: 'agent-evidence/v1',
|
|
230
|
+
},
|
|
231
|
+
capabilities: [
|
|
232
|
+
capability('planning', true, false, options, 'low'),
|
|
233
|
+
capability('review', true, false, options, 'low'),
|
|
234
|
+
capability('validation', true, false, options, 'medium'),
|
|
235
|
+
capability('implementation', false, true, options, 'high'),
|
|
236
|
+
capability('reverse-engineering', true, false, options, 'medium'),
|
|
237
|
+
capability('plugin-execution', false, true, options, 'high'),
|
|
238
|
+
capability('adr-governance', false, true, options, 'medium'),
|
|
239
|
+
capability('quality-witness', true, false, options, 'medium'),
|
|
240
|
+
capability('documentation-sync', false, true, options, 'medium'),
|
|
241
|
+
],
|
|
242
|
+
governance: {
|
|
243
|
+
owner: 'platform-engineering',
|
|
244
|
+
trust_tier: options.trust_tier,
|
|
245
|
+
approval: provider === 'fake' ? 'none' : 'maintainer',
|
|
246
|
+
notes: [`${label} adapter is declarative and non-executing in FEAT-0150.`],
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function capability(taskKind, readOnly, edits, options, riskTier) {
|
|
251
|
+
return agentBindingCapabilitySchema.parse({
|
|
252
|
+
task_kind: taskKind,
|
|
253
|
+
description: `${taskKind} capability advertised by the agent binding adapter.`,
|
|
254
|
+
read_only: readOnly,
|
|
255
|
+
edits,
|
|
256
|
+
background: options.background,
|
|
257
|
+
worktree_isolation: options.worktree_isolation,
|
|
258
|
+
mcp: options.mcp,
|
|
259
|
+
skills: true,
|
|
260
|
+
structured_evidence: true,
|
|
261
|
+
risk_tier: riskTier,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function buildCandidate(adapter, request, reasons) {
|
|
265
|
+
const capability = adapter.capabilities.find((candidate) => candidate.task_kind === request.task_kind);
|
|
266
|
+
const rejectionReasons = collectRejectionReasons(adapter, capability, request);
|
|
267
|
+
if (rejectionReasons.length > 0) {
|
|
268
|
+
reasons.push(...rejectionReasons.map((reason) => `${adapter.id}/${request.task_kind}: ${reason}`));
|
|
269
|
+
return [];
|
|
270
|
+
}
|
|
271
|
+
const resolvedCapability = capability;
|
|
272
|
+
return [
|
|
273
|
+
agentBindingCandidateSchema.parse({
|
|
274
|
+
adapter_ref: {
|
|
275
|
+
id: adapter.id,
|
|
276
|
+
provider: adapter.provider,
|
|
277
|
+
label: adapter.label,
|
|
278
|
+
},
|
|
279
|
+
task_kind: resolvedCapability.task_kind,
|
|
280
|
+
rank: rankCandidate(adapter, resolvedCapability, request),
|
|
281
|
+
reasons: candidateReasons(adapter, resolvedCapability),
|
|
282
|
+
}),
|
|
283
|
+
];
|
|
284
|
+
}
|
|
285
|
+
function collectRejectionReasons(adapter, capability, request) {
|
|
286
|
+
const reasons = [];
|
|
287
|
+
if (request.provider && adapter.provider !== request.provider) {
|
|
288
|
+
reasons.push(`provider ${adapter.provider} does not match requested provider ${request.provider}.`);
|
|
289
|
+
}
|
|
290
|
+
if (!request.allowed_providers.includes(adapter.provider)) {
|
|
291
|
+
reasons.push(`provider ${adapter.provider} is not allowed.`);
|
|
292
|
+
}
|
|
293
|
+
if (!request.statuses.includes(adapter.status)) {
|
|
294
|
+
reasons.push(`status ${adapter.status} is not eligible.`);
|
|
295
|
+
}
|
|
296
|
+
if (!request.trust_tiers.includes(adapter.governance.trust_tier)) {
|
|
297
|
+
reasons.push(`trust tier ${adapter.governance.trust_tier} is not eligible.`);
|
|
298
|
+
}
|
|
299
|
+
if (!capability) {
|
|
300
|
+
reasons.push(`task kind ${request.task_kind} is not advertised.`);
|
|
301
|
+
return reasons;
|
|
302
|
+
}
|
|
303
|
+
if (request.require_edits && !capability.edits) {
|
|
304
|
+
reasons.push('edits are required but not supported.');
|
|
305
|
+
}
|
|
306
|
+
if (request.require_background && !capability.background) {
|
|
307
|
+
reasons.push('background execution is required but not supported.');
|
|
308
|
+
}
|
|
309
|
+
if (request.require_worktree_isolation && !capability.worktree_isolation) {
|
|
310
|
+
reasons.push('worktree isolation is required but not supported.');
|
|
311
|
+
}
|
|
312
|
+
if (request.require_mcp && !capability.mcp) {
|
|
313
|
+
reasons.push('MCP support is required but not supported.');
|
|
314
|
+
}
|
|
315
|
+
if (request.require_skills && !capability.skills) {
|
|
316
|
+
reasons.push('skill support is required but not supported.');
|
|
317
|
+
}
|
|
318
|
+
if (request.require_structured_evidence && !capability.structured_evidence) {
|
|
319
|
+
reasons.push('structured evidence is required but not supported.');
|
|
320
|
+
}
|
|
321
|
+
return reasons;
|
|
322
|
+
}
|
|
323
|
+
function candidateReasons(adapter, capability) {
|
|
324
|
+
return [
|
|
325
|
+
`${adapter.label} supports ${capability.task_kind} with ${capability.edits ? 'edit' : 'read-only'} scope.`,
|
|
326
|
+
];
|
|
327
|
+
}
|
|
328
|
+
function rankCandidate(adapter, capability, request) {
|
|
329
|
+
const providerRank = request.provider && adapter.provider === request.provider ? 100_000 : 0;
|
|
330
|
+
const trustRank = TRUST_RANK[adapter.governance.trust_tier] * 1_000;
|
|
331
|
+
const isolationRank = capability.worktree_isolation ? 200 : 0;
|
|
332
|
+
const backgroundRank = capability.background ? 100 : 0;
|
|
333
|
+
const mcpRank = capability.mcp ? 50 : 0;
|
|
334
|
+
const riskRank = RISK_RANK[capability.risk_tier] * 10;
|
|
335
|
+
return providerRank + trustRank + isolationRank + backgroundRank + mcpRank + riskRank;
|
|
336
|
+
}
|
|
337
|
+
function compareCandidates(left, right) {
|
|
338
|
+
if (right.rank !== left.rank) {
|
|
339
|
+
return right.rank - left.rank;
|
|
340
|
+
}
|
|
341
|
+
return left.adapter_ref.id.localeCompare(right.adapter_ref.id);
|
|
342
|
+
}
|
|
343
|
+
//# sourceMappingURL=agent-binding.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type BacklogProviderId, type BacklogProjectionPlan, type CanonicalBacklogItem } from './backlog-provider-contract.js';
|
|
2
|
+
export interface BacklogProjectDryRunOptions {
|
|
3
|
+
provider: BacklogProviderId;
|
|
4
|
+
ref: string;
|
|
5
|
+
items?: CanonicalBacklogItem[];
|
|
6
|
+
created_at?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BacklogProjectDryRunResult {
|
|
9
|
+
schema_version: 1;
|
|
10
|
+
dry_run: true;
|
|
11
|
+
ref: string;
|
|
12
|
+
fixture: string;
|
|
13
|
+
plan: BacklogProjectionPlan;
|
|
14
|
+
}
|
|
15
|
+
export declare function buildBacklogProjectDryRun(options: BacklogProjectDryRunOptions): BacklogProjectDryRunResult;
|
|
16
|
+
//# sourceMappingURL=backlog-cli.d.ts.map
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { backlogProjectionPlanSchema, buildBacklogProjectionItem, } from './backlog-provider-contract.js';
|
|
2
|
+
const azureDevOpsContract = {
|
|
3
|
+
schema_version: 1,
|
|
4
|
+
provider: 'azure-devops',
|
|
5
|
+
adapter_id: 'azure-devops',
|
|
6
|
+
label: 'Azure DevOps Boards',
|
|
7
|
+
status: 'experimental',
|
|
8
|
+
auth: {
|
|
9
|
+
mode: 'pat',
|
|
10
|
+
required_env: ['AZURE_DEVOPS_EXT_PAT'],
|
|
11
|
+
secret_fields: ['AZURE_DEVOPS_EXT_PAT'],
|
|
12
|
+
},
|
|
13
|
+
capabilities: [
|
|
14
|
+
{
|
|
15
|
+
operation: 'create',
|
|
16
|
+
entity_kinds: ['epic', 'feature'],
|
|
17
|
+
dry_run: true,
|
|
18
|
+
apply: false,
|
|
19
|
+
idempotent: true,
|
|
20
|
+
required_fields: ['System.Title', 'System.State', 'Custom.CodeSDDRef'],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
operation: 'link',
|
|
24
|
+
entity_kinds: ['epic', 'feature'],
|
|
25
|
+
dry_run: true,
|
|
26
|
+
apply: false,
|
|
27
|
+
idempotent: true,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
mapping: {
|
|
31
|
+
external_project_field: 'System.TeamProject',
|
|
32
|
+
external_id_field: 'System.Id',
|
|
33
|
+
external_url_field: 'System.Url',
|
|
34
|
+
canonical_ref_field: 'Custom.CodeSDDRef',
|
|
35
|
+
parent_ref_field: 'Custom.CodeSDDParentRef',
|
|
36
|
+
entity_type_field: 'Custom.CodeSDDEntityType',
|
|
37
|
+
title_field: 'System.Title',
|
|
38
|
+
status_field: 'System.State',
|
|
39
|
+
},
|
|
40
|
+
canonical_state_boundary: {
|
|
41
|
+
source_of_truth: 'codesdd',
|
|
42
|
+
state_paths: ['.sdd/state/*.yaml'],
|
|
43
|
+
external_state_authoritative: false,
|
|
44
|
+
hidden_state_allowed: false,
|
|
45
|
+
},
|
|
46
|
+
governance: {
|
|
47
|
+
owner: 'platform-architecture',
|
|
48
|
+
sync_requires_dry_run: true,
|
|
49
|
+
mutation_requires_approval: true,
|
|
50
|
+
audit_event: 'codesdd.backlog.projection',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
const epic0039Fixture = [
|
|
54
|
+
{
|
|
55
|
+
ref: 'EPIC-0039',
|
|
56
|
+
kind: 'epic',
|
|
57
|
+
title: 'Provider-agnostic backlog integration and CodeSDD naming governance',
|
|
58
|
+
status: 'SPLIT',
|
|
59
|
+
labels: ['codesdd', 'backlog-integration'],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
ref: 'FEAT-0166',
|
|
63
|
+
kind: 'feature',
|
|
64
|
+
title: 'Backlog provider contract and canonical projection schema',
|
|
65
|
+
status: 'DONE',
|
|
66
|
+
parent_ref: 'EPIC-0039',
|
|
67
|
+
labels: ['codesdd', 'backlog-integration'],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
ref: 'FEAT-0167',
|
|
71
|
+
kind: 'feature',
|
|
72
|
+
title: 'Azure DevOps dry-run projection planner',
|
|
73
|
+
status: 'IN_PROGRESS',
|
|
74
|
+
parent_ref: 'EPIC-0039',
|
|
75
|
+
labels: ['codesdd', 'backlog-integration'],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
ref: 'FEAT-0168',
|
|
79
|
+
kind: 'feature',
|
|
80
|
+
title: 'Backlog sync conflict and idempotency policy',
|
|
81
|
+
status: 'IN_PROGRESS',
|
|
82
|
+
parent_ref: 'EPIC-0039',
|
|
83
|
+
labels: ['codesdd', 'backlog-integration'],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
ref: 'FEAT-0169',
|
|
87
|
+
kind: 'feature',
|
|
88
|
+
title: 'Backlog integration CLI dry-run surface',
|
|
89
|
+
status: 'IN_PROGRESS',
|
|
90
|
+
parent_ref: 'EPIC-0039',
|
|
91
|
+
labels: ['codesdd', 'backlog-integration'],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
ref: 'FEAT-0170',
|
|
95
|
+
kind: 'feature',
|
|
96
|
+
title: 'Backlog integration documentation and handoff',
|
|
97
|
+
status: 'IN_PROGRESS',
|
|
98
|
+
parent_ref: 'EPIC-0039',
|
|
99
|
+
labels: ['codesdd', 'backlog-integration'],
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
export function buildBacklogProjectDryRun(options) {
|
|
103
|
+
if (options.provider !== 'azure-devops') {
|
|
104
|
+
throw new Error(`Unsupported backlog provider for dry-run projection: ${options.provider}.`);
|
|
105
|
+
}
|
|
106
|
+
const items = options.items ?? resolveFixtureItems(options.ref);
|
|
107
|
+
const createdAt = options.created_at ?? new Date().toISOString();
|
|
108
|
+
const plan = backlogProjectionPlanSchema.parse({
|
|
109
|
+
schema_version: 1,
|
|
110
|
+
created_at: createdAt,
|
|
111
|
+
provider: options.provider,
|
|
112
|
+
mode: 'dry-run',
|
|
113
|
+
direction: 'push',
|
|
114
|
+
source_of_truth: 'codesdd',
|
|
115
|
+
items: items.map((item) => buildBacklogProjectionItem({
|
|
116
|
+
contract: azureDevOpsContract,
|
|
117
|
+
item,
|
|
118
|
+
external_type: toAzureDevOpsWorkItemType(item),
|
|
119
|
+
})),
|
|
120
|
+
warnings: [
|
|
121
|
+
'Dry-run only: no network calls, credentials, external IDs, or provider writes are used.',
|
|
122
|
+
`Projection source: ${options.items ? 'caller-provided canonical items' : `built-in ${options.ref} fixture`}.`,
|
|
123
|
+
],
|
|
124
|
+
});
|
|
125
|
+
return {
|
|
126
|
+
schema_version: 1,
|
|
127
|
+
dry_run: true,
|
|
128
|
+
ref: options.ref,
|
|
129
|
+
fixture: options.items ? 'provided' : options.ref,
|
|
130
|
+
plan,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function resolveFixtureItems(ref) {
|
|
134
|
+
if (ref !== 'EPIC-0039') {
|
|
135
|
+
throw new Error(`No built-in backlog projection fixture for ${ref}. Provide canonical items in code or use EPIC-0039.`);
|
|
136
|
+
}
|
|
137
|
+
return epic0039Fixture;
|
|
138
|
+
}
|
|
139
|
+
function toAzureDevOpsWorkItemType(item) {
|
|
140
|
+
if (item.kind === 'epic')
|
|
141
|
+
return 'Epic';
|
|
142
|
+
if (item.kind === 'feature')
|
|
143
|
+
return 'User Story';
|
|
144
|
+
return item.kind;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=backlog-cli.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { BacklogEntityKind, BacklogProviderId } from './backlog-provider-contract.js';
|
|
2
|
+
export type BacklogConflictClassification = 'none' | 'create' | 'update' | 'manual-review' | 'stale-external' | 'canonical-drift';
|
|
3
|
+
export type BacklogSyncOperation = 'noop' | 'create' | 'update' | 'manual-review';
|
|
4
|
+
export type BacklogSyncDecisionSeverity = 'info' | 'warning' | 'error';
|
|
5
|
+
export interface BacklogSyncFieldSet {
|
|
6
|
+
title: string;
|
|
7
|
+
status: string;
|
|
8
|
+
parent_ref?: string;
|
|
9
|
+
labels?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface CanonicalBacklogSyncItem extends BacklogSyncFieldSet {
|
|
12
|
+
ref: string;
|
|
13
|
+
kind: Exclude<BacklogEntityKind, 'task'>;
|
|
14
|
+
updated_at?: string;
|
|
15
|
+
last_synced_at?: string;
|
|
16
|
+
last_synced_fingerprint?: string;
|
|
17
|
+
fields?: Record<string, string | string[] | undefined>;
|
|
18
|
+
}
|
|
19
|
+
export interface ExternalBacklogWorkItem extends Partial<BacklogSyncFieldSet> {
|
|
20
|
+
provider: BacklogProviderId;
|
|
21
|
+
external_id?: string;
|
|
22
|
+
canonical_ref?: string;
|
|
23
|
+
updated_at?: string;
|
|
24
|
+
last_synced_at?: string;
|
|
25
|
+
codesdd_fingerprint?: string;
|
|
26
|
+
idempotency_key?: string;
|
|
27
|
+
fields?: Record<string, string | string[] | undefined>;
|
|
28
|
+
}
|
|
29
|
+
export interface BacklogConflictDecision {
|
|
30
|
+
code: string;
|
|
31
|
+
severity: BacklogSyncDecisionSeverity;
|
|
32
|
+
message: string;
|
|
33
|
+
field?: string;
|
|
34
|
+
source_of_truth: 'codesdd';
|
|
35
|
+
canonical_value?: unknown;
|
|
36
|
+
external_value?: unknown;
|
|
37
|
+
}
|
|
38
|
+
export interface BacklogConflictPolicyInput {
|
|
39
|
+
provider: BacklogProviderId;
|
|
40
|
+
canonical: CanonicalBacklogSyncItem;
|
|
41
|
+
external?: ExternalBacklogWorkItem;
|
|
42
|
+
source_of_truth?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface BacklogConflictPolicyResult {
|
|
45
|
+
classification: BacklogConflictClassification;
|
|
46
|
+
operation: BacklogSyncOperation;
|
|
47
|
+
idempotency_key: string;
|
|
48
|
+
canonical_fingerprint: string;
|
|
49
|
+
decisions: BacklogConflictDecision[];
|
|
50
|
+
}
|
|
51
|
+
export declare function classifyBacklogSyncConflict(input: BacklogConflictPolicyInput): BacklogConflictPolicyResult;
|
|
52
|
+
export declare function buildBacklogSyncIdempotencyKey(input: {
|
|
53
|
+
provider: BacklogProviderId;
|
|
54
|
+
canonical_ref: string;
|
|
55
|
+
operation: BacklogSyncOperation;
|
|
56
|
+
}): string;
|
|
57
|
+
export declare function fingerprintBacklogSyncFields(fields: BacklogSyncFieldSet): string;
|
|
58
|
+
//# sourceMappingURL=backlog-conflict-policy.d.ts.map
|