@tiangong-lca/cli 0.0.9 → 0.0.11

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
@@ -263,6 +263,7 @@ tiangong-lca process resume-build --run-dir /abs/path/to/process-run --json
263
263
  tiangong-lca process publish-build --run-dir /abs/path/to/process-run --json
264
264
  tiangong-lca process batch-build --input ./examples/process-batch-build.request.json --out-dir /abs/path/to/process-batch --json
265
265
  tiangong-lca dataset validate --input ./rows.jsonl --type auto --out-dir /abs/path/to/dataset-validate --json
266
+ 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
266
267
  tiangong-lca dataset evidence-search plan --query "中国2026年电力结构数据" --out-dir /abs/path/to/evidence-search --json
267
268
  tiangong-lca dataset evidence-search run --input ./evidence-search.request.json --results ./search-results.json --out-dir /abs/path/to/evidence-search --json
268
269
  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
@@ -302,6 +303,8 @@ For `lifecyclemodel save-draft`, canonical lifecyclemodel payloads are validated
302
303
 
303
304
  For `dataset evidence-search`, `plan` creates the field-level query matrix and search budget. `run` accepts normalized external search results from browser/web-search tools or a generic JSON provider endpoint, then writes `outputs/evidence-search-plan.json`, `outputs/evidence-search-results.jsonl`, `outputs/evidence-search-report.json`, and `outputs/evidence-search-declaration.json` when evidence is absent or only partial. The CLI records scope and normalization; Codex/skills still own semantic judgement and source selection.
304
305
 
306
+ For `dataset curation-queue build`, the CLI writes entity-level Foundry import queue artifacts: `outputs/curation-queue-manifest.json`, `outputs/curation-queue-tasks.jsonl`, `outputs/curation-queue-locks.json`, `outputs/curation-queue-blockers.jsonl`, and per-entity `input.jsonl`, `closure.json`, and `entity-run-plan.json`. The command only builds deterministic queue state. AI authoring must return structured patches or build plans, and remote writes remain gated by deterministic apply, schema/QA, prewrite verify, and readback.
307
+
305
308
  For `dataset references rewrite`, `--commit` executes the state-aware save-draft path for patched process and lifecyclemodel rows; without `--commit`, the command only writes local rewrite artifacts.
306
309
 
307
310
  ## More Docs
