@paths.design/caws-cli 5.0.1 → 5.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.
Files changed (115) hide show
  1. package/README.md +15 -12
  2. package/dist/budget-derivation.d.ts +74 -0
  3. package/dist/budget-derivation.d.ts.map +1 -0
  4. package/dist/cicd-optimizer.d.ts +142 -0
  5. package/dist/cicd-optimizer.d.ts.map +1 -0
  6. package/dist/commands/archive.d.ts +50 -0
  7. package/dist/commands/archive.d.ts.map +1 -0
  8. package/dist/commands/burnup.d.ts +6 -0
  9. package/dist/commands/burnup.d.ts.map +1 -0
  10. package/dist/commands/diagnose.d.ts +52 -0
  11. package/dist/commands/diagnose.d.ts.map +1 -0
  12. package/dist/commands/evaluate.d.ts +8 -0
  13. package/dist/commands/evaluate.d.ts.map +1 -0
  14. package/dist/commands/init.d.ts +5 -0
  15. package/dist/commands/init.d.ts.map +1 -0
  16. package/dist/commands/iterate.d.ts +8 -0
  17. package/dist/commands/iterate.d.ts.map +1 -0
  18. package/dist/commands/mode.d.ts +24 -0
  19. package/dist/commands/mode.d.ts.map +1 -0
  20. package/dist/commands/plan.d.ts +49 -0
  21. package/dist/commands/plan.d.ts.map +1 -0
  22. package/dist/commands/provenance.d.ts +32 -0
  23. package/dist/commands/provenance.d.ts.map +1 -0
  24. package/dist/commands/provenance.js +27 -22
  25. package/dist/commands/quality-gates.d.ts +52 -0
  26. package/dist/commands/quality-gates.d.ts.map +1 -0
  27. package/dist/commands/quality-gates.js +190 -455
  28. package/dist/commands/quality-monitor.d.ts +17 -0
  29. package/dist/commands/quality-monitor.d.ts.map +1 -0
  30. package/dist/commands/specs.d.ts +71 -0
  31. package/dist/commands/specs.d.ts.map +1 -0
  32. package/dist/commands/specs.js +34 -35
  33. package/dist/commands/status.d.ts +44 -0
  34. package/dist/commands/status.d.ts.map +1 -0
  35. package/dist/commands/status.js +10 -7
  36. package/dist/commands/templates.d.ts +74 -0
  37. package/dist/commands/templates.d.ts.map +1 -0
  38. package/dist/commands/tool.d.ts +13 -0
  39. package/dist/commands/tool.d.ts.map +1 -0
  40. package/dist/commands/tool.js +63 -63
  41. package/dist/commands/troubleshoot.d.ts +8 -0
  42. package/dist/commands/troubleshoot.d.ts.map +1 -0
  43. package/dist/commands/tutorial.d.ts +55 -0
  44. package/dist/commands/tutorial.d.ts.map +1 -0
  45. package/dist/commands/validate.d.ts +15 -0
  46. package/dist/commands/validate.d.ts.map +1 -0
  47. package/dist/commands/waivers.d.ts +8 -0
  48. package/dist/commands/waivers.d.ts.map +1 -0
  49. package/dist/commands/waivers.js +38 -39
  50. package/dist/commands/workflow.d.ts +85 -0
  51. package/dist/commands/workflow.d.ts.map +1 -0
  52. package/dist/config/index.d.ts +29 -0
  53. package/dist/config/index.d.ts.map +1 -0
  54. package/dist/config/modes.d.ts +225 -0
  55. package/dist/config/modes.d.ts.map +1 -0
  56. package/dist/constants/spec-types.d.ts +41 -0
  57. package/dist/constants/spec-types.d.ts.map +1 -0
  58. package/dist/error-handler.d.ts +164 -0
  59. package/dist/error-handler.d.ts.map +1 -0
  60. package/dist/generators/jest-config.d.ts +32 -0
  61. package/dist/generators/jest-config.d.ts.map +1 -0
  62. package/dist/generators/working-spec.d.ts +13 -0
  63. package/dist/generators/working-spec.d.ts.map +1 -0
  64. package/dist/index-new.d.ts +5 -0
  65. package/dist/index-new.d.ts.map +1 -0
  66. package/dist/index-new.js +317 -0
  67. package/dist/index.d.ts +5 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +1 -0
  70. package/dist/index.js.backup +4711 -0
  71. package/dist/minimal-cli.d.ts +3 -0
  72. package/dist/minimal-cli.d.ts.map +1 -0
  73. package/dist/policy/PolicyManager.d.ts +104 -0
  74. package/dist/policy/PolicyManager.d.ts.map +1 -0
  75. package/dist/policy/PolicyManager.js +60 -28
  76. package/dist/scaffold/cursor-hooks.d.ts +7 -0
  77. package/dist/scaffold/cursor-hooks.d.ts.map +1 -0
  78. package/dist/scaffold/git-hooks.d.ts +20 -0
  79. package/dist/scaffold/git-hooks.d.ts.map +1 -0
  80. package/dist/scaffold/git-hooks.js +89 -27
  81. package/dist/scaffold/index.d.ts +20 -0
  82. package/dist/scaffold/index.d.ts.map +1 -0
  83. package/dist/scaffold/index.js +25 -0
  84. package/dist/spec/SpecFileManager.d.ts +146 -0
  85. package/dist/spec/SpecFileManager.d.ts.map +1 -0
  86. package/dist/test-analysis.d.ts +182 -0
  87. package/dist/test-analysis.d.ts.map +1 -0
  88. package/dist/tool-interface.d.ts +236 -0
  89. package/dist/tool-interface.d.ts.map +1 -0
  90. package/dist/tool-loader.d.ts +77 -0
  91. package/dist/tool-loader.d.ts.map +1 -0
  92. package/dist/tool-validator.d.ts +72 -0
  93. package/dist/tool-validator.d.ts.map +1 -0
  94. package/dist/utils/async-utils.js +188 -0
  95. package/dist/utils/command-wrapper.js +200 -0
  96. package/dist/utils/detection.d.ts +7 -0
  97. package/dist/utils/detection.d.ts.map +1 -0
  98. package/dist/utils/finalization.d.ts +17 -0
  99. package/dist/utils/finalization.d.ts.map +1 -0
  100. package/dist/utils/project-analysis.d.ts +14 -0
  101. package/dist/utils/project-analysis.d.ts.map +1 -0
  102. package/dist/utils/promise-utils.js +72 -0
  103. package/dist/utils/quality-gates.d.ts +49 -0
  104. package/dist/utils/quality-gates.d.ts.map +1 -0
  105. package/dist/utils/spec-resolver.d.ts +88 -0
  106. package/dist/utils/spec-resolver.d.ts.map +1 -0
  107. package/dist/utils/typescript-detector.d.ts +63 -0
  108. package/dist/utils/typescript-detector.d.ts.map +1 -0
  109. package/dist/validation/spec-validation.d.ts +43 -0
  110. package/dist/validation/spec-validation.d.ts.map +1 -0
  111. package/dist/waivers-manager.d.ts +167 -0
  112. package/dist/waivers-manager.d.ts.map +1 -0
  113. package/package.json +1 -1
  114. package/templates/apps/tools/caws/prompt-lint.js.backup +274 -0
  115. package/templates/apps/tools/caws/provenance.js.backup +73 -0
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Quality monitor command handler
3
+ *
4
+ * @param {string} action - Type of action to monitor
5
+ * @param {object} options - Command options
6
+ */
7
+ export function qualityMonitorCommand(action: string, options?: object): Promise<void>;
8
+ /**
9
+ * Analyze quality impact of an action
10
+ *
11
+ * @param {string} action - Type of action (file_saved, code_edited, test_run)
12
+ * @param {array} files - Files affected by the action
13
+ * @param {object} context - Additional context information
14
+ * @returns {object} Quality analysis
15
+ */
16
+ export function analyzeQualityImpact(action: string, files?: any[], context?: object): object;
17
+ //# sourceMappingURL=quality-monitor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quality-monitor.d.ts","sourceRoot":"","sources":["../../src/commands/quality-monitor.js"],"names":[],"mappings":"AAoIA;;;;;GAKG;AACH,8CAHW,MAAM,YACN,MAAM,iBA2HhB;AArPD;;;;;;;GAOG;AACH,6CALW,MAAM,2BAEN,MAAM,GACJ,MAAM,CA8GlB"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Specs command handler
3
+ * @param {string} action - Action to perform (list, create, show, update, delete, conflicts, migrate)
4
+ * @param {Object} options - Command options
5
+ */
6
+ export function specsCommand(action: string, options?: any): Promise<any>;
7
+ /**
8
+ * Load specs registry
9
+ * @returns {Promise<Object>} Registry data
10
+ */
11
+ export function loadSpecsRegistry(): Promise<any>;
12
+ /**
13
+ * Save specs registry
14
+ * @param {Object} registry - Registry data
15
+ * @returns {Promise<void>}
16
+ */
17
+ export function saveSpecsRegistry(registry: any): Promise<void>;
18
+ /**
19
+ * List all spec files in the specs directory
20
+ * @returns {Promise<Array>} Array of spec file info
21
+ */
22
+ export function listSpecFiles(): Promise<any[]>;
23
+ /**
24
+ * Create a new spec file
25
+ * @param {string} id - Spec identifier
26
+ * @param {Object} options - Creation options
27
+ * @returns {Promise<Object>} Created spec info
28
+ */
29
+ export function createSpec(id: string, options?: any): Promise<any>;
30
+ /**
31
+ * Load a specific spec file
32
+ * @param {string} id - Spec identifier
33
+ * @returns {Promise<Object|null>} Spec data or null
34
+ */
35
+ export function loadSpec(id: string): Promise<any | null>;
36
+ /**
37
+ * Update a spec file
38
+ * @param {string} id - Spec identifier
39
+ * @param {Object} updates - Updates to apply
40
+ * @returns {Promise<boolean>} Success status
41
+ */
42
+ export function updateSpec(id: string, updates?: any): Promise<boolean>;
43
+ /**
44
+ * Delete a spec file
45
+ * @param {string} id - Spec identifier
46
+ * @returns {Promise<boolean>} Success status
47
+ */
48
+ export function deleteSpec(id: string): Promise<boolean>;
49
+ /**
50
+ * Display specs in a formatted table
51
+ * @param {Array} specs - Array of spec objects
52
+ */
53
+ export function displaySpecsTable(specs: any[]): void;
54
+ /**
55
+ * Display detailed spec information
56
+ * @param {Object} spec - Spec object
57
+ */
58
+ export function displaySpecDetails(spec: any): void;
59
+ /**
60
+ * Ask user how to resolve spec creation conflicts
61
+ * @returns {Promise<string>} User's choice: 'cancel', 'rename', 'merge', 'override'
62
+ */
63
+ export function askConflictResolution(): Promise<string>;
64
+ /**
65
+ * Specs directory structure
66
+ */
67
+ export const SPECS_DIR: ".caws/specs";
68
+ export const SPECS_REGISTRY: ".caws/specs/registry.json";
69
+ import { SPEC_TYPES } from "../constants/spec-types";
70
+ export { SPEC_TYPES };
71
+ //# sourceMappingURL=specs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specs.d.ts","sourceRoot":"","sources":["../../src/commands/specs.js"],"names":[],"mappings":"AAghBA;;;;GAIG;AACH,qCAHW,MAAM,+BA2LhB;AAvrBD;;;GAGG;AACH,qCAFa,OAAO,KAAQ,CAqB3B;AAED;;;;GAIG;AACH,kDAFa,OAAO,CAAC,IAAI,CAAC,CAMzB;AAED;;;GAGG;AACH,iCAFa,OAAO,OAAO,CAmC1B;AAED;;;;;GAKG;AACH,+BAJW,MAAM,kBAEJ,OAAO,KAAQ,CA8H3B;AAED;;;;GAIG;AACH,6BAHW,MAAM,GACJ,OAAO,CAAC,MAAO,IAAI,CAAC,CAiBhC;AAED;;;;;GAKG;AACH,+BAJW,MAAM,kBAEJ,OAAO,CAAC,OAAO,CAAC,CA6B5B;AAED;;;;GAIG;AACH,+BAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAmB5B;AAED;;;GAGG;AACH,sDA2CC;AAED;;;GAGG;AACH,oDAoCC;AAsFD;;;GAGG;AACH,yCAFa,OAAO,CAAC,MAAM,CAAC,CAuC3B;AA9fD;;GAEG;AACH,wBAAkB,aAAa,CAAC;AAChC,6BAAuB,2BAA2B,CAAC"}
@@ -9,6 +9,7 @@ const path = require('path');
9
9
  const yaml = require('js-yaml');
