@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,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tutorial command handler
|
|
3
|
+
* @param {string} tutorialType - Type of tutorial to run
|
|
4
|
+
* @param {Object} options - Command options
|
|
5
|
+
*/
|
|
6
|
+
export function tutorialCommand(tutorialType: string, _options?: {}): Promise<any>;
|
|
7
|
+
export namespace TUTORIALS {
|
|
8
|
+
namespace agent {
|
|
9
|
+
let name: string;
|
|
10
|
+
let description: string;
|
|
11
|
+
let icon: string;
|
|
12
|
+
let steps: ({
|
|
13
|
+
id: string;
|
|
14
|
+
title: string;
|
|
15
|
+
content: string;
|
|
16
|
+
action: string;
|
|
17
|
+
verify?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
content: string;
|
|
22
|
+
action: string;
|
|
23
|
+
verify: string;
|
|
24
|
+
})[];
|
|
25
|
+
}
|
|
26
|
+
namespace developer {
|
|
27
|
+
let name_1: string;
|
|
28
|
+
export { name_1 as name };
|
|
29
|
+
let description_1: string;
|
|
30
|
+
export { description_1 as description };
|
|
31
|
+
let icon_1: string;
|
|
32
|
+
export { icon_1 as icon };
|
|
33
|
+
let steps_1: ({
|
|
34
|
+
id: string;
|
|
35
|
+
title: string;
|
|
36
|
+
content: string;
|
|
37
|
+
action: string;
|
|
38
|
+
verify?: undefined;
|
|
39
|
+
} | {
|
|
40
|
+
id: string;
|
|
41
|
+
title: string;
|
|
42
|
+
content: string;
|
|
43
|
+
action: string;
|
|
44
|
+
verify: string;
|
|
45
|
+
})[];
|
|
46
|
+
export { steps_1 as steps };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Interactive tutorial session
|
|
51
|
+
* @param {string} tutorialType - Type of tutorial (agent, developer)
|
|
52
|
+
* @returns {Promise<void>}
|
|
53
|
+
*/
|
|
54
|
+
export function runInteractiveTutorial(tutorialType: string): Promise<void>;
|
|
55
|
+
//# sourceMappingURL=tutorial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tutorial.d.ts","sourceRoot":"","sources":["../../src/commands/tutorial.js"],"names":[],"mappings":"AA4aA;;;;GAIG;AACH,8CAHW,MAAM,+BA4ChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA/FD;;;;GAIG;AACH,qDAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CA4CzB"}
|
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview CAWS Tutorial Command
|
|
3
|
+
* Interactive guided learning for AI agents and developers
|
|
4
|
+
* @author @darianrosebrook
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const chalk = require('chalk');
|
|
8
|
+
const { safeAsync, outputResult } = require('../error-handler');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Tutorial steps for different user types
|
|
12
|
+
*/
|
|
13
|
+
const TUTORIALS = {
|
|
14
|
+
agent: {
|
|
15
|
+
name: 'AI Agent Onboarding',
|
|
16
|
+
description: 'Complete guide for AI agents working with CAWS',
|
|
17
|
+
icon: '🤖',
|
|
18
|
+
steps: [
|
|
19
|
+
{
|
|
20
|
+
id: 'welcome',
|
|
21
|
+
title: 'Welcome to CAWS',
|
|
22
|
+
content: `
|
|
23
|
+
Welcome to CAWS (Coding Agent Workflow System)!
|
|
24
|
+
|
|
25
|
+
CAWS helps AI agents and developers collaborate effectively by providing:
|
|
26
|
+
• 📋 Structured specifications and requirements
|
|
27
|
+
• 🔍 Automated validation and quality gates
|
|
28
|
+
• 📊 Progress tracking and status monitoring
|
|
29
|
+
• 🔄 Change management and archival
|
|
30
|
+
• 🏗️ Multi-tier complexity modes
|
|
31
|
+
|
|
32
|
+
This tutorial will guide you through the essential CAWS workflow.
|
|
33
|
+
`,
|
|
34
|
+
action: 'Press Enter to continue...',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'first-steps',
|
|
38
|
+
title: 'Your First Steps',
|
|
39
|
+
content: `
|
|
40
|
+
Every CAWS session should start with validation:
|
|
41
|
+
|
|
42
|
+
1. ✅ Always validate first: \`caws validate\`
|
|
43
|
+
2. 📊 Check current status: \`caws status --visual\`
|
|
44
|
+
3. 🎯 Get guidance: \`caws iterate --current-state "Starting implementation"\`
|
|
45
|
+
|
|
46
|
+
These commands ensure you're working with validated specifications and understand the current project state.
|
|
47
|
+
`,
|
|
48
|
+
action: 'Try: caws validate',
|
|
49
|
+
verify: 'validation',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'modes',
|
|
53
|
+
title: 'Understanding Modes',
|
|
54
|
+
content: `
|
|
55
|
+
CAWS adapts to your project needs with three complexity tiers:
|
|
56
|
+
|
|
57
|
+
🟢 **Simple Mode** (70% coverage, 30% mutation)
|
|
58
|
+
• Perfect for small projects and prototyping
|
|
59
|
+
• Minimal commands and features
|
|
60
|
+
• Quick setup and iteration
|
|
61
|
+
|
|
62
|
+
🟡 **Standard Mode** (80% coverage, 50% mutation)
|
|
63
|
+
• Balanced approach for most projects
|
|
64
|
+
• Quality gates and provenance tracking
|
|
65
|
+
• Change management and archival
|
|
66
|
+
|
|
67
|
+
🔴 **Enterprise Mode** (90% coverage, 70% mutation)
|
|
68
|
+
• Full compliance and audit trails
|
|
69
|
+
• Advanced monitoring and reporting
|
|
70
|
+
• Maximum quality assurance
|
|
71
|
+
|
|
72
|
+
Check your current mode: \`caws mode current\`
|
|
73
|
+
Switch modes: \`caws mode set --interactive\`
|
|
74
|
+
`,
|
|
75
|
+
action: 'Try: caws mode current',
|
|
76
|
+
verify: 'mode_check',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: 'specs-system',
|
|
80
|
+
title: 'Multi-Spec Organization',
|
|
81
|
+
content: `
|
|
82
|
+
CAWS uses a multi-spec system for better organization:
|
|
83
|
+
|
|
84
|
+
📁 **Individual spec files** instead of monolithic specs
|
|
85
|
+
🎯 **Type-based organization** (feature, fix, refactor, etc.)
|
|
86
|
+
📊 **Visual progress tracking** across all specs
|
|
87
|
+
🔄 **Concurrent development** support
|
|
88
|
+
|
|
89
|
+
Commands:
|
|
90
|
+
• \`caws specs list\` - View all specs
|
|
91
|
+
• \`caws specs create <id>\` - Create new spec
|
|
92
|
+
• \`caws specs show <id>\` - View spec details
|
|
93
|
+
• \`caws specs update <id>\` - Update spec status
|
|
94
|
+
|
|
95
|
+
Each spec contains:
|
|
96
|
+
• Acceptance criteria with progress tracking
|
|
97
|
+
• Risk tier and complexity mode
|
|
98
|
+
• Contract definitions and validation
|
|
99
|
+
`,
|
|
100
|
+
action: 'Try: caws specs list',
|
|
101
|
+
verify: 'specs_list',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 'workflow',
|
|
105
|
+
title: 'Development Workflow',
|
|
106
|
+
content: `
|
|
107
|
+
Follow this proven TDD workflow:
|
|
108
|
+
|
|
109
|
+
1. 📋 **Plan**: Create/update specs with acceptance criteria
|
|
110
|
+
2. ✅ **Validate**: Ensure specs are valid and complete
|
|
111
|
+
3. 🧪 **Test First**: Write failing tests for each criterion
|
|
112
|
+
4. 🔨 **Implement**: Make tests pass incrementally
|
|
113
|
+
5. 📊 **Track Progress**: Update acceptance criteria status
|
|
114
|
+
6. 🔍 **Quality Gates**: Run validation and quality checks
|
|
115
|
+
7. 📦 **Archive**: Complete and archive finished work
|
|
116
|
+
|
|
117
|
+
Key commands:
|
|
118
|
+
• \`caws progress update --criterion-id A1 --status completed\`
|
|
119
|
+
• \`caws validate\` - Validate current work
|
|
120
|
+
• \`caws status --visual\` - Check progress
|
|
121
|
+
• \`caws archive <change-id>\` - Complete work
|
|
122
|
+
`,
|
|
123
|
+
action: 'Try: caws status --visual',
|
|
124
|
+
verify: 'status_check',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: 'quality-gates',
|
|
128
|
+
title: 'Quality Assurance',
|
|
129
|
+
content: `
|
|
130
|
+
CAWS enforces quality through multiple gates:
|
|
131
|
+
|
|
132
|
+
🔍 **Validation Gates**
|
|
133
|
+
• Spec format and completeness
|
|
134
|
+
• Contract compliance
|
|
135
|
+
• Risk tier requirements
|
|
136
|
+
|
|
137
|
+
🧪 **Testing Gates**
|
|
138
|
+
• Test coverage thresholds
|
|
139
|
+
• Mutation testing scores
|
|
140
|
+
• Integration test passing
|
|
141
|
+
|
|
142
|
+
📊 **Progress Gates**
|
|
143
|
+
• Acceptance criteria completion
|
|
144
|
+
• Spec status validation
|
|
145
|
+
• Change budget compliance
|
|
146
|
+
|
|
147
|
+
⚡ **Quick Checks**
|
|
148
|
+
• \`caws validate\` - Spec validation
|
|
149
|
+
• \`caws diagnose\` - Health checks (if in standard/enterprise mode)
|
|
150
|
+
• \`caws evaluate\` - Quality evaluation
|
|
151
|
+
`,
|
|
152
|
+
action: 'Try: caws validate',
|
|
153
|
+
verify: 'quality_check',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: 'common-patterns',
|
|
157
|
+
title: 'Common Patterns & Best Practices',
|
|
158
|
+
content: `
|
|
159
|
+
🚫 **Avoid These**:
|
|
160
|
+
• ❌ Don't start implementation before validation
|
|
161
|
+
• ❌ Don't create duplicate files (enhanced-*, new-*)
|
|
162
|
+
• ❌ Don't exceed change budgets
|
|
163
|
+
• ❌ Don't skip quality gates
|
|
164
|
+
|
|
165
|
+
✅ **Do These**:
|
|
166
|
+
• ✅ Always validate first: \`caws validate\`
|
|
167
|
+
• ✅ Use multi-spec system for organization
|
|
168
|
+
• ✅ Write tests before implementation (TDD)
|
|
169
|
+
• ✅ Update progress: \`caws progress update\`
|
|
170
|
+
• ✅ Archive completed work: \`caws archive\`
|
|
171
|
+
|
|
172
|
+
📚 **Get Help**:
|
|
173
|
+
• \`caws --help\` - All commands
|
|
174
|
+
• \`caws workflow guidance\` - Workflow-specific help
|
|
175
|
+
• \`docs/agents/full-guide.md\` - Complete documentation
|
|
176
|
+
`,
|
|
177
|
+
action: 'Try: caws --help',
|
|
178
|
+
verify: 'help_check',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
id: 'completion',
|
|
182
|
+
title: 'Tutorial Complete!',
|
|
183
|
+
content: `
|
|
184
|
+
🎉 Congratulations! You've completed the CAWS agent tutorial.
|
|
185
|
+
|
|
186
|
+
**Key Takeaways**:
|
|
187
|
+
• CAWS provides structure and validation for AI-human collaboration
|
|
188
|
+
• Start every session with validation and status checks
|
|
189
|
+
• Use the multi-spec system for better organization
|
|
190
|
+
• Follow TDD practices with comprehensive testing
|
|
191
|
+
• Respect quality gates and change budgets
|
|
192
|
+
• Archive completed work for clean project history
|
|
193
|
+
|
|
194
|
+
**Next Steps**:
|
|
195
|
+
1. Explore the multi-spec system: \`caws specs create my-feature\`
|
|
196
|
+
2. Practice the workflow with a small feature
|
|
197
|
+
3. Use mode switching to match your project needs
|
|
198
|
+
4. Read the full documentation for advanced features
|
|
199
|
+
|
|
200
|
+
Remember: CAWS exists to make AI-human collaboration reliable and high-quality. Follow the rules, validate often, and deliver excellent results!
|
|
201
|
+
|
|
202
|
+
💡 Pro tip: Use \`caws status --visual\` regularly to stay oriented
|
|
203
|
+
`,
|
|
204
|
+
action: 'Tutorial complete! Try: caws specs create my-feature',
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
developer: {
|
|
210
|
+
name: 'Developer Quick Start',
|
|
211
|
+
description: 'Fast track for developers new to CAWS',
|
|
212
|
+
icon: '👨💻',
|
|
213
|
+
steps: [
|
|
214
|
+
{
|
|
215
|
+
id: 'welcome-dev',
|
|
216
|
+
title: 'Welcome Developer!',
|
|
217
|
+
content: `
|
|
218
|
+
Welcome to CAWS! This quick start will get you up and running fast.
|
|
219
|
+
|
|
220
|
+
CAWS helps development teams by providing:
|
|
221
|
+
• 📋 Clear specification management
|
|
222
|
+
• 🔄 Structured change workflows
|
|
223
|
+
• 📊 Progress visibility for stakeholders
|
|
224
|
+
• 🏗️ Quality gates and validation
|
|
225
|
+
• 🤝 Better AI-human collaboration
|
|
226
|
+
|
|
227
|
+
Let's get you started!
|
|
228
|
+
`,
|
|
229
|
+
action: 'Press Enter to continue...',
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: 'setup',
|
|
233
|
+
title: 'Project Setup',
|
|
234
|
+
content: `
|
|
235
|
+
First, ensure CAWS is properly initialized:
|
|
236
|
+
|
|
237
|
+
1. Initialize CAWS: \`caws init .\`
|
|
238
|
+
2. Choose your complexity mode: \`caws mode set --interactive\`
|
|
239
|
+
3. Set up git hooks: \`caws hooks install\`
|
|
240
|
+
4. Initialize provenance: \`caws provenance init\`
|
|
241
|
+
|
|
242
|
+
For existing projects, use: \`caws scaffold\`
|
|
243
|
+
|
|
244
|
+
Choose a mode that fits your project:
|
|
245
|
+
• 🟢 Simple: Small projects, quick prototyping
|
|
246
|
+
• 🟡 Standard: Most teams and projects
|
|
247
|
+
• 🔴 Enterprise: Large teams, compliance requirements
|
|
248
|
+
`,
|
|
249
|
+
action: 'Try: caws mode current',
|
|
250
|
+
verify: 'mode_setup',
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
id: 'create-spec',
|
|
254
|
+
title: 'Create Your First Spec',
|
|
255
|
+
content: `
|
|
256
|
+
Create a spec for your feature or fix:
|
|
257
|
+
|
|
258
|
+
\`caws specs create user-login --type feature --title "User Login System"\`
|
|
259
|
+
|
|
260
|
+
This creates:
|
|
261
|
+
• A new spec file in \`.caws/specs/user-login.yaml\`
|
|
262
|
+
• Basic structure with acceptance criteria template
|
|
263
|
+
• Automatic registration in the specs registry
|
|
264
|
+
|
|
265
|
+
View all specs: \`caws specs list\`
|
|
266
|
+
View spec details: \`caws specs show user-login\`
|
|
267
|
+
`,
|
|
268
|
+
action: 'Try: caws specs list',
|
|
269
|
+
verify: 'first_spec',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
id: 'define-criteria',
|
|
273
|
+
title: 'Define Acceptance Criteria',
|
|
274
|
+
content: `
|
|
275
|
+
Edit your spec file to add acceptance criteria:
|
|
276
|
+
|
|
277
|
+
\`\`\`yaml
|
|
278
|
+
# .caws/specs/user-login.yaml
|
|
279
|
+
acceptance_criteria:
|
|
280
|
+
- id: A1
|
|
281
|
+
title: User can login with valid credentials
|
|
282
|
+
description: Users should be able to authenticate using email/password
|
|
283
|
+
completed: false
|
|
284
|
+
- id: A2
|
|
285
|
+
title: Invalid credentials show error
|
|
286
|
+
description: Invalid login attempts should display appropriate error messages
|
|
287
|
+
completed: false
|
|
288
|
+
\`\`\`
|
|
289
|
+
|
|
290
|
+
Each criterion should be:
|
|
291
|
+
• ✅ Testable and verifiable
|
|
292
|
+
• 📏 Specific and measurable
|
|
293
|
+
• 🎯 Focused on user value
|
|
294
|
+
`,
|
|
295
|
+
action: 'Edit your spec file and add acceptance criteria',
|
|
296
|
+
verify: 'criteria_defined',
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
id: 'workflow',
|
|
300
|
+
title: 'Development Workflow',
|
|
301
|
+
content: `
|
|
302
|
+
Follow this workflow for each acceptance criterion:
|
|
303
|
+
|
|
304
|
+
1. **Write failing tests first** (TDD approach)
|
|
305
|
+
2. **Implement the minimum** to make tests pass
|
|
306
|
+
3. **Update progress**: \`caws progress update --criterion-id A1 --status completed\`
|
|
307
|
+
4. **Validate**: \`caws validate\`
|
|
308
|
+
5. **Run quality gates** (if in standard/enterprise mode)
|
|
309
|
+
|
|
310
|
+
Repeat for each criterion until the spec is complete.
|
|
311
|
+
|
|
312
|
+
Track progress: \`caws status --visual\`
|
|
313
|
+
Get guidance: \`caws iterate --current-state "Working on A1"\`
|
|
314
|
+
`,
|
|
315
|
+
action: 'Try: caws progress update --criterion-id A1 --status in_progress',
|
|
316
|
+
verify: 'workflow_started',
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
id: 'completion',
|
|
320
|
+
title: 'Complete and Archive',
|
|
321
|
+
content: `
|
|
322
|
+
When all acceptance criteria are completed:
|
|
323
|
+
|
|
324
|
+
1. **Final validation**: \`caws validate\`
|
|
325
|
+
2. **Quality checks**: \`caws diagnose\` (if enabled)
|
|
326
|
+
3. **Archive the work**: \`caws archive user-login\`
|
|
327
|
+
|
|
328
|
+
This:
|
|
329
|
+
• ✅ Validates all criteria are met
|
|
330
|
+
• 📦 Moves completed work to archive
|
|
331
|
+
• 📊 Updates provenance chain
|
|
332
|
+
• 🎯 Provides completion summary
|
|
333
|
+
|
|
334
|
+
View archived work: Check \`.caws/archive/\` directory
|
|
335
|
+
`,
|
|
336
|
+
action: 'Complete your spec and try: caws archive <spec-id>',
|
|
337
|
+
verify: 'archival_complete',
|
|
338
|
+
},
|
|
339
|
+
],
|
|
340
|
+
},
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Display tutorial step
|
|
345
|
+
* @param {Object} step - Tutorial step
|
|
346
|
+
* @param {number} stepNumber - Step number (1-based)
|
|
347
|
+
* @param {number} totalSteps - Total number of steps
|
|
348
|
+
*/
|
|
349
|
+
function displayTutorialStep(step, stepNumber, totalSteps) {
|
|
350
|
+
console.log(chalk.bold.cyan(`\n📚 Step ${stepNumber}/${totalSteps}: ${step.title}`));
|
|
351
|
+
console.log(chalk.cyan('━'.repeat(60)));
|
|
352
|
+
|
|
353
|
+
// Display content with proper formatting
|
|
354
|
+
const lines = step.content.trim().split('\n');
|
|
355
|
+
lines.forEach((line) => {
|
|
356
|
+
if (
|
|
357
|
+
line.startsWith('•') ||
|
|
358
|
+
line.startsWith('✅') ||
|
|
359
|
+
line.startsWith('❌') ||
|
|
360
|
+
line.startsWith('📋') ||
|
|
361
|
+
line.startsWith('🔍')
|
|
362
|
+
) {
|
|
363
|
+
console.log(chalk.gray(line));
|
|
364
|
+
} else if (line.startsWith('🟢') || line.startsWith('🟡') || line.startsWith('🔴')) {
|
|
365
|
+
console.log(line);
|
|
366
|
+
} else if (line.includes('`')) {
|
|
367
|
+
console.log(chalk.cyan(line));
|
|
368
|
+
} else {
|
|
369
|
+
console.log(line);
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
if (step.action) {
|
|
374
|
+
console.log(chalk.yellow(`\n💡 ${step.action}`));
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
console.log('');
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Interactive tutorial session
|
|
382
|
+
* @param {string} tutorialType - Type of tutorial (agent, developer)
|
|
383
|
+
* @returns {Promise<void>}
|
|
384
|
+
*/
|
|
385
|
+
async function runInteractiveTutorial(tutorialType) {
|
|
386
|
+
const tutorial = TUTORIALS[tutorialType];
|
|
387
|
+
if (!tutorial) {
|
|
388
|
+
throw new Error(
|
|
389
|
+
`Unknown tutorial type: ${tutorialType}. Available: ${Object.keys(TUTORIALS).join(', ')}`
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const readline = require('readline');
|
|
394
|
+
const rl = readline.createInterface({
|
|
395
|
+
input: process.stdin,
|
|
396
|
+
output: process.stdout,
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
console.log(chalk.bold.green(`\n🚀 Starting ${tutorial.icon} ${tutorial.name}`));
|
|
400
|
+
console.log(chalk.green(tutorial.description));
|
|
401
|
+
console.log(chalk.gray(`Total steps: ${tutorial.steps.length}\n`));
|
|
402
|
+
|
|
403
|
+
for (let i = 0; i < tutorial.steps.length; i++) {
|
|
404
|
+
const step = tutorial.steps[i];
|
|
405
|
+
const stepNumber = i + 1;
|
|
406
|
+
|
|
407
|
+
displayTutorialStep(step, stepNumber, tutorial.steps.length);
|
|
408
|
+
|
|
409
|
+
// Wait for user input (except for the last step)
|
|
410
|
+
if (i < tutorial.steps.length - 1) {
|
|
411
|
+
await new Promise((resolve) => {
|
|
412
|
+
console.log(chalk.blue('Press Enter to continue...'));
|
|
413
|
+
rl.on('line', () => {
|
|
414
|
+
resolve();
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
rl.close();
|
|
421
|
+
|
|
422
|
+
// Final message
|
|
423
|
+
console.log(chalk.bold.green(`\n🎉 ${tutorial.icon} ${tutorial.name} Complete!`));
|
|
424
|
+
console.log(chalk.green('You can always run this tutorial again with:'));
|
|
425
|
+
console.log(chalk.cyan(`caws tutorial ${tutorialType}`));
|
|
426
|
+
console.log('');
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Tutorial command handler
|
|
431
|
+
* @param {string} tutorialType - Type of tutorial to run
|
|
432
|
+
* @param {Object} options - Command options
|
|
433
|
+
*/
|
|
434
|
+
async function tutorialCommand(tutorialType, _options = {}) {
|
|
435
|
+
return safeAsync(
|
|
436
|
+
async () => {
|
|
437
|
+
if (!tutorialType) {
|
|
438
|
+
// Show available tutorials
|
|
439
|
+
console.log(chalk.bold.cyan('\n📚 Available CAWS Tutorials'));
|
|
440
|
+
console.log(chalk.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
441
|
+
|
|
442
|
+
Object.entries(TUTORIALS).forEach(([type, tutorial]) => {
|
|
443
|
+
console.log(`${tutorial.icon} ${chalk.green(type.padEnd(12))} - ${tutorial.description}`);
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
console.log(chalk.gray('\nUsage: caws tutorial <type>'));
|
|
447
|
+
console.log(chalk.gray('Example: caws tutorial agent'));
|
|
448
|
+
|
|
449
|
+
return outputResult({
|
|
450
|
+
command: 'tutorial',
|
|
451
|
+
action: 'list',
|
|
452
|
+
available: Object.keys(TUTORIALS),
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (!TUTORIALS[tutorialType]) {
|
|
457
|
+
throw new Error(
|
|
458
|
+
`Unknown tutorial: ${tutorialType}. Available: ${Object.keys(TUTORIALS).join(', ')}`
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// Run the interactive tutorial
|
|
463
|
+
await runInteractiveTutorial(tutorialType);
|
|
464
|
+
|
|
465
|
+
return outputResult({
|
|
466
|
+
command: 'tutorial',
|
|
467
|
+
tutorial: tutorialType,
|
|
468
|
+
steps: TUTORIALS[tutorialType].steps.length,
|
|
469
|
+
completed: true,
|
|
470
|
+
});
|
|
471
|
+
},
|
|
472
|
+
`tutorial ${tutorialType}`,
|
|
473
|
+
true
|
|
474
|
+
);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
module.exports = {
|
|
478
|
+
tutorialCommand,
|
|
479
|
+
TUTORIALS,
|
|
480
|
+
runInteractiveTutorial,
|
|
481
|
+
};
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Validate command handler
|
|
3
|
-
* Enhanced with JSON output format
|
|
4
|
-
* @param {string} specFile - Path to spec file
|
|
3
|
+
* Enhanced with multi-spec support and JSON output format
|
|
4
|
+
* @param {string} specFile - Path to spec file (optional, uses spec resolution)
|
|
5
5
|
* @param {Object} options - Command options
|
|
6
|
+
* @param {string} [options.specId] - Feature-specific spec ID
|
|
7
|
+
* @param {boolean} [options.interactive] - Use interactive spec selection
|
|
8
|
+
* @param {boolean} [options.format] - Output format (json)
|
|
6
9
|
*/
|
|
7
|
-
export function validateCommand(specFile: string, options
|
|
10
|
+
export function validateCommand(specFile: string, options?: {
|
|
11
|
+
specId?: string;
|
|
12
|
+
interactive?: boolean;
|
|
13
|
+
format?: boolean;
|
|
14
|
+
}): Promise<void>;
|
|
8
15
|
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.js"],"names":[],"mappings":"AAkBA;;;;;;;;GAQG;AACH,0CANW,MAAM,YAEd;IAAyB,MAAM,GAAvB,MAAM;IACY,WAAW,GAA7B,OAAO;IACW,MAAM,GAAxB,OAAO;CACjB,iBAiNA"}
|