@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
|
@@ -7,13 +7,17 @@ import { promisify } from 'node:util';
|
|
|
7
7
|
import * as yaml from 'yaml';
|
|
8
8
|
import { CLI_NAME } from '../branding.js';
|
|
9
9
|
import { LENSES, validateDocumentAgainstLens } from './lenses.js';
|
|
10
|
+
import { detectSddEntityType, normalizeFeatRef } from './entity-reference.js';
|
|
10
11
|
import { TransitionEngine } from './domain/transition-engine.js';
|
|
11
|
-
import {
|
|
12
|
+
import { resolveLegacySpecSubpath } from './services/legacy-capability.service.js';
|
|
12
13
|
import { allocateEntityId, loadProjectSddConfig, loadStateSnapshot, nowIso, resolveSddPaths, } from './state.js';
|
|
13
14
|
import { BUILT_IN_SDD_SKILLS } from './default-skills.js';
|
|
14
15
|
import { renderViews } from './views.js';
|
|
15
16
|
import { normalizeSemanticText } from './dedup.js';
|
|
17
|
+
import { buildWorkspacePolicyInjection } from './skill-policy-pool.js';
|
|
16
18
|
import { stringifyWorkspaceYamlDocument } from './workspace-schemas.js';
|
|
19
|
+
import { parseGovernanceFile } from './governance-parser.js';
|
|
20
|
+
import { debateFrontmatterSchema } from './governance-schemas.js';
|
|
17
21
|
export const execFileAsync = promisify(execFile);
|
|
18
22
|
export const RADAR_TO_DISCOVERY_STATUS = {
|
|
19
23
|
READY: 'READY',
|
|
@@ -55,7 +59,70 @@ export function findDiscoveryRecord(records, id) {
|
|
|
55
59
|
}
|
|
56
60
|
export function markdownDebateTemplate(insight, debateId) {
|
|
57
61
|
const now = nowIso();
|
|
58
|
-
|
|
62
|
+
const frontmatter = yaml
|
|
63
|
+
.stringify({
|
|
64
|
+
schema_version: 1,
|
|
65
|
+
artifact_type: 'DEB',
|
|
66
|
+
id: debateId,
|
|
67
|
+
title: `Debate ${debateId}: ${insight.title}`,
|
|
68
|
+
status: 'OPEN',
|
|
69
|
+
origin: {
|
|
70
|
+
type: 'insight',
|
|
71
|
+
ref: insight.id,
|
|
72
|
+
},
|
|
73
|
+
related_ids: [insight.id],
|
|
74
|
+
created_at: now,
|
|
75
|
+
updated_at: now,
|
|
76
|
+
decision: {
|
|
77
|
+
question: 'Decide ____ instead of ____ to solve ____.',
|
|
78
|
+
options: [
|
|
79
|
+
{ id: 'A', label: 'Option A' },
|
|
80
|
+
{ id: 'B', label: 'Option B' },
|
|
81
|
+
{ id: 'C', label: 'Option C' },
|
|
82
|
+
],
|
|
83
|
+
criteria: ['User impact', 'Implementation complexity', 'Technical risk', 'Operational cost', 'Delivery time'],
|
|
84
|
+
scoring: [
|
|
85
|
+
{
|
|
86
|
+
criterion: 'User impact',
|
|
87
|
+
weight: 3,
|
|
88
|
+
scores: { A: 0, B: 0, C: 0 },
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
criterion: 'Implementation complexity',
|
|
92
|
+
weight: 2,
|
|
93
|
+
scores: { A: 0, B: 0, C: 0 },
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
criterion: 'Technical risk',
|
|
97
|
+
weight: 3,
|
|
98
|
+
scores: { A: 0, B: 0, C: 0 },
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
criterion: 'Operational cost',
|
|
102
|
+
weight: 2,
|
|
103
|
+
scores: { A: 0, B: 0, C: 0 },
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
criterion: 'Delivery time',
|
|
107
|
+
weight: 2,
|
|
108
|
+
scores: { A: 0, B: 0, C: 0 },
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
mediator: {
|
|
112
|
+
choice: 'A',
|
|
113
|
+
rationale: '____',
|
|
114
|
+
accepted_risks: [],
|
|
115
|
+
reversal_conditions: [],
|
|
116
|
+
},
|
|
117
|
+
output: 'APPROVED',
|
|
118
|
+
},
|
|
119
|
+
})
|
|
120
|
+
.trim();
|
|
121
|
+
return `---
|
|
122
|
+
${frontmatter}
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
# Debate ${debateId}
|
|
59
126
|
|
|
60
127
|
## 1) Decision Question (Required)
|
|
61
128
|
Decide ____ instead of ____ to solve ____.
|
|
@@ -135,7 +202,25 @@ Decide ____ instead of ____ to solve ____.
|
|
|
135
202
|
`;
|
|
136
203
|
}
|
|
137
204
|
export function markdownInsightTemplate(id, title, text) {
|
|
138
|
-
|
|
205
|
+
const now = nowIso();
|
|
206
|
+
const frontmatter = yaml
|
|
207
|
+
.stringify({
|
|
208
|
+
schema_version: 1,
|
|
209
|
+
artifact_type: 'INS',
|
|
210
|
+
id,
|
|
211
|
+
title,
|
|
212
|
+
status: 'NEW',
|
|
213
|
+
origin: { type: 'user_prompt' },
|
|
214
|
+
related_ids: [],
|
|
215
|
+
created_at: now,
|
|
216
|
+
updated_at: now,
|
|
217
|
+
})
|
|
218
|
+
.trim();
|
|
219
|
+
return `---
|
|
220
|
+
${frontmatter}
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
# Insight ${id}
|
|
139
224
|
|
|
140
225
|
## Title
|
|
141
226
|
${title}
|
|
@@ -145,14 +230,44 @@ ${text}
|
|
|
145
230
|
`;
|
|
146
231
|
}
|
|
147
232
|
export function markdownRadarTemplate(debate, radarId, rationale) {
|
|
148
|
-
|
|
233
|
+
const now = nowIso();
|
|
234
|
+
const summary = rationale || 'Approved summary pending explicit expansion from the source debate.';
|
|
235
|
+
const frontmatter = yaml
|
|
236
|
+
.stringify({
|
|
237
|
+
schema_version: 1,
|
|
238
|
+
artifact_type: 'EPIC',
|
|
239
|
+
id: radarId,
|
|
240
|
+
title: debate.title,
|
|
241
|
+
status: 'READY',
|
|
242
|
+
origin: { type: 'debate', ref: debate.id },
|
|
243
|
+
related_ids: [debate.id],
|
|
244
|
+
created_at: now,
|
|
245
|
+
updated_at: now,
|
|
246
|
+
approved_summary: summary,
|
|
247
|
+
quality_contract: {
|
|
248
|
+
scope: 'touched_scope',
|
|
249
|
+
unit_target_percent: 95,
|
|
250
|
+
integration_target_percent: 95,
|
|
251
|
+
evidence_mode: 'hybrid',
|
|
252
|
+
},
|
|
253
|
+
lock_domains: [],
|
|
254
|
+
produces: [],
|
|
255
|
+
consumes: [],
|
|
256
|
+
breakdown_policy: 'graph',
|
|
257
|
+
})
|
|
258
|
+
.trim();
|
|
259
|
+
return `---
|
|
260
|
+
${frontmatter}
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
# Epic ${radarId}
|
|
149
264
|
|
|
150
265
|
## Origin
|
|
151
266
|
- Debate: ${debate.id}
|
|
152
267
|
- Base title: ${debate.title}
|
|
153
268
|
|
|
154
269
|
## Approved Summary
|
|
155
|
-
${
|
|
270
|
+
${summary}
|
|
156
271
|
|
|
157
272
|
## Quality Contract
|
|
158
273
|
- Default scope: touched_scope.
|
|
@@ -166,14 +281,44 @@ READY
|
|
|
166
281
|
`;
|
|
167
282
|
}
|
|
168
283
|
export function markdownRadarFromDepositoTemplate(radarId, title, sourceCount, rationale) {
|
|
169
|
-
|
|
284
|
+
const now = nowIso();
|
|
285
|
+
const summary = rationale || 'Initial planning generated from source inputs.';
|
|
286
|
+
const frontmatter = yaml
|
|
287
|
+
.stringify({
|
|
288
|
+
schema_version: 1,
|
|
289
|
+
artifact_type: 'EPIC',
|
|
290
|
+
id: radarId,
|
|
291
|
+
title,
|
|
292
|
+
status: 'READY',
|
|
293
|
+
origin: { type: 'source_intake' },
|
|
294
|
+
related_ids: [],
|
|
295
|
+
created_at: now,
|
|
296
|
+
updated_at: now,
|
|
297
|
+
approved_summary: summary,
|
|
298
|
+
quality_contract: {
|
|
299
|
+
scope: 'touched_scope',
|
|
300
|
+
unit_target_percent: 95,
|
|
301
|
+
integration_target_percent: 95,
|
|
302
|
+
evidence_mode: 'hybrid',
|
|
303
|
+
},
|
|
304
|
+
lock_domains: [],
|
|
305
|
+
produces: [],
|
|
306
|
+
consumes: [],
|
|
307
|
+
breakdown_policy: 'graph',
|
|
308
|
+
})
|
|
309
|
+
.trim();
|
|
310
|
+
return `---
|
|
311
|
+
${frontmatter}
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
# Epic ${radarId}
|
|
170
315
|
|
|
171
316
|
## Origin
|
|
172
317
|
- Origin: source intake
|
|
173
318
|
- Indexed sources: ${sourceCount}
|
|
174
319
|
|
|
175
320
|
## Approved Summary
|
|
176
|
-
${
|
|
321
|
+
${summary}
|
|
177
322
|
|
|
178
323
|
## Quality Contract
|
|
179
324
|
- Default scope: touched_scope.
|
|
@@ -190,14 +335,37 @@ READY
|
|
|
190
335
|
`;
|
|
191
336
|
}
|
|
192
337
|
export function markdownDiscardTemplate(debate, rationale) {
|
|
193
|
-
|
|
338
|
+
const now = nowIso();
|
|
339
|
+
const reason = rationale || '(reason not provided)';
|
|
340
|
+
const frontmatter = yaml
|
|
341
|
+
.stringify({
|
|
342
|
+
schema_version: 1,
|
|
343
|
+
artifact_type: 'Discarded',
|
|
344
|
+
id: debate.id,
|
|
345
|
+
title: debate.title,
|
|
346
|
+
status: 'DISCARDED',
|
|
347
|
+
origin: { type: 'debate', ref: debate.id },
|
|
348
|
+
related_ids: [debate.id],
|
|
349
|
+
created_at: debate.created_at || now,
|
|
350
|
+
updated_at: now,
|
|
351
|
+
discarded_from: debate.id,
|
|
352
|
+
discard_reason: reason,
|
|
353
|
+
discarded_at: now,
|
|
354
|
+
discarded_by: CLI_NAME,
|
|
355
|
+
})
|
|
356
|
+
.trim();
|
|
357
|
+
return `---
|
|
358
|
+
${frontmatter}
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
# Discarded ${debate.id}
|
|
194
362
|
|
|
195
363
|
## Origin
|
|
196
364
|
- Debate: ${debate.id}
|
|
197
365
|
- Title: ${debate.title}
|
|
198
366
|
|
|
199
367
|
## Discard Reason
|
|
200
|
-
${
|
|
368
|
+
${reason}
|
|
201
369
|
`;
|
|
202
370
|
}
|
|
203
371
|
export const DEFAULT_META_EVOLUTION_CONFIG = {
|
|
@@ -369,6 +537,19 @@ export async function collectAuditArtifacts(paths) {
|
|
|
369
537
|
return artifactFiles;
|
|
370
538
|
}
|
|
371
539
|
export function debateHasRealDeliberation(content) {
|
|
540
|
+
try {
|
|
541
|
+
const parsed = parseGovernanceFile('inline-content', content, debateFrontmatterSchema);
|
|
542
|
+
if (parsed.hasFrontmatter && parsed.frontmatter) {
|
|
543
|
+
const choice = parsed.frontmatter.decision.mediator.choice.trim().toLowerCase();
|
|
544
|
+
const rationale = parsed.frontmatter.decision.mediator.rationale.trim().toLowerCase();
|
|
545
|
+
const invalidTokens = ['(preencher', '(fill in', '____', '-', 'todo', 'tbd'];
|
|
546
|
+
const isInvalid = (value, token) => value === token || (token !== '-' && value.includes(token));
|
|
547
|
+
return !invalidTokens.some((token) => isInvalid(choice, token) || isInvalid(rationale, token));
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
catch {
|
|
551
|
+
return false;
|
|
552
|
+
}
|
|
372
553
|
const lower = content.toLowerCase();
|
|
373
554
|
const sectionIndexCandidates = [
|
|
374
555
|
lower.indexOf('## 7) decisao do mediador'),
|
|
@@ -565,6 +746,37 @@ export async function findDebateFile(paths, debateId) {
|
|
|
565
746
|
return path.join(debateDir, found.name);
|
|
566
747
|
}
|
|
567
748
|
export function validateDebateDocument(content) {
|
|
749
|
+
try {
|
|
750
|
+
const parsed = parseGovernanceFile('inline-content', content, debateFrontmatterSchema);
|
|
751
|
+
if (parsed.hasFrontmatter && parsed.frontmatter) {
|
|
752
|
+
const missing = [];
|
|
753
|
+
const question = parsed.frontmatter.decision.question.trim().toLowerCase();
|
|
754
|
+
if (!question || question.includes('____')) {
|
|
755
|
+
missing.push('Fill the decision question with real context');
|
|
756
|
+
}
|
|
757
|
+
const rationale = parsed.frontmatter.decision.mediator.rationale.trim().toLowerCase();
|
|
758
|
+
if (!rationale || rationale.includes('____') || rationale.includes('(fill in') || rationale.includes('(preencher')) {
|
|
759
|
+
missing.push('Inform the mediator decision rationale');
|
|
760
|
+
}
|
|
761
|
+
if (/\- Unit coverage:\s*$/m.test(parsed.body)) {
|
|
762
|
+
missing.push('Inform required unit coverage evidence in the quality contract');
|
|
763
|
+
}
|
|
764
|
+
if (/\- Integration\/e2e or equivalent:\s*$/m.test(parsed.body)) {
|
|
765
|
+
missing.push('Inform integration/e2e or equivalence evidence in the quality contract');
|
|
766
|
+
}
|
|
767
|
+
if (/\- Acceptance and risk matrix:\s*$/m.test(parsed.body)) {
|
|
768
|
+
missing.push('Inform acceptance and risk matrix evidence in the quality contract');
|
|
769
|
+
}
|
|
770
|
+
if (/\- Exceptions:\s*\n\s+- None, or formal exception/m.test(parsed.body)) {
|
|
771
|
+
missing.push('Confirm there is no quality exception or document the formal exception');
|
|
772
|
+
}
|
|
773
|
+
return missing;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
catch (error) {
|
|
777
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
778
|
+
return [`Invalid debate frontmatter: ${message}`];
|
|
779
|
+
}
|
|
568
780
|
const missing = validateDocumentAgainstLens(content, LENSES.debate);
|
|
569
781
|
if (content.includes('Decidir ____ em vez de ____ para resolver ____.') ||
|
|
570
782
|
content.includes('Decide ____ instead of ____ to solve ____.')) {
|
|
@@ -754,7 +966,7 @@ function workspaceExecutionProfileForFeature(feature) {
|
|
|
754
966
|
return {
|
|
755
967
|
id: 'frontend_typescript',
|
|
756
968
|
label: 'frontend workflow',
|
|
757
|
-
description: 'frontend routes, UI coverage, and
|
|
969
|
+
description: 'frontend routes, UI coverage, and CodeSDD frontend guardrails',
|
|
758
970
|
implementationFiles: ['src/', 'app/', 'pages/', 'components/', 'tests/'],
|
|
759
971
|
unitCommand: 'pnpm test -- test/core/sdd-operations.test.ts',
|
|
760
972
|
integrationCommand: 'pnpm test -- test/core/sdd-operations.test.ts',
|
|
@@ -764,9 +976,9 @@ function workspaceExecutionProfileForFeature(feature) {
|
|
|
764
976
|
};
|
|
765
977
|
}
|
|
766
978
|
return {
|
|
767
|
-
id: '
|
|
768
|
-
label: '
|
|
769
|
-
description: '
|
|
979
|
+
id: 'codesdd_typescript',
|
|
980
|
+
label: 'CodeSDD backend workflow',
|
|
981
|
+
description: 'CodeSDD state, command services, and backend validation flows',
|
|
770
982
|
implementationFiles: ['src/core/sdd/legacy-operations.ts'],
|
|
771
983
|
unitCommand: 'pnpm test -- test/core/sdd-operations.test.ts',
|
|
772
984
|
integrationCommand: 'pnpm test -- test/core/sdd-operations.test.ts',
|
|
@@ -789,7 +1001,7 @@ export function buildActiveSpecDoc(feature) {
|
|
|
789
1001
|
},
|
|
790
1002
|
objective,
|
|
791
1003
|
expected_outcome: ensureMinLength(`${feature.title} is implemented with acceptance refs, dependencies, and quality evidence visible to the next agent.`, `Feature ${feature.id} reaches a verifiable done state with generated workspace artifacts and canonical SDD state in sync.`, 50),
|
|
792
|
-
system_impact: ensureMinLength('Preserve canonical SDD state, generated views, documentation sync, and handoff context without hidden operational memory.', `System impact for ${feature.id} remains visible in
|
|
1004
|
+
system_impact: ensureMinLength('Preserve canonical SDD state, generated views, documentation sync, and handoff context without hidden operational memory.', `System impact for ${feature.id} remains visible in CodeSDD state and workspace artifacts.`, 30),
|
|
793
1005
|
acceptance_refs: feature.acceptance_refs.length > 0 ? feature.acceptance_refs : [feature.origin_ref || feature.id],
|
|
794
1006
|
gates: feature.gates,
|
|
795
1007
|
created_at: now,
|
|
@@ -808,6 +1020,7 @@ export function buildActiveSpecDoc(feature) {
|
|
|
808
1020
|
}
|
|
809
1021
|
export function buildActivePlanDoc(feature, recommendedBundles) {
|
|
810
1022
|
const profile = workspaceExecutionProfileForFeature(feature);
|
|
1023
|
+
const policyInjection = buildWorkspacePolicyInjection(feature.recommended_skills);
|
|
811
1024
|
const affectedContracts = [
|
|
812
1025
|
...feature.consumes.map((name) => ({ name, change_type: 'consumes' })),
|
|
813
1026
|
...feature.produces.map((name) => ({ name, change_type: 'produces' })),
|
|
@@ -836,6 +1049,7 @@ export function buildActivePlanDoc(feature, recommendedBundles) {
|
|
|
836
1049
|
detected_conflicts: [],
|
|
837
1050
|
architecture_tree_ascii: profile.architectureTreeAscii,
|
|
838
1051
|
},
|
|
1052
|
+
policy_injection: policyInjection,
|
|
839
1053
|
};
|
|
840
1054
|
if (isPrivacyComplianceFeature(feature)) {
|
|
841
1055
|
baseDocument.privacy_controls = {
|
|
@@ -855,6 +1069,8 @@ export function buildActiveQualityDoc(feature) {
|
|
|
855
1069
|
const profile = workspaceExecutionProfileForFeature(feature);
|
|
856
1070
|
const targetedTestCommand = testCommandForFeature(feature);
|
|
857
1071
|
const requiredSkillIds = Array.from(new Set(feature.recommended_skills.filter(Boolean)));
|
|
1072
|
+
const requirementRefs = Array.from(new Set([`${feature.id}-R1`, ...(feature.acceptance_refs ?? []).map((ref) => ref.trim()).filter(Boolean)]));
|
|
1073
|
+
const policyInjection = buildWorkspacePolicyInjection(requiredSkillIds);
|
|
858
1074
|
const baseDocument = {
|
|
859
1075
|
schema_version: 1,
|
|
860
1076
|
feature_id: feature.id,
|
|
@@ -877,6 +1093,14 @@ export function buildActiveQualityDoc(feature) {
|
|
|
877
1093
|
evidence_log: [],
|
|
878
1094
|
skill_evidence: {
|
|
879
1095
|
required_skill_ids: requiredSkillIds,
|
|
1096
|
+
policy_requirements: policyInjection.required_policies.map((policy) => ({
|
|
1097
|
+
skill_id: policy.skill_id,
|
|
1098
|
+
policy_pool_ref: policy.policy_pool_ref,
|
|
1099
|
+
source_contract_ref: policy.source_contract_ref,
|
|
1100
|
+
enforcement: policy.enforcement,
|
|
1101
|
+
required_rule_refs: policy.required_rule_refs,
|
|
1102
|
+
required_evidence: policy.required_evidence,
|
|
1103
|
+
})),
|
|
880
1104
|
evidence: [],
|
|
881
1105
|
verification_rule: requiredSkillIds.length > 0
|
|
882
1106
|
? `Record one evidence entry per required skill before finalize: ${requiredSkillIds.join(', ')}.`
|
|
@@ -887,6 +1111,14 @@ export function buildActiveQualityDoc(feature) {
|
|
|
887
1111
|
status: 'not_met',
|
|
888
1112
|
evidence: 'Evidence must be recorded before finalize.',
|
|
889
1113
|
})),
|
|
1114
|
+
requirement_validation_evidence_risk_matrix: requirementRefs.map((requirementRef) => ({
|
|
1115
|
+
requirement_ref: requirementRef,
|
|
1116
|
+
validation_refs: ['Targeted tests', 'Build'],
|
|
1117
|
+
evidence_refs: ['Tasks must be completed with validation evidence.'],
|
|
1118
|
+
residual_risk: 'Residual risk must be documented with mitigation before finalize.',
|
|
1119
|
+
risk_status: 'open',
|
|
1120
|
+
})),
|
|
1121
|
+
policy_injection: policyInjection,
|
|
890
1122
|
exceptions: contract.exceptions.map((exception) => ({
|
|
891
1123
|
scope: exception.scope,
|
|
892
1124
|
reason: exception.reason,
|
|
@@ -904,6 +1136,47 @@ export function buildActiveQualityDoc(feature) {
|
|
|
904
1136
|
},
|
|
905
1137
|
requirements: [],
|
|
906
1138
|
},
|
|
1139
|
+
q95_ledger: {
|
|
1140
|
+
threshold: 95,
|
|
1141
|
+
score: 0,
|
|
1142
|
+
status: 'pending',
|
|
1143
|
+
computed_at: '',
|
|
1144
|
+
weights: {
|
|
1145
|
+
coverage: 30,
|
|
1146
|
+
traceability: 20,
|
|
1147
|
+
integrity: 20,
|
|
1148
|
+
naming: 10,
|
|
1149
|
+
token: 20,
|
|
1150
|
+
},
|
|
1151
|
+
axes: {
|
|
1152
|
+
coverage: {
|
|
1153
|
+
raw_score: 0,
|
|
1154
|
+
weighted_score: 0,
|
|
1155
|
+
rationale: 'Computed during finalize.',
|
|
1156
|
+
},
|
|
1157
|
+
traceability: {
|
|
1158
|
+
raw_score: 0,
|
|
1159
|
+
weighted_score: 0,
|
|
1160
|
+
rationale: 'Computed during finalize.',
|
|
1161
|
+
},
|
|
1162
|
+
integrity: {
|
|
1163
|
+
raw_score: 0,
|
|
1164
|
+
weighted_score: 0,
|
|
1165
|
+
rationale: 'Computed during finalize.',
|
|
1166
|
+
},
|
|
1167
|
+
naming: {
|
|
1168
|
+
raw_score: 0,
|
|
1169
|
+
weighted_score: 0,
|
|
1170
|
+
rationale: 'Computed during finalize.',
|
|
1171
|
+
},
|
|
1172
|
+
token: {
|
|
1173
|
+
raw_score: 0,
|
|
1174
|
+
weighted_score: 0,
|
|
1175
|
+
rationale: 'Computed during finalize.',
|
|
1176
|
+
},
|
|
1177
|
+
},
|
|
1178
|
+
next_best_action: 'Record missing evidence to raise the lowest weighted axis.',
|
|
1179
|
+
},
|
|
907
1180
|
};
|
|
908
1181
|
if (isPrivacyComplianceFeature(feature)) {
|
|
909
1182
|
baseDocument.security_integrity = {
|
|
@@ -926,18 +1199,23 @@ export function buildActiveTasksDoc(feature, paths) {
|
|
|
926
1199
|
? feature.recommended_skills.join(', ')
|
|
927
1200
|
: 'architecture and api-design-principles';
|
|
928
1201
|
const summary = feature.summary || `Deliver ${feature.title} for ${scope.description}.`;
|
|
1202
|
+
const policyInjection = buildWorkspacePolicyInjection(feature.recommended_skills);
|
|
1203
|
+
const policySummary = policyInjection.required_policies.length > 0
|
|
1204
|
+
? ` Policy requirements injected for ${policyInjection.required_policies.map((policy) => policy.skill_id).join(', ')}.`
|
|
1205
|
+
: '';
|
|
929
1206
|
return workspaceYamlDoc('3-tasks.yaml', {
|
|
930
1207
|
schema_version: 1,
|
|
931
1208
|
feature_id: feature.id,
|
|
1209
|
+
policy_injection: policyInjection,
|
|
932
1210
|
tasks: [
|
|
933
1211
|
{
|
|
934
1212
|
id: `${feature.id}-T1`,
|
|
935
1213
|
phase: 'preparation',
|
|
936
1214
|
title: `Frame ${feature.title}`,
|
|
937
|
-
description: `Run ${CLI_NAME} sdd context ${feature.id}, confirm ${scope.description}, review ${skills}, and turn the feature summary into concrete acceptance checks: ${summary}`,
|
|
1215
|
+
description: `Run ${CLI_NAME} sdd context ${feature.id}, confirm ${scope.description}, review ${skills}, and turn the feature summary into concrete acceptance checks: ${summary}${policySummary}`,
|
|
938
1216
|
files_touched: ['.sdd/state/backlog.yaml', '.sdd/state/discovery-index.yaml'],
|
|
939
1217
|
test_scripts: [],
|
|
940
|
-
acceptance: `The implementation plan names the ${scope.description} files, expected validation commands, and any dependency or lock-domain risk before edits begin.`,
|
|
1218
|
+
acceptance: `The implementation plan names the ${scope.description} files, injected policy requirements, expected validation commands, and any dependency or lock-domain risk before edits begin.`,
|
|
941
1219
|
status: 'pending',
|
|
942
1220
|
},
|
|
943
1221
|
{
|
|
@@ -947,7 +1225,7 @@ export function buildActiveTasksDoc(feature, paths) {
|
|
|
947
1225
|
description: `Apply the ${feature.title} changes in ${touchedFiles.join(', ')} while preserving existing public contracts and SDD state transitions.`,
|
|
948
1226
|
files_touched: touchedFiles,
|
|
949
1227
|
test_scripts: [],
|
|
950
|
-
acceptance: `The ${scope.label} behavior is implemented, uses existing
|
|
1228
|
+
acceptance: `The ${scope.label} behavior is implemented, uses existing CodeSDD patterns, and keeps generated workspace/state artifacts valid.`,
|
|
951
1229
|
status: 'pending',
|
|
952
1230
|
},
|
|
953
1231
|
{
|
|
@@ -985,16 +1263,32 @@ export function buildActiveTasksDoc(feature, paths) {
|
|
|
985
1263
|
id: `${feature.id}-T5`,
|
|
986
1264
|
phase: 'finalization',
|
|
987
1265
|
title: `Finalize ${feature.id}`,
|
|
988
|
-
description: `Declare frontend impact, ensure 5-quality.yaml has evidence meeting coverage targets or a formal exception, then finalize with ${CLI_NAME} sdd finalize --ref ${feature.id}.`,
|
|
989
|
-
files_touched: [
|
|
1266
|
+
description: `Declare frontend impact, ensure 5-quality.yaml has evidence meeting coverage targets or a formal exception, then finalize with ${CLI_NAME} sdd finalize --ref ${feature.id}. After finalize, run ${CLI_NAME} sdd diagnose and ${CLI_NAME} sdd check --render, confirm ${feature.id} is DONE with current_stage consolidacao, confirm done_at and archived_at are set, confirm .sdd/archived/${feature.id}/ exists, confirm .sdd/active/${feature.id}/ no longer exists, and triage any remote security warnings such as Dependabot as an in-scope fix, formal exception, or follow-up SDD item before reporting completion.`,
|
|
1267
|
+
files_touched: [
|
|
1268
|
+
'.sdd/active/<FEAT-ID>/5-quality.yaml',
|
|
1269
|
+
'.sdd/archived/<FEAT-ID>/',
|
|
1270
|
+
'.sdd/state/backlog.yaml',
|
|
1271
|
+
'.sdd/state/finalize-queue.yaml',
|
|
1272
|
+
'.sdd/state/transition-log.yaml',
|
|
1273
|
+
],
|
|
990
1274
|
test_scripts: [
|
|
991
1275
|
{
|
|
992
1276
|
command: profile.buildCommand,
|
|
993
1277
|
type: 'build',
|
|
994
1278
|
expected: profile.buildExpected,
|
|
995
1279
|
},
|
|
1280
|
+
{
|
|
1281
|
+
command: `${CLI_NAME} sdd diagnose`,
|
|
1282
|
+
type: 'sdd',
|
|
1283
|
+
expected: 'SDD structural health is healthy after finalize.',
|
|
1284
|
+
},
|
|
1285
|
+
{
|
|
1286
|
+
command: `${CLI_NAME} sdd check --render`,
|
|
1287
|
+
type: 'sdd',
|
|
1288
|
+
expected: 'Rendered SDD state is valid and completed FEAT status is coherent.',
|
|
1289
|
+
},
|
|
996
1290
|
],
|
|
997
|
-
acceptance:
|
|
1291
|
+
acceptance: `${feature.id} is DONE in .sdd/state/backlog.yaml, current_stage is consolidacao, done_at and archived_at are set, the workspace lives under .sdd/archived/${feature.id}/, no .sdd/active/${feature.id}/ residue remains, SDD diagnose/check pass, and any remote security warning observed during push or validation is recorded with a fix, exception, or follow-up SDD reference.`,
|
|
998
1292
|
status: 'pending',
|
|
999
1293
|
},
|
|
1000
1294
|
],
|
|
@@ -1008,9 +1302,25 @@ function taskScopeForFeature(feature) {
|
|
|
1008
1302
|
feature.summary || '',
|
|
1009
1303
|
].join(' ').toLowerCase();
|
|
1010
1304
|
const profile = workspaceExecutionProfileForFeature(feature);
|
|
1011
|
-
if (profile.id !== '
|
|
1305
|
+
if (profile.id !== 'codesdd_typescript') {
|
|
1012
1306
|
return { label: profile.label, description: profile.description };
|
|
1013
1307
|
}
|
|
1308
|
+
if (includesAny(tokens, [
|
|
1309
|
+
'creditos',
|
|
1310
|
+
'créditos',
|
|
1311
|
+
'clean-room',
|
|
1312
|
+
'clean room',
|
|
1313
|
+
'licenca',
|
|
1314
|
+
'licença',
|
|
1315
|
+
'license',
|
|
1316
|
+
'notices',
|
|
1317
|
+
'notice',
|
|
1318
|
+
])) {
|
|
1319
|
+
return {
|
|
1320
|
+
label: 'governance docs workflow',
|
|
1321
|
+
description: 'credits clean-room boundary, runtime license notices, and repository documentation governance',
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1014
1324
|
if (tokens.includes('skill')) {
|
|
1015
1325
|
return { label: 'skill distribution workflow', description: 'built-in skills, skill catalog state, and distribution templates' };
|
|
1016
1326
|
}
|
|
@@ -1018,7 +1328,7 @@ function taskScopeForFeature(feature) {
|
|
|
1018
1328
|
return { label: 'workspace schema workflow', description: 'workspace YAML documents, schemas, and SDD write validation' };
|
|
1019
1329
|
}
|
|
1020
1330
|
if (tokens.includes('sdd') || tokens.includes('backend') || tokens.includes('architecture')) {
|
|
1021
|
-
return { label: '
|
|
1331
|
+
return { label: 'CodeSDD backend workflow', description: 'CodeSDD state, command services, and backend validation flows' };
|
|
1022
1332
|
}
|
|
1023
1333
|
return { label: 'feature scope', description: feature.touches.join(', ') || 'the declared feature scope' };
|
|
1024
1334
|
}
|
|
@@ -1038,6 +1348,22 @@ function filesForFeatureScope(feature, paths) {
|
|
|
1038
1348
|
];
|
|
1039
1349
|
}
|
|
1040
1350
|
const files = new Set();
|
|
1351
|
+
if (includesAny(tokens, [
|
|
1352
|
+
'creditos',
|
|
1353
|
+
'créditos',
|
|
1354
|
+
'clean-room',
|
|
1355
|
+
'clean room',
|
|
1356
|
+
'licenca',
|
|
1357
|
+
'licença',
|
|
1358
|
+
'license',
|
|
1359
|
+
'notices',
|
|
1360
|
+
'notice',
|
|
1361
|
+
])) {
|
|
1362
|
+
files.add('docs/CREDITS.md');
|
|
1363
|
+
files.add('docs/THIRD_PARTY_NOTICES.md');
|
|
1364
|
+
files.add('README.md');
|
|
1365
|
+
files.add('src/core/sdd/legacy-operations.ts');
|
|
1366
|
+
}
|
|
1041
1367
|
if (tokens.includes('schema') || tokens.includes('yaml') || tokens.includes('workspace')) {
|
|
1042
1368
|
files.add('src/core/sdd/workspace-schemas.ts');
|
|
1043
1369
|
files.add('src/core/sdd/legacy-operations.ts');
|
|
@@ -1073,6 +1399,19 @@ function testCommandForFeature(feature) {
|
|
|
1073
1399
|
feature.title,
|
|
1074
1400
|
feature.summary || '',
|
|
1075
1401
|
].join(' ').toLowerCase();
|
|
1402
|
+
if (includesAny(tokens, [
|
|
1403
|
+
'creditos',
|
|
1404
|
+
'créditos',
|
|
1405
|
+
'clean-room',
|
|
1406
|
+
'clean room',
|
|
1407
|
+
'licenca',
|
|
1408
|
+
'licença',
|
|
1409
|
+
'license',
|
|
1410
|
+
'notices',
|
|
1411
|
+
'notice',
|
|
1412
|
+
])) {
|
|
1413
|
+
return 'pnpm test -- test/core/sdd-operations.test.ts';
|
|
1414
|
+
}
|
|
1076
1415
|
if (tokens.includes('quality') || tokens.includes('task') || tokens.includes('finalize')) {
|
|
1077
1416
|
return 'pnpm test -- test/core/sdd/task-quality-schemas.test.ts';
|
|
1078
1417
|
}
|
|
@@ -1192,9 +1531,10 @@ export function resolveRadar(record) {
|
|
|
1192
1531
|
}
|
|
1193
1532
|
}
|
|
1194
1533
|
export function resolveFeat(items, id) {
|
|
1195
|
-
const
|
|
1534
|
+
const normalizedId = normalizeFeatRef(id) ?? id.trim();
|
|
1535
|
+
const feat = items.find((item) => item.id === normalizedId);
|
|
1196
1536
|
if (!feat) {
|
|
1197
|
-
throw new Error(`Feature ${
|
|
1537
|
+
throw new Error(`Feature ${normalizedId} nao encontrada no backlog.`);
|
|
1198
1538
|
}
|
|
1199
1539
|
return feat;
|
|
1200
1540
|
}
|
|
@@ -1291,6 +1631,38 @@ export function classifyFeatureShape(title, contextTokens = []) {
|
|
|
1291
1631
|
const titleNormalized = title.toLowerCase();
|
|
1292
1632
|
const contextNormalized = contextTokens.join(' ').toLowerCase();
|
|
1293
1633
|
const normalized = [titleNormalized, contextNormalized].join(' ').toLowerCase();
|
|
1634
|
+
const isDocumentationGovernanceWork = includesAny(normalized, [
|
|
1635
|
+
'docs',
|
|
1636
|
+
'documentacao',
|
|
1637
|
+
'documentation',
|
|
1638
|
+
'adr',
|
|
1639
|
+
'manual',
|
|
1640
|
+
'review',
|
|
1641
|
+
'revisao',
|
|
1642
|
+
'migration plan',
|
|
1643
|
+
'plano de migracao',
|
|
1644
|
+
'naming',
|
|
1645
|
+
'nomeacao',
|
|
1646
|
+
]) &&
|
|
1647
|
+
!includesAny(normalized, [
|
|
1648
|
+
'seed',
|
|
1649
|
+
'backfill',
|
|
1650
|
+
'database migration',
|
|
1651
|
+
'db migration',
|
|
1652
|
+
'schema migration',
|
|
1653
|
+
'migracao de banco',
|
|
1654
|
+
'migracao de dados',
|
|
1655
|
+
]);
|
|
1656
|
+
if (isDocumentationGovernanceWork) {
|
|
1657
|
+
return {
|
|
1658
|
+
executionKind: 'documentation',
|
|
1659
|
+
touches: ['docs'],
|
|
1660
|
+
lockDomains: [],
|
|
1661
|
+
produces: ['documentacao-atualizada'],
|
|
1662
|
+
consumes: ['implementacao-concluida'],
|
|
1663
|
+
planningMode: 'direct_tasks',
|
|
1664
|
+
};
|
|
1665
|
+
}
|
|
1294
1666
|
if (includesAny(normalized, ['migracao', 'migration', 'seed', 'backfill'])) {
|
|
1295
1667
|
return {
|
|
1296
1668
|
executionKind: 'migration',
|
|
@@ -1368,7 +1740,7 @@ export function classifyFeatureShape(title, contextTokens = []) {
|
|
|
1368
1740
|
planningMode: 'local_plan',
|
|
1369
1741
|
};
|
|
1370
1742
|
}
|
|
1371
|
-
if (includesAny(normalized, ['docs', 'documentacao', 'adr', 'manual'])) {
|
|
1743
|
+
if (includesAny(normalized, ['docs', 'documentacao', 'documentation', 'adr', 'manual'])) {
|
|
1372
1744
|
return {
|
|
1373
1745
|
executionKind: 'documentation',
|
|
1374
1746
|
touches: ['docs'],
|
|
@@ -1608,8 +1980,12 @@ export async function maybeCreateAutomaticFrontendGap(paths, snapshot, feature,
|
|
|
1608
1980
|
export function resolveRoutedSkills(snapshot, touches) {
|
|
1609
1981
|
const knownSkills = new Set((snapshot.skillCatalog?.skills || []).map((skill) => skill.id));
|
|
1610
1982
|
let injectedSkills = [];
|
|
1611
|
-
|
|
1612
|
-
|
|
1983
|
+
const hasPythonApiOverride = touches.some((touch) => ['python', 'flask', 'langgraph', 'langchain'].includes(touch));
|
|
1984
|
+
const routeTouches = hasPythonApiOverride
|
|
1985
|
+
? touches.filter((touch) => touch !== 'backend' && touch !== 'api')
|
|
1986
|
+
: touches;
|
|
1987
|
+
if (routeTouches.length > 0 && snapshot.skillRouting && snapshot.skillRouting.routes) {
|
|
1988
|
+
for (const touch of routeTouches) {
|
|
1613
1989
|
const route = snapshot.skillRouting.routes.find((r) => r.domain === touch);
|
|
1614
1990
|
if (route && route.skills) {
|
|
1615
1991
|
injectedSkills.push(...route.skills);
|
|
@@ -1641,7 +2017,7 @@ export function inferOriginType(input) {
|
|
|
1641
2017
|
}
|
|
1642
2018
|
export async function buildFinalizeQueue(paths, backlogItems, queueItems) {
|
|
1643
2019
|
const queueByFeature = new Map(queueItems.map((item) => [item.feature_id, item]));
|
|
1644
|
-
const archiveRoot =
|
|
2020
|
+
const archiveRoot = resolveLegacySpecSubpath(paths.projectRoot, 'changes', 'archive');
|
|
1645
2021
|
for (const item of backlogItems) {
|
|
1646
2022
|
if (!item.change_name)
|
|
1647
2023
|
continue;
|
|
@@ -1708,8 +2084,30 @@ export async function evaluateFeatureQuality(paths, config, feature) {
|
|
|
1708
2084
|
};
|
|
1709
2085
|
}
|
|
1710
2086
|
export function buildAdrMarkdown(feature, unlocked, timestamp) {
|
|
1711
|
-
const refs = [feature.id, feature.origin_ref].filter(Boolean)
|
|
1712
|
-
|
|
2087
|
+
const refs = [feature.id, feature.origin_ref].filter(Boolean);
|
|
2088
|
+
const refsText = refs.join(', ') || '-';
|
|
2089
|
+
const frontmatter = yaml
|
|
2090
|
+
.stringify({
|
|
2091
|
+
schema_version: 1,
|
|
2092
|
+
artifact_type: 'ADR',
|
|
2093
|
+
id: `ADR-${feature.id}`,
|
|
2094
|
+
feature_id: feature.id,
|
|
2095
|
+
title: `ADR ${feature.id}: ${feature.title}`,
|
|
2096
|
+
status: feature.status,
|
|
2097
|
+
origin: { type: 'feature', ref: feature.id },
|
|
2098
|
+
related_ids: refs,
|
|
2099
|
+
created_at: timestamp,
|
|
2100
|
+
updated_at: timestamp,
|
|
2101
|
+
decision_status: 'ACCEPTED',
|
|
2102
|
+
supersedes: [],
|
|
2103
|
+
superseded_by: [],
|
|
2104
|
+
references: refs,
|
|
2105
|
+
})
|
|
2106
|
+
.trim();
|
|
2107
|
+
return `---
|
|
2108
|
+
${frontmatter}
|
|
2109
|
+
---
|
|
2110
|
+
# ADR ${feature.id}
|
|
1713
2111
|
|
|
1714
2112
|
## Context
|
|
1715
2113
|
- Feature: ${feature.id} - ${feature.title}
|
|
@@ -1732,7 +2130,7 @@ Consolidate feature ${feature.id} and make the result official in SDD memory.
|
|
|
1732
2130
|
${unlocked.length > 0 ? unlocked.map((id) => `- ${id}`).join('\n') : '- None'}
|
|
1733
2131
|
|
|
1734
2132
|
## References
|
|
1735
|
-
- ${
|
|
2133
|
+
- ${refsText}
|
|
1736
2134
|
`;
|
|
1737
2135
|
}
|
|
1738
2136
|
export function applyLoggedTransition(transitionLog, entityType, entity, toStatus, options) {
|
|
@@ -1762,17 +2160,7 @@ export function gateSatisfied(status) {
|
|
|
1762
2160
|
return status === 'aprovada' || status === 'nao_exigida';
|
|
1763
2161
|
}
|
|
1764
2162
|
export function detectContextType(ref) {
|
|
1765
|
-
|
|
1766
|
-
return 'FEAT';
|
|
1767
|
-
if (/^EPIC-\d{3,}$/.test(ref))
|
|
1768
|
-
return 'EPIC';
|
|
1769
|
-
if (/^RAD-\d{3,}$/.test(ref))
|
|
1770
|
-
return 'RAD';
|
|
1771
|
-
if (/^FGAP-\d{3,}$/.test(ref))
|
|
1772
|
-
return 'FGAP';
|
|
1773
|
-
if (/^TD-\d{3,}$/.test(ref))
|
|
1774
|
-
return 'TD';
|
|
1775
|
-
return null;
|
|
2163
|
+
return detectSddEntityType(ref);
|
|
1776
2164
|
}
|
|
1777
2165
|
export async function pathExists(targetPath) {
|
|
1778
2166
|
try {
|
|
@@ -2170,6 +2558,6 @@ Regras:
|
|
|
2170
2558
|
1. Cite as skills que esta aplicando no inicio da resposta.
|
|
2171
2559
|
2. Siga a ordem definida acima.
|
|
2172
2560
|
3. Se faltar contexto, consulte primeiro o estado canônico em .sdd/state/*.yaml.
|
|
2173
|
-
4. Finalize com proximos comandos
|
|
2561
|
+
4. Finalize com proximos comandos CodeSDD recomendados.`;
|
|
2174
2562
|
}
|
|
2175
2563
|
//# sourceMappingURL=legacy-operations.js.map
|