@paths.design/caws-cli 4.0.0 → 5.0.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.
Files changed (119) hide show
  1. package/dist/commands/archive.js +353 -0
  2. package/dist/commands/iterate.js +12 -13
  3. package/dist/commands/mode.js +259 -0
  4. package/dist/commands/plan.js +448 -0
  5. package/dist/commands/quality-gates.js +490 -0
  6. package/dist/commands/specs.js +735 -0
  7. package/dist/commands/status.js +552 -22
  8. package/dist/commands/tutorial.js +481 -0
  9. package/dist/commands/validate.js +137 -54
  10. package/dist/commands/waivers.js +101 -26
  11. package/dist/config/modes.js +321 -0
  12. package/dist/constants/spec-types.js +42 -0
  13. package/dist/index.js +225 -10
  14. package/dist/scaffold/git-hooks.js +32 -44
  15. package/dist/scaffold/index.js +19 -0
  16. package/dist/utils/quality-gates-errors.js +520 -0
  17. package/dist/utils/quality-gates.js +361 -0
  18. package/dist/utils/spec-resolver.js +602 -0
  19. package/dist/waivers-manager.js +49 -4
  20. package/package.json +6 -5
  21. package/templates/.cursor/hooks/caws-scope-guard.sh +64 -8
  22. package/templates/.cursor/hooks/validate-spec.sh +22 -12
  23. package/templates/.cursor/rules/{01-claims-verification.mdc → 00-claims-verification.mdc} +1 -1
  24. package/templates/.cursor/rules/01-working-style.mdc +50 -0
  25. package/templates/.cursor/rules/{02-testing-standards.mdc → 02-quality-gates.mdc} +84 -29
  26. package/templates/.cursor/rules/03-naming-and-refactor.mdc +33 -0
  27. package/templates/.cursor/rules/04-logging-language-style.mdc +23 -0
  28. package/templates/.cursor/rules/05-safe-defaults-guards.mdc +23 -0
  29. package/templates/.cursor/rules/06-typescript-conventions.mdc +36 -0
  30. package/templates/.cursor/rules/07-process-ops.mdc +20 -0
  31. package/templates/.cursor/rules/08-solid-and-architecture.mdc +16 -0
  32. package/templates/.cursor/rules/09-docstrings.mdc +89 -0
  33. package/templates/.cursor/rules/10-authorship-and-attribution.mdc +15 -0
  34. package/templates/.cursor/rules/11-documentation-quality-standards.mdc +390 -0
  35. package/templates/.cursor/rules/12-scope-management-waivers.mdc +385 -0
  36. package/templates/.cursor/rules/13-implementation-completeness.mdc +516 -0
  37. package/templates/.cursor/rules/14-language-agnostic-standards.mdc +588 -0
  38. package/templates/.cursor/rules/15-sophisticated-todo-detection.mdc +425 -0
  39. package/templates/.cursor/rules/README.md +93 -7
  40. package/templates/scripts/quality-gates/check-god-objects.js +146 -0
  41. package/templates/scripts/quality-gates/run-quality-gates.js +50 -0
  42. package/templates/scripts/v3/analysis/todo_analyzer.py +1950 -0
  43. package/dist/budget-derivation.d.ts +0 -74
  44. package/dist/budget-derivation.d.ts.map +0 -1
  45. package/dist/cicd-optimizer.d.ts +0 -142
  46. package/dist/cicd-optimizer.d.ts.map +0 -1
  47. package/dist/commands/burnup.d.ts +0 -6
  48. package/dist/commands/burnup.d.ts.map +0 -1
  49. package/dist/commands/diagnose.d.ts +0 -52
  50. package/dist/commands/diagnose.d.ts.map +0 -1
  51. package/dist/commands/evaluate.d.ts +0 -8
  52. package/dist/commands/evaluate.d.ts.map +0 -1
  53. package/dist/commands/init.d.ts +0 -5
  54. package/dist/commands/init.d.ts.map +0 -1
  55. package/dist/commands/iterate.d.ts +0 -8
  56. package/dist/commands/iterate.d.ts.map +0 -1
  57. package/dist/commands/provenance.d.ts +0 -32
  58. package/dist/commands/provenance.d.ts.map +0 -1
  59. package/dist/commands/quality-monitor.d.ts +0 -17
  60. package/dist/commands/quality-monitor.d.ts.map +0 -1
  61. package/dist/commands/status.d.ts +0 -43
  62. package/dist/commands/status.d.ts.map +0 -1
  63. package/dist/commands/templates.d.ts +0 -74
  64. package/dist/commands/templates.d.ts.map +0 -1
  65. package/dist/commands/tool.d.ts +0 -13
  66. package/dist/commands/tool.d.ts.map +0 -1
  67. package/dist/commands/troubleshoot.d.ts +0 -8
  68. package/dist/commands/troubleshoot.d.ts.map +0 -1
  69. package/dist/commands/validate.d.ts +0 -8
  70. package/dist/commands/validate.d.ts.map +0 -1
  71. package/dist/commands/waivers.d.ts +0 -8
  72. package/dist/commands/waivers.d.ts.map +0 -1
  73. package/dist/commands/workflow.d.ts +0 -85
  74. package/dist/commands/workflow.d.ts.map +0 -1
  75. package/dist/config/index.d.ts +0 -29
  76. package/dist/config/index.d.ts.map +0 -1
  77. package/dist/error-handler.d.ts +0 -164
  78. package/dist/error-handler.d.ts.map +0 -1
  79. package/dist/generators/jest-config.d.ts +0 -32
  80. package/dist/generators/jest-config.d.ts.map +0 -1
  81. package/dist/generators/working-spec.d.ts +0 -13
  82. package/dist/generators/working-spec.d.ts.map +0 -1
  83. package/dist/index.d.ts +0 -5
  84. package/dist/index.d.ts.map +0 -1
  85. package/dist/minimal-cli.d.ts +0 -3
  86. package/dist/minimal-cli.d.ts.map +0 -1
  87. package/dist/policy/PolicyManager.d.ts +0 -104
  88. package/dist/policy/PolicyManager.d.ts.map +0 -1
  89. package/dist/scaffold/cursor-hooks.d.ts +0 -7
  90. package/dist/scaffold/cursor-hooks.d.ts.map +0 -1
  91. package/dist/scaffold/git-hooks.d.ts +0 -20
  92. package/dist/scaffold/git-hooks.d.ts.map +0 -1
  93. package/dist/scaffold/index.d.ts +0 -20
  94. package/dist/scaffold/index.d.ts.map +0 -1
  95. package/dist/spec/SpecFileManager.d.ts +0 -146
  96. package/dist/spec/SpecFileManager.d.ts.map +0 -1
  97. package/dist/test-analysis.d.ts +0 -182
  98. package/dist/test-analysis.d.ts.map +0 -1
  99. package/dist/tool-interface.d.ts +0 -236
  100. package/dist/tool-interface.d.ts.map +0 -1
  101. package/dist/tool-loader.d.ts +0 -77
  102. package/dist/tool-loader.d.ts.map +0 -1
  103. package/dist/tool-validator.d.ts +0 -72
  104. package/dist/tool-validator.d.ts.map +0 -1
  105. package/dist/utils/detection.d.ts +0 -7
  106. package/dist/utils/detection.d.ts.map +0 -1
  107. package/dist/utils/finalization.d.ts +0 -17
  108. package/dist/utils/finalization.d.ts.map +0 -1
  109. package/dist/utils/project-analysis.d.ts +0 -14
  110. package/dist/utils/project-analysis.d.ts.map +0 -1
  111. package/dist/utils/typescript-detector.d.ts +0 -63
  112. package/dist/utils/typescript-detector.d.ts.map +0 -1
  113. package/dist/validation/spec-validation.d.ts +0 -43
  114. package/dist/validation/spec-validation.d.ts.map +0 -1
  115. package/dist/waivers-manager.d.ts +0 -167
  116. package/dist/waivers-manager.d.ts.map +0 -1
  117. package/templates/.cursor/rules/03-infrastructure-standards.mdc +0 -251
  118. package/templates/.cursor/rules/04-documentation-integrity.mdc +0 -291
  119. package/templates/.cursor/rules/05-production-readiness-checklist.mdc +0 -214
@@ -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
+ };