@devtrack-solution/codesdd 1.2.4-rc3 → 1.2.4

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.
Files changed (128) hide show
  1. package/.sdd/skills/curated/devtrack-api/SKILL.md +91 -12
  2. package/.sdd/skills/curated/devtrack-api/agents/claude-code.yaml +2 -0
  3. package/.sdd/skills/curated/devtrack-api/agents/codex.yaml +2 -0
  4. package/.sdd/skills/curated/devtrack-api/agents/cursor.yaml +2 -0
  5. package/.sdd/skills/curated/devtrack-api/agents/gemini.yaml +2 -0
  6. package/.sdd/skills/curated/devtrack-api/agents/kimi.yaml +2 -0
  7. package/.sdd/skills/curated/devtrack-api/agents/openai.yaml +3 -3
  8. package/.sdd/skills/curated/devtrack-api/agents/opencode.yaml +2 -0
  9. package/.sdd/skills/curated/devtrack-api/references/application-presentation.md +59 -3
  10. package/.sdd/skills/curated/devtrack-api/references/consumer-sync-policy.md +15 -3
  11. package/.sdd/skills/curated/devtrack-api/references/contract-pack.yaml +1898 -2
  12. package/.sdd/skills/curated/devtrack-api/references/domain-modeling.md +3 -1
  13. package/.sdd/skills/curated/devtrack-api/references/field-validation-protocol.md +40 -0
  14. package/.sdd/skills/curated/devtrack-api/references/foundation-layout.md +20 -2
  15. package/.sdd/skills/curated/devtrack-api/references/generated-artifact-invalidation.md +97 -0
  16. package/.sdd/skills/curated/devtrack-api/references/implementation-checklist.md +30 -1
  17. package/.sdd/skills/curated/devtrack-api/references/portable-agent-contract.md +4 -3
  18. package/.sdd/skills/curated/devtrack-api/references/testing-validation.md +22 -1
  19. package/.sdd/skills/curated/devtrack-api/references/typeorm-infrastructure.md +9 -5
  20. package/README.md +122 -25
  21. package/dist/cli/program.js +180 -11
  22. package/dist/commands/config.js +27 -1
  23. package/dist/commands/sdd/execution.js +64 -2
  24. package/dist/commands/sdd.js +119 -4
  25. package/dist/core/cli/command-matrix.d.ts +18 -0
  26. package/dist/core/cli/command-matrix.js +148 -0
  27. package/dist/core/cli-command-quality.js +2 -0
  28. package/dist/core/config-schema.d.ts +14 -1
  29. package/dist/core/config-schema.js +32 -1
  30. package/dist/core/config.d.ts +1 -0
  31. package/dist/core/config.js +11 -0
  32. package/dist/core/global-config.d.ts +13 -0
  33. package/dist/core/init.d.ts +2 -2
  34. package/dist/core/init.js +13 -14
  35. package/dist/core/sdd/agent-binding.d.ts +9 -9
  36. package/dist/core/sdd/agent-runtime-contract.d.ts +4 -4
  37. package/dist/core/sdd/allocator-recovery.d.ts +14 -0
  38. package/dist/core/sdd/allocator-recovery.js +30 -0
  39. package/dist/core/sdd/allocator-security.d.ts +18 -0
  40. package/dist/core/sdd/allocator-security.js +36 -0
  41. package/dist/core/sdd/api-foundation-baseline.d.ts +111 -0
  42. package/dist/core/sdd/api-foundation-baseline.js +151 -0
  43. package/dist/core/sdd/api-foundation-parity.d.ts +114 -0
  44. package/dist/core/sdd/api-foundation-parity.js +131 -0
  45. package/dist/core/sdd/api-profile-catalog.d.ts +36 -0
  46. package/dist/core/sdd/api-profile-catalog.js +132 -0
  47. package/dist/core/sdd/api-profile-dry-run-projection.d.ts +93 -0
  48. package/dist/core/sdd/api-profile-dry-run-projection.js +370 -0
  49. package/dist/core/sdd/api-profile-recipes.d.ts +82 -0
  50. package/dist/core/sdd/api-profile-recipes.js +484 -0
  51. package/dist/core/sdd/artifact-id-allocator.d.ts +368 -0
  52. package/dist/core/sdd/artifact-id-allocator.js +510 -0
  53. package/dist/core/sdd/check.d.ts +50 -1
  54. package/dist/core/sdd/check.js +286 -9
  55. package/dist/core/sdd/deepagent-contracts.d.ts +4 -4
  56. package/dist/core/sdd/deepagents/reversa-subagents.d.ts +3 -3
  57. package/dist/core/sdd/default-bootstrap-files.d.ts +1 -1
  58. package/dist/core/sdd/default-bootstrap-files.js +0 -2
  59. package/dist/core/sdd/default-skills.js +7 -5
  60. package/dist/core/sdd/devtrack-api-appliance.d.ts +34 -0
  61. package/dist/core/sdd/devtrack-api-appliance.js +138 -34
  62. package/dist/core/sdd/devtrack-api-architecture.d.ts +16 -0
  63. package/dist/core/sdd/devtrack-api-architecture.js +86 -0
  64. package/dist/core/sdd/docs-sync.js +3 -3
  65. package/dist/core/sdd/enterprise-mutating-command-gate.d.ts +27 -0
  66. package/dist/core/sdd/enterprise-mutating-command-gate.js +104 -0
  67. package/dist/core/sdd/enterprise-provenance-gates.d.ts +20 -0
  68. package/dist/core/sdd/enterprise-provenance-gates.js +63 -0
  69. package/dist/core/sdd/enterprise-provisioning-policy.d.ts +26 -0
  70. package/dist/core/sdd/enterprise-provisioning-policy.js +104 -0
  71. package/dist/core/sdd/governance-schemas.d.ts +2 -2
  72. package/dist/core/sdd/governance-schemas.js +11 -2
  73. package/dist/core/sdd/json-schema.js +4 -0
  74. package/dist/core/sdd/legacy-operations.js +93 -4
  75. package/dist/core/sdd/package-security-gates.js +2 -0
  76. package/dist/core/sdd/package-structure-gate.d.ts +85 -3
  77. package/dist/core/sdd/package-structure-gate.js +386 -8
  78. package/dist/core/sdd/parallel-feat-automation.d.ts +6 -6
  79. package/dist/core/sdd/plugin-policy.js +6 -1
  80. package/dist/core/sdd/plugin-registry.d.ts +3 -3
  81. package/dist/core/sdd/quality-validation.d.ts +5 -5
  82. package/dist/core/sdd/release-readiness.d.ts +49 -0
  83. package/dist/core/sdd/release-readiness.js +303 -8
  84. package/dist/core/sdd/reversa-architecture-extractor.d.ts +13 -0
  85. package/dist/core/sdd/reversa-architecture-extractor.js +89 -0
  86. package/dist/core/sdd/reversa-artifact-writer.d.ts +18 -0
  87. package/dist/core/sdd/reversa-artifact-writer.js +40 -0
  88. package/dist/core/sdd/reversa-command-policy.d.ts +136 -0
  89. package/dist/core/sdd/reversa-command-policy.js +361 -0
  90. package/dist/core/sdd/reversa-data-extractor.d.ts +11 -0
  91. package/dist/core/sdd/reversa-data-extractor.js +73 -0
  92. package/dist/core/sdd/reversa-equivalence.d.ts +20 -0
  93. package/dist/core/sdd/reversa-equivalence.js +34 -0
  94. package/dist/core/sdd/reversa-evidence.d.ts +298 -0
  95. package/dist/core/sdd/reversa-evidence.js +118 -0
  96. package/dist/core/sdd/reversa-reconstruction.d.ts +29 -0
  97. package/dist/core/sdd/reversa-reconstruction.js +32 -0
  98. package/dist/core/sdd/reversa-rules-extractor.d.ts +12 -0
  99. package/dist/core/sdd/reversa-rules-extractor.js +86 -0
  100. package/dist/core/sdd/reversa-source-safety.d.ts +19 -0
  101. package/dist/core/sdd/reversa-source-safety.js +105 -0
  102. package/dist/core/sdd/reversa-surface-scout.d.ts +13 -0
  103. package/dist/core/sdd/reversa-surface-scout.js +85 -0
  104. package/dist/core/sdd/reversa-ux-mapper.d.ts +11 -0
  105. package/dist/core/sdd/reversa-ux-mapper.js +73 -0
  106. package/dist/core/sdd/sdk-agent-plugin-quality-gates.d.ts +1 -1
  107. package/dist/core/sdd/services/archive-quality-coherence.service.d.ts +17 -0
  108. package/dist/core/sdd/services/archive-quality-coherence.service.js +141 -0
  109. package/dist/core/sdd/services/decide.service.js +1 -1
  110. package/dist/core/sdd/services/finalize.service.d.ts +2 -0
  111. package/dist/core/sdd/services/finalize.service.js +48 -2
  112. package/dist/core/sdd/services/historical-quality-regression.service.d.ts +35 -0
  113. package/dist/core/sdd/services/historical-quality-regression.service.js +228 -0
  114. package/dist/core/sdd/services/ingest-deposito.service.js +1 -1
  115. package/dist/core/sdd/services/planning-execution-coherence.service.d.ts +45 -0
  116. package/dist/core/sdd/services/planning-execution-coherence.service.js +225 -0
  117. package/dist/core/sdd/state.js +15 -5
  118. package/dist/core/sdd/types.d.ts +3 -3
  119. package/dist/core/sdd/workspace-schemas.d.ts +45 -4
  120. package/dist/core/sdd/workspace-schemas.js +27 -6
  121. package/dist/core/shared/skill-generation.d.ts +2 -0
  122. package/dist/core/shared/skill-generation.js +19 -2
  123. package/dist/core/shared/tool-detection.d.ts +19 -0
  124. package/dist/core/shared/tool-detection.js +89 -0
  125. package/package.json +6 -5
  126. package/schemas/sdd/5-quality.schema.json +43 -0
  127. package/schemas/sdd/reversa-evidence-bundle.schema.json +466 -0
  128. package/schemas/sdd/workspace-catalog.schema.json +511 -0
