@tiangong-lca/cli 0.0.28 → 0.0.30
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 +90 -2
- package/dist/src/cli.js +553 -4
- package/dist/src/cli.js.map +1 -1
- package/dist/src/lib/dataset-command.js +11 -0
- package/dist/src/lib/dataset-command.js.map +1 -1
- package/dist/src/lib/dataset-maintenance-contract.js.map +1 -1
- package/dist/src/lib/dataset-maintenance-flow-identity-approval-claim.js +175 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-approval-claim.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-capture.js +511 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-capture.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-command.js +26 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-command.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-contract.js +784 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-contract.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-execution-contract.js +1317 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-execution-contract.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-freeze.js +342 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-freeze.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-plan.js +900 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-plan.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-recovery.js +688 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-recovery.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-run.js +1369 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-run.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-seal.js +144 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-seal.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-verify.js +377 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-verify.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-wire.js +178 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-wire.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-remote.js +156 -10
- package/dist/src/lib/dataset-maintenance-remote.js.map +1 -1
- package/dist/src/lib/dataset-save-draft-run.js +667 -0
- package/dist/src/lib/dataset-save-draft-run.js.map +1 -1
- package/dist/src/lib/http.js.map +1 -1
- package/dist/src/lib/lca-release.js +683 -0
- package/dist/src/lib/lca-release.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,8 +17,10 @@ checkPaths:
|
|
|
17
17
|
- bin/**
|
|
18
18
|
- src/cli.ts
|
|
19
19
|
- src/main.ts
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
- src/lib/lca-release.ts
|
|
21
|
+
- test/lca-release*.test.ts
|
|
22
|
+
lastReviewedAt: 2026-07-23
|
|
23
|
+
lastReviewedCommit: 5c90ddd60328748ab6d8d89717e59dcaeca8cde7
|
|
22
24
|
---
|
|
23
25
|
|
|
24
26
|
# TianGong LCA CLI
|
|
@@ -35,6 +37,12 @@ Review note, 2026-07-15: `dataset maintenance run-protected` adds a production-o
|
|
|
35
37
|
|
|
36
38
|
Review note, 2026-07-15: `dataset maintenance freeze-protected` and `seal-protected-approval` close the preparation gap without adding a second execution path. Freeze preparation authenticates directly to the explicitly confirmed production project, performs only complete account/support reads plus the 50 derivative snapshot RPCs, and writes an unapproved canonical request. Approval sealing is entirely local and requires the exact human-returned UTF-8 bytes plus explicit freeze/request/text hashes and account confirmation. Only the later `run-protected` command can preflight or admit work.
|
|
37
39
|
|
|
40
|
+
Review note, 2026-07-16: `release ...` is the LCI/LCIA data-release command family, not the npm package release workflow. It uses the normal user-session bootstrap, requires the server to authorize `data_product_manager` for private and mutating operations, never accepts a service-role key, and keeps large Calculation Bundle or ZIP payloads in hash-verified files instead of stdout.
|
|
41
|
+
|
|
42
|
+
Review note, 2026-07-17: `dataset maintenance flow-identity capture|plan|freeze|seal-approval|run|freeze-recovery|seal-recovery-approval|run-recovery|verify` is the dedicated Step 3 workflow for approved BAFU elementary-flow identity mappings. Capture performs one complete authenticated census and one database-attestation POST; plan rejects historical authorities and binds the exact 305-source request to its immutable receipt. The write path uses a database-minted one-wrapper permit that rotates after each successful process/finalize write and is never stored in proof artifacts; a create-only local approval claim is defense in depth. A lost permit or preflight response cannot be replayed: the operator must freeze and approve an exact recovery baseline, while status/recovery may locate only the same actor-owned scope through the exact read-only lookup. Terminal verification independently proves unchanged source/public/support rows, exact desired owner-draft processes, zero approved-source residue, unchanged pending/blocker/orphan closure, and causal derivative completion. Failed/stale derivatives still require a separate derivative-only plan, freeze, and approval and never replay the process mutation. Production use remains gated on merge, Preview validation, and coordinated database/CLI release.
|
|
43
|
+
|
|
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
|
+
|
|
38
46
|
## Run
|
|
39
47
|
|
|
40
48
|
One-off published run:
|
|
@@ -87,6 +95,83 @@ TIANGONG_LCA_DISABLE_SESSION_CACHE=false
|
|
|
87
95
|
TIANGONG_LCA_FORCE_REAUTH=false
|
|
88
96
|
```
|
|
89
97
|
|
|
98
|
+
## LCI/LCIA Data Release
|
|
99
|
+
|
|
100
|
+
The `release` command family is the authenticated transport used by the standalone release control plane. It does not introduce a TIDAS schema variant: result packages reuse the existing Process exchange structure for LCI and the existing Process LCIA result fields, with a LifecycleModel referencing the resulting Process.
|
|
101
|
+
|
|
102
|
+
The canonical publication set contains four self-contained ZIPs:
|
|
103
|
+
|
|
104
|
+
- Unit Process full closure in TIDAS and ILCD.
|
|
105
|
+
- Standalone LifecycleModel + Result full closure in TIDAS and ILCD. This package repeats the required canonical Unit Process and support closure, so it has no dependency on another ZIP.
|
|
106
|
+
|
|
107
|
+
Workflow:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
tiangong-lca release prepare --input ./release-prepare.json --json
|
|
111
|
+
tiangong-lca release upload --input ./release-upload.json --output ./upload-receipt.json
|
|
112
|
+
tiangong-lca release finalize --input ./release-finalize.json --json
|
|
113
|
+
tiangong-lca release approve --input ./release-approval.json --json
|
|
114
|
+
tiangong-lca release publish --input ./release-publish.json --json
|
|
115
|
+
tiangong-lca release readback-verify --input ./release-readback.json --json
|
|
116
|
+
tiangong-lca release status --release-run-id <release-run-id> --json
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`release-upload.json` contains the immutable plan identity plus exactly one artifact for each profile/format pair. Paths are resolved relative to the request file:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"releaseRunId": "11111111-1111-4111-8111-111111111111",
|
|
124
|
+
"publishPlanHash": "<64 lowercase hex characters>",
|
|
125
|
+
"artifacts": [
|
|
126
|
+
{
|
|
127
|
+
"profileId": "unit-process-full-closure.v1",
|
|
128
|
+
"format": "tidas",
|
|
129
|
+
"path": "./packages/unit-process.tidas.zip",
|
|
130
|
+
"sha256": "<64 lowercase hex characters>",
|
|
131
|
+
"byteSize": 1234,
|
|
132
|
+
"mediaType": "application/zip"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"profileId": "unit-process-full-closure.v1",
|
|
136
|
+
"format": "ilcd",
|
|
137
|
+
"path": "./packages/unit-process.ilcd.zip",
|
|
138
|
+
"sha256": "<64 lowercase hex characters>",
|
|
139
|
+
"byteSize": 1234,
|
|
140
|
+
"mediaType": "application/zip"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"profileId": "standalone-lifecyclemodel-result-full-closure.v1",
|
|
144
|
+
"format": "tidas",
|
|
145
|
+
"path": "./packages/result.tidas.zip",
|
|
146
|
+
"sha256": "<64 lowercase hex characters>",
|
|
147
|
+
"byteSize": 1234,
|
|
148
|
+
"mediaType": "application/zip"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"profileId": "standalone-lifecyclemodel-result-full-closure.v1",
|
|
152
|
+
"format": "ilcd",
|
|
153
|
+
"path": "./packages/result.ilcd.zip",
|
|
154
|
+
"sha256": "<64 lowercase hex characters>",
|
|
155
|
+
"byteSize": 1234,
|
|
156
|
+
"mediaType": "application/zip"
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The CLI verifies every local upload against its declared byte size, SHA-256, media type, and required pair before requesting signed URLs. Upload receipts and downloads are written atomically with private file permissions. Existing outputs are preserved unless `--force` is explicit. The publish credential fingerprint is derived locally from `TIANGONG_LCA_API_KEY`; callers cannot inject it through the request file.
|
|
163
|
+
|
|
164
|
+
Calculation results and published artifacts remain file-first:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
tiangong-lca release calculation-bundle --package-id <package-id> --output ./calculation-bundle.json
|
|
168
|
+
tiangong-lca release calculation-artifact --package-id <package-id> --artifact-path chunks/lci-00000.jsonl.gz --output ./lci-00000.jsonl.gz
|
|
169
|
+
tiangong-lca release current --json
|
|
170
|
+
tiangong-lca release artifact-download --artifact-id <artifact-id> --output ./release.zip
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`calculation-bundle` writes a verified manifest projection with short-lived URLs for its declared artifacts. Artifact downloads are accepted only when their exact path is present in that manifest, and downloaded bytes must match the durable size and SHA-256 before the output is exposed. Use `--dry-run` to validate inputs and inspect a credential-masked request without network writes.
|
|
174
|
+
|
|
90
175
|
Optional LLM review env, only for `qa process --enable-llm` or `qa flow --enable-llm`:
|
|
91
176
|
|
|
92
177
|
```bash
|
|
@@ -280,6 +365,7 @@ tiangong-lca dataset classification apply --type location --input ./rows/process
|
|
|
280
365
|
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
|
|
281
366
|
tiangong-lca dataset curation-queue next --queue-dir /abs/path/to/curation-queue --type support --json
|
|
282
367
|
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
|
|
283
369
|
tiangong-lca dataset evidence-search plan --query "中国2026年电力结构数据" --out-dir /abs/path/to/evidence-search --json
|
|
284
370
|
tiangong-lca dataset evidence-search run --input ./evidence-search.request.json --results ./search-results.json --out-dir /abs/path/to/evidence-search --json
|
|
285
371
|
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
|
|
@@ -314,6 +400,8 @@ For `process build-plan` and `flow build-plan`, canonical payloads embedded in t
|
|
|
314
400
|
|
|
315
401
|
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.
|
|
316
402
|
|
|
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.
|
|
404
|
+
|
|
317
405
|
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.
|
|
318
406
|
|
|
319
407
|
For `process publish-build`, canonical process payloads are validated locally with `ProcessSchema` before publish handoff artifacts are written. The gate report is `reports/process-publish-schema-gate.json`.
|