@devtrack-solution/codesdd 1.2.2
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 +2751 -0
- package/.sdd/skills/curated/devtrack-api/SKILL.md +137 -0
- package/.sdd/skills/curated/devtrack-api/agents/openai.yaml +4 -0
- package/.sdd/skills/curated/devtrack-api/references/application-presentation.md +381 -0
- package/.sdd/skills/curated/devtrack-api/references/architecture-governance.md +219 -0
- package/.sdd/skills/curated/devtrack-api/references/domain-modeling.md +359 -0
- package/.sdd/skills/curated/devtrack-api/references/implementation-checklist.md +127 -0
- package/.sdd/skills/curated/devtrack-api/references/imports-lint.md +207 -0
- package/.sdd/skills/curated/devtrack-api/references/testing-validation.md +167 -0
- package/.sdd/skills/curated/devtrack-api/references/typeorm-infrastructure.md +334 -0
- package/LICENSE +21 -0
- package/README.md +842 -0
- package/bin/codesdd.js +10 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +560 -0
- package/dist/commands/change.d.ts +35 -0
- package/dist/commands/change.js +296 -0
- package/dist/commands/completion.d.ts +72 -0
- package/dist/commands/completion.js +258 -0
- package/dist/commands/config.d.ts +36 -0
- package/dist/commands/config.js +552 -0
- package/dist/commands/feedback.d.ts +9 -0
- package/dist/commands/feedback.js +184 -0
- package/dist/commands/schema.d.ts +6 -0
- package/dist/commands/schema.js +870 -0
- package/dist/commands/sdd/execution.d.ts +3 -0
- package/dist/commands/sdd/execution.js +409 -0
- package/dist/commands/sdd/shared.d.ts +9 -0
- package/dist/commands/sdd/shared.js +84 -0
- package/dist/commands/sdd/skills.d.ts +3 -0
- package/dist/commands/sdd/skills.js +154 -0
- package/dist/commands/sdd.d.ts +3 -0
- package/dist/commands/sdd.js +769 -0
- package/dist/commands/show.d.ts +14 -0
- package/dist/commands/show.js +133 -0
- package/dist/commands/spec.d.ts +15 -0
- package/dist/commands/spec.js +228 -0
- package/dist/commands/validate.d.ts +24 -0
- package/dist/commands/validate.js +295 -0
- package/dist/commands/workflow/index.d.ts +17 -0
- package/dist/commands/workflow/index.js +12 -0
- package/dist/commands/workflow/instructions.d.ts +29 -0
- package/dist/commands/workflow/instructions.js +383 -0
- package/dist/commands/workflow/new-change.d.ts +11 -0
- package/dist/commands/workflow/new-change.js +45 -0
- package/dist/commands/workflow/schemas.d.ts +10 -0
- package/dist/commands/workflow/schemas.js +34 -0
- package/dist/commands/workflow/shared.d.ts +57 -0
- package/dist/commands/workflow/shared.js +117 -0
- package/dist/commands/workflow/status.d.ts +14 -0
- package/dist/commands/workflow/status.js +76 -0
- package/dist/commands/workflow/templates.d.ts +16 -0
- package/dist/commands/workflow/templates.js +68 -0
- package/dist/core/archive.d.ts +16 -0
- package/dist/core/archive.js +487 -0
- package/dist/core/artifact-graph/graph.d.ts +56 -0
- package/dist/core/artifact-graph/graph.js +141 -0
- package/dist/core/artifact-graph/index.d.ts +7 -0
- package/dist/core/artifact-graph/index.js +13 -0
- package/dist/core/artifact-graph/instruction-loader.d.ts +143 -0
- package/dist/core/artifact-graph/instruction-loader.js +215 -0
- package/dist/core/artifact-graph/resolver.d.ts +81 -0
- package/dist/core/artifact-graph/resolver.js +258 -0
- package/dist/core/artifact-graph/schema.d.ts +13 -0
- package/dist/core/artifact-graph/schema.js +108 -0
- package/dist/core/artifact-graph/state.d.ts +12 -0
- package/dist/core/artifact-graph/state.js +54 -0
- package/dist/core/artifact-graph/types.d.ts +45 -0
- package/dist/core/artifact-graph/types.js +43 -0
- package/dist/core/available-tools.d.ts +16 -0
- package/dist/core/available-tools.js +30 -0
- package/dist/core/branding.d.ts +8 -0
- package/dist/core/branding.js +12 -0
- package/dist/core/cli/command-matrix.d.ts +23 -0
- package/dist/core/cli/command-matrix.js +123 -0
- package/dist/core/command-generation/adapters/amazon-q.d.ts +13 -0
- package/dist/core/command-generation/adapters/amazon-q.js +26 -0
- package/dist/core/command-generation/adapters/antigravity.d.ts +13 -0
- package/dist/core/command-generation/adapters/antigravity.js +26 -0
- package/dist/core/command-generation/adapters/auggie.d.ts +13 -0
- package/dist/core/command-generation/adapters/auggie.js +27 -0
- package/dist/core/command-generation/adapters/claude.d.ts +13 -0
- package/dist/core/command-generation/adapters/claude.js +50 -0
- package/dist/core/command-generation/adapters/cline.d.ts +14 -0
- package/dist/core/command-generation/adapters/cline.js +27 -0
- package/dist/core/command-generation/adapters/codebuddy.d.ts +13 -0
- package/dist/core/command-generation/adapters/codebuddy.js +28 -0
- package/dist/core/command-generation/adapters/codex.d.ts +16 -0
- package/dist/core/command-generation/adapters/codex.js +39 -0
- package/dist/core/command-generation/adapters/continue.d.ts +13 -0
- package/dist/core/command-generation/adapters/continue.js +28 -0
- package/dist/core/command-generation/adapters/costrict.d.ts +13 -0
- package/dist/core/command-generation/adapters/costrict.js +27 -0
- package/dist/core/command-generation/adapters/crush.d.ts +13 -0
- package/dist/core/command-generation/adapters/crush.js +30 -0
- package/dist/core/command-generation/adapters/cursor.d.ts +14 -0
- package/dist/core/command-generation/adapters/cursor.js +44 -0
- package/dist/core/command-generation/adapters/factory.d.ts +13 -0
- package/dist/core/command-generation/adapters/factory.js +27 -0
- package/dist/core/command-generation/adapters/gemini.d.ts +13 -0
- package/dist/core/command-generation/adapters/gemini.js +26 -0
- package/dist/core/command-generation/adapters/github-copilot.d.ts +13 -0
- package/dist/core/command-generation/adapters/github-copilot.js +26 -0
- package/dist/core/command-generation/adapters/iflow.d.ts +13 -0
- package/dist/core/command-generation/adapters/iflow.js +29 -0
- package/dist/core/command-generation/adapters/index.d.ts +29 -0
- package/dist/core/command-generation/adapters/index.js +29 -0
- package/dist/core/command-generation/adapters/kilocode.d.ts +14 -0
- package/dist/core/command-generation/adapters/kilocode.js +23 -0
- package/dist/core/command-generation/adapters/kiro.d.ts +13 -0
- package/dist/core/command-generation/adapters/kiro.js +26 -0
- package/dist/core/command-generation/adapters/opencode.d.ts +13 -0
- package/dist/core/command-generation/adapters/opencode.js +29 -0
- package/dist/core/command-generation/adapters/pi.d.ts +14 -0
- package/dist/core/command-generation/adapters/pi.js +41 -0
- package/dist/core/command-generation/adapters/qoder.d.ts +13 -0
- package/dist/core/command-generation/adapters/qoder.js +30 -0
- package/dist/core/command-generation/adapters/qwen.d.ts +13 -0
- package/dist/core/command-generation/adapters/qwen.js +26 -0
- package/dist/core/command-generation/adapters/roocode.d.ts +14 -0
- package/dist/core/command-generation/adapters/roocode.js +27 -0
- package/dist/core/command-generation/adapters/windsurf.d.ts +14 -0
- package/dist/core/command-generation/adapters/windsurf.js +51 -0
- package/dist/core/command-generation/generator.d.ts +21 -0
- package/dist/core/command-generation/generator.js +27 -0
- package/dist/core/command-generation/index.d.ts +22 -0
- package/dist/core/command-generation/index.js +24 -0
- package/dist/core/command-generation/registry.d.ts +36 -0
- package/dist/core/command-generation/registry.js +92 -0
- package/dist/core/command-generation/types.d.ts +56 -0
- package/dist/core/command-generation/types.js +8 -0
- package/dist/core/completions/command-registry.d.ts +7 -0
- package/dist/core/completions/command-registry.js +461 -0
- package/dist/core/completions/completion-provider.d.ts +60 -0
- package/dist/core/completions/completion-provider.js +102 -0
- package/dist/core/completions/factory.d.ts +64 -0
- package/dist/core/completions/factory.js +75 -0
- package/dist/core/completions/generators/bash-generator.d.ts +32 -0
- package/dist/core/completions/generators/bash-generator.js +174 -0
- package/dist/core/completions/generators/fish-generator.d.ts +32 -0
- package/dist/core/completions/generators/fish-generator.js +157 -0
- package/dist/core/completions/generators/powershell-generator.d.ts +33 -0
- package/dist/core/completions/generators/powershell-generator.js +207 -0
- package/dist/core/completions/generators/zsh-generator.d.ts +44 -0
- package/dist/core/completions/generators/zsh-generator.js +250 -0
- package/dist/core/completions/installers/bash-installer.d.ts +87 -0
- package/dist/core/completions/installers/bash-installer.js +318 -0
- package/dist/core/completions/installers/fish-installer.d.ts +43 -0
- package/dist/core/completions/installers/fish-installer.js +143 -0
- package/dist/core/completions/installers/powershell-installer.d.ts +88 -0
- package/dist/core/completions/installers/powershell-installer.js +327 -0
- package/dist/core/completions/installers/zsh-installer.d.ts +125 -0
- package/dist/core/completions/installers/zsh-installer.js +452 -0
- package/dist/core/completions/templates/bash-templates.d.ts +6 -0
- package/dist/core/completions/templates/bash-templates.js +24 -0
- package/dist/core/completions/templates/fish-templates.d.ts +7 -0
- package/dist/core/completions/templates/fish-templates.js +39 -0
- package/dist/core/completions/templates/powershell-templates.d.ts +6 -0
- package/dist/core/completions/templates/powershell-templates.js +25 -0
- package/dist/core/completions/templates/zsh-templates.d.ts +6 -0
- package/dist/core/completions/templates/zsh-templates.js +36 -0
- package/dist/core/completions/types.d.ts +79 -0
- package/dist/core/completions/types.js +2 -0
- package/dist/core/config-prompts.d.ts +9 -0
- package/dist/core/config-prompts.js +34 -0
- package/dist/core/config-schema.d.ts +86 -0
- package/dist/core/config-schema.js +213 -0
- package/dist/core/config.d.ts +17 -0
- package/dist/core/config.js +33 -0
- package/dist/core/converters/json-converter.d.ts +6 -0
- package/dist/core/converters/json-converter.js +51 -0
- package/dist/core/global-config.d.ts +44 -0
- package/dist/core/global-config.js +125 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +3 -0
- package/dist/core/init.d.ts +36 -0
- package/dist/core/init.js +576 -0
- package/dist/core/legacy-cleanup.d.ts +162 -0
- package/dist/core/legacy-cleanup.js +512 -0
- package/dist/core/list.d.ts +9 -0
- package/dist/core/list.js +173 -0
- package/dist/core/migration.d.ts +23 -0
- package/dist/core/migration.js +108 -0
- package/dist/core/parsers/change-parser.d.ts +13 -0
- package/dist/core/parsers/change-parser.js +193 -0
- package/dist/core/parsers/markdown-parser.d.ts +22 -0
- package/dist/core/parsers/markdown-parser.js +187 -0
- package/dist/core/parsers/requirement-blocks.d.ts +37 -0
- package/dist/core/parsers/requirement-blocks.js +201 -0
- package/dist/core/profile-sync-drift.d.ts +38 -0
- package/dist/core/profile-sync-drift.js +201 -0
- package/dist/core/profiles.d.ts +26 -0
- package/dist/core/profiles.js +41 -0
- package/dist/core/project-config.d.ts +64 -0
- package/dist/core/project-config.js +223 -0
- package/dist/core/schemas/base.schema.d.ts +13 -0
- package/dist/core/schemas/base.schema.js +13 -0
- package/dist/core/schemas/change.schema.d.ts +73 -0
- package/dist/core/schemas/change.schema.js +31 -0
- package/dist/core/schemas/index.d.ts +4 -0
- package/dist/core/schemas/index.js +4 -0
- package/dist/core/schemas/spec.schema.d.ts +18 -0
- package/dist/core/schemas/spec.schema.js +15 -0
- package/dist/core/sdd/adr-policy.d.ts +7 -0
- package/dist/core/sdd/adr-policy.js +47 -0
- package/dist/core/sdd/adr.d.ts +4 -0
- package/dist/core/sdd/adr.js +27 -0
- package/dist/core/sdd/bootstrap.d.ts +28 -0
- package/dist/core/sdd/bootstrap.js +353 -0
- package/dist/core/sdd/check.d.ts +51 -0
- package/dist/core/sdd/check.js +831 -0
- package/dist/core/sdd/coordination/coordination-adapters.d.ts +73 -0
- package/dist/core/sdd/coordination/coordination-adapters.js +87 -0
- package/dist/core/sdd/coordination/index.d.ts +2 -0
- package/dist/core/sdd/coordination/index.js +2 -0
- package/dist/core/sdd/dedup.d.ts +23 -0
- package/dist/core/sdd/dedup.js +62 -0
- package/dist/core/sdd/default-bootstrap-files.d.ts +23 -0
- package/dist/core/sdd/default-bootstrap-files.js +385 -0
- package/dist/core/sdd/default-skills.d.ts +16 -0
- package/dist/core/sdd/default-skills.js +427 -0
- package/dist/core/sdd/diagnose.d.ts +25 -0
- package/dist/core/sdd/diagnose.js +1312 -0
- package/dist/core/sdd/docs-sync.d.ts +21 -0
- package/dist/core/sdd/docs-sync.js +231 -0
- package/dist/core/sdd/domain/helpers.d.ts +6 -0
- package/dist/core/sdd/domain/helpers.js +37 -0
- package/dist/core/sdd/domain/lifecycle-guardrails.d.ts +22 -0
- package/dist/core/sdd/domain/lifecycle-guardrails.js +31 -0
- package/dist/core/sdd/domain/lifecycle-hooks.d.ts +16 -0
- package/dist/core/sdd/domain/lifecycle-hooks.js +27 -0
- package/dist/core/sdd/domain/post-active-validation.d.ts +15 -0
- package/dist/core/sdd/domain/post-active-validation.js +71 -0
- package/dist/core/sdd/domain/traceability.d.ts +8 -0
- package/dist/core/sdd/domain/traceability.js +83 -0
- package/dist/core/sdd/domain/transition-engine.d.ts +49 -0
- package/dist/core/sdd/domain/transition-engine.js +120 -0
- package/dist/core/sdd/fingerprint.d.ts +23 -0
- package/dist/core/sdd/fingerprint.js +146 -0
- package/dist/core/sdd/import-openspec.d.ts +31 -0
- package/dist/core/sdd/import-openspec.js +232 -0
- package/dist/core/sdd/init.d.ts +36 -0
- package/dist/core/sdd/init.js +65 -0
- package/dist/core/sdd/json-schema.d.ts +6 -0
- package/dist/core/sdd/json-schema.js +59 -0
- package/dist/core/sdd/legacy-operations.d.ts +286 -0
- package/dist/core/sdd/legacy-operations.js +2175 -0
- package/dist/core/sdd/lenses.d.ts +14 -0
- package/dist/core/sdd/lenses.js +97 -0
- package/dist/core/sdd/merge-catalog.d.ts +9 -0
- package/dist/core/sdd/merge-catalog.js +70 -0
- package/dist/core/sdd/migrate-workspace.d.ts +36 -0
- package/dist/core/sdd/migrate-workspace.js +344 -0
- package/dist/core/sdd/migrate.d.ts +24 -0
- package/dist/core/sdd/migrate.js +385 -0
- package/dist/core/sdd/resolve-project-root.d.ts +15 -0
- package/dist/core/sdd/resolve-project-root.js +46 -0
- package/dist/core/sdd/root-resolver.d.ts +16 -0
- package/dist/core/sdd/root-resolver.js +62 -0
- package/dist/core/sdd/sanitize.d.ts +35 -0
- package/dist/core/sdd/sanitize.js +750 -0
- package/dist/core/sdd/services/approve.service.d.ts +20 -0
- package/dist/core/sdd/services/approve.service.js +82 -0
- package/dist/core/sdd/services/audit.service.d.ts +53 -0
- package/dist/core/sdd/services/audit.service.js +136 -0
- package/dist/core/sdd/services/breakdown.service.d.ts +35 -0
- package/dist/core/sdd/services/breakdown.service.js +185 -0
- package/dist/core/sdd/services/context.service.d.ts +346 -0
- package/dist/core/sdd/services/context.service.js +278 -0
- package/dist/core/sdd/services/debate.service.d.ts +16 -0
- package/dist/core/sdd/services/debate.service.js +73 -0
- package/dist/core/sdd/services/decide.service.d.ts +23 -0
- package/dist/core/sdd/services/decide.service.js +81 -0
- package/dist/core/sdd/services/dedup-apply.service.d.ts +39 -0
- package/dist/core/sdd/services/dedup-apply.service.js +259 -0
- package/dist/core/sdd/services/feature-lint.service.d.ts +29 -0
- package/dist/core/sdd/services/feature-lint.service.js +146 -0
- package/dist/core/sdd/services/finalize.service.d.ts +33 -0
- package/dist/core/sdd/services/finalize.service.js +707 -0
- package/dist/core/sdd/services/frontend-gap.service.d.ts +23 -0
- package/dist/core/sdd/services/frontend-gap.service.js +117 -0
- package/dist/core/sdd/services/frontend-impact.service.d.ts +19 -0
- package/dist/core/sdd/services/frontend-impact.service.js +46 -0
- package/dist/core/sdd/services/ingest-deposito.service.d.ts +32 -0
- package/dist/core/sdd/services/ingest-deposito.service.js +231 -0
- package/dist/core/sdd/services/insight.service.d.ts +21 -0
- package/dist/core/sdd/services/insight.service.js +81 -0
- package/dist/core/sdd/services/legacy-capability.service.d.ts +24 -0
- package/dist/core/sdd/services/legacy-capability.service.js +59 -0
- package/dist/core/sdd/services/mcp-runtime.service.d.ts +42 -0
- package/dist/core/sdd/services/mcp-runtime.service.js +144 -0
- package/dist/core/sdd/services/metrics.service.d.ts +49 -0
- package/dist/core/sdd/services/metrics.service.js +181 -0
- package/dist/core/sdd/services/next.service.d.ts +35 -0
- package/dist/core/sdd/services/next.service.js +54 -0
- package/dist/core/sdd/services/onboard.service.d.ts +9 -0
- package/dist/core/sdd/services/onboard.service.js +165 -0
- package/dist/core/sdd/services/rebuild.service.d.ts +31 -0
- package/dist/core/sdd/services/rebuild.service.js +482 -0
- package/dist/core/sdd/services/scan-naming.service.d.ts +43 -0
- package/dist/core/sdd/services/scan-naming.service.js +246 -0
- package/dist/core/sdd/services/skills-invoke.service.d.ts +24 -0
- package/dist/core/sdd/services/skills-invoke.service.js +63 -0
- package/dist/core/sdd/services/skills-sync.service.d.ts +15 -0
- package/dist/core/sdd/services/skills-sync.service.js +117 -0
- package/dist/core/sdd/services/start.service.d.ts +26 -0
- package/dist/core/sdd/services/start.service.js +237 -0
- package/dist/core/sdd/skills.d.ts +15 -0
- package/dist/core/sdd/skills.js +46 -0
- package/dist/core/sdd/state-lock.d.ts +19 -0
- package/dist/core/sdd/state-lock.js +144 -0
- package/dist/core/sdd/state.d.ts +155 -0
- package/dist/core/sdd/state.js +1000 -0
- package/dist/core/sdd/store/in-memory-adapter.d.ts +12 -0
- package/dist/core/sdd/store/in-memory-adapter.js +27 -0
- package/dist/core/sdd/store/index.d.ts +5 -0
- package/dist/core/sdd/store/index.js +5 -0
- package/dist/core/sdd/store/sdd-stores.d.ts +25 -0
- package/dist/core/sdd/store/sdd-stores.js +59 -0
- package/dist/core/sdd/store/state-store.d.ts +32 -0
- package/dist/core/sdd/store/state-store.js +2 -0
- package/dist/core/sdd/store/yaml-file-adapter.d.ts +12 -0
- package/dist/core/sdd/store/yaml-file-adapter.js +43 -0
- package/dist/core/sdd/structural-health.d.ts +557 -0
- package/dist/core/sdd/structural-health.js +187 -0
- package/dist/core/sdd/transaction.d.ts +14 -0
- package/dist/core/sdd/transaction.js +100 -0
- package/dist/core/sdd/types.d.ts +1570 -0
- package/dist/core/sdd/types.js +617 -0
- package/dist/core/sdd/views.d.ts +3 -0
- package/dist/core/sdd/views.js +560 -0
- package/dist/core/sdd/workspace-schemas.d.ts +620 -0
- package/dist/core/sdd/workspace-schemas.js +254 -0
- package/dist/core/sdd/write-manifest.d.ts +25 -0
- package/dist/core/sdd/write-manifest.js +353 -0
- package/dist/core/shared/index.d.ts +8 -0
- package/dist/core/shared/index.js +8 -0
- package/dist/core/shared/skill-generation.d.ts +49 -0
- package/dist/core/shared/skill-generation.js +106 -0
- package/dist/core/shared/tool-detection.d.ts +71 -0
- package/dist/core/shared/tool-detection.js +158 -0
- package/dist/core/specs-apply.d.ts +73 -0
- package/dist/core/specs-apply.js +385 -0
- package/dist/core/styles/palette.d.ts +7 -0
- package/dist/core/styles/palette.js +8 -0
- package/dist/core/templates/index.d.ts +8 -0
- package/dist/core/templates/index.js +9 -0
- package/dist/core/templates/skill-templates.d.ts +20 -0
- package/dist/core/templates/skill-templates.js +19 -0
- package/dist/core/templates/types.d.ts +19 -0
- package/dist/core/templates/types.js +5 -0
- package/dist/core/templates/workflows/apply-change.d.ts +10 -0
- package/dist/core/templates/workflows/apply-change.js +308 -0
- package/dist/core/templates/workflows/archive-change.d.ts +10 -0
- package/dist/core/templates/workflows/archive-change.js +277 -0
- package/dist/core/templates/workflows/bulk-archive-change.d.ts +10 -0
- package/dist/core/templates/workflows/bulk-archive-change.js +502 -0
- package/dist/core/templates/workflows/continue-change.d.ts +10 -0
- package/dist/core/templates/workflows/continue-change.js +232 -0
- package/dist/core/templates/workflows/explore.d.ts +10 -0
- package/dist/core/templates/workflows/explore.js +475 -0
- package/dist/core/templates/workflows/feedback.d.ts +9 -0
- package/dist/core/templates/workflows/feedback.js +108 -0
- package/dist/core/templates/workflows/ff-change.d.ts +10 -0
- package/dist/core/templates/workflows/ff-change.js +206 -0
- package/dist/core/templates/workflows/new-change.d.ts +10 -0
- package/dist/core/templates/workflows/new-change.js +151 -0
- package/dist/core/templates/workflows/onboard.d.ts +10 -0
- package/dist/core/templates/workflows/onboard.js +573 -0
- package/dist/core/templates/workflows/propose.d.ts +10 -0
- package/dist/core/templates/workflows/propose.js +224 -0
- package/dist/core/templates/workflows/sdd.d.ts +10 -0
- package/dist/core/templates/workflows/sdd.js +107 -0
- package/dist/core/templates/workflows/sync-specs.d.ts +10 -0
- package/dist/core/templates/workflows/sync-specs.js +286 -0
- package/dist/core/templates/workflows/verify-change.d.ts +10 -0
- package/dist/core/templates/workflows/verify-change.js +346 -0
- package/dist/core/update.d.ts +77 -0
- package/dist/core/update.js +538 -0
- package/dist/core/validation/constants.d.ts +34 -0
- package/dist/core/validation/constants.js +40 -0
- package/dist/core/validation/types.d.ts +18 -0
- package/dist/core/validation/types.js +2 -0
- package/dist/core/validation/validator.d.ts +33 -0
- package/dist/core/validation/validator.js +409 -0
- package/dist/core/view.d.ts +8 -0
- package/dist/core/view.js +170 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/prompts/searchable-multi-select.d.ts +28 -0
- package/dist/prompts/searchable-multi-select.js +159 -0
- package/dist/telemetry/config.d.ts +32 -0
- package/dist/telemetry/config.js +68 -0
- package/dist/telemetry/index.d.ts +44 -0
- package/dist/telemetry/index.js +207 -0
- package/dist/ui/ascii-patterns.d.ts +16 -0
- package/dist/ui/ascii-patterns.js +133 -0
- package/dist/ui/welcome-screen.d.ts +10 -0
- package/dist/ui/welcome-screen.js +146 -0
- package/dist/utils/change-metadata.d.ts +51 -0
- package/dist/utils/change-metadata.js +147 -0
- package/dist/utils/change-utils.d.ts +62 -0
- package/dist/utils/change-utils.js +121 -0
- package/dist/utils/command-references.d.ts +18 -0
- package/dist/utils/command-references.js +20 -0
- package/dist/utils/file-system.d.ts +36 -0
- package/dist/utils/file-system.js +281 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/interactive.d.ts +18 -0
- package/dist/utils/interactive.js +21 -0
- package/dist/utils/item-discovery.d.ts +4 -0
- package/dist/utils/item-discovery.js +73 -0
- package/dist/utils/match.d.ts +3 -0
- package/dist/utils/match.js +22 -0
- package/dist/utils/openspec-compat.d.ts +2 -0
- package/dist/utils/openspec-compat.js +2 -0
- package/dist/utils/shell-detection.d.ts +20 -0
- package/dist/utils/shell-detection.js +41 -0
- package/dist/utils/task-progress.d.ts +8 -0
- package/dist/utils/task-progress.js +36 -0
- package/package.json +111 -0
- package/schemas/sdd/1-spec.schema.json +221 -0
- package/schemas/sdd/2-plan.schema.json +199 -0
- package/schemas/sdd/3-tasks.schema.json +102 -0
- package/schemas/sdd/4-changelog.schema.json +55 -0
- package/schemas/sdd/5-quality.schema.json +427 -0
- package/schemas/sdd/workspace-catalog.schema.json +1012 -0
- package/schemas/spec-driven/schema.yaml +153 -0
- package/schemas/spec-driven/templates/design.md +19 -0
- package/schemas/spec-driven/templates/proposal.md +23 -0
- package/schemas/spec-driven/templates/spec.md +8 -0
- package/schemas/spec-driven/templates/tasks.md +9 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { promises as fs } from "node:fs";
|
|
3
|
+
import { TransitionEngine } from "../domain/transition-engine.js";
|
|
4
|
+
import { allocateEntityId, loadStateSnapshot, nowIso, saveStateTransaction } from "../state.js";
|
|
5
|
+
import { slugify, computeCanonicalTitle, findDiscoveryRecord, markdownDebateTemplate, buildDefaultQualityContract, syncCounterFromId, getRuntime, persistAndRender, applyLoggedTransition } from "../legacy-operations.js";
|
|
6
|
+
import { withStateLock } from "../state-lock.js";
|
|
7
|
+
export class DebateService {
|
|
8
|
+
stores;
|
|
9
|
+
constructor(stores) {
|
|
10
|
+
this.stores = stores;
|
|
11
|
+
}
|
|
12
|
+
async execute(projectRoot, insightId, options) {
|
|
13
|
+
const { config, paths } = await getRuntime(projectRoot);
|
|
14
|
+
return withStateLock(paths.stateDir, async () => {
|
|
15
|
+
const snapshot = await loadStateSnapshot(paths, config);
|
|
16
|
+
const insight = findDiscoveryRecord(snapshot.discoveryIndex.records, insightId);
|
|
17
|
+
if (!insight || insight.type !== 'INS') {
|
|
18
|
+
throw new Error(`Insight ${insightId} nao encontrado.`);
|
|
19
|
+
}
|
|
20
|
+
const existingDebate = snapshot.discoveryIndex.records.find((record) => record.type === 'DEB' && record.related_ids.includes(insight.id));
|
|
21
|
+
if (existingDebate) {
|
|
22
|
+
return {
|
|
23
|
+
id: existingDebate.id,
|
|
24
|
+
title: existingDebate.title,
|
|
25
|
+
filePath: path.join(paths.discoveryDebatesDir, `${existingDebate.id}-${slugify(existingDebate.title)}.md`),
|
|
26
|
+
reused: true,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
TransitionEngine.assertValid(insight.type, insight.status, 'DEBATED');
|
|
30
|
+
const id = await allocateEntityId(paths, 'DEB');
|
|
31
|
+
syncCounterFromId(snapshot.discoveryIndex, id);
|
|
32
|
+
const now = nowIso();
|
|
33
|
+
const title = (options?.title || `Debate: ${insight.title}`).slice(0, 120);
|
|
34
|
+
const titleCanonical = computeCanonicalTitle(options?.title || insight.title_canonical || insight.title);
|
|
35
|
+
const debate = {
|
|
36
|
+
id,
|
|
37
|
+
type: 'DEB',
|
|
38
|
+
title,
|
|
39
|
+
title_canonical: titleCanonical,
|
|
40
|
+
status: 'OPEN',
|
|
41
|
+
origin_prompt: `Debate originado de ${insight.id}${options?.agent ? ` por ${options.agent}` : ''}`,
|
|
42
|
+
related_ids: [insight.id],
|
|
43
|
+
warning_links: [],
|
|
44
|
+
created_at: now,
|
|
45
|
+
updated_at: now,
|
|
46
|
+
quality_contract: buildDefaultQualityContract({
|
|
47
|
+
inheritedFrom: insight.id,
|
|
48
|
+
scope: 'decision_scope',
|
|
49
|
+
}),
|
|
50
|
+
};
|
|
51
|
+
applyLoggedTransition(snapshot.transitionLog.events, insight.type, insight, 'DEBATED', {
|
|
52
|
+
sourceCommand: 'sdd debate',
|
|
53
|
+
actor: options?.agent || 'system',
|
|
54
|
+
reason: `Insight promovido para debate ${id}`,
|
|
55
|
+
timestamp: now,
|
|
56
|
+
afterTransition: (currentInsight) => {
|
|
57
|
+
currentInsight.related_ids = Array.from(new Set([...currentInsight.related_ids, id]));
|
|
58
|
+
currentInsight.updated_at = now;
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
snapshot.discoveryIndex.records.push(debate);
|
|
62
|
+
await saveStateTransaction(paths, {
|
|
63
|
+
discoveryIndex: snapshot.discoveryIndex,
|
|
64
|
+
transitionLog: snapshot.transitionLog,
|
|
65
|
+
});
|
|
66
|
+
const filePath = path.join(paths.discoveryDebatesDir, `${id}-${slugify(title)}.md`);
|
|
67
|
+
await fs.writeFile(filePath, markdownDebateTemplate(insight, id), 'utf-8');
|
|
68
|
+
await persistAndRender(paths, config, options?.render);
|
|
69
|
+
return { id, title, filePath, reused: false };
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=debate.service.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SddStores } from "../store/sdd-stores.js";
|
|
2
|
+
export declare class DecideService {
|
|
3
|
+
private readonly stores;
|
|
4
|
+
constructor(stores: SddStores);
|
|
5
|
+
execute(projectRoot: string, debateId: string, outcome: 'radar' | 'epic' | 'discard', options?: {
|
|
6
|
+
title?: string;
|
|
7
|
+
rationale?: string;
|
|
8
|
+
render?: boolean;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
outcome: "discard";
|
|
11
|
+
debateId: string;
|
|
12
|
+
discardPath: string;
|
|
13
|
+
radarId?: undefined;
|
|
14
|
+
radarPath?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
outcome: "radar" | "epic";
|
|
17
|
+
debateId: string;
|
|
18
|
+
radarId: string;
|
|
19
|
+
radarPath: string;
|
|
20
|
+
discardPath?: undefined;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=decide.service.d.ts.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { promises as fs } from "node:fs";
|
|
3
|
+
import { allocateEntityId, loadStateSnapshot, nowIso, saveStateTransaction } from "../state.js";
|
|
4
|
+
import { slugify, findDiscoveryRecord, markdownRadarTemplate, markdownDiscardTemplate, buildDefaultQualityContract, findDebateFile, validateDebateDocument, syncCounterFromId, getRuntime, persistAndRender, applyLoggedTransition } from "../legacy-operations.js";
|
|
5
|
+
import { withStateLock } from "../state-lock.js";
|
|
6
|
+
export class DecideService {
|
|
7
|
+
stores;
|
|
8
|
+
constructor(stores) {
|
|
9
|
+
this.stores = stores;
|
|
10
|
+
}
|
|
11
|
+
async execute(projectRoot, debateId, outcome, options) {
|
|
12
|
+
const { config, paths } = await getRuntime(projectRoot);
|
|
13
|
+
return withStateLock(paths.stateDir, async () => {
|
|
14
|
+
const snapshot = await loadStateSnapshot(paths, config);
|
|
15
|
+
const debate = findDiscoveryRecord(snapshot.discoveryIndex.records, debateId);
|
|
16
|
+
if (!debate || debate.type !== 'DEB') {
|
|
17
|
+
throw new Error(`Debate ${debateId} nao encontrado.`);
|
|
18
|
+
}
|
|
19
|
+
const debateFile = await findDebateFile(paths, debateId);
|
|
20
|
+
if (!debateFile) {
|
|
21
|
+
throw new Error(`Arquivo do debate ${debateId} nao encontrado em ${path.relative(projectRoot, paths.discoveryDebatesDir)}.`);
|
|
22
|
+
}
|
|
23
|
+
const debateContent = await fs.readFile(debateFile, 'utf-8');
|
|
24
|
+
const missingSections = validateDebateDocument(debateContent);
|
|
25
|
+
if (missingSections.length > 0) {
|
|
26
|
+
throw new Error(`Debate ${debateId} is incomplete. Fill required sections before deciding:\n- ${missingSections.join('\n- ')}`);
|
|
27
|
+
}
|
|
28
|
+
const now = nowIso();
|
|
29
|
+
const targetStatus = outcome === 'radar' || outcome === 'epic' ? 'APPROVED' : 'DISCARDED';
|
|
30
|
+
applyLoggedTransition(snapshot.transitionLog.events, debate.type, debate, targetStatus, {
|
|
31
|
+
sourceCommand: 'sdd decide',
|
|
32
|
+
reason: outcome === 'discard'
|
|
33
|
+
? `Debate descartado por ${debate.id}`
|
|
34
|
+
: `Debate aprovado e promovido para ${outcome === 'epic' ? 'epic' : 'radar'}`,
|
|
35
|
+
timestamp: now,
|
|
36
|
+
afterTransition: (currentDebate) => {
|
|
37
|
+
currentDebate.updated_at = now;
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
if (outcome === 'discard') {
|
|
41
|
+
const discardPath = path.join(paths.discoveryDiscardedDir, `${debate.id}-${slugify(debate.title)}.md`);
|
|
42
|
+
await fs.writeFile(discardPath, markdownDiscardTemplate(debate, options?.rationale), 'utf-8');
|
|
43
|
+
await saveStateTransaction(paths, {
|
|
44
|
+
discoveryIndex: snapshot.discoveryIndex,
|
|
45
|
+
transitionLog: snapshot.transitionLog,
|
|
46
|
+
});
|
|
47
|
+
await persistAndRender(paths, config, options?.render);
|
|
48
|
+
return { outcome, debateId, discardPath };
|
|
49
|
+
}
|
|
50
|
+
const radarId = await allocateEntityId(paths, 'EPIC');
|
|
51
|
+
syncCounterFromId(snapshot.discoveryIndex, radarId);
|
|
52
|
+
const radarTitle = (options?.title || debate.title_canonical || debate.title).slice(0, 120);
|
|
53
|
+
const radarRecord = {
|
|
54
|
+
id: radarId,
|
|
55
|
+
type: 'EPIC',
|
|
56
|
+
title: radarTitle,
|
|
57
|
+
status: 'READY',
|
|
58
|
+
origin_prompt: options?.rationale,
|
|
59
|
+
related_ids: [debate.id, ...debate.related_ids],
|
|
60
|
+
warning_links: [],
|
|
61
|
+
created_at: now,
|
|
62
|
+
updated_at: now,
|
|
63
|
+
quality_contract: buildDefaultQualityContract({
|
|
64
|
+
inheritedFrom: debate.id,
|
|
65
|
+
scope: 'epic_touched_scope',
|
|
66
|
+
}),
|
|
67
|
+
};
|
|
68
|
+
debate.related_ids = Array.from(new Set([...debate.related_ids, radarId]));
|
|
69
|
+
snapshot.discoveryIndex.records.push(radarRecord);
|
|
70
|
+
await saveStateTransaction(paths, {
|
|
71
|
+
discoveryIndex: snapshot.discoveryIndex,
|
|
72
|
+
transitionLog: snapshot.transitionLog,
|
|
73
|
+
});
|
|
74
|
+
const radarPath = path.join(paths.discoveryEpicDir, `${radarId}-${slugify(radarTitle)}.md`);
|
|
75
|
+
await fs.writeFile(radarPath, markdownRadarTemplate(debate, radarId, options?.rationale), 'utf-8');
|
|
76
|
+
await persistAndRender(paths, config, options?.render);
|
|
77
|
+
return { outcome, debateId, radarId, radarPath };
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=decide.service.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface SddDedupApplyOptions {
|
|
2
|
+
apply?: boolean;
|
|
3
|
+
dryRun?: boolean;
|
|
4
|
+
render?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface SddDedupCandidate {
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
status: string;
|
|
10
|
+
warning_links: string[];
|
|
11
|
+
valid_links: string[];
|
|
12
|
+
missing_links: string[];
|
|
13
|
+
primary_link: string;
|
|
14
|
+
action: 'reconcile' | 'skip-active' | 'skip-missing';
|
|
15
|
+
}
|
|
16
|
+
export interface SddDedupSectionReport {
|
|
17
|
+
scanned: number;
|
|
18
|
+
candidates: SddDedupCandidate[];
|
|
19
|
+
reconciled: string[];
|
|
20
|
+
skipped_active: string[];
|
|
21
|
+
missing_links: string[];
|
|
22
|
+
canonical_updates: string[];
|
|
23
|
+
reference_updates: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface SddDedupApplyReport {
|
|
26
|
+
dry_run: boolean;
|
|
27
|
+
applied: boolean;
|
|
28
|
+
rendered: boolean;
|
|
29
|
+
changed: boolean;
|
|
30
|
+
generated_at: string;
|
|
31
|
+
backlog: SddDedupSectionReport;
|
|
32
|
+
discovery: SddDedupSectionReport;
|
|
33
|
+
warnings: string[];
|
|
34
|
+
}
|
|
35
|
+
export declare class SddDedupApplyService {
|
|
36
|
+
execute(projectRoot?: string, options?: SddDedupApplyOptions): Promise<SddDedupApplyReport>;
|
|
37
|
+
}
|
|
38
|
+
export declare function formatSddDedupApplyReport(report: SddDedupApplyReport): string;
|
|
39
|
+
//# sourceMappingURL=dedup-apply.service.d.ts.map
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
2
|
+
import { loadProjectSddConfig, loadStateSnapshot, nowIso, resolveSddPaths, saveStateTransaction, } from '../state.js';
|
|
3
|
+
import { BacklogStateSchema, DiscoveryIndexStateSchema, } from '../types.js';
|
|
4
|
+
import { ensureMemoryInitialized } from '../legacy-operations.js';
|
|
5
|
+
import { renderViews } from '../views.js';
|
|
6
|
+
const BACKLOG_HISTORICAL_STATUSES = new Set(['DONE', 'ARCHIVED']);
|
|
7
|
+
const DISCOVERY_HISTORICAL_STATUSES = new Set([
|
|
8
|
+
'DISCARDED',
|
|
9
|
+
'SUPERSEDED',
|
|
10
|
+
'DONE',
|
|
11
|
+
'CANCELLED',
|
|
12
|
+
]);
|
|
13
|
+
function clone(value) {
|
|
14
|
+
return JSON.parse(JSON.stringify(value));
|
|
15
|
+
}
|
|
16
|
+
function unique(values) {
|
|
17
|
+
const seen = new Set();
|
|
18
|
+
const result = [];
|
|
19
|
+
for (const value of values) {
|
|
20
|
+
const trimmed = value.trim();
|
|
21
|
+
if (!trimmed || seen.has(trimmed))
|
|
22
|
+
continue;
|
|
23
|
+
seen.add(trimmed);
|
|
24
|
+
result.push(trimmed);
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
function defaultSectionReport() {
|
|
29
|
+
return {
|
|
30
|
+
scanned: 0,
|
|
31
|
+
candidates: [],
|
|
32
|
+
reconciled: [],
|
|
33
|
+
skipped_active: [],
|
|
34
|
+
missing_links: [],
|
|
35
|
+
canonical_updates: [],
|
|
36
|
+
reference_updates: [],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function appendSummary(summary, note) {
|
|
40
|
+
const existing = summary?.trim();
|
|
41
|
+
if (!existing)
|
|
42
|
+
return note;
|
|
43
|
+
if (existing.includes(note))
|
|
44
|
+
return existing;
|
|
45
|
+
return `${existing}\n${note}`;
|
|
46
|
+
}
|
|
47
|
+
function replaceRefs(values, fromId, toId, ownerId) {
|
|
48
|
+
return unique(values.map((value) => (value === fromId ? toId : value))).filter((value) => value !== ownerId);
|
|
49
|
+
}
|
|
50
|
+
function shouldRender(config, options, changed) {
|
|
51
|
+
if (!changed)
|
|
52
|
+
return false;
|
|
53
|
+
if (options.dryRun)
|
|
54
|
+
return false;
|
|
55
|
+
if (options.render === false)
|
|
56
|
+
return false;
|
|
57
|
+
return options.render === true || config.views.autoRender;
|
|
58
|
+
}
|
|
59
|
+
function candidateFor(entity, existingIds, historicalStatuses) {
|
|
60
|
+
const warningLinks = unique(entity.warning_links ?? []);
|
|
61
|
+
const validLinks = warningLinks.filter((link) => link !== entity.id && existingIds.has(link));
|
|
62
|
+
const missingLinks = warningLinks.filter((link) => link === entity.id || !existingIds.has(link));
|
|
63
|
+
const historical = historicalStatuses.has(entity.status);
|
|
64
|
+
const action = validLinks.length === 0 ? 'skip-missing' : historical ? 'reconcile' : 'skip-active';
|
|
65
|
+
return {
|
|
66
|
+
id: entity.id,
|
|
67
|
+
title: entity.title,
|
|
68
|
+
status: entity.status,
|
|
69
|
+
warning_links: warningLinks,
|
|
70
|
+
valid_links: validLinks,
|
|
71
|
+
missing_links: missingLinks,
|
|
72
|
+
primary_link: validLinks[0] ?? '',
|
|
73
|
+
action,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function mergeBacklogIntoCanonical(canonical, duplicate, timestamp) {
|
|
77
|
+
canonical.acceptance_refs = unique([...canonical.acceptance_refs, ...duplicate.acceptance_refs]);
|
|
78
|
+
canonical.spec_refs = unique([...canonical.spec_refs, ...duplicate.spec_refs]);
|
|
79
|
+
canonical.touches = unique([...canonical.touches, ...duplicate.touches]);
|
|
80
|
+
canonical.lock_domains = unique([...canonical.lock_domains, ...duplicate.lock_domains]);
|
|
81
|
+
canonical.produces = unique([...canonical.produces, ...duplicate.produces]);
|
|
82
|
+
canonical.consumes = unique([...canonical.consumes, ...duplicate.consumes]);
|
|
83
|
+
canonical.recommended_skills = unique([...canonical.recommended_skills, ...duplicate.recommended_skills]);
|
|
84
|
+
canonical.frontend_surface_tokens = unique([
|
|
85
|
+
...canonical.frontend_surface_tokens,
|
|
86
|
+
...duplicate.frontend_surface_tokens,
|
|
87
|
+
]);
|
|
88
|
+
canonical.frontend_gap_refs = unique([...canonical.frontend_gap_refs, ...duplicate.frontend_gap_refs]);
|
|
89
|
+
canonical.blocked_by = unique([...canonical.blocked_by, ...duplicate.blocked_by]).filter((id) => id !== canonical.id && id !== duplicate.id);
|
|
90
|
+
canonical.last_sync_at = timestamp;
|
|
91
|
+
if (canonical.quality_contract) {
|
|
92
|
+
canonical.quality_contract.updated_at = timestamp;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function applyBacklogDedup(state, timestamp) {
|
|
96
|
+
const report = defaultSectionReport();
|
|
97
|
+
const byId = new Map(state.items.map((item) => [item.id, item]));
|
|
98
|
+
const ids = new Set(byId.keys());
|
|
99
|
+
const candidates = state.items
|
|
100
|
+
.filter((item) => item.warning_links.length > 0)
|
|
101
|
+
.map((item) => candidateFor(item, ids, BACKLOG_HISTORICAL_STATUSES));
|
|
102
|
+
report.scanned = candidates.length;
|
|
103
|
+
report.candidates = candidates;
|
|
104
|
+
for (const candidate of candidates) {
|
|
105
|
+
if (candidate.missing_links.length > 0) {
|
|
106
|
+
report.missing_links.push(`${candidate.id}:${candidate.missing_links.join(',')}`);
|
|
107
|
+
}
|
|
108
|
+
if (candidate.action === 'skip-missing')
|
|
109
|
+
continue;
|
|
110
|
+
if (candidate.action === 'skip-active') {
|
|
111
|
+
report.skipped_active.push(candidate.id);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const duplicate = byId.get(candidate.id);
|
|
115
|
+
const canonical = byId.get(candidate.primary_link);
|
|
116
|
+
if (!duplicate || !canonical)
|
|
117
|
+
continue;
|
|
118
|
+
mergeBacklogIntoCanonical(canonical, duplicate, timestamp);
|
|
119
|
+
canonical.summary = appendSummary(canonical.summary, `[dedup] Reconciled warning-linked historical duplicate ${duplicate.id} on ${timestamp}.`);
|
|
120
|
+
duplicate.summary = appendSummary(duplicate.summary, `[dedup] Reconciled into ${canonical.id} via warning_links on ${timestamp}.`);
|
|
121
|
+
duplicate.warning_links = duplicate.warning_links.filter((link) => !candidate.valid_links.includes(link));
|
|
122
|
+
duplicate.last_sync_at = timestamp;
|
|
123
|
+
report.reconciled.push(duplicate.id);
|
|
124
|
+
report.canonical_updates.push(canonical.id);
|
|
125
|
+
for (const item of state.items) {
|
|
126
|
+
const nextBlockedBy = replaceRefs(item.blocked_by, duplicate.id, canonical.id, item.id);
|
|
127
|
+
if (!isDeepStrictEqual(item.blocked_by, nextBlockedBy)) {
|
|
128
|
+
item.blocked_by = nextBlockedBy;
|
|
129
|
+
item.last_sync_at = timestamp;
|
|
130
|
+
report.reference_updates.push(item.id);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
report.reconciled = unique(report.reconciled);
|
|
135
|
+
report.skipped_active = unique(report.skipped_active);
|
|
136
|
+
report.missing_links = unique(report.missing_links);
|
|
137
|
+
report.canonical_updates = unique(report.canonical_updates);
|
|
138
|
+
report.reference_updates = unique(report.reference_updates);
|
|
139
|
+
return report;
|
|
140
|
+
}
|
|
141
|
+
function mergeDiscoveryIntoCanonical(canonical, duplicate, timestamp) {
|
|
142
|
+
canonical.related_ids = unique([...canonical.related_ids, duplicate.id, ...duplicate.related_ids]);
|
|
143
|
+
canonical.updated_at = timestamp;
|
|
144
|
+
}
|
|
145
|
+
function applyDiscoveryDedup(state, timestamp) {
|
|
146
|
+
const report = defaultSectionReport();
|
|
147
|
+
const byId = new Map(state.records.map((record) => [record.id, record]));
|
|
148
|
+
const ids = new Set(byId.keys());
|
|
149
|
+
const candidates = state.records
|
|
150
|
+
.filter((record) => record.warning_links.length > 0)
|
|
151
|
+
.map((record) => candidateFor(record, ids, DISCOVERY_HISTORICAL_STATUSES));
|
|
152
|
+
report.scanned = candidates.length;
|
|
153
|
+
report.candidates = candidates;
|
|
154
|
+
for (const candidate of candidates) {
|
|
155
|
+
if (candidate.missing_links.length > 0) {
|
|
156
|
+
report.missing_links.push(`${candidate.id}:${candidate.missing_links.join(',')}`);
|
|
157
|
+
}
|
|
158
|
+
if (candidate.action === 'skip-missing')
|
|
159
|
+
continue;
|
|
160
|
+
if (candidate.action === 'skip-active') {
|
|
161
|
+
report.skipped_active.push(candidate.id);
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const duplicate = byId.get(candidate.id);
|
|
165
|
+
const canonical = byId.get(candidate.primary_link);
|
|
166
|
+
if (!duplicate || !canonical)
|
|
167
|
+
continue;
|
|
168
|
+
mergeDiscoveryIntoCanonical(canonical, duplicate, timestamp);
|
|
169
|
+
duplicate.related_ids = unique([...duplicate.related_ids, ...candidate.valid_links]);
|
|
170
|
+
duplicate.warning_links = duplicate.warning_links.filter((link) => !candidate.valid_links.includes(link));
|
|
171
|
+
duplicate.updated_at = timestamp;
|
|
172
|
+
report.reconciled.push(duplicate.id);
|
|
173
|
+
report.canonical_updates.push(canonical.id);
|
|
174
|
+
}
|
|
175
|
+
report.reconciled = unique(report.reconciled);
|
|
176
|
+
report.skipped_active = unique(report.skipped_active);
|
|
177
|
+
report.missing_links = unique(report.missing_links);
|
|
178
|
+
report.canonical_updates = unique(report.canonical_updates);
|
|
179
|
+
report.reference_updates = unique(report.reference_updates);
|
|
180
|
+
return report;
|
|
181
|
+
}
|
|
182
|
+
function hasReconciliations(report) {
|
|
183
|
+
return report.backlog.reconciled.length > 0 || report.discovery.reconciled.length > 0;
|
|
184
|
+
}
|
|
185
|
+
export class SddDedupApplyService {
|
|
186
|
+
async execute(projectRoot = '.', options = {}) {
|
|
187
|
+
if (!options.apply) {
|
|
188
|
+
throw new Error('Use --apply to reconcile historical duplicate warning_links.');
|
|
189
|
+
}
|
|
190
|
+
const config = await loadProjectSddConfig(projectRoot);
|
|
191
|
+
const paths = resolveSddPaths(projectRoot, config);
|
|
192
|
+
await ensureMemoryInitialized(paths);
|
|
193
|
+
const snapshot = await loadStateSnapshot(paths, config);
|
|
194
|
+
const timestamp = nowIso();
|
|
195
|
+
const backlogState = clone(snapshot.backlog);
|
|
196
|
+
const discoveryState = clone(snapshot.discoveryIndex);
|
|
197
|
+
const backlog = applyBacklogDedup(backlogState, timestamp);
|
|
198
|
+
const discovery = applyDiscoveryDedup(discoveryState, timestamp);
|
|
199
|
+
const warnings = [
|
|
200
|
+
...backlog.skipped_active.map((id) => `${id} has warning_links but is not historical; left unchanged.`),
|
|
201
|
+
...discovery.skipped_active.map((id) => `${id} has warning_links but is not historical; left unchanged.`),
|
|
202
|
+
...backlog.missing_links.map((entry) => `Backlog warning_links not found: ${entry}`),
|
|
203
|
+
...discovery.missing_links.map((entry) => `Discovery warning_links not found: ${entry}`),
|
|
204
|
+
];
|
|
205
|
+
const report = {
|
|
206
|
+
dry_run: options.dryRun === true,
|
|
207
|
+
applied: options.dryRun !== true,
|
|
208
|
+
rendered: false,
|
|
209
|
+
changed: false,
|
|
210
|
+
generated_at: timestamp,
|
|
211
|
+
backlog,
|
|
212
|
+
discovery,
|
|
213
|
+
warnings,
|
|
214
|
+
};
|
|
215
|
+
report.changed = hasReconciliations(report);
|
|
216
|
+
const render = shouldRender(config, options, report.changed);
|
|
217
|
+
report.rendered = render;
|
|
218
|
+
if (!options.dryRun && report.changed) {
|
|
219
|
+
const parsedBacklog = BacklogStateSchema.parse(backlogState);
|
|
220
|
+
const parsedDiscovery = DiscoveryIndexStateSchema.parse(discoveryState);
|
|
221
|
+
await saveStateTransaction(paths, {
|
|
222
|
+
backlog: parsedBacklog,
|
|
223
|
+
discoveryIndex: parsedDiscovery,
|
|
224
|
+
});
|
|
225
|
+
if (render) {
|
|
226
|
+
const renderedSnapshot = {
|
|
227
|
+
...snapshot,
|
|
228
|
+
backlog: parsedBacklog,
|
|
229
|
+
discoveryIndex: parsedDiscovery,
|
|
230
|
+
};
|
|
231
|
+
await renderViews(paths, config, renderedSnapshot);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return report;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
export function formatSddDedupApplyReport(report) {
|
|
238
|
+
const lines = [
|
|
239
|
+
`Dry run: ${report.dry_run ? 'yes' : 'no'}`,
|
|
240
|
+
`Changed: ${report.changed ? 'yes' : 'no'}`,
|
|
241
|
+
`Views rendered: ${report.rendered ? 'yes' : 'no'}`,
|
|
242
|
+
`Backlog candidates: ${report.backlog.scanned}`,
|
|
243
|
+
`Backlog reconciled: ${report.backlog.reconciled.join(', ') || '-'}`,
|
|
244
|
+
`Backlog skipped active: ${report.backlog.skipped_active.join(', ') || '-'}`,
|
|
245
|
+
`Backlog canonical updates: ${report.backlog.canonical_updates.join(', ') || '-'}`,
|
|
246
|
+
`Discovery candidates: ${report.discovery.scanned}`,
|
|
247
|
+
`Discovery reconciled: ${report.discovery.reconciled.join(', ') || '-'}`,
|
|
248
|
+
`Discovery skipped active: ${report.discovery.skipped_active.join(', ') || '-'}`,
|
|
249
|
+
`Discovery canonical updates: ${report.discovery.canonical_updates.join(', ') || '-'}`,
|
|
250
|
+
];
|
|
251
|
+
if (report.warnings.length > 0) {
|
|
252
|
+
lines.push('Warnings:');
|
|
253
|
+
for (const warning of report.warnings) {
|
|
254
|
+
lines.push(`- ${warning}`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return lines.join('\n');
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=dedup-apply.service.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface FeatureLintOptions {
|
|
2
|
+
strict?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export interface FeatureLintFinding {
|
|
5
|
+
severity: 'warning' | 'error';
|
|
6
|
+
code: string;
|
|
7
|
+
message: string;
|
|
8
|
+
evidence: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface FeatureLintReport {
|
|
11
|
+
feature_id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
status: string;
|
|
14
|
+
ok: boolean;
|
|
15
|
+
level: 'pass' | 'warning' | 'error';
|
|
16
|
+
workspace_path: string;
|
|
17
|
+
counts: {
|
|
18
|
+
tasks: number;
|
|
19
|
+
lock_domains: number;
|
|
20
|
+
frontend_surfaces: number;
|
|
21
|
+
touched_modules: number;
|
|
22
|
+
};
|
|
23
|
+
findings: FeatureLintFinding[];
|
|
24
|
+
}
|
|
25
|
+
export declare class FeatureLintService {
|
|
26
|
+
execute(projectRoot: string, featureId: string, options?: FeatureLintOptions): Promise<FeatureLintReport>;
|
|
27
|
+
}
|
|
28
|
+
export declare function formatFeatureLintReport(report: FeatureLintReport): string;
|
|
29
|
+
//# sourceMappingURL=feature-lint.service.d.ts.map
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { existsSync, promises as fs } from 'node:fs';
|
|
3
|
+
import { loadProjectSddConfig, loadStateSnapshot, resolveSddPaths, } from '../state.js';
|
|
4
|
+
import { activeDocNamesForLayout, ensureMemoryInitialized, relProjectPath } from '../legacy-operations.js';
|
|
5
|
+
import { parseWorkspaceYamlDocument } from '../workspace-schemas.js';
|
|
6
|
+
async function loadTasksDocument(paths, config, featureId) {
|
|
7
|
+
const names = activeDocNamesForLayout(config);
|
|
8
|
+
const roots = [paths.activeDir, paths.plannedDir, paths.archivedDir];
|
|
9
|
+
for (const root of roots) {
|
|
10
|
+
const workspacePath = path.join(root, featureId);
|
|
11
|
+
if (!existsSync(workspacePath))
|
|
12
|
+
continue;
|
|
13
|
+
const tasksPath = path.join(workspacePath, names.tasks);
|
|
14
|
+
if (!existsSync(tasksPath)) {
|
|
15
|
+
return { workspacePath: relProjectPath(paths, workspacePath), error: `${names.tasks} not found.` };
|
|
16
|
+
}
|
|
17
|
+
const content = await fs.readFile(tasksPath, 'utf-8');
|
|
18
|
+
try {
|
|
19
|
+
return {
|
|
20
|
+
workspacePath: relProjectPath(paths, workspacePath),
|
|
21
|
+
tasks: parseWorkspaceYamlDocument('3-tasks.yaml', content),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return {
|
|
26
|
+
workspacePath: relProjectPath(paths, workspacePath),
|
|
27
|
+
error: error instanceof Error ? error.message : String(error),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return { workspacePath: '', error: 'Feature workspace not found.' };
|
|
32
|
+
}
|
|
33
|
+
function addFinding(findings, severity, code, message, evidence) {
|
|
34
|
+
findings.push({ severity, code, message, evidence });
|
|
35
|
+
}
|
|
36
|
+
function lintFeatureShape(feature, taskCount, workspaceError) {
|
|
37
|
+
const findings = [];
|
|
38
|
+
if (workspaceError) {
|
|
39
|
+
addFinding(findings, 'error', 'workspace_tasks_unreadable', 'Feature tasks could not be read from the workspace.', {
|
|
40
|
+
error: workspaceError,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (taskCount > 12) {
|
|
44
|
+
addFinding(findings, 'error', 'too_many_tasks', 'Feature has more than 12 tasks and should be split before execution.', {
|
|
45
|
+
tasks: taskCount,
|
|
46
|
+
threshold: 12,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else if (taskCount > 8) {
|
|
50
|
+
addFinding(findings, 'warning', 'many_tasks', 'Feature has more than 8 tasks; consider splitting if tasks touch different concerns.', {
|
|
51
|
+
tasks: taskCount,
|
|
52
|
+
threshold: 8,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (feature.lock_domains.length > 3) {
|
|
56
|
+
addFinding(findings, 'error', 'too_many_lock_domains', 'Feature spans more than 3 lock domains.', {
|
|
57
|
+
lock_domains: feature.lock_domains,
|
|
58
|
+
threshold: 3,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else if (feature.lock_domains.length > 2) {
|
|
62
|
+
addFinding(findings, 'warning', 'many_lock_domains', 'Feature spans more than 2 lock domains.', {
|
|
63
|
+
lock_domains: feature.lock_domains,
|
|
64
|
+
threshold: 2,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (feature.frontend_surface_tokens.length > 5) {
|
|
68
|
+
addFinding(findings, 'error', 'too_many_frontend_surfaces', 'Feature targets more than 5 frontend surfaces.', {
|
|
69
|
+
frontend_surface_tokens: feature.frontend_surface_tokens,
|
|
70
|
+
threshold: 5,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
else if (feature.frontend_surface_tokens.length > 3) {
|
|
74
|
+
addFinding(findings, 'warning', 'many_frontend_surfaces', 'Feature targets more than 3 frontend surfaces.', {
|
|
75
|
+
frontend_surface_tokens: feature.frontend_surface_tokens,
|
|
76
|
+
threshold: 3,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (feature.touches.length > 5) {
|
|
80
|
+
addFinding(findings, 'warning', 'broad_touched_modules', 'Feature touches more than 5 modules.', {
|
|
81
|
+
touches: feature.touches,
|
|
82
|
+
threshold: 5,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (feature.touches.length > 3 && feature.lock_domains.length === 0) {
|
|
86
|
+
addFinding(findings, 'warning', 'missing_lock_domains', 'Broad feature has no lock domains declared.', {
|
|
87
|
+
touches: feature.touches,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return findings;
|
|
91
|
+
}
|
|
92
|
+
export class FeatureLintService {
|
|
93
|
+
async execute(projectRoot, featureId, options = {}) {
|
|
94
|
+
if (!/^FEAT-\d{4}$/.test(featureId)) {
|
|
95
|
+
throw new Error('Invalid feature id. Use FEAT-####.');
|
|
96
|
+
}
|
|
97
|
+
const config = await loadProjectSddConfig(projectRoot);
|
|
98
|
+
const paths = resolveSddPaths(projectRoot, config);
|
|
99
|
+
await ensureMemoryInitialized(paths);
|
|
100
|
+
const snapshot = await loadStateSnapshot(paths, config);
|
|
101
|
+
const feature = snapshot.backlog.items.find((item) => item.id === featureId);
|
|
102
|
+
if (!feature) {
|
|
103
|
+
throw new Error(`Feature ${featureId} not found in backlog.`);
|
|
104
|
+
}
|
|
105
|
+
const workspace = await loadTasksDocument(paths, config, featureId);
|
|
106
|
+
const taskCount = workspace.tasks?.tasks.length ?? 0;
|
|
107
|
+
const findings = lintFeatureShape(feature, taskCount, workspace.error);
|
|
108
|
+
const hasErrors = findings.some((finding) => finding.severity === 'error');
|
|
109
|
+
const hasWarnings = findings.some((finding) => finding.severity === 'warning');
|
|
110
|
+
const ok = !hasErrors && !(options.strict && hasWarnings);
|
|
111
|
+
return {
|
|
112
|
+
feature_id: feature.id,
|
|
113
|
+
title: feature.title,
|
|
114
|
+
status: feature.status,
|
|
115
|
+
ok,
|
|
116
|
+
level: hasErrors ? 'error' : hasWarnings ? 'warning' : 'pass',
|
|
117
|
+
workspace_path: workspace.workspacePath,
|
|
118
|
+
counts: {
|
|
119
|
+
tasks: taskCount,
|
|
120
|
+
lock_domains: feature.lock_domains.length,
|
|
121
|
+
frontend_surfaces: feature.frontend_surface_tokens.length,
|
|
122
|
+
touched_modules: feature.touches.length,
|
|
123
|
+
},
|
|
124
|
+
findings,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export function formatFeatureLintReport(report) {
|
|
129
|
+
const lines = [
|
|
130
|
+
`Feature lint: ${report.feature_id} (${report.level})`,
|
|
131
|
+
`Status: ${report.status}`,
|
|
132
|
+
`Workspace: ${report.workspace_path || '-'}`,
|
|
133
|
+
`Counts: tasks=${report.counts.tasks}, locks=${report.counts.lock_domains}, surfaces=${report.counts.frontend_surfaces}, touched=${report.counts.touched_modules}`,
|
|
134
|
+
];
|
|
135
|
+
if (report.findings.length === 0) {
|
|
136
|
+
lines.push('Findings: none');
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
lines.push('Findings:');
|
|
140
|
+
for (const finding of report.findings) {
|
|
141
|
+
lines.push(`- [${finding.severity}] ${finding.code}: ${finding.message}`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return lines.join('\n');
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=feature-lint.service.js.map
|