@@ -9,6 +9,8 @@ import { OnboardService } from '../../core/sdd/services/onboard.service.js';
9
9
  import { ApproveService } from '../../core/sdd/services/approve.service.js';
10
10
  import { NextService } from '../../core/sdd/services/next.service.js';
11
11
  import { AuditService } from '../../core/sdd/services/audit.service.js';
12
+ import { PlanningExecutionCoherenceService } from '../../core/sdd/services/planning-execution-coherence.service.js';
13
+ import { HistoricalQualityRegressionService } from '../../core/sdd/services/historical-quality-regression.service.js';
12
14
  import { McpRuntimeService } from '../../core/sdd/services/mcp-runtime.service.js';
13
15
  import { DeepAgentsRunService, } from '../../core/sdd/services/agent-run.service.js';
14
16
  import { evaluateReleaseReadiness, formatReleaseReadinessReport } from '../../core/sdd/release-readiness.js';
@@ -142,7 +144,7 @@ async function buildPlanStatus(root, stores, options) {
142
144
  export function registerExecutionCommands(sddCmd) {
143
145
  sddCmd
144
146
  .command('release-readiness')
145
- .description('Report non-mutating release readiness gates and CI parity commands')
147
+ .description('Report non-mutating release readiness handoff sections and CI parity commands')
146
148
  .alias('prontidao-release')
147
149
  .option('--strict', 'Return exit code 1 when readiness is blocked')
148
150
  .option('--json', 'JSON output')
@@ -834,10 +836,55 @@ export function registerExecutionCommands(sddCmd) {
834
836
  console.log(`Workspace ativo: ${startResult.active_path}`);
835
837
  console.log(`Proximo passo: codesdd sdd context ${startResult.featureId} --compact`);
836
838
  });
839
+ sddCmd
840
+ .command('historical-quality-regression [path]')
841
+ .description('Escaneia regressao historica de qualidade em modo CI (janela recente) ou revisao completa')
842
+ .alias('qualidade-regressao-historica')
843
+ .option('--mode <mode>', 'Modo: recent-window|full-history (padrao: recent-window)', 'recent-window')
844
+ .option('--window <n>', 'Quantidade de FEATs mais recentes no modo recent-window (padrao: 25)')
845
+ .option('--grandfather-max-feat <n>', 'Limite numerico de grandfathering (padrao: FEAT-0451)')
846
+ .option('--strict', 'Retorna exit code 1 quando regressao e detectada')
847
+ .option('--json', 'Saida em JSON')
848
+ .action(async (targetPath = '.', options) => {
849
+ const root = resolveRoot(targetPath);
850
+ const __config = await loadProjectSddConfig(root);
851
+ const __paths = resolveSddPaths(root, __config);
852
+ const stores = createSddStores(__paths);
853
+ await ensureMandatorySddMigration(root);
854
+ if (options?.mode && !['recent-window', 'full-history'].includes(options.mode)) {
855
+ throw new Error('Valor invalido em --mode. Use recent-window ou full-history.');
856
+ }
857
+ const command = new HistoricalQualityRegressionService();
858
+ const report = await command.execute(root, {
859
+ mode: options?.mode,
860
+ recentWindowSize: parsePositiveNumberOption(options?.window, '--window'),
861
+ grandfatherMaxFeat: parseNonNegativeNumberOption(options?.grandfatherMaxFeat, '--grandfather-max-feat'),
862
+ });
863
+ if (options?.json) {
864
+ console.log(JSON.stringify(report, null, 2));
865
+ }
866
+ else {
867
+ console.log(chalk.green('Scanner historico de regressao de qualidade'));
868
+ console.log(`Modo: ${report.mode}`);
869
+ console.log(`Escopo: scanned=${report.scanned} considered=${report.considered} analyzed=${report.analyzed}`);
870
+ console.log(`Grandfathering: <= FEAT-${String(report.grandfathering.max_feat_id).padStart(4, '0')} (skipped=${report.grandfathered})`);
871
+ console.log(`Regressoes: ${report.issue_count}`);
872
+ if (report.issues.length > 0) {
873
+ for (const issue of report.issues) {
874
+ console.log(`- ${issue.feature_id} [${issue.code}] ${issue.message}`);
875
+ }
876
+ }
877
+ }
878
+ if (options?.strict && report.issue_count > 0) {
879
+ process.exitCode = 1;
880
+ }
881
+ });
837
882
  sddCmd
838
883
  .command('audit [path]')
839
884
  .description('Audita a saude de meta-evolucao do SDD (placeholders, deliberacao, ADR e forced transition)')
840
885
  .alias('auditar')
886
+ .option('--feature <featId>', 'Executa auditoria de coerencia planejamento-execucao para uma FEAT')
887
+ .option('--strict', 'Retorna exit code 1 quando a auditoria de coerencia encontra erro')
841
888
  .option('--json', 'Saida em JSON')
842
889
  .action(async (targetPath = '.', options) => {
843
890
  const root = resolveRoot(targetPath);
@@ -847,8 +894,14 @@ export function registerExecutionCommands(sddCmd) {
847
894
  await ensureMandatorySddMigration(root);
848
895
  const command = new AuditService(stores);
849
896
  const result = await command.execute(root);
897
+ const coherence = options?.feature
898
+ ? await new PlanningExecutionCoherenceService().execute(root, options.feature)
899
+ : null;
850
900
  if (options?.json) {
851
- console.log(JSON.stringify(result, null, 2));
901
+ console.log(JSON.stringify({ ...result, planning_execution_coherence: coherence }, null, 2));
902
+ if (options?.strict && coherence && !coherence.healthy) {
903
+ process.exitCode = 1;
904
+ }
852
905
  return;
853
906
  }
854
907
  console.log(chalk.green('Auditoria SDD concluida.'));
@@ -864,7 +917,16 @@ export function registerExecutionCommands(sddCmd) {
864
917
  if (result.metrics.forced_transitions.feature_refs.length > 0) {
865
918
  console.log(`Features com evidencias: ${result.metrics.forced_transitions.feature_refs.join(', ')}`);
866
919
  }
920
+ if (coherence) {
921
+ console.log(`Coerencia planejamento-execucao (${coherence.feature_id}): ${coherence.healthy ? 'OK' : 'ALERTA'}`);
922
+ if (coherence.issues.length > 0) {
923
+ console.log(`Issues: ${coherence.issues.map((issue) => `${issue.code}:${issue.severity}`).join(', ')}`);
924
+ }
925
+ }
867
926
  console.log(result.recommendation);
927
+ if (options?.strict && coherence && !coherence.healthy) {
928
+ process.exitCode = 1;
929
+ }
868
930
  });
869
931
  }
870
932
  //# sourceMappingURL=execution.js.map
@@ -25,6 +25,7 @@ import { FeatureLintService, formatFeatureLintReport } from "../core/sdd/service
25
25
  import { SddDedupApplyService, formatSddDedupApplyReport } from "../core/sdd/services/dedup-apply.service.js";
26
26
  import { evaluateSddIntentGuard } from '../core/sdd/intent-guard.js';
27
27
  import { captureFingerprintsForChange, writeMeta } from '../core/sdd/fingerprint.js';
28
+ import { REVERSA_AUTHORIZATION_SCOPES, REVERSA_BACKEND_CONTRACT_MODES, REVERSA_COMMANDS, REVERSA_MODES, REVERSA_PRESERVATION_CHOICES, REVERSA_TARGET_STACKS, REVERSA_URL_MODES, REVERSA_VOLUME_PRESETS, buildReversaCommandPlan, } from '../core/sdd/reversa-command-policy.js';
28
29
  import { ensureMandatorySddMigration, parseCsvOption, parseFlowModeOption, parseLangOption, parseLayoutOption, resolveInitRoot, resolveRoot, } from './sdd/shared.js';
29
30
  import { registerExecutionCommands } from './sdd/execution.js';
30
31
  import { registerPluginCommands } from './sdd/plugin.js';
@@ -67,6 +68,101 @@ export function registerSddCommand(program) {
67
68
  process.exitCode = 2;
68
69
  }
69
70
  });
