@tiangong-lca/cli 0.0.2 → 0.0.3
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 +131 -309
- package/dist/src/cli.js +158 -1
- package/dist/src/cli.js.map +1 -1
- package/dist/src/lib/flow-fetch-rows.js +235 -0
- package/dist/src/lib/flow-fetch-rows.js.map +1 -0
- package/dist/src/lib/flow-materialize-decisions.js +421 -0
- package/dist/src/lib/flow-materialize-decisions.js.map +1 -0
- package/package.json +1 -1
package/dist/src/cli.js
CHANGED
|
@@ -18,6 +18,8 @@ import { runProcessReview, } from './lib/review-process.js';
|
|
|
18
18
|
import { runFlowReview, } from './lib/review-flow.js';
|
|
19
19
|
import { runLifecyclemodelReview, } from './lib/review-lifecyclemodel.js';
|
|
20
20
|
import { runFlowRemediate, } from './lib/flow-remediate.js';
|
|
21
|
+
import { runFlowFetchRows, } from './lib/flow-fetch-rows.js';
|
|
22
|
+
import { runFlowMaterializeDecisions, } from './lib/flow-materialize-decisions.js';
|
|
21
23
|
import { runFlowGet } from './lib/flow-get.js';
|
|
22
24
|
import { runFlowList } from './lib/flow-list.js';
|
|
23
25
|
import { runFlowPublishVersion, } from './lib/flow-publish-version.js';
|
|
@@ -45,7 +47,7 @@ Implemented Commands:
|
|
|
45
47
|
doctor show environment diagnostics
|
|
46
48
|
search flow | process | lifecyclemodel
|
|
47
49
|
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
|
|
50
|
+
flow get | list | fetch-rows | materialize-decisions | 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
51
|
lifecyclemodel auto-build | validate-build | publish-build | build-resulting-process | publish-resulting-process | orchestrate
|
|
50
52
|
review process | flow | lifecyclemodel
|
|
51
53
|
publish run
|
|
@@ -73,6 +75,8 @@ Examples:
|
|
|
73
75
|
tiangong lifecyclemodel orchestrate plan --input ./lifecyclemodel-orchestrate.request.json --out-dir ./artifacts/lifecyclemodel_recursive/run-001
|
|
74
76
|
tiangong flow get --id <flow-id> --version <version>
|
|
75
77
|
tiangong flow list --id <flow-id> --state-code 100 --limit 20
|
|
78
|
+
tiangong flow fetch-rows --refs-file ./flow-refs.json --out-dir ./flow-fetch
|
|
79
|
+
tiangong flow materialize-decisions --decision-file ./approved-decisions.json --flow-rows-file ./review-input-rows.jsonl --out-dir ./flow-decisions
|
|
76
80
|
tiangong flow remediate --input-file ./invalid-flows.jsonl --out-dir ./flow-remediation
|
|
77
81
|
tiangong flow publish-version --input-file ./ready-flows.jsonl --out-dir ./flow-publish --commit
|
|
78
82
|
tiangong flow publish-reviewed-data --flow-rows-file ./reviewed-flows.jsonl --original-flow-rows-file ./original-flows.jsonl --out-dir ./flow-publish-review
|
|
@@ -182,6 +186,8 @@ function renderFlowHelp() {
|
|
|
182
186
|
Implemented Subcommands:
|
|
183
187
|
get Load one flow dataset by identifier through direct Supabase access
|
|
184
188
|
list Enumerate flow datasets through direct Supabase access with deterministic filters
|
|
189
|
+
fetch-rows Materialize real DB flow refs into local review-input rows and fetch artifacts
|
|
190
|
+
materialize-decisions Materialize approved merge decisions into canonical-map, rewrite-plan, and seed artifacts
|
|
185
191
|
remediate Deterministically repair invalid local flow rows and emit artifact-first outputs
|
|
186
192
|
publish-version Publish remediated flow versions through the unified CLI surface
|
|
187
193
|
publish-reviewed-data Prepare reviewed flow rows, skip unchanged snapshots, and optionally publish the resulting versions
|
|
@@ -196,6 +202,8 @@ Examples:
|
|
|
196
202
|
tiangong flow --help
|
|
197
203
|
tiangong flow get --help
|
|
198
204
|
tiangong flow list --help
|
|
205
|
+
tiangong flow fetch-rows --help
|
|
206
|
+
tiangong flow materialize-decisions --help
|
|
199
207
|
tiangong flow remediate --help
|
|
200
208
|
tiangong flow publish-version --help
|
|
201
209
|
tiangong flow publish-reviewed-data --help
|
|
@@ -276,6 +284,50 @@ Outputs written under --out-dir:
|
|
|
276
284
|
- flows_tidas_sdk_plus_classification_residual_manual_queue_prompt.md
|
|
277
285
|
`.trim();
|
|
278
286
|
}
|
|
287
|
+
function renderFlowFetchRowsHelp() {
|
|
288
|
+
return `Usage:
|
|
289
|
+
tiangong flow fetch-rows --refs-file <file> --out-dir <dir> [options]
|
|
290
|
+
|
|
291
|
+
Options:
|
|
292
|
+
--refs-file <file> Flow refs as JSON or JSONL
|
|
293
|
+
--out-dir <dir> Output directory for fetch artifacts
|
|
294
|
+
--no-latest-fallback Do not fall back to the latest visible version when --version misses
|
|
295
|
+
--fail-on-missing Return exit code 1 when any ref is missing or ambiguous
|
|
296
|
+
--json Print compact JSON
|
|
297
|
+
-h, --help
|
|
298
|
+
|
|
299
|
+
Required env:
|
|
300
|
+
TIANGONG_LCA_API_BASE_URL
|
|
301
|
+
TIANGONG_LCA_API_KEY
|
|
302
|
+
TIANGONG_LCA_SUPABASE_PUBLISHABLE_KEY
|
|
303
|
+
|
|
304
|
+
Outputs written under --out-dir:
|
|
305
|
+
- resolved-flow-rows.jsonl
|
|
306
|
+
- review-input-rows.jsonl
|
|
307
|
+
- fetch-summary.json
|
|
308
|
+
- missing-flow-refs.jsonl
|
|
309
|
+
- ambiguous-flow-refs.jsonl
|
|
310
|
+
`.trim();
|
|
311
|
+
}
|
|
312
|
+
function renderFlowMaterializeDecisionsHelp() {
|
|
313
|
+
return `Usage:
|
|
314
|
+
tiangong flow materialize-decisions --decision-file <file> --flow-rows-file <file> --out-dir <dir> [options]
|
|
315
|
+
|
|
316
|
+
Options:
|
|
317
|
+
--decision-file <file> Approved cluster decisions as JSON or JSONL
|
|
318
|
+
--flow-rows-file <file> Real DB flow rows as JSON or JSONL
|
|
319
|
+
--out-dir <dir> Output directory for decision materialization artifacts
|
|
320
|
+
--json Print compact JSON
|
|
321
|
+
-h, --help
|
|
322
|
+
|
|
323
|
+
Outputs written under --out-dir:
|
|
324
|
+
- flow-dedup-canonical-map.json
|
|
325
|
+
- flow-dedup-rewrite-plan.json
|
|
326
|
+
- manual-semantic-merge-seed.current.json
|
|
327
|
+
- decision-summary.json
|
|
328
|
+
- blocked-clusters.json
|
|
329
|
+
`.trim();
|
|
330
|
+
}
|
|
279
331
|
function renderFlowPublishVersionHelp() {
|
|
280
332
|
return `Usage:
|
|
281
333
|
tiangong flow publish-version --input-file <file> --out-dir <dir> [options]
|
|
@@ -1477,6 +1529,68 @@ function parseFlowGetFlags(args) {
|
|
|
1477
1529
|
stateCode: parseOptionalNonNegativeIntegerFlag(values['state-code'], '--state-code', 'INVALID_FLOW_GET_STATE_CODE'),
|
|
1478
1530
|
};
|
|
1479
1531
|
}
|
|
1532
|
+
function parseFlowFetchRowsFlags(args) {
|
|
1533
|
+
let values;
|
|
1534
|
+
try {
|
|
1535
|
+
({ values } = parseArgs({
|
|
1536
|
+
args,
|
|
1537
|
+
allowPositionals: false,
|
|
1538
|
+
strict: true,
|
|
1539
|
+
options: {
|
|
1540
|
+
help: { type: 'boolean', short: 'h' },
|
|
1541
|
+
json: { type: 'boolean' },
|
|
1542
|
+
'refs-file': { type: 'string' },
|
|
1543
|
+
'out-dir': { type: 'string' },
|
|
1544
|
+
'no-latest-fallback': { type: 'boolean' },
|
|
1545
|
+
'fail-on-missing': { type: 'boolean' },
|
|
1546
|
+
},
|
|
1547
|
+
}));
|
|
1548
|
+
}
|
|
1549
|
+
catch (error) {
|
|
1550
|
+
throw new CliError(String(error), {
|
|
1551
|
+
code: 'INVALID_ARGS',
|
|
1552
|
+
exitCode: 2,
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
return {
|
|
1556
|
+
help: Boolean(values.help),
|
|
1557
|
+
json: Boolean(values.json),
|
|
1558
|
+
refsFile: typeof values['refs-file'] === 'string' ? values['refs-file'] : '',
|
|
1559
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
1560
|
+
allowLatestFallback: values['no-latest-fallback'] !== true,
|
|
1561
|
+
failOnMissing: values['fail-on-missing'] === true,
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
function parseFlowMaterializeDecisionsFlags(args) {
|
|
1565
|
+
let values;
|
|
1566
|
+
try {
|
|
1567
|
+
({ values } = parseArgs({
|
|
1568
|
+
args,
|
|
1569
|
+
allowPositionals: false,
|
|
1570
|
+
strict: true,
|
|
1571
|
+
options: {
|
|
1572
|
+
help: { type: 'boolean', short: 'h' },
|
|
1573
|
+
json: { type: 'boolean' },
|
|
1574
|
+
'decision-file': { type: 'string' },
|
|
1575
|
+
'flow-rows-file': { type: 'string' },
|
|
1576
|
+
'out-dir': { type: 'string' },
|
|
1577
|
+
},
|
|
1578
|
+
}));
|
|
1579
|
+
}
|
|
1580
|
+
catch (error) {
|
|
1581
|
+
throw new CliError(String(error), {
|
|
1582
|
+
code: 'INVALID_ARGS',
|
|
1583
|
+
exitCode: 2,
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
return {
|
|
1587
|
+
help: Boolean(values.help),
|
|
1588
|
+
json: Boolean(values.json),
|
|
1589
|
+
decisionFile: typeof values['decision-file'] === 'string' ? values['decision-file'] : '',
|
|
1590
|
+
flowRowsFile: typeof values['flow-rows-file'] === 'string' ? values['flow-rows-file'] : '',
|
|
1591
|
+
outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1480
1594
|
function parseFlowListFlags(args) {
|
|
1481
1595
|
let values;
|
|
1482
1596
|
try {
|
|
@@ -2062,6 +2176,8 @@ export async function executeCli(argv, deps) {
|
|
|
2062
2176
|
const flowReviewImpl = deps.runFlowReviewImpl ?? runFlowReview;
|
|
2063
2177
|
const lifecyclemodelReviewImpl = deps.runLifecyclemodelReviewImpl ?? runLifecyclemodelReview;
|
|
2064
2178
|
const flowRemediateImpl = deps.runFlowRemediateImpl ?? runFlowRemediate;
|
|
2179
|
+
const flowFetchRowsImpl = deps.runFlowFetchRowsImpl ?? runFlowFetchRows;
|
|
2180
|
+
const flowMaterializeDecisionsImpl = deps.runFlowMaterializeDecisionsImpl ?? runFlowMaterializeDecisions;
|
|
2065
2181
|
const flowGetImpl = deps.runFlowGetImpl ?? runFlowGet;
|
|
2066
2182
|
const flowListImpl = deps.runFlowListImpl ?? runFlowList;
|
|
2067
2183
|
const flowPublishVersionImpl = deps.runFlowPublishVersionImpl ?? runFlowPublishVersion;
|
|
@@ -2414,6 +2530,47 @@ export async function executeCli(argv, deps) {
|
|
|
2414
2530
|
stderr: '',
|
|
2415
2531
|
};
|
|
2416
2532
|
}
|
|
2533
|
+
if (command === 'flow' && subcommand === 'fetch-rows') {
|
|
2534
|
+
const flowFlags = parseFlowFetchRowsFlags(commandArgs);
|
|
2535
|
+
if (flowFlags.help) {
|
|
2536
|
+
return { exitCode: 0, stdout: `${renderFlowFetchRowsHelp()}\n`, stderr: '' };
|
|
2537
|
+
}
|
|
2538
|
+
const report = await flowFetchRowsImpl({
|
|
2539
|
+
refsFile: flowFlags.refsFile,
|
|
2540
|
+
outDir: flowFlags.outDir,
|
|
2541
|
+
allowLatestFallback: flowFlags.allowLatestFallback,
|
|
2542
|
+
env: deps.env,
|
|
2543
|
+
fetchImpl: deps.fetchImpl,
|
|
2544
|
+
});
|
|
2545
|
+
return {
|
|
2546
|
+
exitCode: flowFlags.failOnMissing &&
|
|
2547
|
+
report.status === 'completed_flow_row_materialization_with_gaps'
|
|
2548
|
+
? 1
|
|
2549
|
+
: 0,
|
|
2550
|
+
stdout: stringifyJson(report, flowFlags.json),
|
|
2551
|
+
stderr: '',
|
|
2552
|
+
};
|
|
2553
|
+
}
|
|
2554
|
+
if (command === 'flow' && subcommand === 'materialize-decisions') {
|
|
2555
|
+
const flowFlags = parseFlowMaterializeDecisionsFlags(commandArgs);
|
|
2556
|
+
if (flowFlags.help) {
|
|
2557
|
+
return {
|
|
2558
|
+
exitCode: 0,
|
|
2559
|
+
stdout: `${renderFlowMaterializeDecisionsHelp()}\n`,
|
|
2560
|
+
stderr: '',
|
|
2561
|
+
};
|
|
2562
|
+
}
|
|
2563
|
+
const report = await flowMaterializeDecisionsImpl({
|
|
2564
|
+
decisionFile: flowFlags.decisionFile,
|
|
2565
|
+
flowRowsFile: flowFlags.flowRowsFile,
|
|
2566
|
+
outDir: flowFlags.outDir,
|
|
2567
|
+
});
|
|
2568
|
+
return {
|
|
2569
|
+
exitCode: 0,
|
|
2570
|
+
stdout: stringifyJson(report, flowFlags.json),
|
|
2571
|
+
stderr: '',
|
|
2572
|
+
};
|
|
2573
|
+
}
|
|
2417
2574
|
if (command === 'flow' && subcommand === 'publish-version') {
|
|
2418
2575
|
const flowFlags = parseFlowPublishVersionFlags(commandArgs);
|
|
2419
2576
|
if (flowFlags.help) {
|