@outputai/cli 0.1.4 → 0.1.5
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.
- package/dist/api/generated/api.d.ts +820 -0
- package/dist/api/generated/api.js +226 -0
- package/dist/api/http_client.d.ts +27 -0
- package/dist/api/http_client.js +71 -0
- package/dist/api/orval_post_process.d.ts +11 -0
- package/dist/api/orval_post_process.js +46 -0
- package/dist/api/parser.d.ts +17 -0
- package/dist/api/parser.js +68 -0
- package/dist/assets/config/costs.yml +309 -0
- package/dist/assets/docker/docker-compose-dev.yml +146 -0
- package/dist/commands/credentials/edit.d.ts +10 -0
- package/dist/commands/credentials/edit.js +67 -0
- package/dist/commands/credentials/edit.spec.d.ts +1 -0
- package/dist/commands/credentials/edit.spec.js +73 -0
- package/dist/commands/credentials/get.d.ts +13 -0
- package/dist/commands/credentials/get.js +46 -0
- package/dist/commands/credentials/get.spec.d.ts +1 -0
- package/dist/commands/credentials/get.spec.js +74 -0
- package/dist/commands/credentials/init.d.ts +11 -0
- package/dist/commands/credentials/init.js +45 -0
- package/dist/commands/credentials/init.spec.d.ts +1 -0
- package/dist/commands/credentials/init.spec.js +68 -0
- package/dist/commands/credentials/show.d.ts +10 -0
- package/dist/commands/credentials/show.js +33 -0
- package/dist/commands/credentials/show.spec.d.ts +1 -0
- package/dist/commands/credentials/show.spec.js +57 -0
- package/dist/commands/dev/eject.d.ts +11 -0
- package/dist/commands/dev/eject.js +58 -0
- package/dist/commands/dev/eject.spec.d.ts +1 -0
- package/dist/commands/dev/eject.spec.js +109 -0
- package/dist/commands/dev/index.d.ts +14 -0
- package/dist/commands/dev/index.js +173 -0
- package/dist/commands/dev/index.spec.d.ts +1 -0
- package/dist/commands/dev/index.spec.js +239 -0
- package/dist/commands/init.d.ts +12 -0
- package/dist/commands/init.js +37 -0
- package/dist/commands/init.spec.d.ts +1 -0
- package/dist/commands/init.spec.js +100 -0
- package/dist/commands/update.d.ts +14 -0
- package/dist/commands/update.js +120 -0
- package/dist/commands/update.spec.d.ts +1 -0
- package/dist/commands/update.spec.js +178 -0
- package/dist/commands/workflow/cost.d.ts +16 -0
- package/dist/commands/workflow/cost.js +71 -0
- package/dist/commands/workflow/cost.spec.d.ts +1 -0
- package/dist/commands/workflow/cost.spec.js +47 -0
- package/dist/commands/workflow/dataset/generate.d.ts +22 -0
- package/dist/commands/workflow/dataset/generate.js +143 -0
- package/dist/commands/workflow/dataset/list.d.ts +12 -0
- package/dist/commands/workflow/dataset/list.js +87 -0
- package/dist/commands/workflow/debug.d.ts +16 -0
- package/dist/commands/workflow/debug.js +60 -0
- package/dist/commands/workflow/debug.spec.d.ts +1 -0
- package/dist/commands/workflow/debug.spec.js +34 -0
- package/dist/commands/workflow/generate.d.ts +17 -0
- package/dist/commands/workflow/generate.js +85 -0
- package/dist/commands/workflow/generate.spec.d.ts +1 -0
- package/dist/commands/workflow/generate.spec.js +115 -0
- package/dist/commands/workflow/list.d.ts +22 -0
- package/dist/commands/workflow/list.js +152 -0
- package/dist/commands/workflow/list.spec.d.ts +1 -0
- package/dist/commands/workflow/list.spec.js +99 -0
- package/dist/commands/workflow/plan.d.ts +12 -0
- package/dist/commands/workflow/plan.js +66 -0
- package/dist/commands/workflow/plan.spec.d.ts +1 -0
- package/dist/commands/workflow/plan.spec.js +341 -0
- package/dist/commands/workflow/reset.d.ts +14 -0
- package/dist/commands/workflow/reset.js +51 -0
- package/dist/commands/workflow/result.d.ts +13 -0
- package/dist/commands/workflow/result.js +46 -0
- package/dist/commands/workflow/result.spec.d.ts +1 -0
- package/dist/commands/workflow/result.spec.js +23 -0
- package/dist/commands/workflow/run.d.ts +16 -0
- package/dist/commands/workflow/run.js +97 -0
- package/dist/commands/workflow/run.spec.d.ts +1 -0
- package/dist/commands/workflow/run.spec.js +110 -0
- package/dist/commands/workflow/runs/list.d.ts +14 -0
- package/dist/commands/workflow/runs/list.js +104 -0
- package/dist/commands/workflow/start.d.ts +15 -0
- package/dist/commands/workflow/start.js +62 -0
- package/dist/commands/workflow/start.spec.d.ts +1 -0
- package/dist/commands/workflow/start.spec.js +28 -0
- package/dist/commands/workflow/status.d.ts +13 -0
- package/dist/commands/workflow/status.js +57 -0
- package/dist/commands/workflow/status.spec.d.ts +1 -0
- package/dist/commands/workflow/status.spec.js +33 -0
- package/dist/commands/workflow/stop.d.ts +10 -0
- package/dist/commands/workflow/stop.js +31 -0
- package/dist/commands/workflow/stop.spec.d.ts +1 -0
- package/dist/commands/workflow/stop.spec.js +17 -0
- package/dist/commands/workflow/terminate.d.ts +13 -0
- package/dist/commands/workflow/terminate.js +39 -0
- package/dist/commands/workflow/test_eval.d.ts +20 -0
- package/dist/commands/workflow/test_eval.js +151 -0
- package/dist/config.d.ts +47 -0
- package/dist/config.js +47 -0
- package/dist/generated/framework_version.json +3 -0
- package/dist/hooks/init.d.ts +3 -0
- package/dist/hooks/init.js +30 -0
- package/dist/hooks/init.spec.d.ts +1 -0
- package/dist/hooks/init.spec.js +54 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.spec.d.ts +1 -0
- package/dist/index.spec.js +6 -0
- package/dist/services/claude_client.d.ts +30 -0
- package/dist/services/claude_client.integration.test.d.ts +1 -0
- package/dist/services/claude_client.integration.test.js +43 -0
- package/dist/services/claude_client.js +215 -0
- package/dist/services/claude_client.spec.d.ts +1 -0
- package/dist/services/claude_client.spec.js +145 -0
- package/dist/services/coding_agents.d.ts +36 -0
- package/dist/services/coding_agents.js +236 -0
- package/dist/services/coding_agents.spec.d.ts +1 -0
- package/dist/services/coding_agents.spec.js +256 -0
- package/dist/services/copy_assets.spec.d.ts +1 -0
- package/dist/services/copy_assets.spec.js +22 -0
- package/dist/services/cost_calculator.d.ts +18 -0
- package/dist/services/cost_calculator.js +359 -0
- package/dist/services/cost_calculator.spec.d.ts +1 -0
- package/dist/services/cost_calculator.spec.js +540 -0
- package/dist/services/credentials_service.d.ts +12 -0
- package/dist/services/credentials_service.integration.test.d.ts +1 -0
- package/dist/services/credentials_service.integration.test.js +66 -0
- package/dist/services/credentials_service.js +64 -0
- package/dist/services/credentials_service.spec.d.ts +1 -0
- package/dist/services/credentials_service.spec.js +106 -0
- package/dist/services/datasets.d.ts +20 -0
- package/dist/services/datasets.js +132 -0
- package/dist/services/docker.d.ts +39 -0
- package/dist/services/docker.js +160 -0
- package/dist/services/docker.spec.d.ts +1 -0
- package/dist/services/docker.spec.js +124 -0
- package/dist/services/env_configurator.d.ts +15 -0
- package/dist/services/env_configurator.js +163 -0
- package/dist/services/env_configurator.spec.d.ts +1 -0
- package/dist/services/env_configurator.spec.js +192 -0
- package/dist/services/generate_plan_name@v1.prompt +24 -0
- package/dist/services/messages.d.ts +9 -0
- package/dist/services/messages.js +338 -0
- package/dist/services/messages.spec.d.ts +1 -0
- package/dist/services/messages.spec.js +55 -0
- package/dist/services/npm_update_service.d.ts +6 -0
- package/dist/services/npm_update_service.js +87 -0
- package/dist/services/npm_update_service.spec.d.ts +1 -0
- package/dist/services/npm_update_service.spec.js +104 -0
- package/dist/services/project_scaffold.d.ts +31 -0
- package/dist/services/project_scaffold.js +212 -0
- package/dist/services/project_scaffold.spec.d.ts +1 -0
- package/dist/services/project_scaffold.spec.js +122 -0
- package/dist/services/s3_trace_downloader.d.ts +12 -0
- package/dist/services/s3_trace_downloader.js +57 -0
- package/dist/services/template_processor.d.ts +14 -0
- package/dist/services/template_processor.js +57 -0
- package/dist/services/trace_reader.d.ts +16 -0
- package/dist/services/trace_reader.js +57 -0
- package/dist/services/trace_reader.spec.d.ts +1 -0
- package/dist/services/trace_reader.spec.js +78 -0
- package/dist/services/version_check.d.ts +6 -0
- package/dist/services/version_check.js +52 -0
- package/dist/services/version_check.spec.d.ts +1 -0
- package/dist/services/version_check.spec.js +106 -0
- package/dist/services/workflow_builder.d.ts +16 -0
- package/dist/services/workflow_builder.js +86 -0
- package/dist/services/workflow_builder.spec.d.ts +1 -0
- package/dist/services/workflow_builder.spec.js +165 -0
- package/dist/services/workflow_generator.d.ts +5 -0
- package/dist/services/workflow_generator.js +40 -0
- package/dist/services/workflow_generator.spec.d.ts +1 -0
- package/dist/services/workflow_generator.spec.js +77 -0
- package/dist/services/workflow_planner.d.ts +15 -0
- package/dist/services/workflow_planner.js +48 -0
- package/dist/services/workflow_planner.spec.d.ts +1 -0
- package/dist/services/workflow_planner.spec.js +122 -0
- package/dist/services/workflow_runs.d.ts +14 -0
- package/dist/services/workflow_runs.js +25 -0
- package/dist/templates/agent_instructions/CLAUDE.md.template +19 -0
- package/dist/templates/agent_instructions/dotclaude/settings.json.template +29 -0
- package/dist/templates/project/.env.example.template +9 -0
- package/dist/templates/project/.gitignore.template +35 -0
- package/dist/templates/project/README.md.template +100 -0
- package/dist/templates/project/config/costs.yml.template +29 -0
- package/dist/templates/project/package.json.template +25 -0
- package/dist/templates/project/src/clients/jina.ts.template +30 -0
- package/dist/templates/project/src/shared/utils/string.ts.template +3 -0
- package/dist/templates/project/src/shared/utils/url.ts.template +15 -0
- package/dist/templates/project/src/workflows/blog_evaluator/evaluators.ts.template +23 -0
- package/dist/templates/project/src/workflows/blog_evaluator/prompts/signal_noise@v1.prompt.template +26 -0
- package/dist/templates/project/src/workflows/blog_evaluator/scenarios/paulgraham_hwh.json.template +3 -0
- package/dist/templates/project/src/workflows/blog_evaluator/steps.ts.template +27 -0
- package/dist/templates/project/src/workflows/blog_evaluator/types.ts.template +30 -0
- package/dist/templates/project/src/workflows/blog_evaluator/utils.ts.template +15 -0
- package/dist/templates/project/src/workflows/blog_evaluator/workflow.ts.template +27 -0
- package/dist/templates/project/tsconfig.json.template +20 -0
- package/dist/templates/workflow/README.md.template +216 -0
- package/dist/templates/workflow/evaluators.ts.template +21 -0
- package/dist/templates/workflow/prompts/example@v1.prompt.template +15 -0
- package/dist/templates/workflow/scenarios/test_input.json.template +3 -0
- package/dist/templates/workflow/steps.ts.template +20 -0
- package/dist/templates/workflow/types.ts.template +13 -0
- package/dist/templates/workflow/workflow.ts.template +23 -0
- package/dist/test_helpers/mocks.d.ts +38 -0
- package/dist/test_helpers/mocks.js +77 -0
- package/dist/types/cost.d.ts +149 -0
- package/dist/types/cost.js +6 -0
- package/dist/types/domain.d.ts +20 -0
- package/dist/types/domain.js +4 -0
- package/dist/types/errors.d.ts +68 -0
- package/dist/types/errors.js +100 -0
- package/dist/types/errors.spec.d.ts +1 -0
- package/dist/types/errors.spec.js +18 -0
- package/dist/types/generator.d.ts +26 -0
- package/dist/types/generator.js +1 -0
- package/dist/types/trace.d.ts +161 -0
- package/dist/types/trace.js +18 -0
- package/dist/utils/claude.d.ts +5 -0
- package/dist/utils/claude.js +19 -0
- package/dist/utils/claude.spec.d.ts +1 -0
- package/dist/utils/claude.spec.js +119 -0
- package/dist/utils/constants.d.ts +5 -0
- package/dist/utils/constants.js +4 -0
- package/dist/utils/cost_formatter.d.ts +5 -0
- package/dist/utils/cost_formatter.js +218 -0
- package/dist/utils/date_formatter.d.ts +23 -0
- package/dist/utils/date_formatter.js +49 -0
- package/dist/utils/env_loader.d.ts +1 -0
- package/dist/utils/env_loader.js +22 -0
- package/dist/utils/env_loader.spec.d.ts +1 -0
- package/dist/utils/env_loader.spec.js +43 -0
- package/dist/utils/error_handler.d.ts +8 -0
- package/dist/utils/error_handler.js +71 -0
- package/dist/utils/error_utils.d.ts +24 -0
- package/dist/utils/error_utils.js +87 -0
- package/dist/utils/file_system.d.ts +3 -0
- package/dist/utils/file_system.js +33 -0
- package/dist/utils/format_workflow_result.d.ts +5 -0
- package/dist/utils/format_workflow_result.js +18 -0
- package/dist/utils/format_workflow_result.spec.d.ts +1 -0
- package/dist/utils/format_workflow_result.spec.js +81 -0
- package/dist/utils/framework_version.d.ts +4 -0
- package/dist/utils/framework_version.js +4 -0
- package/dist/utils/framework_version.spec.d.ts +1 -0
- package/dist/utils/framework_version.spec.js +13 -0
- package/dist/utils/header_utils.d.ts +12 -0
- package/dist/utils/header_utils.js +29 -0
- package/dist/utils/header_utils.spec.d.ts +1 -0
- package/dist/utils/header_utils.spec.js +52 -0
- package/dist/utils/input_parser.d.ts +1 -0
- package/dist/utils/input_parser.js +19 -0
- package/dist/utils/output_formatter.d.ts +2 -0
- package/dist/utils/output_formatter.js +11 -0
- package/dist/utils/paths.d.ts +25 -0
- package/dist/utils/paths.js +36 -0
- package/dist/utils/process.d.ts +4 -0
- package/dist/utils/process.js +50 -0
- package/dist/utils/resolve_input.d.ts +1 -0
- package/dist/utils/resolve_input.js +22 -0
- package/dist/utils/scenario_resolver.d.ts +9 -0
- package/dist/utils/scenario_resolver.js +93 -0
- package/dist/utils/scenario_resolver.spec.d.ts +1 -0
- package/dist/utils/scenario_resolver.spec.js +214 -0
- package/dist/utils/secret_sanitizer.d.ts +1 -0
- package/dist/utils/secret_sanitizer.js +29 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.js +5 -0
- package/dist/utils/template.d.ts +9 -0
- package/dist/utils/template.js +30 -0
- package/dist/utils/template.spec.d.ts +1 -0
- package/dist/utils/template.spec.js +77 -0
- package/dist/utils/trace_extractor.d.ts +27 -0
- package/dist/utils/trace_extractor.js +53 -0
- package/dist/utils/trace_formatter.d.ts +11 -0
- package/dist/utils/trace_formatter.js +402 -0
- package/dist/utils/validation.d.ts +13 -0
- package/dist/utils/validation.js +25 -0
- package/dist/utils/validation.spec.d.ts +1 -0
- package/dist/utils/validation.spec.js +140 -0
- package/package.json +4 -4
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
# LLM Token Pricing Configuration
|
|
2
|
+
# Prices are per million tokens (as of Feb 2026)
|
|
3
|
+
# Update these values as pricing changes
|
|
4
|
+
|
|
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
|
+
claude-opus-4:
|
|
22
|
+
provider: anthropic
|
|
23
|
+
input: 15.00
|
|
24
|
+
output: 75.00
|
|
25
|
+
cached_input: 1.50
|
|
26
|
+
|
|
27
|
+
claude-opus-4-6:
|
|
28
|
+
provider: anthropic
|
|
29
|
+
input: 5.00
|
|
30
|
+
output: 25.00
|
|
31
|
+
cached_input: 0.50
|
|
32
|
+
|
|
33
|
+
claude-opus-4-5:
|
|
34
|
+
provider: anthropic
|
|
35
|
+
input: 5.00
|
|
36
|
+
output: 25.00
|
|
37
|
+
cached_input: 0.50
|
|
38
|
+
|
|
39
|
+
claude-sonnet-4-5:
|
|
40
|
+
provider: anthropic
|
|
41
|
+
input: 3.00
|
|
42
|
+
output: 15.00
|
|
43
|
+
cached_input: 0.30
|
|
44
|
+
|
|
45
|
+
# Legacy models
|
|
46
|
+
claude-3-5-sonnet-20241022:
|
|
47
|
+
provider: anthropic
|
|
48
|
+
input: 3.00
|
|
49
|
+
output: 15.00
|
|
50
|
+
cached_input: 0.30
|
|
51
|
+
|
|
52
|
+
claude-3-5-haiku-20241022:
|
|
53
|
+
provider: anthropic
|
|
54
|
+
input: 0.80
|
|
55
|
+
output: 4.00
|
|
56
|
+
cached_input: 0.08
|
|
57
|
+
|
|
58
|
+
# =============================================================================
|
|
59
|
+
# OpenAI
|
|
60
|
+
# =============================================================================
|
|
61
|
+
|
|
62
|
+
# GPT-5 series
|
|
63
|
+
gpt-5.2:
|
|
64
|
+
provider: openai
|
|
65
|
+
input: 1.75
|
|
66
|
+
output: 14.00
|
|
67
|
+
cached_input: 0.175
|
|
68
|
+
|
|
69
|
+
gpt-5.2-pro:
|
|
70
|
+
provider: openai
|
|
71
|
+
input: 21.00
|
|
72
|
+
output: 168.00
|
|
73
|
+
|
|
74
|
+
gpt-5-mini:
|
|
75
|
+
provider: openai
|
|
76
|
+
input: 0.25
|
|
77
|
+
output: 2.00
|
|
78
|
+
cached_input: 0.025
|
|
79
|
+
|
|
80
|
+
gpt-5-nano:
|
|
81
|
+
provider: openai
|
|
82
|
+
input: 0.05
|
|
83
|
+
output: 0.40
|
|
84
|
+
cached_input: 0.005
|
|
85
|
+
|
|
86
|
+
# GPT-4.1 series
|
|
87
|
+
gpt-4.1:
|
|
88
|
+
provider: openai
|
|
89
|
+
input: 2.00
|
|
90
|
+
output: 8.00
|
|
91
|
+
cached_input: 0.50
|
|
92
|
+
|
|
93
|
+
gpt-4.1-mini:
|
|
94
|
+
provider: openai
|
|
95
|
+
input: 0.40
|
|
96
|
+
output: 1.60
|
|
97
|
+
cached_input: 0.10
|
|
98
|
+
|
|
99
|
+
gpt-4.1-nano:
|
|
100
|
+
provider: openai
|
|
101
|
+
input: 0.10
|
|
102
|
+
output: 0.40
|
|
103
|
+
cached_input: 0.025
|
|
104
|
+
|
|
105
|
+
# GPT-4o series (legacy)
|
|
106
|
+
gpt-4o:
|
|
107
|
+
provider: openai
|
|
108
|
+
input: 2.50
|
|
109
|
+
output: 10.00
|
|
110
|
+
cached_input: 1.25
|
|
111
|
+
|
|
112
|
+
gpt-4o-mini:
|
|
113
|
+
provider: openai
|
|
114
|
+
input: 0.15
|
|
115
|
+
output: 0.60
|
|
116
|
+
cached_input: 0.075
|
|
117
|
+
|
|
118
|
+
gpt-4-turbo:
|
|
119
|
+
provider: openai
|
|
120
|
+
input: 10.00
|
|
121
|
+
output: 30.00
|
|
122
|
+
|
|
123
|
+
gpt-4:
|
|
124
|
+
provider: openai
|
|
125
|
+
input: 30.00
|
|
126
|
+
output: 60.00
|
|
127
|
+
|
|
128
|
+
gpt-3.5-turbo:
|
|
129
|
+
provider: openai
|
|
130
|
+
input: 0.50
|
|
131
|
+
output: 1.50
|
|
132
|
+
|
|
133
|
+
# Reasoning models (o-series)
|
|
134
|
+
o1:
|
|
135
|
+
provider: openai
|
|
136
|
+
input: 15.00
|
|
137
|
+
output: 60.00
|
|
138
|
+
cached_input: 7.50
|
|
139
|
+
reasoning: 60.00
|
|
140
|
+
|
|
141
|
+
o1-mini:
|
|
142
|
+
provider: openai
|
|
143
|
+
input: 1.10
|
|
144
|
+
output: 4.40
|
|
145
|
+
cached_input: 0.55
|
|
146
|
+
reasoning: 4.40
|
|
147
|
+
|
|
148
|
+
o3-mini:
|
|
149
|
+
provider: openai
|
|
150
|
+
input: 1.10
|
|
151
|
+
output: 4.40
|
|
152
|
+
cached_input: 0.55
|
|
153
|
+
reasoning: 4.40
|
|
154
|
+
|
|
155
|
+
o4-mini:
|
|
156
|
+
provider: openai
|
|
157
|
+
input: 1.10
|
|
158
|
+
output: 4.40
|
|
159
|
+
cached_input: 0.275
|
|
160
|
+
|
|
161
|
+
# =============================================================================
|
|
162
|
+
# Google
|
|
163
|
+
# =============================================================================
|
|
164
|
+
gemini-1.5-pro:
|
|
165
|
+
provider: google
|
|
166
|
+
input: 1.25
|
|
167
|
+
output: 5.00
|
|
168
|
+
cached_input: 0.3125
|
|
169
|
+
|
|
170
|
+
gemini-1.5-flash:
|
|
171
|
+
provider: google
|
|
172
|
+
input: 0.075
|
|
173
|
+
output: 0.30
|
|
174
|
+
cached_input: 0.01875
|
|
175
|
+
|
|
176
|
+
gemini-2.0-flash:
|
|
177
|
+
provider: google
|
|
178
|
+
input: 0.10
|
|
179
|
+
output: 0.40
|
|
180
|
+
|
|
181
|
+
# =============================================================================
|
|
182
|
+
# Perplexity (usage-based, approximate)
|
|
183
|
+
# =============================================================================
|
|
184
|
+
llama-3.1-sonar-small-128k-online:
|
|
185
|
+
provider: perplexity
|
|
186
|
+
input: 0.20
|
|
187
|
+
output: 0.20
|
|
188
|
+
|
|
189
|
+
llama-3.1-sonar-large-128k-online:
|
|
190
|
+
provider: perplexity
|
|
191
|
+
input: 1.00
|
|
192
|
+
output: 1.00
|
|
193
|
+
|
|
194
|
+
llama-3.1-sonar-huge-128k-online:
|
|
195
|
+
provider: perplexity
|
|
196
|
+
input: 5.00
|
|
197
|
+
output: 5.00
|
|
198
|
+
|
|
199
|
+
# =============================================================================
|
|
200
|
+
# API Services - Extensible pricing for non-LLM APIs
|
|
201
|
+
# =============================================================================
|
|
202
|
+
#
|
|
203
|
+
# Pricing types:
|
|
204
|
+
# - token: Price per million tokens (usage extracted from response)
|
|
205
|
+
# - unit: Price per API unit (usage extracted or calculated from response)
|
|
206
|
+
# - request: Fixed price per request
|
|
207
|
+
#
|
|
208
|
+
# To add a new provider:
|
|
209
|
+
# 1. Add entry with url_pattern to match HTTP calls
|
|
210
|
+
# 2. Set type and pricing
|
|
211
|
+
# 3. Optional: usage_path to extract usage from response body
|
|
212
|
+
#
|
|
213
|
+
services:
|
|
214
|
+
# ---------------------------------------------------------------------------
|
|
215
|
+
# Jina Reader API - Token-based
|
|
216
|
+
# Pricing: https://jina.ai/reader/
|
|
217
|
+
# ---------------------------------------------------------------------------
|
|
218
|
+
jina:
|
|
219
|
+
type: token
|
|
220
|
+
url_pattern: "r.jina.ai"
|
|
221
|
+
usage_path: "body.data.usage.tokens"
|
|
222
|
+
per_million: 0.045 # $0.045 per 1M tokens
|
|
223
|
+
|
|
224
|
+
# ---------------------------------------------------------------------------
|
|
225
|
+
# Semrush API - Unit-based (converted to dollars)
|
|
226
|
+
# Pricing: https://developer.semrush.com/api/basics/api-units-balance/
|
|
227
|
+
# ---------------------------------------------------------------------------
|
|
228
|
+
semrush:
|
|
229
|
+
type: unit
|
|
230
|
+
url_pattern: "api.semrush.com"
|
|
231
|
+
price_per_unit: 0.00025 # ~$0.25 per 1000 units
|
|
232
|
+
endpoints:
|
|
233
|
+
backlinks_overview:
|
|
234
|
+
pattern: "type=backlinks_overview"
|
|
235
|
+
units_per_request: 10
|
|
236
|
+
domain_organic:
|
|
237
|
+
pattern: "type=domain_organic"
|
|
238
|
+
units_per_line: 10
|
|
239
|
+
phrase_related:
|
|
240
|
+
pattern: "type=phrase_related"
|
|
241
|
+
units_per_line: 40
|
|
242
|
+
domain_ranks:
|
|
243
|
+
pattern: "type=domain_ranks"
|
|
244
|
+
units_per_request: 10
|
|
245
|
+
|
|
246
|
+
# ---------------------------------------------------------------------------
|
|
247
|
+
# Exa Research API - Cost from response
|
|
248
|
+
# Pricing: https://exa.ai/pricing
|
|
249
|
+
#
|
|
250
|
+
# Exa's pricing structure (per 1k tasks):
|
|
251
|
+
# - Agent search operations: $5 (all models)
|
|
252
|
+
# - Agent page reads: $5 (exa-research/fast) or $10 (exa-research-pro) per 1k pages
|
|
253
|
+
# - Reasoning tokens: $5 per 1M tokens
|
|
254
|
+
#
|
|
255
|
+
# The API returns actual cost in response.body.costDollars.total
|
|
256
|
+
# which accounts for searches, page reads, and reasoning tokens.
|
|
257
|
+
# ---------------------------------------------------------------------------
|
|
258
|
+
exa:
|
|
259
|
+
type: response_cost
|
|
260
|
+
url_pattern: "api.exa.ai"
|
|
261
|
+
cost_path: "output.body.costDollars.total"
|
|
262
|
+
# Exa uses async flow: POST creates task, GET returns results with costDollars
|
|
263
|
+
# Only count GET responses that have costDollars.total - no fallback needed
|
|
264
|
+
# For traces without verbose HTTP bodies, Exa costs will show as $0
|
|
265
|
+
|
|
266
|
+
# ---------------------------------------------------------------------------
|
|
267
|
+
# Tavily API - Request-based
|
|
268
|
+
# Pricing: https://tavily.com/pricing
|
|
269
|
+
# ---------------------------------------------------------------------------
|
|
270
|
+
tavily:
|
|
271
|
+
type: request
|
|
272
|
+
url_pattern: "api.tavily.com"
|
|
273
|
+
endpoints:
|
|
274
|
+
search:
|
|
275
|
+
pattern: "/search"
|
|
276
|
+
price: 0.01
|
|
277
|
+
extract:
|
|
278
|
+
pattern: "/extract"
|
|
279
|
+
price_per_item: 0.005
|
|
280
|
+
items_path: "body.urls"
|
|
281
|
+
|
|
282
|
+
# ---------------------------------------------------------------------------
|
|
283
|
+
# DataForSEO API - Request-based
|
|
284
|
+
# Pricing: https://dataforseo.com/pricing
|
|
285
|
+
# ---------------------------------------------------------------------------
|
|
286
|
+
dataforseo:
|
|
287
|
+
type: request
|
|
288
|
+
url_pattern: "api.dataforseo.com"
|
|
289
|
+
endpoints:
|
|
290
|
+
whois:
|
|
291
|
+
pattern: "/whois"
|
|
292
|
+
price: 0.015
|
|
293
|
+
bulk_traffic:
|
|
294
|
+
pattern: "/bulk_traffic"
|
|
295
|
+
price_per_item: 0.075
|
|
296
|
+
items_path: "body[0].targets"
|
|
297
|
+
|
|
298
|
+
# ---------------------------------------------------------------------------
|
|
299
|
+
# Perplexity API (direct HTTP calls, not via LLM SDK)
|
|
300
|
+
# Pricing: https://docs.perplexity.ai/guides/pricing
|
|
301
|
+
# ---------------------------------------------------------------------------
|
|
302
|
+
perplexity_api:
|
|
303
|
+
type: token
|
|
304
|
+
url_pattern: "api.perplexity.ai"
|
|
305
|
+
usage_path: "body.usage"
|
|
306
|
+
input_field: "prompt_tokens"
|
|
307
|
+
output_field: "completion_tokens"
|
|
308
|
+
input_per_million: 1.00
|
|
309
|
+
output_per_million: 1.00
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
name: ${DOCKER_SERVICE_NAME:-output-sdk}
|
|
2
|
+
services:
|
|
3
|
+
redis:
|
|
4
|
+
image: redis:8-alpine
|
|
5
|
+
networks:
|
|
6
|
+
- main
|
|
7
|
+
ports:
|
|
8
|
+
- '6379:6379'
|
|
9
|
+
volumes:
|
|
10
|
+
- redis:/data
|
|
11
|
+
healthcheck:
|
|
12
|
+
test: ['CMD', 'redis-cli', 'ping']
|
|
13
|
+
interval: 2s
|
|
14
|
+
timeout: 2s
|
|
15
|
+
retries: 5
|
|
16
|
+
start_period: 3s
|
|
17
|
+
|
|
18
|
+
postgresql:
|
|
19
|
+
environment:
|
|
20
|
+
POSTGRES_PASSWORD: temporal
|
|
21
|
+
POSTGRES_USER: temporal
|
|
22
|
+
image: postgres:17.5
|
|
23
|
+
networks:
|
|
24
|
+
- main
|
|
25
|
+
expose:
|
|
26
|
+
- 5432
|
|
27
|
+
volumes:
|
|
28
|
+
- postgres:/var/lib/postgresql/data
|
|
29
|
+
healthcheck:
|
|
30
|
+
test: ['CMD-SHELL', 'pg_isready -U temporal -d temporal']
|
|
31
|
+
interval: 2s
|
|
32
|
+
timeout: 2s
|
|
33
|
+
retries: 5
|
|
34
|
+
start_period: 3s
|
|
35
|
+
|
|
36
|
+
temporal:
|
|
37
|
+
depends_on:
|
|
38
|
+
postgresql:
|
|
39
|
+
condition: service_healthy
|
|
40
|
+
redis:
|
|
41
|
+
condition: service_healthy
|
|
42
|
+
environment:
|
|
43
|
+
- DB=postgres12
|
|
44
|
+
- DB_PORT=5432
|
|
45
|
+
- POSTGRES_USER=temporal
|
|
46
|
+
- POSTGRES_PWD=temporal
|
|
47
|
+
- POSTGRES_SEEDS=postgresql
|
|
48
|
+
image: temporalio/auto-setup:latest
|
|
49
|
+
networks:
|
|
50
|
+
- main
|
|
51
|
+
ports:
|
|
52
|
+
- '7233:7233'
|
|
53
|
+
healthcheck:
|
|
54
|
+
test:
|
|
55
|
+
[
|
|
56
|
+
'CMD',
|
|
57
|
+
'sh',
|
|
58
|
+
'-c',
|
|
59
|
+
'tctl --address temporal:7233 cluster health 2>&1 | grep -q "temporal.api.workflowservice.v1.WorkflowService: SERVING"'
|
|
60
|
+
]
|
|
61
|
+
interval: 3s
|
|
62
|
+
timeout: 5s
|
|
63
|
+
retries: 20
|
|
64
|
+
start_period: 10s
|
|
65
|
+
|
|
66
|
+
temporal-ui:
|
|
67
|
+
depends_on:
|
|
68
|
+
- temporal
|
|
69
|
+
environment:
|
|
70
|
+
- TEMPORAL_ADDRESS=temporal:7233
|
|
71
|
+
- TEMPORAL_CORS_ORIGINS=http://localhost:3000
|
|
72
|
+
image: temporalio/ui:latest
|
|
73
|
+
networks:
|
|
74
|
+
- main
|
|
75
|
+
ports:
|
|
76
|
+
- '8080:8080'
|
|
77
|
+
|
|
78
|
+
api:
|
|
79
|
+
depends_on:
|
|
80
|
+
temporal:
|
|
81
|
+
condition: service_healthy
|
|
82
|
+
worker:
|
|
83
|
+
condition: service_healthy
|
|
84
|
+
image: outputai/api:${OUTPUT_API_VERSION:-0.1.5}
|
|
85
|
+
init: true
|
|
86
|
+
networks:
|
|
87
|
+
- main
|
|
88
|
+
env_file:
|
|
89
|
+
- path: ./${OUTPUT_WORKFLOWS_DIR:-.}/.env
|
|
90
|
+
required: false
|
|
91
|
+
environment:
|
|
92
|
+
- NODE_ENV=development
|
|
93
|
+
- OUTPUT_API_PORT=3001
|
|
94
|
+
- OUTPUT_CATALOG_ID=${OUTPUT_CATALOG_ID:-main}
|
|
95
|
+
- OUTPUT_AWS_REGION=${AWS_REGION:-us-west-1}
|
|
96
|
+
- OUTPUT_AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-}
|
|
97
|
+
- OUTPUT_AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-}
|
|
98
|
+
- TEMPORAL_ADDRESS=temporal:7233
|
|
99
|
+
ports:
|
|
100
|
+
- '3001:3001'
|
|
101
|
+
|
|
102
|
+
worker:
|
|
103
|
+
depends_on:
|
|
104
|
+
temporal:
|
|
105
|
+
condition: service_healthy
|
|
106
|
+
image: node:24.13.0-slim
|
|
107
|
+
healthcheck:
|
|
108
|
+
test: [ 'CMD', 'npx', '--yes', 'output-healthcheck' ]
|
|
109
|
+
interval: 3s
|
|
110
|
+
timeout: 10s
|
|
111
|
+
retries: 20
|
|
112
|
+
start_period: 30s
|
|
113
|
+
init: true
|
|
114
|
+
networks:
|
|
115
|
+
- main
|
|
116
|
+
env_file:
|
|
117
|
+
- path: ./${OUTPUT_WORKFLOWS_DIR:-.}/.env
|
|
118
|
+
required: false
|
|
119
|
+
environment:
|
|
120
|
+
- NODE_ENV=development
|
|
121
|
+
- OUTPUT_CATALOG_ID=${OUTPUT_CATALOG_ID:-main}
|
|
122
|
+
- OUTPUT_REDIS_URL=redis://redis:6379
|
|
123
|
+
- OUTPUT_TRACE_LOCAL_ON=${OUTPUT_TRACE_LOCAL_ON:-true}
|
|
124
|
+
- OUTPUT_TRACE_HOST_PATH=${PWD}/logs
|
|
125
|
+
- OUTPUT_TRACE_HTTP_VERBOSE=${OUTPUT_TRACE_HTTP_VERBOSE:-true}
|
|
126
|
+
- TEMPORAL_ADDRESS=temporal:7233
|
|
127
|
+
- NODE_OPTIONS=${NODE_OPTIONS:---max-old-space-size=4096}
|
|
128
|
+
command: >
|
|
129
|
+
sh -c "
|
|
130
|
+
npm run output:worker:install &&
|
|
131
|
+
echo 'Installed dependencies' &&
|
|
132
|
+
npx nodemon --watch src --watch package.json --ext ts,js,json,prompt --ignore 'dist/**' --ignore '**/*.test.ts' --ignore '**/*.spec.ts' --exec 'npm run output:worker:install && npm run output:worker:build && npm run output:worker:start'
|
|
133
|
+
"
|
|
134
|
+
working_dir: /app/${OUTPUT_WORKFLOWS_DIR:-.}
|
|
135
|
+
volumes:
|
|
136
|
+
- ./:/app
|
|
137
|
+
- worker_node_modules:/app/${OUTPUT_WORKFLOWS_DIR:-.}/node_modules
|
|
138
|
+
|
|
139
|
+
volumes:
|
|
140
|
+
postgres:
|
|
141
|
+
redis:
|
|
142
|
+
worker_node_modules:
|
|
143
|
+
|
|
144
|
+
networks:
|
|
145
|
+
main:
|
|
146
|
+
driver: bridge
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class CredentialsEdit extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
environment: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
workflow: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { spawnSync } from 'node:child_process';
|
|
6
|
+
import { load as parseYaml } from 'js-yaml';
|
|
7
|
+
import { decryptCredentials, writeEncrypted, credentialsExist, resolveCredentialsPath } from '#services/credentials_service.js';
|
|
8
|
+
export default class CredentialsEdit extends Command {
|
|
9
|
+
static description = 'Edit encrypted credentials in your $EDITOR';
|
|
10
|
+
static examples = [
|
|
11
|
+
'<%= config.bin %> <%= command.id %>',
|
|
12
|
+
'<%= config.bin %> <%= command.id %> --environment production',
|
|
13
|
+
'<%= config.bin %> <%= command.id %> --workflow my_workflow'
|
|
14
|
+
];
|
|
15
|
+
static flags = {
|
|
16
|
+
environment: Flags.string({
|
|
17
|
+
char: 'e',
|
|
18
|
+
description: 'Target environment (e.g. production, development)'
|
|
19
|
+
}),
|
|
20
|
+
workflow: Flags.string({
|
|
21
|
+
char: 'w',
|
|
22
|
+
description: 'Target a specific workflow directory'
|
|
23
|
+
})
|
|
24
|
+
};
|
|
25
|
+
async run() {
|
|
26
|
+
const { flags } = await this.parse(CredentialsEdit);
|
|
27
|
+
const environment = flags.environment;
|
|
28
|
+
const workflow = flags.workflow;
|
|
29
|
+
if (environment && workflow) {
|
|
30
|
+
this.error('Cannot specify both --environment and --workflow.');
|
|
31
|
+
}
|
|
32
|
+
if (!credentialsExist(environment, workflow)) {
|
|
33
|
+
this.error(`No credentials file found at ${resolveCredentialsPath(environment, workflow)}. Run "output credentials init" first.`);
|
|
34
|
+
}
|
|
35
|
+
const editorEnv = process.env.EDITOR || process.env.VISUAL || 'vi';
|
|
36
|
+
const [editorCmd, ...editorArgs] = editorEnv.split(/\s+/);
|
|
37
|
+
const plaintext = decryptCredentials(environment, workflow);
|
|
38
|
+
const tmpFile = path.join(os.tmpdir(), `output-credentials-${Date.now()}.yml`);
|
|
39
|
+
try {
|
|
40
|
+
fs.writeFileSync(tmpFile, plaintext, { mode: 0o600 });
|
|
41
|
+
const result = spawnSync(editorCmd, [...editorArgs, tmpFile], { stdio: 'inherit' });
|
|
42
|
+
if (result.error) {
|
|
43
|
+
this.error(`Failed to launch editor: ${result.error.message}`);
|
|
44
|
+
}
|
|
45
|
+
if (result.status !== 0) {
|
|
46
|
+
this.error(`Editor exited with non-zero status: ${result.status}`);
|
|
47
|
+
}
|
|
48
|
+
const edited = fs.readFileSync(tmpFile, 'utf8');
|
|
49
|
+
// Validate YAML before saving
|
|
50
|
+
parseYaml(edited);
|
|
51
|
+
writeEncrypted(environment, edited, workflow);
|
|
52
|
+
this.log('Credentials saved successfully.');
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
try {
|
|
56
|
+
if (fs.existsSync(tmpFile)) {
|
|
57
|
+
const size = fs.statSync(tmpFile).size;
|
|
58
|
+
fs.writeFileSync(tmpFile, '\0'.repeat(size));
|
|
59
|
+
fs.unlinkSync(tmpFile);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// best-effort cleanup
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
3
|
+
import * as credentialsService from '#services/credentials_service.js';
|
|
4
|
+
import CredentialsEdit from './edit.js';
|
|
5
|
+
vi.mock('#services/credentials_service.js');
|
|
6
|
+
vi.mock('js-yaml', () => ({
|
|
7
|
+
load: vi.fn()
|
|
8
|
+
}));
|
|
9
|
+
vi.mock('node:fs', () => ({
|
|
10
|
+
default: {
|
|
11
|
+
writeFileSync: vi.fn(),
|
|
12
|
+
readFileSync: vi.fn(() => 'edited: content\n'),
|
|
13
|
+
existsSync: vi.fn(() => true),
|
|
14
|
+
statSync: vi.fn(() => ({ size: 16 })),
|
|
15
|
+
unlinkSync: vi.fn()
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
|
+
vi.mock('node:child_process', () => ({
|
|
19
|
+
spawnSync: vi.fn(() => ({ status: 0 }))
|
|
20
|
+
}));
|
|
21
|
+
describe('credentials edit command', () => {
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
vi.clearAllMocks();
|
|
24
|
+
vi.mocked(credentialsService.credentialsExist).mockReturnValue(true);
|
|
25
|
+
vi.mocked(credentialsService.decryptCredentials).mockReturnValue('anthropic:\n api_key: sk-test\n');
|
|
26
|
+
});
|
|
27
|
+
afterEach(() => {
|
|
28
|
+
vi.restoreAllMocks();
|
|
29
|
+
});
|
|
30
|
+
const createTestCommand = (flags = {}) => {
|
|
31
|
+
const cmd = new CredentialsEdit([], {});
|
|
32
|
+
cmd.log = vi.fn();
|
|
33
|
+
cmd.error = vi.fn((msg) => {
|
|
34
|
+
throw new Error(msg);
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(cmd, 'parse', {
|
|
37
|
+
value: vi.fn().mockResolvedValue({
|
|
38
|
+
args: {},
|
|
39
|
+
flags: { environment: undefined, workflow: undefined, ...flags }
|
|
40
|
+
}),
|
|
41
|
+
configurable: true
|
|
42
|
+
});
|
|
43
|
+
return cmd;
|
|
44
|
+
};
|
|
45
|
+
describe('command structure', () => {
|
|
46
|
+
it('should have correct description', () => {
|
|
47
|
+
expect(CredentialsEdit.description).toContain('Edit');
|
|
48
|
+
});
|
|
49
|
+
it('should have environment and workflow flags', () => {
|
|
50
|
+
expect(CredentialsEdit.flags.environment).toBeDefined();
|
|
51
|
+
expect(CredentialsEdit.flags.workflow).toBeDefined();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe('command execution', () => {
|
|
55
|
+
it('should decrypt, spawn editor, and re-encrypt', async () => {
|
|
56
|
+
const cmd = createTestCommand();
|
|
57
|
+
await cmd.run();
|
|
58
|
+
expect(credentialsService.decryptCredentials).toHaveBeenCalledWith(undefined, undefined);
|
|
59
|
+
expect(credentialsService.writeEncrypted).toHaveBeenCalled();
|
|
60
|
+
expect(cmd.log).toHaveBeenCalledWith('Credentials saved successfully.');
|
|
61
|
+
});
|
|
62
|
+
it('should error when both environment and workflow are specified', async () => {
|
|
63
|
+
const cmd = createTestCommand({ environment: 'production', workflow: 'my_workflow' });
|
|
64
|
+
await expect(cmd.run()).rejects.toThrow('Cannot specify both');
|
|
65
|
+
});
|
|
66
|
+
it('should error when credentials file does not exist', async () => {
|
|
67
|
+
vi.mocked(credentialsService.credentialsExist).mockReturnValue(false);
|
|
68
|
+
vi.mocked(credentialsService.resolveCredentialsPath).mockReturnValue('/project/config/credentials.yml.enc');
|
|
69
|
+
const cmd = createTestCommand();
|
|
70
|
+
await expect(cmd.run()).rejects.toThrow('No credentials file found');
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class CredentialsGet extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
path: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
environment: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
workflow: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { load as parseYaml } from 'js-yaml';
|
|
3
|
+
import { getNestedValue } from '@outputai/credentials';
|
|
4
|
+
import { decryptCredentials, credentialsExist, resolveCredentialsPath } from '#services/credentials_service.js';
|
|
5
|
+
export default class CredentialsGet extends Command {
|
|
6
|
+
static description = 'Get a specific credential value by dot-notation path';
|
|
7
|
+
static examples = [
|
|
8
|
+
'<%= config.bin %> <%= command.id %> anthropic.api_key',
|
|
9
|
+
'<%= config.bin %> <%= command.id %> aws.region --environment production',
|
|
10
|
+
'<%= config.bin %> <%= command.id %> stripe.key --workflow my_workflow'
|
|
11
|
+
];
|
|
12
|
+
static args = {
|
|
13
|
+
path: Args.string({
|
|
14
|
+
description: 'Dot-notation path to the credential (e.g. anthropic.api_key)',
|
|
15
|
+
required: true
|
|
16
|
+
})
|
|
17
|
+
};
|
|
18
|
+
static flags = {
|
|
19
|
+
environment: Flags.string({
|
|
20
|
+
char: 'e',
|
|
21
|
+
description: 'Target environment (e.g. production, development)'
|
|
22
|
+
}),
|
|
23
|
+
workflow: Flags.string({
|
|
24
|
+
char: 'w',
|
|
25
|
+
description: 'Target a specific workflow directory'
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
async run() {
|
|
29
|
+
const { args, flags } = await this.parse(CredentialsGet);
|
|
30
|
+
const environment = flags.environment;
|
|
31
|
+
const workflow = flags.workflow;
|
|
32
|
+
if (environment && workflow) {
|
|
33
|
+
this.error('Cannot specify both --environment and --workflow.');
|
|
34
|
+
}
|
|
35
|
+
if (!credentialsExist(environment, workflow)) {
|
|
36
|
+
this.error(`No credentials file found at ${resolveCredentialsPath(environment, workflow)}. Run "output credentials init" first.`);
|
|
37
|
+
}
|
|
38
|
+
const plaintext = decryptCredentials(environment, workflow);
|
|
39
|
+
const data = parseYaml(plaintext);
|
|
40
|
+
const value = getNestedValue(data, args.path);
|
|
41
|
+
if (value === undefined || value === null) {
|
|
42
|
+
this.error(`Credential not found: ${args.path}`);
|
|
43
|
+
}
|
|
44
|
+
this.log(typeof value === 'object' ? JSON.stringify(value, null, 2) : String(value));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|