@outputai/cli 0.1.2-dev.0 → 0.1.2

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 (278) hide show
  1. package/package.json +7 -7
  2. package/dist/api/generated/api.d.ts +0 -820
  3. package/dist/api/generated/api.js +0 -226
  4. package/dist/api/http_client.d.ts +0 -27
  5. package/dist/api/http_client.js +0 -71
  6. package/dist/api/orval_post_process.d.ts +0 -11
  7. package/dist/api/orval_post_process.js +0 -46
  8. package/dist/api/parser.d.ts +0 -17
  9. package/dist/api/parser.js +0 -68
  10. package/dist/assets/config/costs.yml +0 -309
  11. package/dist/assets/docker/docker-compose-dev.yml +0 -146
  12. package/dist/commands/credentials/edit.d.ts +0 -10
  13. package/dist/commands/credentials/edit.js +0 -67
  14. package/dist/commands/credentials/edit.spec.d.ts +0 -1
  15. package/dist/commands/credentials/edit.spec.js +0 -73
  16. package/dist/commands/credentials/get.d.ts +0 -13
  17. package/dist/commands/credentials/get.js +0 -46
  18. package/dist/commands/credentials/get.spec.d.ts +0 -1
  19. package/dist/commands/credentials/get.spec.js +0 -74
  20. package/dist/commands/credentials/init.d.ts +0 -11
  21. package/dist/commands/credentials/init.js +0 -45
  22. package/dist/commands/credentials/init.spec.d.ts +0 -1
  23. package/dist/commands/credentials/init.spec.js +0 -68
  24. package/dist/commands/credentials/show.d.ts +0 -10
  25. package/dist/commands/credentials/show.js +0 -33
  26. package/dist/commands/credentials/show.spec.d.ts +0 -1
  27. package/dist/commands/credentials/show.spec.js +0 -57
  28. package/dist/commands/dev/eject.d.ts +0 -11
  29. package/dist/commands/dev/eject.js +0 -58
  30. package/dist/commands/dev/eject.spec.d.ts +0 -1
  31. package/dist/commands/dev/eject.spec.js +0 -109
  32. package/dist/commands/dev/index.d.ts +0 -13
  33. package/dist/commands/dev/index.js +0 -162
  34. package/dist/commands/dev/index.spec.d.ts +0 -1
  35. package/dist/commands/dev/index.spec.js +0 -239
  36. package/dist/commands/init.d.ts +0 -12
  37. package/dist/commands/init.js +0 -37
  38. package/dist/commands/init.spec.d.ts +0 -1
  39. package/dist/commands/init.spec.js +0 -100
  40. package/dist/commands/update.d.ts +0 -14
  41. package/dist/commands/update.js +0 -120
  42. package/dist/commands/update.spec.d.ts +0 -1
  43. package/dist/commands/update.spec.js +0 -178
  44. package/dist/commands/workflow/cost.d.ts +0 -16
  45. package/dist/commands/workflow/cost.js +0 -71
  46. package/dist/commands/workflow/cost.spec.d.ts +0 -1
  47. package/dist/commands/workflow/cost.spec.js +0 -47
  48. package/dist/commands/workflow/dataset/generate.d.ts +0 -22
  49. package/dist/commands/workflow/dataset/generate.js +0 -143
  50. package/dist/commands/workflow/dataset/list.d.ts +0 -12
  51. package/dist/commands/workflow/dataset/list.js +0 -87
  52. package/dist/commands/workflow/debug.d.ts +0 -16
  53. package/dist/commands/workflow/debug.js +0 -60
  54. package/dist/commands/workflow/debug.spec.d.ts +0 -1
  55. package/dist/commands/workflow/debug.spec.js +0 -34
  56. package/dist/commands/workflow/generate.d.ts +0 -17
  57. package/dist/commands/workflow/generate.js +0 -85
  58. package/dist/commands/workflow/generate.spec.d.ts +0 -1
  59. package/dist/commands/workflow/generate.spec.js +0 -115
  60. package/dist/commands/workflow/list.d.ts +0 -22
  61. package/dist/commands/workflow/list.js +0 -152
  62. package/dist/commands/workflow/list.spec.d.ts +0 -1
  63. package/dist/commands/workflow/list.spec.js +0 -99
  64. package/dist/commands/workflow/plan.d.ts +0 -12
  65. package/dist/commands/workflow/plan.js +0 -66
  66. package/dist/commands/workflow/plan.spec.d.ts +0 -1
  67. package/dist/commands/workflow/plan.spec.js +0 -341
  68. package/dist/commands/workflow/reset.d.ts +0 -14
  69. package/dist/commands/workflow/reset.js +0 -51
  70. package/dist/commands/workflow/result.d.ts +0 -13
  71. package/dist/commands/workflow/result.js +0 -46
  72. package/dist/commands/workflow/result.spec.d.ts +0 -1
  73. package/dist/commands/workflow/result.spec.js +0 -23
  74. package/dist/commands/workflow/run.d.ts +0 -16
  75. package/dist/commands/workflow/run.js +0 -97
  76. package/dist/commands/workflow/run.spec.d.ts +0 -1
  77. package/dist/commands/workflow/run.spec.js +0 -110
  78. package/dist/commands/workflow/runs/list.d.ts +0 -14
  79. package/dist/commands/workflow/runs/list.js +0 -104
  80. package/dist/commands/workflow/start.d.ts +0 -15
  81. package/dist/commands/workflow/start.js +0 -62
  82. package/dist/commands/workflow/start.spec.d.ts +0 -1
  83. package/dist/commands/workflow/start.spec.js +0 -28
  84. package/dist/commands/workflow/status.d.ts +0 -13
  85. package/dist/commands/workflow/status.js +0 -57
  86. package/dist/commands/workflow/status.spec.d.ts +0 -1
  87. package/dist/commands/workflow/status.spec.js +0 -33
  88. package/dist/commands/workflow/stop.d.ts +0 -10
  89. package/dist/commands/workflow/stop.js +0 -31
  90. package/dist/commands/workflow/stop.spec.d.ts +0 -1
  91. package/dist/commands/workflow/stop.spec.js +0 -17
  92. package/dist/commands/workflow/terminate.d.ts +0 -13
  93. package/dist/commands/workflow/terminate.js +0 -39
  94. package/dist/commands/workflow/test_eval.d.ts +0 -20
  95. package/dist/commands/workflow/test_eval.js +0 -151
  96. package/dist/config.d.ts +0 -47
  97. package/dist/config.js +0 -47
  98. package/dist/generated/framework_version.json +0 -3
  99. package/dist/hooks/init.d.ts +0 -3
  100. package/dist/hooks/init.js +0 -30
  101. package/dist/hooks/init.spec.d.ts +0 -1
  102. package/dist/hooks/init.spec.js +0 -54
  103. package/dist/index.d.ts +0 -1
  104. package/dist/index.js +0 -1
  105. package/dist/index.spec.d.ts +0 -1
  106. package/dist/index.spec.js +0 -6
  107. package/dist/services/claude_client.d.ts +0 -30
  108. package/dist/services/claude_client.integration.test.d.ts +0 -1
  109. package/dist/services/claude_client.integration.test.js +0 -43
  110. package/dist/services/claude_client.js +0 -215
  111. package/dist/services/claude_client.spec.d.ts +0 -1
  112. package/dist/services/claude_client.spec.js +0 -145
  113. package/dist/services/coding_agents.d.ts +0 -36
  114. package/dist/services/coding_agents.js +0 -236
  115. package/dist/services/coding_agents.spec.d.ts +0 -1
  116. package/dist/services/coding_agents.spec.js +0 -256
  117. package/dist/services/copy_assets.spec.d.ts +0 -1
  118. package/dist/services/copy_assets.spec.js +0 -22
  119. package/dist/services/cost_calculator.d.ts +0 -18
  120. package/dist/services/cost_calculator.js +0 -359
  121. package/dist/services/cost_calculator.spec.d.ts +0 -1
  122. package/dist/services/cost_calculator.spec.js +0 -540
  123. package/dist/services/credentials_service.d.ts +0 -12
  124. package/dist/services/credentials_service.integration.test.d.ts +0 -1
  125. package/dist/services/credentials_service.integration.test.js +0 -66
  126. package/dist/services/credentials_service.js +0 -64
  127. package/dist/services/credentials_service.spec.d.ts +0 -1
  128. package/dist/services/credentials_service.spec.js +0 -106
  129. package/dist/services/datasets.d.ts +0 -20
  130. package/dist/services/datasets.js +0 -132
  131. package/dist/services/docker.d.ts +0 -38
  132. package/dist/services/docker.js +0 -148
  133. package/dist/services/docker.spec.d.ts +0 -1
  134. package/dist/services/docker.spec.js +0 -124
  135. package/dist/services/env_configurator.d.ts +0 -15
  136. package/dist/services/env_configurator.js +0 -163
  137. package/dist/services/env_configurator.spec.d.ts +0 -1
  138. package/dist/services/env_configurator.spec.js +0 -192
  139. package/dist/services/generate_plan_name@v1.prompt +0 -24
  140. package/dist/services/messages.d.ts +0 -9
  141. package/dist/services/messages.js +0 -338
  142. package/dist/services/messages.spec.d.ts +0 -1
  143. package/dist/services/messages.spec.js +0 -55
  144. package/dist/services/npm_update_service.d.ts +0 -6
  145. package/dist/services/npm_update_service.js +0 -87
  146. package/dist/services/npm_update_service.spec.d.ts +0 -1
  147. package/dist/services/npm_update_service.spec.js +0 -104
  148. package/dist/services/project_scaffold.d.ts +0 -31
  149. package/dist/services/project_scaffold.js +0 -212
  150. package/dist/services/project_scaffold.spec.d.ts +0 -1
  151. package/dist/services/project_scaffold.spec.js +0 -122
  152. package/dist/services/s3_trace_downloader.d.ts +0 -12
  153. package/dist/services/s3_trace_downloader.js +0 -57
  154. package/dist/services/template_processor.d.ts +0 -14
  155. package/dist/services/template_processor.js +0 -57
  156. package/dist/services/trace_reader.d.ts +0 -16
  157. package/dist/services/trace_reader.js +0 -57
  158. package/dist/services/trace_reader.spec.d.ts +0 -1
  159. package/dist/services/trace_reader.spec.js +0 -78
  160. package/dist/services/version_check.d.ts +0 -6
  161. package/dist/services/version_check.js +0 -52
  162. package/dist/services/version_check.spec.d.ts +0 -1
  163. package/dist/services/version_check.spec.js +0 -106
  164. package/dist/services/workflow_builder.d.ts +0 -16
  165. package/dist/services/workflow_builder.js +0 -86
  166. package/dist/services/workflow_builder.spec.d.ts +0 -1
  167. package/dist/services/workflow_builder.spec.js +0 -165
  168. package/dist/services/workflow_generator.d.ts +0 -5
  169. package/dist/services/workflow_generator.js +0 -40
  170. package/dist/services/workflow_generator.spec.d.ts +0 -1
  171. package/dist/services/workflow_generator.spec.js +0 -77
  172. package/dist/services/workflow_planner.d.ts +0 -15
  173. package/dist/services/workflow_planner.js +0 -48
  174. package/dist/services/workflow_planner.spec.d.ts +0 -1
  175. package/dist/services/workflow_planner.spec.js +0 -122
  176. package/dist/services/workflow_runs.d.ts +0 -14
  177. package/dist/services/workflow_runs.js +0 -25
  178. package/dist/templates/agent_instructions/CLAUDE.md.template +0 -19
  179. package/dist/templates/agent_instructions/dotclaude/settings.json.template +0 -29
  180. package/dist/templates/project/.env.example.template +0 -9
  181. package/dist/templates/project/.gitignore.template +0 -35
  182. package/dist/templates/project/README.md.template +0 -100
  183. package/dist/templates/project/config/costs.yml.template +0 -29
  184. package/dist/templates/project/package.json.template +0 -25
  185. package/dist/templates/project/src/clients/jina.ts.template +0 -30
  186. package/dist/templates/project/src/shared/utils/string.ts.template +0 -3
  187. package/dist/templates/project/src/shared/utils/url.ts.template +0 -15
  188. package/dist/templates/project/src/workflows/blog_evaluator/evaluators.ts.template +0 -23
  189. package/dist/templates/project/src/workflows/blog_evaluator/prompts/signal_noise@v1.prompt.template +0 -26
  190. package/dist/templates/project/src/workflows/blog_evaluator/scenarios/paulgraham_hwh.json.template +0 -3
  191. package/dist/templates/project/src/workflows/blog_evaluator/steps.ts.template +0 -27
  192. package/dist/templates/project/src/workflows/blog_evaluator/types.ts.template +0 -30
  193. package/dist/templates/project/src/workflows/blog_evaluator/utils.ts.template +0 -15
  194. package/dist/templates/project/src/workflows/blog_evaluator/workflow.ts.template +0 -27
  195. package/dist/templates/project/tsconfig.json.template +0 -20
  196. package/dist/templates/workflow/README.md.template +0 -216
  197. package/dist/templates/workflow/evaluators.ts.template +0 -21
  198. package/dist/templates/workflow/prompts/example@v1.prompt.template +0 -15
  199. package/dist/templates/workflow/scenarios/test_input.json.template +0 -3
  200. package/dist/templates/workflow/steps.ts.template +0 -20
  201. package/dist/templates/workflow/types.ts.template +0 -13
  202. package/dist/templates/workflow/workflow.ts.template +0 -23
  203. package/dist/test_helpers/mocks.d.ts +0 -38
  204. package/dist/test_helpers/mocks.js +0 -77
  205. package/dist/types/cost.d.ts +0 -149
  206. package/dist/types/cost.js +0 -6
  207. package/dist/types/domain.d.ts +0 -20
  208. package/dist/types/domain.js +0 -4
  209. package/dist/types/errors.d.ts +0 -68
  210. package/dist/types/errors.js +0 -100
  211. package/dist/types/errors.spec.d.ts +0 -1
  212. package/dist/types/errors.spec.js +0 -18
  213. package/dist/types/generator.d.ts +0 -26
  214. package/dist/types/generator.js +0 -1
  215. package/dist/types/trace.d.ts +0 -161
  216. package/dist/types/trace.js +0 -18
  217. package/dist/utils/claude.d.ts +0 -5
  218. package/dist/utils/claude.js +0 -19
  219. package/dist/utils/claude.spec.d.ts +0 -1
  220. package/dist/utils/claude.spec.js +0 -119
  221. package/dist/utils/constants.d.ts +0 -5
  222. package/dist/utils/constants.js +0 -4
  223. package/dist/utils/cost_formatter.d.ts +0 -5
  224. package/dist/utils/cost_formatter.js +0 -218
  225. package/dist/utils/date_formatter.d.ts +0 -23
  226. package/dist/utils/date_formatter.js +0 -49
  227. package/dist/utils/env_loader.d.ts +0 -1
  228. package/dist/utils/env_loader.js +0 -22
  229. package/dist/utils/env_loader.spec.d.ts +0 -1
  230. package/dist/utils/env_loader.spec.js +0 -43
  231. package/dist/utils/error_handler.d.ts +0 -8
  232. package/dist/utils/error_handler.js +0 -71
  233. package/dist/utils/error_utils.d.ts +0 -24
  234. package/dist/utils/error_utils.js +0 -87
  235. package/dist/utils/file_system.d.ts +0 -3
  236. package/dist/utils/file_system.js +0 -33
  237. package/dist/utils/format_workflow_result.d.ts +0 -5
  238. package/dist/utils/format_workflow_result.js +0 -18
  239. package/dist/utils/format_workflow_result.spec.d.ts +0 -1
  240. package/dist/utils/format_workflow_result.spec.js +0 -81
  241. package/dist/utils/framework_version.d.ts +0 -4
  242. package/dist/utils/framework_version.js +0 -4
  243. package/dist/utils/framework_version.spec.d.ts +0 -1
  244. package/dist/utils/framework_version.spec.js +0 -13
  245. package/dist/utils/header_utils.d.ts +0 -12
  246. package/dist/utils/header_utils.js +0 -29
  247. package/dist/utils/header_utils.spec.d.ts +0 -1
  248. package/dist/utils/header_utils.spec.js +0 -52
  249. package/dist/utils/input_parser.d.ts +0 -1
  250. package/dist/utils/input_parser.js +0 -19
  251. package/dist/utils/output_formatter.d.ts +0 -2
  252. package/dist/utils/output_formatter.js +0 -11
  253. package/dist/utils/paths.d.ts +0 -25
  254. package/dist/utils/paths.js +0 -36
  255. package/dist/utils/process.d.ts +0 -4
  256. package/dist/utils/process.js +0 -50
  257. package/dist/utils/resolve_input.d.ts +0 -1
  258. package/dist/utils/resolve_input.js +0 -22
  259. package/dist/utils/scenario_resolver.d.ts +0 -9
  260. package/dist/utils/scenario_resolver.js +0 -93
  261. package/dist/utils/scenario_resolver.spec.d.ts +0 -1
  262. package/dist/utils/scenario_resolver.spec.js +0 -214
  263. package/dist/utils/secret_sanitizer.d.ts +0 -1
  264. package/dist/utils/secret_sanitizer.js +0 -29
  265. package/dist/utils/sleep.d.ts +0 -5
  266. package/dist/utils/sleep.js +0 -5
  267. package/dist/utils/template.d.ts +0 -9
  268. package/dist/utils/template.js +0 -30
  269. package/dist/utils/template.spec.d.ts +0 -1
  270. package/dist/utils/template.spec.js +0 -77
  271. package/dist/utils/trace_extractor.d.ts +0 -27
  272. package/dist/utils/trace_extractor.js +0 -53
  273. package/dist/utils/trace_formatter.d.ts +0 -11
  274. package/dist/utils/trace_formatter.js +0 -402
  275. package/dist/utils/validation.d.ts +0 -13
  276. package/dist/utils/validation.js +0 -25
  277. package/dist/utils/validation.spec.d.ts +0 -1
  278. package/dist/utils/validation.spec.js +0 -140