package/dist/src/cli.js CHANGED
@@ -41,6 +41,7 @@ import { runFlowApplyProcessFlowRepairs, runFlowPlanProcessFlowRepairs, runFlowR
41
41
  import { executeRemoteCommand, getRemoteCommandHelp } from './lib/remote.js';
42
42
  import { runValidation, } from './lib/validation.js';
43
43
  import { runDatasetValidate, } from './lib/dataset-validate.js';
44
+ import { runDatasetCurationQueueBuild, } from './lib/dataset-curation-queue.js';
44
45
  import { runDatasetReferencesRewrite, } from './lib/dataset-references-rewrite.js';
45
46
  import { runDatasetRemoteRefresh, } from './lib/dataset-remote-refresh.js';
46
47
  import { runDatasetRemoteVerify, } from './lib/dataset-remote-verify.js';
@@ -68,7 +69,7 @@ Implemented Commands:
68
69
  doctor show environment diagnostics
69
70
  search flow | process | lifecyclemodel
70
71
  process get | list | identity-preflight | build-plan | scope-statistics | dedup-review | auto-build | resume-build | publish-build | complete-required-fields | save-draft | batch-build | refresh-references | verify-rows
71
- dataset contract get | context-pack | import-lca convert | author | validate | verify-remote | bilingual extract/apply/validate | evidence-search plan/run | references rewrite/refresh-remote
72
+ dataset contract get | context-pack | curation-queue build | import-lca convert | author | validate | verify-remote | bilingual extract/apply/validate | evidence-search plan/run | references rewrite/refresh-remote
72
73
  flow get | list | identity-preflight | build-plan | 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
73
74
  lifecyclemodel auto-build | validate-build | publish-build | save-draft | graph | build-resulting-process | publish-resulting-process | orchestrate
74
75
  qa process | flow | lifecyclemodel
@@ -103,6 +104,7 @@ Examples:
103
104
  tiangong-lca dataset validate --input ./rows.jsonl --type auto --out-dir /abs/path/to/dataset-validate
104
105
  tiangong-lca dataset contract get --type process --include schema,methodology,ruleset --out-dir ./contract
105
106
  tiangong-lca dataset context-pack --type process --profile ai-import --out-dir ./context-pack
107
+ tiangong-lca dataset curation-queue build --processes ./processes.jsonl --flows ./flows.jsonl --out-dir ./curation-queue
106
108
  tiangong-lca dataset import-lca convert --input ./external-package --output-dir ./converted --from-format auto --target tidas
107
109
  tiangong-lca dataset author --input ./source.pdf --target-types process,flow --out-dir ./authoring
108
110
  tiangong-lca dataset verify-remote --input ./rows.jsonl --out-dir /abs/path/to/dataset-remote-verify
@@ -244,6 +246,7 @@ function renderDatasetHelp() {
244
246
  Implemented Subcommands:
245
247
  contract get Write TIDAS schema / methodology / ruleset contract artifacts
246
248
  context-pack Write an AI-ready TIDAS contract context pack
249
+ curation-queue build Build entity-level AI curation queue artifacts for Foundry imports
247
250
  import-lca convert Convert supported external LCA packages through tidas-tools
248
251
  author Extract source evidence and prepare TIDAS context packs for AI authoring
249
252
  validate Validate local flow / process / lifecyclemodel rows with the TIDAS SDK
@@ -258,6 +261,7 @@ Implemented Subcommands:
258
261
  Examples:
259
262
  tiangong-lca dataset contract get --type process --include schema,methodology,ruleset --out-dir ./contract --help
260
263
  tiangong-lca dataset context-pack --type process --profile ai-import --out-dir ./context-pack --help
264
+ tiangong-lca dataset curation-queue build --processes ./rows/processes.jsonl --flows ./rows/flows.jsonl --support ./rows/sources.jsonl --out-dir ./curation-queue --help
261
265
  tiangong-lca dataset import-lca convert --input ./external-package --output-dir ./converted --from-format auto --target tidas --help
262
266
  tiangong-lca dataset author --input ./source.pdf --target-types process,flow --out-dir ./authoring --help
263
267
  tiangong-lca dataset validate --input ./rows.jsonl --type auto --out-dir ./dataset-validate --help
@@ -313,6 +317,35 @@ Outputs written under --out-dir:
313
317
  - outputs/contract-report.json
314
318
  `.trim();
315
319
  }
320
+ function renderDatasetCurationQueueHelp() {
321
+ return `Usage:
322
+ tiangong-lca dataset curation-queue build --processes <file> --out-dir <dir> [options]
323
+
324
+ Options:
325
+ --processes <file> Process rows JSON/JSONL
326
+ --flows <file> Local flow rows JSON/JSONL used by process references
327
+ --support <file> Repeatable support rows JSON/JSONL, for source/contact/unitgroup/flowproperty rows
328
+ --external-flow-ref <file> Repeatable external flow ref rows JSON/JSONL treated as already resolvable
329
+ --exclude-process-id <id> Repeatable process id to skip
330
+ --process-limit <n> Limit process tasks for focused validation or retries
331
+ --out-dir <dir> Queue artifact directory
332
+ --json Print compact JSON
333
+ -h, --help
334
+
335
+ Outputs written under --out-dir:
336
+ - outputs/curation-queue-manifest.json
337
+ - outputs/curation-queue-tasks.jsonl
338
+ - outputs/curation-queue-locks.json
339
+ - outputs/curation-queue-blockers.jsonl
340
+ - entities/<supports|flows|processes>/<id>__<version>/input.jsonl
341
+ - entities/<supports|flows|processes>/<id>__<version>/closure.json
342
+ - entities/<supports|flows|processes>/<id>__<version>/entity-run-plan.json
343
+
344
+ Contract:
345
+ This command builds the queue only. AI authoring must write structured patches or build plans,
346
+ and remote writes remain blocked until deterministic apply, schema/QA, prewrite verify, and readback gates pass.
347
+ `.trim();
348
+ }
316
349
  function renderDatasetImportLcaHelp() {
317
350
  return `Usage:
318
351
  tiangong-lca dataset import-lca convert --input <path> --output-dir <dir> [options]
@@ -1822,6 +1855,53 @@ function parseDatasetContractFlags(args) {
1822
1855
  outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : null,
1823
1856
  };
1824
1857
  }
1858
+ function parseDatasetCurationQueueBuildFlags(args) {
1859
+ let values;
1860
+ try {
1861
+ ({ values } = parseArgs({
1862
+ args,
1863
+ allowPositionals: false,
1864
+ strict: true,
1865
+ options: {
1866
+ help: { type: 'boolean', short: 'h' },
1867
+ json: { type: 'boolean' },
1868
+ processes: { type: 'string' },
1869
+ flows: { type: 'string' },
1870
+ support: { type: 'string', multiple: true },
1871
+ 'external-flow-ref': { type: 'string', multiple: true },
1872
+ 'exclude-process-id': { type: 'string', multiple: true },
1873
+ 'process-limit': { type: 'string' },
1874
+ 'out-dir': { type: 'string' },
1875
+ },
1876
+ }));
1877
+ }
1878
+ catch (error) {
1879
+ throw new CliError(String(error), {
1880
+ code: 'INVALID_ARGS',
1881
+ exitCode: 2,
1882
+ });
1883
+ }
1884
+ const processLimit = typeof values['process-limit'] === 'string'
1885
+ ? Number.parseInt(values['process-limit'], 10)
1886
+ : undefined;
1887
+ return {
1888
+ help: Boolean(values.help),
1889
+ json: Boolean(values.json),
1890
+ processesPath: typeof values.processes === 'string' ? values.processes : '',
1891
+ flowsPath: typeof values.flows === 'string' ? values.flows : undefined,
1892
+ supportPaths: Array.isArray(values.support)
1893
+ ? values.support.filter((value) => typeof value === 'string')
1894
+ : [],
1895
+ externalFlowRefPaths: Array.isArray(values['external-flow-ref'])
1896
+ ? values['external-flow-ref'].filter((value) => typeof value === 'string')
1897
+ : [],
1898
+ outDir: typeof values['out-dir'] === 'string' ? values['out-dir'] : '',
1899
+ excludeProcessIds: Array.isArray(values['exclude-process-id'])
1900
+ ? values['exclude-process-id'].filter((value) => typeof value === 'string')
1901
+ : [],
1902
+ processLimit,
1903
+ };
1904
+ }
1825
1905
  function parseDatasetImportLcaConvertFlags(args) {
1826
1906
  let values;
1827
1907
  try {
@@ -3908,6 +3988,7 @@ export async function executeCli(argv, deps) {
3908
3988
  const flowBuildPlanValidateImpl = deps.runFlowBuildPlanValidateImpl ?? runFlowBuildPlanValidate;
3909
3989
  const flowBuildPlanMaterializeImpl = deps.runFlowBuildPlanMaterializeImpl ?? runFlowBuildPlanMaterialize;
3910
3990
  const datasetValidateImpl = deps.runDatasetValidateImpl ?? runDatasetValidate;
3991
+ const datasetCurationQueueBuildImpl = deps.runDatasetCurationQueueBuildImpl ?? runDatasetCurationQueueBuild;
3911
3992
  const datasetReferencesRewriteImpl = deps.runDatasetReferencesRewriteImpl ?? runDatasetReferencesRewrite;
3912
3993
  const datasetRemoteRefreshImpl = deps.runDatasetRemoteRefreshImpl ?? runDatasetRemoteRefresh;
3913
3994
  const datasetRemoteVerifyImpl = deps.runDatasetRemoteVerifyImpl ?? runDatasetRemoteVerify;
@@ -4009,6 +4090,36 @@ export async function executeCli(argv, deps) {
4009
4090
  stderr: '',
4010
4091
  };
4011
4092
  }
4093
+ if (command === 'dataset' && subcommand === 'curation-queue') {
4094
+ const action = commandArgs[0] ?? '';
4095
+ if (!action || action === '--help' || action === '-h') {
4096
+ return { exitCode: 0, stdout: `${renderDatasetCurationQueueHelp()}\n`, stderr: '' };
4097
+ }
4098
+ if (action !== 'build') {
4099
+ throw new CliError("dataset curation-queue action must be 'build'.", {
4100
+ code: 'DATASET_CURATION_QUEUE_ACTION_INVALID',
4101
+ exitCode: 2,
4102
+ });
4103
+ }
4104
+ const datasetFlags = parseDatasetCurationQueueBuildFlags(commandArgs.slice(1));
4105
+ if (datasetFlags.help) {
4106
+ return { exitCode: 0, stdout: `${renderDatasetCurationQueueHelp()}\n`, stderr: '' };
4107
+ }
4108
+ const report = await datasetCurationQueueBuildImpl({
4109
+ processesPath: datasetFlags.processesPath,
4110
+ flowsPath: datasetFlags.flowsPath,
4111
+ supportPaths: datasetFlags.supportPaths,
4112
+ externalFlowRefPaths: datasetFlags.externalFlowRefPaths,
4113
+ outDir: datasetFlags.outDir,
4114
+ excludeProcessIds: datasetFlags.excludeProcessIds,
4115
+ processLimit: datasetFlags.processLimit,
4116
+ });
4117
+ return {
4118
+ exitCode: report.status === 'blocked' ? 1 : 0,
4119
+ stdout: stringifyJson(report, datasetFlags.json),
4120
+ stderr: '',
4121
+ };
4122
+ }
4012
4123
  if (command === 'dataset' && subcommand === 'import-lca') {
4013
4124
  const action = commandArgs[0] ?? '';
4014
4125
  if (!action || action === '--help' || action === '-h') {