10
10
  const chalk = require('chalk');
11
11
  const { safeAsync, outputResult } = require('../error-handler');
12
+ const { question, closeReadline } = require('../utils/promise-utils');
12
13
  const { SPEC_TYPES } = require('../constants/spec-types');
13
14
 
14
15
  // Import suggestFeatureBreakdown from spec-resolver
@@ -488,42 +489,40 @@ async function migrateFromLegacy(options = {}) {
488
489
  * @returns {Promise<string>} User's choice: 'cancel', 'rename', 'merge', 'override'
489
490
  */
490
491
  async function askConflictResolution() {
491
- return new Promise((resolve) => {
492
- const readline = require('readline');
493
-
494
- console.log(chalk.blue('\n🔄 Conflict Resolution Options:'));
495
- console.log(chalk.gray(" 1. Cancel - Don't create the spec"));
496
- console.log(chalk.gray(' 2. Rename - Create with auto-generated name'));
497
- console.log(chalk.gray(' 3. Merge - Merge with existing spec (not implemented)'));
498
- console.log(chalk.gray(' 4. Override - Replace existing spec (use --force)'));
499
-
500
- console.log(chalk.yellow('\nEnter your choice (1-4) or the option name:'));
501
-
502
- const rl = readline.createInterface({
503
- input: process.stdin,
504
- output: process.stdout,
505
- });
506
-
507
- rl.question('> ', (answer) => {
508
- rl.close();
509
-
510
- const trimmed = answer.trim().toLowerCase();
511
-
512
- // Handle numeric choices
513
- if (trimmed === '1' || trimmed === 'cancel') {
514
- resolve('cancel');
515
- } else if (trimmed === '2' || trimmed === 'rename') {
516
- resolve('rename');
517
- } else if (trimmed === '3' || trimmed === 'merge') {
518
- resolve('merge');
519
- } else if (trimmed === '4' || trimmed === 'override') {
520
- resolve('override');
521
- } else {
522
- console.log(chalk.red('❌ Invalid choice. Defaulting to cancel.'));
523
- resolve('cancel');
524
- }
525
- });
492
+ const readline = require('readline');
493
+
494
+ console.log(chalk.blue('\n🔄 Conflict Resolution Options:'));
495
+ console.log(chalk.gray(" 1. Cancel - Don't create the spec"));
496
+ console.log(chalk.gray(' 2. Rename - Create with auto-generated name'));
497
+ console.log(chalk.gray(' 3. Merge - Merge with existing spec (not implemented)'));
498
+ console.log(chalk.gray(' 4. Override - Replace existing spec (use --force)'));
499
+ console.log(chalk.yellow('\nEnter your choice (1-4) or the option name:'));
500
+
501
+ const rl = readline.createInterface({
502
+ input: process.stdin,
503
+ output: process.stdout,
526
504
  });
505
+
506
+ try {
507
+ const answer = await question(rl, '> ');
508
+ const trimmed = answer.trim().toLowerCase();
509
+
510
+ // Handle numeric choices
511
+ if (trimmed === '1' || trimmed === 'cancel') {
512
+ return 'cancel';
513
+ } else if (trimmed === '2' || trimmed === 'rename') {
514
+ return 'rename';
515
+ } else if (trimmed === '3' || trimmed === 'merge') {
516
+ return 'merge';
517
+ } else if (trimmed === '4' || trimmed === 'override') {
518
+ return 'override';
519
+ } else {
520
+ console.log(chalk.red('❌ Invalid choice. Defaulting to cancel.'));
521
+ return 'cancel';
522
+ }
523
+ } finally {
524
+ await closeReadline(rl);
525
+ }
527
526
  }
528
527
 
529
528
  /**
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Status command handler
3
+ * @param {Object} options - Command options
4
+ */
5
+ export function statusCommand(options?: any): Promise<any>;
6
+ /**
7
+ * Load working specification (legacy single file approach)
8
+ * @param {string} specPath - Path to working spec
9
+ * @returns {Promise<Object|null>} Parsed spec or null
10
+ */
11
+ export function loadWorkingSpec(specPath?: string): Promise<any | null>;
12
+ /**
13
+ * Check Git hooks status
14
+ * @returns {Promise<Object>} Hooks status
15
+ */
16
+ export function checkGitHooks(): Promise<any>;
17
+ /**
18
+ * Load provenance chain
19
+ * @returns {Promise<Object>} Provenance status
20
+ */
21
+ export function loadProvenanceChain(): Promise<any>;
22
+ /**
23
+ * Load waiver status
24
+ * @returns {Promise<Object>} Waiver status
25
+ */
26
+ export function loadWaiverStatus(): Promise<any>;
27
+ /**
28
+ * Check quality gates status (simplified)
29
+ * @returns {Promise<Object>} Quality gates status
30
+ */
31
+ export function checkQualityGates(): Promise<any>;
32
+ /**
33
+ * Display project status
34
+ * @param {Object} data - Status data
35
+ */
36
+ export function displayStatus(data: any): void;
37
+ /**
38
+ * Generate actionable suggestions based on status and mode
39
+ * @param {Object} data - Status data
40
+ * @param {string} currentMode - Current CAWS mode
41
+ * @returns {string[]} Array of suggestions
42
+ */
43
+ export function generateSuggestions(data: any, currentMode: string): string[];
44
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.js"],"names":[],"mappings":"AA6uBA;;;GAGG;AACH,2DA6IC;AAl3BD;;;;GAIG;AACH,2CAHW,MAAM,GACJ,OAAO,CAAC,MAAO,IAAI,CAAC,CAahC;AAgBD;;;GAGG;AACH,iCAFa,OAAO,KAAQ,CAgC3B;AAED;;;GAGG;AACH,uCAFa,OAAO,KAAQ,CA+B3B;AAED;;;GAGG;AACH,oCAFa,OAAO,KAAQ,CA0D3B;AAED;;;GAGG;AACH,qCAFa,OAAO,KAAQ,CAS3B;AAwBD;;;GAGG;AACH,+CAgGC;AAED;;;;;GAKG;AACH,4DAHW,MAAM,GACJ,MAAM,EAAE,CAoCpB"}
@@ -9,6 +9,7 @@ const path = require('path');
9
9
  const yaml = require('js-yaml');
10
10
  const chalk = require('chalk');
11
11
  const { safeAsync, outputResult } = require('../error-handler');
12
+ const { parallel } = require('../utils/async-utils');
12
13
 
13
14
  /**
14
15
  * Load working specification (legacy single file approach)
@@ -758,13 +759,15 @@ async function statusCommand(options = {}) {
758
759
  const modes = require('../config/modes');
759
760
  const currentMode = await modes.getCurrentMode();
760
761
 
761
- // Load all status data
762
- const spec = await loadWorkingSpec(options.spec || '.caws/working-spec.yaml');
763
- const specs = await loadSpecsFromMultiSpec();
764
- const hooks = await checkGitHooks();
765
- const provenance = await loadProvenanceChain();
766
- const waivers = await loadWaiverStatus();
767
- const gates = await checkQualityGates();
762
+ // Load all status data in parallel for better performance
763
+ const [spec, specs, hooks, provenance, waivers, gates] = await parallel([
764
+ () => loadWorkingSpec(options.spec || '.caws/working-spec.yaml'),
765
+ () => loadSpecsFromMultiSpec(),
766
+ () => checkGitHooks(),
767
+ () => loadProvenanceChain(),
768
+ () => loadWaiverStatus(),
769
+ () => checkQualityGates(),
770
+ ]);
768
771
 
769
772
  // Display status (visual mode if requested)
770
773
  if (options.visual || options.json) {
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Templates command handler
3
+ * @param {string} subcommand - Subcommand (list, info)
4
+ * @param {Object} options - Command options
5
+ */
6
+ export function templatesCommand(subcommand?: string, options?: any): Promise<void>;
7
+ /**
8
+ * List all available templates
9
+ */
10
+ export function listTemplates(): void;
11
+ /**
12
+ * Show detailed template information
13
+ * @param {string} templateId - Template ID
14
+ */
15
+ export function showTemplateInfo(templateId: string): void;
16
+ /**
17
+ * Check which templates actually exist
18
+ * @returns {Object} Available templates
19
+ */
20
+ export function getAvailableTemplates(): any;
21
+ /**
22
+ * Built-in template definitions
23
+ */
24
+ export const BUILTIN_TEMPLATES: {
25
+ 'typescript-library': {
26
+ name: string;
27
+ description: string;
28
+ category: string;
29
+ tier: number;
30
+ features: string[];
31
+ path: string;
32
+ };
33
+ 'typescript-api': {
34
+ name: string;
35
+ description: string;
36
+ category: string;
37
+ tier: number;
38
+ features: string[];
39
+ path: string;
40
+ };
41
+ 'typescript-monorepo': {
42
+ name: string;
43
+ description: string;
44
+ category: string;
45
+ tier: number;
46
+ features: string[];
47
+ path: string;
48
+ };
49
+ 'javascript-package': {
50
+ name: string;
51
+ description: string;
52
+ category: string;
53
+ tier: number;
54
+ features: string[];
55
+ path: string;
56
+ };
57
+ 'react-component-lib': {
58
+ name: string;
59
+ description: string;
60
+ category: string;
61
+ tier: number;
62
+ features: string[];
63
+ path: string;
64
+ };
65
+ 'vscode-extension': {
66
+ name: string;
67
+ description: string;
68
+ category: string;
69
+ tier: number;
70
+ features: string[];
71
+ path: string;
72
+ };
73
+ };
74
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/commands/templates.js"],"names":[],"mappings":"AAoMA;;;;GAIG;AACH,8CAHW,MAAM,gCA4BhB;AAvHD;;GAEG;AACH,sCAuCC;AAED;;;GAGG;AACH,6CAFW,MAAM,QAyChB;AA9GD;;;GAGG;AACH,6CAiBC;AA/FD;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDE"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Initialize tool system
3
+ * @returns {Promise<ToolLoader|null>} Initialized tool loader or null if failed
4
+ */
5
+ export function initializeToolSystem(): Promise<ToolLoader | null>;
6
+ /**
7
+ * Execute tool command handler
8
+ * @param {string} toolId - ID of the tool to execute
9
+ * @param {Object} options - Command options
10
+ */
11
+ export function executeTool(toolId: string, options: any): Promise<void>;
12
+ import ToolLoader = require("../tool-loader");
13
+ //# sourceMappingURL=tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/commands/tool.js"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,wCAFa,OAAO,CAAC,UAAU,GAAC,IAAI,CAAC,CAoCpC;AAED;;;;GAIG;AACH,oCAHW,MAAM,+BAyEhB"}
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  const path = require('path');
8
- const chalk = require('chalk');
8
+ const { commandWrapper, Output } = require('../utils/command-wrapper');
9
9
 
10
10
  // Import tool system
11
11
  const ToolLoader = require('../tool-loader');
@@ -32,16 +32,19 @@ async function initializeToolSystem() {
32
32
  // Set up event listeners for tool system
33
33
  toolLoader.on('discovery:complete', ({ tools: _tools, count }) => {
34
34
  if (count > 0) {
35
- console.log(chalk.blue(`🔧 Discovered ${count} tools`));
35
+ Output.info(`Discovered ${count} tools`);
36
36
  }
37
37
  });
38
38
 
39
39
  toolLoader.on('tool:loaded', ({ id, metadata }) => {
40
- console.log(chalk.gray(` ✓ Loaded tool: ${metadata.name} (${id})`));
40
+ // Only log in verbose mode or when not using JSON output
41
+ if (!process.env.CAWS_OUTPUT_FORMAT || process.env.CAWS_OUTPUT_FORMAT !== 'json') {
42
+ console.log(` ✓ Loaded tool: ${metadata.name} (${id})`);
43
+ }
41
44
  });
42
45
 
43
46
  toolLoader.on('tool:error', ({ id, error }) => {
44
- console.warn(chalk.yellow(`⚠️ Failed to load tool ${id}: ${error}`));
47
+ Output.warning(`Failed to load tool ${id}: ${error}`);
45
48
  });
46
49
 
47
50
  // Auto-discover tools on initialization
@@ -49,8 +52,10 @@ async function initializeToolSystem() {
49
52
 
50
53
  return toolLoader;
51
54
  } catch (error) {
52
- console.warn(chalk.yellow('⚠️ Tool system initialization failed:'), error.message);
53
- console.warn(chalk.blue('💡 Continuing without dynamic tools'));
55
+ Output.warning(
56
+ `Tool system initialization failed: ${error.message}`,
57
+ 'Continuing without dynamic tools'
58
+ );
54
59
  return null;
55
60
  }
56
61
  }
@@ -61,75 +66,70 @@ async function initializeToolSystem() {
61
66
  * @param {Object} options - Command options
62
67
  */
63
68
  async function executeTool(toolId, options) {
64
- try {
65
- // Initialize tool system
66
- const loader = await initializeToolSystem();
69
+ return commandWrapper(
70
+ async () => {
71
+ // Initialize tool system
72
+ const loader = await initializeToolSystem();
67
73
 
68
- if (!loader) {
69
- console.error(chalk.red('Tool system not available'));
70
- process.exit(1);
71
- }
74
+ if (!loader) {
75
+ throw new Error('Tool system not available');
76
+ }
72
77
 
73
- // Load all tools first
74
- await loader.loadAllTools();
75
- const tool = loader.getTool(toolId);
78
+ // Load all tools first
79
+ await loader.loadAllTools();
80
+ const tool = loader.getTool(toolId);
76
81
 
77
- if (!tool) {
78
- console.error(chalk.red(`❌ Tool '${toolId}' not found`));
79
- console.log(chalk.blue('💡 Available tools:'));
80
- const tools = loader.getAllTools();
81
- for (const [id, t] of tools) {
82
- console.log(` - ${id}: ${t.metadata.name}`);
82
+ if (!tool) {
83
+ const tools = loader.getAllTools();
84
+ const availableTools = Array.from(tools, ([id, t]) => `${id}: ${t.metadata.name}`).join(
85
+ ', '
86
+ );
87
+ throw new Error(`Tool '${toolId}' not found.\n` + `Available tools: ${availableTools}`);
83
88
  }
84
- process.exit(1);
85
- }
86
89
 
87
- // Validate tool before execution
88
- const validation = await toolValidator.validateTool(tool);
89
- if (!validation.valid) {
90
- console.error(chalk.red('❌ Tool validation failed:'));
91
- validation.errors.forEach((error) => {
92
- console.error(` ${chalk.red('✗')} ${error}`);
93
- });
94
- process.exit(1);
95
- }
90
+ // Validate tool before execution
91
+ const validation = await toolValidator.validateTool(tool);
92
+ if (!validation.valid) {
93
+ throw new Error(
94
+ `Tool validation failed:\n` + validation.errors.map((e) => ` - ${e}`).join('\n')
95
+ );
96
+ }
96
97
 
97
- // Parse parameters
98
- let params = {};
99
- if (options.params) {
100
- try {
101
- params = JSON.parse(options.params);
102
- } catch (error) {
103
- console.error(chalk.red('❌ Invalid JSON parameters:'), error.message);
104
- process.exit(1);
98
+ // Parse parameters
99
+ let params = {};
100
+ if (options.params) {
101
+ try {
102
+ params = JSON.parse(options.params);
103
+ } catch (error) {
104
+ throw new Error(`Invalid JSON parameters: ${error.message}`);
105
+ }
105
106
  }
106
- }
107
107
 
108
- console.log(chalk.blue(`🚀 Executing tool: ${tool.metadata.name}`));
108
+ Output.progress(`Executing tool: ${tool.metadata.name}`);
109
109
 
110
- // Execute tool
111
- const result = await tool.module.execute(params, {
112
- workingDirectory: process.cwd(),
113
- timeout: options.timeout,
114
- });
110
+ // Execute tool
111
+ const result = await tool.module.execute(params, {
112
+ workingDirectory: process.cwd(),
113
+ timeout: options.timeout,
114
+ });
115
115
 
116
- // Display results
117
- if (result.success) {
118
- console.log(chalk.green('Tool execution successful'));
119
- if (result.output && typeof result.output === 'object') {
120
- console.log(chalk.gray('Output:'), JSON.stringify(result.output, null, 2));
116
+ // Display results
117
+ if (result.success) {
118
+ Output.success('Tool execution successful', {
119
+ output: result.output,
120
+ });
121
+ return result;
122
+ } else {
123
+ throw new Error(
124
+ `Tool execution failed:\n` + result.errors.map((e) => ` - ${e}`).join('\n')
125
+ );
121
126
  }
122
- } else {
123
- console.error(chalk.red('❌ Tool execution failed'));
124
- result.errors.forEach((error) => {
125
- console.error(` ${chalk.red('✗')} ${error}`);
126
- });
127
- process.exit(1);
127
+ },
128
+ {
129
+ commandName: `tool ${toolId}`,
130
+ context: { toolId, options },
128
131
  }
129
- } catch (error) {
130
- console.error(chalk.red(`❌ Error executing tool ${toolId}:`), error.message);
131
- process.exit(1);
132
- }
132
+ );
133
133
  }
134
134
 
135
135
  module.exports = {
@@ -0,0 +1,8 @@
1
+ export = troubleshootCommand;
2
+ /**
3
+ * Troubleshoot command handler
4
+ * @param {string} guide - Guide key argument
5
+ * @param {Object} options - Command options
6
+ */
7
+ declare function troubleshootCommand(guide: string, options: any): void;
8
+ //# sourceMappingURL=troubleshoot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"troubleshoot.d.ts","sourceRoot":"","sources":["../../src/commands/troubleshoot.js"],"names":[],"mappings":";AAqFA;;;;GAIG;AACH,4CAHW,MAAM,sBAchB"}
@@ -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,15 @@
1
+ /**
2
+ * Validate command handler
3
+ * Enhanced with multi-spec support and JSON output format
4
+ * @param {string} specFile - Path to spec file (optional, uses spec resolution)
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)
9
+ */
10
+ export function validateCommand(specFile: string, options?: {
11
+ specId?: string;
12
+ interactive?: boolean;
13
+ format?: boolean;
14
+ }): Promise<void>;
15
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Waivers command handler
3
+ *
4
+ * @param {string} subcommand - create, list, show, revoke
5
+ * @param {object} options - Command options
6
+ */
7
+ export function waiversCommand(subcommand?: string, options?: object): Promise<void>;
8
+ //# sourceMappingURL=waivers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waivers.d.ts","sourceRoot":"","sources":["../../src/commands/waivers.js"],"names":[],"mappings":"AAmBA;;;;;GAKG;AACH,4CAHW,MAAM,YACN,MAAM,iBA2ChB"}