71
+ sddCmd
72
+ .command('reversa <command> [target]')
73
+ .description('Planeja a superficie Reversa com politica governada e fail-closed')
74
+ .option('--mode <mode>', `Modo Reversa: ${REVERSA_MODES.join('|')} (padrao: read-only); para url aceita tambem ${REVERSA_URL_MODES.join('|')}`)
75
+ .option('--execution-mode <mode>', `Modo de execucao Reversa: ${REVERSA_MODES.join('|')}`)
76
+ .option('--url-mode <mode>', `Modo URL: ${REVERSA_URL_MODES.join('|')}`)
77
+ .option('--feature <FEAT-ID>', 'FEAT que recebera evidencias Reversa')
78
+ .option('--source <path>', 'Fonte legada ou diretorio alvo a inspecionar')
79
+ .option('--approval <list>', 'Aprovacoes separadas por virgula para modos apply')
80
+ .option('--accept-legal-terms', 'Aceita os termos legais obrigatorios para Reversa URL')
81
+ .option('--authorization-scope <scope>', `Escopo de autorizacao URL: ${REVERSA_AUTHORIZATION_SCOPES.join('|')}`)
82
+ .option('--authorization-note <note>', 'Referencia auditavel de autorizacao, contrato, ticket ou ordem')
83
+ .option('--volume-preset <preset>', `Preset de volumetria URL: ${REVERSA_VOLUME_PRESETS.join('|')}`)
84
+ .option('--volume-budget <file>', 'Arquivo de budget customizado para volumetria URL')
85
+ .option('--approve-volume-budget', 'Confirma que o budget customizado foi validado por schema e aprovado por humano')
86
+ .option('--target-stack <stack>', `Stack alvo URL: ${REVERSA_TARGET_STACKS.join('|')}`)
87
+ .option('--preserve-brand <decision>', `Decisao de marca: ${REVERSA_PRESERVATION_CHOICES.join('|')}`)
88
+ .option('--preserve-logo <decision>', `Decisao de logo: ${REVERSA_PRESERVATION_CHOICES.join('|')}`)
89
+ .option('--preserve-content <decision>', `Decisao de conteudo: ${REVERSA_PRESERVATION_CHOICES.join('|')}`)
90
+ .option('--preserve-assets <decision>', `Decisao de assets: ${REVERSA_PRESERVATION_CHOICES.join('|')}`)
91
+ .option('--preserve-unique-traits <text>', 'Caracteristicas unicas a preservar ou transformar')
92
+ .option('--backend-contracts <mode>', `Contratos backend observados: ${REVERSA_BACKEND_CONTRACT_MODES.join('|')}`)
93
+ .option('--backend-redaction-policy <policy>', 'Politica/arquivo de redacao para inventario de contratos backend')
94
+ .option('--brand-transform <text>', 'Instrucoes de transformacao de marca para derivacao autorizada')
95
+ .option('--intake <file>', 'Arquivo de intake guiado para execucao nao interativa')
96
+ .option('--intake-schema-validated', 'Confirma que o arquivo de intake foi validado por schema')
97
+ .option('--ack-frontend-only', 'Reconhece que a saida Reversa URL e somente frontend renderizado')
98
+ .option('--json', 'Saida em JSON')
99
+ .action((command, target, options) => {
100
+ const plan = buildReversaCommandPlan({
101
+ command,
102
+ mode: options?.mode,
103
+ executionMode: options?.executionMode,
104
+ target,
105
+ featureRef: options?.feature,
106
+ sourcePath: options?.source,
107
+ approvals: parseCsvOption(options?.approval),
108
+ urlMode: options?.urlMode,
109
+ acceptLegalTerms: options?.acceptLegalTerms,
110
+ authorizationScope: options?.authorizationScope,
111
+ authorizationNote: options?.authorizationNote,
112
+ volumePreset: options?.volumePreset,
113
+ volumeBudgetPath: options?.volumeBudget,
114
+ volumeBudgetApproved: options?.approveVolumeBudget,
115
+ targetStack: options?.targetStack,
116
+ preserveBrand: options?.preserveBrand,
117
+ preserveLogo: options?.preserveLogo,
118
+ preserveContent: options?.preserveContent,
119
+ preserveAssets: options?.preserveAssets,
120
+ preserveUniqueTraits: options?.preserveUniqueTraits,
121
+ backendContracts: options?.backendContracts,
122
+ backendRedactionPolicy: options?.backendRedactionPolicy,
123
+ brandTransform: options?.brandTransform,
124
+ intakePath: options?.intake,
125
+ intakeSchemaValidated: options?.intakeSchemaValidated,
126
+ acknowledgeFrontendOnly: options?.ackFrontendOnly,
127
+ });
128
+ if (options?.json) {
129
+ console.log(JSON.stringify(plan, null, 2));
130
+ }
131
+ else {
132
+ console.log(`Reversa command: ${plan.command}`);
133
+ console.log(`Mode: ${plan.mode}`);
134
+ console.log(`Status: ${plan.status}`);
135
+ console.log(`Evidence: ${plan.evidence_path}`);
136
+ console.log(`Supported commands: ${REVERSA_COMMANDS.join(', ')}`);
137
+ if (plan.url_policy) {
138
+ console.log(`URL mode: ${plan.url_policy.url_mode}`);
139
+ console.log(`Frontend-only: ${plan.url_policy.frontend_only_boundary ? 'yes' : 'no'}`);
140
+ console.log(`Backend copied: ${plan.url_policy.backend_implementation_copied ? 'yes' : 'no'}`);
141
+ console.log(`Volume preset: ${plan.url_policy.volume_preset}`);
142
+ if (plan.url_policy.required_questions.length > 0) {
143
+ console.log('Required guided questions:');
144
+ for (const question of plan.url_policy.required_questions) {
145
+ console.log(`- ${question}`);
146
+ }
147
+ }
148
+ }
149
+ if (plan.required_contracts.length > 0) {
150
+ console.log('Required contracts:');
151
+ for (const contract of plan.required_contracts) {
152
+ console.log(`- ${contract}`);
153
+ }
154
+ }
155
+ if (plan.warnings.length > 0) {
156
+ console.log('Warnings:');
157
+ for (const warning of plan.warnings) {
158
+ console.log(chalk.yellow(`- ${warning}`));
159
+ }
160
+ }
161
+ }
162
+ if (plan.status === 'blocked') {
163
+ process.exitCode = 2;
164
+ }
165
+ });
70
166
  sddCmd
