@tiangong-lca/cli 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +368 -0
- package/bin/tiangong.d.ts +1 -0
- package/bin/tiangong.js +32 -0
- package/dist/scripts/assert-full-coverage.js +77 -0
- package/dist/scripts/assert-full-coverage.js.map +1 -0
- package/dist/src/cli.js +2740 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/lib/artifacts.js +86 -0
- package/dist/src/lib/artifacts.js.map +1 -0
- package/dist/src/lib/dotenv.js +36 -0
- package/dist/src/lib/dotenv.js.map +1 -0
- package/dist/src/lib/env.js +139 -0
- package/dist/src/lib/env.js.map +1 -0
- package/dist/src/lib/errors.js +38 -0
- package/dist/src/lib/errors.js.map +1 -0
- package/dist/src/lib/flow-build-alias-map.js +299 -0
- package/dist/src/lib/flow-build-alias-map.js.map +1 -0
- package/dist/src/lib/flow-get.js +81 -0
- package/dist/src/lib/flow-get.js.map +1 -0
- package/dist/src/lib/flow-governance.js +164 -0
- package/dist/src/lib/flow-governance.js.map +1 -0
- package/dist/src/lib/flow-list.js +187 -0
- package/dist/src/lib/flow-list.js.map +1 -0
- package/dist/src/lib/flow-publish-reviewed-data.js +808 -0
- package/dist/src/lib/flow-publish-reviewed-data.js.map +1 -0
- package/dist/src/lib/flow-publish-version.js +541 -0
- package/dist/src/lib/flow-publish-version.js.map +1 -0
- package/dist/src/lib/flow-read.js +310 -0
- package/dist/src/lib/flow-read.js.map +1 -0
- package/dist/src/lib/flow-regen-product.js +1396 -0
- package/dist/src/lib/flow-regen-product.js.map +1 -0
- package/dist/src/lib/flow-remediate.js +821 -0
- package/dist/src/lib/flow-remediate.js.map +1 -0
- package/dist/src/lib/http.js +45 -0
- package/dist/src/lib/http.js.map +1 -0
- package/dist/src/lib/io.js +30 -0
- package/dist/src/lib/io.js.map +1 -0
- package/dist/src/lib/kb-search.js +83 -0
- package/dist/src/lib/kb-search.js.map +1 -0
- package/dist/src/lib/lifecyclemodel-auto-build.js +1328 -0
- package/dist/src/lib/lifecyclemodel-auto-build.js.map +1 -0
- package/dist/src/lib/lifecyclemodel-orchestrate.js +1556 -0
- package/dist/src/lib/lifecyclemodel-orchestrate.js.map +1 -0
- package/dist/src/lib/lifecyclemodel-publish-build.js +296 -0
- package/dist/src/lib/lifecyclemodel-publish-build.js.map +1 -0
- package/dist/src/lib/lifecyclemodel-publish-resulting-process.js +101 -0
- package/dist/src/lib/lifecyclemodel-publish-resulting-process.js.map +1 -0
- package/dist/src/lib/lifecyclemodel-resulting-process.js +1152 -0
- package/dist/src/lib/lifecyclemodel-resulting-process.js.map +1 -0
- package/dist/src/lib/lifecyclemodel-validate-build.js +238 -0
- package/dist/src/lib/lifecyclemodel-validate-build.js.map +1 -0
- package/dist/src/lib/llm.js +383 -0
- package/dist/src/lib/llm.js.map +1 -0
- package/dist/src/lib/process-auto-build.js +717 -0
- package/dist/src/lib/process-auto-build.js.map +1 -0
- package/dist/src/lib/process-batch-build.js +409 -0
- package/dist/src/lib/process-batch-build.js.map +1 -0
- package/dist/src/lib/process-get.js +66 -0
- package/dist/src/lib/process-get.js.map +1 -0
- package/dist/src/lib/process-publish-build.js +451 -0
- package/dist/src/lib/process-publish-build.js.map +1 -0
- package/dist/src/lib/process-resume-build.js +364 -0
- package/dist/src/lib/process-resume-build.js.map +1 -0
- package/dist/src/lib/publish.js +562 -0
- package/dist/src/lib/publish.js.map +1 -0
- package/dist/src/lib/remote.js +88 -0
- package/dist/src/lib/remote.js.map +1 -0
- package/dist/src/lib/review-flow.js +1110 -0
- package/dist/src/lib/review-flow.js.map +1 -0
- package/dist/src/lib/review-lifecyclemodel.js +727 -0
- package/dist/src/lib/review-lifecyclemodel.js.map +1 -0
- package/dist/src/lib/review-process.js +702 -0
- package/dist/src/lib/review-process.js.map +1 -0
- package/dist/src/lib/run.js +106 -0
- package/dist/src/lib/run.js.map +1 -0
- package/dist/src/lib/state-lock.js +150 -0
- package/dist/src/lib/state-lock.js.map +1 -0
- package/dist/src/lib/supabase-client.js +269 -0
- package/dist/src/lib/supabase-client.js.map +1 -0
- package/dist/src/lib/supabase-json-ordered-write.js +186 -0
- package/dist/src/lib/supabase-json-ordered-write.js.map +1 -0
- package/dist/src/lib/supabase-rest.js +138 -0
- package/dist/src/lib/supabase-rest.js.map +1 -0
- package/dist/src/lib/supabase-session.js +424 -0
- package/dist/src/lib/supabase-session.js.map +1 -0
- package/dist/src/lib/tidas-sdk-package-validator.js +493 -0
- package/dist/src/lib/tidas-sdk-package-validator.js.map +1 -0
- package/dist/src/lib/unstructured.js +203 -0
- package/dist/src/lib/unstructured.js.map +1 -0
- package/dist/src/lib/user-api-key.js +75 -0
- package/dist/src/lib/user-api-key.js.map +1 -0
- package/dist/src/lib/validation.js +191 -0
- package/dist/src/lib/validation.js.map +1 -0
- package/dist/src/main.js +38 -0
- package/dist/src/main.js.map +1 -0
- package/package.json +81 -0
package/dist/src/cli.js
ADDED
|
@@ -0,0 +1,2740 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
2
|
+
import { buildDoctorReport, readRuntimeEnv } from './lib/env.js';
|
|
3
|
+
import { CliError, toErrorPayload } from './lib/errors.js';
|
|
4
|
+
import { stringifyJson } from './lib/io.js';
|
|
5
|
+
import { runLifecyclemodelAutoBuild, } from './lib/lifecyclemodel-auto-build.js';
|
|
6
|
+
import { runLifecyclemodelBuildResultingProcess, } from './lib/lifecyclemodel-resulting-process.js';
|
|
7
|
+
import { runLifecyclemodelPublishResultingProcess, } from './lib/lifecyclemodel-publish-resulting-process.js';
|
|
8
|
+
import { runLifecyclemodelValidateBuild, } from './lib/lifecyclemodel-validate-build.js';
|
|
9
|
+
import { runLifecyclemodelPublishBuild, } from './lib/lifecyclemodel-publish-build.js';
|
|
10
|
+
import { runLifecyclemodelOrchestrate, } from './lib/lifecyclemodel-orchestrate.js';
|
|
11
|
+
import { runProcessAutoBuild, } from './lib/process-auto-build.js';
|
|
12
|
+
import { runProcessGet, } from './lib/process-get.js';
|
|
13
|
+
import { runProcessBatchBuild, } from './lib/process-batch-build.js';
|
|
14
|
+
import { runProcessResumeBuild, } from './lib/process-resume-build.js';
|
|
15
|
+
import { runProcessPublishBuild, } from './lib/process-publish-build.js';
|
|
16
|
+
import { runPublish } from './lib/publish.js';
|
|
17
|
+
import { runProcessReview, } from './lib/review-process.js';
|
|
18
|
+
import { runFlowReview, } from './lib/review-flow.js';
|
|
19
|
+
import { runLifecyclemodelReview, } from './lib/review-lifecyclemodel.js';
|
|
20
|
+
import { runFlowRemediate, } from './lib/flow-remediate.js';
|
|
21
|
+
import { runFlowGet } from './lib/flow-get.js';
|
|
22
|
+
import { runFlowList } from './lib/flow-list.js';
|
|
23
|
+
import { runFlowPublishVersion, } from './lib/flow-publish-version.js';
|
|
24
|
+
import { runFlowReviewedPublishData, } from './lib/flow-publish-reviewed-data.js';
|
|
25
|
+
import { runFlowBuildAliasMap, } from './lib/flow-build-alias-map.js';
|
|
26
|
+
import { runFlowApplyProcessFlowRepairs, runFlowPlanProcessFlowRepairs, runFlowRegenProduct, runFlowScanProcessFlowRefs, runFlowValidateProcesses, } from './lib/flow-regen-product.js';
|
|
27
|
+
import { executeRemoteCommand, getRemoteCommandHelp } from './lib/remote.js';
|
|
28
|
+
import { runValidation, } from './lib/validation.js';
|
|
29
|
+
function renderMainHelp(dotEnvStatus) {
|
|
30
|
+
return `TianGong LCA CLI
|
|
31
|
+
|
|
32
|
+
Unified TianGong command entrypoint.
|
|
33
|
+
|
|
34
|
+
Design principles:
|
|
35
|
+
- direct REST / Edge Function access
|
|
36
|
+
- no MCP inside the CLI
|
|
37
|
+
- TypeScript source on Node 24
|
|
38
|
+
- file-first input and JSON-first output
|
|
39
|
+
|
|
40
|
+
Usage:
|
|
41
|
+
tiangong <command> [subcommand] [options]
|
|
42
|
+
|
|
43
|
+
Commands:
|
|
44
|
+
Implemented Commands:
|
|
45
|
+
doctor show environment diagnostics
|
|
46
|
+
search flow | process | lifecyclemodel
|
|
47
|
+
process get | auto-build | resume-build | publish-build | batch-build
|
|
48
|
+
flow get | list | remediate | publish-version | publish-reviewed-data | build-alias-map | scan-process-flow-refs | plan-process-flow-repairs | apply-process-flow-repairs | regen-product | validate-processes
|
|
49
|
+
lifecyclemodel auto-build | validate-build | publish-build | build-resulting-process | publish-resulting-process | orchestrate
|
|
50
|
+
review process | flow | lifecyclemodel
|
|
51
|
+
publish run
|
|
52
|
+
validation run
|
|
53
|
+
admin embedding-run
|
|
54
|
+
|
|
55
|
+
Planned Surface (not implemented yet):
|
|
56
|
+
auth whoami | doctor-auth
|
|
57
|
+
job get | wait | logs
|
|
58
|
+
|
|
59
|
+
Planned commands currently print an explicit "not implemented yet" message and exit with code 2.
|
|
60
|
+
|
|
61
|
+
Examples:
|
|
62
|
+
tiangong doctor
|
|
63
|
+
tiangong search flow --input ./request.json
|
|
64
|
+
tiangong search process --input ./request.json --dry-run
|
|
65
|
+
tiangong process get --id <process-id>
|
|
66
|
+
tiangong process auto-build --input ./pff-request.json
|
|
67
|
+
tiangong process resume-build --run-id <id>
|
|
68
|
+
tiangong process publish-build --run-id <id>
|
|
69
|
+
tiangong process batch-build --input ./batch-request.json
|
|
70
|
+
tiangong lifecyclemodel auto-build --input ./lifecyclemodel-auto-build.request.json
|
|
71
|
+
tiangong lifecyclemodel validate-build --run-dir ./artifacts/lifecyclemodel_auto_build/<run_id>
|
|
72
|
+
tiangong lifecyclemodel publish-build --run-dir ./artifacts/lifecyclemodel_auto_build/<run_id>
|
|
73
|
+
tiangong lifecyclemodel orchestrate plan --input ./lifecyclemodel-orchestrate.request.json --out-dir ./artifacts/lifecyclemodel_recursive/run-001
|
|
74
|
+
tiangong flow get --id <flow-id> --version <version>
|
|
75
|
+
tiangong flow list --id <flow-id> --state-code 100 --limit 20
|
|
76
|
+
tiangong flow remediate --input-file ./invalid-flows.jsonl --out-dir ./flow-remediation
|
|
77
|
+
tiangong flow publish-version --input-file ./ready-flows.jsonl --out-dir ./flow-publish --commit
|
|
78
|
+
tiangong flow publish-reviewed-data --flow-rows-file ./reviewed-flows.jsonl --original-flow-rows-file ./original-flows.jsonl --out-dir ./flow-publish-review
|
|
79
|
+
tiangong flow build-alias-map --old-flow-file ./old-flows.jsonl --new-flow-file ./new-flows.jsonl --out-dir ./flow-alias-map
|
|
80
|
+
tiangong flow scan-process-flow-refs --processes-file ./processes.jsonl --scope-flow-file ./flows.jsonl --out-dir ./flow-scan
|
|
81
|
+
tiangong flow plan-process-flow-repairs --processes-file ./processes.jsonl --scope-flow-file ./flows.jsonl --out-dir ./flow-repair-plan
|
|
82
|
+
tiangong flow apply-process-flow-repairs --processes-file ./processes.jsonl --scope-flow-file ./flows.jsonl --out-dir ./flow-repair-apply
|
|
83
|
+
tiangong flow regen-product --processes-file ./processes.jsonl --scope-flow-file ./flows.jsonl --out-dir ./flow-regeneration --apply
|
|
84
|
+
tiangong flow validate-processes --original-processes-file ./before.jsonl --patched-processes-file ./after.jsonl --scope-flow-file ./flows.jsonl --out-dir ./flow-validation
|
|
85
|
+
tiangong review process --run-root ./artifacts/process_from_flow/<run_id> --run-id <run_id> --out-dir ./review
|
|
86
|
+
tiangong review flow --rows-file ./flows.json --out-dir ./review
|
|
87
|
+
tiangong review lifecyclemodel --run-dir ./artifacts/lifecyclemodel_auto_build/<run_id> --out-dir ./lifecyclemodel-review
|
|
88
|
+
tiangong publish run --input ./publish-request.json --dry-run
|
|
89
|
+
tiangong validation run --input-dir ./package --engine auto
|
|
90
|
+
tiangong admin embedding-run --input ./jobs.json
|
|
91
|
+
|
|
92
|
+
Environment:
|
|
93
|
+
.env loaded: ${dotEnvStatus.loaded ? `yes (${dotEnvStatus.path}, ${dotEnvStatus.count} keys)` : 'no'}
|
|
94
|
+
`.trim();
|
|
95
|
+
}
|
|
96
|
+
function renderDoctorHelp() {
|
|
97
|
+
return `Usage:
|
|
98
|
+
tiangong doctor [--json]
|
|
99
|
+
|
|
100
|
+
Options:
|
|
101
|
+
--json Print structured environment diagnostics
|
|
102
|
+
-h, --help
|
|
103
|
+
`.trim();
|
|
104
|
+
}
|
|
105
|
+
function renderSearchHelp() {
|
|
106
|
+
return `Usage:
|
|
107
|
+
tiangong search <flow|process|lifecyclemodel> --input <file> [options]
|
|
108
|
+
|
|
109
|
+
Options:
|
|
110
|
+
--input <file> JSON request file
|
|
111
|
+
--json Print compact JSON
|
|
112
|
+
--dry-run Print the planned HTTP request without sending it
|
|
113
|
+
--api-key <key> Override TIANGONG_LCA_API_KEY
|
|
114
|
+
--base-url <url> Override TIANGONG_LCA_API_BASE_URL
|
|
115
|
+
--region <name> Override TIANGONG_LCA_REGION
|
|
116
|
+
--timeout-ms <n> Request timeout in milliseconds
|
|
117
|
+
-h, --help
|
|
118
|
+
|
|
119
|
+
Required env:
|
|
120
|
+
TIANGONG_LCA_API_BASE_URL
|
|
121
|
+
TIANGONG_LCA_API_KEY
|
|
122
|
+
TIANGONG_LCA_SUPABASE_PUBLISHABLE_KEY
|
|
123
|
+
TIANGONG_LCA_REGION (optional)
|
|
124
|
+
|
|
125
|
+
Runtime note:
|
|
126
|
+
The CLI decodes TIANGONG_LCA_API_KEY as a user API key bootstrap, exchanges it for a user session,
|
|
127
|
+
and sends the resolved access token to Edge Functions.
|
|
128
|
+
`.trim();
|
|
129
|
+
}
|
|
130
|
+
function renderAdminHelp() {
|
|
131
|
+
return `Usage:
|
|
132
|
+
tiangong admin embedding-run --input <file> [options]
|
|
133
|
+
|
|
134
|
+
Options:
|
|
135
|
+
--input <file> JSON request file
|
|
136
|
+
--json Print compact JSON
|
|
137
|
+
--dry-run Print the planned HTTP request without sending it
|
|
138
|
+
--api-key <key> Override TIANGONG_LCA_API_KEY
|
|
139
|
+
--base-url <url> Override TIANGONG_LCA_API_BASE_URL
|
|
140
|
+
--timeout-ms <n> Request timeout in milliseconds
|
|
141
|
+
-h, --help
|
|
142
|
+
|
|
143
|
+
Required env:
|
|
144
|
+
TIANGONG_LCA_API_BASE_URL
|
|
145
|
+
TIANGONG_LCA_API_KEY
|
|
146
|
+
TIANGONG_LCA_SUPABASE_PUBLISHABLE_KEY
|
|
147
|
+
|
|
148
|
+
Runtime note:
|
|
149
|
+
The CLI decodes TIANGONG_LCA_API_KEY as a user API key bootstrap, exchanges it for a user session,
|
|
150
|
+
and sends the resolved access token to Edge Functions.
|
|
151
|
+
`.trim();
|
|
152
|
+
}
|
|
153
|
+
function renderPublishHelp() {
|
|
154
|
+
return `Usage:
|
|
155
|
+
tiangong publish run --input <file> [options]
|
|
156
|
+
|
|
157
|
+
Options:
|
|
158
|
+
--input <file> JSON publish request file
|
|
159
|
+
--out-dir <dir> Override request out_dir
|
|
160
|
+
--commit Force publish.commit=true
|
|
161
|
+
--dry-run Force publish.commit=false
|
|
162
|
+
--json Print compact JSON
|
|
163
|
+
-h, --help
|
|
164
|
+
`.trim();
|
|
165
|
+
}
|
|
166
|
+
function renderValidationHelp() {
|
|
167
|
+
return `Usage:
|
|
168
|
+
tiangong validation run --input-dir <dir> [options]
|
|
169
|
+
|
|
170
|
+
Options:
|
|
171
|
+
--input-dir <dir> TIDAS package directory
|
|
172
|
+
--engine <mode> auto | sdk (default: auto)
|
|
173
|
+
--report-file <file> Write the structured validation report to a file
|
|
174
|
+
--json Print compact JSON
|
|
175
|
+
-h, --help
|
|
176
|
+
`.trim();
|
|
177
|
+
}
|
|
178
|
+
function renderFlowHelp() {
|
|
179
|
+
return `Usage:
|
|
180
|
+
tiangong flow <subcommand> [options]
|
|
181
|
+
|
|
182
|
+
Implemented Subcommands:
|
|
183
|
+
get Load one flow dataset by identifier through direct Supabase access
|
|
184
|
+
list Enumerate flow datasets through direct Supabase access with deterministic filters
|
|
185
|
+
remediate Deterministically repair invalid local flow rows and emit artifact-first outputs
|
|
186
|
+
publish-version Publish remediated flow versions through the unified CLI surface
|
|
187
|
+
publish-reviewed-data Prepare reviewed flow rows, skip unchanged snapshots, and optionally publish the resulting versions
|
|
188
|
+
build-alias-map Build a deterministic flow alias map from old/new local flow snapshots
|
|
189
|
+
scan-process-flow-refs Classify process exchange references against the current flow scope
|
|
190
|
+
plan-process-flow-repairs Plan deterministic repairs for local process-flow references
|
|
191
|
+
apply-process-flow-repairs Apply deterministic process-flow reference repairs and emit patch artifacts
|
|
192
|
+
regen-product Regenerate local process-side artifacts after flow governance changes
|
|
193
|
+
validate-processes Validate locally patched process rows against allowed flow-reference-only changes
|
|
194
|
+
|
|
195
|
+
Examples:
|
|
196
|
+
tiangong flow --help
|
|
197
|
+
tiangong flow get --help
|
|
198
|
+
tiangong flow list --help
|
|
199
|
+
tiangong flow remediate --help
|
|
200
|
+
tiangong flow publish-version --help
|
|
201
|
+
tiangong flow publish-reviewed-data --help
|
|
202
|
+
tiangong flow build-alias-map --help
|
|
203
|
+
tiangong flow scan-process-flow-refs --help
|
|
204
|
+
tiangong flow plan-process-flow-repairs --help
|
|
205
|
+
tiangong flow apply-process-flow-repairs --help
|
|
206
|
+
tiangong flow regen-product --help
|
|
207
|
+
tiangong flow validate-processes --help
|
|
208
|
+
`.trim();
|
|
209
|
+
}
|
|
210
|
+
function renderFlowGetHelp() {
|
|
211
|
+
return `Usage:
|
|
212
|
+
tiangong flow get --id <flow-id> [options]
|
|
213
|
+
|
|
214
|
+
Options:
|
|
215
|
+
--id <flow-id> Flow UUID
|
|
216
|
+
--version <version> Optional requested dataset version; if absent or missing, the latest reachable row is returned
|
|
217
|
+
--user-id <user-id> Optional owner filter for private rows
|
|
218
|
+
--state-code <code> Optional visibility filter such as 0 or 100
|
|
219
|
+
--json Print compact JSON
|
|
220
|
+
-h, --help
|
|
221
|
+
|
|
222
|
+
Required env:
|
|
223
|
+
TIANGONG_LCA_API_BASE_URL
|
|
224
|
+
TIANGONG_LCA_API_KEY
|
|
225
|
+
TIANGONG_LCA_SUPABASE_PUBLISHABLE_KEY
|
|
226
|
+
|
|
227
|
+
Runtime note:
|
|
228
|
+
The CLI derives a native @supabase/supabase-js client and deterministic read target from TIANGONG_LCA_API_BASE_URL,
|
|
229
|
+
and authenticates that client with the resolved user access token.
|
|
230
|
+
`.trim();
|
|
231
|
+
}
|
|
232
|
+
function renderFlowListHelp() {
|
|
233
|
+
return `Usage:
|
|
234
|
+
tiangong flow list [options]
|
|
235
|
+
|
|
236
|
+
Options:
|
|
237
|
+
--id <flow-id> Repeatable exact flow UUID filter
|
|
238
|
+
--version <version> Optional dataset version filter
|
|
239
|
+
--user-id <user-id> Optional owner filter for private rows
|
|
240
|
+
--state-code <code> Repeatable visibility filter such as 0 or 100
|
|
241
|
+
--type-of-dataset <name> Repeatable flow type filter, for example "Product flow" or "Waste flow"
|
|
242
|
+
--order <expr> Deterministic PostgREST order expression (default: id.asc,version.asc)
|
|
243
|
+
--limit <n> Page size for one request (default: 100)
|
|
244
|
+
--offset <n> Row offset for one request (default: 0)
|
|
245
|
+
--all Fetch all matching rows via offset pagination
|
|
246
|
+
--page-size <n> Page size when --all is used (default: 100)
|
|
247
|
+
--json Print compact JSON
|
|
248
|
+
-h, --help
|
|
249
|
+
|
|
250
|
+
Required env:
|
|
251
|
+
TIANGONG_LCA_API_BASE_URL
|
|
252
|
+
TIANGONG_LCA_API_KEY
|
|
253
|
+
TIANGONG_LCA_SUPABASE_PUBLISHABLE_KEY
|
|
254
|
+
|
|
255
|
+
Runtime note:
|
|
256
|
+
The CLI derives a native @supabase/supabase-js client and deterministic read target from TIANGONG_LCA_API_BASE_URL,
|
|
257
|
+
and authenticates that client with the resolved user access token.
|
|
258
|
+
`.trim();
|
|
259
|
+
}
|
|
260
|
+
function renderFlowRemediateHelp() {
|
|
261
|
+
return `Usage:
|
|
262
|
+
tiangong flow remediate --input-file <file> --out-dir <dir> [options]
|
|
263
|
+
|
|
264
|
+
Options:
|
|
265
|
+
--input-file <file> Invalid flow rows as JSON or JSONL
|
|
266
|
+
--out-dir <dir> Output directory for remediation artifacts
|
|
267
|
+
--json Print compact JSON
|
|
268
|
+
-h, --help
|
|
269
|
+
|
|
270
|
+
Outputs written under --out-dir:
|
|
271
|
+
- flows_tidas_sdk_plus_classification_remediated_all.jsonl
|
|
272
|
+
- flows_tidas_sdk_plus_classification_remediated_ready_for_mcp.jsonl
|
|
273
|
+
- flows_tidas_sdk_plus_classification_residual_manual_queue.jsonl
|
|
274
|
+
- flows_tidas_sdk_plus_classification_remediation_audit.jsonl
|
|
275
|
+
- flows_tidas_sdk_plus_classification_remediation_report.json
|
|
276
|
+
- flows_tidas_sdk_plus_classification_residual_manual_queue_prompt.md
|
|
277
|
+
`.trim();
|
|
278
|
+
}
|
|
279
|
+
function renderFlowPublishVersionHelp() {
|
|
280
|
+
return `Usage:
|
|
281
|
+
tiangong flow publish-version --input-file <file> --out-dir <dir> [options]
|
|
282
|
+
|
|
283
|
+
Options:
|
|
284
|
+
--input-file <file> Ready-for-publish flow rows as JSON or JSONL
|
|
285
|
+
--out-dir <dir> Output directory for publish-version artifacts
|
|
286
|
+
--commit Execute remote writes
|
|
287
|
+
--dry-run Plan the publish-version operations without remote writes
|
|
288
|
+
--max-workers <n> Parallel worker count (default: 4)
|
|
289
|
+
--limit <n> Optional row limit; 0 means all rows
|
|
290
|
+
--target-user-id <id> Override the target owner when input rows omit user_id
|
|
291
|
+
--json Print compact JSON
|
|
292
|
+
-h, --help
|
|
293
|
+
|
|
294
|
+
Environment:
|
|
295
|
+
TIANGONG_LCA_API_BASE_URL
|
|
296
|
+
TIANGONG_LCA_API_KEY
|
|
297
|
+
TIANGONG_LCA_SUPABASE_PUBLISHABLE_KEY
|
|
298
|
+
|
|
299
|
+
Outputs written under --out-dir:
|
|
300
|
+
- flows_tidas_sdk_plus_classification_mcp_success_list.json
|
|
301
|
+
- flows_tidas_sdk_plus_classification_remote_validation_failed.jsonl
|
|
302
|
+
- flows_tidas_sdk_plus_classification_mcp_sync_report.json
|
|
303
|
+
`.trim();
|
|
304
|
+
}
|
|
305
|
+
function renderFlowPublishReviewedDataHelp() {
|
|
306
|
+
return `Usage:
|
|
307
|
+
tiangong flow publish-reviewed-data --out-dir <dir> [--flow-rows-file <file>] [--process-rows-file <file>] [options]
|
|
308
|
+
|
|
309
|
+
Options:
|
|
310
|
+
--flow-rows-file <file> Reviewed flow rows as JSON or JSONL
|
|
311
|
+
--original-flow-rows-file <file> Optional original flow snapshot used to skip unchanged reviewed rows
|
|
312
|
+
--process-rows-file <file> Optional reviewed process rows as JSON or JSONL
|
|
313
|
+
--flow-publish-policy <mode> skip | append_only_bump | upsert_current_version (default: append_only_bump)
|
|
314
|
+
--process-publish-policy <mode> skip | append_only_bump | upsert_current_version (default: append_only_bump)
|
|
315
|
+
--no-rewrite-process-flow-refs Keep process flow references unchanged during local preparation
|
|
316
|
+
--commit Execute remote writes for prepared flow and process rows
|
|
317
|
+
--dry-run Keep the command local-only and write prepared artifacts without remote writes
|
|
318
|
+
--max-workers <n> Parallel worker count for the flow commit step (default: 4)
|
|
319
|
+
--target-user-id <id> Override the target owner when prepared flow rows omit user_id
|
|
320
|
+
--json Print compact JSON
|
|
321
|
+
-h, --help
|
|
322
|
+
|
|
323
|
+
Environment:
|
|
324
|
+
none for local dry-run
|
|
325
|
+
TIANGONG_LCA_API_BASE_URL, TIANGONG_LCA_API_KEY, and TIANGONG_LCA_SUPABASE_PUBLISHABLE_KEY
|
|
326
|
+
when --commit publishes prepared rows
|
|
327
|
+
|
|
328
|
+
Outputs written under --out-dir:
|
|
329
|
+
- prepared-flow-rows.json
|
|
330
|
+
- prepared-process-rows.json
|
|
331
|
+
- flow-version-map.json
|
|
332
|
+
- skipped-unchanged-flow-rows.json
|
|
333
|
+
- process-flow-ref-rewrite-evidence.jsonl
|
|
334
|
+
- publish-report.json
|
|
335
|
+
- flows_tidas_sdk_plus_classification_mcp_success_list.json
|
|
336
|
+
- flows_tidas_sdk_plus_classification_remote_validation_failed.jsonl
|
|
337
|
+
- flows_tidas_sdk_plus_classification_mcp_sync_report.json
|
|
338
|
+
`.trim();
|
|
339
|
+
}
|
|
340
|
+
function renderFlowBuildAliasMapHelp() {
|
|
341
|
+
return `Usage:
|
|
342
|
+
tiangong flow build-alias-map --old-flow-file <file> --new-flow-file <file> --out-dir <dir> [options]
|
|
343
|
+
|
|
344
|
+
Options:
|
|
345
|
+
--old-flow-file <file> Repeatable pre-governance flow snapshot as JSON or JSONL
|
|
346
|
+
--new-flow-file <file> Repeatable post-governance flow snapshot as JSON or JSONL
|
|
347
|
+
--seed-alias-map <file> Optional existing alias map JSON object used as deterministic seed input
|
|
348
|
+
--out-dir <dir> Output directory for alias-plan artifacts
|
|
349
|
+
--json Print compact JSON
|
|
350
|
+
-h, --help
|
|
351
|
+
|
|
352
|
+
Outputs written under --out-dir:
|
|
353
|
+
- alias-plan.json
|
|
354
|
+
- alias-plan.jsonl
|
|
355
|
+
- flow-alias-map.json
|
|
356
|
+
- manual-review-queue.jsonl
|
|
357
|
+
- alias-summary.json
|
|
358
|
+
`.trim();
|
|
359
|
+
}
|
|
360
|
+
function renderFlowScanProcessFlowRefsHelp() {
|
|
361
|
+
return `Usage:
|
|
362
|
+
tiangong flow scan-process-flow-refs --processes-file <file> --scope-flow-file <file> --out-dir <dir> [options]
|
|
363
|
+
|
|
364
|
+
Options:
|
|
365
|
+
--processes-file <file> Process rows as JSON or JSONL
|
|
366
|
+
--scope-flow-file <file> Repeatable target flow scope file as JSON or JSONL
|
|
367
|
+
--catalog-flow-file <file> Repeatable catalog flow file; defaults to the scope files
|
|
368
|
+
--alias-map <file> Optional flow alias map JSON object
|
|
369
|
+
--exclude-emergy Exclude emergy-named processes before reference scanning
|
|
370
|
+
--out-dir <dir> Output directory for scan artifacts
|
|
371
|
+
--json Print compact JSON
|
|
372
|
+
-h, --help
|
|
373
|
+
|
|
374
|
+
Outputs written under --out-dir:
|
|
375
|
+
- emergy-excluded-processes.json
|
|
376
|
+
- scan-summary.json
|
|
377
|
+
- scan-findings.json
|
|
378
|
+
- scan-findings.jsonl
|
|
379
|
+
`.trim();
|
|
380
|
+
}
|
|
381
|
+
function renderFlowPlanProcessFlowRepairsHelp() {
|
|
382
|
+
return `Usage:
|
|
383
|
+
tiangong flow plan-process-flow-repairs --processes-file <file> --scope-flow-file <file> --out-dir <dir> [options]
|
|
384
|
+
|
|
385
|
+
Options:
|
|
386
|
+
--processes-file <file> Process rows as JSON or JSONL
|
|
387
|
+
--scope-flow-file <file> Repeatable target flow scope file as JSON or JSONL
|
|
388
|
+
--alias-map <file> Optional flow alias map JSON object
|
|
389
|
+
--scan-findings <file> Optional scan-findings JSON or JSONL from a prior scan step
|
|
390
|
+
--auto-patch-policy <mode> disabled | alias-only | alias-or-unique-name (default: alias-only)
|
|
391
|
+
--out-dir <dir> Output directory for repair plan artifacts
|
|
392
|
+
--json Print compact JSON
|
|
393
|
+
-h, --help
|
|
394
|
+
|
|
395
|
+
Outputs written under --out-dir:
|
|
396
|
+
- repair-plan.json
|
|
397
|
+
- repair-plan.jsonl
|
|
398
|
+
- manual-review-queue.jsonl
|
|
399
|
+
- repair-summary.json
|
|
400
|
+
`.trim();
|
|
401
|
+
}
|
|
402
|
+
function renderFlowApplyProcessFlowRepairsHelp() {
|
|
403
|
+
return `Usage:
|
|
404
|
+
tiangong flow apply-process-flow-repairs --processes-file <file> --scope-flow-file <file> --out-dir <dir> [options]
|
|
405
|
+
|
|
406
|
+
Options:
|
|
407
|
+
--processes-file <file> Process rows as JSON or JSONL
|
|
408
|
+
--scope-flow-file <file> Repeatable target flow scope file as JSON or JSONL
|
|
409
|
+
--alias-map <file> Optional flow alias map JSON object
|
|
410
|
+
--scan-findings <file> Optional scan-findings JSON or JSONL from a prior scan step
|
|
411
|
+
--auto-patch-policy <mode> disabled | alias-only | alias-or-unique-name (default: alias-only)
|
|
412
|
+
--process-pool-file <file> Optional process pool file to sync after patch application
|
|
413
|
+
--out-dir <dir> Output directory for repair apply artifacts
|
|
414
|
+
--json Print compact JSON
|
|
415
|
+
-h, --help
|
|
416
|
+
|
|
417
|
+
Outputs written under --out-dir:
|
|
418
|
+
- repair-plan.json
|
|
419
|
+
- repair-plan.jsonl
|
|
420
|
+
- manual-review-queue.jsonl
|
|
421
|
+
- repair-summary.json
|
|
422
|
+
- patched-processes.json
|
|
423
|
+
- process-patches/
|
|
424
|
+
`.trim();
|
|
425
|
+
}
|
|
426
|
+
function renderFlowRegenProductHelp() {
|
|
427
|
+
return `Usage:
|
|
428
|
+
tiangong flow regen-product --processes-file <file> --scope-flow-file <file> --out-dir <dir> [options]
|
|
429
|
+
|
|
430
|
+
Options:
|
|
431
|
+
--processes-file <file> Process rows as JSON or JSONL
|
|
432
|
+
--scope-flow-file <file> Repeatable target flow scope file as JSON or JSONL
|
|
433
|
+
--catalog-flow-file <file> Repeatable catalog flow file; defaults to the scope files
|
|
434
|
+
--alias-map <file> Optional flow alias map JSON object
|
|
435
|
+
--exclude-emergy Exclude emergy-named processes before scan and repair
|
|
436
|
+
--auto-patch-policy <mode> disabled | alias-only | alias-or-unique-name (default: alias-only)
|
|
437
|
+
--apply Apply deterministic patches and run local validation
|
|
438
|
+
--process-pool-file <file> Optional process pool file to sync after --apply
|
|
439
|
+
--tidas-mode <mode> auto | required | skip (default: auto)
|
|
440
|
+
--out-dir <dir> Run root for scan / repair / validate artifacts
|
|
441
|
+
--json Print compact JSON
|
|
442
|
+
-h, --help
|
|
443
|
+
|
|
444
|
+
Outputs written under --out-dir:
|
|
445
|
+
- flow-regen-product-report.json
|
|
446
|
+
- scan/
|
|
447
|
+
- repair/
|
|
448
|
+
- repair-apply/ (only with --apply)
|
|
449
|
+
- validate/ (only with --apply)
|
|
450
|
+
`.trim();
|
|
451
|
+
}
|
|
452
|
+
function renderFlowValidateProcessesHelp() {
|
|
453
|
+
return `Usage:
|
|
454
|
+
tiangong flow validate-processes --original-processes-file <file> --patched-processes-file <file> --scope-flow-file <file> --out-dir <dir> [options]
|
|
455
|
+
|
|
456
|
+
Options:
|
|
457
|
+
--original-processes-file <file> Original process rows before repair as JSON or JSONL
|
|
458
|
+
--patched-processes-file <file> Patched process rows after repair as JSON or JSONL
|
|
459
|
+
--scope-flow-file <file> Repeatable target flow scope file as JSON or JSONL
|
|
460
|
+
--out-dir <dir> Output directory for validation-report.json and validation-failures.jsonl
|
|
461
|
+
--tidas-mode <mode> auto | required | skip (default: auto)
|
|
462
|
+
--json Print compact JSON
|
|
463
|
+
-h, --help
|
|
464
|
+
|
|
465
|
+
Outputs written under --out-dir:
|
|
466
|
+
- validation-report.json
|
|
467
|
+
- validation-failures.jsonl
|
|
468
|
+
`.trim();
|
|
469
|
+
}
|
|
470
|
+
function renderReviewHelp() {
|
|
471
|
+
return `Usage:
|
|
472
|
+
tiangong review <subcommand> [options]
|
|
473
|
+
|
|
474
|
+
Implemented Subcommands:
|
|
475
|
+
process Review one local process build run and emit artifact-first findings
|
|
476
|
+
flow Review local flow governance snapshots and emit artifact-first findings
|
|
477
|
+
lifecyclemodel Review one local lifecyclemodel build run and emit artifact-first findings
|
|
478
|
+
|
|
479
|
+
Examples:
|
|
480
|
+
tiangong review --help
|
|
481
|
+
tiangong review process --help
|
|
482
|
+
tiangong review flow --help
|
|
483
|
+
tiangong review lifecyclemodel --help
|
|
484
|
+
`.trim();
|
|
485
|
+
}
|
|
486
|
+
function renderReviewProcessHelp() {
|
|
487
|
+
return `Usage:
|
|
488
|
+
tiangong review process --run-root <dir> --run-id <id> --out-dir <dir> [options]
|
|
489
|
+
|
|
490
|
+
Options:
|
|
491
|
+
--run-root <dir> Process build run root containing exports/processes
|
|
492
|
+
--run-id <id> Process build run identifier
|
|
493
|
+
--out-dir <dir> Review artifact output directory
|
|
494
|
+
--start-ts <iso> Optional run start timestamp
|
|
495
|
+
--end-ts <iso> Optional run end timestamp
|
|
496
|
+
--logic-version <name> Review logic version label (default: v2.1)
|
|
497
|
+
--enable-llm Enable optional review-only semantic review via the CLI LLM client
|
|
498
|
+
--llm-model <name> Override TIANGONG_LCA_REVIEW_LLM_MODEL for this review command
|
|
499
|
+
--llm-max-processes <n> Cap how many process summaries are sent to the LLM (default: 8)
|
|
500
|
+
--json Print compact JSON
|
|
501
|
+
-h, --help
|
|
502
|
+
`.trim();
|
|
503
|
+
}
|
|
504
|
+
function renderReviewFlowHelp() {
|
|
505
|
+
return `Usage:
|
|
506
|
+
tiangong review flow (--rows-file <file> | --flows-dir <dir> | --run-root <dir>) --out-dir <dir> [options]
|
|
507
|
+
|
|
508
|
+
Options:
|
|
509
|
+
--rows-file <file> Flow rows JSON / JSONL file; the CLI materializes review-input/flows automatically
|
|
510
|
+
--flows-dir <dir> Directory containing per-flow JSON files
|
|
511
|
+
--run-root <dir> Existing run root containing cache/flows or exports/flows
|
|
512
|
+
--run-id <id> Optional run identifier override
|
|
513
|
+
--out-dir <dir> Review artifact output directory
|
|
514
|
+
--start-ts <iso> Optional run start timestamp
|
|
515
|
+
--end-ts <iso> Optional run end timestamp
|
|
516
|
+
--logic-version <name> Review logic version label (default: flow-v1.0-cli)
|
|
517
|
+
--enable-llm Enable optional review-only semantic review via the CLI LLM client
|
|
518
|
+
--llm-model <name> Override TIANGONG_LCA_REVIEW_LLM_MODEL for this review command
|
|
519
|
+
--llm-max-flows <n> Cap how many flow summaries are sent to the LLM (default: 120)
|
|
520
|
+
--llm-batch-size <n> Cap how many flow summaries each LLM batch sends (default: 20)
|
|
521
|
+
--similarity-threshold <n> Similarity threshold for duplicate-candidate warnings (default: 0.92)
|
|
522
|
+
--methodology-id <name> Label written into methodology-backed rule findings (default: built_in)
|
|
523
|
+
--json Print compact JSON
|
|
524
|
+
-h, --help
|
|
525
|
+
`.trim();
|
|
526
|
+
}
|
|
527
|
+
function renderReviewLifecyclemodelHelp() {
|
|
528
|
+
return `Usage:
|
|
529
|
+
tiangong review lifecyclemodel --run-dir <dir> --out-dir <dir> [options]
|
|
530
|
+
|
|
531
|
+
Options:
|
|
532
|
+
--run-dir <dir> Existing lifecyclemodel auto-build run directory
|
|
533
|
+
--out-dir <dir> Review artifact output directory
|
|
534
|
+
--start-ts <iso> Optional run start timestamp
|
|
535
|
+
--end-ts <iso> Optional run end timestamp
|
|
536
|
+
--logic-version <name> Review logic version label (default: lifecyclemodel-review-v1.0)
|
|
537
|
+
--json Print compact JSON
|
|
538
|
+
-h, --help
|
|
539
|
+
|
|
540
|
+
This command:
|
|
541
|
+
- reads one existing lifecyclemodel build run under models/*/tidas_bundle/lifecyclemodels
|
|
542
|
+
- aggregates validate-build findings when reports/lifecyclemodel-validate-build-report.json is present
|
|
543
|
+
- emits artifact-first model summaries, findings, markdown review notes, and a structured report
|
|
544
|
+
`.trim();
|
|
545
|
+
}
|
|
546
|
+
function renderLifecyclemodelBuildResultingProcessHelp() {
|
|
547
|
+
return `Usage:
|
|
548
|
+
tiangong lifecyclemodel build-resulting-process --input <file> [options]
|
|
549
|
+
|
|
550
|
+
Options:
|
|
551
|
+
--input <file> JSON request file
|
|
552
|
+
--out-dir <dir> Override the default artifact output directory
|
|
553
|
+
--json Print compact JSON
|
|
554
|
+
-h, --help
|
|
555
|
+
|
|
556
|
+
Remote lookup env (only when process_sources.allow_remote_lookup=true):
|
|
557
|
+
TIANGONG_LCA_API_BASE_URL
|
|
558
|
+
TIANGONG_LCA_API_KEY
|
|
559
|
+
TIANGONG_LCA_SUPABASE_PUBLISHABLE_KEY
|
|
560
|
+
`.trim();
|
|
561
|
+
}
|
|
562
|
+
function renderLifecyclemodelPublishResultingProcessHelp() {
|
|
563
|
+
return `Usage:
|
|
564
|
+
tiangong lifecyclemodel publish-resulting-process --run-dir <dir> [options]
|
|
565
|
+
|
|
566
|
+
Options:
|
|
567
|
+
--run-dir <dir> Existing lifecyclemodel resulting-process run directory
|
|
568
|
+
--publish-processes Include projected processes in publish-bundle.json
|
|
569
|
+
--publish-relations Include lifecyclemodel/resulting-process relations in publish-bundle.json
|
|
570
|
+
--json Print compact JSON
|
|
571
|
+
-h, --help
|
|
572
|
+
`.trim();
|
|
573
|
+
}
|
|
574
|
+
function renderLifecyclemodelHelp() {
|
|
575
|
+
return `Usage:
|
|
576
|
+
tiangong lifecyclemodel <subcommand> [options]
|
|
577
|
+
|
|
578
|
+
Implemented Subcommands:
|
|
579
|
+
auto-build Build native lifecyclemodel json_ordered artifacts from local process run exports
|
|
580
|
+
validate-build Re-run local validation on one lifecyclemodel build run
|
|
581
|
+
publish-build Prepare lifecyclemodel publish handoff artifacts from one local build run
|
|
582
|
+
build-resulting-process Deterministically aggregate a lifecycle model into a resulting process bundle
|
|
583
|
+
publish-resulting-process Prepare publish-bundle.json and publish-intent.json from a prior resulting-process run
|
|
584
|
+
orchestrate Plan, execute, or publish a recursive lifecyclemodel assembly run
|
|
585
|
+
|
|
586
|
+
Examples:
|
|
587
|
+
tiangong lifecyclemodel --help
|
|
588
|
+
tiangong lifecyclemodel auto-build --help
|
|
589
|
+
tiangong lifecyclemodel validate-build --help
|
|
590
|
+
tiangong lifecyclemodel publish-build --help
|
|
591
|
+
tiangong lifecyclemodel build-resulting-process --help
|
|
592
|
+
tiangong lifecyclemodel orchestrate --help
|
|
593
|
+
`.trim();
|
|
594
|
+
}
|
|
595
|
+
function renderLifecyclemodelOrchestrateHelp() {
|
|
596
|
+
return `Usage:
|
|
597
|
+
tiangong lifecyclemodel orchestrate <plan|execute|publish> [options]
|
|
598
|
+
|
|
599
|
+
Plan / execute options:
|
|
600
|
+
--input <file> JSON request file
|
|
601
|
+
--request <file> Alias for --input
|
|
602
|
+
--out-dir <dir> Output run directory
|
|
603
|
+
--allow-process-build Override orchestration.allow_process_build=true during execute
|
|
604
|
+
--allow-submodel-build Override orchestration.allow_submodel_build=true during execute
|
|
605
|
+
--json Print compact JSON
|
|
606
|
+
-h, --help
|
|
607
|
+
|
|
608
|
+
Publish options:
|
|
609
|
+
--run-dir <dir> Existing orchestrator run directory
|
|
610
|
+
--publish-lifecyclemodels Include built lifecyclemodels in publish-bundle.json
|
|
611
|
+
--publish-resulting-process-relations Include projected processes and resulting-process relations in publish-bundle.json
|
|
612
|
+
--json Print compact JSON
|
|
613
|
+
-h, --help
|
|
614
|
+
|
|
615
|
+
This command:
|
|
616
|
+
- normalizes a recursive request into assembly-plan.json, graph-manifest.json, lineage-manifest.json, and boundary-report.json
|
|
617
|
+
- executes only native CLI-backed builders; no Python fallback path remains
|
|
618
|
+
- prepares a local publish-bundle.json from prior invocation artifacts
|
|
619
|
+
`.trim();
|
|
620
|
+
}
|
|
621
|
+
function renderLifecyclemodelAutoBuildHelp() {
|
|
622
|
+
return `Usage:
|
|
623
|
+
tiangong lifecyclemodel auto-build --input <file> [options]
|
|
624
|
+
|
|
625
|
+
Options:
|
|
626
|
+
--input <file> JSON request file
|
|
627
|
+
--out-dir <dir> Override the default lifecyclemodel build run root
|
|
628
|
+
--json Print compact JSON
|
|
629
|
+
-h, --help
|
|
630
|
+
|
|
631
|
+
Minimal request contract:
|
|
632
|
+
{
|
|
633
|
+
"local_runs": ["/abs/path/to/process-build-run"]
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
This first CLI slice is local-only and read-only:
|
|
637
|
+
- loads local process build run directories
|
|
638
|
+
- infers the process graph from shared flow UUIDs
|
|
639
|
+
- emits native lifecyclemodel json_ordered artifacts
|
|
640
|
+
- leaves follow-up validation and publish handoff to the companion validate-build and publish-build commands
|
|
641
|
+
`.trim();
|
|
642
|
+
}
|
|
643
|
+
function renderLifecyclemodelValidateBuildHelp() {
|
|
644
|
+
return `Usage:
|
|
645
|
+
tiangong lifecyclemodel validate-build --run-dir <dir> [options]
|
|
646
|
+
|
|
647
|
+
Options:
|
|
648
|
+
--run-dir <dir> Existing lifecyclemodel auto-build run directory
|
|
649
|
+
--engine <mode> auto | sdk (default: auto)
|
|
650
|
+
--json Print compact JSON
|
|
651
|
+
-h, --help
|
|
652
|
+
|
|
653
|
+
This command:
|
|
654
|
+
- scans models/*/tidas_bundle from one lifecyclemodel auto-build run
|
|
655
|
+
- re-runs local validation through the unified validation module
|
|
656
|
+
- writes per-model validation reports plus one aggregate report
|
|
657
|
+
`.trim();
|
|
658
|
+
}
|
|
659
|
+
function renderLifecyclemodelPublishBuildHelp() {
|
|
660
|
+
return `Usage:
|
|
661
|
+
tiangong lifecyclemodel publish-build --run-dir <dir> [options]
|
|
662
|
+
|
|
663
|
+
Options:
|
|
664
|
+
--run-dir <dir> Existing lifecyclemodel auto-build run directory
|
|
665
|
+
--json Print compact JSON
|
|
666
|
+
-h, --help
|
|
667
|
+
|
|
668
|
+
This command:
|
|
669
|
+
- collects native lifecyclemodel json_ordered payloads from one local build run
|
|
670
|
+
- writes publish-bundle.json, publish-request.json, and publish-intent.json
|
|
671
|
+
- keeps actual dry-run / commit execution in tiangong publish run
|
|
672
|
+
`.trim();
|
|
673
|
+
}
|
|
674
|
+
function renderProcessAutoBuildHelp() {
|
|
675
|
+
return `Usage:
|
|
676
|
+
tiangong process auto-build --input <file> [options]
|
|
677
|
+
|
|
678
|
+
Options:
|
|
679
|
+
--input <file> JSON request file
|
|
680
|
+
--out-dir <dir> Override the default run root directory
|
|
681
|
+
--json Print compact JSON
|
|
682
|
+
-h, --help
|
|
683
|
+
`.trim();
|
|
684
|
+
}
|
|
685
|
+
function renderProcessGetHelp() {
|
|
686
|
+
return `Usage:
|
|
687
|
+
tiangong process get --id <process-id> [options]
|
|
688
|
+
|
|
689
|
+
Options:
|
|
690
|
+
--id <process-id> Process UUID
|
|
691
|
+
--version <version> Optional requested dataset version; if absent or missing, the latest reachable row is returned
|
|
692
|
+
--json Print compact JSON
|
|
693
|
+
-h, --help
|
|
694
|
+
|
|
695
|
+
Required env:
|
|
696
|
+
TIANGONG_LCA_API_BASE_URL
|
|
697
|
+
TIANGONG_LCA_API_KEY
|
|
698
|
+
TIANGONG_LCA_SUPABASE_PUBLISHABLE_KEY
|
|
699
|
+
|
|
700
|
+
Runtime note:
|
|
701
|
+
The CLI derives a native @supabase/supabase-js client and deterministic read target from TIANGONG_LCA_API_BASE_URL,
|
|
702
|
+
and authenticates that client with the resolved user access token.
|
|
703
|
+
`.trim();
|
|
704
|
+
}
|
|
705
|
+
function renderProcessResumeBuildHelp() {
|
|
706
|
+
return `Usage:
|
|
707
|
+
tiangong process resume-build [--run-id <id>] [--run-dir <dir>] [options]
|
|
708
|
+
|
|
709
|
+
Options:
|
|
710
|
+
--run-id <id> Existing process build run id
|
|
711
|
+
--run-dir <dir> Existing process build run directory
|
|
712
|
+
--json Print compact JSON
|
|
713
|
+
-h, --help
|
|
714
|
+
`.trim();
|
|
715
|
+
}
|
|
716
|
+
function renderProcessPublishBuildHelp() {
|
|
717
|
+
return `Usage:
|
|
718
|
+
tiangong process publish-build [--run-id <id>] [--run-dir <dir>] [options]
|
|
719
|
+
|
|
720
|
+
Options:
|
|
721
|
+
--run-id <id> Existing process build run id
|
|
722
|
+
--run-dir <dir> Existing process build run directory
|
|
723
|
+
--json Print compact JSON
|
|
724
|
+
-h, --help
|
|
725
|
+
`.trim();
|
|
726
|
+
}
|
|
727
|
+
function renderProcessBatchBuildHelp() {
|
|
728
|
+
return `Usage:
|
|
729
|
+
tiangong process batch-build --input <file> [options]
|
|
730
|
+
|
|
731
|
+
Options:
|
|
732
|
+
--input <file> JSON batch manifest file
|
|
733
|
+
--out-dir <dir> Override the batch artifact output directory
|
|
734
|
+
--json Print compact JSON
|
|
735
|
+
-h, --help
|
|
736
|
+
`.trim();
|
|
737
|
+
}
|
|
738
|
+
function renderProcessHelp() {
|
|
739
|
+
return `Usage:
|
|
740
|
+
tiangong process <subcommand> [options]
|
|
741
|
+
|
|
742
|
+
Implemented Subcommands:
|
|
743
|
+
get Load one process dataset by identifier through direct Supabase access
|
|
744
|
+
auto-build Prepare a local process-from-flow run scaffold and artifact workspace
|
|
745
|
+
resume-build Prepare a local resume handoff from one existing process build run
|
|
746
|
+
publish-build Prepare publish handoff artifacts from one existing process build run
|
|
747
|
+
batch-build Run multiple process auto-build requests through one batch-oriented CLI surface
|
|
748
|
+
|
|
749
|
+
Examples:
|
|
750
|
+
tiangong process --help
|
|
751
|
+
tiangong process get --id <process-id>
|
|
752
|
+
tiangong process auto-build --help
|
|
753
|
+
tiangong process resume-build --run-id <id> --help
|
|
754
|
+
tiangong process publish-build --run-id <id> --help
|
|
755
|
+
tiangong process batch-build --input ./batch-request.json --help
|
|
756
|
+
`.trim();
|
|
757
|
+
}
|
|
758
|
+
function renderDoctorText(report) {
|
|
759
|
+
const lines = [
|
|
760
|
+
'TianGong CLI doctor',
|
|
761
|
+
` .env loaded: ${report.loadedDotEnv ? `yes (${report.dotEnvKeysLoaded} keys)` : 'no'}`,
|
|
762
|
+
` .env path: ${report.dotEnvPath}`,
|
|
763
|
+
'',
|
|
764
|
+
];
|
|
765
|
+
for (const check of report.checks) {
|
|
766
|
+
const status = check.present ? 'OK ' : 'MISS';
|
|
767
|
+
lines.push(` [${status}] ${check.key} (${check.source})${check.required ? ' [required]' : ''}`);
|
|
768
|
+
}
|
|
769
|
+
if (!report.ok) {
|
|
770
|
+
lines.push('', 'Missing required environment keys:');
|
|
771
|
+
for (const check of report.checks) {
|
|
772
|
+
if (check.required && !check.present) {
|
|
773
|
+
lines.push(` - ${check.key}`);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return `${lines.join('\n')}\n`;
|
|
778
|
+
}
|
|
779
|
+
function parseCommandLine(args) {
|
|
780
|
+
const flags = {
|
|
781
|
+
help: false,
|
|
782
|
+
version: false,
|
|
783
|
+
};
|
|
784
|
+
let index = 0;
|
|
785
|
+
while (index < args.length) {
|
|
786
|
+
const arg = args[index];
|
|
787
|
+
if (arg === '--') {
|
|
788
|
+
index += 1;
|
|
789
|
+
break;
|
|
790
|
+
}
|
|
791
|
+
if (arg === '--help' || arg === '-h') {
|
|
792
|
+
flags.help = true;
|
|
793
|
+
index += 1;
|
|
794
|
+
continue;
|
|
795
|
+
}
|
|
796
|
+
if (arg === '--version' || arg === '-v') {
|
|
797
|
+
flags.version = true;
|
|
798
|
+
index += 1;
|
|
799
|
+
continue;
|
|
800
|
+
}
|
|
801
|
+
if (arg.startsWith('-')) {
|
|
802
|
+
throw new CliError(`Unknown root option: ${arg}`, {
|
|
803
|
+
code: 'UNKNOWN_ROOT_OPTION',
|
|
804
|
+
exitCode: 2,
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
break;
|
|
808
|
+
}
|
|
809
|
+
const command = args[index] ?? null;
|
|
810
|
+
if (!command) {
|
|
811
|
+
return {
|
|
812
|
+
flags,
|
|
813
|
+
command: null,
|
|
814
|
+
subcommand: null,
|
|
815
|
+
commandArgs: [],
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
const maybeSubcommand = args[index + 1];
|
|
819
|
+
const subcommand = maybeSubcommand && !maybeSubcommand.startsWith('-') ? maybeSubcommand : null;
|
|
820
|
+
const commandArgs = args.slice(index + 1 + (subcommand ? 1 : 0));
|
|
821
|
+
return {
|
|
822
|
+
flags,
|
|
823
|
+
command,
|
|
824
|
+
subcommand,
|
|
825
|
+
commandArgs,
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
function parseDoctorFlags(args) {
|
|
829
|
+
let values;
|
|
830
|
+
try {
|
|
831
|
+
({ values } = parseArgs({
|
|
832
|
+
args,
|
|
833
|
+
allowPositionals: false,
|
|
834
|
+
strict: true,
|
|
835
|
+
options: {
|
|
836
|
+
help: { type: 'boolean', short: 'h' },
|
|
837
|
+
json: { type: 'boolean' },
|
|
838
|
+
},
|
|
839
|
+
}));
|
|
840
|
+
}
|
|
841
|
+
catch (error) {
|
|
842
|
+
throw new CliError(String(error), {
|
|
843
|
+
code: 'INVALID_ARGS',
|
|
844
|
+
exitCode: 2,
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
return {
|
|
848
|
+
help: Boolean(values.help),
|
|
849
|
+
json: Boolean(values.json),
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
function parseRemoteFlags(args) {
|
|
853
|
+
let values;
|
|
854
|
+
try {
|
|
855
|
+
({ values } = parseArgs({
|
|
856
|
+
args,
|
|
857
|
+
allowPositionals: false,
|
|
858
|
+
strict: true,
|
|
859
|
+
options: {
|
|
860
|
+
help: { type: 'boolean', short: 'h' },
|
|
861
|
+
json: { type: 'boolean' },
|
|
862
|
+
'dry-run': { type: 'boolean' },
|
|
863
|
+
input: { type: 'string' },
|
|
864
|
+
'api-key': { type: 'string' },
|
|
865
|
+
'base-url': { type: 'string' },
|
|
866
|
+
region: { type: 'string' },
|
|
867
|
+
'timeout-ms': { type: 'string' },
|
|
868
|
+
},
|
|
869
|
+
}));
|
|
870
|
+
}
|
|
871
|
+
catch (error) {
|
|
872
|
+
throw new CliError(String(error), {
|
|
873
|
+
code: 'INVALID_ARGS',
|
|
874
|
+
exitCode: 2,
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
const timeoutText = typeof values['timeout-ms'] === 'string' ? values['timeout-ms'] : undefined;
|
|
878
|
+
const timeoutMs = timeoutText ? Number.parseInt(timeoutText, 10) : 60_000;
|
|
879
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0) {
|
|
880
|
+
throw new CliError('Expected --timeout-ms to be a positive integer.', {
|
|
881
|
+
code: 'INVALID_TIMEOUT',
|
|
882
|
+
exitCode: 2,
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
return {
|
|
886
|
+
help: Boolean(values.help),
|
|
887
|
+
json: Boolean(values.json),
|
|
888
|
+
dryRun: Boolean(values['dry-run']),
|
|
889
|
+
inputPath: typeof values.input === 'string' ? values.input : '',
|
|
890
|
+
apiKey: typeof values['api-key'] === 'string' ? values['api-key'] : null,
|
|
891
|
+
apiBaseUrl: typeof values['base-url'] === 'string' ? values['base-url'] : null,
|
|
892
|
+
region: typeof values.region === 'string' ? values.region : null,
|
|
893
|
+
timeoutMs,
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
function parsePublishFlags(args) {
|
|
897
|
+
let values;
|
|
898
|
+
try {
|
|
899
|
+
({ values } = parseArgs({
|
|
900
|
+
args,
|
|
901
|
+
allowPositionals: false,
|
|
902
|
+
strict: true,
|
|
903
|
+
options: {
|
|
904
|
+
help: { type: 'boolean', short: 'h' },
|
|
905
|
+
json: { type: 'boolean' },
|
|
906
|
+
input: { type: 'string' },
|
|
907
|
+
'out-dir': { type: 'string' },
|
|
908
|
+
commit: { type: 'boolean' },
|
|
909
|
+
'dry-run': { type: 'boolean' },
|
|
910
|
+
},
|
|
911
|
+
}));
|
|
912
|
+
}
|
|
913
|
+
catch (error) {
|
|
914
|
+
throw new CliError(String(error), {
|
|
915
|
+
code: 'INVALID_ARGS',
|
|
916
|
+
exitCode: 2,
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
if (values.commit && values['dry-run']) {
|
|
920
|
+
throw new CliError('Cannot pass both --commit and --dry-run.', {
|
|
921
|
+
code: 'INVALID_PUBLISH_MODE',
|
|
922
|
+
exitCode: 2,
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
return {
|
|
926
|
+
help: Boolean(values.help),
|
|
927
|
+
json: Boolean(values.json),
|
|
928
|
+
inputPath: typeof values.input === 'string' ? values.input : '',
|
|
929
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : null,
|
|
930
|
+
commitOverride: values.commit ? true : values['dry-run'] ? false : null,
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
function parseValidationFlags(args) {
|
|
934
|
+
let values;
|
|
935
|
+
try {
|
|
936
|
+
({ values } = parseArgs({
|
|
937
|
+
args,
|
|
938
|
+
allowPositionals: false,
|
|
939
|
+
strict: true,
|
|
940
|
+
options: {
|
|
941
|
+
help: { type: 'boolean', short: 'h' },
|
|
942
|
+
json: { type: 'boolean' },
|
|
943
|
+
'input-dir': { type: 'string' },
|
|
944
|
+
engine: { type: 'string' },
|
|
945
|
+
'report-file': { type: 'string' },
|
|
946
|
+
},
|
|
947
|
+
}));
|
|
948
|
+
}
|
|
949
|
+
catch (error) {
|
|
950
|
+
throw new CliError(String(error), {
|
|
951
|
+
code: 'INVALID_ARGS',
|
|
952
|
+
exitCode: 2,
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
return {
|
|
956
|
+
help: Boolean(values.help),
|
|
957
|
+
json: Boolean(values.json),
|
|
958
|
+
inputDir: typeof values['input-dir'] === 'string' ? values['input-dir'] : '',
|
|
959
|
+
engine: typeof values.engine === 'string' ? values.engine : undefined,
|
|
960
|
+
reportFile: typeof values['report-file'] === 'string' ? values['report-file'] : null,
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
function parseFlowRemediateFlags(args) {
|
|
964
|
+
let values;
|
|
965
|
+
try {
|
|
966
|
+
({ values } = parseArgs({
|
|
967
|
+
args,
|
|
968
|
+
allowPositionals: false,
|
|
969
|
+
strict: true,
|
|
970
|
+
options: {
|
|
971
|
+
help: { type: 'boolean', short: 'h' },
|
|
972
|
+
json: { type: 'boolean' },
|
|
973
|
+
'input-file': { type: 'string' },
|
|
974
|
+
'out-dir': { type: 'string' },
|
|
975
|
+
},
|
|
976
|
+
}));
|
|
977
|
+
}
|
|
978
|
+
catch (error) {
|
|
979
|
+
throw new CliError(String(error), {
|
|
980
|
+
code: 'INVALID_ARGS',
|
|
981
|
+
exitCode: 2,
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
return {
|
|
985
|
+
help: Boolean(values.help),
|
|
986
|
+
json: Boolean(values.json),
|
|
987
|
+
inputFile: typeof values['input-file'] === 'string' ? values['input-file'] : '',
|
|
988
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
function parseFlowPublishVersionFlags(args) {
|
|
992
|
+
let values;
|
|
993
|
+
try {
|
|
994
|
+
({ values } = parseArgs({
|
|
995
|
+
args,
|
|
996
|
+
allowPositionals: false,
|
|
997
|
+
strict: true,
|
|
998
|
+
options: {
|
|
999
|
+
help: { type: 'boolean', short: 'h' },
|
|
1000
|
+
json: { type: 'boolean' },
|
|
1001
|
+
commit: { type: 'boolean' },
|
|
1002
|
+
'dry-run': { type: 'boolean' },
|
|
1003
|
+
'input-file': { type: 'string' },
|
|
1004
|
+
'out-dir': { type: 'string' },
|
|
1005
|
+
'max-workers': { type: 'string' },
|
|
1006
|
+
limit: { type: 'string' },
|
|
1007
|
+
'target-user-id': { type: 'string' },
|
|
1008
|
+
},
|
|
1009
|
+
}));
|
|
1010
|
+
}
|
|
1011
|
+
catch (error) {
|
|
1012
|
+
throw new CliError(String(error), {
|
|
1013
|
+
code: 'INVALID_ARGS',
|
|
1014
|
+
exitCode: 2,
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
if (values.commit && values['dry-run']) {
|
|
1018
|
+
throw new CliError('Cannot pass both --commit and --dry-run.', {
|
|
1019
|
+
code: 'FLOW_PUBLISH_VERSION_MODE_CONFLICT',
|
|
1020
|
+
exitCode: 2,
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
const parsePositiveIntegerFlag = (value, label, code) => {
|
|
1024
|
+
if (typeof value !== 'string') {
|
|
1025
|
+
return undefined;
|
|
1026
|
+
}
|
|
1027
|
+
const parsed = Number.parseInt(value, 10);
|
|
1028
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
1029
|
+
throw new CliError(`Expected ${label} to be a positive integer.`, {
|
|
1030
|
+
code,
|
|
1031
|
+
exitCode: 2,
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
return parsed;
|
|
1035
|
+
};
|
|
1036
|
+
const parseNonNegativeIntegerFlag = (value, label, code) => {
|
|
1037
|
+
if (typeof value !== 'string') {
|
|
1038
|
+
return undefined;
|
|
1039
|
+
}
|
|
1040
|
+
const parsed = Number.parseInt(value, 10);
|
|
1041
|
+
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
1042
|
+
throw new CliError(`Expected ${label} to be a non-negative integer.`, {
|
|
1043
|
+
code,
|
|
1044
|
+
exitCode: 2,
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
return parsed;
|
|
1048
|
+
};
|
|
1049
|
+
return {
|
|
1050
|
+
help: Boolean(values.help),
|
|
1051
|
+
json: Boolean(values.json),
|
|
1052
|
+
inputFile: typeof values['input-file'] === 'string' ? values['input-file'] : '',
|
|
1053
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
1054
|
+
commit: Boolean(values.commit),
|
|
1055
|
+
maxWorkers: parsePositiveIntegerFlag(values['max-workers'], '--max-workers', 'INVALID_FLOW_PUBLISH_VERSION_MAX_WORKERS'),
|
|
1056
|
+
limit: parseNonNegativeIntegerFlag(values.limit, '--limit', 'INVALID_FLOW_PUBLISH_VERSION_LIMIT'),
|
|
1057
|
+
targetUserId: typeof values['target-user-id'] === 'string' ? values['target-user-id'] : null,
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
function parseFlowPublishReviewedDataFlags(args) {
|
|
1061
|
+
let values;
|
|
1062
|
+
try {
|
|
1063
|
+
({ values } = parseArgs({
|
|
1064
|
+
args,
|
|
1065
|
+
allowPositionals: false,
|
|
1066
|
+
strict: true,
|
|
1067
|
+
options: {
|
|
1068
|
+
help: { type: 'boolean', short: 'h' },
|
|
1069
|
+
json: { type: 'boolean' },
|
|
1070
|
+
'flow-rows-file': { type: 'string' },
|
|
1071
|
+
'original-flow-rows-file': { type: 'string' },
|
|
1072
|
+
'process-rows-file': { type: 'string' },
|
|
1073
|
+
'flow-publish-policy': { type: 'string' },
|
|
1074
|
+
'process-publish-policy': { type: 'string' },
|
|
1075
|
+
'no-rewrite-process-flow-refs': { type: 'boolean' },
|
|
1076
|
+
'out-dir': { type: 'string' },
|
|
1077
|
+
commit: { type: 'boolean' },
|
|
1078
|
+
'dry-run': { type: 'boolean' },
|
|
1079
|
+
'max-workers': { type: 'string' },
|
|
1080
|
+
'target-user-id': { type: 'string' },
|
|
1081
|
+
},
|
|
1082
|
+
}));
|
|
1083
|
+
}
|
|
1084
|
+
catch (error) {
|
|
1085
|
+
throw new CliError(String(error), {
|
|
1086
|
+
code: 'INVALID_ARGS',
|
|
1087
|
+
exitCode: 2,
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
if (values.commit && values['dry-run']) {
|
|
1091
|
+
throw new CliError('Cannot pass both --commit and --dry-run.', {
|
|
1092
|
+
code: 'FLOW_PUBLISH_REVIEWED_MODE_CONFLICT',
|
|
1093
|
+
exitCode: 2,
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
const processPublishPolicy = typeof values['process-publish-policy'] === 'string'
|
|
1097
|
+
? values['process-publish-policy']
|
|
1098
|
+
: 'append_only_bump';
|
|
1099
|
+
if (processPublishPolicy !== 'skip' &&
|
|
1100
|
+
processPublishPolicy !== 'append_only_bump' &&
|
|
1101
|
+
processPublishPolicy !== 'upsert_current_version') {
|
|
1102
|
+
throw new CliError('Expected --process-publish-policy to be one of: skip, append_only_bump, upsert_current_version.', {
|
|
1103
|
+
code: 'FLOW_PUBLISH_REVIEWED_PROCESS_POLICY_INVALID',
|
|
1104
|
+
exitCode: 2,
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
const flowPublishPolicy = typeof values['flow-publish-policy'] === 'string'
|
|
1108
|
+
? values['flow-publish-policy']
|
|
1109
|
+
: 'append_only_bump';
|
|
1110
|
+
if (flowPublishPolicy !== 'skip' &&
|
|
1111
|
+
flowPublishPolicy !== 'append_only_bump' &&
|
|
1112
|
+
flowPublishPolicy !== 'upsert_current_version') {
|
|
1113
|
+
throw new CliError('Expected --flow-publish-policy to be one of: skip, append_only_bump, upsert_current_version.', {
|
|
1114
|
+
code: 'FLOW_PUBLISH_REVIEWED_FLOW_POLICY_INVALID',
|
|
1115
|
+
exitCode: 2,
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
const parsePositiveIntegerFlag = (value, label, code) => {
|
|
1119
|
+
if (typeof value !== 'string') {
|
|
1120
|
+
return undefined;
|
|
1121
|
+
}
|
|
1122
|
+
const parsed = Number.parseInt(value, 10);
|
|
1123
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
1124
|
+
throw new CliError(`Expected ${label} to be a positive integer.`, {
|
|
1125
|
+
code,
|
|
1126
|
+
exitCode: 2,
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
return parsed;
|
|
1130
|
+
};
|
|
1131
|
+
return {
|
|
1132
|
+
help: Boolean(values.help),
|
|
1133
|
+
json: Boolean(values.json),
|
|
1134
|
+
flowRowsFile: typeof values['flow-rows-file'] === 'string' ? values['flow-rows-file'] : '',
|
|
1135
|
+
originalFlowRowsFile: typeof values['original-flow-rows-file'] === 'string'
|
|
1136
|
+
? values['original-flow-rows-file']
|
|
1137
|
+
: null,
|
|
1138
|
+
processRowsFile: typeof values['process-rows-file'] === 'string' ? values['process-rows-file'] : null,
|
|
1139
|
+
flowPublishPolicy,
|
|
1140
|
+
processPublishPolicy,
|
|
1141
|
+
rewriteProcessFlowRefs: !values['no-rewrite-process-flow-refs'],
|
|
1142
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
1143
|
+
commit: Boolean(values.commit),
|
|
1144
|
+
maxWorkers: parsePositiveIntegerFlag(values['max-workers'], '--max-workers', 'INVALID_FLOW_PUBLISH_REVIEWED_MAX_WORKERS'),
|
|
1145
|
+
targetUserId: typeof values['target-user-id'] === 'string' ? values['target-user-id'] : null,
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
function parseFlowBuildAliasMapFlags(args) {
|
|
1149
|
+
let values;
|
|
1150
|
+
try {
|
|
1151
|
+
({ values } = parseArgs({
|
|
1152
|
+
args,
|
|
1153
|
+
allowPositionals: false,
|
|
1154
|
+
strict: true,
|
|
1155
|
+
options: {
|
|
1156
|
+
help: { type: 'boolean', short: 'h' },
|
|
1157
|
+
json: { type: 'boolean' },
|
|
1158
|
+
'old-flow-file': { type: 'string', multiple: true },
|
|
1159
|
+
'new-flow-file': { type: 'string', multiple: true },
|
|
1160
|
+
'seed-alias-map': { type: 'string' },
|
|
1161
|
+
'out-dir': { type: 'string' },
|
|
1162
|
+
},
|
|
1163
|
+
}));
|
|
1164
|
+
}
|
|
1165
|
+
catch (error) {
|
|
1166
|
+
throw new CliError(String(error), {
|
|
1167
|
+
code: 'INVALID_ARGS',
|
|
1168
|
+
exitCode: 2,
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
return {
|
|
1172
|
+
help: Boolean(values.help),
|
|
1173
|
+
json: Boolean(values.json),
|
|
1174
|
+
oldFlowFiles: Array.isArray(values['old-flow-file'])
|
|
1175
|
+
? values['old-flow-file'].filter((value) => typeof value === 'string')
|
|
1176
|
+
: [],
|
|
1177
|
+
newFlowFiles: Array.isArray(values['new-flow-file'])
|
|
1178
|
+
? values['new-flow-file'].filter((value) => typeof value === 'string')
|
|
1179
|
+
: [],
|
|
1180
|
+
seedAliasMapFile: typeof values['seed-alias-map'] === 'string' ? values['seed-alias-map'] : null,
|
|
1181
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
function parseFlowScanProcessFlowRefsFlags(args) {
|
|
1185
|
+
let values;
|
|
1186
|
+
try {
|
|
1187
|
+
({ values } = parseArgs({
|
|
1188
|
+
args,
|
|
1189
|
+
allowPositionals: false,
|
|
1190
|
+
strict: true,
|
|
1191
|
+
options: {
|
|
1192
|
+
help: { type: 'boolean', short: 'h' },
|
|
1193
|
+
json: { type: 'boolean' },
|
|
1194
|
+
'processes-file': { type: 'string' },
|
|
1195
|
+
'scope-flow-file': { type: 'string', multiple: true },
|
|
1196
|
+
'catalog-flow-file': { type: 'string', multiple: true },
|
|
1197
|
+
'alias-map': { type: 'string' },
|
|
1198
|
+
'exclude-emergy': { type: 'boolean' },
|
|
1199
|
+
'out-dir': { type: 'string' },
|
|
1200
|
+
},
|
|
1201
|
+
}));
|
|
1202
|
+
}
|
|
1203
|
+
catch (error) {
|
|
1204
|
+
throw new CliError(String(error), {
|
|
1205
|
+
code: 'INVALID_ARGS',
|
|
1206
|
+
exitCode: 2,
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
return {
|
|
1210
|
+
help: Boolean(values.help),
|
|
1211
|
+
json: Boolean(values.json),
|
|
1212
|
+
processesFile: typeof values['processes-file'] === 'string' ? values['processes-file'] : '',
|
|
1213
|
+
scopeFlowFiles: Array.isArray(values['scope-flow-file'])
|
|
1214
|
+
? values['scope-flow-file'].filter((value) => typeof value === 'string')
|
|
1215
|
+
: [],
|
|
1216
|
+
catalogFlowFiles: Array.isArray(values['catalog-flow-file'])
|
|
1217
|
+
? values['catalog-flow-file'].filter((value) => typeof value === 'string')
|
|
1218
|
+
: [],
|
|
1219
|
+
aliasMapFile: typeof values['alias-map'] === 'string' ? values['alias-map'] : null,
|
|
1220
|
+
excludeEmergy: Boolean(values['exclude-emergy']),
|
|
1221
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
function parseFlowPlanProcessFlowRepairsFlags(args) {
|
|
1225
|
+
let values;
|
|
1226
|
+
try {
|
|
1227
|
+
({ values } = parseArgs({
|
|
1228
|
+
args,
|
|
1229
|
+
allowPositionals: false,
|
|
1230
|
+
strict: true,
|
|
1231
|
+
options: {
|
|
1232
|
+
help: { type: 'boolean', short: 'h' },
|
|
1233
|
+
json: { type: 'boolean' },
|
|
1234
|
+
'processes-file': { type: 'string' },
|
|
1235
|
+
'scope-flow-file': { type: 'string', multiple: true },
|
|
1236
|
+
'alias-map': { type: 'string' },
|
|
1237
|
+
'scan-findings': { type: 'string' },
|
|
1238
|
+
'auto-patch-policy': { type: 'string' },
|
|
1239
|
+
'out-dir': { type: 'string' },
|
|
1240
|
+
},
|
|
1241
|
+
}));
|
|
1242
|
+
}
|
|
1243
|
+
catch (error) {
|
|
1244
|
+
throw new CliError(String(error), {
|
|
1245
|
+
code: 'INVALID_ARGS',
|
|
1246
|
+
exitCode: 2,
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
const autoPatchPolicy = typeof values['auto-patch-policy'] === 'string' ? values['auto-patch-policy'] : 'alias-only';
|
|
1250
|
+
if (autoPatchPolicy !== 'disabled' &&
|
|
1251
|
+
autoPatchPolicy !== 'alias-only' &&
|
|
1252
|
+
autoPatchPolicy !== 'alias-or-unique-name') {
|
|
1253
|
+
throw new CliError('Expected --auto-patch-policy to be one of disabled, alias-only, or alias-or-unique-name.', {
|
|
1254
|
+
code: 'INVALID_FLOW_PLAN_PROCESS_FLOW_REPAIRS_AUTO_PATCH_POLICY',
|
|
1255
|
+
exitCode: 2,
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
return {
|
|
1259
|
+
help: Boolean(values.help),
|
|
1260
|
+
json: Boolean(values.json),
|
|
1261
|
+
processesFile: typeof values['processes-file'] === 'string' ? values['processes-file'] : '',
|
|
1262
|
+
scopeFlowFiles: Array.isArray(values['scope-flow-file'])
|
|
1263
|
+
? values['scope-flow-file'].filter((value) => typeof value === 'string')
|
|
1264
|
+
: [],
|
|
1265
|
+
aliasMapFile: typeof values['alias-map'] === 'string' ? values['alias-map'] : null,
|
|
1266
|
+
scanFindingsFile: typeof values['scan-findings'] === 'string' ? values['scan-findings'] : null,
|
|
1267
|
+
autoPatchPolicy,
|
|
1268
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
function parseFlowApplyProcessFlowRepairsFlags(args) {
|
|
1272
|
+
let values;
|
|
1273
|
+
try {
|
|
1274
|
+
({ values } = parseArgs({
|
|
1275
|
+
args,
|
|
1276
|
+
allowPositionals: false,
|
|
1277
|
+
strict: true,
|
|
1278
|
+
options: {
|
|
1279
|
+
help: { type: 'boolean', short: 'h' },
|
|
1280
|
+
json: { type: 'boolean' },
|
|
1281
|
+
'processes-file': { type: 'string' },
|
|
1282
|
+
'scope-flow-file': { type: 'string', multiple: true },
|
|
1283
|
+
'alias-map': { type: 'string' },
|
|
1284
|
+
'scan-findings': { type: 'string' },
|
|
1285
|
+
'auto-patch-policy': { type: 'string' },
|
|
1286
|
+
'process-pool-file': { type: 'string' },
|
|
1287
|
+
'out-dir': { type: 'string' },
|
|
1288
|
+
},
|
|
1289
|
+
}));
|
|
1290
|
+
}
|
|
1291
|
+
catch (error) {
|
|
1292
|
+
throw new CliError(String(error), {
|
|
1293
|
+
code: 'INVALID_ARGS',
|
|
1294
|
+
exitCode: 2,
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
const autoPatchPolicy = typeof values['auto-patch-policy'] === 'string' ? values['auto-patch-policy'] : 'alias-only';
|
|
1298
|
+
if (autoPatchPolicy !== 'disabled' &&
|
|
1299
|
+
autoPatchPolicy !== 'alias-only' &&
|
|
1300
|
+
autoPatchPolicy !== 'alias-or-unique-name') {
|
|
1301
|
+
throw new CliError('Expected --auto-patch-policy to be one of disabled, alias-only, or alias-or-unique-name.', {
|
|
1302
|
+
code: 'INVALID_FLOW_APPLY_PROCESS_FLOW_REPAIRS_AUTO_PATCH_POLICY',
|
|
1303
|
+
exitCode: 2,
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
return {
|
|
1307
|
+
help: Boolean(values.help),
|
|
1308
|
+
json: Boolean(values.json),
|
|
1309
|
+
processesFile: typeof values['processes-file'] === 'string' ? values['processes-file'] : '',
|
|
1310
|
+
scopeFlowFiles: Array.isArray(values['scope-flow-file'])
|
|
1311
|
+
? values['scope-flow-file'].filter((value) => typeof value === 'string')
|
|
1312
|
+
: [],
|
|
1313
|
+
aliasMapFile: typeof values['alias-map'] === 'string' ? values['alias-map'] : null,
|
|
1314
|
+
scanFindingsFile: typeof values['scan-findings'] === 'string' ? values['scan-findings'] : null,
|
|
1315
|
+
autoPatchPolicy,
|
|
1316
|
+
processPoolFile: typeof values['process-pool-file'] === 'string' ? values['process-pool-file'] : null,
|
|
1317
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
function parseFlowRegenProductFlags(args) {
|
|
1321
|
+
let values;
|
|
1322
|
+
try {
|
|
1323
|
+
({ values } = parseArgs({
|
|
1324
|
+
args,
|
|
1325
|
+
allowPositionals: false,
|
|
1326
|
+
strict: true,
|
|
1327
|
+
options: {
|
|
1328
|
+
help: { type: 'boolean', short: 'h' },
|
|
1329
|
+
json: { type: 'boolean' },
|
|
1330
|
+
'processes-file': { type: 'string' },
|
|
1331
|
+
'scope-flow-file': { type: 'string', multiple: true },
|
|
1332
|
+
'catalog-flow-file': { type: 'string', multiple: true },
|
|
1333
|
+
'alias-map': { type: 'string' },
|
|
1334
|
+
'exclude-emergy': { type: 'boolean' },
|
|
1335
|
+
'auto-patch-policy': { type: 'string' },
|
|
1336
|
+
apply: { type: 'boolean' },
|
|
1337
|
+
'process-pool-file': { type: 'string' },
|
|
1338
|
+
'tidas-mode': { type: 'string' },
|
|
1339
|
+
'out-dir': { type: 'string' },
|
|
1340
|
+
},
|
|
1341
|
+
}));
|
|
1342
|
+
}
|
|
1343
|
+
catch (error) {
|
|
1344
|
+
throw new CliError(String(error), {
|
|
1345
|
+
code: 'INVALID_ARGS',
|
|
1346
|
+
exitCode: 2,
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
const autoPatchPolicy = typeof values['auto-patch-policy'] === 'string' ? values['auto-patch-policy'] : 'alias-only';
|
|
1350
|
+
if (autoPatchPolicy !== 'disabled' &&
|
|
1351
|
+
autoPatchPolicy !== 'alias-only' &&
|
|
1352
|
+
autoPatchPolicy !== 'alias-or-unique-name') {
|
|
1353
|
+
throw new CliError('Expected --auto-patch-policy to be one of disabled, alias-only, or alias-or-unique-name.', {
|
|
1354
|
+
code: 'INVALID_FLOW_REGEN_AUTO_PATCH_POLICY',
|
|
1355
|
+
exitCode: 2,
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
const tidasMode = typeof values['tidas-mode'] === 'string' ? values['tidas-mode'] : 'auto';
|
|
1359
|
+
if (tidasMode !== 'auto' && tidasMode !== 'required' && tidasMode !== 'skip') {
|
|
1360
|
+
throw new CliError('Expected --tidas-mode to be one of auto, required, or skip.', {
|
|
1361
|
+
code: 'INVALID_FLOW_REGEN_TIDAS_MODE',
|
|
1362
|
+
exitCode: 2,
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
if (typeof values['process-pool-file'] === 'string' && !values.apply) {
|
|
1366
|
+
throw new CliError('Use --process-pool-file only with --apply.', {
|
|
1367
|
+
code: 'FLOW_REGEN_PROCESS_POOL_REQUIRES_APPLY',
|
|
1368
|
+
exitCode: 2,
|
|
1369
|
+
});
|
|
1370
|
+
}
|
|
1371
|
+
return {
|
|
1372
|
+
help: Boolean(values.help),
|
|
1373
|
+
json: Boolean(values.json),
|
|
1374
|
+
processesFile: typeof values['processes-file'] === 'string' ? values['processes-file'] : '',
|
|
1375
|
+
scopeFlowFiles: Array.isArray(values['scope-flow-file'])
|
|
1376
|
+
? values['scope-flow-file'].filter((value) => typeof value === 'string')
|
|
1377
|
+
: [],
|
|
1378
|
+
catalogFlowFiles: Array.isArray(values['catalog-flow-file'])
|
|
1379
|
+
? values['catalog-flow-file'].filter((value) => typeof value === 'string')
|
|
1380
|
+
: [],
|
|
1381
|
+
aliasMapFile: typeof values['alias-map'] === 'string' ? values['alias-map'] : null,
|
|
1382
|
+
excludeEmergy: Boolean(values['exclude-emergy']),
|
|
1383
|
+
autoPatchPolicy,
|
|
1384
|
+
apply: Boolean(values.apply),
|
|
1385
|
+
processPoolFile: typeof values['process-pool-file'] === 'string' ? values['process-pool-file'] : null,
|
|
1386
|
+
tidasMode,
|
|
1387
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1390
|
+
function parseFlowValidateProcessesFlags(args) {
|
|
1391
|
+
let values;
|
|
1392
|
+
try {
|
|
1393
|
+
({ values } = parseArgs({
|
|
1394
|
+
args,
|
|
1395
|
+
allowPositionals: false,
|
|
1396
|
+
strict: true,
|
|
1397
|
+
options: {
|
|
1398
|
+
help: { type: 'boolean', short: 'h' },
|
|
1399
|
+
json: { type: 'boolean' },
|
|
1400
|
+
'original-processes-file': { type: 'string' },
|
|
1401
|
+
'patched-processes-file': { type: 'string' },
|
|
1402
|
+
'scope-flow-file': { type: 'string', multiple: true },
|
|
1403
|
+
'tidas-mode': { type: 'string' },
|
|
1404
|
+
'out-dir': { type: 'string' },
|
|
1405
|
+
},
|
|
1406
|
+
}));
|
|
1407
|
+
}
|
|
1408
|
+
catch (error) {
|
|
1409
|
+
throw new CliError(String(error), {
|
|
1410
|
+
code: 'INVALID_ARGS',
|
|
1411
|
+
exitCode: 2,
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
const tidasMode = typeof values['tidas-mode'] === 'string' ? values['tidas-mode'] : 'auto';
|
|
1415
|
+
if (tidasMode !== 'auto' && tidasMode !== 'required' && tidasMode !== 'skip') {
|
|
1416
|
+
throw new CliError('Expected --tidas-mode to be one of auto, required, or skip.', {
|
|
1417
|
+
code: 'INVALID_FLOW_VALIDATE_TIDAS_MODE',
|
|
1418
|
+
exitCode: 2,
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
return {
|
|
1422
|
+
help: Boolean(values.help),
|
|
1423
|
+
json: Boolean(values.json),
|
|
1424
|
+
originalProcessesFile: typeof values['original-processes-file'] === 'string'
|
|
1425
|
+
? values['original-processes-file']
|
|
1426
|
+
: '',
|
|
1427
|
+
patchedProcessesFile: typeof values['patched-processes-file'] === 'string' ? values['patched-processes-file'] : '',
|
|
1428
|
+
scopeFlowFiles: Array.isArray(values['scope-flow-file'])
|
|
1429
|
+
? values['scope-flow-file'].filter((value) => typeof value === 'string')
|
|
1430
|
+
: [],
|
|
1431
|
+
tidasMode,
|
|
1432
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
function parseFlowGetFlags(args) {
|
|
1436
|
+
let values;
|
|
1437
|
+
try {
|
|
1438
|
+
({ values } = parseArgs({
|
|
1439
|
+
args,
|
|
1440
|
+
allowPositionals: false,
|
|
1441
|
+
strict: true,
|
|
1442
|
+
options: {
|
|
1443
|
+
help: { type: 'boolean', short: 'h' },
|
|
1444
|
+
json: { type: 'boolean' },
|
|
1445
|
+
id: { type: 'string' },
|
|
1446
|
+
version: { type: 'string' },
|
|
1447
|
+
'user-id': { type: 'string' },
|
|
1448
|
+
'state-code': { type: 'string' },
|
|
1449
|
+
},
|
|
1450
|
+
}));
|
|
1451
|
+
}
|
|
1452
|
+
catch (error) {
|
|
1453
|
+
throw new CliError(String(error), {
|
|
1454
|
+
code: 'INVALID_ARGS',
|
|
1455
|
+
exitCode: 2,
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
const parseOptionalNonNegativeIntegerFlag = (value, label, code) => {
|
|
1459
|
+
if (typeof value !== 'string') {
|
|
1460
|
+
return null;
|
|
1461
|
+
}
|
|
1462
|
+
const parsed = Number.parseInt(value, 10);
|
|
1463
|
+
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
1464
|
+
throw new CliError(`Expected ${label} to be a non-negative integer.`, {
|
|
1465
|
+
code,
|
|
1466
|
+
exitCode: 2,
|
|
1467
|
+
});
|
|
1468
|
+
}
|
|
1469
|
+
return parsed;
|
|
1470
|
+
};
|
|
1471
|
+
return {
|
|
1472
|
+
help: Boolean(values.help),
|
|
1473
|
+
json: Boolean(values.json),
|
|
1474
|
+
flowId: typeof values.id === 'string' ? values.id : '',
|
|
1475
|
+
version: typeof values.version === 'string' ? values.version : null,
|
|
1476
|
+
userId: typeof values['user-id'] === 'string' ? values['user-id'] : null,
|
|
1477
|
+
stateCode: parseOptionalNonNegativeIntegerFlag(values['state-code'], '--state-code', 'INVALID_FLOW_GET_STATE_CODE'),
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
function parseFlowListFlags(args) {
|
|
1481
|
+
let values;
|
|
1482
|
+
try {
|
|
1483
|
+
({ values } = parseArgs({
|
|
1484
|
+
args,
|
|
1485
|
+
allowPositionals: false,
|
|
1486
|
+
strict: true,
|
|
1487
|
+
options: {
|
|
1488
|
+
help: { type: 'boolean', short: 'h' },
|
|
1489
|
+
json: { type: 'boolean' },
|
|
1490
|
+
id: { type: 'string', multiple: true },
|
|
1491
|
+
version: { type: 'string' },
|
|
1492
|
+
'user-id': { type: 'string' },
|
|
1493
|
+
'state-code': { type: 'string', multiple: true },
|
|
1494
|
+
type: { type: 'string', multiple: true },
|
|
1495
|
+
'type-of-dataset': { type: 'string', multiple: true },
|
|
1496
|
+
limit: { type: 'string' },
|
|
1497
|
+
offset: { type: 'string' },
|
|
1498
|
+
all: { type: 'boolean' },
|
|
1499
|
+
'page-size': { type: 'string' },
|
|
1500
|
+
order: { type: 'string' },
|
|
1501
|
+
},
|
|
1502
|
+
}));
|
|
1503
|
+
}
|
|
1504
|
+
catch (error) {
|
|
1505
|
+
throw new CliError(String(error), {
|
|
1506
|
+
code: 'INVALID_ARGS',
|
|
1507
|
+
exitCode: 2,
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
const parseOptionalPositiveIntegerFlag = (value, label, code) => {
|
|
1511
|
+
if (typeof value !== 'string') {
|
|
1512
|
+
return null;
|
|
1513
|
+
}
|
|
1514
|
+
const parsed = Number.parseInt(value, 10);
|
|
1515
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
1516
|
+
throw new CliError(`Expected ${label} to be a positive integer.`, {
|
|
1517
|
+
code,
|
|
1518
|
+
exitCode: 2,
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
return parsed;
|
|
1522
|
+
};
|
|
1523
|
+
const parseOptionalNonNegativeIntegerFlag = (value, label, code) => {
|
|
1524
|
+
if (typeof value !== 'string') {
|
|
1525
|
+
return null;
|
|
1526
|
+
}
|
|
1527
|
+
const parsed = Number.parseInt(value, 10);
|
|
1528
|
+
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
1529
|
+
throw new CliError(`Expected ${label} to be a non-negative integer.`, {
|
|
1530
|
+
code,
|
|
1531
|
+
exitCode: 2,
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
return parsed;
|
|
1535
|
+
};
|
|
1536
|
+
const parseStateCodeValues = (value) => {
|
|
1537
|
+
if (!Array.isArray(value)) {
|
|
1538
|
+
return [];
|
|
1539
|
+
}
|
|
1540
|
+
return value.map((entry) => {
|
|
1541
|
+
const parsed = Number.parseInt(String(entry), 10);
|
|
1542
|
+
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
1543
|
+
throw new CliError('Expected --state-code to be a non-negative integer.', {
|
|
1544
|
+
code: 'INVALID_FLOW_LIST_STATE_CODE',
|
|
1545
|
+
exitCode: 2,
|
|
1546
|
+
});
|
|
1547
|
+
}
|
|
1548
|
+
return parsed;
|
|
1549
|
+
});
|
|
1550
|
+
};
|
|
1551
|
+
const toStringArray = (value) => Array.isArray(value) ? value.filter((entry) => typeof entry === 'string') : [];
|
|
1552
|
+
if (values['page-size'] !== undefined && !values.all) {
|
|
1553
|
+
throw new CliError('Use --page-size only with --all.', {
|
|
1554
|
+
code: 'FLOW_LIST_PAGE_SIZE_REQUIRES_ALL',
|
|
1555
|
+
exitCode: 2,
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
return {
|
|
1559
|
+
help: Boolean(values.help),
|
|
1560
|
+
json: Boolean(values.json),
|
|
1561
|
+
ids: toStringArray(values.id),
|
|
1562
|
+
version: typeof values.version === 'string' ? values.version : null,
|
|
1563
|
+
userId: typeof values['user-id'] === 'string' ? values['user-id'] : null,
|
|
1564
|
+
stateCodes: parseStateCodeValues(values['state-code']),
|
|
1565
|
+
typeOfDataset: [...toStringArray(values['type-of-dataset']), ...toStringArray(values.type)],
|
|
1566
|
+
limit: parseOptionalPositiveIntegerFlag(values.limit, '--limit', 'INVALID_FLOW_LIST_LIMIT'),
|
|
1567
|
+
offset: parseOptionalNonNegativeIntegerFlag(values.offset, '--offset', 'INVALID_FLOW_LIST_OFFSET'),
|
|
1568
|
+
all: Boolean(values.all),
|
|
1569
|
+
pageSize: parseOptionalPositiveIntegerFlag(values['page-size'], '--page-size', 'INVALID_FLOW_LIST_PAGE_SIZE'),
|
|
1570
|
+
order: typeof values.order === 'string' ? values.order : null,
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1573
|
+
function parseReviewProcessFlags(args) {
|
|
1574
|
+
let values;
|
|
1575
|
+
try {
|
|
1576
|
+
({ values } = parseArgs({
|
|
1577
|
+
args,
|
|
1578
|
+
allowPositionals: false,
|
|
1579
|
+
strict: true,
|
|
1580
|
+
options: {
|
|
1581
|
+
help: { type: 'boolean', short: 'h' },
|
|
1582
|
+
json: { type: 'boolean' },
|
|
1583
|
+
'run-root': { type: 'string' },
|
|
1584
|
+
'run-id': { type: 'string' },
|
|
1585
|
+
'out-dir': { type: 'string' },
|
|
1586
|
+
'start-ts': { type: 'string' },
|
|
1587
|
+
'end-ts': { type: 'string' },
|
|
1588
|
+
'logic-version': { type: 'string' },
|
|
1589
|
+
'enable-llm': { type: 'boolean' },
|
|
1590
|
+
'llm-model': { type: 'string' },
|
|
1591
|
+
'llm-max-processes': { type: 'string' },
|
|
1592
|
+
},
|
|
1593
|
+
}));
|
|
1594
|
+
}
|
|
1595
|
+
catch (error) {
|
|
1596
|
+
throw new CliError(String(error), {
|
|
1597
|
+
code: 'INVALID_ARGS',
|
|
1598
|
+
exitCode: 2,
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
const llmMaxProcessesValue = typeof values['llm-max-processes'] === 'string'
|
|
1602
|
+
? Number.parseInt(values['llm-max-processes'], 10)
|
|
1603
|
+
: undefined;
|
|
1604
|
+
if (values['llm-max-processes'] !== undefined &&
|
|
1605
|
+
(!Number.isInteger(llmMaxProcessesValue) || llmMaxProcessesValue <= 0)) {
|
|
1606
|
+
throw new CliError('Expected --llm-max-processes to be a positive integer.', {
|
|
1607
|
+
code: 'INVALID_LLM_MAX_PROCESSES',
|
|
1608
|
+
exitCode: 2,
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
return {
|
|
1612
|
+
help: Boolean(values.help),
|
|
1613
|
+
json: Boolean(values.json),
|
|
1614
|
+
runRoot: typeof values['run-root'] === 'string' ? values['run-root'] : '',
|
|
1615
|
+
runId: typeof values['run-id'] === 'string' ? values['run-id'] : '',
|
|
1616
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
1617
|
+
startTs: typeof values['start-ts'] === 'string' ? values['start-ts'] : undefined,
|
|
1618
|
+
endTs: typeof values['end-ts'] === 'string' ? values['end-ts'] : undefined,
|
|
1619
|
+
logicVersion: typeof values['logic-version'] === 'string' ? values['logic-version'] : undefined,
|
|
1620
|
+
enableLlm: Boolean(values['enable-llm']),
|
|
1621
|
+
llmModel: typeof values['llm-model'] === 'string' ? values['llm-model'] : undefined,
|
|
1622
|
+
llmMaxProcesses: llmMaxProcessesValue,
|
|
1623
|
+
};
|
|
1624
|
+
}
|
|
1625
|
+
function parseReviewFlowFlags(args) {
|
|
1626
|
+
let values;
|
|
1627
|
+
try {
|
|
1628
|
+
({ values } = parseArgs({
|
|
1629
|
+
args,
|
|
1630
|
+
allowPositionals: false,
|
|
1631
|
+
strict: true,
|
|
1632
|
+
options: {
|
|
1633
|
+
help: { type: 'boolean', short: 'h' },
|
|
1634
|
+
json: { type: 'boolean' },
|
|
1635
|
+
'rows-file': { type: 'string' },
|
|
1636
|
+
'flows-dir': { type: 'string' },
|
|
1637
|
+
'run-root': { type: 'string' },
|
|
1638
|
+
'run-id': { type: 'string' },
|
|
1639
|
+
'out-dir': { type: 'string' },
|
|
1640
|
+
'start-ts': { type: 'string' },
|
|
1641
|
+
'end-ts': { type: 'string' },
|
|
1642
|
+
'logic-version': { type: 'string' },
|
|
1643
|
+
'enable-llm': { type: 'boolean' },
|
|
1644
|
+
'llm-model': { type: 'string' },
|
|
1645
|
+
'llm-max-flows': { type: 'string' },
|
|
1646
|
+
'llm-batch-size': { type: 'string' },
|
|
1647
|
+
'similarity-threshold': { type: 'string' },
|
|
1648
|
+
'methodology-id': { type: 'string' },
|
|
1649
|
+
},
|
|
1650
|
+
}));
|
|
1651
|
+
}
|
|
1652
|
+
catch (error) {
|
|
1653
|
+
throw new CliError(String(error), {
|
|
1654
|
+
code: 'INVALID_ARGS',
|
|
1655
|
+
exitCode: 2,
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
const parsePositiveIntegerFlag = (value, label, code) => {
|
|
1659
|
+
if (typeof value !== 'string') {
|
|
1660
|
+
return undefined;
|
|
1661
|
+
}
|
|
1662
|
+
const parsed = Number.parseInt(value, 10);
|
|
1663
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
1664
|
+
throw new CliError(`Expected ${label} to be a positive integer.`, {
|
|
1665
|
+
code,
|
|
1666
|
+
exitCode: 2,
|
|
1667
|
+
});
|
|
1668
|
+
}
|
|
1669
|
+
return parsed;
|
|
1670
|
+
};
|
|
1671
|
+
const similarityThreshold = typeof values['similarity-threshold'] === 'string'
|
|
1672
|
+
? Number.parseFloat(values['similarity-threshold'])
|
|
1673
|
+
: undefined;
|
|
1674
|
+
if (values['similarity-threshold'] !== undefined &&
|
|
1675
|
+
(!Number.isFinite(similarityThreshold) || similarityThreshold <= 0)) {
|
|
1676
|
+
throw new CliError('Expected --similarity-threshold to be a positive number.', {
|
|
1677
|
+
code: 'INVALID_SIMILARITY_THRESHOLD',
|
|
1678
|
+
exitCode: 2,
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
return {
|
|
1682
|
+
help: Boolean(values.help),
|
|
1683
|
+
json: Boolean(values.json),
|
|
1684
|
+
rowsFile: typeof values['rows-file'] === 'string' ? values['rows-file'] : undefined,
|
|
1685
|
+
flowsDir: typeof values['flows-dir'] === 'string' ? values['flows-dir'] : undefined,
|
|
1686
|
+
runRoot: typeof values['run-root'] === 'string' ? values['run-root'] : undefined,
|
|
1687
|
+
runId: typeof values['run-id'] === 'string' ? values['run-id'] : undefined,
|
|
1688
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
1689
|
+
startTs: typeof values['start-ts'] === 'string' ? values['start-ts'] : undefined,
|
|
1690
|
+
endTs: typeof values['end-ts'] === 'string' ? values['end-ts'] : undefined,
|
|
1691
|
+
logicVersion: typeof values['logic-version'] === 'string' ? values['logic-version'] : undefined,
|
|
1692
|
+
enableLlm: Boolean(values['enable-llm']),
|
|
1693
|
+
llmModel: typeof values['llm-model'] === 'string' ? values['llm-model'] : undefined,
|
|
1694
|
+
llmMaxFlows: parsePositiveIntegerFlag(values['llm-max-flows'], '--llm-max-flows', 'INVALID_LLM_MAX_FLOWS'),
|
|
1695
|
+
llmBatchSize: parsePositiveIntegerFlag(values['llm-batch-size'], '--llm-batch-size', 'INVALID_LLM_BATCH_SIZE'),
|
|
1696
|
+
similarityThreshold,
|
|
1697
|
+
methodologyId: typeof values['methodology-id'] === 'string' ? values['methodology-id'] : undefined,
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1700
|
+
function parseReviewLifecyclemodelFlags(args) {
|
|
1701
|
+
let values;
|
|
1702
|
+
try {
|
|
1703
|
+
({ values } = parseArgs({
|
|
1704
|
+
args,
|
|
1705
|
+
allowPositionals: false,
|
|
1706
|
+
strict: true,
|
|
1707
|
+
options: {
|
|
1708
|
+
help: { type: 'boolean', short: 'h' },
|
|
1709
|
+
json: { type: 'boolean' },
|
|
1710
|
+
'run-dir': { type: 'string' },
|
|
1711
|
+
'out-dir': { type: 'string' },
|
|
1712
|
+
'start-ts': { type: 'string' },
|
|
1713
|
+
'end-ts': { type: 'string' },
|
|
1714
|
+
'logic-version': { type: 'string' },
|
|
1715
|
+
},
|
|
1716
|
+
}));
|
|
1717
|
+
}
|
|
1718
|
+
catch (error) {
|
|
1719
|
+
throw new CliError(String(error), {
|
|
1720
|
+
code: 'INVALID_ARGS',
|
|
1721
|
+
exitCode: 2,
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
return {
|
|
1725
|
+
help: Boolean(values.help),
|
|
1726
|
+
json: Boolean(values.json),
|
|
1727
|
+
runDir: typeof values['run-dir'] === 'string' ? values['run-dir'] : '',
|
|
1728
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
1729
|
+
startTs: typeof values['start-ts'] === 'string' ? values['start-ts'] : undefined,
|
|
1730
|
+
endTs: typeof values['end-ts'] === 'string' ? values['end-ts'] : undefined,
|
|
1731
|
+
logicVersion: typeof values['logic-version'] === 'string' ? values['logic-version'] : undefined,
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1734
|
+
function parseLifecyclemodelPublishFlags(args) {
|
|
1735
|
+
let values;
|
|
1736
|
+
try {
|
|
1737
|
+
({ values } = parseArgs({
|
|
1738
|
+
args,
|
|
1739
|
+
allowPositionals: false,
|
|
1740
|
+
strict: true,
|
|
1741
|
+
options: {
|
|
1742
|
+
help: { type: 'boolean', short: 'h' },
|
|
1743
|
+
json: { type: 'boolean' },
|
|
1744
|
+
'run-dir': { type: 'string' },
|
|
1745
|
+
'publish-processes': { type: 'boolean' },
|
|
1746
|
+
'publish-relations': { type: 'boolean' },
|
|
1747
|
+
},
|
|
1748
|
+
}));
|
|
1749
|
+
}
|
|
1750
|
+
catch (error) {
|
|
1751
|
+
throw new CliError(String(error), {
|
|
1752
|
+
code: 'INVALID_ARGS',
|
|
1753
|
+
exitCode: 2,
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1756
|
+
return {
|
|
1757
|
+
help: Boolean(values.help),
|
|
1758
|
+
json: Boolean(values.json),
|
|
1759
|
+
runDir: typeof values['run-dir'] === 'string' ? values['run-dir'] : '',
|
|
1760
|
+
publishProcesses: Boolean(values['publish-processes']),
|
|
1761
|
+
publishRelations: Boolean(values['publish-relations']),
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1764
|
+
function parseLifecyclemodelValidateBuildFlags(args) {
|
|
1765
|
+
let values;
|
|
1766
|
+
try {
|
|
1767
|
+
({ values } = parseArgs({
|
|
1768
|
+
args,
|
|
1769
|
+
allowPositionals: false,
|
|
1770
|
+
strict: true,
|
|
1771
|
+
options: {
|
|
1772
|
+
help: { type: 'boolean', short: 'h' },
|
|
1773
|
+
json: { type: 'boolean' },
|
|
1774
|
+
'run-dir': { type: 'string' },
|
|
1775
|
+
engine: { type: 'string' },
|
|
1776
|
+
},
|
|
1777
|
+
}));
|
|
1778
|
+
}
|
|
1779
|
+
catch (error) {
|
|
1780
|
+
throw new CliError(String(error), {
|
|
1781
|
+
code: 'INVALID_ARGS',
|
|
1782
|
+
exitCode: 2,
|
|
1783
|
+
});
|
|
1784
|
+
}
|
|
1785
|
+
return {
|
|
1786
|
+
help: Boolean(values.help),
|
|
1787
|
+
json: Boolean(values.json),
|
|
1788
|
+
runDir: typeof values['run-dir'] === 'string' ? values['run-dir'] : '',
|
|
1789
|
+
engine: typeof values.engine === 'string' ? values.engine : undefined,
|
|
1790
|
+
};
|
|
1791
|
+
}
|
|
1792
|
+
function parseLifecyclemodelPublishBuildFlags(args) {
|
|
1793
|
+
let values;
|
|
1794
|
+
try {
|
|
1795
|
+
({ values } = parseArgs({
|
|
1796
|
+
args,
|
|
1797
|
+
allowPositionals: false,
|
|
1798
|
+
strict: true,
|
|
1799
|
+
options: {
|
|
1800
|
+
help: { type: 'boolean', short: 'h' },
|
|
1801
|
+
json: { type: 'boolean' },
|
|
1802
|
+
'run-dir': { type: 'string' },
|
|
1803
|
+
},
|
|
1804
|
+
}));
|
|
1805
|
+
}
|
|
1806
|
+
catch (error) {
|
|
1807
|
+
throw new CliError(String(error), {
|
|
1808
|
+
code: 'INVALID_ARGS',
|
|
1809
|
+
exitCode: 2,
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
return {
|
|
1813
|
+
help: Boolean(values.help),
|
|
1814
|
+
json: Boolean(values.json),
|
|
1815
|
+
runDir: typeof values['run-dir'] === 'string' ? values['run-dir'] : '',
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1818
|
+
function parseLifecyclemodelBuildFlags(args) {
|
|
1819
|
+
let values;
|
|
1820
|
+
try {
|
|
1821
|
+
({ values } = parseArgs({
|
|
1822
|
+
args,
|
|
1823
|
+
allowPositionals: false,
|
|
1824
|
+
strict: true,
|
|
1825
|
+
options: {
|
|
1826
|
+
help: { type: 'boolean', short: 'h' },
|
|
1827
|
+
json: { type: 'boolean' },
|
|
1828
|
+
input: { type: 'string' },
|
|
1829
|
+
'out-dir': { type: 'string' },
|
|
1830
|
+
},
|
|
1831
|
+
}));
|
|
1832
|
+
}
|
|
1833
|
+
catch (error) {
|
|
1834
|
+
throw new CliError(String(error), {
|
|
1835
|
+
code: 'INVALID_ARGS',
|
|
1836
|
+
exitCode: 2,
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
return {
|
|
1840
|
+
help: Boolean(values.help),
|
|
1841
|
+
json: Boolean(values.json),
|
|
1842
|
+
inputPath: typeof values.input === 'string' ? values.input : '',
|
|
1843
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : null,
|
|
1844
|
+
};
|
|
1845
|
+
}
|
|
1846
|
+
function parseLifecyclemodelOrchestrateFlags(args) {
|
|
1847
|
+
let values;
|
|
1848
|
+
let positionals;
|
|
1849
|
+
try {
|
|
1850
|
+
({ values, positionals } = parseArgs({
|
|
1851
|
+
args,
|
|
1852
|
+
allowPositionals: true,
|
|
1853
|
+
strict: true,
|
|
1854
|
+
options: {
|
|
1855
|
+
help: { type: 'boolean', short: 'h' },
|
|
1856
|
+
json: { type: 'boolean' },
|
|
1857
|
+
input: { type: 'string' },
|
|
1858
|
+
request: { type: 'string' },
|
|
1859
|
+
'out-dir': { type: 'string' },
|
|
1860
|
+
'run-dir': { type: 'string' },
|
|
1861
|
+
'allow-process-build': { type: 'boolean' },
|
|
1862
|
+
'allow-submodel-build': { type: 'boolean' },
|
|
1863
|
+
'publish-lifecyclemodels': { type: 'boolean' },
|
|
1864
|
+
'publish-resulting-process-relations': { type: 'boolean' },
|
|
1865
|
+
},
|
|
1866
|
+
}));
|
|
1867
|
+
}
|
|
1868
|
+
catch (error) {
|
|
1869
|
+
throw new CliError(String(error), {
|
|
1870
|
+
code: 'INVALID_ARGS',
|
|
1871
|
+
exitCode: 2,
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
const inputAlias = typeof values.request === 'string' ? values.request : '';
|
|
1875
|
+
return {
|
|
1876
|
+
help: Boolean(values.help),
|
|
1877
|
+
json: Boolean(values.json),
|
|
1878
|
+
action: positionals[0] ?? '',
|
|
1879
|
+
inputPath: typeof values.input === 'string' ? values.input : inputAlias,
|
|
1880
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : null,
|
|
1881
|
+
runDir: typeof values['run-dir'] === 'string' ? values['run-dir'] : '',
|
|
1882
|
+
allowProcessBuild: Boolean(values['allow-process-build']),
|
|
1883
|
+
allowSubmodelBuild: Boolean(values['allow-submodel-build']),
|
|
1884
|
+
publishLifecyclemodels: Boolean(values['publish-lifecyclemodels']),
|
|
1885
|
+
publishResultingProcessRelations: Boolean(values['publish-resulting-process-relations']),
|
|
1886
|
+
};
|
|
1887
|
+
}
|
|
1888
|
+
function parseProcessAutoBuildFlags(args) {
|
|
1889
|
+
let values;
|
|
1890
|
+
try {
|
|
1891
|
+
({ values } = parseArgs({
|
|
1892
|
+
args,
|
|
1893
|
+
allowPositionals: false,
|
|
1894
|
+
strict: true,
|
|
1895
|
+
options: {
|
|
1896
|
+
help: { type: 'boolean', short: 'h' },
|
|
1897
|
+
json: { type: 'boolean' },
|
|
1898
|
+
input: { type: 'string' },
|
|
1899
|
+
'out-dir': { type: 'string' },
|
|
1900
|
+
},
|
|
1901
|
+
}));
|
|
1902
|
+
}
|
|
1903
|
+
catch (error) {
|
|
1904
|
+
throw new CliError(String(error), {
|
|
1905
|
+
code: 'INVALID_ARGS',
|
|
1906
|
+
exitCode: 2,
|
|
1907
|
+
});
|
|
1908
|
+
}
|
|
1909
|
+
return {
|
|
1910
|
+
help: Boolean(values.help),
|
|
1911
|
+
json: Boolean(values.json),
|
|
1912
|
+
inputPath: typeof values.input === 'string' ? values.input : '',
|
|
1913
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : null,
|
|
1914
|
+
};
|
|
1915
|
+
}
|
|
1916
|
+
function parseProcessGetFlags(args) {
|
|
1917
|
+
let values;
|
|
1918
|
+
try {
|
|
1919
|
+
({ values } = parseArgs({
|
|
1920
|
+
args,
|
|
1921
|
+
allowPositionals: false,
|
|
1922
|
+
strict: true,
|
|
1923
|
+
options: {
|
|
1924
|
+
help: { type: 'boolean', short: 'h' },
|
|
1925
|
+
json: { type: 'boolean' },
|
|
1926
|
+
id: { type: 'string' },
|
|
1927
|
+
version: { type: 'string' },
|
|
1928
|
+
},
|
|
1929
|
+
}));
|
|
1930
|
+
}
|
|
1931
|
+
catch (error) {
|
|
1932
|
+
throw new CliError(String(error), {
|
|
1933
|
+
code: 'INVALID_ARGS',
|
|
1934
|
+
exitCode: 2,
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1937
|
+
return {
|
|
1938
|
+
help: Boolean(values.help),
|
|
1939
|
+
json: Boolean(values.json),
|
|
1940
|
+
processId: typeof values.id === 'string' ? values.id : '',
|
|
1941
|
+
version: typeof values.version === 'string' ? values.version : null,
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
function parseProcessResumeBuildFlags(args) {
|
|
1945
|
+
let values;
|
|
1946
|
+
try {
|
|
1947
|
+
({ values } = parseArgs({
|
|
1948
|
+
args,
|
|
1949
|
+
allowPositionals: false,
|
|
1950
|
+
strict: true,
|
|
1951
|
+
options: {
|
|
1952
|
+
help: { type: 'boolean', short: 'h' },
|
|
1953
|
+
json: { type: 'boolean' },
|
|
1954
|
+
'run-id': { type: 'string' },
|
|
1955
|
+
'run-dir': { type: 'string' },
|
|
1956
|
+
},
|
|
1957
|
+
}));
|
|
1958
|
+
}
|
|
1959
|
+
catch (error) {
|
|
1960
|
+
throw new CliError(String(error), {
|
|
1961
|
+
code: 'INVALID_ARGS',
|
|
1962
|
+
exitCode: 2,
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
return {
|
|
1966
|
+
help: Boolean(values.help),
|
|
1967
|
+
json: Boolean(values.json),
|
|
1968
|
+
runId: typeof values['run-id'] === 'string' ? values['run-id'] : '',
|
|
1969
|
+
runDir: typeof values['run-dir'] === 'string' ? values['run-dir'] : null,
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
function parseProcessPublishBuildFlags(args) {
|
|
1973
|
+
let values;
|
|
1974
|
+
try {
|
|
1975
|
+
({ values } = parseArgs({
|
|
1976
|
+
args,
|
|
1977
|
+
allowPositionals: false,
|
|
1978
|
+
strict: true,
|
|
1979
|
+
options: {
|
|
1980
|
+
help: { type: 'boolean', short: 'h' },
|
|
1981
|
+
json: { type: 'boolean' },
|
|
1982
|
+
'run-id': { type: 'string' },
|
|
1983
|
+
'run-dir': { type: 'string' },
|
|
1984
|
+
},
|
|
1985
|
+
}));
|
|
1986
|
+
}
|
|
1987
|
+
catch (error) {
|
|
1988
|
+
throw new CliError(String(error), {
|
|
1989
|
+
code: 'INVALID_ARGS',
|
|
1990
|
+
exitCode: 2,
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1993
|
+
return {
|
|
1994
|
+
help: Boolean(values.help),
|
|
1995
|
+
json: Boolean(values.json),
|
|
1996
|
+
runId: typeof values['run-id'] === 'string' ? values['run-id'] : '',
|
|
1997
|
+
runDir: typeof values['run-dir'] === 'string' ? values['run-dir'] : null,
|
|
1998
|
+
};
|
|
1999
|
+
}
|
|
2000
|
+
function parseProcessBatchBuildFlags(args) {
|
|
2001
|
+
let values;
|
|
2002
|
+
try {
|
|
2003
|
+
({ values } = parseArgs({
|
|
2004
|
+
args,
|
|
2005
|
+
allowPositionals: false,
|
|
2006
|
+
strict: true,
|
|
2007
|
+
options: {
|
|
2008
|
+
help: { type: 'boolean', short: 'h' },
|
|
2009
|
+
json: { type: 'boolean' },
|
|
2010
|
+
input: { type: 'string' },
|
|
2011
|
+
'out-dir': { type: 'string' },
|
|
2012
|
+
},
|
|
2013
|
+
}));
|
|
2014
|
+
}
|
|
2015
|
+
catch (error) {
|
|
2016
|
+
throw new CliError(String(error), {
|
|
2017
|
+
code: 'INVALID_ARGS',
|
|
2018
|
+
exitCode: 2,
|
|
2019
|
+
});
|
|
2020
|
+
}
|
|
2021
|
+
return {
|
|
2022
|
+
help: Boolean(values.help),
|
|
2023
|
+
json: Boolean(values.json),
|
|
2024
|
+
inputPath: typeof values.input === 'string' ? values.input : '',
|
|
2025
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : null,
|
|
2026
|
+
};
|
|
2027
|
+
}
|
|
2028
|
+
function plannedCommand(command, subcommand) {
|
|
2029
|
+
const suffix = subcommand ? ` ${subcommand}` : '';
|
|
2030
|
+
return {
|
|
2031
|
+
exitCode: 2,
|
|
2032
|
+
stdout: '',
|
|
2033
|
+
stderr: `Command '${command}${suffix}' is part of the planned unified surface but is not implemented yet.\n`,
|
|
2034
|
+
};
|
|
2035
|
+
}
|
|
2036
|
+
function applyRemoteOverrides(env, overrides) {
|
|
2037
|
+
const runtimeEnv = readRuntimeEnv(env);
|
|
2038
|
+
return {
|
|
2039
|
+
...env,
|
|
2040
|
+
TIANGONG_LCA_API_BASE_URL: overrides.apiBaseUrl ?? runtimeEnv.apiBaseUrl ?? undefined,
|
|
2041
|
+
TIANGONG_LCA_API_KEY: overrides.apiKey ?? runtimeEnv.apiKey ?? undefined,
|
|
2042
|
+
TIANGONG_LCA_REGION: overrides.region ?? runtimeEnv.region,
|
|
2043
|
+
};
|
|
2044
|
+
}
|
|
2045
|
+
export async function executeCli(argv, deps) {
|
|
2046
|
+
try {
|
|
2047
|
+
const { flags, command, subcommand, commandArgs } = parseCommandLine(argv);
|
|
2048
|
+
const publishImpl = deps.runPublishImpl ?? runPublish;
|
|
2049
|
+
const validationImpl = deps.runValidationImpl ?? runValidation;
|
|
2050
|
+
const lifecyclemodelAutoBuildImpl = deps.runLifecyclemodelAutoBuildImpl ?? runLifecyclemodelAutoBuild;
|
|
2051
|
+
const lifecyclemodelBuildImpl = deps.runLifecyclemodelBuildResultingProcessImpl ?? runLifecyclemodelBuildResultingProcess;
|
|
2052
|
+
const lifecyclemodelPublishImpl = deps.runLifecyclemodelPublishResultingProcessImpl ?? runLifecyclemodelPublishResultingProcess;
|
|
2053
|
+
const lifecyclemodelValidateImpl = deps.runLifecyclemodelValidateBuildImpl ?? runLifecyclemodelValidateBuild;
|
|
2054
|
+
const lifecyclemodelPublishBuildImpl = deps.runLifecyclemodelPublishBuildImpl ?? runLifecyclemodelPublishBuild;
|
|
2055
|
+
const lifecyclemodelOrchestrateImpl = deps.runLifecyclemodelOrchestrateImpl ?? runLifecyclemodelOrchestrate;
|
|
2056
|
+
const processGetImpl = deps.runProcessGetImpl ?? runProcessGet;
|
|
2057
|
+
const processAutoBuildImpl = deps.runProcessAutoBuildImpl ?? runProcessAutoBuild;
|
|
2058
|
+
const processBatchBuildImpl = deps.runProcessBatchBuildImpl ?? runProcessBatchBuild;
|
|
2059
|
+
const processResumeBuildImpl = deps.runProcessResumeBuildImpl ?? runProcessResumeBuild;
|
|
2060
|
+
const processPublishBuildImpl = deps.runProcessPublishBuildImpl ?? runProcessPublishBuild;
|
|
2061
|
+
const processReviewImpl = deps.runProcessReviewImpl ?? runProcessReview;
|
|
2062
|
+
const flowReviewImpl = deps.runFlowReviewImpl ?? runFlowReview;
|
|
2063
|
+
const lifecyclemodelReviewImpl = deps.runLifecyclemodelReviewImpl ?? runLifecyclemodelReview;
|
|
2064
|
+
const flowRemediateImpl = deps.runFlowRemediateImpl ?? runFlowRemediate;
|
|
2065
|
+
const flowGetImpl = deps.runFlowGetImpl ?? runFlowGet;
|
|
2066
|
+
const flowListImpl = deps.runFlowListImpl ?? runFlowList;
|
|
2067
|
+
const flowPublishVersionImpl = deps.runFlowPublishVersionImpl ?? runFlowPublishVersion;
|
|
2068
|
+
const flowReviewedPublishDataImpl = deps.runFlowReviewedPublishDataImpl ?? runFlowReviewedPublishData;
|
|
2069
|
+
const flowBuildAliasMapImpl = deps.runFlowBuildAliasMapImpl ?? runFlowBuildAliasMap;
|
|
2070
|
+
const flowScanProcessFlowRefsImpl = deps.runFlowScanProcessFlowRefsImpl ?? runFlowScanProcessFlowRefs;
|
|
2071
|
+
const flowPlanProcessFlowRepairsImpl = deps.runFlowPlanProcessFlowRepairsImpl ?? runFlowPlanProcessFlowRepairs;
|
|
2072
|
+
const flowApplyProcessFlowRepairsImpl = deps.runFlowApplyProcessFlowRepairsImpl ?? runFlowApplyProcessFlowRepairs;
|
|
2073
|
+
const flowRegenProductImpl = deps.runFlowRegenProductImpl ?? runFlowRegenProduct;
|
|
2074
|
+
const flowValidateProcessesImpl = deps.runFlowValidateProcessesImpl ?? runFlowValidateProcesses;
|
|
2075
|
+
if (flags.version) {
|
|
2076
|
+
return { exitCode: 0, stdout: '0.0.1\n', stderr: '' };
|
|
2077
|
+
}
|
|
2078
|
+
if (!command || command === 'help' || flags.help) {
|
|
2079
|
+
return { exitCode: 0, stdout: `${renderMainHelp(deps.dotEnvStatus)}\n`, stderr: '' };
|
|
2080
|
+
}
|
|
2081
|
+
if (command === 'doctor') {
|
|
2082
|
+
const doctorFlags = parseDoctorFlags(commandArgs);
|
|
2083
|
+
if (doctorFlags.help) {
|
|
2084
|
+
return { exitCode: 0, stdout: `${renderDoctorHelp()}\n`, stderr: '' };
|
|
2085
|
+
}
|
|
2086
|
+
const report = buildDoctorReport(deps.env, deps.dotEnvStatus);
|
|
2087
|
+
return {
|
|
2088
|
+
exitCode: report.ok ? 0 : 1,
|
|
2089
|
+
stdout: doctorFlags.json ? `${JSON.stringify(report)}\n` : renderDoctorText(report),
|
|
2090
|
+
stderr: '',
|
|
2091
|
+
};
|
|
2092
|
+
}
|
|
2093
|
+
if (command === 'search' && !subcommand && commandArgs.includes('--help')) {
|
|
2094
|
+
return { exitCode: 0, stdout: `${renderSearchHelp()}\n`, stderr: '' };
|
|
2095
|
+
}
|
|
2096
|
+
if (command === 'search' && subcommand) {
|
|
2097
|
+
const remoteFlags = parseRemoteFlags(commandArgs);
|
|
2098
|
+
const commandKey = `search:${subcommand}`;
|
|
2099
|
+
if (remoteFlags.help) {
|
|
2100
|
+
return { exitCode: 0, stdout: `${getRemoteCommandHelp(commandKey)}\n`, stderr: '' };
|
|
2101
|
+
}
|
|
2102
|
+
const env = applyRemoteOverrides(deps.env, remoteFlags);
|
|
2103
|
+
return {
|
|
2104
|
+
exitCode: 0,
|
|
2105
|
+
stdout: await executeRemoteCommand({
|
|
2106
|
+
commandKey,
|
|
2107
|
+
inputPath: remoteFlags.inputPath,
|
|
2108
|
+
env,
|
|
2109
|
+
timeoutMs: remoteFlags.timeoutMs,
|
|
2110
|
+
dryRun: remoteFlags.dryRun,
|
|
2111
|
+
compactJson: remoteFlags.json,
|
|
2112
|
+
fetchImpl: deps.fetchImpl,
|
|
2113
|
+
}),
|
|
2114
|
+
stderr: '',
|
|
2115
|
+
};
|
|
2116
|
+
}
|
|
2117
|
+
if (command === 'lifecyclemodel' && !subcommand) {
|
|
2118
|
+
return { exitCode: 0, stdout: `${renderLifecyclemodelHelp()}\n`, stderr: '' };
|
|
2119
|
+
}
|
|
2120
|
+
if (command === 'lifecyclemodel' && subcommand === 'auto-build') {
|
|
2121
|
+
const lifecyclemodelFlags = parseLifecyclemodelBuildFlags(commandArgs);
|
|
2122
|
+
if (lifecyclemodelFlags.help) {
|
|
2123
|
+
return {
|
|
2124
|
+
exitCode: 0,
|
|
2125
|
+
stdout: `${renderLifecyclemodelAutoBuildHelp()}\n`,
|
|
2126
|
+
stderr: '',
|
|
2127
|
+
};
|
|
2128
|
+
}
|
|
2129
|
+
const report = await lifecyclemodelAutoBuildImpl({
|
|
2130
|
+
inputPath: lifecyclemodelFlags.inputPath,
|
|
2131
|
+
outDir: lifecyclemodelFlags.outDir,
|
|
2132
|
+
cwd: process.cwd(),
|
|
2133
|
+
});
|
|
2134
|
+
return {
|
|
2135
|
+
exitCode: 0,
|
|
2136
|
+
stdout: stringifyJson(report, lifecyclemodelFlags.json),
|
|
2137
|
+
stderr: '',
|
|
2138
|
+
};
|
|
2139
|
+
}
|
|
2140
|
+
if (command === 'lifecyclemodel' && subcommand === 'build-resulting-process') {
|
|
2141
|
+
const lifecyclemodelFlags = parseLifecyclemodelBuildFlags(commandArgs);
|
|
2142
|
+
if (lifecyclemodelFlags.help) {
|
|
2143
|
+
return {
|
|
2144
|
+
exitCode: 0,
|
|
2145
|
+
stdout: `${renderLifecyclemodelBuildResultingProcessHelp()}\n`,
|
|
2146
|
+
stderr: '',
|
|
2147
|
+
};
|
|
2148
|
+
}
|
|
2149
|
+
const report = await lifecyclemodelBuildImpl({
|
|
2150
|
+
inputPath: lifecyclemodelFlags.inputPath,
|
|
2151
|
+
outDir: lifecyclemodelFlags.outDir,
|
|
2152
|
+
env: deps.env,
|
|
2153
|
+
fetchImpl: deps.fetchImpl,
|
|
2154
|
+
});
|
|
2155
|
+
return {
|
|
2156
|
+
exitCode: 0,
|
|
2157
|
+
stdout: stringifyJson(report, lifecyclemodelFlags.json),
|
|
2158
|
+
stderr: '',
|
|
2159
|
+
};
|
|
2160
|
+
}
|
|
2161
|
+
if (command === 'lifecyclemodel' && subcommand === 'publish-resulting-process') {
|
|
2162
|
+
const lifecyclemodelFlags = parseLifecyclemodelPublishFlags(commandArgs);
|
|
2163
|
+
if (lifecyclemodelFlags.help) {
|
|
2164
|
+
return {
|
|
2165
|
+
exitCode: 0,
|
|
2166
|
+
stdout: `${renderLifecyclemodelPublishResultingProcessHelp()}\n`,
|
|
2167
|
+
stderr: '',
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2170
|
+
const report = await lifecyclemodelPublishImpl({
|
|
2171
|
+
runDir: lifecyclemodelFlags.runDir,
|
|
2172
|
+
publishProcesses: lifecyclemodelFlags.publishProcesses,
|
|
2173
|
+
publishRelations: lifecyclemodelFlags.publishRelations,
|
|
2174
|
+
});
|
|
2175
|
+
return {
|
|
2176
|
+
exitCode: 0,
|
|
2177
|
+
stdout: stringifyJson(report, lifecyclemodelFlags.json),
|
|
2178
|
+
stderr: '',
|
|
2179
|
+
};
|
|
2180
|
+
}
|
|
2181
|
+
if (command === 'lifecyclemodel' && subcommand === 'validate-build') {
|
|
2182
|
+
const lifecyclemodelFlags = parseLifecyclemodelValidateBuildFlags(commandArgs);
|
|
2183
|
+
if (lifecyclemodelFlags.help) {
|
|
2184
|
+
return {
|
|
2185
|
+
exitCode: 0,
|
|
2186
|
+
stdout: `${renderLifecyclemodelValidateBuildHelp()}\n`,
|
|
2187
|
+
stderr: '',
|
|
2188
|
+
};
|
|
2189
|
+
}
|
|
2190
|
+
const report = await lifecyclemodelValidateImpl({
|
|
2191
|
+
runDir: lifecyclemodelFlags.runDir,
|
|
2192
|
+
engine: lifecyclemodelFlags.engine,
|
|
2193
|
+
cwd: process.cwd(),
|
|
2194
|
+
});
|
|
2195
|
+
return {
|
|
2196
|
+
exitCode: report.ok ? 0 : 1,
|
|
2197
|
+
stdout: stringifyJson(report, lifecyclemodelFlags.json),
|
|
2198
|
+
stderr: '',
|
|
2199
|
+
};
|
|
2200
|
+
}
|
|
2201
|
+
if (command === 'lifecyclemodel' && subcommand === 'publish-build') {
|
|
2202
|
+
const lifecyclemodelFlags = parseLifecyclemodelPublishBuildFlags(commandArgs);
|
|
2203
|
+
if (lifecyclemodelFlags.help) {
|
|
2204
|
+
return {
|
|
2205
|
+
exitCode: 0,
|
|
2206
|
+
stdout: `${renderLifecyclemodelPublishBuildHelp()}\n`,
|
|
2207
|
+
stderr: '',
|
|
2208
|
+
};
|
|
2209
|
+
}
|
|
2210
|
+
const report = await lifecyclemodelPublishBuildImpl({
|
|
2211
|
+
runDir: lifecyclemodelFlags.runDir,
|
|
2212
|
+
cwd: process.cwd(),
|
|
2213
|
+
});
|
|
2214
|
+
return {
|
|
2215
|
+
exitCode: 0,
|
|
2216
|
+
stdout: stringifyJson(report, lifecyclemodelFlags.json),
|
|
2217
|
+
stderr: '',
|
|
2218
|
+
};
|
|
2219
|
+
}
|
|
2220
|
+
if (command === 'lifecyclemodel' && subcommand === 'orchestrate') {
|
|
2221
|
+
const lifecyclemodelFlags = parseLifecyclemodelOrchestrateFlags(commandArgs);
|
|
2222
|
+
if (lifecyclemodelFlags.help || !lifecyclemodelFlags.action) {
|
|
2223
|
+
return {
|
|
2224
|
+
exitCode: 0,
|
|
2225
|
+
stdout: `${renderLifecyclemodelOrchestrateHelp()}\n`,
|
|
2226
|
+
stderr: '',
|
|
2227
|
+
};
|
|
2228
|
+
}
|
|
2229
|
+
if (lifecyclemodelFlags.action !== 'plan' &&
|
|
2230
|
+
lifecyclemodelFlags.action !== 'execute' &&
|
|
2231
|
+
lifecyclemodelFlags.action !== 'publish') {
|
|
2232
|
+
throw new CliError("lifecyclemodel orchestrate action must be 'plan', 'execute', or 'publish'.", {
|
|
2233
|
+
code: 'INVALID_ARGS',
|
|
2234
|
+
exitCode: 2,
|
|
2235
|
+
});
|
|
2236
|
+
}
|
|
2237
|
+
const report = await lifecyclemodelOrchestrateImpl({
|
|
2238
|
+
action: lifecyclemodelFlags.action,
|
|
2239
|
+
inputPath: lifecyclemodelFlags.inputPath,
|
|
2240
|
+
outDir: lifecyclemodelFlags.outDir,
|
|
2241
|
+
runDir: lifecyclemodelFlags.runDir,
|
|
2242
|
+
allowProcessBuild: lifecyclemodelFlags.allowProcessBuild,
|
|
2243
|
+
allowSubmodelBuild: lifecyclemodelFlags.allowSubmodelBuild,
|
|
2244
|
+
publishLifecyclemodels: lifecyclemodelFlags.publishLifecyclemodels,
|
|
2245
|
+
publishResultingProcessRelations: lifecyclemodelFlags.publishResultingProcessRelations,
|
|
2246
|
+
env: deps.env,
|
|
2247
|
+
fetchImpl: deps.fetchImpl,
|
|
2248
|
+
});
|
|
2249
|
+
return {
|
|
2250
|
+
exitCode: report.action === 'execute' && report.status !== 'completed' ? 1 : 0,
|
|
2251
|
+
stdout: stringifyJson(report, lifecyclemodelFlags.json),
|
|
2252
|
+
stderr: '',
|
|
2253
|
+
};
|
|
2254
|
+
}
|
|
2255
|
+
if (command === 'process' && !subcommand) {
|
|
2256
|
+
return { exitCode: 0, stdout: `${renderProcessHelp()}\n`, stderr: '' };
|
|
2257
|
+
}
|
|
2258
|
+
if (command === 'process' && subcommand === 'get') {
|
|
2259
|
+
const processFlags = parseProcessGetFlags(commandArgs);
|
|
2260
|
+
if (processFlags.help) {
|
|
2261
|
+
return {
|
|
2262
|
+
exitCode: 0,
|
|
2263
|
+
stdout: `${renderProcessGetHelp()}\n`,
|
|
2264
|
+
stderr: '',
|
|
2265
|
+
};
|
|
2266
|
+
}
|
|
2267
|
+
const report = await processGetImpl({
|
|
2268
|
+
processId: processFlags.processId,
|
|
2269
|
+
version: processFlags.version,
|
|
2270
|
+
env: deps.env,
|
|
2271
|
+
fetchImpl: deps.fetchImpl,
|
|
2272
|
+
});
|
|
2273
|
+
return {
|
|
2274
|
+
exitCode: 0,
|
|
2275
|
+
stdout: stringifyJson(report, processFlags.json),
|
|
2276
|
+
stderr: '',
|
|
2277
|
+
};
|
|
2278
|
+
}
|
|
2279
|
+
if (command === 'process' && subcommand === 'auto-build') {
|
|
2280
|
+
const processFlags = parseProcessAutoBuildFlags(commandArgs);
|
|
2281
|
+
if (processFlags.help) {
|
|
2282
|
+
return {
|
|
2283
|
+
exitCode: 0,
|
|
2284
|
+
stdout: `${renderProcessAutoBuildHelp()}\n`,
|
|
2285
|
+
stderr: '',
|
|
2286
|
+
};
|
|
2287
|
+
}
|
|
2288
|
+
const report = await processAutoBuildImpl({
|
|
2289
|
+
inputPath: processFlags.inputPath,
|
|
2290
|
+
outDir: processFlags.outDir,
|
|
2291
|
+
});
|
|
2292
|
+
return {
|
|
2293
|
+
exitCode: 0,
|
|
2294
|
+
stdout: stringifyJson(report, processFlags.json),
|
|
2295
|
+
stderr: '',
|
|
2296
|
+
};
|
|
2297
|
+
}
|
|
2298
|
+
if (command === 'process' && subcommand === 'resume-build') {
|
|
2299
|
+
const processFlags = parseProcessResumeBuildFlags(commandArgs);
|
|
2300
|
+
if (processFlags.help) {
|
|
2301
|
+
return {
|
|
2302
|
+
exitCode: 0,
|
|
2303
|
+
stdout: `${renderProcessResumeBuildHelp()}\n`,
|
|
2304
|
+
stderr: '',
|
|
2305
|
+
};
|
|
2306
|
+
}
|
|
2307
|
+
const report = await processResumeBuildImpl({
|
|
2308
|
+
runId: processFlags.runId || undefined,
|
|
2309
|
+
runDir: processFlags.runDir,
|
|
2310
|
+
});
|
|
2311
|
+
return {
|
|
2312
|
+
exitCode: 0,
|
|
2313
|
+
stdout: stringifyJson(report, processFlags.json),
|
|
2314
|
+
stderr: '',
|
|
2315
|
+
};
|
|
2316
|
+
}
|
|
2317
|
+
if (command === 'process' && subcommand === 'publish-build') {
|
|
2318
|
+
const processFlags = parseProcessPublishBuildFlags(commandArgs);
|
|
2319
|
+
if (processFlags.help) {
|
|
2320
|
+
return {
|
|
2321
|
+
exitCode: 0,
|
|
2322
|
+
stdout: `${renderProcessPublishBuildHelp()}\n`,
|
|
2323
|
+
stderr: '',
|
|
2324
|
+
};
|
|
2325
|
+
}
|
|
2326
|
+
const report = await processPublishBuildImpl({
|
|
2327
|
+
runId: processFlags.runId || undefined,
|
|
2328
|
+
runDir: processFlags.runDir,
|
|
2329
|
+
});
|
|
2330
|
+
return {
|
|
2331
|
+
exitCode: 0,
|
|
2332
|
+
stdout: stringifyJson(report, processFlags.json),
|
|
2333
|
+
stderr: '',
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
2336
|
+
if (command === 'process' && subcommand === 'batch-build') {
|
|
2337
|
+
const processFlags = parseProcessBatchBuildFlags(commandArgs);
|
|
2338
|
+
if (processFlags.help) {
|
|
2339
|
+
return {
|
|
2340
|
+
exitCode: 0,
|
|
2341
|
+
stdout: `${renderProcessBatchBuildHelp()}\n`,
|
|
2342
|
+
stderr: '',
|
|
2343
|
+
};
|
|
2344
|
+
}
|
|
2345
|
+
const report = await processBatchBuildImpl({
|
|
2346
|
+
inputPath: processFlags.inputPath,
|
|
2347
|
+
outDir: processFlags.outDir,
|
|
2348
|
+
});
|
|
2349
|
+
return {
|
|
2350
|
+
exitCode: report.status === 'completed_with_failures' ? 1 : 0,
|
|
2351
|
+
stdout: stringifyJson(report, processFlags.json),
|
|
2352
|
+
stderr: '',
|
|
2353
|
+
};
|
|
2354
|
+
}
|
|
2355
|
+
if (command === 'flow' && !subcommand) {
|
|
2356
|
+
return { exitCode: 0, stdout: `${renderFlowHelp()}\n`, stderr: '' };
|
|
2357
|
+
}
|
|
2358
|
+
if (command === 'flow' && subcommand === 'get') {
|
|
2359
|
+
const flowFlags = parseFlowGetFlags(commandArgs);
|
|
2360
|
+
if (flowFlags.help) {
|
|
2361
|
+
return { exitCode: 0, stdout: `${renderFlowGetHelp()}\n`, stderr: '' };
|
|
2362
|
+
}
|
|
2363
|
+
const report = await flowGetImpl({
|
|
2364
|
+
flowId: flowFlags.flowId,
|
|
2365
|
+
version: flowFlags.version,
|
|
2366
|
+
userId: flowFlags.userId,
|
|
2367
|
+
stateCode: flowFlags.stateCode,
|
|
2368
|
+
env: deps.env,
|
|
2369
|
+
fetchImpl: deps.fetchImpl,
|
|
2370
|
+
});
|
|
2371
|
+
return {
|
|
2372
|
+
exitCode: 0,
|
|
2373
|
+
stdout: stringifyJson(report, flowFlags.json),
|
|
2374
|
+
stderr: '',
|
|
2375
|
+
};
|
|
2376
|
+
}
|
|
2377
|
+
if (command === 'flow' && subcommand === 'list') {
|
|
2378
|
+
const flowFlags = parseFlowListFlags(commandArgs);
|
|
2379
|
+
if (flowFlags.help) {
|
|
2380
|
+
return { exitCode: 0, stdout: `${renderFlowListHelp()}\n`, stderr: '' };
|
|
2381
|
+
}
|
|
2382
|
+
const report = await flowListImpl({
|
|
2383
|
+
ids: flowFlags.ids,
|
|
2384
|
+
version: flowFlags.version,
|
|
2385
|
+
userId: flowFlags.userId,
|
|
2386
|
+
stateCodes: flowFlags.stateCodes,
|
|
2387
|
+
typeOfDataset: flowFlags.typeOfDataset,
|
|
2388
|
+
limit: flowFlags.limit,
|
|
2389
|
+
offset: flowFlags.offset,
|
|
2390
|
+
all: flowFlags.all,
|
|
2391
|
+
pageSize: flowFlags.pageSize,
|
|
2392
|
+
order: flowFlags.order,
|
|
2393
|
+
env: deps.env,
|
|
2394
|
+
fetchImpl: deps.fetchImpl,
|
|
2395
|
+
});
|
|
2396
|
+
return {
|
|
2397
|
+
exitCode: 0,
|
|
2398
|
+
stdout: stringifyJson(report, flowFlags.json),
|
|
2399
|
+
stderr: '',
|
|
2400
|
+
};
|
|
2401
|
+
}
|
|
2402
|
+
if (command === 'flow' && subcommand === 'remediate') {
|
|
2403
|
+
const flowFlags = parseFlowRemediateFlags(commandArgs);
|
|
2404
|
+
if (flowFlags.help) {
|
|
2405
|
+
return { exitCode: 0, stdout: `${renderFlowRemediateHelp()}\n`, stderr: '' };
|
|
2406
|
+
}
|
|
2407
|
+
const report = await flowRemediateImpl({
|
|
2408
|
+
inputFile: flowFlags.inputFile,
|
|
2409
|
+
outDir: flowFlags.outDir,
|
|
2410
|
+
});
|
|
2411
|
+
return {
|
|
2412
|
+
exitCode: 0,
|
|
2413
|
+
stdout: stringifyJson(report, flowFlags.json),
|
|
2414
|
+
stderr: '',
|
|
2415
|
+
};
|
|
2416
|
+
}
|
|
2417
|
+
if (command === 'flow' && subcommand === 'publish-version') {
|
|
2418
|
+
const flowFlags = parseFlowPublishVersionFlags(commandArgs);
|
|
2419
|
+
if (flowFlags.help) {
|
|
2420
|
+
return { exitCode: 0, stdout: `${renderFlowPublishVersionHelp()}\n`, stderr: '' };
|
|
2421
|
+
}
|
|
2422
|
+
const report = await flowPublishVersionImpl({
|
|
2423
|
+
inputFile: flowFlags.inputFile,
|
|
2424
|
+
outDir: flowFlags.outDir,
|
|
2425
|
+
commit: flowFlags.commit,
|
|
2426
|
+
maxWorkers: flowFlags.maxWorkers,
|
|
2427
|
+
limit: flowFlags.limit,
|
|
2428
|
+
targetUserId: flowFlags.targetUserId,
|
|
2429
|
+
env: deps.env,
|
|
2430
|
+
fetchImpl: deps.fetchImpl,
|
|
2431
|
+
});
|
|
2432
|
+
return {
|
|
2433
|
+
exitCode: report.status === 'completed_flow_publish_version_with_failures' ? 1 : 0,
|
|
2434
|
+
stdout: stringifyJson(report, flowFlags.json),
|
|
2435
|
+
stderr: '',
|
|
2436
|
+
};
|
|
2437
|
+
}
|
|
2438
|
+
if (command === 'flow' && subcommand === 'publish-reviewed-data') {
|
|
2439
|
+
const flowFlags = parseFlowPublishReviewedDataFlags(commandArgs);
|
|
2440
|
+
if (flowFlags.help) {
|
|
2441
|
+
return { exitCode: 0, stdout: `${renderFlowPublishReviewedDataHelp()}\n`, stderr: '' };
|
|
2442
|
+
}
|
|
2443
|
+
const report = await flowReviewedPublishDataImpl({
|
|
2444
|
+
flowRowsFile: flowFlags.flowRowsFile,
|
|
2445
|
+
originalFlowRowsFile: flowFlags.originalFlowRowsFile,
|
|
2446
|
+
processRowsFile: flowFlags.processRowsFile,
|
|
2447
|
+
outDir: flowFlags.outDir,
|
|
2448
|
+
flowPublishPolicy: flowFlags.flowPublishPolicy,
|
|
2449
|
+
processPublishPolicy: flowFlags.processPublishPolicy,
|
|
2450
|
+
rewriteProcessFlowRefs: flowFlags.rewriteProcessFlowRefs,
|
|
2451
|
+
commit: flowFlags.commit,
|
|
2452
|
+
maxWorkers: flowFlags.maxWorkers,
|
|
2453
|
+
targetUserId: flowFlags.targetUserId,
|
|
2454
|
+
env: deps.env,
|
|
2455
|
+
fetchImpl: deps.fetchImpl,
|
|
2456
|
+
});
|
|
2457
|
+
return {
|
|
2458
|
+
exitCode: report.status === 'completed_flow_publish_reviewed_data_with_failures' ? 1 : 0,
|
|
2459
|
+
stdout: stringifyJson(report, flowFlags.json),
|
|
2460
|
+
stderr: '',
|
|
2461
|
+
};
|
|
2462
|
+
}
|
|
2463
|
+
if (command === 'flow' && subcommand === 'build-alias-map') {
|
|
2464
|
+
const flowFlags = parseFlowBuildAliasMapFlags(commandArgs);
|
|
2465
|
+
if (flowFlags.help) {
|
|
2466
|
+
return { exitCode: 0, stdout: `${renderFlowBuildAliasMapHelp()}\n`, stderr: '' };
|
|
2467
|
+
}
|
|
2468
|
+
const report = await flowBuildAliasMapImpl({
|
|
2469
|
+
oldFlowFiles: flowFlags.oldFlowFiles,
|
|
2470
|
+
newFlowFiles: flowFlags.newFlowFiles,
|
|
2471
|
+
seedAliasMapFile: flowFlags.seedAliasMapFile,
|
|
2472
|
+
outDir: flowFlags.outDir,
|
|
2473
|
+
});
|
|
2474
|
+
return {
|
|
2475
|
+
exitCode: 0,
|
|
2476
|
+
stdout: stringifyJson(report, flowFlags.json),
|
|
2477
|
+
stderr: '',
|
|
2478
|
+
};
|
|
2479
|
+
}
|
|
2480
|
+
if (command === 'flow' && subcommand === 'scan-process-flow-refs') {
|
|
2481
|
+
const flowFlags = parseFlowScanProcessFlowRefsFlags(commandArgs);
|
|
2482
|
+
if (flowFlags.help) {
|
|
2483
|
+
return { exitCode: 0, stdout: `${renderFlowScanProcessFlowRefsHelp()}\n`, stderr: '' };
|
|
2484
|
+
}
|
|
2485
|
+
const report = await flowScanProcessFlowRefsImpl({
|
|
2486
|
+
processesFile: flowFlags.processesFile,
|
|
2487
|
+
scopeFlowFiles: flowFlags.scopeFlowFiles,
|
|
2488
|
+
catalogFlowFiles: flowFlags.catalogFlowFiles,
|
|
2489
|
+
aliasMapFile: flowFlags.aliasMapFile,
|
|
2490
|
+
excludeEmergy: flowFlags.excludeEmergy,
|
|
2491
|
+
outDir: flowFlags.outDir,
|
|
2492
|
+
});
|
|
2493
|
+
return {
|
|
2494
|
+
exitCode: 0,
|
|
2495
|
+
stdout: stringifyJson(report, flowFlags.json),
|
|
2496
|
+
stderr: '',
|
|
2497
|
+
};
|
|
2498
|
+
}
|
|
2499
|
+
if (command === 'flow' && subcommand === 'plan-process-flow-repairs') {
|
|
2500
|
+
const flowFlags = parseFlowPlanProcessFlowRepairsFlags(commandArgs);
|
|
2501
|
+
if (flowFlags.help) {
|
|
2502
|
+
return {
|
|
2503
|
+
exitCode: 0,
|
|
2504
|
+
stdout: `${renderFlowPlanProcessFlowRepairsHelp()}\n`,
|
|
2505
|
+
stderr: '',
|
|
2506
|
+
};
|
|
2507
|
+
}
|
|
2508
|
+
const report = await flowPlanProcessFlowRepairsImpl({
|
|
2509
|
+
processesFile: flowFlags.processesFile,
|
|
2510
|
+
scopeFlowFiles: flowFlags.scopeFlowFiles,
|
|
2511
|
+
aliasMapFile: flowFlags.aliasMapFile,
|
|
2512
|
+
scanFindingsFile: flowFlags.scanFindingsFile,
|
|
2513
|
+
autoPatchPolicy: flowFlags.autoPatchPolicy,
|
|
2514
|
+
outDir: flowFlags.outDir,
|
|
2515
|
+
});
|
|
2516
|
+
return {
|
|
2517
|
+
exitCode: 0,
|
|
2518
|
+
stdout: stringifyJson(report, flowFlags.json),
|
|
2519
|
+
stderr: '',
|
|
2520
|
+
};
|
|
2521
|
+
}
|
|
2522
|
+
if (command === 'flow' && subcommand === 'apply-process-flow-repairs') {
|
|
2523
|
+
const flowFlags = parseFlowApplyProcessFlowRepairsFlags(commandArgs);
|
|
2524
|
+
if (flowFlags.help) {
|
|
2525
|
+
return {
|
|
2526
|
+
exitCode: 0,
|
|
2527
|
+
stdout: `${renderFlowApplyProcessFlowRepairsHelp()}\n`,
|
|
2528
|
+
stderr: '',
|
|
2529
|
+
};
|
|
2530
|
+
}
|
|
2531
|
+
const report = await flowApplyProcessFlowRepairsImpl({
|
|
2532
|
+
processesFile: flowFlags.processesFile,
|
|
2533
|
+
scopeFlowFiles: flowFlags.scopeFlowFiles,
|
|
2534
|
+
aliasMapFile: flowFlags.aliasMapFile,
|
|
2535
|
+
scanFindingsFile: flowFlags.scanFindingsFile,
|
|
2536
|
+
autoPatchPolicy: flowFlags.autoPatchPolicy,
|
|
2537
|
+
processPoolFile: flowFlags.processPoolFile,
|
|
2538
|
+
outDir: flowFlags.outDir,
|
|
2539
|
+
});
|
|
2540
|
+
return {
|
|
2541
|
+
exitCode: 0,
|
|
2542
|
+
stdout: stringifyJson(report, flowFlags.json),
|
|
2543
|
+
stderr: '',
|
|
2544
|
+
};
|
|
2545
|
+
}
|
|
2546
|
+
if (command === 'flow' && subcommand === 'regen-product') {
|
|
2547
|
+
const flowFlags = parseFlowRegenProductFlags(commandArgs);
|
|
2548
|
+
if (flowFlags.help) {
|
|
2549
|
+
return { exitCode: 0, stdout: `${renderFlowRegenProductHelp()}\n`, stderr: '' };
|
|
2550
|
+
}
|
|
2551
|
+
const report = await flowRegenProductImpl({
|
|
2552
|
+
processesFile: flowFlags.processesFile,
|
|
2553
|
+
scopeFlowFiles: flowFlags.scopeFlowFiles,
|
|
2554
|
+
catalogFlowFiles: flowFlags.catalogFlowFiles,
|
|
2555
|
+
aliasMapFile: flowFlags.aliasMapFile,
|
|
2556
|
+
excludeEmergy: flowFlags.excludeEmergy,
|
|
2557
|
+
autoPatchPolicy: flowFlags.autoPatchPolicy,
|
|
2558
|
+
apply: flowFlags.apply,
|
|
2559
|
+
processPoolFile: flowFlags.processPoolFile,
|
|
2560
|
+
tidasMode: flowFlags.tidasMode,
|
|
2561
|
+
outDir: flowFlags.outDir,
|
|
2562
|
+
});
|
|
2563
|
+
return {
|
|
2564
|
+
exitCode: report.validation.ok === false ? 1 : 0,
|
|
2565
|
+
stdout: stringifyJson(report, flowFlags.json),
|
|
2566
|
+
stderr: '',
|
|
2567
|
+
};
|
|
2568
|
+
}
|
|
2569
|
+
if (command === 'flow' && subcommand === 'validate-processes') {
|
|
2570
|
+
const flowFlags = parseFlowValidateProcessesFlags(commandArgs);
|
|
2571
|
+
if (flowFlags.help) {
|
|
2572
|
+
return { exitCode: 0, stdout: `${renderFlowValidateProcessesHelp()}\n`, stderr: '' };
|
|
2573
|
+
}
|
|
2574
|
+
const report = await flowValidateProcessesImpl({
|
|
2575
|
+
originalProcessesFile: flowFlags.originalProcessesFile,
|
|
2576
|
+
patchedProcessesFile: flowFlags.patchedProcessesFile,
|
|
2577
|
+
scopeFlowFiles: flowFlags.scopeFlowFiles,
|
|
2578
|
+
tidasMode: flowFlags.tidasMode,
|
|
2579
|
+
outDir: flowFlags.outDir,
|
|
2580
|
+
});
|
|
2581
|
+
return {
|
|
2582
|
+
exitCode: report.summary.failed > 0 ? 1 : 0,
|
|
2583
|
+
stdout: stringifyJson(report, flowFlags.json),
|
|
2584
|
+
stderr: '',
|
|
2585
|
+
};
|
|
2586
|
+
}
|
|
2587
|
+
if (command === 'admin' && !subcommand && commandArgs.includes('--help')) {
|
|
2588
|
+
return { exitCode: 0, stdout: `${renderAdminHelp()}\n`, stderr: '' };
|
|
2589
|
+
}
|
|
2590
|
+
if (command === 'admin' && subcommand === 'embedding-run') {
|
|
2591
|
+
const remoteFlags = parseRemoteFlags(commandArgs);
|
|
2592
|
+
if (remoteFlags.help) {
|
|
2593
|
+
return {
|
|
2594
|
+
exitCode: 0,
|
|
2595
|
+
stdout: `${getRemoteCommandHelp('admin:embedding-run')}\n`,
|
|
2596
|
+
stderr: '',
|
|
2597
|
+
};
|
|
2598
|
+
}
|
|
2599
|
+
const env = applyRemoteOverrides(deps.env, remoteFlags);
|
|
2600
|
+
return {
|
|
2601
|
+
exitCode: 0,
|
|
2602
|
+
stdout: await executeRemoteCommand({
|
|
2603
|
+
commandKey: 'admin:embedding-run',
|
|
2604
|
+
inputPath: remoteFlags.inputPath,
|
|
2605
|
+
env,
|
|
2606
|
+
timeoutMs: remoteFlags.timeoutMs,
|
|
2607
|
+
dryRun: remoteFlags.dryRun,
|
|
2608
|
+
compactJson: remoteFlags.json,
|
|
2609
|
+
fetchImpl: deps.fetchImpl,
|
|
2610
|
+
}),
|
|
2611
|
+
stderr: '',
|
|
2612
|
+
};
|
|
2613
|
+
}
|
|
2614
|
+
if (command === 'publish' && !subcommand && commandArgs.includes('--help')) {
|
|
2615
|
+
return { exitCode: 0, stdout: `${renderPublishHelp()}\n`, stderr: '' };
|
|
2616
|
+
}
|
|
2617
|
+
if (command === 'publish' && subcommand === 'run') {
|
|
2618
|
+
const publishFlags = parsePublishFlags(commandArgs);
|
|
2619
|
+
if (publishFlags.help) {
|
|
2620
|
+
return { exitCode: 0, stdout: `${renderPublishHelp()}\n`, stderr: '' };
|
|
2621
|
+
}
|
|
2622
|
+
const report = await publishImpl({
|
|
2623
|
+
inputPath: publishFlags.inputPath,
|
|
2624
|
+
outDir: publishFlags.outDir,
|
|
2625
|
+
commit: publishFlags.commitOverride,
|
|
2626
|
+
env: deps.env,
|
|
2627
|
+
fetchImpl: deps.fetchImpl,
|
|
2628
|
+
});
|
|
2629
|
+
return {
|
|
2630
|
+
exitCode: report.status === 'completed_with_failures' ? 1 : 0,
|
|
2631
|
+
stdout: stringifyJson(report, publishFlags.json),
|
|
2632
|
+
stderr: '',
|
|
2633
|
+
};
|
|
2634
|
+
}
|
|
2635
|
+
if (command === 'validation' && !subcommand && commandArgs.includes('--help')) {
|
|
2636
|
+
return { exitCode: 0, stdout: `${renderValidationHelp()}\n`, stderr: '' };
|
|
2637
|
+
}
|
|
2638
|
+
if (command === 'validation' && subcommand === 'run') {
|
|
2639
|
+
const validationFlags = parseValidationFlags(commandArgs);
|
|
2640
|
+
if (validationFlags.help) {
|
|
2641
|
+
return { exitCode: 0, stdout: `${renderValidationHelp()}\n`, stderr: '' };
|
|
2642
|
+
}
|
|
2643
|
+
const report = await validationImpl({
|
|
2644
|
+
inputDir: validationFlags.inputDir,
|
|
2645
|
+
engine: validationFlags.engine,
|
|
2646
|
+
reportFile: validationFlags.reportFile,
|
|
2647
|
+
});
|
|
2648
|
+
return {
|
|
2649
|
+
exitCode: report.ok ? 0 : 1,
|
|
2650
|
+
stdout: stringifyJson(report, validationFlags.json),
|
|
2651
|
+
stderr: '',
|
|
2652
|
+
};
|
|
2653
|
+
}
|
|
2654
|
+
if (command === 'review' && !subcommand) {
|
|
2655
|
+
return { exitCode: 0, stdout: `${renderReviewHelp()}\n`, stderr: '' };
|
|
2656
|
+
}
|
|
2657
|
+
if (command === 'review' && subcommand === 'process') {
|
|
2658
|
+
const reviewFlags = parseReviewProcessFlags(commandArgs);
|
|
2659
|
+
if (reviewFlags.help) {
|
|
2660
|
+
return { exitCode: 0, stdout: `${renderReviewProcessHelp()}\n`, stderr: '' };
|
|
2661
|
+
}
|
|
2662
|
+
const report = await processReviewImpl({
|
|
2663
|
+
runRoot: reviewFlags.runRoot,
|
|
2664
|
+
runId: reviewFlags.runId,
|
|
2665
|
+
outDir: reviewFlags.outDir,
|
|
2666
|
+
startTs: reviewFlags.startTs,
|
|
2667
|
+
endTs: reviewFlags.endTs,
|
|
2668
|
+
logicVersion: reviewFlags.logicVersion,
|
|
2669
|
+
enableLlm: reviewFlags.enableLlm,
|
|
2670
|
+
llmModel: reviewFlags.llmModel,
|
|
2671
|
+
llmMaxProcesses: reviewFlags.llmMaxProcesses,
|
|
2672
|
+
env: deps.env,
|
|
2673
|
+
fetchImpl: deps.fetchImpl,
|
|
2674
|
+
});
|
|
2675
|
+
return {
|
|
2676
|
+
exitCode: 0,
|
|
2677
|
+
stdout: stringifyJson(report, reviewFlags.json),
|
|
2678
|
+
stderr: '',
|
|
2679
|
+
};
|
|
2680
|
+
}
|
|
2681
|
+
if (command === 'review' && subcommand === 'flow') {
|
|
2682
|
+
const reviewFlags = parseReviewFlowFlags(commandArgs);
|
|
2683
|
+
if (reviewFlags.help) {
|
|
2684
|
+
return { exitCode: 0, stdout: `${renderReviewFlowHelp()}\n`, stderr: '' };
|
|
2685
|
+
}
|
|
2686
|
+
const report = await flowReviewImpl({
|
|
2687
|
+
rowsFile: reviewFlags.rowsFile,
|
|
2688
|
+
flowsDir: reviewFlags.flowsDir,
|
|
2689
|
+
runRoot: reviewFlags.runRoot,
|
|
2690
|
+
runId: reviewFlags.runId,
|
|
2691
|
+
outDir: reviewFlags.outDir,
|
|
2692
|
+
startTs: reviewFlags.startTs,
|
|
2693
|
+
endTs: reviewFlags.endTs,
|
|
2694
|
+
logicVersion: reviewFlags.logicVersion,
|
|
2695
|
+
enableLlm: reviewFlags.enableLlm,
|
|
2696
|
+
llmModel: reviewFlags.llmModel,
|
|
2697
|
+
llmMaxFlows: reviewFlags.llmMaxFlows,
|
|
2698
|
+
llmBatchSize: reviewFlags.llmBatchSize,
|
|
2699
|
+
similarityThreshold: reviewFlags.similarityThreshold,
|
|
2700
|
+
methodologyId: reviewFlags.methodologyId,
|
|
2701
|
+
env: deps.env,
|
|
2702
|
+
fetchImpl: deps.fetchImpl,
|
|
2703
|
+
});
|
|
2704
|
+
return {
|
|
2705
|
+
exitCode: 0,
|
|
2706
|
+
stdout: stringifyJson(report, reviewFlags.json),
|
|
2707
|
+
stderr: '',
|
|
2708
|
+
};
|
|
2709
|
+
}
|
|
2710
|
+
if (command === 'review' && subcommand === 'lifecyclemodel') {
|
|
2711
|
+
const reviewFlags = parseReviewLifecyclemodelFlags(commandArgs);
|
|
2712
|
+
if (reviewFlags.help) {
|
|
2713
|
+
return { exitCode: 0, stdout: `${renderReviewLifecyclemodelHelp()}\n`, stderr: '' };
|
|
2714
|
+
}
|
|
2715
|
+
const report = await lifecyclemodelReviewImpl({
|
|
2716
|
+
runDir: reviewFlags.runDir,
|
|
2717
|
+
outDir: reviewFlags.outDir,
|
|
2718
|
+
startTs: reviewFlags.startTs,
|
|
2719
|
+
endTs: reviewFlags.endTs,
|
|
2720
|
+
logicVersion: reviewFlags.logicVersion,
|
|
2721
|
+
});
|
|
2722
|
+
return {
|
|
2723
|
+
exitCode: 0,
|
|
2724
|
+
stdout: stringifyJson(report, reviewFlags.json),
|
|
2725
|
+
stderr: '',
|
|
2726
|
+
};
|
|
2727
|
+
}
|
|
2728
|
+
return plannedCommand(command, subcommand ?? undefined);
|
|
2729
|
+
}
|
|
2730
|
+
catch (error) {
|
|
2731
|
+
const payload = toErrorPayload(error);
|
|
2732
|
+
const exitCode = error instanceof CliError ? error.exitCode : 1;
|
|
2733
|
+
return {
|
|
2734
|
+
exitCode,
|
|
2735
|
+
stdout: '',
|
|
2736
|
+
stderr: `${JSON.stringify(payload)}\n`,
|
|
2737
|
+
};
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
//# sourceMappingURL=cli.js.map
|