@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
package/dist/cli/program.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import ora from 'ora';
|
|
4
|
+
import chalk from 'chalk';
|
|
4
5
|
import path from 'path';
|
|
5
6
|
import { promises as fs } from 'fs';
|
|
6
|
-
import { AI_TOOLS } from '../core/config.js';
|
|
7
|
-
import { CLI_NAME } from '../core/branding.js';
|
|
7
|
+
import { AI_TOOLS, getToolInstallGuidance } from '../core/config.js';
|
|
8
|
+
import { CLI_NAME, CLI_PRODUCT_NAME } from '../core/branding.js';
|
|
8
9
|
import { UpdateCommand } from '../core/update.js';
|
|
9
10
|
import { ListCommand } from '../core/list.js';
|
|
10
11
|
import { ArchiveCommand } from '../core/archive.js';
|
|
@@ -108,6 +109,114 @@ export function createCliProgram(options = {}) {
|
|
|
108
109
|
return value;
|
|
109
110
|
throw new Error(`Invalid value for --layout: "${value}". Use en-US, legacy, or pt-BR.`);
|
|
110
111
|
}
|
|
112
|
+
async function detectExistingCodebase(projectRoot) {
|
|
113
|
+
const markers = [
|
|
114
|
+
'package.json',
|
|
115
|
+
'pnpm-workspace.yaml',
|
|
116
|
+
'tsconfig.json',
|
|
117
|
+
'pyproject.toml',
|
|
118
|
+
'requirements.txt',
|
|
119
|
+
'go.mod',
|
|
120
|
+
'Cargo.toml',
|
|
121
|
+
'pom.xml',
|
|
122
|
+
'build.gradle',
|
|
123
|
+
'pubspec.yaml',
|
|
124
|
+
'src',
|
|
125
|
+
'test',
|
|
126
|
+
'tests',
|
|
127
|
+
'docs',
|
|
128
|
+
'README.md',
|
|
129
|
+
'.github',
|
|
130
|
+
];
|
|
131
|
+
const entries = await fs.readdir(projectRoot).catch(() => []);
|
|
132
|
+
const visibleEntries = entries.filter((entry) => !['.sdd', '.git', '.codex', '.claude', '.cursor', '.opencode'].includes(entry));
|
|
133
|
+
return markers.some((marker) => visibleEntries.includes(marker));
|
|
134
|
+
}
|
|
135
|
+
async function resolveInstallPrimaryNextAction(projectRoot) {
|
|
136
|
+
try {
|
|
137
|
+
const { loadProjectSddConfig, loadStateSnapshot, resolveSddPaths } = await import('../core/sdd/state.js');
|
|
138
|
+
const config = await loadProjectSddConfig(projectRoot);
|
|
139
|
+
const paths = resolveSddPaths(projectRoot, config);
|
|
140
|
+
const snapshot = await loadStateSnapshot(paths, config);
|
|
141
|
+
const activeFeature = snapshot.backlog.items.find((item) => item.status === 'IN_PROGRESS');
|
|
142
|
+
if (activeFeature) {
|
|
143
|
+
return `${CLI_NAME} sdd context ${activeFeature.id}`;
|
|
144
|
+
}
|
|
145
|
+
const readyFeature = snapshot.backlog.items.find((item) => item.status === 'READY');
|
|
146
|
+
if (readyFeature) {
|
|
147
|
+
return `${CLI_NAME} sdd start ${readyFeature.id}`;
|
|
148
|
+
}
|
|
149
|
+
const openDebate = snapshot.discoveryIndex.records.find((record) => record.type === 'DEB' && record.status === 'OPEN');
|
|
150
|
+
if (openDebate) {
|
|
151
|
+
return `${CLI_NAME} sdd decide ${openDebate.id} --outcome epic`;
|
|
152
|
+
}
|
|
153
|
+
const hasInsight = snapshot.discoveryIndex.records.some((record) => record.type === 'INS');
|
|
154
|
+
if (!hasInsight) {
|
|
155
|
+
return `${CLI_NAME} sdd insight "describe the change or initiative"`;
|
|
156
|
+
}
|
|
157
|
+
return `${CLI_NAME} sdd next`;
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
return `${CLI_NAME} sdd onboard system`;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function formatInstallDefaults(options) {
|
|
164
|
+
return {
|
|
165
|
+
tools: options?.tools ? `explicit:${options.tools}` : 'auto',
|
|
166
|
+
language: options?.lang ? `explicit:${options.lang}` : 'auto',
|
|
167
|
+
layout: options?.layout ? `explicit:${options.layout}` : 'auto',
|
|
168
|
+
frontend: options?.frontend === false ? 'disabled' : 'auto',
|
|
169
|
+
check: 'rendered',
|
|
170
|
+
onboard: 'synced',
|
|
171
|
+
announce: 'synced',
|
|
172
|
+
legacy: 'warn-only',
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function resolveInstallToolIds(tools) {
|
|
176
|
+
if (!tools)
|
|
177
|
+
return [];
|
|
178
|
+
const raw = tools.trim().toLowerCase();
|
|
179
|
+
if (!raw || raw === 'none')
|
|
180
|
+
return [];
|
|
181
|
+
if (raw === 'all')
|
|
182
|
+
return availableToolIds;
|
|
183
|
+
return raw
|
|
184
|
+
.split(',')
|
|
185
|
+
.map((token) => token.trim())
|
|
186
|
+
.filter((token) => token.length > 0);
|
|
187
|
+
}
|
|
188
|
+
function displayFullInstallResult(result) {
|
|
189
|
+
console.log();
|
|
190
|
+
console.log(chalk.bold(`${CLI_PRODUCT_NAME} Setup Complete`));
|
|
191
|
+
console.log();
|
|
192
|
+
console.log(chalk.bold('Default-first engagement:'));
|
|
193
|
+
console.log(` Mode: ${result.mode}`);
|
|
194
|
+
console.log(` Tools: ${result.defaults.tools}`);
|
|
195
|
+
for (const note of result.toolNotes) {
|
|
196
|
+
console.log(` ${note}`);
|
|
197
|
+
}
|
|
198
|
+
console.log(` Language: ${result.defaults.language}`);
|
|
199
|
+
console.log(` Layout: ${result.defaults.layout}`);
|
|
200
|
+
console.log(` Frontend: ${result.frontendEnabled ? 'enabled' : 'disabled'} (${result.defaults.frontend})`);
|
|
201
|
+
console.log(` Views generated: ${result.rendered ? 'yes' : 'no'}`);
|
|
202
|
+
console.log(` Curated skills loaded: ${result.skillsSeeded}`);
|
|
203
|
+
console.log(` Local skills generated: ${result.localSkillsMaterialized}`);
|
|
204
|
+
console.log(` Tools synced: ${result.syncedTools.length > 0 ? result.syncedTools.join(', ') : 'none detected'}`);
|
|
205
|
+
if (result.mode === 'existing-codebase') {
|
|
206
|
+
const updatedKeys = Object.entries(result.contextUpdated)
|
|
207
|
+
.filter(([, updated]) => updated)
|
|
208
|
+
.map(([key]) => key);
|
|
209
|
+
console.log(` Existing context absorbed: ${updatedKeys.length > 0 ? updatedKeys.join(', ') : 'no structural updates needed'}`);
|
|
210
|
+
}
|
|
211
|
+
console.log(` Compatibility: ${result.defaults.legacy}`);
|
|
212
|
+
console.log();
|
|
213
|
+
console.log(chalk.bold('Primary next action:'));
|
|
214
|
+
console.log(` ${result.primaryNextAction}`);
|
|
215
|
+
console.log();
|
|
216
|
+
console.log(chalk.dim(`Advanced checks: ${CLI_NAME} sdd onboard system | ${CLI_NAME} sdd check --render`));
|
|
217
|
+
console.log(chalk.dim('Compatibility slash commands may exist for older workflows; prefer CodeSDD SDD commands in .sdd-native projects.'));
|
|
218
|
+
console.log();
|
|
219
|
+
}
|
|
111
220
|
async function runInitCommand(targetPath, options) {
|
|
112
221
|
// Validate that the path is a valid directory
|
|
113
222
|
const resolvedPath = path.resolve(targetPath);
|
|
@@ -142,15 +251,53 @@ export function createCliProgram(options = {}) {
|
|
|
142
251
|
await initCommand.execute(targetPath);
|
|
143
252
|
}
|
|
144
253
|
async function runFullInstallCommand(targetPath, options) {
|
|
145
|
-
|
|
146
|
-
const
|
|
254
|
+
const resolvedPath = path.resolve(targetPath);
|
|
255
|
+
const existingCodebase = await detectExistingCodebase(resolvedPath);
|
|
256
|
+
await runInitCommand(targetPath, {
|
|
257
|
+
...options,
|
|
258
|
+
allowNoToolsFallback: true,
|
|
259
|
+
interactive: false,
|
|
260
|
+
silent: true,
|
|
261
|
+
});
|
|
262
|
+
const { SddInitCommand, SddInitContextCommand } = await import('../core/sdd/init.js');
|
|
263
|
+
const language = normalizeSddLang(options?.lang);
|
|
264
|
+
const layout = normalizeSddLayout(options?.layout);
|
|
265
|
+
const frontendEnabled = options?.frontend ?? true;
|
|
147
266
|
const sddInitCommand = new SddInitCommand();
|
|
148
|
-
await sddInitCommand.execute(targetPath, {
|
|
149
|
-
frontendEnabled
|
|
150
|
-
language
|
|
151
|
-
layout
|
|
152
|
-
render:
|
|
267
|
+
const initResult = await sddInitCommand.execute(targetPath, {
|
|
268
|
+
frontendEnabled,
|
|
269
|
+
language,
|
|
270
|
+
layout,
|
|
271
|
+
render: !existingCodebase,
|
|
153
272
|
});
|
|
273
|
+
let contextUpdated = {};
|
|
274
|
+
let rendered = initResult.rendered;
|
|
275
|
+
if (existingCodebase) {
|
|
276
|
+
const contextCommand = new SddInitContextCommand();
|
|
277
|
+
const contextResult = await contextCommand.execute(targetPath, {
|
|
278
|
+
mode: 'merge',
|
|
279
|
+
deep: true,
|
|
280
|
+
render: true,
|
|
281
|
+
frontendEnabled,
|
|
282
|
+
language,
|
|
283
|
+
layout,
|
|
284
|
+
});
|
|
285
|
+
contextUpdated = contextResult.sddBootstrap.updated;
|
|
286
|
+
rendered = contextResult.rendered;
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
memoryDir: initResult.memoryDir,
|
|
290
|
+
frontendEnabled: initResult.frontendEnabled,
|
|
291
|
+
rendered,
|
|
292
|
+
skillsSeeded: initResult.skillsSeeded,
|
|
293
|
+
localSkillsMaterialized: initResult.localSkillsMaterialized,
|
|
294
|
+
syncedTools: initResult.syncedTools,
|
|
295
|
+
mode: existingCodebase ? 'existing-codebase' : 'new-project',
|
|
296
|
+
contextUpdated,
|
|
297
|
+
defaults: formatInstallDefaults(options),
|
|
298
|
+
toolNotes: getToolInstallGuidance(resolveInstallToolIds(options?.tools)),
|
|
299
|
+
primaryNextAction: await resolveInstallPrimaryNextAction(resolvedPath),
|
|
300
|
+
};
|
|
154
301
|
}
|
|
155
302
|
async function runReloadCommand(targetPath, options) {
|
|
156
303
|
await runInitCommand(targetPath, {
|
|
@@ -254,7 +401,8 @@ export function createCliProgram(options = {}) {
|
|
|
254
401
|
.option('--no-frontend', 'Disable frontend module in the SDD bootstrap')
|
|
255
402
|
.action(async (targetPath = '.', options) => {
|
|
256
403
|
try {
|
|
257
|
-
await runFullInstallCommand(targetPath, options);
|
|
404
|
+
const result = await runFullInstallCommand(targetPath, options);
|
|
405
|
+
displayFullInstallResult(result);
|
|
258
406
|
}
|
|
259
407
|
catch (error) {
|
|
260
408
|
console.log();
|
|
@@ -640,6 +788,27 @@ export function createCliProgram(options = {}) {
|
|
|
640
788
|
}
|
|
641
789
|
export async function runCli(argv = process.argv) {
|
|
642
790
|
const program = createCliProgram();
|
|
643
|
-
|
|
791
|
+
try {
|
|
792
|
+
await program.parseAsync(argv);
|
|
793
|
+
}
|
|
794
|
+
catch (error) {
|
|
795
|
+
const rawMessage = error instanceof Error ? error.message : `${error}`;
|
|
796
|
+
const formattedMessage = /^error:/i.test(rawMessage) ? rawMessage : `Error: ${rawMessage}`;
|
|
797
|
+
const errorExitCode = typeof error === 'object' &&
|
|
798
|
+
error !== null &&
|
|
799
|
+
'exitCode' in error &&
|
|
800
|
+
typeof error.exitCode === 'number'
|
|
801
|
+
? error.exitCode
|
|
802
|
+
: undefined;
|
|
803
|
+
console.error(formattedMessage);
|
|
804
|
+
if (typeof process.exitCode === 'number' && process.exitCode !== 0) {
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
if (typeof errorExitCode === 'number' && Number.isInteger(errorExitCode) && errorExitCode > 0) {
|
|
808
|
+
process.exitCode = errorExitCode;
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
process.exitCode = 1;
|
|
812
|
+
}
|
|
644
813
|
}
|
|
645
814
|
//# sourceMappingURL=program.js.map
|
package/dist/commands/config.js
CHANGED
|
@@ -7,8 +7,11 @@ import { getNestedValue, setNestedValue, deleteNestedValue, coerceValue, formatV
|
|
|
7
7
|
import { CORE_WORKFLOWS, ALL_WORKFLOWS, getProfileWorkflows } from '../core/profiles.js';
|
|
8
8
|
import { hasProjectConfigDrift } from '../core/profile-sync-drift.js';
|
|
9
9
|
import { CLI_NAME } from '../core/branding.js';
|
|
10
|
+
import { buildGeneratedInstructionDriftReport } from '../core/shared/tool-detection.js';
|
|
10
11
|
import { resolveLegacySpecLiveRoot } from '../core/sdd/services/legacy-capability.service.js';
|
|
11
|
-
import { resolveRedisBoundaryConfig } from '../core/sdd/coordination/index.js';
|
|
12
|
+
import { buildRedisOperationalReport, deleteKeysByPrefix, RedisClientFactory, resolveRedisBoundaryConfig, runRedisBenchmark, } from '../core/sdd/coordination/index.js';
|
|
13
|
+
import { buildCodesddStorageBoundaryReport } from '../core/sdd/runtime-boundary-contract.js';
|
|
14
|
+
import { buildEnterpriseProvisioningPolicyReport } from '../core/sdd/enterprise-provisioning-policy.js';
|
|
12
15
|
import { buildDeepAgentsOperationalPreflight, createDeepAgentsPolicySnapshot, } from '../core/sdd/deepagents/policy.js';
|
|
13
16
|
import { detectShell } from '../utils/shell-detection.js';
|
|
14
17
|
import { ZshInstaller } from '../core/completions/installers/zsh-installer.js';
|
|
@@ -70,6 +73,10 @@ function buildCodesddEnvTemplate() {
|
|
|
70
73
|
'export CODESDD_DEEPAGENTS_RUNTIME="${CODESDD_DEEPAGENTS_RUNTIME:-disabled}"',
|
|
71
74
|
'export CODESDD_AGENT_NETWORK_POLICY="${CODESDD_AGENT_NETWORK_POLICY:-disabled}"',
|
|
72
75
|
'export CODESDD_DEEPAGENTS_PROVIDER_SMOKE="${CODESDD_DEEPAGENTS_PROVIDER_SMOKE:-0}"',
|
|
76
|
+
'export CODESDD_REDIS_ENABLED="${CODESDD_REDIS_ENABLED:-false}"',
|
|
77
|
+
'export CODESDD_REDIS_NAMESPACE="${CODESDD_REDIS_NAMESPACE:-codesdd}"',
|
|
78
|
+
'# export CODESDD_REDIS_URL="redis://localhost:6379"',
|
|
79
|
+
'# export CODESDD_REDIS_FALLBACK="filesystem"',
|
|
73
80
|
'# Optional live-provider launcher references. Keep values in your shell,',
|
|
74
81
|
'# password manager, CI secret store, or another untracked launcher context.',
|
|
75
82
|
'# export CODESDD_DEEPAGENTS_ENABLED=true',
|
|
@@ -255,11 +262,18 @@ export function registerConfigCommand(program) {
|
|
|
255
262
|
.command('doctor')
|
|
256
263
|
.description('Run operational readiness checks for DeepAgents/Azure, cache, and Redis boundary')
|
|
257
264
|
.option('--json', 'Output as JSON')
|
|
258
|
-
.action((options) => {
|
|
265
|
+
.action(async (options) => {
|
|
259
266
|
const snapshot = createDeepAgentsPolicySnapshot(process.env);
|
|
260
267
|
const preflight = buildDeepAgentsOperationalPreflight(snapshot, process.env);
|
|
261
|
-
const
|
|
268
|
+
const redisReport = await buildRedisOperationalReport({
|
|
269
|
+
env: process.env,
|
|
270
|
+
globalConfig: getGlobalConfig(),
|
|
271
|
+
});
|
|
272
|
+
const globalConfig = getGlobalConfig();
|
|
262
273
|
const cacheTiers = getGlobalCacheTierDirs();
|
|
274
|
+
const storageBoundary = buildCodesddStorageBoundaryReport(process.cwd());
|
|
275
|
+
const generatedInstructions = buildGeneratedInstructionDriftReport(process.cwd());
|
|
276
|
+
const enterpriseProvisioning = buildEnterpriseProvisioningPolicyReport(globalConfig, process.env);
|
|
263
277
|
const report = {
|
|
264
278
|
schema_version: 1,
|
|
265
279
|
global_config_path: getGlobalConfigPath(),
|
|
@@ -267,11 +281,20 @@ export function registerConfigCommand(program) {
|
|
|
267
281
|
root: getGlobalCacheDir(),
|
|
268
282
|
tiers: Object.keys(cacheTiers),
|
|
269
283
|
},
|
|
284
|
+
storage_boundary: storageBoundary,
|
|
285
|
+
generated_instructions: generatedInstructions,
|
|
270
286
|
redis: {
|
|
271
|
-
requested:
|
|
272
|
-
namespace:
|
|
273
|
-
status:
|
|
287
|
+
requested: redisReport.requested,
|
|
288
|
+
namespace: redisReport.namespace,
|
|
289
|
+
status: redisReport.status,
|
|
290
|
+
fallback: redisReport.fallback,
|
|
291
|
+
redacted_url: redisReport.redacted_url,
|
|
292
|
+
latency_ms: redisReport.latency_ms,
|
|
293
|
+
reason: redisReport.reason,
|
|
294
|
+
validation_errors: redisReport.validation_errors,
|
|
295
|
+
warnings: redisReport.warnings,
|
|
274
296
|
},
|
|
297
|
+
enterprise_provisioning: enterpriseProvisioning,
|
|
275
298
|
deepagents: preflight,
|
|
276
299
|
};
|
|
277
300
|
if (options.json) {
|
|
@@ -281,14 +304,170 @@ export function registerConfigCommand(program) {
|
|
|
281
304
|
console.log(`Global config: ${report.global_config_path}`);
|
|
282
305
|
console.log(`Cache root: ${report.cache.root}`);
|
|
283
306
|
console.log(`Cache tiers: ${report.cache.tiers.join(', ')}`);
|
|
284
|
-
console.log(`
|
|
307
|
+
console.log(`Project state: ${report.storage_boundary.project_state_dir}`);
|
|
308
|
+
console.log(`Global runtime: ${report.storage_boundary.global_runtime_dir}`);
|
|
309
|
+
console.log(`Generated instructions: ${generatedInstructions.status} (checked=${generatedInstructions.checked_count}, stale=${generatedInstructions.stale_count})`);
|
|
310
|
+
for (const warning of generatedInstructions.warnings) {
|
|
311
|
+
console.log(`- ${warning}`);
|
|
312
|
+
}
|
|
313
|
+
for (const staleFile of generatedInstructions.stale_files.slice(0, 10)) {
|
|
314
|
+
console.log(`- stale ${staleFile.kind}: ${staleFile.path}`);
|
|
315
|
+
}
|
|
316
|
+
console.log(`Redis: ${report.redis.status} (namespace=${report.redis.namespace}, fallback=${report.redis.fallback})`);
|
|
317
|
+
if (report.redis.redacted_url) {
|
|
318
|
+
console.log(`Redis URL: ${report.redis.redacted_url}`);
|
|
319
|
+
}
|
|
320
|
+
if (report.redis.latency_ms !== undefined) {
|
|
321
|
+
console.log(`Redis latency: ${report.redis.latency_ms}ms`);
|
|
322
|
+
}
|
|
323
|
+
console.log(`Redis reason: ${report.redis.reason}`);
|
|
324
|
+
for (const warning of report.redis.warnings) {
|
|
325
|
+
console.log(`- ${warning}`);
|
|
326
|
+
}
|
|
327
|
+
for (const error of report.redis.validation_errors) {
|
|
328
|
+
console.log(`- ${error}`);
|
|
329
|
+
}
|
|
330
|
+
const enterpriseRequestedMode = enterpriseProvisioning.requested_mode ?? enterpriseProvisioning.mode;
|
|
331
|
+
const enterpriseEffectiveMode = enterpriseProvisioning.effective_mode ?? (enterpriseProvisioning.requested ? 'enterprise' : 'local');
|
|
332
|
+
const localModeExceptionAccepted = enterpriseProvisioning.local_mode_exception_accepted ?? !enterpriseProvisioning.requested;
|
|
333
|
+
console.log(`Enterprise provisioning: ${enterpriseProvisioning.status}`);
|
|
334
|
+
console.log(`Enterprise requested mode: ${enterpriseRequestedMode}`);
|
|
335
|
+
console.log(`Enterprise effective mode: ${enterpriseEffectiveMode}`);
|
|
336
|
+
console.log(`Enterprise local-mode exception accepted: ${localModeExceptionAccepted ? 'yes' : 'no'}`);
|
|
337
|
+
console.log(`Enterprise provisioning reason: ${enterpriseProvisioning.reason}`);
|
|
338
|
+
console.log(`Enterprise provisioning next action: ${enterpriseProvisioning.next_action}`);
|
|
339
|
+
for (const error of enterpriseProvisioning.validation_errors) {
|
|
340
|
+
console.log(`- ${error}`);
|
|
341
|
+
}
|
|
285
342
|
console.log(`DeepAgents preflight: ${preflight.status}`);
|
|
286
343
|
for (const reason of preflight.reasons) {
|
|
287
344
|
console.log(`- ${reason}`);
|
|
288
345
|
}
|
|
289
346
|
}
|
|
290
|
-
if (preflight.status === 'blocked') {
|
|
347
|
+
if (preflight.status === 'blocked' || redisReport.status === 'blocked' || enterpriseProvisioning.status === 'blocked') {
|
|
348
|
+
process.exitCode = 1;
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
const redisCmd = configCmd
|
|
352
|
+
.command('redis')
|
|
353
|
+
.description('Inspect and operate the optional Redis runtime backend');
|
|
354
|
+
redisCmd
|
|
355
|
+
.command('status')
|
|
356
|
+
.description('Show Redis runtime status')
|
|
357
|
+
.option('--json', 'Output as JSON')
|
|
358
|
+
.action(async (options) => {
|
|
359
|
+
const report = await buildRedisOperationalReport({
|
|
360
|
+
env: process.env,
|
|
361
|
+
globalConfig: getGlobalConfig(),
|
|
362
|
+
});
|
|
363
|
+
if (options.json) {
|
|
364
|
+
console.log(JSON.stringify(report, null, 2));
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
console.log(`Redis: ${report.status}`);
|
|
368
|
+
console.log(`Namespace: ${report.namespace}`);
|
|
369
|
+
console.log(`Fallback: ${report.fallback}`);
|
|
370
|
+
if (report.redacted_url)
|
|
371
|
+
console.log(`URL: ${report.redacted_url}`);
|
|
372
|
+
if (report.latency_ms !== undefined)
|
|
373
|
+
console.log(`Latency: ${report.latency_ms}ms`);
|
|
374
|
+
console.log(`Reason: ${report.reason}`);
|
|
375
|
+
if (report.status === 'blocked')
|
|
376
|
+
process.exitCode = 1;
|
|
377
|
+
});
|
|
378
|
+
redisCmd
|
|
379
|
+
.command('ping')
|
|
380
|
+
.description('Ping Redis using the effective CodeSDD configuration')
|
|
381
|
+
.option('--json', 'Output as JSON')
|
|
382
|
+
.action(async (options) => {
|
|
383
|
+
const report = await buildRedisOperationalReport({
|
|
384
|
+
env: process.env,
|
|
385
|
+
globalConfig: getGlobalConfig(),
|
|
386
|
+
});
|
|
387
|
+
if (options.json) {
|
|
388
|
+
console.log(JSON.stringify(report, null, 2));
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
console.log(`Redis ping: ${report.status}`);
|
|
392
|
+
if (report.latency_ms !== undefined)
|
|
393
|
+
console.log(`Latency: ${report.latency_ms}ms`);
|
|
394
|
+
console.log(report.reason);
|
|
395
|
+
}
|
|
396
|
+
if (report.status !== 'ready')
|
|
291
397
|
process.exitCode = 1;
|
|
398
|
+
});
|
|
399
|
+
redisCmd
|
|
400
|
+
.command('bench')
|
|
401
|
+
.description('Run a short redacted Redis latency benchmark')
|
|
402
|
+
.option('--json', 'Output as JSON')
|
|
403
|
+
.option('--iterations <n>', 'Number of benchmark iterations')
|
|
404
|
+
.action(async (options) => {
|
|
405
|
+
const iterations = options.iterations ? Number.parseInt(options.iterations, 10) : undefined;
|
|
406
|
+
const report = await runRedisBenchmark({
|
|
407
|
+
env: process.env,
|
|
408
|
+
globalConfig: getGlobalConfig(),
|
|
409
|
+
iterations,
|
|
410
|
+
});
|
|
411
|
+
if (options.json) {
|
|
412
|
+
console.log(JSON.stringify(report, null, 2));
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
console.log(`Redis benchmark: ${report.status}`);
|
|
416
|
+
console.log(`Namespace: ${report.namespace}`);
|
|
417
|
+
console.log(`Iterations: ${report.iterations}`);
|
|
418
|
+
if (report.p50_ms !== undefined)
|
|
419
|
+
console.log(`p50: ${report.p50_ms}ms`);
|
|
420
|
+
if (report.p95_ms !== undefined)
|
|
421
|
+
console.log(`p95: ${report.p95_ms}ms`);
|
|
422
|
+
console.log(`Reason: ${report.reason}`);
|
|
423
|
+
}
|
|
424
|
+
if (report.status !== 'ready')
|
|
425
|
+
process.exitCode = 1;
|
|
426
|
+
});
|
|
427
|
+
redisCmd
|
|
428
|
+
.command('flush-namespace')
|
|
429
|
+
.description('Delete only keys under the effective CodeSDD Redis namespace')
|
|
430
|
+
.option('--json', 'Output as JSON')
|
|
431
|
+
.option('-y, --yes', 'Confirm namespace-scoped deletion')
|
|
432
|
+
.action(async (options) => {
|
|
433
|
+
const config = resolveRedisBoundaryConfig(process.env, getGlobalConfig());
|
|
434
|
+
if (!options.yes) {
|
|
435
|
+
console.error('Error: --yes is required to flush the CodeSDD Redis namespace.');
|
|
436
|
+
process.exitCode = 1;
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
const report = await buildRedisOperationalReport({
|
|
440
|
+
env: process.env,
|
|
441
|
+
globalConfig: getGlobalConfig(),
|
|
442
|
+
});
|
|
443
|
+
if (report.status !== 'ready') {
|
|
444
|
+
if (options.json) {
|
|
445
|
+
console.log(JSON.stringify({ ...report, deleted_keys: 0 }, null, 2));
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
console.log(`Redis namespace flush skipped: ${report.reason}`);
|
|
449
|
+
}
|
|
450
|
+
process.exitCode = 1;
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
const factory = new RedisClientFactory(config);
|
|
454
|
+
try {
|
|
455
|
+
const deleted = await deleteKeysByPrefix(factory, `${config.namespace}:`);
|
|
456
|
+
const payload = {
|
|
457
|
+
schema_version: 1,
|
|
458
|
+
namespace: config.namespace,
|
|
459
|
+
deleted_keys: deleted,
|
|
460
|
+
status: 'ok',
|
|
461
|
+
};
|
|
462
|
+
if (options.json) {
|
|
463
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
console.log(`Deleted ${deleted} Redis key(s) under namespace ${config.namespace}.`);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
finally {
|
|
470
|
+
await factory.close();
|
|
292
471
|
}
|
|
293
472
|
});
|
|
294
473
|
// config list
|
|
@@ -331,11 +510,19 @@ export function registerConfigCommand(program) {
|
|
|
331
510
|
console.log(`\nCache settings:`);
|
|
332
511
|
console.log(` root: ${getGlobalCacheDir()}`);
|
|
333
512
|
console.log(` tiers: ${Object.keys(cacheTiers).join(', ')}`);
|
|
334
|
-
const redisBoundary = resolveRedisBoundaryConfig(process.env);
|
|
335
|
-
const redisStatus = redisBoundary.
|
|
513
|
+
const redisBoundary = resolveRedisBoundaryConfig(process.env, config);
|
|
514
|
+
const redisStatus = redisBoundary.validationErrors.length > 0
|
|
515
|
+
? 'blocked'
|
|
516
|
+
: redisBoundary.requested
|
|
517
|
+
? 'requested-unavailable or ready after ping'
|
|
518
|
+
: 'disabled';
|
|
336
519
|
console.log(`\nRedis boundary:`);
|
|
337
520
|
console.log(` status: ${redisStatus}`);
|
|
338
521
|
console.log(` namespace: ${redisBoundary.namespace}`);
|
|
522
|
+
console.log(` fallback: ${redisBoundary.fallback}`);
|
|
523
|
+
if (redisBoundary.redactedUrl) {
|
|
524
|
+
console.log(` url: ${redisBoundary.redactedUrl}`);
|
|
525
|
+
}
|
|
339
526
|
}
|
|
340
527
|
});
|
|
341
528
|
// config get
|