@paths.design/caws-cli 9.3.2 → 10.0.1

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 (273) hide show
  1. package/README.md +58 -27
  2. package/dist/commands/archive.js +67 -28
  3. package/dist/commands/burnup.js +20 -11
  4. package/dist/commands/diagnose.js +34 -22
  5. package/dist/commands/evaluate.js +27 -15
  6. package/dist/commands/gates.js +122 -0
  7. package/dist/commands/init.js +143 -15
  8. package/dist/commands/iterate.js +77 -4
  9. package/dist/commands/parallel.js +4 -0
  10. package/dist/commands/plan.js +9 -19
  11. package/dist/commands/provenance.js +53 -17
  12. package/dist/commands/quality-monitor.js +64 -45
  13. package/dist/commands/sidecar.js +71 -0
  14. package/dist/commands/specs.js +233 -44
  15. package/dist/commands/status.js +113 -9
  16. package/dist/commands/tutorial.js +10 -9
  17. package/dist/commands/validate.js +49 -6
  18. package/dist/commands/verify-acs.js +35 -78
  19. package/dist/commands/waivers.js +69 -12
  20. package/dist/commands/worktree.js +50 -25
  21. package/dist/error-handler.js +2 -13
  22. package/dist/gates/budget-limit.js +116 -0
  23. package/dist/gates/feedback.js +260 -0
  24. package/dist/gates/format.js +179 -0
  25. package/dist/gates/god-object.js +117 -0
  26. package/dist/gates/pipeline.js +167 -0
  27. package/dist/gates/scope-boundary.js +93 -0
  28. package/dist/gates/spec-completeness.js +102 -0
  29. package/dist/gates/todo-detection.js +205 -0
  30. package/dist/index.js +130 -151
  31. package/dist/parallel/parallel-manager.js +3 -3
  32. package/dist/policy/PolicyManager.js +42 -10
  33. package/dist/scaffold/claude-hooks.js +24 -1
  34. package/dist/scaffold/git-hooks.js +45 -102
  35. package/dist/scaffold/index.js +4 -3
  36. package/dist/session/session-manager.js +71 -14
  37. package/dist/sidecars/index.js +33 -0
  38. package/dist/sidecars/listeners.js +40 -0
  39. package/dist/sidecars/provenance-summary.js +238 -0
  40. package/dist/sidecars/quality-gaps.js +258 -0
  41. package/dist/sidecars/schema.js +149 -0
  42. package/dist/sidecars/spec-drift.js +151 -0
  43. package/dist/sidecars/waiver-draft.js +176 -0
  44. package/dist/templates/.caws/schemas/policy.schema.json +50 -0
  45. package/dist/templates/.caws/schemas/waivers.schema.json +30 -24
  46. package/dist/templates/.caws/schemas/working-spec.schema.json +51 -8
  47. package/dist/templates/.caws/schemas/worktrees.schema.json +3 -1
  48. package/dist/templates/.caws/templates/working-spec.template.yml +7 -3
  49. package/dist/templates/.claude/hooks/audit.sh +0 -0
  50. package/dist/templates/.claude/hooks/block-dangerous.sh +52 -11
  51. package/dist/templates/.claude/hooks/classify_command.py +592 -0
  52. package/dist/templates/.claude/hooks/doc-frontmatter-check.sh +173 -0
  53. package/dist/templates/.claude/hooks/quality-check.sh +23 -10
  54. package/dist/templates/.claude/hooks/scope-guard.sh +34 -32
  55. package/dist/templates/.claude/hooks/session-caws-status.sh +2 -2
  56. package/dist/templates/.claude/hooks/session-log.sh +76 -3
  57. package/dist/templates/.claude/hooks/stop-worktree-check.sh +1 -1
  58. package/dist/templates/.claude/hooks/test_classify_command.py +370 -0
  59. package/dist/templates/.claude/hooks/test_wrapper_smoke.sh +96 -0
  60. package/dist/templates/.claude/hooks/worktree-guard.sh +2 -2
  61. package/dist/templates/.claude/hooks/worktree-write-guard.sh +1 -1
  62. package/dist/templates/.claude/settings.json +26 -0
  63. package/dist/templates/.cursor/hooks/caws-quality-check.sh +4 -4
  64. package/dist/templates/.cursor/hooks/caws-scope-guard.sh +1 -1
  65. package/dist/templates/.cursor/hooks/session-log.sh +924 -0
  66. package/dist/templates/.cursor/hooks.json +25 -0
  67. package/dist/templates/.cursor/rules/02-quality-gates.mdc +3 -5
  68. package/dist/templates/.cursor/rules/10-documentation-quality-standards.mdc +6 -11
  69. package/dist/templates/.cursor/rules/11-scope-management-waivers.mdc +14 -18
  70. package/dist/templates/.cursor/rules/12-implementation-completeness.mdc +4 -4
  71. package/dist/templates/.cursor/rules/13-language-agnostic-standards.mdc +3 -13
  72. package/dist/templates/.github/copilot-instructions.md +5 -5
  73. package/dist/templates/.idea/runConfigurations/CAWS_Evaluate.xml +1 -1
  74. package/dist/templates/.junie/guidelines.md +2 -2
  75. package/dist/templates/.vscode/settings.json +3 -1
  76. package/dist/templates/.windsurf/rules/caws-quality-standards.md +2 -2
  77. package/dist/templates/.windsurf/workflows/caws-guided-development.md +3 -3
  78. package/dist/templates/CLAUDE.md +43 -8
  79. package/dist/templates/agents.md +29 -9
  80. package/dist/templates/docs/README.md +8 -7
  81. package/dist/templates/scripts/new_feature.sh +80 -0
  82. package/dist/test-analysis.js +43 -30
  83. package/dist/tool-loader.js +1 -1
  84. package/dist/utils/agent-session.js +202 -0
  85. package/dist/utils/detection.js +8 -2
  86. package/dist/utils/finalization.js +7 -6
  87. package/dist/utils/gitignore-updater.js +3 -0
  88. package/dist/utils/lifecycle-events.js +94 -0
  89. package/dist/utils/quality-gates-utils.js +29 -44
  90. package/dist/utils/schema-validator.js +42 -0
  91. package/dist/utils/spec-resolver.js +93 -21
  92. package/dist/utils/working-state.js +505 -0
  93. package/dist/validation/spec-validation.js +92 -22
  94. package/dist/waivers-manager.js +60 -6
  95. package/dist/worktree/worktree-manager.js +390 -93
  96. package/package.json +6 -6
  97. package/templates/.caws/schemas/policy.schema.json +50 -0
  98. package/templates/.caws/schemas/waivers.schema.json +30 -24
  99. package/templates/.caws/schemas/working-spec.schema.json +51 -8
  100. package/templates/.caws/schemas/worktrees.schema.json +3 -1
  101. package/templates/.caws/templates/working-spec.template.yml +7 -3
  102. package/templates/.claude/hooks/block-dangerous.sh +52 -11
  103. package/templates/.claude/hooks/classify_command.py +592 -0
  104. package/templates/.claude/hooks/doc-frontmatter-check.sh +173 -0
  105. package/templates/.claude/hooks/quality-check.sh +23 -10
  106. package/templates/.claude/hooks/scope-guard.sh +34 -32
  107. package/templates/.claude/hooks/session-caws-status.sh +2 -2
  108. package/templates/.claude/hooks/session-log.sh +76 -3
  109. package/templates/.claude/hooks/stop-worktree-check.sh +1 -1
  110. package/templates/.claude/hooks/test_classify_command.py +370 -0
  111. package/templates/.claude/hooks/test_wrapper_smoke.sh +96 -0
  112. package/templates/.claude/hooks/worktree-guard.sh +2 -2
  113. package/templates/.claude/hooks/worktree-write-guard.sh +1 -1
  114. package/templates/.claude/settings.json +26 -0
  115. package/templates/.cursor/hooks/caws-quality-check.sh +4 -4
  116. package/templates/.cursor/hooks/caws-scope-guard.sh +1 -1
  117. package/templates/.cursor/hooks/session-log.sh +924 -0
  118. package/templates/.cursor/hooks.json +25 -0
  119. package/templates/.cursor/rules/02-quality-gates.mdc +3 -5
  120. package/templates/.cursor/rules/10-documentation-quality-standards.mdc +6 -11
  121. package/templates/.cursor/rules/11-scope-management-waivers.mdc +14 -18
  122. package/templates/.cursor/rules/12-implementation-completeness.mdc +4 -4
  123. package/templates/.cursor/rules/13-language-agnostic-standards.mdc +3 -13
  124. package/templates/.github/copilot-instructions.md +5 -5
  125. package/templates/.idea/runConfigurations/CAWS_Evaluate.xml +1 -1
  126. package/templates/.junie/guidelines.md +2 -2
  127. package/templates/.vscode/settings.json +3 -1
  128. package/templates/.windsurf/rules/caws-quality-standards.md +2 -2
  129. package/templates/.windsurf/workflows/caws-guided-development.md +3 -3
  130. package/templates/CLAUDE.md +43 -8
  131. package/templates/{AGENTS.md → agents.md} +29 -9
  132. package/templates/docs/README.md +8 -7
  133. package/templates/scripts/new_feature.sh +80 -0
  134. package/dist/budget-derivation.d.ts +0 -74
  135. package/dist/budget-derivation.d.ts.map +0 -1
  136. package/dist/cicd-optimizer.d.ts +0 -142
  137. package/dist/cicd-optimizer.d.ts.map +0 -1
  138. package/dist/commands/archive.d.ts +0 -51
  139. package/dist/commands/archive.d.ts.map +0 -1
  140. package/dist/commands/burnup.d.ts +0 -6
  141. package/dist/commands/burnup.d.ts.map +0 -1
  142. package/dist/commands/diagnose.d.ts +0 -52
  143. package/dist/commands/diagnose.d.ts.map +0 -1
  144. package/dist/commands/evaluate.d.ts +0 -8
  145. package/dist/commands/evaluate.d.ts.map +0 -1
  146. package/dist/commands/init.d.ts +0 -5
  147. package/dist/commands/init.d.ts.map +0 -1
  148. package/dist/commands/iterate.d.ts +0 -8
  149. package/dist/commands/iterate.d.ts.map +0 -1
  150. package/dist/commands/mode.d.ts +0 -25
  151. package/dist/commands/mode.d.ts.map +0 -1
  152. package/dist/commands/parallel.d.ts +0 -7
  153. package/dist/commands/parallel.d.ts.map +0 -1
  154. package/dist/commands/plan.d.ts +0 -49
  155. package/dist/commands/plan.d.ts.map +0 -1
  156. package/dist/commands/provenance.d.ts +0 -32
  157. package/dist/commands/provenance.d.ts.map +0 -1
  158. package/dist/commands/quality-gates.d.ts +0 -6
  159. package/dist/commands/quality-gates.d.ts.map +0 -1
  160. package/dist/commands/quality-gates.js +0 -444
  161. package/dist/commands/quality-monitor.d.ts +0 -17
  162. package/dist/commands/quality-monitor.d.ts.map +0 -1
  163. package/dist/commands/session.d.ts +0 -7
  164. package/dist/commands/session.d.ts.map +0 -1
  165. package/dist/commands/specs.d.ts +0 -77
  166. package/dist/commands/specs.d.ts.map +0 -1
  167. package/dist/commands/status.d.ts +0 -44
  168. package/dist/commands/status.d.ts.map +0 -1
  169. package/dist/commands/templates.d.ts +0 -74
  170. package/dist/commands/templates.d.ts.map +0 -1
  171. package/dist/commands/tool.d.ts +0 -13
  172. package/dist/commands/tool.d.ts.map +0 -1
  173. package/dist/commands/troubleshoot.d.ts +0 -8
  174. package/dist/commands/troubleshoot.d.ts.map +0 -1
  175. package/dist/commands/troubleshoot.js +0 -104
  176. package/dist/commands/tutorial.d.ts +0 -55
  177. package/dist/commands/tutorial.d.ts.map +0 -1
  178. package/dist/commands/validate.d.ts +0 -15
  179. package/dist/commands/validate.d.ts.map +0 -1
  180. package/dist/commands/waivers.d.ts +0 -8
  181. package/dist/commands/waivers.d.ts.map +0 -1
  182. package/dist/commands/workflow.d.ts +0 -85
  183. package/dist/commands/workflow.d.ts.map +0 -1
  184. package/dist/commands/worktree.d.ts +0 -7
  185. package/dist/commands/worktree.d.ts.map +0 -1
  186. package/dist/config/index.d.ts +0 -29
  187. package/dist/config/index.d.ts.map +0 -1
  188. package/dist/config/lite-scope.d.ts +0 -33
  189. package/dist/config/lite-scope.d.ts.map +0 -1
  190. package/dist/config/modes.d.ts +0 -264
  191. package/dist/config/modes.d.ts.map +0 -1
  192. package/dist/constants/spec-types.d.ts +0 -93
  193. package/dist/constants/spec-types.d.ts.map +0 -1
  194. package/dist/error-handler.d.ts +0 -151
  195. package/dist/error-handler.d.ts.map +0 -1
  196. package/dist/generators/jest-config-generator.d.ts +0 -32
  197. package/dist/generators/jest-config-generator.d.ts.map +0 -1
  198. package/dist/generators/jest-config.d.ts +0 -32
  199. package/dist/generators/jest-config.d.ts.map +0 -1
  200. package/dist/generators/jest-config.js +0 -242
  201. package/dist/generators/working-spec.d.ts +0 -13
  202. package/dist/generators/working-spec.d.ts.map +0 -1
  203. package/dist/index-new.d.ts +0 -5
  204. package/dist/index-new.d.ts.map +0 -1
  205. package/dist/index-new.js +0 -317
  206. package/dist/index.d.ts +0 -5
  207. package/dist/index.d.ts.map +0 -1
  208. package/dist/index.js.backup +0 -4711
  209. package/dist/minimal-cli.d.ts +0 -3
  210. package/dist/minimal-cli.d.ts.map +0 -1
  211. package/dist/parallel/parallel-manager.d.ts +0 -67
  212. package/dist/parallel/parallel-manager.d.ts.map +0 -1
  213. package/dist/policy/PolicyManager.d.ts +0 -104
  214. package/dist/policy/PolicyManager.d.ts.map +0 -1
  215. package/dist/scaffold/claude-hooks.d.ts +0 -28
  216. package/dist/scaffold/claude-hooks.d.ts.map +0 -1
  217. package/dist/scaffold/cursor-hooks.d.ts +0 -7
  218. package/dist/scaffold/cursor-hooks.d.ts.map +0 -1
  219. package/dist/scaffold/git-hooks.d.ts +0 -38
  220. package/dist/scaffold/git-hooks.d.ts.map +0 -1
  221. package/dist/scaffold/index.d.ts +0 -17
  222. package/dist/scaffold/index.d.ts.map +0 -1
  223. package/dist/session/session-manager.d.ts +0 -94
  224. package/dist/session/session-manager.d.ts.map +0 -1
  225. package/dist/spec/SpecFileManager.d.ts +0 -146
  226. package/dist/spec/SpecFileManager.d.ts.map +0 -1
  227. package/dist/templates/.cursor/hooks/caws-tool-validation.sh +0 -121
  228. package/dist/templates/.github/copilot/instructions.md +0 -311
  229. package/dist/test-analysis.d.ts +0 -231
  230. package/dist/test-analysis.d.ts.map +0 -1
  231. package/dist/tool-interface.d.ts +0 -236
  232. package/dist/tool-interface.d.ts.map +0 -1
  233. package/dist/tool-loader.d.ts +0 -77
  234. package/dist/tool-loader.d.ts.map +0 -1
  235. package/dist/tool-validator.d.ts +0 -72
  236. package/dist/tool-validator.d.ts.map +0 -1
  237. package/dist/utils/async-utils.d.ts +0 -73
  238. package/dist/utils/async-utils.d.ts.map +0 -1
  239. package/dist/utils/command-wrapper.d.ts +0 -66
  240. package/dist/utils/command-wrapper.d.ts.map +0 -1
  241. package/dist/utils/detection.d.ts +0 -14
  242. package/dist/utils/detection.d.ts.map +0 -1
  243. package/dist/utils/error-categories.d.ts +0 -52
  244. package/dist/utils/error-categories.d.ts.map +0 -1
  245. package/dist/utils/finalization.d.ts +0 -17
  246. package/dist/utils/finalization.d.ts.map +0 -1
  247. package/dist/utils/git-lock.d.ts +0 -13
  248. package/dist/utils/git-lock.d.ts.map +0 -1
  249. package/dist/utils/gitignore-updater.d.ts +0 -39
  250. package/dist/utils/gitignore-updater.d.ts.map +0 -1
  251. package/dist/utils/ide-detection.d.ts +0 -89
  252. package/dist/utils/ide-detection.d.ts.map +0 -1
  253. package/dist/utils/project-analysis.d.ts +0 -34
  254. package/dist/utils/project-analysis.d.ts.map +0 -1
  255. package/dist/utils/promise-utils.d.ts +0 -30
  256. package/dist/utils/promise-utils.d.ts.map +0 -1
  257. package/dist/utils/quality-gates-utils.d.ts +0 -49
  258. package/dist/utils/quality-gates-utils.d.ts.map +0 -1
  259. package/dist/utils/quality-gates.d.ts +0 -49
  260. package/dist/utils/quality-gates.d.ts.map +0 -1
  261. package/dist/utils/quality-gates.js +0 -402
  262. package/dist/utils/spec-resolver.d.ts +0 -80
  263. package/dist/utils/spec-resolver.d.ts.map +0 -1
  264. package/dist/utils/typescript-detector.d.ts +0 -66
  265. package/dist/utils/typescript-detector.d.ts.map +0 -1
  266. package/dist/utils/yaml-validation.d.ts +0 -32
  267. package/dist/utils/yaml-validation.d.ts.map +0 -1
  268. package/dist/validation/spec-validation.d.ts +0 -43
  269. package/dist/validation/spec-validation.d.ts.map +0 -1
  270. package/dist/waivers-manager.d.ts +0 -167
  271. package/dist/waivers-manager.d.ts.map +0 -1
  272. package/dist/worktree/worktree-manager.d.ts +0 -54
  273. package/dist/worktree/worktree-manager.d.ts.map +0 -1
