@paths.design/caws-cli 4.0.0 → 4.1.0
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/dist/commands/archive.d.ts +50 -0
- package/dist/commands/archive.d.ts.map +1 -0
- package/dist/commands/archive.js +353 -0
- package/dist/commands/iterate.d.ts.map +1 -1
- package/dist/commands/iterate.js +12 -13
- package/dist/commands/mode.d.ts +24 -0
- package/dist/commands/mode.d.ts.map +1 -0
- package/dist/commands/mode.js +259 -0
- package/dist/commands/plan.d.ts +49 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +448 -0
- package/dist/commands/quality-gates.d.ts +52 -0
- package/dist/commands/quality-gates.d.ts.map +1 -0
- package/dist/commands/quality-gates.js +490 -0
- package/dist/commands/specs.d.ts +71 -0
- package/dist/commands/specs.d.ts.map +1 -0
- package/dist/commands/specs.js +735 -0
- package/dist/commands/status.d.ts +4 -3
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +552 -22
- package/dist/commands/tutorial.d.ts +55 -0
- package/dist/commands/tutorial.d.ts.map +1 -0
- package/dist/commands/tutorial.js +481 -0
- package/dist/commands/validate.d.ts +10 -3
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +137 -54
- package/dist/config/modes.d.ts +225 -0
- package/dist/config/modes.d.ts.map +1 -0
- package/dist/config/modes.js +321 -0
- package/dist/constants/spec-types.d.ts +41 -0
- package/dist/constants/spec-types.d.ts.map +1 -0
- package/dist/constants/spec-types.js +42 -0
- package/dist/index-new.d.ts +5 -0
- package/dist/index-new.d.ts.map +1 -0
- package/dist/index-new.js +317 -0
- package/dist/index.js +225 -10
- package/dist/index.js.backup +4711 -0
- package/dist/scaffold/git-hooks.d.ts.map +1 -1
- package/dist/scaffold/git-hooks.js +32 -44
- package/dist/scaffold/index.d.ts.map +1 -1
- package/dist/scaffold/index.js +19 -0
- package/dist/utils/quality-gates-errors.js +520 -0
- package/dist/utils/quality-gates.d.ts +49 -0
- package/dist/utils/quality-gates.d.ts.map +1 -0
- package/dist/utils/quality-gates.js +361 -0
- package/dist/utils/spec-resolver.d.ts +88 -0
- package/dist/utils/spec-resolver.d.ts.map +1 -0
- package/dist/utils/spec-resolver.js +602 -0
- package/package.json +6 -5
- package/templates/.cursor/hooks/caws-scope-guard.sh +64 -8
- package/templates/.cursor/hooks/validate-spec.sh +22 -12
- package/templates/.cursor/rules/{01-claims-verification.mdc → 00-claims-verification.mdc} +1 -1
- package/templates/.cursor/rules/01-working-style.mdc +50 -0
- package/templates/.cursor/rules/{02-testing-standards.mdc → 02-quality-gates.mdc} +84 -29
- package/templates/.cursor/rules/03-naming-and-refactor.mdc +33 -0
- package/templates/.cursor/rules/04-logging-language-style.mdc +23 -0
- package/templates/.cursor/rules/05-safe-defaults-guards.mdc +23 -0
- package/templates/.cursor/rules/06-typescript-conventions.mdc +36 -0
- package/templates/.cursor/rules/07-process-ops.mdc +20 -0
- package/templates/.cursor/rules/08-solid-and-architecture.mdc +16 -0
- package/templates/.cursor/rules/09-docstrings.mdc +89 -0
- package/templates/.cursor/rules/10-authorship-and-attribution.mdc +15 -0
- package/templates/.cursor/rules/11-documentation-quality-standards.mdc +390 -0
- package/templates/.cursor/rules/12-scope-management-waivers.mdc +385 -0
- package/templates/.cursor/rules/13-implementation-completeness.mdc +516 -0
- package/templates/.cursor/rules/14-language-agnostic-standards.mdc +588 -0
- package/templates/.cursor/rules/15-sophisticated-todo-detection.mdc +425 -0
- package/templates/.cursor/rules/README.md +93 -7
- package/templates/apps/tools/caws/prompt-lint.js.backup +274 -0
- package/templates/apps/tools/caws/provenance.js.backup +73 -0
- package/templates/scripts/quality-gates/check-god-objects.js +146 -0
- package/templates/scripts/quality-gates/run-quality-gates.js +50 -0
- package/templates/scripts/v3/analysis/todo_analyzer.py +1950 -0
- package/templates/.cursor/rules/03-infrastructure-standards.mdc +0 -251
- package/templates/.cursor/rules/04-documentation-integrity.mdc +0 -291
- package/templates/.cursor/rules/05-production-readiness-checklist.mdc +0 -214
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Archive command handler
|
|
3
|
+
* @param {string} changeId - Change identifier to archive
|
|
4
|
+
* @param {Object} options - Command options
|
|
5
|
+
*/
|
|
6
|
+
export function archiveCommand(changeId: string, options?: any): Promise<any>;
|
|
7
|
+
/**
|
|
8
|
+
* Load change folder structure
|
|
9
|
+
* @param {string} changeId - Change identifier
|
|
10
|
+
* @returns {Promise<Object|null>} Change data or null
|
|
11
|
+
*/
|
|
12
|
+
export function loadChange(changeId: string): Promise<any | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Validate all acceptance criteria are met
|
|
15
|
+
* @param {Object} workingSpec - Working specification
|
|
16
|
+
* @returns {Promise<Object>} Validation result
|
|
17
|
+
*/
|
|
18
|
+
export function validateAcceptanceCriteria(workingSpec: any): Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* Validate change meets quality gates
|
|
21
|
+
* @param {string} changeId - Change identifier
|
|
22
|
+
* @returns {Promise<Object>} Quality gate result
|
|
23
|
+
*/
|
|
24
|
+
export function validateQualityGates(_changeId: any): Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* Generate change summary for archival
|
|
27
|
+
* @param {Object} change - Change data
|
|
28
|
+
* @returns {Promise<string>} Summary text
|
|
29
|
+
*/
|
|
30
|
+
export function generateChangeSummary(change: any): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Archive change folder to archive directory
|
|
33
|
+
* @param {Object} change - Change data
|
|
34
|
+
* @returns {Promise<void>}
|
|
35
|
+
*/
|
|
36
|
+
export function archiveChange(change: any): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Update provenance with completion
|
|
39
|
+
* @param {Object} change - Change data
|
|
40
|
+
* @returns {Promise<void>}
|
|
41
|
+
*/
|
|
42
|
+
export function updateProvenance(change: any): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Display archive results
|
|
45
|
+
* @param {Object} change - Change data
|
|
46
|
+
* @param {Object} validation - Validation result
|
|
47
|
+
* @param {Object} qualityGates - Quality gates result
|
|
48
|
+
*/
|
|
49
|
+
export function displayArchiveResults(change: any, validation: any, qualityGates: any): void;
|
|
50
|
+
//# sourceMappingURL=archive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../src/commands/archive.js"],"names":[],"mappings":"AA8OA;;;;GAIG;AACH,yCAHW,MAAM,+BAqGhB;AAtUD;;;;GAIG;AACH,qCAHW,MAAM,GACJ,OAAO,CAAC,MAAO,IAAI,CAAC,CAgChC;AAED;;;;GAIG;AACH,8DAFa,OAAO,KAAQ,CA8B3B;AAED;;;;GAIG;AACH,sDAFa,OAAO,KAAQ,CAS3B;AAED;;;;GAIG;AACH,oDAFa,OAAO,CAAC,MAAM,CAAC,CAgC3B;AAED;;;;GAIG;AACH,4CAFa,OAAO,CAAC,IAAI,CAAC,CAazB;AAED;;;;GAIG;AACH,+CAFa,OAAO,CAAC,IAAI,CAAC,CAoCzB;AAED;;;;;GAKG;AACH,6FAiCC"}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview CAWS Archive Command
|
|
3
|
+
* Archive completed changes with lifecycle management (multi-spec aware)
|
|
4
|
+
* @author @darianrosebrook
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs-extra');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const yaml = require('js-yaml');
|
|
10
|
+
const chalk = require('chalk');
|
|
11
|
+
const { safeAsync, outputResult } = require('../error-handler');
|
|
12
|
+
|
|
13
|
+
// Import spec resolution system
|
|
14
|
+
const { resolveSpec } = require('../utils/spec-resolver');
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Load change folder structure
|
|
18
|
+
* @param {string} changeId - Change identifier
|
|
19
|
+
* @returns {Promise<Object|null>} Change data or null
|
|
20
|
+
*/
|
|
21
|
+
async function loadChange(changeId) {
|
|
22
|
+
const changesDir = '.caws/changes';
|
|
23
|
+
const changePath = path.join(changesDir, changeId);
|
|
24
|
+
|
|
25
|
+
if (!(await fs.pathExists(changePath))) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const metadataPath = path.join(changePath, 'metadata.yaml');
|
|
31
|
+
const workingSpecPath = path.join(changePath, 'working-spec.yaml');
|
|
32
|
+
|
|
33
|
+
const metadata = (await fs.pathExists(metadataPath))
|
|
34
|
+
? yaml.load(await fs.readFile(metadataPath, 'utf8'))
|
|
35
|
+
: {};
|
|
36
|
+
|
|
37
|
+
const workingSpec = (await fs.pathExists(workingSpecPath))
|
|
38
|
+
? yaml.load(await fs.readFile(workingSpecPath, 'utf8'))
|
|
39
|
+
: null;
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
id: changeId,
|
|
43
|
+
path: changePath,
|
|
44
|
+
metadata,
|
|
45
|
+
workingSpec,
|
|
46
|
+
exists: true,
|
|
47
|
+
};
|
|
48
|
+
} catch (error) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Validate all acceptance criteria are met
|
|
55
|
+
* @param {Object} workingSpec - Working specification
|
|
56
|
+
* @returns {Promise<Object>} Validation result
|
|
57
|
+
*/
|
|
58
|
+
async function validateAcceptanceCriteria(workingSpec) {
|
|
59
|
+
if (!workingSpec || !workingSpec.acceptance_criteria) {
|
|
60
|
+
return {
|
|
61
|
+
valid: false,
|
|
62
|
+
message: 'No acceptance criteria found in working spec',
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const criteria = workingSpec.acceptance_criteria;
|
|
67
|
+
const incomplete = [];
|
|
68
|
+
|
|
69
|
+
for (const criterion of criteria) {
|
|
70
|
+
if (!criterion.completed) {
|
|
71
|
+
incomplete.push(criterion.id || 'unknown');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (incomplete.length > 0) {
|
|
76
|
+
return {
|
|
77
|
+
valid: false,
|
|
78
|
+
message: `Incomplete acceptance criteria: ${incomplete.join(', ')}`,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
valid: true,
|
|
84
|
+
message: `All ${criteria.length} acceptance criteria completed`,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Validate change meets quality gates
|
|
90
|
+
* @param {string} changeId - Change identifier
|
|
91
|
+
* @returns {Promise<Object>} Quality gate result
|
|
92
|
+
*/
|
|
93
|
+
async function validateQualityGates(_changeId) {
|
|
94
|
+
// For now, return success - in full implementation would run actual gate checks
|
|
95
|
+
return {
|
|
96
|
+
valid: true,
|
|
97
|
+
message: 'Quality gates passed (implementation pending)',
|
|
98
|
+
gates: ['test-coverage', 'linting', 'type-checking'],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Generate change summary for archival
|
|
104
|
+
* @param {Object} change - Change data
|
|
105
|
+
* @returns {Promise<string>} Summary text
|
|
106
|
+
*/
|
|
107
|
+
async function generateChangeSummary(change) {
|
|
108
|
+
const { workingSpec, metadata } = change;
|
|
109
|
+
|
|
110
|
+
let summary = `# Change Summary: ${change.id}\n\n`;
|
|
111
|
+
|
|
112
|
+
if (workingSpec) {
|
|
113
|
+
summary += `**Title**: ${workingSpec.title || 'Untitled'}\n`;
|
|
114
|
+
summary += `**Risk Tier**: ${workingSpec.risk_tier || 'Unknown'}\n`;
|
|
115
|
+
summary += `**Mode**: ${workingSpec.mode || 'Unknown'}\n\n`;
|
|
116
|
+
|
|
117
|
+
if (workingSpec.acceptance_criteria) {
|
|
118
|
+
const total = workingSpec.acceptance_criteria.length;
|
|
119
|
+
const completed = workingSpec.acceptance_criteria.filter((c) => c.completed).length;
|
|
120
|
+
summary += `**Acceptance Criteria**: ${completed}/${total} completed\n\n`;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (metadata.created_at) {
|
|
125
|
+
summary += `**Created**: ${new Date(metadata.created_at).toISOString()}\n`;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (metadata.completed_at) {
|
|
129
|
+
summary += `**Completed**: ${new Date(metadata.completed_at).toISOString()}\n`;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
summary += `\n**Files Changed**: ${metadata.files_changed || 0}\n`;
|
|
133
|
+
summary += `**Lines Added**: ${metadata.lines_added || 0}\n`;
|
|
134
|
+
summary += `**Lines Removed**: ${metadata.lines_removed || 0}\n`;
|
|
135
|
+
|
|
136
|
+
return summary;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Archive change folder to archive directory
|
|
141
|
+
* @param {Object} change - Change data
|
|
142
|
+
* @returns {Promise<void>}
|
|
143
|
+
*/
|
|
144
|
+
async function archiveChange(change) {
|
|
145
|
+
const archiveDir = '.caws/archive';
|
|
146
|
+
const archivePath = path.join(archiveDir, change.id);
|
|
147
|
+
|
|
148
|
+
// Ensure archive directory exists
|
|
149
|
+
await fs.ensureDir(archiveDir);
|
|
150
|
+
|
|
151
|
+
// Move change folder to archive
|
|
152
|
+
await fs.move(change.path, archivePath);
|
|
153
|
+
|
|
154
|
+
console.log(chalk.green(` ✅ Moved to: ${archivePath}`));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Update provenance with completion
|
|
159
|
+
* @param {Object} change - Change data
|
|
160
|
+
* @returns {Promise<void>}
|
|
161
|
+
*/
|
|
162
|
+
async function updateProvenance(change) {
|
|
163
|
+
const provenanceDir = '.caws/provenance';
|
|
164
|
+
const chainPath = path.join(provenanceDir, 'chain.json');
|
|
165
|
+
|
|
166
|
+
try {
|
|
167
|
+
let chain = [];
|
|
168
|
+
|
|
169
|
+
if (await fs.pathExists(chainPath)) {
|
|
170
|
+
chain = JSON.parse(await fs.readFile(chainPath, 'utf8'));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Add completion entry
|
|
174
|
+
const completionEntry = {
|
|
175
|
+
timestamp: new Date().toISOString(),
|
|
176
|
+
action: 'change_completed',
|
|
177
|
+
change_id: change.id,
|
|
178
|
+
metadata: {
|
|
179
|
+
title: change.workingSpec?.title,
|
|
180
|
+
risk_tier: change.workingSpec?.risk_tier,
|
|
181
|
+
files_changed: change.metadata?.files_changed || 0,
|
|
182
|
+
lines_added: change.metadata?.lines_added || 0,
|
|
183
|
+
lines_removed: change.metadata?.lines_removed || 0,
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
chain.push(completionEntry);
|
|
188
|
+
|
|
189
|
+
await fs.ensureDir(provenanceDir);
|
|
190
|
+
await fs.writeFile(chainPath, JSON.stringify(chain, null, 2));
|
|
191
|
+
|
|
192
|
+
console.log(chalk.green(` ✅ Provenance updated: ${chain.length} total entries`));
|
|
193
|
+
} catch (error) {
|
|
194
|
+
console.log(chalk.yellow(` ⚠️ Could not update provenance: ${error.message}`));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Display archive results
|
|
200
|
+
* @param {Object} change - Change data
|
|
201
|
+
* @param {Object} validation - Validation result
|
|
202
|
+
* @param {Object} qualityGates - Quality gates result
|
|
203
|
+
*/
|
|
204
|
+
function displayArchiveResults(change, validation, qualityGates) {
|
|
205
|
+
console.log(chalk.bold.cyan(`\n📦 Archiving Change: ${change.id}`));
|
|
206
|
+
console.log(chalk.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
207
|
+
|
|
208
|
+
// Validation status
|
|
209
|
+
if (validation.valid) {
|
|
210
|
+
console.log(chalk.green('✅ Acceptance Criteria'));
|
|
211
|
+
console.log(chalk.gray(` ${validation.message}`));
|
|
212
|
+
} else {
|
|
213
|
+
console.log(chalk.red('❌ Acceptance Criteria'));
|
|
214
|
+
console.log(chalk.gray(` ${validation.message}`));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
console.log('');
|
|
218
|
+
|
|
219
|
+
// Quality gates status
|
|
220
|
+
if (qualityGates.valid) {
|
|
221
|
+
console.log(chalk.green('✅ Quality Gates'));
|
|
222
|
+
console.log(chalk.gray(` ${qualityGates.message}`));
|
|
223
|
+
} else {
|
|
224
|
+
console.log(chalk.red('❌ Quality Gates'));
|
|
225
|
+
console.log(chalk.gray(` ${qualityGates.message}`));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
console.log('');
|
|
229
|
+
|
|
230
|
+
// Archive action
|
|
231
|
+
console.log(chalk.blue('📂 Archive Actions:'));
|
|
232
|
+
console.log(chalk.gray(' • Moving change folder to archive'));
|
|
233
|
+
console.log(chalk.gray(' • Updating provenance chain'));
|
|
234
|
+
console.log(chalk.gray(' • Generating change summary'));
|
|
235
|
+
|
|
236
|
+
console.log('');
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Archive command handler
|
|
241
|
+
* @param {string} changeId - Change identifier to archive
|
|
242
|
+
* @param {Object} options - Command options
|
|
243
|
+
*/
|
|
244
|
+
async function archiveCommand(changeId, options = {}) {
|
|
245
|
+
return safeAsync(
|
|
246
|
+
async () => {
|
|
247
|
+
if (!changeId) {
|
|
248
|
+
throw new Error('Change ID is required. Usage: caws archive <change-id>');
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Load change data
|
|
252
|
+
const change = await loadChange(changeId);
|
|
253
|
+
if (!change) {
|
|
254
|
+
throw new Error(`Change '${changeId}' not found in .caws/changes/`);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Resolve spec using priority system
|
|
258
|
+
let workingSpec = change.workingSpec;
|
|
259
|
+
if (!workingSpec && options.specId) {
|
|
260
|
+
// If change doesn't have a working spec but spec-id is provided, load it
|
|
261
|
+
try {
|
|
262
|
+
const resolved = await resolveSpec({
|
|
263
|
+
specId: options.specId,
|
|
264
|
+
warnLegacy: false,
|
|
265
|
+
});
|
|
266
|
+
workingSpec = resolved.spec;
|
|
267
|
+
} catch (error) {
|
|
268
|
+
console.log(
|
|
269
|
+
chalk.yellow(`⚠️ Could not load spec '${options.specId}': ${error.message}`)
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Validate acceptance criteria
|
|
275
|
+
const validation = await validateAcceptanceCriteria(workingSpec);
|
|
276
|
+
|
|
277
|
+
// Validate quality gates
|
|
278
|
+
const qualityGates = await validateQualityGates(changeId);
|
|
279
|
+
|
|
280
|
+
// Display results
|
|
281
|
+
displayArchiveResults(change, validation, qualityGates);
|
|
282
|
+
|
|
283
|
+
// Check if we should proceed with archival
|
|
284
|
+
if (!validation.valid) {
|
|
285
|
+
console.log(chalk.yellow('⚠️ Cannot archive: Incomplete acceptance criteria'));
|
|
286
|
+
if (!options.force) {
|
|
287
|
+
console.log(chalk.yellow('💡 Use --force to archive anyway'));
|
|
288
|
+
return outputResult({
|
|
289
|
+
command: 'archive',
|
|
290
|
+
change: changeId,
|
|
291
|
+
archived: false,
|
|
292
|
+
reason: 'incomplete_criteria',
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (!qualityGates.valid) {
|
|
298
|
+
console.log(chalk.yellow('⚠️ Cannot archive: Quality gates not met'));
|
|
299
|
+
if (!options.force) {
|
|
300
|
+
console.log(chalk.yellow('💡 Use --force to archive anyway'));
|
|
301
|
+
return outputResult({
|
|
302
|
+
command: 'archive',
|
|
303
|
+
change: changeId,
|
|
304
|
+
archived: false,
|
|
305
|
+
reason: 'quality_gates_failed',
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Perform archival
|
|
311
|
+
console.log(chalk.blue('🔄 Performing archival...'));
|
|
312
|
+
|
|
313
|
+
// Update metadata with completion timestamp
|
|
314
|
+
change.metadata.completed_at = new Date().toISOString();
|
|
315
|
+
change.metadata.archived = true;
|
|
316
|
+
|
|
317
|
+
// Generate and save summary
|
|
318
|
+
const summary = await generateChangeSummary(change);
|
|
319
|
+
const summaryPath = path.join(change.path, 'archive-summary.md');
|
|
320
|
+
await fs.writeFile(summaryPath, summary);
|
|
321
|
+
|
|
322
|
+
// Archive the change
|
|
323
|
+
await archiveChange(change);
|
|
324
|
+
|
|
325
|
+
// Update provenance
|
|
326
|
+
await updateProvenance(change);
|
|
327
|
+
|
|
328
|
+
console.log(chalk.green(`\n🎉 Successfully archived change: ${changeId}`));
|
|
329
|
+
|
|
330
|
+
return outputResult({
|
|
331
|
+
command: 'archive',
|
|
332
|
+
change: changeId,
|
|
333
|
+
archived: true,
|
|
334
|
+
validation: validation.valid,
|
|
335
|
+
qualityGates: qualityGates.valid,
|
|
336
|
+
summary: summary,
|
|
337
|
+
});
|
|
338
|
+
},
|
|
339
|
+
'archive change',
|
|
340
|
+
true
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
module.exports = {
|
|
345
|
+
archiveCommand,
|
|
346
|
+
loadChange,
|
|
347
|
+
validateAcceptanceCriteria,
|
|
348
|
+
validateQualityGates,
|
|
349
|
+
generateChangeSummary,
|
|
350
|
+
archiveChange,
|
|
351
|
+
updateProvenance,
|
|
352
|
+
displayArchiveResults,
|
|
353
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iterate.d.ts","sourceRoot":"","sources":["../../src/commands/iterate.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"iterate.d.ts","sourceRoot":"","sources":["../../src/commands/iterate.js"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,0CAHW,MAAM,YACN,MAAM,iBAgLhB"}
|
package/dist/commands/iterate.js
CHANGED
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
const fs = require('fs');
|
|
11
11
|
const path = require('path');
|
|
12
|
-
const yaml = require('js-yaml');
|
|
13
12
|
const chalk = require('chalk');
|
|
14
13
|
const { initializeGlobalSetup } = require('../config');
|
|
15
14
|
|
|
15
|
+
// Import spec resolution system
|
|
16
|
+
const { resolveSpec } = require('../utils/spec-resolver');
|
|
17
|
+
|
|
16
18
|
/**
|
|
17
19
|
* Iterate command handler
|
|
18
20
|
*
|
|
@@ -21,6 +23,15 @@ const { initializeGlobalSetup } = require('../config');
|
|
|
21
23
|
*/
|
|
22
24
|
async function iterateCommand(specFile = '.caws/working-spec.yaml', options = {}) {
|
|
23
25
|
try {
|
|
26
|
+
// Resolve spec using priority system
|
|
27
|
+
const resolved = await resolveSpec({
|
|
28
|
+
specId: options.specId,
|
|
29
|
+
specFile,
|
|
30
|
+
warnLegacy: false,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const { spec } = resolved;
|
|
34
|
+
|
|
24
35
|
console.log('🔍 Detecting CAWS setup...');
|
|
25
36
|
const setup = initializeGlobalSetup();
|
|
26
37
|
|
|
@@ -29,18 +40,6 @@ async function iterateCommand(specFile = '.caws/working-spec.yaml', options = {}
|
|
|
29
40
|
console.log(` Capabilities: ${setup.capabilities.join(', ')}`);
|
|
30
41
|
}
|
|
31
42
|
|
|
32
|
-
// Load working spec
|
|
33
|
-
const specPath = path.isAbsolute(specFile) ? specFile : path.join(process.cwd(), specFile);
|
|
34
|
-
|
|
35
|
-
if (!fs.existsSync(specPath)) {
|
|
36
|
-
console.error(chalk.red(`\n❌ Working spec not found: ${specFile}`));
|
|
37
|
-
console.error(chalk.yellow('💡 Run: caws init to create a working spec'));
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const specContent = fs.readFileSync(specPath, 'utf8');
|
|
42
|
-
const spec = yaml.load(specContent);
|
|
43
|
-
|
|
44
43
|
// Parse current state from options
|
|
45
44
|
const currentState = options.currentState ? JSON.parse(options.currentState) : {};
|
|
46
45
|
const stateDescription = currentState.description || 'Starting implementation';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mode command handler
|
|
3
|
+
* @param {string} action - Action to perform (current, set, compare, recommend)
|
|
4
|
+
* @param {Object} options - Command options
|
|
5
|
+
*/
|
|
6
|
+
export function modeCommand(action: string, options?: any): Promise<any>;
|
|
7
|
+
import { getCurrentMode } from "../config/modes";
|
|
8
|
+
import { setCurrentMode } from "../config/modes";
|
|
9
|
+
/**
|
|
10
|
+
* Display current mode status
|
|
11
|
+
*/
|
|
12
|
+
export function displayCurrentMode(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Display mode details
|
|
15
|
+
* @param {string} mode - Mode to display
|
|
16
|
+
*/
|
|
17
|
+
export function displayModeDetails(mode: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* Interactive mode selection
|
|
20
|
+
* @returns {Promise<string>} Selected mode
|
|
21
|
+
*/
|
|
22
|
+
export function interactiveModeSelection(): Promise<string>;
|
|
23
|
+
export { getCurrentMode, setCurrentMode };
|
|
24
|
+
//# sourceMappingURL=mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../../src/commands/mode.js"],"names":[],"mappings":"AAuHA;;;;GAIG;AACH,oCAHW,MAAM,+BAgIhB;;;AAvOD;;GAEG;AACH,2CAOC;AAED;;;GAGG;AACH,yCAFW,MAAM,QA+ChB;AAED;;;GAGG;AACH,4CAFa,OAAO,CAAC,MAAM,CAAC,CAkC3B"}
|