@devtrack-solution/codesdd 1.2.3 → 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.
- package/.sdd/skills/curated/devtrack-api/SKILL.md +98 -12
- package/.sdd/skills/curated/devtrack-api/agents/claude-code.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/codex.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/cursor.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/gemini.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/kimi.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/openai.yaml +5 -3
- package/.sdd/skills/curated/devtrack-api/agents/opencode.yaml +12 -0
- package/.sdd/skills/curated/devtrack-api/references/application-presentation.md +61 -5
- package/.sdd/skills/curated/devtrack-api/references/consumer-sync-policy.md +15 -3
- package/.sdd/skills/curated/devtrack-api/references/contract-pack.yaml +1951 -0
- package/.sdd/skills/curated/devtrack-api/references/domain-modeling.md +16 -14
- package/.sdd/skills/curated/devtrack-api/references/field-validation-protocol.md +40 -0
- package/.sdd/skills/curated/devtrack-api/references/foundation-layout.md +19 -2
- package/.sdd/skills/curated/devtrack-api/references/generated-artifact-invalidation.md +97 -0
- package/.sdd/skills/curated/devtrack-api/references/implementation-checklist.md +30 -1
- package/.sdd/skills/curated/devtrack-api/references/portable-agent-contract.md +42 -0
- package/.sdd/skills/curated/devtrack-api/references/testing-validation.md +22 -1
- package/.sdd/skills/curated/devtrack-api/references/typeorm-infrastructure.md +9 -7
- package/README.md +280 -29
- package/dist/applications/sdd/index.d.ts +16 -0
- package/dist/applications/sdd/index.js +16 -0
- package/dist/cli/program.js +180 -11
- package/dist/commands/config.js +197 -10
- package/dist/commands/sdd/execution.js +408 -16
- package/dist/commands/sdd/plugin.js +5 -0
- package/dist/commands/sdd/shared.d.ts +1 -0
- package/dist/commands/sdd/shared.js +10 -0
- package/dist/commands/sdd.js +157 -7
- package/dist/core/cli/command-matrix.d.ts +18 -0
- package/dist/core/cli/command-matrix.js +157 -0
- package/dist/core/cli-command-quality.js +11 -0
- package/dist/core/completions/command-registry.js +45 -0
- package/dist/core/config-schema.d.ts +31 -1
- package/dist/core/config-schema.js +79 -5
- package/dist/core/config.d.ts +1 -0
- package/dist/core/config.js +11 -0
- package/dist/core/global-config.d.ts +29 -0
- package/dist/core/init.d.ts +2 -2
- package/dist/core/init.js +13 -14
- package/dist/core/sdd/agent-binding.d.ts +19 -19
- package/dist/core/sdd/agent-runtime-contract.d.ts +204 -0
- package/dist/core/sdd/agent-runtime-contract.js +200 -0
- package/dist/core/sdd/allocator-recovery.d.ts +14 -0
- package/dist/core/sdd/allocator-recovery.js +30 -0
- package/dist/core/sdd/allocator-security.d.ts +18 -0
- package/dist/core/sdd/allocator-security.js +36 -0
- package/dist/core/sdd/api-foundation-baseline.d.ts +111 -0
- package/dist/core/sdd/api-foundation-baseline.js +151 -0
- package/dist/core/sdd/api-foundation-parity.d.ts +114 -0
- package/dist/core/sdd/api-foundation-parity.js +131 -0
- package/dist/core/sdd/api-profile-catalog.d.ts +36 -0
- package/dist/core/sdd/api-profile-catalog.js +132 -0
- package/dist/core/sdd/api-profile-dry-run-projection.d.ts +93 -0
- package/dist/core/sdd/api-profile-dry-run-projection.js +370 -0
- package/dist/core/sdd/api-profile-recipes.d.ts +82 -0
- package/dist/core/sdd/api-profile-recipes.js +484 -0
- package/dist/core/sdd/artifact-id-allocator.d.ts +368 -0
- package/dist/core/sdd/artifact-id-allocator.js +510 -0
- package/dist/core/sdd/check.d.ts +52 -1
- package/dist/core/sdd/check.js +326 -11
- package/dist/core/sdd/coordination/coordination-adapters.d.ts +15 -8
- package/dist/core/sdd/coordination/coordination-adapters.js +43 -15
- package/dist/core/sdd/coordination/index.d.ts +1 -0
- package/dist/core/sdd/coordination/index.js +1 -0
- package/dist/core/sdd/coordination/redis-runtime.d.ts +131 -0
- package/dist/core/sdd/coordination/redis-runtime.js +698 -0
- package/dist/core/sdd/deepagent-contracts.d.ts +99 -5
- package/dist/core/sdd/deepagent-contracts.js +62 -0
- package/dist/core/sdd/deepagents/reversa-subagents.d.ts +3 -3
- package/dist/core/sdd/default-bootstrap-files.d.ts +2 -2
- package/dist/core/sdd/default-bootstrap-files.js +14 -10
- package/dist/core/sdd/default-skills.js +115 -9
- package/dist/core/sdd/devtrack-api-appliance.d.ts +42 -1
- package/dist/core/sdd/devtrack-api-appliance.js +159 -32
- package/dist/core/sdd/devtrack-api-architecture.d.ts +16 -0
- package/dist/core/sdd/devtrack-api-architecture.js +86 -0
- package/dist/core/sdd/docs-sync.js +24 -18
- package/dist/core/sdd/domain/capability-diff.d.ts +63 -0
- package/dist/core/sdd/domain/capability-diff.js +200 -0
- package/dist/core/sdd/domain/change-safety-guardrails.d.ts +74 -0
- package/dist/core/sdd/domain/change-safety-guardrails.js +333 -0
- package/dist/core/sdd/domain/semantic-intent-classifier.d.ts +29 -0
- package/dist/core/sdd/domain/semantic-intent-classifier.js +117 -0
- package/dist/core/sdd/enterprise-mutating-command-gate.d.ts +27 -0
- package/dist/core/sdd/enterprise-mutating-command-gate.js +104 -0
- package/dist/core/sdd/enterprise-provenance-gates.d.ts +20 -0
- package/dist/core/sdd/enterprise-provenance-gates.js +63 -0
- package/dist/core/sdd/enterprise-provisioning-policy.d.ts +26 -0
- package/dist/core/sdd/enterprise-provisioning-policy.js +104 -0
- package/dist/core/sdd/foundation-artifact-map-validator.d.ts +16 -0
- package/dist/core/sdd/foundation-artifact-map-validator.js +71 -0
- package/dist/core/sdd/foundation-layer-manifest.d.ts +24 -0
- package/dist/core/sdd/foundation-layer-manifest.js +117 -0
- package/dist/core/sdd/governance-schemas.d.ts +2 -2
- package/dist/core/sdd/governance-schemas.js +11 -2
- package/dist/core/sdd/intent-guard.d.ts +22 -0
- package/dist/core/sdd/intent-guard.js +67 -0
- package/dist/core/sdd/json-schema.js +13 -1
- package/dist/core/sdd/legacy-operations.js +169 -5
- package/dist/core/sdd/migrate-workspace.js +39 -0
- package/dist/core/sdd/package-security-gates.d.ts +21 -0
- package/dist/core/sdd/package-security-gates.js +121 -0
- package/dist/core/sdd/package-structure-gate.d.ts +85 -3
- package/dist/core/sdd/package-structure-gate.js +384 -11
- package/dist/core/sdd/parallel-feat-automation.d.ts +185 -7
- package/dist/core/sdd/parallel-feat-automation.js +212 -0
- package/dist/core/sdd/plugin-broker.d.ts +223 -4
- package/dist/core/sdd/plugin-broker.js +10 -0
- package/dist/core/sdd/plugin-cli.d.ts +30 -0
- package/dist/core/sdd/plugin-cli.js +70 -3
- package/dist/core/sdd/plugin-evidence.d.ts +73 -0
- package/dist/core/sdd/plugin-manifest.d.ts +69 -1
- package/dist/core/sdd/plugin-manifest.js +10 -0
- package/dist/core/sdd/plugin-policy-pack.d.ts +1 -1
- package/dist/core/sdd/plugin-policy.js +6 -1
- package/dist/core/sdd/plugin-registry.d.ts +138 -2
- package/dist/core/sdd/plugin-sdk-contract.d.ts +363 -0
- package/dist/core/sdd/plugin-sdk-contract.js +268 -0
- package/dist/core/sdd/plugin-skill-binding.d.ts +1 -1
- package/dist/core/sdd/quality-validation.d.ts +89 -16
- package/dist/core/sdd/release-readiness.d.ts +68 -0
- package/dist/core/sdd/release-readiness.js +767 -0
- package/dist/core/sdd/reversa-architecture-extractor.d.ts +13 -0
- package/dist/core/sdd/reversa-architecture-extractor.js +89 -0
- package/dist/core/sdd/reversa-artifact-writer.d.ts +18 -0
- package/dist/core/sdd/reversa-artifact-writer.js +40 -0
- package/dist/core/sdd/reversa-command-policy.d.ts +136 -0
- package/dist/core/sdd/reversa-command-policy.js +361 -0
- package/dist/core/sdd/reversa-data-extractor.d.ts +11 -0
- package/dist/core/sdd/reversa-data-extractor.js +73 -0
- package/dist/core/sdd/reversa-equivalence.d.ts +20 -0
- package/dist/core/sdd/reversa-equivalence.js +34 -0
- package/dist/core/sdd/reversa-evidence.d.ts +298 -0
- package/dist/core/sdd/reversa-evidence.js +118 -0
- package/dist/core/sdd/reversa-reconstruction.d.ts +29 -0
- package/dist/core/sdd/reversa-reconstruction.js +32 -0
- package/dist/core/sdd/reversa-rules-extractor.d.ts +12 -0
- package/dist/core/sdd/reversa-rules-extractor.js +86 -0
- package/dist/core/sdd/reversa-source-safety.d.ts +19 -0
- package/dist/core/sdd/reversa-source-safety.js +105 -0
- package/dist/core/sdd/reversa-surface-scout.d.ts +13 -0
- package/dist/core/sdd/reversa-surface-scout.js +85 -0
- package/dist/core/sdd/reversa-ux-mapper.d.ts +11 -0
- package/dist/core/sdd/reversa-ux-mapper.js +73 -0
- package/dist/core/sdd/runtime-boundary-contract.d.ts +45 -0
- package/dist/core/sdd/runtime-boundary-contract.js +90 -0
- package/dist/core/sdd/sdk-agent-plugin-quality-gates.d.ts +150 -0
- package/dist/core/sdd/sdk-agent-plugin-quality-gates.js +258 -0
- package/dist/core/sdd/services/agent-run.service.d.ts +38 -6
- package/dist/core/sdd/services/agent-run.service.js +73 -1
- package/dist/core/sdd/services/archive-quality-coherence.service.d.ts +17 -0
- package/dist/core/sdd/services/archive-quality-coherence.service.js +141 -0
- package/dist/core/sdd/services/capability-diff.service.d.ts +18 -0
- package/dist/core/sdd/services/capability-diff.service.js +26 -0
- package/dist/core/sdd/services/change-safety-preflight.service.d.ts +17 -0
- package/dist/core/sdd/services/change-safety-preflight.service.js +17 -0
- package/dist/core/sdd/services/context.service.d.ts +43 -340
- package/dist/core/sdd/services/context.service.js +323 -9
- package/dist/core/sdd/services/decide.service.js +1 -1
- package/dist/core/sdd/services/finalize.service.d.ts +27 -0
- package/dist/core/sdd/services/finalize.service.js +226 -18
- package/dist/core/sdd/services/frontend-impact.service.d.ts +1 -1
- package/dist/core/sdd/services/historical-quality-regression.service.d.ts +35 -0
- package/dist/core/sdd/services/historical-quality-regression.service.js +228 -0
- package/dist/core/sdd/services/ingest-deposito.service.js +1 -1
- package/dist/core/sdd/services/planning-execution-coherence.service.d.ts +45 -0
- package/dist/core/sdd/services/planning-execution-coherence.service.js +225 -0
- package/dist/core/sdd/services/semantic-intent-classifier.service.d.ts +6 -0
- package/dist/core/sdd/services/semantic-intent-classifier.service.js +7 -0
- package/dist/core/sdd/state.d.ts +1 -0
- package/dist/core/sdd/state.js +266 -34
- package/dist/core/sdd/store/sdd-stores.js +2 -2
- package/dist/core/sdd/structural-health.d.ts +13 -13
- package/dist/core/sdd/types.d.ts +30 -15
- package/dist/core/sdd/types.js +4 -0
- package/dist/core/sdd/views.js +17 -0
- package/dist/core/sdd/workspace-schemas.d.ts +428 -7
- package/dist/core/sdd/workspace-schemas.js +223 -70
- package/dist/core/shared/skill-generation.d.ts +2 -0
- package/dist/core/shared/skill-generation.js +19 -2
- package/dist/core/shared/tool-detection.d.ts +19 -0
- package/dist/core/shared/tool-detection.js +89 -0
- package/dist/domains/sdd/index.d.ts +6 -0
- package/dist/domains/sdd/index.js +6 -0
- package/dist/infrastructures/sdd/index.d.ts +7 -0
- package/dist/infrastructures/sdd/index.js +6 -0
- package/dist/presentations/cli/sdd/index.d.ts +3 -0
- package/dist/presentations/cli/sdd/index.js +3 -0
- package/dist/shared/sdd/index.d.ts +3 -0
- package/dist/shared/sdd/index.js +2 -0
- package/package.json +14 -10
- package/schemas/sdd/2-plan.schema.json +207 -2
- package/schemas/sdd/5-quality.schema.json +324 -25
- package/schemas/sdd/agent-runtime-command-plan.schema.json +212 -0
- package/schemas/sdd/agent-runtime-opencode-run-evidence.schema.json +270 -0
- package/schemas/sdd/codesdd-plugin.schema.json +171 -0
- package/schemas/sdd/deepagent-run-request.schema.json +316 -0
- package/schemas/sdd/parallel-feat-automation-plan.schema.json +89 -0
- package/schemas/sdd/parallel-feat-scheduler-request.schema.json +116 -0
- package/schemas/sdd/parallel-feat-scheduler-result.schema.json +404 -0
- package/schemas/sdd/plugin-artifact-manifest.schema.json +109 -0
- package/schemas/sdd/plugin-artifact-map.schema.json +223 -0
- package/schemas/sdd/plugin-evidence-manifest.schema.json +109 -0
- package/schemas/sdd/plugin-language-runtime.schema.json +103 -0
- package/schemas/sdd/plugin-package-governance.schema.json +74 -0
- package/schemas/sdd/plugin-registry.schema.json +171 -0
- package/schemas/sdd/plugin-runtime-invocation-plan.schema.json +109 -0
- package/schemas/sdd/quality-evidence-bundle.schema.json +109 -0
- package/schemas/sdd/reversa-evidence-bundle.schema.json +466 -0
- package/schemas/sdd/sdk-agent-plugin-quality-gate-input.schema.json +168 -0
- package/schemas/sdd/sdk-agent-plugin-quality-gate-report.schema.json +160 -0
- package/schemas/sdd/workspace-catalog.schema.json +5298 -1409
|
@@ -1,27 +1,168 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { loadProjectSddConfig, resolveSddPaths } from '../../core/sdd/state.js';
|
|
2
|
+
import { loadProjectSddConfig, loadStateSnapshot, resolveSddPaths } from '../../core/sdd/state.js';
|
|
3
3
|
import { createSddStores } from '../../core/sdd/store/sdd-stores.js';
|
|
4
4
|
import { StartService } from '../../core/sdd/services/start.service.js';
|
|
5
5
|
import { FrontendImpactService } from '../../core/sdd/services/frontend-impact.service.js';
|
|
6
6
|
import { FinalizeService } from '../../core/sdd/services/finalize.service.js';
|
|
7
|
-
import { ContextService } from '../../core/sdd/services/context.service.js';
|
|
7
|
+
import { ContextService, CONTEXT_PACK_BUDGET_MODES } from '../../core/sdd/services/context.service.js';
|
|
8
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
|
-
import { DeepAgentsRunService } from '../../core/sdd/services/agent-run.service.js';
|
|
15
|
+
import { DeepAgentsRunService, } from '../../core/sdd/services/agent-run.service.js';
|
|
16
|
+
import { evaluateReleaseReadiness, formatReleaseReadinessReport } from '../../core/sdd/release-readiness.js';
|
|
14
17
|
import { ensureMandatorySddMigration, parseCsvOption, parseFlowModeOption, resolveRoot } from './shared.js';
|
|
15
|
-
|
|
18
|
+
const PREFLIGHT_MUTATING_PLUGIN_FLOW = [
|
|
19
|
+
'plugin-inspect',
|
|
20
|
+
'plugin-plan',
|
|
21
|
+
'plugin-dry-run',
|
|
22
|
+
'policy-evaluation',
|
|
23
|
+
'artifact-manifest',
|
|
24
|
+
'evidence-manifest',
|
|
25
|
+
'validation-manifest',
|
|
26
|
+
'rollback-manifest',
|
|
27
|
+
];
|
|
28
|
+
function parseJsonObjectOption(value, optionName = '--input') {
|
|
16
29
|
if (!value)
|
|
17
30
|
return {};
|
|
18
31
|
const parsed = JSON.parse(value);
|
|
19
32
|
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
20
|
-
throw new Error(
|
|
33
|
+
throw new Error(`${optionName} must be a JSON object.`);
|
|
21
34
|
}
|
|
22
35
|
return parsed;
|
|
23
36
|
}
|
|
37
|
+
function parseGovernedOverrideOption(value) {
|
|
38
|
+
if (!value)
|
|
39
|
+
return undefined;
|
|
40
|
+
return parseJsonObjectOption(value, '--governed-override');
|
|
41
|
+
}
|
|
42
|
+
function buildChangeSafetyFromOptions(options) {
|
|
43
|
+
return {
|
|
44
|
+
explicit_modification_intent: {
|
|
45
|
+
operation: options.intentOperation,
|
|
46
|
+
},
|
|
47
|
+
context_lock: {
|
|
48
|
+
allowed_paths: parseCsvOption(options.allowedPaths ?? options.writeScope),
|
|
49
|
+
forbidden_paths: parseCsvOption(options.forbiddenPaths),
|
|
50
|
+
protected_core: parseCsvOption(options.protectedCore),
|
|
51
|
+
},
|
|
52
|
+
change_budget: {
|
|
53
|
+
max_files_changed: parseNonNegativeNumberOption(options.maxFilesChanged, '--max-files-changed'),
|
|
54
|
+
max_new_files: parseNonNegativeNumberOption(options.maxNewFiles, '--max-new-files'),
|
|
55
|
+
max_deleted_files: parseNonNegativeNumberOption(options.maxDeletedFiles, '--max-deleted-files'),
|
|
56
|
+
},
|
|
57
|
+
governed_override: parseGovernedOverrideOption(options.governedOverride),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function resolvePreflightMode(lifecycle) {
|
|
61
|
+
return lifecycle === 'finalize' ? 'apply-approved' : 'apply-sandbox';
|
|
62
|
+
}
|
|
63
|
+
function buildPreflightRequest(options) {
|
|
64
|
+
const mode = resolvePreflightMode(options.lifecycle ?? 'custom');
|
|
65
|
+
return {
|
|
66
|
+
provider: 'deepagents',
|
|
67
|
+
mode,
|
|
68
|
+
objective: options.objective,
|
|
69
|
+
plugin_execution_path: 'broker',
|
|
70
|
+
plugin_flow: [...PREFLIGHT_MUTATING_PLUGIN_FLOW, mode],
|
|
71
|
+
operations: ['read', 'write', 'execute', 'plugin-apply'],
|
|
72
|
+
write_scope: parseCsvOption(options.writeScope),
|
|
73
|
+
planned_writes: parseCsvOption(options.plannedWrites),
|
|
74
|
+
change_safety: buildChangeSafetyFromOptions(options),
|
|
75
|
+
approval_grants: ['all'],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function resolveContextBudgetModeOption(options) {
|
|
79
|
+
const requested = options?.compact
|
|
80
|
+
? 'compact'
|
|
81
|
+
: options?.full
|
|
82
|
+
? 'full'
|
|
83
|
+
: options?.budget ?? 'standard';
|
|
84
|
+
if (!CONTEXT_PACK_BUDGET_MODES.includes(requested)) {
|
|
85
|
+
throw new Error(`Modo de budget invalido: ${requested}. Use compact, standard ou full.`);
|
|
86
|
+
}
|
|
87
|
+
return requested;
|
|
88
|
+
}
|
|
89
|
+
function parsePositiveNumberOption(value, name) {
|
|
90
|
+
if (!value)
|
|
91
|
+
return undefined;
|
|
92
|
+
const parsed = Number(value);
|
|
93
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
94
|
+
throw new Error(`Valor invalido em ${name}. Use um numero positivo.`);
|
|
95
|
+
}
|
|
96
|
+
return parsed;
|
|
97
|
+
}
|
|
98
|
+
function parseNonNegativeNumberOption(value, name) {
|
|
99
|
+
if (!value)
|
|
100
|
+
return undefined;
|
|
101
|
+
const parsed = Number(value);
|
|
102
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
103
|
+
throw new Error(`Valor invalido em ${name}. Use um numero nao negativo.`);
|
|
104
|
+
}
|
|
105
|
+
return parsed;
|
|
106
|
+
}
|
|
107
|
+
async function buildPlanStatus(root, stores, options) {
|
|
108
|
+
const config = await loadProjectSddConfig(root);
|
|
109
|
+
const paths = resolveSddPaths(root, config);
|
|
110
|
+
const snapshot = await loadStateSnapshot(paths, config);
|
|
111
|
+
const next = await new NextService(stores).execute(root, {
|
|
112
|
+
rank: options?.rank,
|
|
113
|
+
limit: parsePositiveNumberOption(options?.limit, '--limit'),
|
|
114
|
+
maxAgents: parsePositiveNumberOption(options?.maxAgents, '--max-agents'),
|
|
115
|
+
});
|
|
116
|
+
const active = snapshot.backlog.items
|
|
117
|
+
.filter((item) => item.status === 'IN_PROGRESS')
|
|
118
|
+
.map((item) => ({
|
|
119
|
+
id: item.id,
|
|
120
|
+
title: item.title,
|
|
121
|
+
current_stage: item.current_stage,
|
|
122
|
+
frontend_impact_status: item.frontend_impact_status,
|
|
123
|
+
next_action: `codesdd sdd finalize --ref ${item.id}`,
|
|
124
|
+
}))
|
|
125
|
+
.sort((a, b) => a.id.localeCompare(b.id));
|
|
126
|
+
const counts = snapshot.backlog.items.reduce((acc, item) => {
|
|
127
|
+
acc.total += 1;
|
|
128
|
+
acc.by_status[item.status] = (acc.by_status[item.status] ?? 0) + 1;
|
|
129
|
+
return acc;
|
|
130
|
+
}, { total: 0, by_status: {} });
|
|
131
|
+
return {
|
|
132
|
+
schema_version: 1,
|
|
133
|
+
generated_at: new Date().toISOString(),
|
|
134
|
+
active,
|
|
135
|
+
next,
|
|
136
|
+
counts,
|
|
137
|
+
recommended_action: active.length > 0
|
|
138
|
+
? `Finalize active feature ${active[0].id} before starting more work.`
|
|
139
|
+
: next.ready.length > 0
|
|
140
|
+
? `Run codesdd sdd execute-next to start ${next.ready[0].id}.`
|
|
141
|
+
: 'No ready feature is available.',
|
|
142
|
+
};
|
|
143
|
+
}
|
|
24
144
|
export function registerExecutionCommands(sddCmd) {
|
|
145
|
+
sddCmd
|
|
146
|
+
.command('release-readiness')
|
|
147
|
+
.description('Report non-mutating release readiness handoff sections and CI parity commands')
|
|
148
|
+
.alias('prontidao-release')
|
|
149
|
+
.option('--strict', 'Return exit code 1 when readiness is blocked')
|
|
150
|
+
.option('--json', 'JSON output')
|
|
151
|
+
.action(async (options) => {
|
|
152
|
+
const root = resolveRoot();
|
|
153
|
+
await ensureMandatorySddMigration(root);
|
|
154
|
+
const report = await evaluateReleaseReadiness(root);
|
|
155
|
+
if (options?.json) {
|
|
156
|
+
console.log(JSON.stringify(report, null, 2));
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
const color = report.status === 'ready' ? chalk.green : report.status === 'warning' ? chalk.yellow : chalk.red;
|
|
160
|
+
console.log(color(formatReleaseReadinessReport(report)));
|
|
161
|
+
}
|
|
162
|
+
if (options?.strict && report.status === 'blocked') {
|
|
163
|
+
process.exitCode = 1;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
25
166
|
sddCmd
|
|
26
167
|
.command('mcp-manifest')
|
|
27
168
|
.description('Render a provider-agnostic MCP manifest for CodeSDD execution tools')
|
|
@@ -132,6 +273,56 @@ export function registerExecutionCommands(sddCmd) {
|
|
|
132
273
|
console.log(`Invoked at: ${response.invoked_at}`);
|
|
133
274
|
console.log(JSON.stringify(response.result, null, 2));
|
|
134
275
|
});
|
|
276
|
+
sddCmd
|
|
277
|
+
.command('preflight <featureId>')
|
|
278
|
+
.description('Run governed mutation preflight without invoking an agent runtime')
|
|
279
|
+
.option('--objective <text>', 'Natural-language objective for semantic intent checks')
|
|
280
|
+
.option('--intent-operation <operation>', 'Explicit modification intent: add|modify|remove|replace|refactor|optimize')
|
|
281
|
+
.option('--write-scope <list>', 'CSV project-relative write scopes allowed for the runtime')
|
|
282
|
+
.option('--planned-writes <list>', 'CSV project-relative files the runtime plans to write')
|
|
283
|
+
.option('--allowed-paths <list>', 'CSV context-lock allowed project paths')
|
|
284
|
+
.option('--forbidden-paths <list>', 'CSV context-lock forbidden project paths')
|
|
285
|
+
.option('--protected-core <list>', 'CSV protected project paths requiring explicit override')
|
|
286
|
+
.option('--max-files-changed <count>', 'Change budget limit for changed paths')
|
|
287
|
+
.option('--max-new-files <count>', 'Change budget limit for new files')
|
|
288
|
+
.option('--max-deleted-files <count>', 'Change budget limit for deleted files')
|
|
289
|
+
.option('--governed-override <json>', 'JSON governed override contract for protected or replacement changes')
|
|
290
|
+
.option('--lifecycle <name>', 'Lifecycle context: start|finalize|execute-next|custom', 'custom')
|
|
291
|
+
.option('--json', 'JSON output')
|
|
292
|
+
.action(async (featureId, options) => {
|
|
293
|
+
const root = resolveRoot();
|
|
294
|
+
const __config = await loadProjectSddConfig(root);
|
|
295
|
+
const __paths = resolveSddPaths(root, __config);
|
|
296
|
+
const stores = createSddStores(__paths);
|
|
297
|
+
await ensureMandatorySddMigration(root);
|
|
298
|
+
if (options.lifecycle && !['start', 'finalize', 'execute-next', 'custom'].includes(options.lifecycle)) {
|
|
299
|
+
throw new Error('Valor invalido em --lifecycle. Use start, finalize, execute-next ou custom.');
|
|
300
|
+
}
|
|
301
|
+
const result = await new DeepAgentsRunService().execute(featureId, buildPreflightRequest(options), { projectRoot: root, stores, skipRuntime: true });
|
|
302
|
+
if (options.json) {
|
|
303
|
+
console.log(JSON.stringify(result, null, 2));
|
|
304
|
+
if (result.status === 'blocked') {
|
|
305
|
+
process.exitCode = 1;
|
|
306
|
+
}
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (result.status === 'allowed') {
|
|
310
|
+
console.log(chalk.green(`CodeSDD preflight: ${result.status}`));
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
console.log(chalk.red(`CodeSDD preflight: ${result.status}`));
|
|
314
|
+
}
|
|
315
|
+
console.log(`Feature: ${result.feature_id}`);
|
|
316
|
+
console.log(`Mode: ${result.mode}`);
|
|
317
|
+
console.log(`Runtime skipped: ${result.evidence.runtime_skipped ? 'yes' : 'no'}`);
|
|
318
|
+
console.log(`Evidence run id: ${result.evidence.run_id}`);
|
|
319
|
+
if (result.reasons.length > 0) {
|
|
320
|
+
console.log(`Reasons: ${result.reasons.join(' | ')}`);
|
|
321
|
+
}
|
|
322
|
+
if (result.status === 'blocked') {
|
|
323
|
+
process.exitCode = 1;
|
|
324
|
+
}
|
|
325
|
+
});
|
|
135
326
|
const agentCmd = sddCmd
|
|
136
327
|
.command('agent')
|
|
137
328
|
.description('Governed agent execution commands for external providers');
|
|
@@ -140,11 +331,20 @@ export function registerExecutionCommands(sddCmd) {
|
|
|
140
331
|
.description('Run DeepAgents mode policy gate with fail-closed enforcement')
|
|
141
332
|
.requiredOption('--provider <provider>', 'Execution provider (FEAT-0243 accepts only deepagents)')
|
|
142
333
|
.option('--mode <mode>', 'Execution mode: read-only|plan|validate|apply-sandbox|apply-approved')
|
|
334
|
+
.option('--objective <text>', 'Natural-language objective for semantic intent checks')
|
|
143
335
|
.option('--plugin-execution-path <path>', 'Plugin execution path: broker|direct', 'broker')
|
|
144
336
|
.option('--plugin-flow <list>', 'CSV plugin broker/evidence checkpoints for mutation modes')
|
|
145
337
|
.option('--operations <list>', 'CSV runtime operations requested by this run: read|write|execute|network|plugin-apply|finalize|dependency-change|process-spawn')
|
|
146
338
|
.option('--write-scope <list>', 'CSV project-relative write scopes allowed for the runtime')
|
|
147
339
|
.option('--planned-writes <list>', 'CSV project-relative files the runtime plans to write')
|
|
340
|
+
.option('--intent-operation <operation>', 'Explicit modification intent: add|modify|remove|replace|refactor|optimize')
|
|
341
|
+
.option('--allowed-paths <list>', 'CSV context-lock allowed project paths')
|
|
342
|
+
.option('--forbidden-paths <list>', 'CSV context-lock forbidden project paths')
|
|
343
|
+
.option('--protected-core <list>', 'CSV protected project paths requiring explicit override')
|
|
344
|
+
.option('--max-files-changed <count>', 'Change budget limit for changed paths')
|
|
345
|
+
.option('--max-new-files <count>', 'Change budget limit for new files')
|
|
346
|
+
.option('--max-deleted-files <count>', 'Change budget limit for deleted files')
|
|
347
|
+
.option('--governed-override <json>', 'JSON governed override contract for protected or replacement changes')
|
|
148
348
|
.option('--requested-env <list>', 'CSV environment variables requested for runtime passthrough')
|
|
149
349
|
.option('--network-domains <list>', 'CSV network domains requested by this run')
|
|
150
350
|
.option('--approval-grants <list>', 'CSV HITL approval grants: operation names or all')
|
|
@@ -160,11 +360,13 @@ export function registerExecutionCommands(sddCmd) {
|
|
|
160
360
|
const result = await command.execute(featureId, {
|
|
161
361
|
provider: options.provider,
|
|
162
362
|
mode: options.mode,
|
|
363
|
+
objective: options.objective,
|
|
163
364
|
plugin_execution_path: options.pluginExecutionPath,
|
|
164
365
|
plugin_flow: parseCsvOption(options.pluginFlow),
|
|
165
366
|
operations: parseCsvOption(options.operations),
|
|
166
367
|
write_scope: parseCsvOption(options.writeScope),
|
|
167
368
|
planned_writes: parseCsvOption(options.plannedWrites),
|
|
369
|
+
change_safety: buildChangeSafetyFromOptions(options),
|
|
168
370
|
requested_env: parseCsvOption(options.requestedEnv),
|
|
169
371
|
network_domains: parseCsvOption(options.networkDomains),
|
|
170
372
|
approval_grants: parseCsvOption(options.approvalGrants),
|
|
@@ -320,6 +522,12 @@ export function registerExecutionCommands(sddCmd) {
|
|
|
320
522
|
}
|
|
321
523
|
console.log(`Liberadas: ${result.unblocked.join(', ') || '-'}`);
|
|
322
524
|
console.log(`Pendentes na fila: ${result.pending}`);
|
|
525
|
+
if (result.post_finalize_replan?.ready?.length) {
|
|
526
|
+
console.log(`Proximas FEATs: ${result.post_finalize_replan.ready
|
|
527
|
+
.slice(0, 5)
|
|
528
|
+
.map((entry) => entry.id)
|
|
529
|
+
.join(', ')}`);
|
|
530
|
+
}
|
|
323
531
|
console.log(`Docs core atualizados: ${result.updated_core_docs?.join(', ') || '-'}`);
|
|
324
532
|
console.log(`README sincronizado: ${result.updated_readme ? 'sim' : 'nao'}`);
|
|
325
533
|
console.log(`Guia do agente sincronizado: ${result.updated_agent_guide ? 'sim' : 'nao'}`);
|
|
@@ -339,6 +547,9 @@ export function registerExecutionCommands(sddCmd) {
|
|
|
339
547
|
.command('context <ref>')
|
|
340
548
|
.description('Gera contexto objetivo para FEAT/EPIC/FGAP/TD (RAD legado ainda aceito)')
|
|
341
549
|
.alias('contexto')
|
|
550
|
+
.option('--budget <mode>', 'Modo de orcamento do pacote de contexto: compact, standard ou full', 'standard')
|
|
551
|
+
.option('--compact', 'Atalho para --budget compact')
|
|
552
|
+
.option('--full', 'Atalho para --budget full')
|
|
342
553
|
.option('--json', 'Saida em JSON')
|
|
343
554
|
.action(async (ref, options) => {
|
|
344
555
|
const root = resolveRoot();
|
|
@@ -347,28 +558,47 @@ export function registerExecutionCommands(sddCmd) {
|
|
|
347
558
|
const stores = createSddStores(__paths);
|
|
348
559
|
await ensureMandatorySddMigration(root);
|
|
349
560
|
const command = new ContextService(stores);
|
|
350
|
-
const
|
|
561
|
+
const budgetMode = resolveContextBudgetModeOption(options);
|
|
562
|
+
const context = await command.execute(root, ref, { budgetMode });
|
|
351
563
|
if (options?.json) {
|
|
352
564
|
console.log(JSON.stringify(context, null, 2));
|
|
353
565
|
return;
|
|
354
566
|
}
|
|
567
|
+
const contextRecord = context;
|
|
355
568
|
console.log(`Contexto de ${context.target_id} (${context.target_type})`);
|
|
356
569
|
console.log(`Resumo: ${context.summary}`);
|
|
357
|
-
console.log(`
|
|
358
|
-
if (context.
|
|
359
|
-
const
|
|
570
|
+
console.log(`Budget: ${context.context_budget.mode} (${context.context_budget.estimated_chars_after_budget} chars)`);
|
|
571
|
+
if (context.context_budget.deduped_fields?.length) {
|
|
572
|
+
const removed = context.context_budget.deduped_fields.reduce((sum, field) => sum + field.removed, 0);
|
|
573
|
+
console.log(`Dedupe: ${removed} entradas removidas`);
|
|
574
|
+
}
|
|
575
|
+
if (contextRecord.progressive_disclosure) {
|
|
576
|
+
const disclosure = contextRecord.progressive_disclosure;
|
|
577
|
+
const omitted = disclosure.omitted_fields
|
|
578
|
+
.map((field) => `${field.field}:${field.omitted_count}`)
|
|
579
|
+
.join(', ');
|
|
580
|
+
console.log(`Disclosure: ${omitted || '-'} | ${disclosure.reveal_command}`);
|
|
581
|
+
}
|
|
582
|
+
if (contextRecord.context_cache) {
|
|
583
|
+
const cache = contextRecord.context_cache;
|
|
584
|
+
console.log(`Cache: ${cache.hit ? 'hit' : 'miss'} (${cache.key})`);
|
|
585
|
+
}
|
|
586
|
+
const coreDocs = Array.isArray(contextRecord.core_docs) ? contextRecord.core_docs : [];
|
|
587
|
+
console.log(`Core docs: ${coreDocs.join(', ')}`);
|
|
588
|
+
if (contextRecord.origin) {
|
|
589
|
+
const origin = contextRecord.origin;
|
|
360
590
|
console.log(`Origem: ${origin.type}${origin.ref ? ` (${origin.ref})` : ''}`);
|
|
361
591
|
}
|
|
362
|
-
if (
|
|
363
|
-
const refs =
|
|
592
|
+
if (contextRecord.related_features) {
|
|
593
|
+
const refs = contextRecord.related_features;
|
|
364
594
|
console.log(`Features relacionadas: ${refs.join(', ') || '-'}`);
|
|
365
595
|
}
|
|
366
|
-
if (
|
|
367
|
-
const skills =
|
|
596
|
+
if (contextRecord.recommended_skills) {
|
|
597
|
+
const skills = contextRecord.recommended_skills;
|
|
368
598
|
console.log(`Skills sugeridas: ${skills.join(', ') || '-'}`);
|
|
369
599
|
}
|
|
370
|
-
if (
|
|
371
|
-
const skillContract =
|
|
600
|
+
if (contextRecord.skill_execution_contract) {
|
|
601
|
+
const skillContract = contextRecord.skill_execution_contract;
|
|
372
602
|
if (skillContract.required) {
|
|
373
603
|
console.log(`Evidencia de skill: ${skillContract.required_skill_ids.join(', ')} -> ${skillContract.verification_location}`);
|
|
374
604
|
}
|
|
@@ -504,10 +734,157 @@ export function registerExecutionCommands(sddCmd) {
|
|
|
504
734
|
}
|
|
505
735
|
}
|
|
506
736
|
});
|
|
737
|
+
sddCmd
|
|
738
|
+
.command('plan-status [path]')
|
|
739
|
+
.description('Mostra status operacional do plano CodeSDD e a proxima acao recomendada')
|
|
740
|
+
.alias('status-plano')
|
|
741
|
+
.option('--rank <mode>', 'Ranking: impact|criticality|fifo (padrao: impact)')
|
|
742
|
+
.option('--limit <n>', 'Limite de itens prontos (padrao: 10)')
|
|
743
|
+
.option('--max-agents <n>', 'Limite de itens por onda (padrao: sem limite)')
|
|
744
|
+
.option('--json', 'Saida em JSON')
|
|
745
|
+
.action(async (targetPath = '.', options) => {
|
|
746
|
+
const root = resolveRoot(targetPath);
|
|
747
|
+
const __config = await loadProjectSddConfig(root);
|
|
748
|
+
const __paths = resolveSddPaths(root, __config);
|
|
749
|
+
const stores = createSddStores(__paths);
|
|
750
|
+
await ensureMandatorySddMigration(root);
|
|
751
|
+
if (options?.rank && !['impact', 'criticality', 'fifo'].includes(options.rank)) {
|
|
752
|
+
throw new Error('Valor invalido em --rank. Use impact, criticality ou fifo.');
|
|
753
|
+
}
|
|
754
|
+
const result = await buildPlanStatus(root, stores, options);
|
|
755
|
+
if (options?.json) {
|
|
756
|
+
console.log(JSON.stringify(result, null, 2));
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
console.log(chalk.green('Status do plano CodeSDD'));
|
|
760
|
+
console.log(`Ativas: ${result.active.length}`);
|
|
761
|
+
for (const item of result.active) {
|
|
762
|
+
console.log(`- ${item.id}: ${item.title} | etapa=${item.current_stage} | frontend=${item.frontend_impact_status}`);
|
|
763
|
+
}
|
|
764
|
+
console.log(`Prontas: ${result.next.ready.length}`);
|
|
765
|
+
if (result.next.ready[0]) {
|
|
766
|
+
const first = result.next.ready[0];
|
|
767
|
+
console.log(`Proxima recomendada: ${first.id}: ${first.title}`);
|
|
768
|
+
}
|
|
769
|
+
console.log(`Bloqueadas: ${result.next.blocked.length}`);
|
|
770
|
+
console.log(`Conflitos de lock: ${result.next.conflicts.length}`);
|
|
771
|
+
console.log(`Acao recomendada: ${result.recommended_action}`);
|
|
772
|
+
});
|
|
773
|
+
sddCmd
|
|
774
|
+
.command('execute-next [path]')
|
|
775
|
+
.description('Inicia a proxima FEAT pronta pelo ranking CodeSDD')
|
|
776
|
+
.alias('executar-proxima')
|
|
777
|
+
.option('--rank <mode>', 'Ranking: impact|criticality|fifo (padrao: impact)')
|
|
778
|
+
.option('--limit <n>', 'Limite de itens prontos avaliados (padrao: 10)')
|
|
779
|
+
.option('--max-agents <n>', 'Limite de itens por onda (padrao: sem limite)')
|
|
780
|
+
.option('--dry-run', 'Mostra qual FEAT seria iniciada sem alterar estado')
|
|
781
|
+
.option('--force', 'Bypass de bloqueios e conflitos de lock no start')
|
|
782
|
+
.option('--force-transition', 'Bypass das restrições e violações das lentes estruturais')
|
|
783
|
+
.option('--flow-mode <flowMode>', 'Flow: direct|standard|rigorous')
|
|
784
|
+
.option('--fluxo <flowMode>', 'Legacy Portuguese alias for --flow-mode')
|
|
785
|
+
.option('--json', 'Saida em JSON')
|
|
786
|
+
.option('--no-render', 'Nao gera views apos atualizar estado')
|
|
787
|
+
.action(async (targetPath = '.', options) => {
|
|
788
|
+
const root = resolveRoot(targetPath);
|
|
789
|
+
const __config = await loadProjectSddConfig(root);
|
|
790
|
+
const __paths = resolveSddPaths(root, __config);
|
|
791
|
+
const stores = createSddStores(__paths);
|
|
792
|
+
await ensureMandatorySddMigration(root);
|
|
793
|
+
if (options?.rank && !['impact', 'criticality', 'fifo'].includes(options.rank)) {
|
|
794
|
+
throw new Error('Valor invalido em --rank. Use impact, criticality ou fifo.');
|
|
795
|
+
}
|
|
796
|
+
const next = await new NextService(stores).execute(root, {
|
|
797
|
+
rank: options?.rank,
|
|
798
|
+
limit: parsePositiveNumberOption(options?.limit, '--limit'),
|
|
799
|
+
maxAgents: parsePositiveNumberOption(options?.maxAgents, '--max-agents'),
|
|
800
|
+
});
|
|
801
|
+
const selected = next.ready[0];
|
|
802
|
+
if (!selected) {
|
|
803
|
+
const result = { schema_version: 1, started: false, dry_run: !!options?.dryRun, selected: null, next };
|
|
804
|
+
if (options?.json) {
|
|
805
|
+
console.log(JSON.stringify(result, null, 2));
|
|
806
|
+
}
|
|
807
|
+
else {
|
|
808
|
+
console.log('Nenhuma FEAT pronta para iniciar.');
|
|
809
|
+
}
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
if (options?.dryRun) {
|
|
813
|
+
const result = { schema_version: 1, started: false, dry_run: true, selected, next };
|
|
814
|
+
if (options?.json) {
|
|
815
|
+
console.log(JSON.stringify(result, null, 2));
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
console.log(`Proxima FEAT: ${selected.id}: ${selected.title}`);
|
|
819
|
+
console.log(`Comando: codesdd sdd start ${selected.id}`);
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
const flow = parseFlowModeOption(options?.flowMode || options?.fluxo);
|
|
823
|
+
const startResult = await new StartService(stores).execute(root, selected.id, {
|
|
824
|
+
force: options?.force,
|
|
825
|
+
forceTransition: options?.forceTransition,
|
|
826
|
+
flowMode: flow,
|
|
827
|
+
render: options?.render,
|
|
828
|
+
});
|
|
829
|
+
const result = { schema_version: 1, started: true, dry_run: false, selected, start: startResult, next };
|
|
830
|
+
if (options?.json) {
|
|
831
|
+
console.log(JSON.stringify(result, null, 2));
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
console.log(chalk.green(`Proxima FEAT iniciada: ${startResult.featureId}`));
|
|
835
|
+
console.log(`Titulo: ${selected.title}`);
|
|
836
|
+
console.log(`Workspace ativo: ${startResult.active_path}`);
|
|
837
|
+
console.log(`Proximo passo: codesdd sdd context ${startResult.featureId} --compact`);
|
|
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
|
+
});
|
|
507
882
|
sddCmd
|
|
508
883
|
.command('audit [path]')
|
|
509
884
|
.description('Audita a saude de meta-evolucao do SDD (placeholders, deliberacao, ADR e forced transition)')
|
|
510
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')
|
|
511
888
|
.option('--json', 'Saida em JSON')
|
|
512
889
|
.action(async (targetPath = '.', options) => {
|
|
513
890
|
const root = resolveRoot(targetPath);
|
|
@@ -517,8 +894,14 @@ export function registerExecutionCommands(sddCmd) {
|
|
|
517
894
|
await ensureMandatorySddMigration(root);
|
|
518
895
|
const command = new AuditService(stores);
|
|
519
896
|
const result = await command.execute(root);
|
|
897
|
+
const coherence = options?.feature
|
|
898
|
+
? await new PlanningExecutionCoherenceService().execute(root, options.feature)
|
|
899
|
+
: null;
|
|
520
900
|
if (options?.json) {
|
|
521
|
-
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
|
+
}
|
|
522
905
|
return;
|
|
523
906
|
}
|
|
524
907
|
console.log(chalk.green('Auditoria SDD concluida.'));
|
|
@@ -534,7 +917,16 @@ export function registerExecutionCommands(sddCmd) {
|
|
|
534
917
|
if (result.metrics.forced_transitions.feature_refs.length > 0) {
|
|
535
918
|
console.log(`Features com evidencias: ${result.metrics.forced_transitions.feature_refs.join(', ')}`);
|
|
536
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
|
+
}
|
|
537
926
|
console.log(result.recommendation);
|
|
927
|
+
if (options?.strict && coherence && !coherence.healthy) {
|
|
928
|
+
process.exitCode = 1;
|
|
929
|
+
}
|
|
538
930
|
});
|
|
539
931
|
}
|
|
540
932
|
//# sourceMappingURL=execution.js.map
|
|
@@ -32,6 +32,7 @@ export function registerPluginCommands(sddCmd) {
|
|
|
32
32
|
.option('--env <list>', 'Comma-separated requested environment variables')
|
|
33
33
|
.option('--network-domains <list>', 'Comma-separated requested network domains')
|
|
34
34
|
.option('--process-spawn', 'Declare that the operation requests process spawning')
|
|
35
|
+
.option('--project-root <path>', 'Project root used for standalone storage-boundary validation')
|
|
35
36
|
.option('--language <language>', 'Technology language constraint')
|
|
36
37
|
.option('--framework <framework>', 'Technology framework constraint')
|
|
37
38
|
.option('--json', 'Return invocation plan as JSON')
|
|
@@ -50,6 +51,7 @@ export function registerPluginCommands(sddCmd) {
|
|
|
50
51
|
requested_env: parseCsvOption(options.env),
|
|
51
52
|
network_domains: parseCsvOption(options.networkDomains),
|
|
52
53
|
process_spawn_requested: options.processSpawn ?? false,
|
|
54
|
+
project_root: options.projectRoot,
|
|
53
55
|
technology: resolveTechnologyConstraint(options),
|
|
54
56
|
});
|
|
55
57
|
if (options.json) {
|
|
@@ -124,6 +126,9 @@ function printPlanResult(result) {
|
|
|
124
126
|
console.log(chalk.green(`Plugin plan: ${plan.status}`));
|
|
125
127
|
console.log(`Manifest: ${result.manifest_path}`);
|
|
126
128
|
console.log(`Policy: ${plan.policy?.decision ?? 'not-evaluated'}`);
|
|
129
|
+
console.log(`Standalone runner: ${result.workcell_runner.standalone.status}`);
|
|
130
|
+
console.log(`Package governance: ${result.workcell_runner.standalone.package_governance.status}`);
|
|
131
|
+
console.log(`Storage boundary: ${result.workcell_runner.standalone.storage_boundary.status}`);
|
|
127
132
|
if (plan.envelope) {
|
|
128
133
|
console.log(`Operation: ${plan.envelope.operation_id}`);
|
|
129
134
|
console.log(`Plugin: ${plan.envelope.plugin_ref.id}@${plan.envelope.plugin_ref.version}`);
|
|
@@ -2,6 +2,7 @@ import { type SddLanguage, type SddLayout } from '../../core/sdd/state.js';
|
|
|
2
2
|
import type { FlowMode } from '../../core/sdd/types.js';
|
|
3
3
|
export declare function parseCsvOption(value?: string): string[];
|
|
4
4
|
export declare function resolveRoot(targetPath?: string): string;
|
|
5
|
+
export declare function resolveInitRoot(targetPath?: string): string;
|
|
5
6
|
export declare function parseLangOption(value?: string): SddLanguage | undefined;
|
|
6
7
|
export declare function parseLayoutOption(value?: string): SddLayout | undefined;
|
|
7
8
|
export declare function parseFlowModeOption(value?: string): FlowMode | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
2
3
|
import { resolveProjectRoot } from '../../core/sdd/resolve-project-root.js';
|
|
3
4
|
import { loadProjectSddConfig, resolveSddPaths, } from '../../core/sdd/state.js';
|
|
4
5
|
import { assessSddMigration } from '../../core/sdd/migrate.js';
|
|
@@ -13,6 +14,15 @@ export function parseCsvOption(value) {
|
|
|
13
14
|
export function resolveRoot(targetPath = '.') {
|
|
14
15
|
return resolveProjectRoot(targetPath === '.' ? undefined : targetPath);
|
|
15
16
|
}
|
|
17
|
+
export function resolveInitRoot(targetPath = '.') {
|
|
18
|
+
const absoluteTarget = path.resolve(targetPath);
|
|
19
|
+
const segments = absoluteTarget.split(path.sep);
|
|
20
|
+
const sddIndex = segments.lastIndexOf('.sdd');
|
|
21
|
+
if (sddIndex >= 0) {
|
|
22
|
+
return segments.slice(0, sddIndex).join(path.sep) || path.parse(absoluteTarget).root;
|
|
23
|
+
}
|
|
24
|
+
return absoluteTarget;
|
|
25
|
+
}
|
|
16
26
|
export function parseLangOption(value) {
|
|
17
27
|
if (!value)
|
|
18
28
|
return undefined;
|