@@ -1,93 +0,0 @@
1
- export namespace SPEC_TYPES {
2
- namespace feature {
3
- let color: chalk.Chalk;
4
- let icon: string;
5
- let description: string;
6
- }
7
- namespace fix {
8
- let color_1: chalk.Chalk;
9
- export { color_1 as color };
10
- let icon_1: string;
11
- export { icon_1 as icon };
12
- let description_1: string;
13
- export { description_1 as description };
14
- }
15
- namespace refactor {
16
- let color_2: chalk.Chalk;
17
- export { color_2 as color };
18
- let icon_2: string;
19
- export { icon_2 as icon };
20
- let description_2: string;
21
- export { description_2 as description };
22
- }
23
- namespace chore {
24
- let color_3: chalk.Chalk;
25
- export { color_3 as color };
26
- let icon_3: string;
27
- export { icon_3 as icon };
28
- let description_3: string;
29
- export { description_3 as description };
30
- }
31
- namespace docs {
32
- let color_4: chalk.Chalk;
33
- export { color_4 as color };
34
- let icon_4: string;
35
- export { icon_4 as icon };
36
- let description_4: string;
37
- export { description_4 as description };
38
- }
39
- }
40
- export namespace SPEC_STATUSES {
41
- namespace draft {
42
- export let label: string;
43
- let color_5: chalk.Chalk;
44
- export { color_5 as color };
45
- export let terminal: boolean;
46
- }
47
- namespace active {
48
- let label_1: string;
49
- export { label_1 as label };
50
- let color_6: chalk.Chalk;
51
- export { color_6 as color };
52
- let terminal_1: boolean;
53
- export { terminal_1 as terminal };
54
- }
55
- namespace in_progress {
56
- let label_2: string;
57
- export { label_2 as label };
58
- let color_7: chalk.Chalk;
59
- export { color_7 as color };
60
- let terminal_2: boolean;
61
- export { terminal_2 as terminal };
62
- }
63
- namespace completed {
64
- let label_3: string;
65
- export { label_3 as label };
66
- let color_8: chalk.Chalk;
67
- export { color_8 as color };
68
- let terminal_3: boolean;
69
- export { terminal_3 as terminal };
70
- }
71
- namespace closed {
72
- let label_4: string;
73
- export { label_4 as label };
74
- let color_9: chalk.Chalk;
75
- export { color_9 as color };
76
- let terminal_4: boolean;
77
- export { terminal_4 as terminal };
78
- }
79
- namespace archived {
80
- let label_5: string;
81
- export { label_5 as label };
82
- let color_10: chalk.Chalk;
83
- export { color_10 as color };
84
- let terminal_5: boolean;
85
- export { terminal_5 as terminal };
86
- }
87
- }
88
- /**
89
- * Status keys that indicate a spec is done (scope no longer enforced).
90
- */
91
- export const TERMINAL_STATUSES: string[];
92
- import chalk = require("chalk");
93
- //# sourceMappingURL=spec-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spec-types.d.ts","sourceRoot":"","sources":["../../src/constants/spec-types.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA;;GAEG;AACH,yCAEmB"}
@@ -1,151 +0,0 @@
1
- /**
2
- * Enhanced error class with category and recovery suggestions
3
- */
4
- export class CAWSError extends Error {
5
- constructor(message: any, category?: any, suggestions?: any[]);
6
- category: any;
7
- suggestions: any[];
8
- timestamp: Date;
9
- executionTime: any;
10
- }
11
- import { ERROR_CATEGORIES } from "./utils/error-categories";
12
- /**
13
- * Execution timing utilities
14
- */
15
- export class ExecutionTimer {
16
- startTime: bigint;
17
- endTime: bigint;
18
- start(): void;
19
- end(): number;
20
- getDuration(): number;
21
- formatDuration(): string;
22
- }
23
- import { getErrorCategory } from "./utils/error-categories";
24
- /**
25
- * Wrap async operations with consistent error handling and timing
26
- * @param {Function} operation - Async operation to wrap
27
- * @param {string} context - Context for error messages
28
- * @param {boolean} includeTiming - Whether to include timing in results
29
- * @returns {Promise<any>} Operation result or throws handled error
30
- */
31
- export function safeAsync(operation: Function, context?: string, includeTiming?: boolean): Promise<any>;
32
- /**
33
- * Wrap sync operations with timing
34
- * @param {Function} operation - Sync operation to wrap
35
- * @param {string} context - Context for error messages
36
- * @param {boolean} includeTiming - Whether to include timing in results
37
- * @returns {any} Operation result or throws handled error
38
- */
39
- export function safeSync(operation: Function, context?: string, includeTiming?: boolean): any;
40
- /**
41
- * Handle CLI errors with consistent formatting and user guidance
42
- * @param {Error} error - Error to handle
43
- * @param {Object} context - Error context (command, option, etc.)
44
- * @param {boolean} exit - Whether to exit the process (default: true)
45
- */
46
- export function handleCliError(error: Error, context?: any, exit?: boolean): void;
47
- /**
48
- * Validate required environment and dependencies
49
- * @returns {Object} Validation result with any errors
50
- */
51
- export function validateEnvironment(): any;
52
- /**
53
- * Get recovery suggestions based on error category
54
- * @param {Error} error - Original error
55
- * @param {string} category - Error category
56
- * @param {Object} context - Additional context (command, options, etc.)
57
- * @returns {string[]} Array of recovery suggestions
58
- */
59
- export function getRecoverySuggestions(error: Error, category: string, context?: any): string[];
60
- /**
61
- * Get documentation link for error category
62
- * @param {string} category - Error category
63
- * @param {Object} context - Additional context
64
- * @returns {string} Documentation URL
65
- */
66
- export function getDocumentationLink(category: string, context?: any): string;
67
- /**
68
- * Find similar command using Levenshtein distance
69
- * @param {string} input - User's input command
70
- * @param {string[]} validCommands - List of valid commands
71
- * @returns {string|null} Most similar command or null
72
- */
73
- export function findSimilarCommand(input: string, validCommands: string[]): string | null;
74
- /**
75
- * Command-specific error suggestions
76
- */
77
- export const COMMAND_SUGGESTIONS: {
78
- 'unknown option': (option: any, command: any) => any[];
79
- 'unknown command': (command: any) => string[];
80
- 'template not found': () => string[];
81
- 'not a caws project': () => string[];
82
- };
83
- /**
84
- * JSON output formatter for programmatic use
85
- * @param {Object} data - Data to format as JSON
86
- * @param {boolean} pretty - Whether to pretty-print (default: true)
87
- */
88
- export function formatJsonOutput(data: any, pretty?: boolean): string;
89
- /**
90
- * Check if user requested JSON output
91
- * @returns {boolean} True if --json flag is present
92
- */
93
- export function isJsonOutput(): boolean;
94
- /**
95
- * Output data in appropriate format (JSON or human-readable)
96
- * @param {Object} data - Data to output
97
- * @param {boolean} success - Whether this is a success response
98
- */
99
- export function outputResult(data: any, success?: boolean): any;
100
- /**
101
- * Troubleshooting guide system
102
- */
103
- export const TROUBLESHOOTING_GUIDES: {
104
- 'coverage-report-not-found': {
105
- title: string;
106
- symptoms: string[];
107
- rootCauses: string[];
108
- solutions: string[];
109
- commands: string[];
110
- };
111
- 'mutation-report-not-found': {
112
- title: string;
113
- symptoms: string[];
114
- rootCauses: string[];
115
- solutions: string[];
116
- commands: string[];
117
- };
118
- 'working-spec-validation': {
119
- title: string;
120
- symptoms: string[];
121
- rootCauses: string[];
122
- solutions: string[];
123
- commands: string[];
124
- };
125
- 'monorepo-detection': {
126
- title: string;
127
- symptoms: string[];
128
- rootCauses: string[];
129
- solutions: string[];
130
- commands: string[];
131
- };
132
- };
133
- /**
134
- * Get troubleshooting guide for a specific issue
135
- * @param {string} issueKey - Key for the troubleshooting guide
136
- * @returns {Object|null} Troubleshooting guide or null if not found
137
- */
138
- export function getTroubleshootingGuide(issueKey: string): any | null;
139
- /**
140
- * Get all available troubleshooting guides
141
- * @returns {Object} All troubleshooting guides
142
- */
143
- export function getAllTroubleshootingGuides(): any;
144
- /**
145
- * Suggest troubleshooting guide based on error message
146
- * @param {string} errorMessage - Error message to analyze
147
- * @returns {string|null} Issue key if match found, null otherwise
148
- */
149
- export function suggestTroubleshootingGuide(errorMessage: string): string | null;
150
- export { ERROR_CATEGORIES, getErrorCategory };
151
- //# sourceMappingURL=error-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../src/error-handler.js"],"names":[],"mappings":"AAcA;;GAEG;AACH;IACE,+DAOC;IAJC,cAAqD;IACrD,mBAA2F;IAC3F,gBAA2B;IAC3B,mBAAyB;CAE5B;;AAED;;GAEG;AACH;IAEI,kBAAqB;IACrB,gBAAmB;IAGrB,cAEC;IAED,cAGC;IAED,sBAIC;IAED,yBAMC;CACF;;AAED;;;;;;GAMG;AACH,yDAJW,MAAM,kBACN,OAAO,GACL,OAAO,CAAC,GAAG,CAAC,CA8BxB;AAED;;;;;;GAMG;AACH,wDAJW,MAAM,kBACN,OAAO,GACL,GAAG,CA8Bf;AAgSD;;;;;GAKG;AACH,sCAJW,KAAK,wBAEL,OAAO,QAmDjB;AA0JD;;;GAGG;AACH,2CAqBC;AAnXD;;;;;;GAMG;AACH,8CALW,KAAK,YACL,MAAM,kBAEJ,MAAM,EAAE,CAwDpB;AAED;;;;;GAKG;AACH,+CAJW,MAAM,kBAEJ,MAAM,CA4BlB;AAxJD;;;;;GAKG;AACH,0CAJW,MAAM,iBACN,MAAM,EAAE,GACN,MAAM,GAAC,IAAI,CAiBvB;AAjHD;;GAEG;AACH;;;;;EAuFE;AA4JF;;;;GAIG;AACH,qDAFW,OAAO,UAIjB;AAED;;;GAGG;AACH,gCAFa,OAAO,CAQnB;AAED;;;;GAIG;AACH,kDAFW,OAAO,OAcjB;AA2DD;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0GE;AAEF;;;;GAIG;AACH,kDAHW,MAAM,GACJ,MAAO,IAAI,CAIvB;AAED;;;GAGG;AACH,mDAEC;AAED;;;;GAIG;AACH,0DAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAmBvB"}
@@ -1,32 +0,0 @@
1
- /**
2
- * Configure Jest for TypeScript project
3
- * @param {string} projectDir - Project directory path
4
- * @param {Object} options - Configuration options
5
- * @returns {Promise<Object>} Configuration result
6
- */
7
- export function configureJestForTypeScript(projectDir?: string, options?: any): Promise<any>;
8
- /**
9
- * Generate Jest configuration for TypeScript project
10
- * @param {Object} options - Configuration options
11
- * @returns {string} Jest configuration content
12
- */
13
- export function generateJestConfig(options?: any): string;
14
- /**
15
- * Generate test setup file for TypeScript
16
- * @returns {string} Setup file content
17
- */
18
- export function generateTestSetup(): string;
19
- /**
20
- * Install Jest and TypeScript dependencies
21
- * @param {string} projectDir - Project directory
22
- * @param {Object} packageJson - Existing package.json
23
- * @returns {Promise<Object>} Installation result
24
- */
25
- export function installJestDependencies(projectDir: string, packageJson: any): Promise<any>;
26
- /**
27
- * Get Jest configuration recommendations
28
- * @param {string} projectDir - Project directory path
29
- * @returns {Object} Recommendations
30
- */
31
- export function getJestRecommendations(projectDir?: string): any;
32
- //# sourceMappingURL=jest-config-generator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest-config-generator.d.ts","sourceRoot":"","sources":["../../src/generators/jest-config-generator.js"],"names":[],"mappings":"AA+GA;;;;;GAKG;AACH,wDAJW,MAAM,kBAEJ,OAAO,KAAQ,CAgE3B;AAzKD;;;;GAIG;AACH,mDAFa,MAAM,CA0ClB;AAED;;;GAGG;AACH,qCAFa,MAAM,CAiBlB;AAED;;;;;GAKG;AACH,oDAJW,MAAM,qBAEJ,OAAO,KAAQ,CA2B3B;AAwED;;;;GAIG;AACH,oDAHW,MAAM,OAkDhB"}
@@ -1,32 +0,0 @@
1
- /**
2
- * Configure Jest for TypeScript project
3
- * @param {string} projectDir - Project directory path
4
- * @param {Object} options - Configuration options
5
- * @returns {Promise<Object>} Configuration result
6
- */
7
- export function configureJestForTypeScript(projectDir?: string, options?: any): Promise<any>;
8
- /**
9
- * Generate Jest configuration for TypeScript project
10
- * @param {Object} options - Configuration options
11
- * @returns {string} Jest configuration content
12
- */
13
- export function generateJestConfig(options?: any): string;
14
- /**
15
- * Generate test setup file for TypeScript
16
- * @returns {string} Setup file content
17
- */
18
- export function generateTestSetup(): string;
19
- /**
20
- * Install Jest and TypeScript dependencies
21
- * @param {string} projectDir - Project directory
22
- * @param {Object} packageJson - Existing package.json
23
- * @returns {Promise<Object>} Installation result
24
- */
25
- export function installJestDependencies(projectDir: string, packageJson: any): Promise<any>;
26
- /**
27
- * Get Jest configuration recommendations
28
- * @param {string} projectDir - Project directory path
29
- * @returns {Object} Recommendations
30
- */
31
- export function getJestRecommendations(projectDir?: string): any;
32
- //# sourceMappingURL=jest-config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest-config.d.ts","sourceRoot":"","sources":["../../src/generators/jest-config.js"],"names":[],"mappings":"AA+GA;;;;;GAKG;AACH,wDAJW,MAAM,kBAEJ,OAAO,KAAQ,CAgE3B;AAzKD;;;;GAIG;AACH,mDAFa,MAAM,CA0ClB;AAED;;;GAGG;AACH,qCAFa,MAAM,CAiBlB;AAED;;;;;GAKG;AACH,oDAJW,MAAM,qBAEJ,OAAO,KAAQ,CA2B3B;AAwED;;;;GAIG;AACH,oDAHW,MAAM,OAkDhB"}
@@ -1,242 +0,0 @@
1
- /**
2
- * @fileoverview Jest Configuration Generator
3
- * Generates Jest configuration for TypeScript projects
4
- * @author @darianrosebrook
5
- */
6
-
7
- const fs = require('fs-extra');
8
- const path = require('path');
9
- const chalk = require('chalk');
10
-
11
- /**
12
- * Generate Jest configuration for TypeScript project
13
- * @param {Object} options - Configuration options
14
- * @returns {string} Jest configuration content
15
- */
16
- function generateJestConfig(options = {}) {
17
- const {
18
- preset = 'ts-jest',
19
- testEnvironment = 'node',
20
- rootDir = '.',
21
- testMatch = ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
22
- moduleFileExtensions = ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
23
- collectCoverageFrom = ['src/**/*.ts', '!src/**/*.d.ts', '!src/**/*.test.ts'],
24
- coverageThreshold = {
25
- global: {
26
- branches: 80,
27
- functions: 80,
28
- lines: 80,
29
- statements: 80,
30
- },
31
- },
32
- } = options;
33
-
34
- const config = {
35
- preset,
36
- testEnvironment,
37
- rootDir,
38
- testMatch,
39
- moduleFileExtensions,
40
- collectCoverageFrom,
41
- coverageThreshold,
42
- transform: {
43
- '^.+\\.tsx?$': [
44
- 'ts-jest',
45
- {
46
- tsconfig: 'tsconfig.json',
47
- },
48
- ],
49
- },
50
- moduleNameMapper: {
51
- '^@/(.*)$': '<rootDir>/src/$1',
52
- },
53
- };
54
-
55
- return `module.exports = ${JSON.stringify(config, null, 2)};\n`;
56
- }
57
-
58
- /**
59
- * Generate test setup file for TypeScript
60
- * @returns {string} Setup file content
61
- */
62
- function generateTestSetup() {
63
- return `/**
64
- * Jest setup file for TypeScript tests
65
- * @author @darianrosebrook
66
- */
67
-
68
- // Add custom matchers or global test setup here
69
- beforeAll(() => {
70
- // Global setup
71
- });
72
-
73
- afterAll(() => {
74
- // Global teardown
75
- });
76
- `;
77
- }
78
-
79
- /**
80
- * Install Jest and TypeScript dependencies
81
- * @param {string} projectDir - Project directory
82
- * @param {Object} packageJson - Existing package.json
83
- * @returns {Promise<Object>} Installation result
84
- */
85
- async function installJestDependencies(projectDir, packageJson) {
86
- const dependencies = ['jest', '@types/jest', 'ts-jest'];
87
-
88
- // Check which dependencies are already installed
89
- const allDeps = {
90
- ...packageJson.dependencies,
91
- ...packageJson.devDependencies,
92
- };
93
-
94
- const toInstall = dependencies.filter((dep) => !(dep in allDeps));
95
-
96
- if (toInstall.length === 0) {
97
- return {
98
- installed: false,
99
- message: 'All Jest dependencies already installed',
100
- dependencies: [],
101
- };
102
- }
103
-
104
- return {
105
- installed: false,
106
- needsInstall: true,
107
- dependencies: toInstall,
108
- installCommand: `npm install --save-dev ${toInstall.join(' ')}`,
109
- };
110
- }
111
-
112
- /**
113
- * Configure Jest for TypeScript project
114
- * @param {string} projectDir - Project directory path
115
- * @param {Object} options - Configuration options
116
- * @returns {Promise<Object>} Configuration result
117
- */
118
- async function configureJestForTypeScript(projectDir = process.cwd(), options = {}) {
119
- const { force = false, quiet = false } = options;
120
-
121
- // Check if Jest config already exists
122
- const jestConfigPath = path.join(projectDir, 'jest.config.js');
123
- if (fs.existsSync(jestConfigPath) && !force) {
124
- return {
125
- configured: false,
126
- skipped: true,
127
- message: 'Jest configuration already exists',
128
- path: jestConfigPath,
129
- };
130
- }
131
-
132
- // Generate Jest config
133
- const jestConfig = generateJestConfig();
134
- await fs.writeFile(jestConfigPath, jestConfig);
135
-
136
- if (!quiet) {
137
- console.log(chalk.green('✅ Created jest.config.js'));
138
- }
139
-
140
- // Generate test setup file
141
- const setupPath = path.join(projectDir, 'tests', 'setup.ts');
142
- await fs.ensureDir(path.join(projectDir, 'tests'));
143
- await fs.writeFile(setupPath, generateTestSetup());
144
-
145
- if (!quiet) {
146
- console.log(chalk.green('✅ Created tests/setup.ts'));
147
- }
148
-
149
- // Update package.json with test script if needed
150
- const packageJsonPath = path.join(projectDir, 'package.json');
151
- if (fs.existsSync(packageJsonPath)) {
152
- const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'));
153
-
154
- if (!packageJson.scripts) {
155
- packageJson.scripts = {};
156
- }
157
-
158
- if (!packageJson.scripts.test) {
159
- packageJson.scripts.test = 'jest';
160
- packageJson.scripts['test:coverage'] = 'jest --coverage';
161
- packageJson.scripts['test:watch'] = 'jest --watch';
162
-
163
- await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
164
-
165
- if (!quiet) {
166
- console.log(chalk.green('✅ Added test scripts to package.json'));
167
- }
168
- }
169
- }
170
-
171
- return {
172
- configured: true,
173
- files: [jestConfigPath, setupPath],
174
- nextSteps: [
175
- 'Install dependencies: npm install --save-dev jest @types/jest ts-jest',
176
- 'Run tests: npm test',
177
- 'Run with coverage: npm run test:coverage',
178
- ],
179
- };
180
- }
181
-
182
- /**
183
- * Get Jest configuration recommendations
184
- * @param {string} projectDir - Project directory path
185
- * @returns {Object} Recommendations
186
- */
187
- function getJestRecommendations(projectDir = process.cwd()) {
188
- const recommendations = [];
189
- const hasJestConfig = fs.existsSync(path.join(projectDir, 'jest.config.js'));
190
- const packageJsonPath = path.join(projectDir, 'package.json');
191
-
192
- if (fs.existsSync(packageJsonPath)) {
193
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
194
- const allDeps = {
195
- ...packageJson.dependencies,
196
- ...packageJson.devDependencies,
197
- };
198
-
199
- if (!hasJestConfig && !('jest' in allDeps)) {
200
- recommendations.push({
201
- type: 'missing_framework',
202
- severity: 'high',
203
- message: 'No testing framework detected',
204
- fix: 'Install Jest: npm install --save-dev jest @types/jest ts-jest',
205
- autoFixable: false,
206
- });
207
- }
208
-
209
- if ('typescript' in allDeps && 'jest' in allDeps && !('ts-jest' in allDeps)) {
210
- recommendations.push({
211
- type: 'missing_ts_jest',
212
- severity: 'high',
213
- message: 'TypeScript project with Jest but missing ts-jest',
214
- fix: 'Install ts-jest: npm install --save-dev ts-jest',
215
- autoFixable: false,
216
- });
217
- }
218
-
219
- if (!hasJestConfig && 'jest' in allDeps) {
220
- recommendations.push({
221
- type: 'missing_config',
222
- severity: 'medium',
223
- message: 'Jest installed but not configured',
224
- fix: 'Run: caws scaffold to generate Jest configuration',
225
- autoFixable: true,
226
- });
227
- }
228
- }
229
-
230
- return {
231
- hasIssues: recommendations.length > 0,
232
- recommendations,
233
- };
234
- }
235
-
236
- module.exports = {
237
- configureJestForTypeScript,
238
- generateJestConfig,
239
- generateTestSetup,
240
- installJestDependencies,
241
- getJestRecommendations,
242
- };
@@ -1,13 +0,0 @@
1
- /**
2
- * Generate working spec YAML with user input
3
- * @param {Object} answers - User responses
4
- * @returns {string} - Generated YAML content
5
- */
6
- export function generateWorkingSpec(answers: any): string;
7
- /**
8
- * Validate generated working spec against JSON schema
9
- * @param {string} specContent - YAML spec content
10
- * @param {Object} answers - User responses for error context
11
- */
12
- export function validateGeneratedSpec(specContent: string, _answers: any): void;
13
- //# sourceMappingURL=working-spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"working-spec.d.ts","sourceRoot":"","sources":["../../src/generators/working-spec.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,mDAFa,MAAM,CAsLlB;AAED;;;;GAIG;AACH,mDAHW,MAAM,uBA8BhB"}
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import { generateWorkingSpec } from "./generators/working-spec";
3
- import { validateGeneratedSpec } from "./generators/working-spec";
4
- export { generateWorkingSpec, validateGeneratedSpec };
5
- //# sourceMappingURL=index-new.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-new.d.ts","sourceRoot":"","sources":["../src/index-new.js"],"names":[],"mappings":""}