@tiangong-lca/cli 0.0.30 → 0.0.32
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
CHANGED
|
@@ -43,6 +43,8 @@ Review note, 2026-07-17: `dataset maintenance flow-identity capture|plan|freeze|
|
|
|
43
43
|
|
|
44
44
|
Review note, 2026-07-23: `dataset save-draft --execution-contract` adds an opt-in crash-safe ordered owner-draft batch. The contract binds the authenticated project/owner, state 0, exact input order and payloads, before hashes, expected insert/update operations, and dependencies. A stable per-owner/project `action_id@desired_sha256` ledger prevents replay even if the contract or output directory is copied; ambiguous attempts are recovered only by exact owner/state/payload readback. The ordinary save-draft mode is unchanged.
|
|
45
45
|
|
|
46
|
+
Review note, 2026-07-24: CLI 0.0.32 adds bounded execution-contract concurrency without changing the sealed payload or replay model. `--max-parallel 1..8` keeps the complete dependency prefix serial and exact-read-back, then overlaps only the unique-target suffix. The current owner token is renewed and revalidated before each DML dispatch so long batches do not turn token expiry into an avoidable UNKNOWN.
|
|
47
|
+
|
|
46
48
|
## Run
|
|
47
49
|
|
|
48
50
|
One-off published run:
|
|
@@ -365,7 +367,7 @@ tiangong-lca dataset classification apply --type location --input ./rows/process
|
|
|
365
367
|
tiangong-lca dataset curation-queue build --processes ./rows/processes.jsonl --flows ./rows/flows.jsonl --support ./rows/sources.jsonl --out-dir /abs/path/to/curation-queue --json
|
|
366
368
|
tiangong-lca dataset curation-queue next --queue-dir /abs/path/to/curation-queue --type support --json
|
|
367
369
|
tiangong-lca dataset curation-queue verify --queue-dir /abs/path/to/curation-queue --type process --json
|
|
368
|
-
tiangong-lca dataset save-draft --input ./rows.jsonl --type auto --execution-contract ./execution-contract.json --out-dir /abs/path/to/dataset-save-draft --commit --json
|
|
370
|
+
tiangong-lca dataset save-draft --input ./rows.jsonl --type auto --execution-contract ./execution-contract.json --max-parallel 8 --out-dir /abs/path/to/dataset-save-draft --commit --json
|
|
369
371
|
tiangong-lca dataset evidence-search plan --query "中国2026年电力结构数据" --out-dir /abs/path/to/evidence-search --json
|
|
370
372
|
tiangong-lca dataset evidence-search run --input ./evidence-search.request.json --results ./search-results.json --out-dir /abs/path/to/evidence-search --json
|
|
371
373
|
tiangong-lca dataset references rewrite --input ./rows.jsonl --from flow:<old-id>@<old-version> --to flow:<new-id>@<new-version> --out-dir /abs/path/to/dataset-rewrite --json
|
|
@@ -400,7 +402,7 @@ For `process build-plan` and `flow build-plan`, canonical payloads embedded in t
|
|
|
400
402
|
|
|
401
403
|
For `process save-draft`, canonical process payloads are validated locally with `ProcessSchema` before any `--commit` write. Schema-invalid rows remain in `outputs/save-draft-rpc/failures.jsonl` instead of being persisted. Batch import callers should pass `--target-user-id`; the CLI then verifies the current auth session and any visible draft owner before writing, while downstream readback verification still proves the final owner and payload.
|
|
402
404
|
|
|
403
|
-
For `dataset save-draft --execution-contract`, the JSON contract uses schema `dataset-save-draft-execution-contract.v1` and supplies `execution_id`, `project_ref`, an exact owner (`user_id`, lowercase `email`, `state_code: 0`), and ordered actions. Each action binds `action_id`, `desired_sha256`, `expected_operation` (`insert` or `save_draft`), table/id/version, `before_sha256`, and earlier `dependency_action_ids`. Contract mode requires `--commit`; account-local Unit Group or Flow Property support rows additionally require `--allow-account-local-support`. Attempts and outcomes are stored under the platform user-state directory (`$XDG_STATE_HOME/tiangong-lca-cli` when configured), not beside the contract or report. Any prior terminal or unresolved attempt is read back or retained without re-dispatch; exit status is nonzero unless every action has exact terminal success.
|
|
405
|
+
For `dataset save-draft --execution-contract`, the JSON contract uses schema `dataset-save-draft-execution-contract.v1` and supplies `execution_id`, `project_ref`, an exact owner (`user_id`, lowercase `email`, `state_code: 0`), and ordered actions. Each action binds `action_id`, `desired_sha256`, `expected_operation` (`insert` or `save_draft`), table/id/version, `before_sha256`, and earlier `dependency_action_ids`. Contract mode requires `--commit`; account-local Unit Group or Flow Property support rows additionally require `--allow-account-local-support`. `--max-parallel` defaults to 1 and is capped at 8. When it is greater than 1, every action through the highest referenced dependency remains serial; only the later table/id/version-unique suffix may overlap. The exact owner token is renewed and checked before each DML dispatch. Attempts and outcomes are stored under the platform user-state directory (`$XDG_STATE_HOME/tiangong-lca-cli` when configured), not beside the contract or report. Any prior terminal or unresolved attempt is read back or retained without re-dispatch; exit status is nonzero unless every action has exact terminal success.
|
|
404
406
|
|
|
405
407
|
For `flow publish-version`, canonical flow payloads are validated locally with `FlowSchema` before remote visibility planning or writes. The command always writes `flow-publish-version-gate-report.json`; blocked rows are written to the remote-failure JSONL without calling the remote service.
|
|
406
408
|
|
package/dist/src/cli.js
CHANGED
|
@@ -947,6 +947,8 @@ Options:
|
|
|
947
947
|
--dry-run Validate and plan without remote writes (default)
|
|
948
948
|
--execution-contract <file>
|
|
949
949
|
Execute a content-bound ordered owner-draft batch with append-only attempt/readback evidence (requires --commit)
|
|
950
|
+
--max-parallel <1-8>
|
|
951
|
+
Keep the dependency prefix serial, then run only the target-unique suffix with this concurrency (default: 1)
|
|
950
952
|
--allow-account-local-support
|
|
951
953
|
Explicitly permit account-local Unit Group / Flow Property rows in the execution contract
|
|
952
954
|
--json Print compact JSON
|
|
@@ -2484,6 +2486,7 @@ function parseDatasetSaveDraftFlags(args) {
|
|
|
2484
2486
|
'dry-run': { type: 'boolean' },
|
|
2485
2487
|
'allow-account-local-support': { type: 'boolean' },
|
|
2486
2488
|
'execution-contract': { type: 'string' },
|
|
2489
|
+
'max-parallel': { type: 'string' },
|
|
2487
2490
|
},
|
|
2488
2491
|
}));
|
|
2489
2492
|
}
|
|
@@ -2499,6 +2502,18 @@ function parseDatasetSaveDraftFlags(args) {
|
|
|
2499
2502
|
exitCode: 2,
|
|
2500
2503
|
});
|
|
2501
2504
|
}
|
|
2505
|
+
const maxParallelValue = values['max-parallel'];
|
|
2506
|
+
const maxParallel = typeof maxParallelValue === 'string' && /^\d+$/u.test(maxParallelValue)
|
|
2507
|
+
? Number.parseInt(maxParallelValue, 10)
|
|
2508
|
+
: maxParallelValue === undefined
|
|
2509
|
+
? 1
|
|
2510
|
+
: Number.NaN;
|
|
2511
|
+
if (!Number.isInteger(maxParallel) || maxParallel < 1 || maxParallel > 8) {
|
|
2512
|
+
throw new CliError('--max-parallel must be an integer from 1 to 8.', {
|
|
2513
|
+
code: 'INVALID_ARGS',
|
|
2514
|
+
exitCode: 2,
|
|
2515
|
+
});
|
|
2516
|
+
}
|
|
2502
2517
|
return {
|
|
2503
2518
|
help: Boolean(values.help),
|
|
2504
2519
|
json: Boolean(values.json),
|
|
@@ -2508,6 +2523,7 @@ function parseDatasetSaveDraftFlags(args) {
|
|
|
2508
2523
|
commit: Boolean(values.commit),
|
|
2509
2524
|
allowReferenceOnlySupport: Boolean(values['allow-account-local-support']),
|
|
2510
2525
|
executionContractPath: typeof values['execution-contract'] === 'string' ? values['execution-contract'] : null,
|
|
2526
|
+
maxParallel,
|
|
2511
2527
|
};
|
|
2512
2528
|
}
|
|
2513
2529
|
function parseDatasetSourceUploadAttachmentsFlags(args) {
|
|
@@ -5858,6 +5874,7 @@ export async function executeCli(argv, deps) {
|
|
|
5858
5874
|
commit: datasetFlags.commit,
|
|
5859
5875
|
allowReferenceOnlySupport: datasetFlags.allowReferenceOnlySupport,
|
|
5860
5876
|
executionContractPath: datasetFlags.executionContractPath,
|
|
5877
|
+
maxParallel: datasetFlags.maxParallel,
|
|
5861
5878
|
env: deps.env,
|
|
5862
5879
|
fetchImpl: deps.fetchImpl,
|
|
5863
5880
|
});
|