@@ -1,100 +0,0 @@
1
- /**
2
- * Error thrown when a workflow already exists
3
- */
4
- export class WorkflowExistsError extends Error {
5
- constructor(workflowName, targetPath) {
6
- super(`Workflow "${workflowName}" already exists at ${targetPath}. Use --force to overwrite.`);
7
- }
8
- }
9
- /**
10
- * Error thrown when workflow name is invalid
11
- */
12
- export class InvalidNameError extends Error {
13
- constructor(name) {
14
- super(`Invalid workflow name "${name}". Name must contain only letters, numbers, hyphens, and underscores.`);
15
- }
16
- }
17
- /**
18
- * Error thrown when template file is not found
19
- */
20
- export class TemplateNotFoundError extends Error {
21
- constructor(templateFile) {
22
- super(`Template file "${templateFile}" not found. Please ensure CLI is properly installed.`);
23
- }
24
- }
25
- /**
26
- * Error thrown when output directory is invalid or inaccessible
27
- */
28
- export class InvalidOutputDirectoryError extends Error {
29
- constructor(outputDir, reason) {
30
- const message = reason ?
31
- `Invalid output directory "${outputDir}": ${reason}` :
32
- `Invalid output directory "${outputDir}"`;
33
- super(message);
34
- }
35
- }
36
- /**
37
- * Error thrown when folder already exists during initialization
38
- */
39
- export class FolderAlreadyExistsError extends Error {
40
- folderPath;
41
- constructor(folderPath) {
42
- super(`Folder already exists: ${folderPath}`);
43
- this.folderPath = folderPath;
44
- }
45
- }
46
- /**
47
- * Error thrown when user cancels initialization
48
- */
49
- export class UserCancelledError extends Error {
50
- constructor() {
51
- super('Init cancelled by user.');
52
- }
53
- }
54
- /**
55
- * Type-safe error wrapper that preserves original error with context
56
- */
57
- export class ProjectInitError extends Error {
58
- originalError;
59
- projectPath;
60
- constructor(message, originalError, projectPath = null) {
61
- super(message);
62
- this.originalError = originalError;
63
- this.projectPath = projectPath;
64
- // Preserve original stack trace
65
- if (originalError.stack) {
66
- this.stack = originalError.stack;
67
- }
68
- }
69
- }
70
- /**
71
- * Error thrown when directory creation fails with project context
72
- */
73
- export class DirectoryCreationError extends Error {
74
- projectPath;
75
- /**
76
- * @param message - The error message
77
- * @param projectPath - The path where directory creation failed
78
- */
79
- constructor(message, projectPath) {
80
- super(message);
81
- this.projectPath = projectPath;
82
- }
83
- }
84
- /**
85
- * Error thrown when a Claude CLI plugin command fails
86
- */
87
- export class ClaudePluginError extends Error {
88
- commandName;
89
- originalError;
90
- /**
91
- * @param commandName - The Claude command that failed (e.g., 'plugin update outputai')
92
- * @param originalError - The underlying error from the command execution
93
- */
94
- constructor(commandName, originalError) {
95
- const originalMessage = originalError?.message || 'Unknown error';
96
- super(`Claude command '${commandName}' failed: ${originalMessage}`);
97
- this.commandName = commandName;
98
- this.originalError = originalError;
99
- }
100
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,18 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { ClaudePluginError } from './errors.js';
3
- describe('ClaudePluginError', () => {
4
- it('should instantiate with command name and original error', () => {
5
- const originalError = new Error('Connection failed');
6
- const error = new ClaudePluginError('plugin update outputai', originalError);
7
- expect(error).toBeInstanceOf(Error);
8
- expect(error).toBeInstanceOf(ClaudePluginError);
9
- expect(error.commandName).toBe('plugin update outputai');
10
- expect(error.originalError).toBe(originalError);
11
- });
12
- it('should format error message to include command context', () => {
13
- const originalError = new Error('Command not found');
14
- const error = new ClaudePluginError('plugin install outputai@outputai', originalError);
15
- expect(error.message).toContain('plugin install outputai@outputai');
16
- expect(error.message).toContain('Command not found');
17
- });
18
- });
@@ -1,26 +0,0 @@
1
- /**
2
- * Configuration for workflow generation
3
- */
4
- export interface WorkflowGenerationConfig {
5
- name: string;
6
- description?: string;
7
- outputDir: string;
8
- skeleton: boolean;
9
- force: boolean;
10
- }
11
- /**
12
- * Result of workflow generation
13
- */
14
- export interface WorkflowGenerationResult {
15
- workflowName: string;
16
- targetDir: string;
17
- filesCreated: string[];
18
- }
19
- /**
20
- * Template file information
21
- */
22
- export interface TemplateFile {
23
- name: string;
24
- path: string;
25
- outputName: string;
26
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,161 +0,0 @@
1
- /**
2
- * Trace types for workflow execution data.
3
- *
4
- * These types represent the structure of trace files generated during workflow execution,
5
- * used for debugging, visualization, and analysis of workflow runs.
6
- */
7
- /** Node kind values for trace events */
8
- export type NodeKind = 'workflow' | 'activity' | 'step' | 'internal_step' | string;
9
- /** Phase of a trace event lifecycle */
10
- export type NodePhase = 'start' | 'end' | 'error' | string;
11
- /** Execution status of a node */
12
- export type NodeStatus = 'completed' | 'failed' | 'running' | string;
13
- /**
14
- * Details associated with a trace event.
15
- * Contains input/output data and identifying information for the event.
16
- */
17
- export interface TraceDetails {
18
- /** Input data passed to the step/activity */
19
- input?: unknown;
20
- /** Output data returned from the step/activity */
21
- output?: unknown;
22
- /** Name of the activity (for activity events) */
23
- activityName?: string;
24
- /** Name of the step (for step events) */
25
- stepName?: string;
26
- /** Generic name field */
27
- name?: string;
28
- }
29
- /**
30
- * A trace event representing a point in workflow execution.
31
- * Used for timeline display and event-based analysis.
32
- */
33
- export interface TraceEvent {
34
- /** The type of event (workflow, activity, step, etc.) */
35
- kind: NodeKind;
36
- /** The lifecycle phase of the event */
37
- phase: NodePhase;
38
- /** Unix timestamp when the event occurred */
39
- timestamp: number;
40
- /** Unique identifier for the workflow run */
41
- workflowId: string;
42
- /** Name of the workflow being executed */
43
- workflowName: string;
44
- /** Additional event details including input/output */
45
- details?: TraceDetails;
46
- /** Child events for nested executions */
47
- children?: TraceEvent[];
48
- /** Error information if the event represents a failure */
49
- error?: unknown;
50
- /** Duration of the event in milliseconds */
51
- duration?: number;
52
- }
53
- /**
54
- * A node in the debug tree representation of workflow execution.
55
- * Contains more detailed timing and state information than TraceEvent.
56
- */
57
- export interface DebugNode {
58
- /** The type of node (workflow, activity, step, internal_step) */
59
- kind?: NodeKind;
60
- /** Alternative type field */
61
- type?: string;
62
- /** The name of the step or activity */
63
- name?: string;
64
- /** Name of the workflow (for workflow nodes) */
65
- workflowName?: string;
66
- /** Name of the step (for step nodes) */
67
- stepName?: string;
68
- /** Name of the activity (for activity nodes) */
69
- activityName?: string;
70
- /** The lifecycle phase of the node */
71
- phase?: NodePhase;
72
- /** Execution status (completed, failed, running) */
73
- status?: NodeStatus;
74
- /** Unix timestamp or ISO string when execution started */
75
- startedAt?: number | string;
76
- /** Unix timestamp when the event occurred */
77
- timestamp?: number | string;
78
- /** Unix timestamp or ISO string when execution ended */
79
- endedAt?: number | string;
80
- /** Unix timestamp when execution started (alternative field) */
81
- startTime?: number;
82
- /** Unix timestamp when execution ended (alternative field) */
83
- endTime?: number;
84
- /** Execution duration in milliseconds */
85
- duration?: number;
86
- /** Input data passed to the step/activity */
87
- input?: unknown;
88
- /** Output data returned from the step/activity */
89
- output?: unknown;
90
- /** Additional execution details */
91
- details?: Record<string, unknown>;
92
- /** Error information if the node failed */
93
- error?: unknown;
94
- /** Child nodes representing nested executions */
95
- children?: DebugNode[];
96
- }
97
- /**
98
- * Root structure of a workflow trace.
99
- * Contains the execution tree and optional flat event list.
100
- */
101
- export interface TraceStructure {
102
- /** Root node of the execution tree */
103
- root?: TraceEvent | DebugNode;
104
- /** Flat list of execution events for timeline display */
105
- events?: TraceEvent[];
106
- /** Hierarchical tree of execution nodes (alternative to root.children) */
107
- children?: DebugNode[];
108
- }
109
- /**
110
- * The structure of a workflow trace file generated by Output.ai workflow runs.
111
- * This file is written to the local filesystem during workflow execution and contains
112
- * the complete execution history including timing, inputs, outputs, and any errors.
113
- */
114
- export interface TraceData {
115
- /** Root workflow execution information */
116
- root: {
117
- /** The name of the workflow that was executed */
118
- workflowName: string;
119
- /** Unique identifier for this workflow run */
120
- workflowId: string;
121
- /** Unix timestamp when the workflow started */
122
- startTime: number;
123
- /** Unix timestamp when the workflow ended */
124
- endTime?: number;
125
- /** Total workflow duration in milliseconds */
126
- duration?: number;
127
- /** Final workflow status */
128
- status?: string;
129
- /** Error information if the workflow failed */
130
- error?: unknown;
131
- };
132
- /** Flat list of execution events for timeline display */
133
- events?: Array<{
134
- name: string;
135
- phase: string;
136
- timestamp: number;
137
- details?: unknown;
138
- }>;
139
- /** Hierarchical tree of execution nodes */
140
- children?: DebugNode[];
141
- }
142
- /**
143
- * Extracted node information for display formatting.
144
- * Used internally by the trace formatter.
145
- */
146
- export interface NodeInfo {
147
- /** Display name for the node */
148
- name: string;
149
- /** Formatted phase indicator */
150
- phase: string;
151
- /** Formatted duration string */
152
- duration: string;
153
- }
154
- /**
155
- * Type guard to check if a node is a TraceEvent.
156
- */
157
- export declare const isTraceEvent: (node: TraceEvent | DebugNode) => node is TraceEvent;
158
- /**
159
- * Type guard to check if a value is a valid timestamp.
160
- */
161
- export declare const isValidTimestamp: (value: unknown) => value is number | string;
@@ -1,18 +0,0 @@
1
- /**
2
- * Trace types for workflow execution data.
3
- *
4
- * These types represent the structure of trace files generated during workflow execution,
5
- * used for debugging, visualization, and analysis of workflow runs.
6
- */
7
- /**
8
- * Type guard to check if a node is a TraceEvent.
9
- */
10
- export const isTraceEvent = (node) => {
11
- return 'workflowId' in node && 'timestamp' in node;
12
- };
13
- /**
14
- * Type guard to check if a value is a valid timestamp.
15
- */
16
- export const isValidTimestamp = (value) => {
17
- return typeof value === 'number' || typeof value === 'string';
18
- };
@@ -1,5 +0,0 @@
1
- export interface ExecuteClaudeCommandOptions {
2
- ignoreFailure?: boolean;
3
- }
4
- export declare function isClaudeCliAvailable(): boolean;
5
- export declare function executeClaudeCommand(args: string[], cwd: string, options?: ExecuteClaudeCommandOptions): Promise<void>;
@@ -1,19 +0,0 @@
1
- import { spawnSync } from 'node:child_process';
2
- import { executeCommand } from './process.js';
3
- export function isClaudeCliAvailable() {
4
- const result = spawnSync('claude', ['--version'], { encoding: 'utf8' });
5
- return result.status === 0;
6
- }
7
- export async function executeClaudeCommand(args, cwd, options) {
8
- if (!isClaudeCliAvailable()) {
9
- throw new Error('Claude CLI not found. Please install Claude Code CLI and ensure \'claude\' is in your PATH.');
10
- }
11
- try {
12
- await executeCommand('claude', args, cwd);
13
- }
14
- catch (error) {
15
- if (!options?.ignoreFailure) {
16
- throw error;
17
- }
18
- }
19
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,119 +0,0 @@
1
- import { describe, it, expect, beforeEach, vi } from 'vitest';
2
- import { isClaudeCliAvailable, executeClaudeCommand } from './claude.js';
3
- import { spawnSync } from 'node:child_process';
4
- import * as processModule from './process.js';
5
- vi.mock('node:child_process', () => ({
6
- spawnSync: vi.fn()
7
- }));
8
- vi.mock('./process.js', () => ({
9
- executeCommand: vi.fn()
10
- }));
11
- describe('claude utilities', () => {
12
- beforeEach(() => {
13
- vi.clearAllMocks();
14
- });
15
- describe('isClaudeCliAvailable', () => {
16
- it('should return true when claude CLI is available', () => {
17
- vi.mocked(spawnSync).mockReturnValue({
18
- status: 0,
19
- stdout: 'claude 1.0.0',
20
- stderr: '',
21
- pid: 1234,
22
- output: [],
23
- signal: null
24
- });
25
- const result = isClaudeCliAvailable();
26
- expect(result).toBe(true);
27
- expect(spawnSync).toHaveBeenCalledWith('claude', ['--version'], { encoding: 'utf8' });
28
- });
29
- it('should return false when claude CLI is not found', () => {
30
- vi.mocked(spawnSync).mockReturnValue({
31
- status: 1,
32
- stdout: '',
33
- stderr: 'command not found',
34
- pid: 1234,
35
- output: [],
36
- signal: null
37
- });
38
- const result = isClaudeCliAvailable();
39
- expect(result).toBe(false);
40
- });
41
- it('should return false when status is null', () => {
42
- vi.mocked(spawnSync).mockReturnValue({
43
- status: null,
44
- stdout: '',
45
- stderr: '',
46
- pid: 1234,
47
- output: [],
48
- signal: 'SIGTERM'
49
- });
50
- const result = isClaudeCliAvailable();
51
- expect(result).toBe(false);
52
- });
53
- });
54
- describe('executeClaudeCommand', () => {
55
- it('should throw error when Claude CLI is not available', async () => {
56
- vi.mocked(spawnSync).mockReturnValue({
57
- status: 1,
58
- stdout: '',
59
- stderr: '',
60
- pid: 1234,
61
- output: [],
62
- signal: null
63
- });
64
- await expect(executeClaudeCommand(['plugin', 'list'], '/test'))
65
- .rejects.toThrow('Claude CLI not found');
66
- expect(processModule.executeCommand).not.toHaveBeenCalled();
67
- });
68
- it('should call executeCommand with correct arguments when CLI is available', async () => {
69
- vi.mocked(spawnSync).mockReturnValue({
70
- status: 0,
71
- stdout: '',
72
- stderr: '',
73
- pid: 1234,
74
- output: [],
75
- signal: null
76
- });
77
- vi.mocked(processModule.executeCommand).mockResolvedValue({ stderr: [] });
78
- await executeClaudeCommand(['plugin', 'install', 'test'], '/project');
79
- expect(processModule.executeCommand).toHaveBeenCalledWith('claude', ['plugin', 'install', 'test'], '/project');
80
- });
81
- it('should propagate errors when ignoreFailure is not set', async () => {
82
- vi.mocked(spawnSync).mockReturnValue({
83
- status: 0,
84
- stdout: '',
85
- stderr: '',
86
- pid: 1234,
87
- output: [],
88
- signal: null
89
- });
90
- vi.mocked(processModule.executeCommand).mockRejectedValue(new Error('Command failed'));
91
- await expect(executeClaudeCommand(['plugin', 'list'], '/test'))
92
- .rejects.toThrow('Command failed');
93
- });
94
- it('should suppress errors when ignoreFailure is true', async () => {
95
- vi.mocked(spawnSync).mockReturnValue({
96
- status: 0,
97
- stdout: '',
98
- stderr: '',
99
- pid: 1234,
100
- output: [],
101
- signal: null
102
- });
103
- vi.mocked(processModule.executeCommand).mockRejectedValue(new Error('Command failed'));
104
- await expect(executeClaudeCommand(['plugin', 'list'], '/test', { ignoreFailure: true })).resolves.toBeUndefined();
105
- });
106
- it('should not suppress errors when ignoreFailure is false', async () => {
107
- vi.mocked(spawnSync).mockReturnValue({
108
- status: 0,
109
- stdout: '',
110
- stderr: '',
111
- pid: 1234,
112
- output: [],
113
- signal: null
114
- });
115
- vi.mocked(processModule.executeCommand).mockRejectedValue(new Error('Command failed'));
116
- await expect(executeClaudeCommand(['plugin', 'list'], '/test', { ignoreFailure: false })).rejects.toThrow('Command failed');
117
- });
118
- });
119
- });
@@ -1,5 +0,0 @@
1
- export declare const OUTPUT_FORMAT: {
2
- readonly JSON: "json";
3
- readonly TEXT: "text";
4
- };
5
- export type OutputFormat = typeof OUTPUT_FORMAT[keyof typeof OUTPUT_FORMAT];
@@ -1,4 +0,0 @@
1
- export const OUTPUT_FORMAT = {
2
- JSON: 'json',
3
- TEXT: 'text'
4
- };
@@ -1,5 +0,0 @@
1
- import type { CostReport, ParsedCostData } from '#types/cost.js';
2
- export declare function parseCostData(report: CostReport): ParsedCostData;
3
- export declare function formatCostReport(report: CostReport, options?: {
4
- verbose?: boolean;
5
- }): string;