@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,31 @@
|
|
|
1
|
+
export interface SddRebuildOptions {
|
|
2
|
+
fromDisk?: boolean;
|
|
3
|
+
dryRun?: boolean;
|
|
4
|
+
render?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface SddRebuildSectionReport {
|
|
7
|
+
scanned: number;
|
|
8
|
+
created: string[];
|
|
9
|
+
updated: string[];
|
|
10
|
+
unchanged: string[];
|
|
11
|
+
skipped: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface SddRebuildReport {
|
|
14
|
+
mode: 'from-disk';
|
|
15
|
+
dryRun: boolean;
|
|
16
|
+
rendered: boolean;
|
|
17
|
+
discovery: SddRebuildSectionReport;
|
|
18
|
+
backlog: SddRebuildSectionReport & {
|
|
19
|
+
workspaces: {
|
|
20
|
+
planned: number;
|
|
21
|
+
active: number;
|
|
22
|
+
archived: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
warnings: string[];
|
|
26
|
+
}
|
|
27
|
+
export declare class SddRebuildService {
|
|
28
|
+
execute(projectRoot?: string, options?: SddRebuildOptions): Promise<SddRebuildReport>;
|
|
29
|
+
}
|
|
30
|
+
export declare function formatSddRebuildReport(report: SddRebuildReport): string;
|
|
31
|
+
//# sourceMappingURL=rebuild.service.d.ts.map
|
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { promises as fs } from 'node:fs';
|
|
3
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
4
|
+
import { loadProjectSddConfig, loadStateSnapshot, nowIso, resolveSddPaths, saveStateTransaction, } from '../state.js';
|
|
5
|
+
import { BacklogStateSchema, DiscoveryIndexStateSchema, } from '../types.js';
|
|
6
|
+
import { activeDocNamesForLayout, buildBacklogItem, computeCanonicalTitle, ensureFeatureQualityContract, ensureMemoryInitialized, relProjectPath, } from '../legacy-operations.js';
|
|
7
|
+
import { renderViews } from '../views.js';
|
|
8
|
+
import { parseWorkspaceYamlDocument, } from '../workspace-schemas.js';
|
|
9
|
+
const DISCOVERY_STATUSES = new Set([
|
|
10
|
+
'NEW',
|
|
11
|
+
'DEBATED',
|
|
12
|
+
'PROMOTED',
|
|
13
|
+
'DROPPED',
|
|
14
|
+
'OPEN',
|
|
15
|
+
'APPROVED',
|
|
16
|
+
'DISCARDED',
|
|
17
|
+
'SUPERSEDED',
|
|
18
|
+
'READY',
|
|
19
|
+
'PLANNED',
|
|
20
|
+
'SPLIT',
|
|
21
|
+
'IN_PROGRESS',
|
|
22
|
+
'DONE',
|
|
23
|
+
'CANCELLED',
|
|
24
|
+
]);
|
|
25
|
+
const DEFAULT_COUNTERS = {
|
|
26
|
+
INS: 0,
|
|
27
|
+
DEB: 0,
|
|
28
|
+
RAD: 0,
|
|
29
|
+
EPIC: 0,
|
|
30
|
+
FEAT: 0,
|
|
31
|
+
FGAP: 0,
|
|
32
|
+
TD: 0,
|
|
33
|
+
};
|
|
34
|
+
function clone(value) {
|
|
35
|
+
return JSON.parse(JSON.stringify(value));
|
|
36
|
+
}
|
|
37
|
+
function defaultSectionReport() {
|
|
38
|
+
return {
|
|
39
|
+
scanned: 0,
|
|
40
|
+
created: [],
|
|
41
|
+
updated: [],
|
|
42
|
+
unchanged: [],
|
|
43
|
+
skipped: [],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
async function pathExists(filePath) {
|
|
47
|
+
return fs.access(filePath).then(() => true, () => false);
|
|
48
|
+
}
|
|
49
|
+
function syncCounterFromId(counters, id) {
|
|
50
|
+
const match = /^(INS|DEB|RAD|EPIC|FEAT|FGAP|TD)-(\d+)$/i.exec(id.trim());
|
|
51
|
+
if (!match)
|
|
52
|
+
return;
|
|
53
|
+
const prefix = match[1].toUpperCase();
|
|
54
|
+
const value = Number(match[2]);
|
|
55
|
+
if (!Number.isFinite(value))
|
|
56
|
+
return;
|
|
57
|
+
counters[prefix] = Math.max(counters[prefix] ?? 0, value);
|
|
58
|
+
}
|
|
59
|
+
function deriveDiscoveryType(id) {
|
|
60
|
+
const prefix = id.split('-')[0]?.toUpperCase();
|
|
61
|
+
if (prefix === 'INS' || prefix === 'DEB' || prefix === 'RAD' || prefix === 'EPIC') {
|
|
62
|
+
return prefix;
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
function discoveryStatusFromMarkdown(content, type, discarded) {
|
|
67
|
+
const statusMatch = /^## Status\s*\n+([A-Z_]+)/im.exec(content);
|
|
68
|
+
const declared = statusMatch?.[1]?.toUpperCase();
|
|
69
|
+
if (declared && DISCOVERY_STATUSES.has(declared)) {
|
|
70
|
+
return declared;
|
|
71
|
+
}
|
|
72
|
+
if (discarded)
|
|
73
|
+
return 'DISCARDED';
|
|
74
|
+
if (type === 'INS')
|
|
75
|
+
return 'NEW';
|
|
76
|
+
if (type === 'DEB')
|
|
77
|
+
return 'DEBATED';
|
|
78
|
+
return 'READY';
|
|
79
|
+
}
|
|
80
|
+
function titleFromMarkdown(content, id, fileName) {
|
|
81
|
+
const titleBlock = /^## Title\s*\n+(.+)$/im.exec(content);
|
|
82
|
+
const baseTitle = /^\s*-\s*Base title:\s*(.+)$/im.exec(content);
|
|
83
|
+
const heading = /^#\s+(.+)$/m.exec(content);
|
|
84
|
+
const slugTitle = path
|
|
85
|
+
.basename(fileName, path.extname(fileName))
|
|
86
|
+
.replace(new RegExp(`^${id}-?`, 'i'), '')
|
|
87
|
+
.replace(/-/g, ' ')
|
|
88
|
+
.trim();
|
|
89
|
+
const candidate = (titleBlock?.[1] || baseTitle?.[1] || heading?.[1] || slugTitle || id).trim();
|
|
90
|
+
const cleaned = candidate
|
|
91
|
+
.replace(new RegExp(`^(Insight|Debate|Epic)\\s+${id}\\s*:?\\s*`, 'i'), '')
|
|
92
|
+
.trim();
|
|
93
|
+
return cleaned || slugTitle || id;
|
|
94
|
+
}
|
|
95
|
+
async function listFeatureDirs(dir) {
|
|
96
|
+
const entries = await fs.readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
97
|
+
return entries
|
|
98
|
+
.filter((entry) => entry.isDirectory() && /^FEAT-\d{4}$/.test(entry.name))
|
|
99
|
+
.map((entry) => path.join(dir, entry.name))
|
|
100
|
+
.sort((left, right) => left.localeCompare(right));
|
|
101
|
+
}
|
|
102
|
+
async function parseWorkspaceDoc(filePath, fileName, warnings, paths) {
|
|
103
|
+
if (!(await pathExists(filePath)))
|
|
104
|
+
return undefined;
|
|
105
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
106
|
+
try {
|
|
107
|
+
return parseWorkspaceYamlDocument(fileName, content);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
111
|
+
warnings.push(`${relProjectPath(paths, filePath)} ignored during rebuild: ${message}`);
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function workspaceOriginTypeToBacklog(originType) {
|
|
116
|
+
if (originType === 'fgap')
|
|
117
|
+
return 'frontend_gap';
|
|
118
|
+
if (originType === 'td')
|
|
119
|
+
return 'tech_debt';
|
|
120
|
+
return originType;
|
|
121
|
+
}
|
|
122
|
+
function statusForLifecycle(lifecycle) {
|
|
123
|
+
if (lifecycle === 'active')
|
|
124
|
+
return 'IN_PROGRESS';
|
|
125
|
+
if (lifecycle === 'archived')
|
|
126
|
+
return 'DONE';
|
|
127
|
+
return 'READY';
|
|
128
|
+
}
|
|
129
|
+
function stageForLifecycle(lifecycle, existing) {
|
|
130
|
+
if (lifecycle === 'active')
|
|
131
|
+
return 'execucao';
|
|
132
|
+
if (lifecycle === 'archived')
|
|
133
|
+
return 'consolidacao';
|
|
134
|
+
if (existing?.current_stage === 'proposta' ||
|
|
135
|
+
existing?.current_stage === 'planejamento' ||
|
|
136
|
+
existing?.current_stage === 'tarefas') {
|
|
137
|
+
return existing.current_stage;
|
|
138
|
+
}
|
|
139
|
+
return 'planejamento';
|
|
140
|
+
}
|
|
141
|
+
function splitContracts(plan) {
|
|
142
|
+
const produces = [];
|
|
143
|
+
const consumes = [];
|
|
144
|
+
for (const contract of plan?.affected_contracts ?? []) {
|
|
145
|
+
const changeType = contract.change_type.toLowerCase();
|
|
146
|
+
if (changeType.includes('produce')) {
|
|
147
|
+
produces.push(contract.name);
|
|
148
|
+
}
|
|
149
|
+
else if (changeType.includes('consume')) {
|
|
150
|
+
consumes.push(contract.name);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
produces: Array.from(new Set(produces)),
|
|
155
|
+
consumes: Array.from(new Set(consumes)),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function preferExistingArray(existing, derived) {
|
|
159
|
+
return existing && existing.length > 0 ? existing : derived;
|
|
160
|
+
}
|
|
161
|
+
function preferExistingFrontendStatus(existing, plan, fallback) {
|
|
162
|
+
if (existing && existing.frontend_impact_status !== 'unknown') {
|
|
163
|
+
return existing.frontend_impact_status;
|
|
164
|
+
}
|
|
165
|
+
return plan?.frontend_impact.status ?? existing?.frontend_impact_status ?? fallback.frontend_impact_status;
|
|
166
|
+
}
|
|
167
|
+
function buildFeatureFromEvidence(evidence, existing, warnings, paths, timestamp) {
|
|
168
|
+
if (!existing && !evidence.spec) {
|
|
169
|
+
warnings.push(`${relProjectPath(paths, evidence.root)} skipped: missing valid 1-spec.yaml and no backlog item exists.`);
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
const spec = evidence.spec;
|
|
173
|
+
const plan = evidence.plan;
|
|
174
|
+
const quality = evidence.quality;
|
|
175
|
+
const originType = spec ? workspaceOriginTypeToBacklog(spec.origin.type) : existing?.origin_type ?? 'direct';
|
|
176
|
+
const originRef = spec?.origin.ref || existing?.origin_ref || undefined;
|
|
177
|
+
if (originType !== 'direct' && originType !== 'fast_track' && !originRef) {
|
|
178
|
+
warnings.push(`${relProjectPath(paths, evidence.root)} skipped: origin_ref cannot be reconstructed.`);
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
const derivedSkills = Array.from(new Set([
|
|
182
|
+
...(plan?.skill_conformance?.selected_skills ?? []),
|
|
183
|
+
...(plan?.suggested_skills ?? []),
|
|
184
|
+
...(existing?.recommended_skills ?? []),
|
|
185
|
+
].filter(Boolean)));
|
|
186
|
+
const selectedSkills = existing?.recommended_skills.length ? existing.recommended_skills : derivedSkills;
|
|
187
|
+
const affectedModules = plan?.architectural_impact.affected_modules ?? [];
|
|
188
|
+
const contracts = splitContracts(plan);
|
|
189
|
+
const base = buildBacklogItem(evidence.id, spec?.title || existing?.title || evidence.id, originType, originRef, existing?.scale ?? 'STANDARD', selectedSkills, {
|
|
190
|
+
executionKind: existing?.execution_kind ?? 'feature',
|
|
191
|
+
planningMode: existing?.planning_mode ?? 'local_plan',
|
|
192
|
+
flowMode: existing?.flow_mode ?? 'padrao',
|
|
193
|
+
acceptanceRefs: spec?.acceptance_refs ?? existing?.acceptance_refs ?? [],
|
|
194
|
+
touches: preferExistingArray(existing?.touches, affectedModules),
|
|
195
|
+
lockDomains: existing?.lock_domains ?? [],
|
|
196
|
+
produces: preferExistingArray(existing?.produces, contracts.produces),
|
|
197
|
+
consumes: preferExistingArray(existing?.consumes, contracts.consumes),
|
|
198
|
+
parallelGroup: existing?.parallel_group,
|
|
199
|
+
});
|
|
200
|
+
const merged = {
|
|
201
|
+
...base,
|
|
202
|
+
...(existing ? clone(existing) : {}),
|
|
203
|
+
id: evidence.id,
|
|
204
|
+
title: existing?.title || spec?.title || base.title,
|
|
205
|
+
status: statusForLifecycle(evidence.lifecycle),
|
|
206
|
+
origin_type: originType,
|
|
207
|
+
origin_ref: originRef,
|
|
208
|
+
summary: existing?.summary || (!existing ? spec?.objective : undefined) || base.summary,
|
|
209
|
+
touches: preferExistingArray(existing?.touches, affectedModules.length > 0 ? affectedModules : base.touches),
|
|
210
|
+
current_stage: stageForLifecycle(evidence.lifecycle, existing),
|
|
211
|
+
gates: existing?.gates || spec?.gates || base.gates,
|
|
212
|
+
acceptance_refs: preferExistingArray(existing?.acceptance_refs, spec?.acceptance_refs ?? base.acceptance_refs),
|
|
213
|
+
recommended_skills: selectedSkills,
|
|
214
|
+
produces: preferExistingArray(existing?.produces, contracts.produces.length > 0 ? contracts.produces : base.produces),
|
|
215
|
+
consumes: preferExistingArray(existing?.consumes, contracts.consumes.length > 0 ? contracts.consumes : base.consumes),
|
|
216
|
+
frontend_impact_status: preferExistingFrontendStatus(existing, plan, base),
|
|
217
|
+
frontend_impact_reason: existing?.frontend_impact_reason || plan?.frontend_impact.description || base.frontend_impact_reason,
|
|
218
|
+
last_sync_at: existing?.last_sync_at || timestamp,
|
|
219
|
+
};
|
|
220
|
+
const qualityContract = ensureFeatureQualityContract(merged, originRef || evidence.id);
|
|
221
|
+
if (!existing?.quality_contract) {
|
|
222
|
+
qualityContract.unit_target_percent =
|
|
223
|
+
quality?.coverage_targets.unit ?? plan?.quality_strategy.unit_target ?? qualityContract.unit_target_percent;
|
|
224
|
+
qualityContract.integration_target_percent =
|
|
225
|
+
quality?.coverage_targets.integration ??
|
|
226
|
+
plan?.quality_strategy.integration_target ??
|
|
227
|
+
qualityContract.integration_target_percent;
|
|
228
|
+
qualityContract.evidence_mode =
|
|
229
|
+
plan?.quality_strategy.approach === 'coverage' ||
|
|
230
|
+
plan?.quality_strategy.approach === 'equivalence' ||
|
|
231
|
+
plan?.quality_strategy.approach === 'hybrid'
|
|
232
|
+
? plan.quality_strategy.approach
|
|
233
|
+
: qualityContract.evidence_mode;
|
|
234
|
+
}
|
|
235
|
+
qualityContract.inherited_from = originRef || qualityContract.inherited_from || evidence.id;
|
|
236
|
+
qualityContract.updated_at = existing?.quality_contract?.updated_at || qualityContract.updated_at || timestamp;
|
|
237
|
+
merged.quality_contract = qualityContract;
|
|
238
|
+
if (evidence.lifecycle === 'archived' && !merged.done_at) {
|
|
239
|
+
merged.done_at = existing?.done_at || '';
|
|
240
|
+
}
|
|
241
|
+
return merged;
|
|
242
|
+
}
|
|
243
|
+
async function discoverWorkspaceFeatures(paths, config, warnings) {
|
|
244
|
+
const names = activeDocNamesForLayout(config);
|
|
245
|
+
const roots = [
|
|
246
|
+
{ lifecycle: 'planned', dir: paths.plannedDir },
|
|
247
|
+
{ lifecycle: 'active', dir: paths.activeDir },
|
|
248
|
+
{ lifecycle: 'archived', dir: paths.archivedDir },
|
|
249
|
+
];
|
|
250
|
+
const features = [];
|
|
251
|
+
for (const root of roots) {
|
|
252
|
+
const dirs = await listFeatureDirs(root.dir);
|
|
253
|
+
for (const featureRoot of dirs) {
|
|
254
|
+
const id = path.basename(featureRoot);
|
|
255
|
+
features.push({
|
|
256
|
+
id,
|
|
257
|
+
lifecycle: root.lifecycle,
|
|
258
|
+
root: featureRoot,
|
|
259
|
+
spec: await parseWorkspaceDoc(path.join(featureRoot, names.spec), '1-spec.yaml', warnings, paths),
|
|
260
|
+
plan: await parseWorkspaceDoc(path.join(featureRoot, names.plan), '2-plan.yaml', warnings, paths),
|
|
261
|
+
quality: await parseWorkspaceDoc(path.join(featureRoot, names.quality), '5-quality.yaml', warnings, paths),
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return features;
|
|
266
|
+
}
|
|
267
|
+
async function discoverDiscoveryRecords(paths, timestamp, warnings) {
|
|
268
|
+
const roots = [
|
|
269
|
+
{ dir: paths.discoveryInsightsDir },
|
|
270
|
+
{ dir: paths.discoveryDebatesDir },
|
|
271
|
+
{ dir: paths.discoveryEpicDir },
|
|
272
|
+
{ dir: paths.discoveryDiscardedDir, discarded: true },
|
|
273
|
+
];
|
|
274
|
+
const records = [];
|
|
275
|
+
const seen = new Set();
|
|
276
|
+
for (const root of roots) {
|
|
277
|
+
const entries = await fs.readdir(root.dir, { withFileTypes: true }).catch(() => []);
|
|
278
|
+
for (const entry of entries) {
|
|
279
|
+
if (!entry.isFile() || path.extname(entry.name).toLowerCase() !== '.md')
|
|
280
|
+
continue;
|
|
281
|
+
const idMatch = /^(INS|DEB|RAD|EPIC)-\d{3,}/i.exec(entry.name);
|
|
282
|
+
if (!idMatch)
|
|
283
|
+
continue;
|
|
284
|
+
const id = idMatch[0].toUpperCase();
|
|
285
|
+
if (seen.has(id))
|
|
286
|
+
continue;
|
|
287
|
+
const type = deriveDiscoveryType(id);
|
|
288
|
+
if (!type)
|
|
289
|
+
continue;
|
|
290
|
+
const filePath = path.join(root.dir, entry.name);
|
|
291
|
+
const content = await fs.readFile(filePath, 'utf-8').catch((error) => {
|
|
292
|
+
warnings.push(`${relProjectPath(paths, filePath)} ignored during discovery rebuild: ${String(error)}`);
|
|
293
|
+
return '';
|
|
294
|
+
});
|
|
295
|
+
records.push({
|
|
296
|
+
id,
|
|
297
|
+
type,
|
|
298
|
+
title: titleFromMarkdown(content, id, entry.name),
|
|
299
|
+
title_canonical: computeCanonicalTitle(titleFromMarkdown(content, id, entry.name)),
|
|
300
|
+
status: discoveryStatusFromMarkdown(content, type, root.discarded === true),
|
|
301
|
+
origin_prompt: `Reconstructed from ${relProjectPath(paths, filePath)}`,
|
|
302
|
+
related_ids: [],
|
|
303
|
+
warning_links: [],
|
|
304
|
+
created_at: timestamp,
|
|
305
|
+
updated_at: timestamp,
|
|
306
|
+
});
|
|
307
|
+
seen.add(id);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return records;
|
|
311
|
+
}
|
|
312
|
+
function applyDiscoveryRebuild(current, discovered, features, timestamp) {
|
|
313
|
+
const report = defaultSectionReport();
|
|
314
|
+
report.scanned = discovered.length;
|
|
315
|
+
const recordsById = new Map(current.records.map((record) => [record.id, clone(record)]));
|
|
316
|
+
for (const diskRecord of discovered) {
|
|
317
|
+
const existing = recordsById.get(diskRecord.id);
|
|
318
|
+
if (!existing) {
|
|
319
|
+
recordsById.set(diskRecord.id, diskRecord);
|
|
320
|
+
report.created.push(diskRecord.id);
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
const merged = {
|
|
324
|
+
...existing,
|
|
325
|
+
title: existing.title || diskRecord.title,
|
|
326
|
+
title_canonical: existing.title_canonical || diskRecord.title_canonical || computeCanonicalTitle(existing.title || diskRecord.title),
|
|
327
|
+
status: existing.status || diskRecord.status,
|
|
328
|
+
origin_prompt: existing.origin_prompt || diskRecord.origin_prompt,
|
|
329
|
+
related_ids: Array.from(new Set([...(existing.related_ids ?? []), ...(diskRecord.related_ids ?? [])])),
|
|
330
|
+
warning_links: existing.warning_links ?? [],
|
|
331
|
+
created_at: existing.created_at || diskRecord.created_at,
|
|
332
|
+
updated_at: existing.updated_at || timestamp,
|
|
333
|
+
};
|
|
334
|
+
if (isDeepStrictEqual(existing, merged)) {
|
|
335
|
+
report.unchanged.push(diskRecord.id);
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
recordsById.set(diskRecord.id, merged);
|
|
339
|
+
report.updated.push(diskRecord.id);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
for (const feature of features) {
|
|
343
|
+
const originRef = feature.spec?.origin.ref;
|
|
344
|
+
if (!originRef)
|
|
345
|
+
continue;
|
|
346
|
+
const origin = recordsById.get(originRef);
|
|
347
|
+
if (!origin || origin.related_ids.includes(feature.id))
|
|
348
|
+
continue;
|
|
349
|
+
const updated = {
|
|
350
|
+
...origin,
|
|
351
|
+
related_ids: Array.from(new Set([...origin.related_ids, feature.id])),
|
|
352
|
+
updated_at: timestamp,
|
|
353
|
+
};
|
|
354
|
+
recordsById.set(originRef, updated);
|
|
355
|
+
if (!report.created.includes(originRef) && !report.updated.includes(originRef)) {
|
|
356
|
+
report.updated.push(originRef);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const counters = { ...DEFAULT_COUNTERS, ...current.counters };
|
|
360
|
+
const records = Array.from(recordsById.values()).sort((left, right) => left.id.localeCompare(right.id));
|
|
361
|
+
for (const record of records) {
|
|
362
|
+
syncCounterFromId(counters, record.id);
|
|
363
|
+
}
|
|
364
|
+
for (const feature of features) {
|
|
365
|
+
syncCounterFromId(counters, feature.id);
|
|
366
|
+
}
|
|
367
|
+
const state = DiscoveryIndexStateSchema.parse({
|
|
368
|
+
...current,
|
|
369
|
+
counters,
|
|
370
|
+
records,
|
|
371
|
+
});
|
|
372
|
+
return { state, report };
|
|
373
|
+
}
|
|
374
|
+
function applyBacklogRebuild(current, features, warnings, paths, timestamp) {
|
|
375
|
+
const report = {
|
|
376
|
+
...defaultSectionReport(),
|
|
377
|
+
workspaces: {
|
|
378
|
+
planned: features.filter((feature) => feature.lifecycle === 'planned').length,
|
|
379
|
+
active: features.filter((feature) => feature.lifecycle === 'active').length,
|
|
380
|
+
archived: features.filter((feature) => feature.lifecycle === 'archived').length,
|
|
381
|
+
},
|
|
382
|
+
};
|
|
383
|
+
report.scanned = features.length;
|
|
384
|
+
const itemsById = new Map(current.items.map((item) => [item.id, clone(item)]));
|
|
385
|
+
for (const feature of features) {
|
|
386
|
+
const existing = itemsById.get(feature.id);
|
|
387
|
+
const rebuilt = buildFeatureFromEvidence(feature, existing, warnings, paths, timestamp);
|
|
388
|
+
if (!rebuilt) {
|
|
389
|
+
report.skipped.push(feature.id);
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
if (!existing) {
|
|
393
|
+
itemsById.set(feature.id, rebuilt);
|
|
394
|
+
report.created.push(feature.id);
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
if (isDeepStrictEqual(existing, rebuilt)) {
|
|
398
|
+
report.unchanged.push(feature.id);
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
rebuilt.last_sync_at = timestamp;
|
|
402
|
+
if (rebuilt.quality_contract) {
|
|
403
|
+
rebuilt.quality_contract.updated_at = timestamp;
|
|
404
|
+
}
|
|
405
|
+
itemsById.set(feature.id, rebuilt);
|
|
406
|
+
report.updated.push(feature.id);
|
|
407
|
+
}
|
|
408
|
+
const state = BacklogStateSchema.parse({
|
|
409
|
+
...current,
|
|
410
|
+
items: Array.from(itemsById.values()).sort((left, right) => left.id.localeCompare(right.id)),
|
|
411
|
+
});
|
|
412
|
+
return { state, report };
|
|
413
|
+
}
|
|
414
|
+
function shouldRender(config, options) {
|
|
415
|
+
if (options.dryRun)
|
|
416
|
+
return false;
|
|
417
|
+
if (options.render === false)
|
|
418
|
+
return false;
|
|
419
|
+
return options.render === true || config.views.autoRender;
|
|
420
|
+
}
|
|
421
|
+
export class SddRebuildService {
|
|
422
|
+
async execute(projectRoot = '.', options = {}) {
|
|
423
|
+
if (!options.fromDisk) {
|
|
424
|
+
throw new Error('Use --from-disk to rebuild canonical SDD state from workspace and discovery files.');
|
|
425
|
+
}
|
|
426
|
+
const config = await loadProjectSddConfig(projectRoot);
|
|
427
|
+
const paths = resolveSddPaths(projectRoot, config);
|
|
428
|
+
await ensureMemoryInitialized(paths);
|
|
429
|
+
const snapshot = await loadStateSnapshot(paths, config);
|
|
430
|
+
const timestamp = nowIso();
|
|
431
|
+
const warnings = [];
|
|
432
|
+
const features = await discoverWorkspaceFeatures(paths, config, warnings);
|
|
433
|
+
const discovered = await discoverDiscoveryRecords(paths, timestamp, warnings);
|
|
434
|
+
const discovery = applyDiscoveryRebuild(snapshot.discoveryIndex, discovered, features, timestamp);
|
|
435
|
+
const backlog = applyBacklogRebuild(snapshot.backlog, features, warnings, paths, timestamp);
|
|
436
|
+
const render = shouldRender(config, options);
|
|
437
|
+
if (!options.dryRun) {
|
|
438
|
+
await saveStateTransaction(paths, {
|
|
439
|
+
discoveryIndex: discovery.state,
|
|
440
|
+
backlog: backlog.state,
|
|
441
|
+
});
|
|
442
|
+
if (render) {
|
|
443
|
+
const rebuiltSnapshot = {
|
|
444
|
+
...snapshot,
|
|
445
|
+
discoveryIndex: discovery.state,
|
|
446
|
+
backlog: backlog.state,
|
|
447
|
+
};
|
|
448
|
+
await renderViews(paths, config, rebuiltSnapshot);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return {
|
|
452
|
+
mode: 'from-disk',
|
|
453
|
+
dryRun: options.dryRun === true,
|
|
454
|
+
rendered: render,
|
|
455
|
+
discovery: discovery.report,
|
|
456
|
+
backlog: backlog.report,
|
|
457
|
+
warnings,
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
export function formatSddRebuildReport(report) {
|
|
462
|
+
const lines = [
|
|
463
|
+
`Rebuild mode: ${report.mode}`,
|
|
464
|
+
`Dry run: ${report.dryRun ? 'yes' : 'no'}`,
|
|
465
|
+
`Views rendered: ${report.rendered ? 'yes' : 'no'}`,
|
|
466
|
+
`Discovery scanned: ${report.discovery.scanned}`,
|
|
467
|
+
`Discovery created: ${report.discovery.created.join(', ') || '-'}`,
|
|
468
|
+
`Discovery updated: ${report.discovery.updated.join(', ') || '-'}`,
|
|
469
|
+
`Backlog workspaces: planned=${report.backlog.workspaces.planned}, active=${report.backlog.workspaces.active}, archived=${report.backlog.workspaces.archived}`,
|
|
470
|
+
`Backlog created: ${report.backlog.created.join(', ') || '-'}`,
|
|
471
|
+
`Backlog updated: ${report.backlog.updated.join(', ') || '-'}`,
|
|
472
|
+
`Backlog skipped: ${report.backlog.skipped.join(', ') || '-'}`,
|
|
473
|
+
];
|
|
474
|
+
if (report.warnings.length > 0) {
|
|
475
|
+
lines.push('Warnings:');
|
|
476
|
+
for (const warning of report.warnings) {
|
|
477
|
+
lines.push(`- ${warning}`);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return lines.join('\n');
|
|
481
|
+
}
|
|
482
|
+
//# sourceMappingURL=rebuild.service.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface ScanNamingViolation {
|
|
2
|
+
file: string;
|
|
3
|
+
term: string;
|
|
4
|
+
count: number;
|
|
5
|
+
severity: 'error' | 'warning';
|
|
6
|
+
}
|
|
7
|
+
export interface ScanNamingIdentity {
|
|
8
|
+
productName: string;
|
|
9
|
+
cliBin: string;
|
|
10
|
+
packageName: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ScanNamingReport {
|
|
13
|
+
scannedFiles: number;
|
|
14
|
+
violations: ScanNamingViolation[];
|
|
15
|
+
errorCount: number;
|
|
16
|
+
warningCount: number;
|
|
17
|
+
contractVersion: number;
|
|
18
|
+
contract: {
|
|
19
|
+
productName: string;
|
|
20
|
+
cliBin: string;
|
|
21
|
+
packageName: string;
|
|
22
|
+
currentIdentity: ScanNamingIdentity;
|
|
23
|
+
targetIdentity: ScanNamingIdentity;
|
|
24
|
+
forbiddenTerms: number;
|
|
25
|
+
allowlistEntries: number;
|
|
26
|
+
renameRules: number;
|
|
27
|
+
zeroResidueGate: {
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
enforcement: 'error' | 'warning';
|
|
30
|
+
terms: number;
|
|
31
|
+
removalPhase: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface ScanNamingOptions {
|
|
36
|
+
strict?: boolean;
|
|
37
|
+
json?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare class ScanNamingService {
|
|
40
|
+
execute(projectRoot: string, options?: ScanNamingOptions): Promise<ScanNamingReport>;
|
|
41
|
+
}
|
|
42
|
+
export declare function formatScanNamingReport(report: ScanNamingReport): string;
|
|
43
|
+
//# sourceMappingURL=scan-naming.service.d.ts.map
|