71
167
  .command('init [path]')
72
168
  .description('Initializes the .sdd structure and base state files')
@@ -448,9 +544,28 @@ export function registerSddCommand(program) {
448
544
  }
449
545
  }
450
546
  if (report.summary.frontendEnabled) {
451
- console.log(`Gaps de frontend: ${report.summary.frontendGaps}`);
547
+ const frontendGapsSummary = report.summary.frontendGapsSummary ?? {
548
+ total: report.summary.frontendGaps,
549
+ open: report.summary.frontendGaps,
550
+ planned: 0,
551
+ in_progress: 0,
552
+ resolved: 0,
553
+ superseded: 0,
554
+ unresolved: report.summary.frontendGaps,
555
+ };
556
+ console.log(`Gaps de frontend abertos: ${frontendGapsSummary.open}`);
557
+ console.log(`Gaps de frontend em planejamento/execucao: ${frontendGapsSummary.planned + frontendGapsSummary.in_progress}`);
558
+ console.log(`Gaps de frontend resolvidos/historicos: ${frontendGapsSummary.resolved + frontendGapsSummary.superseded}`);
559
+ console.log(`Gaps de frontend total historico: ${frontendGapsSummary.total}`);
452
560
  console.log(`Rotas de frontend: ${report.summary.frontendRoutes}`);
453
561
  }
