@outputai/cli 0.1.1 → 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 -14
  33. package/dist/commands/dev/index.js +0 -173
  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 -39
  132. package/dist/services/docker.js +0 -160
  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,122 +0,0 @@
1
- import { describe, it, expect, beforeEach, vi } from 'vitest';
2
- import { generatePlanName, writePlanFile, updateAgentTemplates } from './workflow_planner.js';
3
- import { initializeAgentConfig } from './coding_agents.js';
4
- import { generateText } from '@outputai/llm';
5
- import fs from 'node:fs/promises';
6
- vi.mock('./coding_agents.js');
7
- vi.mock('@outputai/llm');
8
- vi.mock('node:fs/promises');
9
- const mockGenerateTextResult = (text) => ({
10
- text,
11
- result: text,
12
- usage: { inputTokens: 10, outputTokens: 5, totalTokens: 15 },
13
- finishReason: 'stop'
14
- });
15
- describe('workflow-planner service', () => {
16
- beforeEach(() => {
17
- vi.clearAllMocks();
18
- });
19
- describe('generatePlanName', () => {
20
- it('should generate plan name with date prefix using LLM', async () => {
21
- vi.mocked(generateText).mockResolvedValue(mockGenerateTextResult('customer_order_processing'));
22
- const testDate = new Date(2025, 9, 6);
23
- const planName = await generatePlanName('A workflow that processes customer orders', testDate);
24
- expect(planName).toMatch(/^2025_10_06_/);
25
- expect(planName).toBe('2025_10_06_customer_order_processing');
26
- expect(generateText).toHaveBeenCalledWith({
27
- prompt: 'generate_plan_name@v1',
28
- variables: { description: 'A workflow that processes customer orders' }
29
- });
30
- });
31
- it('should clean and validate LLM response', async () => {
32
- vi.mocked(generateText).mockResolvedValue(mockGenerateTextResult(' User-Auth & Security!@# '));
33
- const testDate = new Date(2025, 9, 6);
34
- const planName = await generatePlanName('User authentication workflow', testDate);
35
- expect(planName).toBe('2025_10_06_user_auth_security');
36
- expect(planName).toMatch(/^[0-9_a-z]+$/);
37
- });
38
- it('should handle LLM errors gracefully', async () => {
39
- vi.mocked(generateText).mockRejectedValue(new Error('API rate limit exceeded'));
40
- await expect(generatePlanName('Test workflow')).rejects.toThrow('API rate limit exceeded');
41
- });
42
- it('should limit plan name length to 50 characters', async () => {
43
- vi.mocked(generateText).mockResolvedValue(mockGenerateTextResult('this_is_an_extremely_long_plan_name_that_exceeds_the_maximum_allowed_length_for_file_names'));
44
- const testDate = new Date(2025, 9, 6);
45
- const planName = await generatePlanName('Long workflow description', testDate);
46
- const namePart = planName.replace(/^2025_10_06_/, '');
47
- expect(namePart.length).toBeLessThanOrEqual(50);
48
- });
49
- it('should handle multiple underscores correctly', async () => {
50
- vi.mocked(generateText).mockResolvedValue(mockGenerateTextResult('user___auth___workflow'));
51
- const testDate = new Date(2025, 9, 6);
52
- const planName = await generatePlanName('Test', testDate);
53
- expect(planName).toBe('2025_10_06_user_auth_workflow');
54
- expect(planName).not.toContain('__');
55
- });
56
- });
57
- describe('writePlanFile', () => {
58
- it('should create plan directory and write PLAN.md', async () => {
59
- vi.mocked(fs.mkdir).mockResolvedValue(undefined);
60
- vi.mocked(fs.writeFile).mockResolvedValue(undefined);
61
- const planName = '2025_10_06_test_plan';
62
- const content = '# Test Plan\n\nThis is a test plan.';
63
- const projectRoot = '/test/project';
64
- const planPath = await writePlanFile(planName, content, projectRoot);
65
- expect(fs.mkdir).toHaveBeenCalledWith('/test/project/.outputai/plans/2025_10_06_test_plan', { recursive: true });
66
- expect(fs.writeFile).toHaveBeenCalledWith('/test/project/.outputai/plans/2025_10_06_test_plan/PLAN.md', content, 'utf-8');
67
- expect(planPath).toBe('/test/project/.outputai/plans/2025_10_06_test_plan/PLAN.md');
68
- });
69
- it('should return the plan file path', async () => {
70
- vi.mocked(fs.mkdir).mockResolvedValue(undefined);
71
- vi.mocked(fs.writeFile).mockResolvedValue(undefined);
72
- const planPath = await writePlanFile('test_plan', 'content', '/root');
73
- expect(planPath).toBe('/root/.outputai/plans/test_plan/PLAN.md');
74
- });
75
- it('should handle nested directory creation', async () => {
76
- vi.mocked(fs.mkdir).mockResolvedValue(undefined);
77
- vi.mocked(fs.writeFile).mockResolvedValue(undefined);
78
- await writePlanFile('2025_10_06_nested_plan', 'content', '/deep/nested/path');
79
- expect(fs.mkdir).toHaveBeenCalledWith('/deep/nested/path/.outputai/plans/2025_10_06_nested_plan', { recursive: true });
80
- });
81
- it('should handle UTF-8 content with special characters', async () => {
82
- vi.mocked(fs.mkdir).mockResolvedValue(undefined);
83
- vi.mocked(fs.writeFile).mockResolvedValue(undefined);
84
- const content = '# Plan\n\nSpecial characters: quotes and dashes';
85
- await writePlanFile('unicode_test', content, '/test');
86
- expect(fs.writeFile).toHaveBeenCalledWith(expect.any(String), content, 'utf-8');
87
- });
88
- it('should throw error when directory creation fails', async () => {
89
- vi.mocked(fs.mkdir).mockRejectedValue(new Error('Permission denied'));
90
- await expect(writePlanFile('test', 'content', '/root'))
91
- .rejects.toThrow('Permission denied');
92
- });
93
- it('should throw error when file writing fails', async () => {
94
- vi.mocked(fs.mkdir).mockResolvedValue(undefined);
95
- vi.mocked(fs.writeFile).mockRejectedValue(new Error('Disk full'));
96
- await expect(writePlanFile('test', 'content', '/root'))
97
- .rejects.toThrow('Disk full');
98
- });
99
- });
100
- describe('updateAgentTemplates', () => {
101
- it('should invoke initializeAgentConfig with force flag', async () => {
102
- vi.mocked(initializeAgentConfig).mockResolvedValue();
103
- await updateAgentTemplates('/test/project');
104
- expect(initializeAgentConfig).toHaveBeenCalledWith({
105
- projectRoot: '/test/project',
106
- force: true
107
- });
108
- });
109
- it('should propagate errors from initializeAgentConfig', async () => {
110
- vi.mocked(initializeAgentConfig).mockRejectedValue(new Error('Failed to write templates'));
111
- await expect(updateAgentTemplates('/test/project'))
112
- .rejects.toThrow('Failed to write templates');
113
- });
114
- it('should work with different project roots', async () => {
115
- vi.mocked(initializeAgentConfig).mockResolvedValue();
116
- await updateAgentTemplates('/different/path');
117
- expect(initializeAgentConfig).toHaveBeenCalledWith(expect.objectContaining({
118
- projectRoot: '/different/path'
119
- }));
120
- });
121
- });
122
- });
@@ -1,14 +0,0 @@
1
- /**
2
- * Workflow runs service for fetching workflow run data from the API
3
- */
4
- import { type WorkflowRunInfo } from '#api/generated/api.js';
5
- export type WorkflowRun = WorkflowRunInfo;
6
- export interface WorkflowRunsResult {
7
- runs: WorkflowRun[];
8
- count: number;
9
- }
10
- export interface FetchWorkflowRunsOptions {
11
- workflowType?: string;
12
- limit?: number;
13
- }
14
- export declare function fetchWorkflowRuns(options?: FetchWorkflowRunsOptions): Promise<WorkflowRunsResult>;
@@ -1,25 +0,0 @@
1
- /**
2
- * Workflow runs service for fetching workflow run data from the API
3
- */
4
- import { getWorkflowRuns } from '#api/generated/api.js';
5
- export async function fetchWorkflowRuns(options = {}) {
6
- const params = {};
7
- if (options.limit) {
8
- params.limit = options.limit;
9
- }
10
- if (options.workflowType) {
11
- params.workflowType = options.workflowType;
12
- }
13
- const response = await getWorkflowRuns(params);
14
- if (!response) {
15
- throw new Error('Failed to connect to API server. Is it running?');
16
- }
17
- if (!response.data) {
18
- throw new Error('API returned invalid response (missing data)');
19
- }
20
- const data = response.data;
21
- return {
22
- runs: data.runs || [],
23
- count: data.count || 0
24
- };
25
- }
@@ -1,19 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This is an **Output.ai** project - a framework for building reliable, production-ready LLM workflows and agents.
4
-
5
- ## Getting Started
6
-
7
- For full framework documentation, commands, and AI-assisted workflow development, install our Claude Code plugins:
8
-
9
- ```bash
10
- claude plugin marketplace add growthxai/output
11
- claude plugin install outputai@outputai --scope project
12
- ```
13
-
14
- ---
15
-
16
- ## Project-Specific Instructions
17
-
18
- <!-- Add your project-specific instructions below -->
19
-
@@ -1,29 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "WebFetch",
5
- "Bash(npx output:*)",
6
- "Bash(npm run dev)",
7
- "Bash(npm run output:*)",
8
- "Skills(output*)",
9
- "Skills(flow*)"
10
- ]
11
- },
12
- "enabledPlugins": {
13
- "outputai@outputai": true
14
- },
15
- "extraKnownMarketplaces": {
16
- "team-tools": {
17
- "source": {
18
- "source": "github",
19
- "repo": "growthxai/output"
20
- }
21
- }
22
- },
23
- "companyAnnouncements": [
24
- "Output.ai: Stay up to date with the latest Output.ai announcements and updates at https://output.ai",
25
- "Output.ai: Ensure the latest version of the Output.ai CLI is installed and up to date with `npm update @outputai/cli`",
26
- "Output.ai: Learn more about how to use the Output Framework at https://docs.output.ai/",
27
- "Output.ai: Ensure your Claude Code Plugins are up to date with `/plugin marketplace update outputai` and `/plugin install @outputai@outputai`"
28
- ]
29
- }
@@ -1,9 +0,0 @@
1
- # Docker Compose service name for development environment
2
- DOCKER_SERVICE_NAME={{projectName}}
3
-
4
- # Configure if you plan to use Anthropic Models in your LLM prompts
5
- ANTHROPIC_API_KEY=<SECRET>
6
-
7
- # Configure if you plan to use OpenAI in your LLM prompts
8
- OPENAI_API_KEY=<SECRET>
9
-
@@ -1,35 +0,0 @@
1
- # Dependencies
2
- node_modules/
3
-
4
- # Build output
5
- dist/
6
- build/
7
-
8
- # IDE & Editor
9
- .vscode/
10
- .idea/
11
- *~
12
- .env
13
- .DS_Store
14
- .env.local
15
- .env.*.local
16
-
17
- # Encrypted credentials keys (never commit)
18
- **/config/credentials.key
19
- **/config/credentials/*.key
20
- **/src/workflows/*/credentials.key
21
-
22
- # TypeScript
23
- *.tsbuildinfo
24
- *.js.map
25
- *.d.ts.map
26
-
27
- # Logs
28
- logs/
29
- *.log
30
- npm-debug.log*
31
- yarn-debug.log*
32
-
33
- # OS specific
34
- Thumbs.db
35
- .DS_Store
@@ -1,100 +0,0 @@
1
- # {{projectName}}
2
-
3
- {{description}}
4
-
5
- ## Prerequisites
6
-
7
- - Node.js >= 24.3
8
- - Docker and Docker Compose (for local development)
9
-
10
- ## Project Structure
11
-
12
- ```
13
- src/
14
- ├── clients/ # API clients (e.g., jina.ts)
15
- ├── shared/ # Shared code across workflows
16
- │ └── utils/ # Utility functions (e.g., string.ts)
17
- └── workflows/ # Workflow definitions
18
- └── blog_evaluator/ # Example workflow
19
- ├── workflow.ts # Main workflow
20
- ├── steps.ts # Workflow steps
21
- ├── evaluators.ts # Quality evaluators
22
- ├── utils.ts # Local utilities
23
- ├── prompts/ # LLM prompts
24
- └── scenarios/ # Test scenarios
25
- ```
26
-
27
- ### Clients Directory
28
-
29
- The `src/clients/` directory contains API clients using `@outputai/http` for external services.
30
-
31
- ### Shared Directory
32
-
33
- The `src/shared/` directory contains code shared across multiple workflows:
34
-
35
- - **`shared/utils/`** - Helper functions and utilities
36
-
37
- ### Import Rules
38
-
39
- **Workflows** can import from:
40
- - Local steps, evaluators, and utilities
41
- - Clients, shared steps, evaluators, and utilities
42
-
43
- **Steps and Evaluators** can import from:
44
- - Local utilities and clients
45
- - Clients and shared utilities
46
-
47
- **Steps and Evaluators cannot** import from:
48
- - Other steps or evaluators (Temporal activity isolation)
49
-
50
- ## Getting Started
51
-
52
- ### 1. Install Dependencies
53
-
54
- ```bash
55
- npm install
56
- ```
57
-
58
- ### 2. Configure Environment
59
-
60
- Copy `.env.example` to `.env` and add your API keys:
61
-
62
- ```bash
63
- cp .env.example .env
64
- ```
65
-
66
- Edit `.env` to add:
67
- - `ANTHROPIC_API_KEY` - for Claude LLM integration
68
- - `OPENAI_API_KEY` - for OpenAI LLM integration (optional)
69
-
70
- ### 3. Start Output Services
71
-
72
- ```bash
73
- npm run dev
74
- ```
75
-
76
- This starts:
77
- - Temporal server and UI (http://localhost:8080)
78
- - PostgreSQL and Redis databases
79
- - Output.ai API server (http://localhost:3001)
80
- - Worker process for executing workflows
81
-
82
- ### 4. Run a workflow
83
-
84
- In a new terminal:
85
-
86
- ```bash
87
- npx output workflow run blog_evaluator paulgraham_hwh
88
- ```
89
-
90
- ### 5. Stop Services
91
-
92
- Press `Ctrl+C` in the terminal running `npm run dev` to stop all services gracefully.
93
-
94
- ### 6. View Logs
95
-
96
- Monitor workflow execution and system status in the Temporal UI:
97
-
98
- ```bash
99
- open http://localhost:8080
100
- ```
@@ -1,29 +0,0 @@
1
- # Token & API Pricing Configuration
2
- # Prices are per million tokens, in USD
3
- # Entries here are merged with built-in defaults (project values take precedence)
4
- # Model names support prefix matching: 'claude-sonnet-4' matches 'claude-sonnet-4-20250514'
5
- # models:
6
- # # =============================================================================
7
- # # Anthropic
8
- # # =============================================================================
9
- # claude-haiku-4-5:
10
- # provider: anthropic
11
- # input: 1.00
12
- # output: 5.00
13
- # cached_input: 0.10
14
-
15
- # claude-sonnet-4:
16
- # provider: anthropic
17
- # input: 3.00
18
- # output: 15.00
19
- # cached_input: 0.30
20
-
21
- # services:
22
- # # =============================================================================
23
- # # Jina Reader API - Token-based
24
- # # =============================================================================
25
- # jina:
26
- # type: token
27
- # url_pattern: "r.jina.ai"
28
- # usage_path: "body.data.usage.tokens"
29
- # per_million: 0.045
@@ -1,25 +0,0 @@
1
- {
2
- "name": "{{projectName}}",
3
- "version": "0.0.1",
4
- "description": "{{description}}",
5
- "type": "module",
6
- "main": "dist/worker.js",
7
- "scripts": {
8
- "output:worker:install": "npm install",
9
- "output:worker:build": "rm -rf dist/* && tsc -p ./ && copyfiles './src/**/*.prompt' './src/**/*.yml.enc' dist -u 1",
10
- "output:worker:start": "output-worker",
11
- "dev": "output dev"
12
- },
13
- "dependencies": {
14
- "@outputai/output": "^{{frameworkVersion}}"
15
- },
16
- "devDependencies": {
17
- "@types/node": "^24.0.0",
18
- "native-copyfiles": "2.0.1",
19
- "nodemon": "3.1.0",
20
- "typescript": "^5.7.0"
21
- },
22
- "engines": {
23
- "node": ">=24.3.0"
24
- }
25
- }
@@ -1,30 +0,0 @@
1
- import { httpClient } from '@outputai/http';
2
-
3
- export interface JinaReaderResponse {
4
- code: number;
5
- status: number;
6
- data: {
7
- title: string;
8
- description: string;
9
- url: string;
10
- content: string;
11
- usage: { tokens: number };
12
- };
13
- }
14
-
15
- const jinaClient = httpClient( {
16
- prefixUrl: 'https://r.jina.ai',
17
- timeout: 30000
18
- } );
19
-
20
- export async function fetchBlogContent( url: string ): Promise<JinaReaderResponse> {
21
- const response = await jinaClient.post( '', {
22
- json: { url },
23
- headers: {
24
- 'Accept': 'application/json',
25
- 'Content-Type': 'application/json',
26
- 'X-Return-Format': 'markdown'
27
- }
28
- } );
29
- return response.json() as Promise<JinaReaderResponse>;
30
- }
@@ -1,3 +0,0 @@
1
- export function lowercase( str: string ): string {
2
- return str.toLowerCase();
3
- }
@@ -1,15 +0,0 @@
1
- export function isValidUrl( urlString: string ): boolean {
2
- try {
3
- const url = new URL( urlString );
4
- return url.protocol === 'http:' || url.protocol === 'https:';
5
- } catch {
6
- return false;
7
- }
8
- }
9
-
10
- export function validateUrl( urlString: string ): string {
11
- if ( !isValidUrl( urlString ) ) {
12
- throw new Error( `Invalid URL: ${urlString}` );
13
- }
14
- return urlString;
15
- }
@@ -1,23 +0,0 @@
1
- import { evaluator, EvaluationNumberResult } from '@outputai/core';
2
- import type { EvaluationResultArgs } from '@outputai/core';
3
- import { generateText, Output } from '@outputai/llm';
4
- import { blogContentSchema } from './types.js';
5
- import type { BlogContent } from './types.js';
6
-
7
- export const evaluateSignalToNoise = evaluator( {
8
- name: 'evaluate_signal_to_noise',
9
- description: 'Evaluate the signal-to-noise ratio of blog content',
10
- inputSchema: blogContentSchema,
11
- fn: async ( input: BlogContent ) => {
12
- const { output } = await generateText( {
13
- prompt: 'signal_noise@v1',
14
- variables: {
15
- title: input.title,
16
- content: input.content
17
- },
18
- output: Output.object( { schema: EvaluationNumberResult.schema } )
19
- } );
20
-
21
- return new EvaluationNumberResult( output as EvaluationResultArgs<number> );
22
- }
23
- } );
@@ -1,26 +0,0 @@
1
- ---
2
- provider: anthropic
3
- model: claude-haiku-4-5
4
- temperature: 0.3
5
- maxTokens: 4096
6
- ---
7
-
8
- <system>
9
- You are an expert content analyst. Evaluate blog posts for their signal-to-noise ratio.
10
- </system>
11
-
12
- <user>
13
- Analyze this blog post for signal-to-noise ratio.
14
-
15
- Title: \{{ title }}
16
-
17
- Content:
18
- \{{ content }}
19
-
20
- Score 0-100 where:
21
- - 0-20: Mostly filler/noise
22
- - 21-40: More noise than signal
23
- - 41-60: Balanced
24
- - 61-80: Good signal, minimal noise
25
- - 81-100: Exceptional, dense valuable content
26
- </user>
@@ -1,3 +0,0 @@
1
- {
2
- "url": "https://paulgraham.com/hwh.html"
3
- }
@@ -1,27 +0,0 @@
1
- import { step, z } from '@outputai/core';
2
- import { fetchBlogContent } from '../../clients/jina.js';
3
-
4
- const blogContentSchema = z.object( {
5
- title: z.string(),
6
- url: z.string(),
7
- content: z.string(),
8
- tokenCount: z.number()
9
- } );
10
-
11
- export const fetchContent = step( {
12
- name: 'fetch_blog_content',
13
- description: 'Fetch blog content from URL using Jina Reader API',
14
- inputSchema: z.object( {
15
- url: z.string().url()
16
- } ),
17
- outputSchema: blogContentSchema,
18
- fn: async ( { url } ) => {
19
- const response = await fetchBlogContent( url );
20
- return {
21
- title: response.data.title,
22
- url: response.data.url,
23
- content: response.data.content,
24
- tokenCount: response.data.usage.tokens
25
- };
26
- }
27
- } );
@@ -1,30 +0,0 @@
1
- import { z } from '@outputai/core';
2
-
3
- export const blogContentSchema = z.object( {
4
- title: z.string(),
5
- url: z.string(),
6
- content: z.string(),
7
- tokenCount: z.number()
8
- } );
9
-
10
- export const workflowInputSchema = z.object( {
11
- url: z.string().url().describe( 'URL of the blog post to evaluate' )
12
- } );
13
-
14
- export const workflowOutputSchema = z.object( {
15
- url: z.string(),
16
- title: z.string(),
17
- signalToNoiseScore: z.number().min( 0 ).max( 100 ).describe( 'Signal-to-noise score 0-100' ),
18
- confidence: z.number().min( 0 ).max( 1 ).describe( 'Confidence score 0-1' ),
19
- reasoning: z.string().optional(),
20
- feedback: z.array( z.object( {
21
- issue: z.string(),
22
- suggestion: z.string().optional(),
23
- reference: z.string().optional(),
24
- priority: z.enum( [ 'low', 'medium', 'high', 'critical' ] ).optional()
25
- } ) ).optional()
26
- } );
27
-
28
- export type BlogContent = z.infer<typeof blogContentSchema>;
29
- export type WorkflowInput = z.infer<typeof workflowInputSchema>;
30
- export type WorkflowOutput = z.infer<typeof workflowOutputSchema>;
@@ -1,15 +0,0 @@
1
- import type { EvaluationNumberResult } from '@outputai/core';
2
-
3
- export function createWorkflowOutput(
4
- blogContent: { url: string; title: string },
5
- evaluation: EvaluationNumberResult
6
- ) {
7
- return {
8
- url: blogContent.url,
9
- title: blogContent.title,
10
- signalToNoiseScore: evaluation.value,
11
- confidence: evaluation.confidence,
12
- reasoning: evaluation.reasoning,
13
- feedback: evaluation.feedback
14
- };
15
- }
@@ -1,27 +0,0 @@
1
- import { workflow, z } from '@outputai/core';
2
- import { validateUrl } from '../../shared/utils/url.js';
3
- import { fetchContent } from './steps.js';
4
- import { evaluateSignalToNoise } from './evaluators.js';
5
- import { createWorkflowOutput } from './utils.js';
6
- import { workflowInputSchema, workflowOutputSchema } from './types.js';
7
-
8
- export default workflow( {
9
- name: 'blog_evaluator',
10
- description: '{{description}}',
11
- inputSchema: workflowInputSchema,
12
- outputSchema: workflowOutputSchema,
13
- fn: async ( input ) => {
14
- const validatedUrl = validateUrl( input.url );
15
- const blogContent = await fetchContent( { url: validatedUrl } );
16
- const evaluation = await evaluateSignalToNoise( blogContent );
17
-
18
- return createWorkflowOutput( blogContent, evaluation );
19
- },
20
- options: {
21
- activityOptions: {
22
- retry: {
23
- maximumAttempts: 3
24
- }
25
- }
26
- }
27
- } );
@@ -1,20 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ES2022",
5
- "moduleResolution": "bundler",
6
- "resolveJsonModule": true,
7
- "allowJs": true,
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "declaration": true,
13
- "declarationMap": true,
14
- "sourceMap": true,
15
- "outDir": "./dist",
16
- "rootDir": "./src",
17
- },
18
- "include": ["./**/*.js", "./**/*.ts", "./**/*.prompt" ],
19
- "exclude": ["node_modules", "dist"]
20
- }