562
+ if (report.summary.lock_domain_health) {
563
+ console.log(`Lock domains compartilhados ativos: ${report.summary.lock_domain_health.active_conflicts}`);
564
+ if (report.summary.lock_domain_health.historical > 0 ||
565
+ report.summary.lock_domain_health.mixed_history > 0) {
566
+ console.log(`Lock domains compartilhados historicos/mistos: ${report.summary.lock_domain_health.historical + report.summary.lock_domain_health.mixed_history}`);
567
+ }
568
+ }
454
569
  if (report.warnings.length > 0) {
455
570
  console.log(chalk.yellow('\nAvisos:'));
456
571
  for (const warning of report.warnings) {
@@ -719,14 +834,14 @@ export function registerSddCommand(program) {
719
834
  });
720
835
  registerSkillsCommands(sddCmd);
721
836
  sddCmd
722
- .command('diagnose')
837
+ .command('diagnose [path]')
723
838
  .alias('diagnosticar')
724
839
  .description('Executa o motor de diagnostico estrutural')
725
840
  .option('--strict', 'Falha se houver inconsistencias criticas')
726
841
  .option('--json', 'Saida em formato JSON')
727
842
  .option('--output <path>', 'Caminho para salvar o relatorio JSON')
728
- .action(async (options) => {
729
- const root = resolveRoot();
843
+ .action(async (targetPath = '.', options) => {
844
+ const root = resolveRoot(targetPath);
730
845
  const command = new SddDiagnoseCommand();
731
846
  const result = await command.execute(root, {
732
847
  strict: options.strict,
@@ -1,5 +1,8 @@
1
1
  import type { Command } from 'commander';
2
2
  export type CliCoverageStrategy = 'contract' | 'spawned-e2e' | 'exception';
3
+ export type CliPublicCommandClass = 'canonical-lifecycle' | 'bootstrap-repair' | 'compatibility-workflow' | 'migration-tool' | 'diagnostics-governance' | 'experimental-internal';
4
+ export type CliCommandBoundary = 'codesdd-native' | 'compatibility-window' | 'migration-only' | 'internal-hidden';
5
+ export type CliLlmPolicy = 'teach-first' | 'advanced' | 'compatibility-only' | 'migration-only' | 'internal-only';
3
6
  export interface CliLeafCommand {
4
7
  commandPath: string;
5
8
  description: string;
@@ -11,13 +14,28 @@ export interface CliCommandMatrixEntry {
11
14
  strategy: CliCoverageStrategy;
12
15
  rationale: string;
13
16
  }
17
+ export interface CliCommandTaxonomyEntry {
18
+ commandPath: string;
19
+ publicClass: CliPublicCommandClass;
20
+ boundary: CliCommandBoundary;
21
+ llmPolicy: CliLlmPolicy;
22
+ rationale: string;
23
+ }
14
24
  export interface CliCommandMatrixValidationReport {
15
25
  leafCommands: CliLeafCommand[];
16
26
  duplicateEntries: string[];
17
27
  missingEntries: string[];
18
28
  extraEntries: string[];
19
29
  }
30
+ export interface CliCommandTaxonomyValidationReport {
31
+ leafCommands: CliLeafCommand[];
32
+ classifiedCommands: CliCommandTaxonomyEntry[];
33
+ missingTaxonomy: string[];
34
+ }
35
+ export declare const CLI_PUBLIC_COMMAND_CLASS_DESCRIPTIONS: Record<CliPublicCommandClass, string>;
20
36
  export declare function collectCliLeafCommands(command: Command, prefix?: string[]): CliLeafCommand[];
37
+ export declare function classifyCliCommandPath(commandPath: string): CliCommandTaxonomyEntry | undefined;
21
38
  export declare const CLI_COMMAND_MATRIX: ReadonlyArray<CliCommandMatrixEntry>;
22
39
  export declare function validateCliCommandMatrix(program: Command): CliCommandMatrixValidationReport;
40
+ export declare function validateCliCommandTaxonomy(program: Command): CliCommandTaxonomyValidationReport;
23
41
  //# sourceMappingURL=command-matrix.d.ts.map
@@ -1,4 +1,122 @@
1
1
  import { CLI_NAME } from '../branding.js';
2
+ export const CLI_PUBLIC_COMMAND_CLASS_DESCRIPTIONS = {
3
+ 'canonical-lifecycle': 'Preferred CodeSDD-native lifecycle commands for discovery, planning, execution, and closure.',
4
+ 'bootstrap-repair': 'Commands that create, refresh, or repair CodeSDD project or tool assets.',
5
+ 'compatibility-workflow': 'Legacy or noun-based workflow commands kept for migration and existing automation.',
6
+ 'migration-tool': 'Explicit import, migration, or upgrade commands for legacy or cross-version state.',
7
+ 'diagnostics-governance': 'Health, configuration, schema, policy, provider, catalog, and governance support commands.',
8
+ 'experimental-internal': 'Hidden, internal, or deprecated experimental surfaces that should not appear in first-run guidance.',
9
+ };
10
+ const CANONICAL_LIFECYCLE_RULE = {
11
+ publicClass: 'canonical-lifecycle',
12
+ boundary: 'codesdd-native',
13
+ llmPolicy: 'teach-first',
14
+ rationale: 'Canonical CodeSDD lifecycle surface backed by .sdd/state/*.yaml.',
15
+ };
16
+ const BOOTSTRAP_REPAIR_RULE = {
17
+ publicClass: 'bootstrap-repair',
18
+ boundary: 'codesdd-native',
19
+ llmPolicy: 'teach-first',
20
+ rationale: 'Creates or refreshes CodeSDD project state and generated tool assets.',
21
+ };
22
+ const COMPATIBILITY_WORKFLOW_RULE = {
23
+ publicClass: 'compatibility-workflow',
24
+ boundary: 'compatibility-window',
25
+ llmPolicy: 'compatibility-only',
26
+ rationale: 'Maintained for existing workflows and legacy automation; not the CodeSDD-native happy path.',
27
+ };
28
+ const MIGRATION_TOOL_RULE = {
29
+ publicClass: 'migration-tool',
30
+ boundary: 'migration-only',
31
+ llmPolicy: 'migration-only',
32
+ rationale: 'Explicitly moves or imports legacy state; never part of the default first-run flow.',
33
+ };
34
+ const DIAGNOSTICS_GOVERNANCE_RULE = {
35
+ publicClass: 'diagnostics-governance',
36
+ boundary: 'codesdd-native',
37
+ llmPolicy: 'advanced',
38
+ rationale: 'Supports health, configuration, schema, provider, catalog, policy, or governance diagnostics.',
39
+ };
40
+ const INTERNAL_RULE = {
41
+ publicClass: 'experimental-internal',
42
+ boundary: 'internal-hidden',
43
+ llmPolicy: 'internal-only',
44
+ rationale: 'Hidden or internal command surface; not documented as user onboarding guidance.',
45
+ };
46
+ const EXACT_COMMAND_TAXONOMY = new Map([
47
+ ['init', BOOTSTRAP_REPAIR_RULE],
48
+ ['reload', BOOTSTRAP_REPAIR_RULE],
49
+ ['install', BOOTSTRAP_REPAIR_RULE],
50
+ ['update', BOOTSTRAP_REPAIR_RULE],
51
+ ['sdd:init', BOOTSTRAP_REPAIR_RULE],
52
+ ['sdd:init-context', BOOTSTRAP_REPAIR_RULE],
53
+ ['sdd:insight', CANONICAL_LIFECYCLE_RULE],
54
+ ['sdd:ingest-deposito', CANONICAL_LIFECYCLE_RULE],
55
+ ['sdd:debate', CANONICAL_LIFECYCLE_RULE],
56
+ ['sdd:decide', CANONICAL_LIFECYCLE_RULE],
57
+ ['sdd:breakdown', CANONICAL_LIFECYCLE_RULE],
58
+ ['sdd:start', CANONICAL_LIFECYCLE_RULE],
59
+ ['sdd:frontend-impact', CANONICAL_LIFECYCLE_RULE],
60
+ ['sdd:finalize', CANONICAL_LIFECYCLE_RULE],
61
+ ['sdd:context', CANONICAL_LIFECYCLE_RULE],
62
+ ['sdd:onboard', CANONICAL_LIFECYCLE_RULE],
63
+ ['sdd:aprovar', CANONICAL_LIFECYCLE_RULE],
64
+ ['sdd:next', CANONICAL_LIFECYCLE_RULE],
65
+ ['sdd:plan-status', CANONICAL_LIFECYCLE_RULE],
66
+ ['sdd:execute-next', CANONICAL_LIFECYCLE_RULE],
67
+ ['sdd:check', CANONICAL_LIFECYCLE_RULE],
68
+ ['sdd:diagnose', CANONICAL_LIFECYCLE_RULE],
69
+ ['sdd:reversa', CANONICAL_LIFECYCLE_RULE],
70
+ ['list', COMPATIBILITY_WORKFLOW_RULE],
71
+ ['view', COMPATIBILITY_WORKFLOW_RULE],
72
+ ['change:show', COMPATIBILITY_WORKFLOW_RULE],
73
+ ['change:list', COMPATIBILITY_WORKFLOW_RULE],
74
+ ['change:validate', COMPATIBILITY_WORKFLOW_RULE],
75
+ ['archive', COMPATIBILITY_WORKFLOW_RULE],
76
+ ['spec:show', COMPATIBILITY_WORKFLOW_RULE],
77
+ ['spec:list', COMPATIBILITY_WORKFLOW_RULE],
78
+ ['spec:validate', COMPATIBILITY_WORKFLOW_RULE],
79
+ ['validate', COMPATIBILITY_WORKFLOW_RULE],
80
+ ['show', COMPATIBILITY_WORKFLOW_RULE],
81
+ ['status', COMPATIBILITY_WORKFLOW_RULE],
82
+ ['instructions', COMPATIBILITY_WORKFLOW_RULE],
83
+ ['templates', COMPATIBILITY_WORKFLOW_RULE],
84
+ ['schemas', COMPATIBILITY_WORKFLOW_RULE],
85
+ ['new:change', COMPATIBILITY_WORKFLOW_RULE],
86
+ ['sdd:migrate', MIGRATION_TOOL_RULE],
87
+ ['sdd:upgrade-to-codesdd', MIGRATION_TOOL_RULE],
88
+ ['sdd:migrate-workspace', MIGRATION_TOOL_RULE],
89
+ ['sdd:import-legacy-spec', MIGRATION_TOOL_RULE],
90
+ ['experimental', INTERNAL_RULE],
91
+ ['__complete', INTERNAL_RULE],
92
+ ]);
93
+ const PREFIX_COMMAND_TAXONOMY = [
94
+ { prefix: 'config:', rule: DIAGNOSTICS_GOVERNANCE_RULE },
95
+ { prefix: 'schema:', rule: DIAGNOSTICS_GOVERNANCE_RULE },
96
+ { prefix: 'completion:', rule: DIAGNOSTICS_GOVERNANCE_RULE },
97
+ { prefix: 'sdd:plugin:', rule: DIAGNOSTICS_GOVERNANCE_RULE },
98
+ { prefix: 'sdd:backlog:', rule: DIAGNOSTICS_GOVERNANCE_RULE },
99
+ { prefix: 'sdd:skills:', rule: DIAGNOSTICS_GOVERNANCE_RULE },
100
+ { prefix: 'sdd:sanitize:', rule: DIAGNOSTICS_GOVERNANCE_RULE },
101
+ { prefix: 'sdd:fgap:', rule: DIAGNOSTICS_GOVERNANCE_RULE },
102
+ { prefix: 'sdd:lint:', rule: DIAGNOSTICS_GOVERNANCE_RULE },
103
+ ];
104
+ const EXACT_DIAGNOSTICS_GOVERNANCE_COMMANDS = new Set([
105
+ 'feedback',
106
+ 'sdd:intent-guard',
107
+ 'sdd:fingerprint',
108
+ 'sdd:historical-quality-regression',
109
+ 'sdd:mcp-manifest',
110
+ 'sdd:mcp-call',
111
+ 'sdd:preflight',
112
+ 'sdd:agent:run',
113
+ 'sdd:release-readiness',
114
+ 'sdd:rebuild',
115
+ 'sdd:metrics',
116
+ 'sdd:dedup',
117
+ 'sdd:audit',
118
+ 'sdd:scan-naming',
119
+ ]);
2
120
  function commandSegments(command, prefix = []) {
3
121
  const name = command.name();
4
122
  if (!name || name === CLI_NAME) {
@@ -21,6 +139,19 @@ export function collectCliLeafCommands(command, prefix = []) {
21
139
  }
22
140
  return children.flatMap((child) => collectCliLeafCommands(child, segments));
23
141
  }
142
+ export function classifyCliCommandPath(commandPath) {
143
+ const exactRule = EXACT_COMMAND_TAXONOMY.get(commandPath);
144
+ const rule = exactRule ??
145
+ PREFIX_COMMAND_TAXONOMY.find((entry) => commandPath.startsWith(entry.prefix))?.rule ??
146
+ (EXACT_DIAGNOSTICS_GOVERNANCE_COMMANDS.has(commandPath) ? DIAGNOSTICS_GOVERNANCE_RULE : undefined);
147
+ if (!rule) {
148
+ return undefined;
149
+ }
150
+ return {
151
+ commandPath,
152
+ ...rule,
153
+ };
154
+ }
24
155
  export const CLI_COMMAND_MATRIX = [
25
156
  { commandPath: 'init', strategy: 'contract', rationale: 'Project bootstrap is deterministic and already decomposes into testable setup services.' },
26
157
  { commandPath: 'reload', strategy: 'spawned-e2e', rationale: 'Reload reapplies base setup plus SDD bootstrap with the installed CLI version and needs real-bin smoke coverage.' },
@@ -78,6 +209,8 @@ export const CLI_COMMAND_MATRIX = [
78
209
  { commandPath: 'sdd:plan-status', strategy: 'contract', rationale: 'Plan status aggregates active and ready work without mutating state.' },
79
210
  { commandPath: 'sdd:execute-next', strategy: 'spawned-e2e', rationale: 'Execute next bridges ranking into start and must preserve lifecycle guardrails.' },
80
211
  { commandPath: 'sdd:audit', strategy: 'contract', rationale: 'Audit is a deterministic report over canonical state.' },
212
+ { commandPath: 'sdd:historical-quality-regression', strategy: 'contract', rationale: 'Historical quality regression scanning is deterministic over archived quality artifacts and bounded window options.' },
213
+ { commandPath: 'sdd:reversa', strategy: 'contract', rationale: 'Reversa command planning, including the governed URL preflight surface, is deterministic, fail-closed, frontend-only by default, and has no direct extraction or state writes.' },
81
214
  { commandPath: 'sdd:plugin:inspect', strategy: 'contract', rationale: 'Plugin inspect is a read-only manifest parser surface.' },
82
215
  { commandPath: 'sdd:plugin:plan', strategy: 'contract', rationale: 'Plugin plan builds a non-executing runtime envelope from a manifest fixture.' },
83
216
  { commandPath: 'sdd:plugin:devtrack-api:scaffold-dry-run', strategy: 'contract', rationale: 'DevTrack API scaffold dry-run plans appliance artifacts without executing a generator.' },
@@ -138,4 +271,19 @@ export function validateCliCommandMatrix(program) {
138
271
  extraEntries,
139
272
  };
140
273
  }
274
+ export function validateCliCommandTaxonomy(program) {
275
+ const leafCommands = collectCliLeafCommands(program).sort((left, right) => left.commandPath.localeCompare(right.commandPath));
276
+ const classifiedCommands = leafCommands
277
+ .map((entry) => classifyCliCommandPath(entry.commandPath))
278
+ .filter((entry) => entry !== undefined);
279
+ const classifiedPaths = new Set(classifiedCommands.map((entry) => entry.commandPath));
280
+ const missingTaxonomy = leafCommands
281
+ .map((entry) => entry.commandPath)
282
+ .filter((commandPath) => !classifiedPaths.has(commandPath));
283
+ return {
284
+ leafCommands,
285
+ classifiedCommands,
286
+ missingTaxonomy,
287
+ };
288
+ }
141
289
  //# sourceMappingURL=command-matrix.js.map
@@ -101,6 +101,7 @@ export const CLI_COMMAND_QUALITY_MATRIX = [
101
101
  'sdd check',
102
102
  'sdd diagnose',
103
103
  'sdd agent run',
104
+ 'sdd historical-quality-regression',
104
105
  'sdd fgap add',
105
106
  'sdd fgap done',
106
107
  'sdd fingerprint',
@@ -115,6 +116,7 @@ export const CLI_COMMAND_QUALITY_MATRIX = [
115
116
  'sdd plan-status',
116
117
  'sdd preflight',
117
118
  'sdd release-readiness',
119
+ 'sdd reversa',
118
120
  'sdd intent-guard',
119
121
  'sdd backlog project',
120
122
  'sdd plugin devtrack-api scaffold-dry-run',
@@ -25,13 +25,26 @@ export declare const GlobalConfigSchema: z.ZodObject<{
25
25
  command_timeout_ms: z.ZodOptional<z.ZodNumber>;
26
26
  max_retries: z.ZodOptional<z.ZodNumber>;
27
27
  fallback: z.ZodOptional<z.ZodEnum<{
28
- filesystem: "filesystem";
29
28
  none: "none";
29
+ filesystem: "filesystem";
30
30
  }>>;
31
31
  cache_default_ttl_ms: z.ZodOptional<z.ZodNumber>;
32
32
  lock_ttl_ms: z.ZodOptional<z.ZodNumber>;
33
33
  stream_max_len: z.ZodOptional<z.ZodNumber>;
34
34
  }, z.core.$strip>>;
35
+ enterprise: z.ZodOptional<z.ZodObject<{
36
+ provisioning: z.ZodOptional<z.ZodObject<{
37
+ mode: z.ZodOptional<z.ZodEnum<{
38
+ local: "local";
39
+ enterprise: "enterprise";
40
+ }>>;
41
+ project_id: z.ZodOptional<z.ZodString>;
42
+ authority_url: z.ZodOptional<z.ZodString>;
43
+ authority_url_env: z.ZodOptional<z.ZodString>;
44
+ tenant_id: z.ZodOptional<z.ZodString>;
45
+ required_for_numbered_artifacts: z.ZodOptional<z.ZodBoolean>;
46
+ }, z.core.$strip>>;
47
+ }, z.core.$strip>>;
35
48
  }, z.core.$loose>;
36
49
  export type GlobalConfigType = z.infer<typeof GlobalConfigSchema>;
37
50
  /**
@@ -36,6 +36,20 @@ export const GlobalConfigSchema = z
36
36
  stream_max_len: z.number().int().positive().optional(),
37
37
  })
38
38
  .optional(),
39
+ enterprise: z
40
+ .object({
41
+ provisioning: z
42
+ .object({
43
+ mode: z.enum(['local', 'enterprise']).optional(),
44
+ project_id: z.string().min(1).optional(),
45
+ authority_url: z.string().min(1).optional(),
46
+ authority_url_env: z.string().min(1).optional(),
47
+ tenant_id: z.string().min(1).optional(),
48
+ required_for_numbered_artifacts: z.boolean().optional(),
49
+ })
50
+ .optional(),
51
+ })
52
+ .optional(),
39
53
  })
40
54
  .passthrough();
41
55
  /**
@@ -46,7 +60,7 @@ export const DEFAULT_CONFIG = {
46
60
  profile: 'core',
47
61
  delivery: 'both',
48
62
  };
49
- const KNOWN_TOP_LEVEL_KEYS = new Set([...Object.keys(DEFAULT_CONFIG), 'workflows', 'redis']);
63
+ const KNOWN_TOP_LEVEL_KEYS = new Set([...Object.keys(DEFAULT_CONFIG), 'workflows', 'redis', 'enterprise']);
50
64
  const SENSITIVE_KEY_TOKENS = ['key', 'secret', 'token', 'password', 'credential', 'private', 'auth'];
51
65
  /**
52
66
  * Validate a config key path for CLI set operations.
@@ -90,6 +104,23 @@ export function validateConfigKeyPath(path) {
90
104
  }
91
105
  return { valid: true };
92
106
  }
107
+ if (rootKey === 'enterprise') {
108
+ if (rawKeys.length !== 3 || rawKeys[1] !== 'provisioning') {
109
+ return { valid: false, reason: 'enterprise settings use enterprise.provisioning.<key>' };
110
+ }
111
+ const provisioningKeys = new Set([
112
+ 'mode',
113
+ 'project_id',
114
+ 'authority_url',
115
+ 'authority_url_env',
116
+ 'tenant_id',
117
+ 'required_for_numbered_artifacts',
118
+ ]);
119
+ if (!provisioningKeys.has(rawKeys[2])) {
120
+ return { valid: false, reason: `Unknown enterprise provisioning key "${rawKeys[2]}"` };
121
+ }
122
+ return { valid: true };
123
+ }
93
124
  if (rawKeys.length > 1) {
94
125
  return { valid: false, reason: `"${rootKey}" does not support nested keys` };
95
126
  }
@@ -13,5 +13,6 @@ export interface AIToolOption {
13
13
  successLabel?: string;
14
14
  skillsDir?: string;
15
15
  }
16
+ export declare function getToolInstallGuidance(toolIds: readonly string[]): string[];
16
17
  export declare const AI_TOOLS: AIToolOption[];
17
18
  //# sourceMappingURL=config.d.ts.map
@@ -3,6 +3,17 @@ export const CODESDD_MARKERS = {
3
3
  start: '<!-- CODESDD:START -->',
4
4
  end: '<!-- CODESDD:END -->'
5
5
  };
6
+ export function getToolInstallGuidance(toolIds) {
7
+ const normalized = new Set(toolIds.map((toolId) => toolId.toLowerCase()));
8
+ const notes = [];
9
+ if (normalized.size > 0) {
10
+ notes.push('Tool scope: generated assistant skills/prompts only; canonical project state stays in .sdd/.');
11
+ }
12
+ if (normalized.has('opencode')) {
13
+ notes.push('OpenCode tool id: use --tools opencode for generated assistant assets; use --provider open-code only for SDD MCP bridge commands.');
14
+ }
15
+ return notes;
16
+ }
6
17
  export const AI_TOOLS = [
7
18
  { name: 'Amazon Q Developer', value: 'amazon-q', available: true, successLabel: 'Amazon Q Developer', skillsDir: '.amazonq' },
8
19
  { name: 'Antigravity', value: 'antigravity', available: true, successLabel: 'Antigravity', skillsDir: '.agent' },
@@ -22,12 +22,25 @@ export interface RedisGlobalConfig {
22
22
  lock_ttl_ms?: number;
23
23
  stream_max_len?: number;
24
24
  }
25
+ export type EnterpriseProvisioningMode = 'local' | 'enterprise';
26
+ export interface EnterpriseProvisioningGlobalConfig {
27
+ mode?: EnterpriseProvisioningMode;
28
+ project_id?: string;
29
+ authority_url?: string;
30
+ authority_url_env?: string;
31
+ tenant_id?: string;
32
+ required_for_numbered_artifacts?: boolean;
33
+ }
34
+ export interface EnterpriseGlobalConfig {
35
+ provisioning?: EnterpriseProvisioningGlobalConfig;
36
+ }
25
37
  export interface GlobalConfig {
26
38
  featureFlags?: Record<string, boolean>;
27
39
  profile?: Profile;
28
40
  delivery?: Delivery;
29
41
  workflows?: string[];
30
42
  redis?: RedisGlobalConfig;
43
+ enterprise?: EnterpriseGlobalConfig;
31
44
  }
32
45
  export declare function parseTomlContent(content: string): Record<string, unknown>;
33
46
  export declare function stringifyTomlContent(value: Record<string, unknown>): string;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Init Command
3
3
  *
4
- * Sets up CodeSDD with Agent Skills and /opsx:* slash commands.
5
- * This is the unified setup command that replaces both the old init and experimental commands.
4
+ * Sets up CodeSDD agent skills and compatibility slash commands.
5
+ * The canonical project lifecycle lives under .sdd and codesdd sdd commands.
6
6
  */
7
7
  type InitCommandOptions = {
8
8
  tools?: string;