bpmax-cli 0.2.1-beta.2 → 0.2.1-beta.4
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
|
@@ -354,7 +354,34 @@ When a local sysconfig mirror only has a UUID, resolve it before using typed con
|
|
|
354
354
|
bpmax-cli config resolve-id --domain project-detail-template --uuid <uuid> --repo <sysconfig_repo> --profile <profile> --format json
|
|
355
355
|
```
|
|
356
356
|
|
|
357
|
-
`bpmax-cli config adapters --format json` returns a JSON array of adapter rows. Each row includes `domain`, capability prefix, supported statuses, read/write endpoints, and notes.
|
|
357
|
+
`bpmax-cli config adapters --format json` returns a JSON array of adapter rows. Each row includes `domain`, capability prefix, supported statuses, read/write endpoints, action support, required files/hash guards, side effects, and notes.
|
|
358
|
+
|
|
359
|
+
Typed readback and migration evidence use stable entrypoints:
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
bpmax-cli config readback dataset --id 793 --format json
|
|
363
|
+
bpmax-cli config readback dataset-field --id 5926 --format json
|
|
364
|
+
bpmax-cli config flow-app context --workspace <workspace> --flow <flow_type_or_name> --evidence-out .codex/tmp/target-context.csv --format json
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
`flow-app create` dry-run responses include `required_confirm`; automation should copy that exact value instead of reconstructing confirmation text. Direct typed create/submit responses expose stable top-level `id`, `key`, and `readback_hint` fields for collectors.
|
|
368
|
+
|
|
369
|
+
Dataset relation fields and lifecycle actions are typed:
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
bpmax-cli config dataset relation-fields submit --id <dataset_id> --payload <submit.json> --confirm "submit dataset <dataset_id>" --response-out <response.json> --format json
|
|
373
|
+
bpmax-cli config dataset relation-fields readback --id <dataset_id> --format json
|
|
374
|
+
bpmax-cli config dataset publish --id <dataset_id> --confirm "publish dataset <dataset_id>" --format json
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
For migrations with many config objects, use batch manifests so each row keeps independent response evidence:
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
bpmax-cli config batch submit --manifest .codex/tmp/config-batch.json --continue-on-error --format json
|
|
381
|
+
bpmax-cli config batch readback --manifest .codex/tmp/config-readback-batch.json --continue-on-error --format json
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
Batch row `response_out` files are envelopes: read `ok`, `domain`, `id`, and `action` at the top level, and read typed command fields from `response.id`, `response.key`, and `response.readback_hint`. If a row stops at dry-run, copy `response.required_confirm` into the manifest row's `confirm` before retrying.
|
|
358
385
|
|
|
359
386
|
## BPMAX AI implementation taskbooks
|
|
360
387
|
|
package/dist/bin.js
CHANGED
|
@@ -469,7 +469,7 @@ function pluginAgentCapabilityForRequest(method, normalizedPath) {
|
|
|
469
469
|
// package.json
|
|
470
470
|
var package_default = {
|
|
471
471
|
name: "bpmax-cli",
|
|
472
|
-
version: "0.2.1-beta.
|
|
472
|
+
version: "0.2.1-beta.4",
|
|
473
473
|
description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
474
474
|
type: "module",
|
|
475
475
|
bin: {
|
|
@@ -3953,6 +3953,8 @@ function configAdapterMatrix() {
|
|
|
3953
3953
|
return Object.entries(CONFIG_DOMAINS).map(([domain, definition]) => {
|
|
3954
3954
|
const supportsCreate = Boolean(definition.createPath) || ["flow-template", "api-platform", "role", "nav-config"].includes(domain);
|
|
3955
3955
|
const supportsDelete = Boolean(definition.deletePath) || ["workspace-flow", "api-platform", "nav-config"].includes(domain);
|
|
3956
|
+
const supportsPublish = domain === "dataset";
|
|
3957
|
+
const supportsRelationFields = domain === "dataset";
|
|
3956
3958
|
return {
|
|
3957
3959
|
domain,
|
|
3958
3960
|
capability_prefix: definition.capability,
|
|
@@ -3970,6 +3972,8 @@ function configAdapterMatrix() {
|
|
|
3970
3972
|
create: supportsCreate,
|
|
3971
3973
|
build: definition.buildStatus === "supported",
|
|
3972
3974
|
submit: definition.submitStatus === "supported" || definition.submitStatus === "requires-platform-proxy",
|
|
3975
|
+
publish: supportsPublish,
|
|
3976
|
+
relationFields: supportsRelationFields,
|
|
3973
3977
|
delete: supportsDelete,
|
|
3974
3978
|
verify: definition.exportStatus === "supported",
|
|
3975
3979
|
dry_run: definition.submitStatus === "supported" || definition.submitStatus === "requires-platform-proxy"
|
|
@@ -3978,12 +3982,13 @@ function configAdapterMatrix() {
|
|
|
3978
3982
|
work_file: definition.buildStatus === "supported",
|
|
3979
3983
|
meta_file_for_build: definition.buildStatus === "supported",
|
|
3980
3984
|
payload_file_for_submit: definition.submitStatus === "supported" || definition.submitStatus === "requires-platform-proxy",
|
|
3981
|
-
base_hash_for_submit: domain === "workspace-flow"
|
|
3985
|
+
base_hash_for_submit: domain === "workspace-flow" || domain === "dataset"
|
|
3982
3986
|
},
|
|
3983
3987
|
side_effects: {
|
|
3984
3988
|
writes_workspace_binding: domain === "workspace-flow",
|
|
3985
3989
|
full_replacement_submit: domain === "workspace-flow",
|
|
3986
|
-
publishes_on_submit: domain === "form-template"
|
|
3990
|
+
publishes_on_submit: domain === "form-template",
|
|
3991
|
+
relation_fields_submit: domain === "dataset"
|
|
3987
3992
|
},
|
|
3988
3993
|
notes: definition.notes
|
|
3989
3994
|
};
|
|
@@ -5118,6 +5123,62 @@ function exactConfirmOrDryRun(confirm3, expectedConfirm, options = {}) {
|
|
|
5118
5123
|
}
|
|
5119
5124
|
throw new Error(`confirmation text mismatch. expected: ${expectedConfirm}. actual: ${confirm3}.`);
|
|
5120
5125
|
}
|
|
5126
|
+
function configReadbackHint(domain, id) {
|
|
5127
|
+
if (id === void 0 || id === null || id === "") {
|
|
5128
|
+
return null;
|
|
5129
|
+
}
|
|
5130
|
+
const value = String(id);
|
|
5131
|
+
return {
|
|
5132
|
+
command: `bpmax-cli config ${domain} export --id ${value} --inline --format json`,
|
|
5133
|
+
unified_command: `bpmax-cli config readback ${domain} --id ${value} --format json`
|
|
5134
|
+
};
|
|
5135
|
+
}
|
|
5136
|
+
function configResponseKey(domain, payload, response, readback) {
|
|
5137
|
+
if (isRecord3(response)) {
|
|
5138
|
+
const key = response.key ?? response.field ?? response.custom_key;
|
|
5139
|
+
if (key !== void 0) return key;
|
|
5140
|
+
if (isRecord3(response.data)) {
|
|
5141
|
+
const nested = response.data.key ?? response.data.field ?? response.data.custom_key;
|
|
5142
|
+
if (nested !== void 0) return nested;
|
|
5143
|
+
}
|
|
5144
|
+
}
|
|
5145
|
+
if (isRecord3(readback)) {
|
|
5146
|
+
const key = readback.key ?? readback.field ?? readback.custom_key;
|
|
5147
|
+
if (key !== void 0) return key;
|
|
5148
|
+
}
|
|
5149
|
+
if (isRecord3(payload)) {
|
|
5150
|
+
if (domain === "dataset") return payload.custom_key ?? payload.customKey ?? null;
|
|
5151
|
+
return payload.key ?? payload.field ?? null;
|
|
5152
|
+
}
|
|
5153
|
+
return null;
|
|
5154
|
+
}
|
|
5155
|
+
function standardConfigWriteResponse(input) {
|
|
5156
|
+
const resolvedId = input.executedId ?? input.id;
|
|
5157
|
+
return {
|
|
5158
|
+
id: resolvedId,
|
|
5159
|
+
request_id: input.id,
|
|
5160
|
+
key: configResponseKey(input.domain, input.payload, input.response, input.readback),
|
|
5161
|
+
readback_hint: configReadbackHint(input.domain, resolvedId)
|
|
5162
|
+
};
|
|
5163
|
+
}
|
|
5164
|
+
function dryRunFields(expectedConfirm) {
|
|
5165
|
+
return {
|
|
5166
|
+
ok: true,
|
|
5167
|
+
dry_run: true,
|
|
5168
|
+
operation_executed: false,
|
|
5169
|
+
confirm_required: true,
|
|
5170
|
+
required_confirm: expectedConfirm,
|
|
5171
|
+
expected_confirm: expectedConfirm
|
|
5172
|
+
};
|
|
5173
|
+
}
|
|
5174
|
+
function executedFields() {
|
|
5175
|
+
return {
|
|
5176
|
+
ok: true,
|
|
5177
|
+
dry_run: false,
|
|
5178
|
+
operation_executed: true,
|
|
5179
|
+
confirm_required: false
|
|
5180
|
+
};
|
|
5181
|
+
}
|
|
5121
5182
|
function validateDatasetFieldCreatePayload(payload) {
|
|
5122
5183
|
if (!isRecord3(payload)) {
|
|
5123
5184
|
throw new Error("dataset-field create requires an object payload.");
|
|
@@ -6865,11 +6926,7 @@ async function createFlowAppFromWork(config, profile, formWorkFile, flowWorkFile
|
|
|
6865
6926
|
};
|
|
6866
6927
|
if (!exactConfirmOrDryRun(confirm3, expectedConfirm, { equivalentConfirms: [acceptedConfirmWithWorkspacePrefix] })) {
|
|
6867
6928
|
return {
|
|
6868
|
-
|
|
6869
|
-
dry_run: true,
|
|
6870
|
-
operation_executed: false,
|
|
6871
|
-
confirm_required: true,
|
|
6872
|
-
expected_confirm: expectedConfirm,
|
|
6929
|
+
...dryRunFields(expectedConfirm),
|
|
6873
6930
|
accepted_confirms: [expectedConfirm, acceptedConfirmWithWorkspacePrefix],
|
|
6874
6931
|
domain: "flow-app",
|
|
6875
6932
|
workspace,
|
|
@@ -7008,10 +7065,7 @@ async function createFlowAppFromWork(config, profile, formWorkFile, flowWorkFile
|
|
|
7008
7065
|
verified_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7009
7066
|
};
|
|
7010
7067
|
return {
|
|
7011
|
-
|
|
7012
|
-
dry_run: false,
|
|
7013
|
-
operation_executed: true,
|
|
7014
|
-
confirm_required: false,
|
|
7068
|
+
...executedFields(),
|
|
7015
7069
|
domain: "flow-app",
|
|
7016
7070
|
workspace,
|
|
7017
7071
|
name,
|
|
@@ -7689,7 +7743,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
7689
7743
|
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
7690
7744
|
if (confirm3 !== expectedConfirm2) {
|
|
7691
7745
|
return {
|
|
7692
|
-
|
|
7746
|
+
...dryRunFields(expectedConfirm2),
|
|
7693
7747
|
domain,
|
|
7694
7748
|
id,
|
|
7695
7749
|
endpoint: endpoint2,
|
|
@@ -7719,7 +7773,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
7719
7773
|
throw new Error(`workspace-flow submit verification failed; missing bindings: ${missingBindings.map((item) => buildWorkspaceFlowBindingKey(item.flow_type, item.flow_key)).join(", ")}`);
|
|
7720
7774
|
}
|
|
7721
7775
|
return {
|
|
7722
|
-
|
|
7776
|
+
...executedFields(),
|
|
7723
7777
|
domain,
|
|
7724
7778
|
id,
|
|
7725
7779
|
endpoint: endpoint2,
|
|
@@ -7757,7 +7811,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
7757
7811
|
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
7758
7812
|
if (confirm3 !== expectedConfirm2) {
|
|
7759
7813
|
return {
|
|
7760
|
-
|
|
7814
|
+
...dryRunFields(expectedConfirm2),
|
|
7761
7815
|
domain,
|
|
7762
7816
|
id,
|
|
7763
7817
|
endpoint: "/workspace",
|
|
@@ -7773,14 +7827,15 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
7773
7827
|
{ data: submit2.payload, capability: `${definition.capability}.create` }
|
|
7774
7828
|
);
|
|
7775
7829
|
const readback3 = await readRemoteConfigDomain(profile, domain, `key:${workspaceKey}`, definition);
|
|
7830
|
+
const createdId = responseDataId(response3) ?? (isRecord3(readback3) ? readback3.id ?? null : null);
|
|
7776
7831
|
return {
|
|
7777
|
-
|
|
7832
|
+
...executedFields(),
|
|
7778
7833
|
domain,
|
|
7779
|
-
id,
|
|
7834
|
+
...standardConfigWriteResponse({ domain, id, executedId: createdId, payload: submit2.payload, response: response3, readback: readback3 }),
|
|
7780
7835
|
endpoint: "/workspace",
|
|
7781
7836
|
method: "POST",
|
|
7782
7837
|
response: response3,
|
|
7783
|
-
created_id:
|
|
7838
|
+
created_id: createdId,
|
|
7784
7839
|
readback_hash: hashJson(readback3)
|
|
7785
7840
|
};
|
|
7786
7841
|
}
|
|
@@ -7801,7 +7856,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
7801
7856
|
const endpoint2 = `/workspace/${encodeURIComponent(workspaceId)}`;
|
|
7802
7857
|
if (confirm3 !== expectedConfirm2) {
|
|
7803
7858
|
return {
|
|
7804
|
-
|
|
7859
|
+
...dryRunFields(expectedConfirm2),
|
|
7805
7860
|
domain,
|
|
7806
7861
|
id,
|
|
7807
7862
|
endpoint: endpoint2,
|
|
@@ -7820,9 +7875,9 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
7820
7875
|
);
|
|
7821
7876
|
const readback2 = await readRemoteConfigDomain(profile, domain, workspaceKey ? `key:${workspaceKey}` : workspaceId, definition);
|
|
7822
7877
|
return {
|
|
7823
|
-
|
|
7878
|
+
...executedFields(),
|
|
7824
7879
|
domain,
|
|
7825
|
-
id,
|
|
7880
|
+
...standardConfigWriteResponse({ domain, id, payload: submit2.payload, response: response2, readback: readback2 }),
|
|
7826
7881
|
endpoint: endpoint2,
|
|
7827
7882
|
method: "PUT",
|
|
7828
7883
|
response: response2,
|
|
@@ -7872,7 +7927,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
7872
7927
|
}
|
|
7873
7928
|
if (confirm3 !== expectedConfirm2) {
|
|
7874
7929
|
return {
|
|
7875
|
-
|
|
7930
|
+
...dryRunFields(expectedConfirm2),
|
|
7876
7931
|
domain,
|
|
7877
7932
|
id,
|
|
7878
7933
|
operation_plan: submit2.payload,
|
|
@@ -7882,7 +7937,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
7882
7937
|
};
|
|
7883
7938
|
}
|
|
7884
7939
|
return {
|
|
7885
|
-
|
|
7940
|
+
...executedFields(),
|
|
7886
7941
|
domain,
|
|
7887
7942
|
id,
|
|
7888
7943
|
...domain === "role" ? await submitRoleOperations(profile, id, submit2) : await submitAggregateConfigDomain(profile, domain, id, submit2)
|
|
@@ -7926,7 +7981,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
7926
7981
|
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
7927
7982
|
if (confirm3 !== expectedConfirm2) {
|
|
7928
7983
|
return {
|
|
7929
|
-
|
|
7984
|
+
...dryRunFields(expectedConfirm2),
|
|
7930
7985
|
domain,
|
|
7931
7986
|
id,
|
|
7932
7987
|
endpoint: definition.createPath,
|
|
@@ -7953,9 +8008,9 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
7953
8008
|
}
|
|
7954
8009
|
}
|
|
7955
8010
|
return {
|
|
7956
|
-
|
|
8011
|
+
...executedFields(),
|
|
7957
8012
|
domain,
|
|
7958
|
-
id,
|
|
8013
|
+
...standardConfigWriteResponse({ domain, id, executedId: createdId ?? null, payload: submit.payload, response: response2 }),
|
|
7959
8014
|
created_id: createdId ?? null,
|
|
7960
8015
|
endpoint: definition.createPath,
|
|
7961
8016
|
method: definition.createMethod,
|
|
@@ -7992,7 +8047,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
7992
8047
|
const endpoint2 = "/form_template";
|
|
7993
8048
|
if (confirm3 !== expectedConfirm2) {
|
|
7994
8049
|
return {
|
|
7995
|
-
|
|
8050
|
+
...dryRunFields(expectedConfirm2),
|
|
7996
8051
|
domain,
|
|
7997
8052
|
id,
|
|
7998
8053
|
endpoint: endpoint2,
|
|
@@ -8033,9 +8088,9 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
8033
8088
|
{ capability: `${definition.capability}.export` }
|
|
8034
8089
|
);
|
|
8035
8090
|
return {
|
|
8036
|
-
|
|
8091
|
+
...executedFields(),
|
|
8037
8092
|
domain,
|
|
8038
|
-
id,
|
|
8093
|
+
...standardConfigWriteResponse({ domain, id, executedId: publishedId, payload: submit.payload, response: publishResponse2, readback: publishedReadback }),
|
|
8039
8094
|
endpoint: endpoint2,
|
|
8040
8095
|
method: "POST",
|
|
8041
8096
|
response: response2,
|
|
@@ -8077,7 +8132,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
8077
8132
|
}
|
|
8078
8133
|
if (confirm3 !== expectedConfirm) {
|
|
8079
8134
|
return {
|
|
8080
|
-
|
|
8135
|
+
...dryRunFields(expectedConfirm),
|
|
8081
8136
|
domain,
|
|
8082
8137
|
id,
|
|
8083
8138
|
endpoint,
|
|
@@ -8107,9 +8162,9 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
8107
8162
|
}
|
|
8108
8163
|
const readback = await readBackConfigDomain(profile, domain, id, definition);
|
|
8109
8164
|
return {
|
|
8110
|
-
|
|
8165
|
+
...executedFields(),
|
|
8111
8166
|
domain,
|
|
8112
|
-
id,
|
|
8167
|
+
...standardConfigWriteResponse({ domain, id, payload: submitPayload, response }),
|
|
8113
8168
|
endpoint,
|
|
8114
8169
|
method: definition.submitMethod,
|
|
8115
8170
|
...publishMode ? { publish_mode: publishMode } : {},
|
|
@@ -8203,7 +8258,7 @@ async function runDatasetLifecycleAction(config, profile, action, id, confirm3)
|
|
|
8203
8258
|
];
|
|
8204
8259
|
if (confirm3 !== expectedConfirm) {
|
|
8205
8260
|
return {
|
|
8206
|
-
|
|
8261
|
+
...dryRunFields(expectedConfirm),
|
|
8207
8262
|
domain: "dataset",
|
|
8208
8263
|
id,
|
|
8209
8264
|
action: commandAction,
|
|
@@ -8229,15 +8284,186 @@ async function runDatasetLifecycleAction(config, profile, action, id, confirm3)
|
|
|
8229
8284
|
}
|
|
8230
8285
|
const readback = await readRemoteConfigDomain(profile, "dataset", id, definition);
|
|
8231
8286
|
return {
|
|
8232
|
-
|
|
8287
|
+
...executedFields(),
|
|
8233
8288
|
domain: "dataset",
|
|
8234
8289
|
id,
|
|
8235
8290
|
action: commandAction,
|
|
8236
8291
|
operations: executableOperations,
|
|
8237
8292
|
operation_responses: responses,
|
|
8293
|
+
readback_hash: hashJson(readback),
|
|
8294
|
+
readback_hint: configReadbackHint("dataset", id),
|
|
8238
8295
|
readback
|
|
8239
8296
|
};
|
|
8240
8297
|
}
|
|
8298
|
+
function normalizeConfigBatchItems(manifest) {
|
|
8299
|
+
if (Array.isArray(manifest)) {
|
|
8300
|
+
return manifest.map((raw) => ({ raw, item: isRecord3(raw) ? raw : null }));
|
|
8301
|
+
}
|
|
8302
|
+
if (!isRecord3(manifest)) {
|
|
8303
|
+
throw new Error("config batch manifest must be a JSON object or array.");
|
|
8304
|
+
}
|
|
8305
|
+
const items = manifest.operations ?? manifest.items ?? manifest.rows;
|
|
8306
|
+
if (!Array.isArray(items)) {
|
|
8307
|
+
throw new Error("config batch manifest requires operations, items, or rows array.");
|
|
8308
|
+
}
|
|
8309
|
+
return items.map((raw) => ({ raw, item: isRecord3(raw) ? raw : null }));
|
|
8310
|
+
}
|
|
8311
|
+
function assertBatchItemDomain(domain) {
|
|
8312
|
+
if (typeof domain !== "string" || !Object.prototype.hasOwnProperty.call(CONFIG_DOMAINS, domain)) {
|
|
8313
|
+
throw new Error(`config batch item requires a supported domain, got ${String(domain)}.`);
|
|
8314
|
+
}
|
|
8315
|
+
return domain;
|
|
8316
|
+
}
|
|
8317
|
+
async function writeOptionalBatchResponse(file, value) {
|
|
8318
|
+
if (typeof file !== "string" || !file.trim()) {
|
|
8319
|
+
return null;
|
|
8320
|
+
}
|
|
8321
|
+
await writeJsonFile(file, value);
|
|
8322
|
+
return file;
|
|
8323
|
+
}
|
|
8324
|
+
async function runConfigBatchSubmit(config, profile, manifestFile, options = {}) {
|
|
8325
|
+
const manifest = await readJsonFile(manifestFile);
|
|
8326
|
+
const items = normalizeConfigBatchItems(manifest);
|
|
8327
|
+
const results = [];
|
|
8328
|
+
for (let index = 0; index < items.length; index += 1) {
|
|
8329
|
+
const batchItem = items[index];
|
|
8330
|
+
const item = batchItem.item;
|
|
8331
|
+
if (!item) {
|
|
8332
|
+
const result = {
|
|
8333
|
+
ok: false,
|
|
8334
|
+
index,
|
|
8335
|
+
domain: null,
|
|
8336
|
+
id: "",
|
|
8337
|
+
action: "submit",
|
|
8338
|
+
error: "config batch submit item must be a JSON object."
|
|
8339
|
+
};
|
|
8340
|
+
results.push(result);
|
|
8341
|
+
if (!options.continueOnError) break;
|
|
8342
|
+
continue;
|
|
8343
|
+
}
|
|
8344
|
+
let domain = null;
|
|
8345
|
+
let id = "";
|
|
8346
|
+
try {
|
|
8347
|
+
domain = assertBatchItemDomain(item.domain);
|
|
8348
|
+
id = typeof item.id === "string" ? item.id : "";
|
|
8349
|
+
const payload = typeof item.payload === "string" ? item.payload : "";
|
|
8350
|
+
if (!id || !payload) {
|
|
8351
|
+
throw new Error("config batch submit item requires id and payload.");
|
|
8352
|
+
}
|
|
8353
|
+
const response = await submitConfigDomain(config, profile, domain, id, payload, item.confirm);
|
|
8354
|
+
const executed = !isRecord3(response) || response.operation_executed !== false && response.dry_run !== true;
|
|
8355
|
+
const result = executed ? {
|
|
8356
|
+
ok: true,
|
|
8357
|
+
index,
|
|
8358
|
+
domain,
|
|
8359
|
+
id,
|
|
8360
|
+
action: "submit",
|
|
8361
|
+
response
|
|
8362
|
+
} : {
|
|
8363
|
+
ok: false,
|
|
8364
|
+
index,
|
|
8365
|
+
domain,
|
|
8366
|
+
id,
|
|
8367
|
+
action: "submit",
|
|
8368
|
+
error: `config batch submit item did not execute; confirm_required=${String(isRecord3(response) ? response.required_confirm ?? response.expected_confirm ?? "" : "")}`,
|
|
8369
|
+
response
|
|
8370
|
+
};
|
|
8371
|
+
results.push(result);
|
|
8372
|
+
await writeOptionalBatchResponse(item.response_out, result);
|
|
8373
|
+
if (!result.ok && !options.continueOnError) break;
|
|
8374
|
+
} catch (error) {
|
|
8375
|
+
const result = {
|
|
8376
|
+
ok: false,
|
|
8377
|
+
index,
|
|
8378
|
+
domain,
|
|
8379
|
+
id,
|
|
8380
|
+
action: "submit",
|
|
8381
|
+
error: error instanceof Error ? error.message : String(error || "")
|
|
8382
|
+
};
|
|
8383
|
+
results.push(result);
|
|
8384
|
+
await writeOptionalBatchResponse(item.response_out, result);
|
|
8385
|
+
if (!options.continueOnError) break;
|
|
8386
|
+
}
|
|
8387
|
+
}
|
|
8388
|
+
const failures = results.filter((item) => item.ok === false);
|
|
8389
|
+
return {
|
|
8390
|
+
ok: failures.length === 0,
|
|
8391
|
+
manifest_file: manifestFile,
|
|
8392
|
+
action: "submit",
|
|
8393
|
+
continue_on_error: Boolean(options.continueOnError),
|
|
8394
|
+
total: items.length,
|
|
8395
|
+
completed: results.length,
|
|
8396
|
+
succeeded: results.length - failures.length,
|
|
8397
|
+
failed: failures.length,
|
|
8398
|
+
results
|
|
8399
|
+
};
|
|
8400
|
+
}
|
|
8401
|
+
async function runConfigBatchReadback(config, profile, manifestFile, options = {}) {
|
|
8402
|
+
const manifest = await readJsonFile(manifestFile);
|
|
8403
|
+
const items = normalizeConfigBatchItems(manifest);
|
|
8404
|
+
const results = [];
|
|
8405
|
+
for (let index = 0; index < items.length; index += 1) {
|
|
8406
|
+
const batchItem = items[index];
|
|
8407
|
+
const item = batchItem.item;
|
|
8408
|
+
if (!item) {
|
|
8409
|
+
const result = {
|
|
8410
|
+
ok: false,
|
|
8411
|
+
index,
|
|
8412
|
+
domain: null,
|
|
8413
|
+
id: "",
|
|
8414
|
+
action: "readback",
|
|
8415
|
+
error: "config batch readback item must be a JSON object."
|
|
8416
|
+
};
|
|
8417
|
+
results.push(result);
|
|
8418
|
+
if (!options.continueOnError) break;
|
|
8419
|
+
continue;
|
|
8420
|
+
}
|
|
8421
|
+
let domain = null;
|
|
8422
|
+
let id = "";
|
|
8423
|
+
try {
|
|
8424
|
+
domain = assertBatchItemDomain(item.domain);
|
|
8425
|
+
id = typeof item.id === "string" ? item.id : "";
|
|
8426
|
+
if (!id) {
|
|
8427
|
+
throw new Error("config batch readback item requires id.");
|
|
8428
|
+
}
|
|
8429
|
+
const response = await readbackConfigDomain(config, profile, domain, id);
|
|
8430
|
+
const result = {
|
|
8431
|
+
ok: true,
|
|
8432
|
+
index,
|
|
8433
|
+
domain,
|
|
8434
|
+
id,
|
|
8435
|
+
action: "readback",
|
|
8436
|
+
response
|
|
8437
|
+
};
|
|
8438
|
+
results.push(result);
|
|
8439
|
+
await writeOptionalBatchResponse(item.response_out, result);
|
|
8440
|
+
} catch (error) {
|
|
8441
|
+
const result = {
|
|
8442
|
+
ok: false,
|
|
8443
|
+
index,
|
|
8444
|
+
domain,
|
|
8445
|
+
id,
|
|
8446
|
+
action: "readback",
|
|
8447
|
+
error: error instanceof Error ? error.message : String(error || "")
|
|
8448
|
+
};
|
|
8449
|
+
results.push(result);
|
|
8450
|
+
await writeOptionalBatchResponse(item.response_out, result);
|
|
8451
|
+
if (!options.continueOnError) break;
|
|
8452
|
+
}
|
|
8453
|
+
}
|
|
8454
|
+
const failures = results.filter((item) => item.ok === false);
|
|
8455
|
+
return {
|
|
8456
|
+
ok: failures.length === 0,
|
|
8457
|
+
manifest_file: manifestFile,
|
|
8458
|
+
action: "readback",
|
|
8459
|
+
continue_on_error: Boolean(options.continueOnError),
|
|
8460
|
+
total: items.length,
|
|
8461
|
+
completed: results.length,
|
|
8462
|
+
succeeded: results.length - failures.length,
|
|
8463
|
+
failed: failures.length,
|
|
8464
|
+
results
|
|
8465
|
+
};
|
|
8466
|
+
}
|
|
8241
8467
|
|
|
8242
8468
|
// src/core/config-workspace.ts
|
|
8243
8469
|
import { mkdir as mkdir6, readFile as readFile9, writeFile as writeFile6 } from "fs/promises";
|
|
@@ -9932,6 +10158,25 @@ function registerConfigCommands(program2) {
|
|
|
9932
10158
|
await saveConfig(configData);
|
|
9933
10159
|
printResult(options.format, result);
|
|
9934
10160
|
});
|
|
10161
|
+
const batch = config.command("batch").description("Run guarded typed config operations from a manifest");
|
|
10162
|
+
batch.command("submit").description("Submit typed config payloads from a batch manifest and keep per-row evidence").requiredOption("--manifest <file>", "Batch manifest JSON file").option("--profile <profile>", "Profile name").option("--continue-on-error", "Continue after a row fails and return a final failed summary").option("--format <format>", "Output format", "json").action(async (options) => {
|
|
10163
|
+
const configData = await loadConfig();
|
|
10164
|
+
const resolved = resolveProfile(configData, options.profile);
|
|
10165
|
+
const result = await runConfigBatchSubmit(configData, resolved, options.manifest, {
|
|
10166
|
+
continueOnError: Boolean(options.continueOnError)
|
|
10167
|
+
});
|
|
10168
|
+
await saveConfig(configData);
|
|
10169
|
+
printResult(options.format, result);
|
|
10170
|
+
});
|
|
10171
|
+
batch.command("readback").description("Read back typed config objects from a batch manifest and keep per-row evidence").requiredOption("--manifest <file>", "Batch manifest JSON file").option("--profile <profile>", "Profile name").option("--continue-on-error", "Continue after a row fails and return a final failed summary").option("--format <format>", "Output format", "json").action(async (options) => {
|
|
10172
|
+
const configData = await loadConfig();
|
|
10173
|
+
const resolved = resolveProfile(configData, options.profile);
|
|
10174
|
+
const result = await runConfigBatchReadback(configData, resolved, options.manifest, {
|
|
10175
|
+
continueOnError: Boolean(options.continueOnError)
|
|
10176
|
+
});
|
|
10177
|
+
await saveConfig(configData);
|
|
10178
|
+
printResult(options.format, result);
|
|
10179
|
+
});
|
|
9935
10180
|
Object.keys(CONFIG_DOMAINS).forEach((domain) => {
|
|
9936
10181
|
const domainCommand = domain === "workspace" ? workspace.description("Initialize local sysconfig workspaces and manage BPMAX workspace configuration") : config.command(domain).description(`Manage BPMAX ${domain} configuration`);
|
|
9937
10182
|
const createCommand = domainCommand.command("create").description(domain === "flow-template" ? "Create a new main flow template through the typed adapter" : `Create a ${domain} config object through a verified typed adapter; dry-run unless --confirm is exact`).option("--profile <profile>", "Profile name").option("--confirm <text>", "Exact confirmation text").option("--publish-live", "For flow-template, publish the created flow to live after saving draft").option("--response-out <file>", "Write the full JSON response to a file").option("--format <format>", "Output format", "pretty");
|
|
@@ -9977,15 +10222,13 @@ function registerConfigCommands(program2) {
|
|
|
9977
10222
|
const resolved = resolveProfile(configData, options.profile);
|
|
9978
10223
|
const workFormat = options.workFormat === "structured" ? "structured" : "raw";
|
|
9979
10224
|
const result = await exportConfigDomain(configData, resolved, domain, options.id, options.out, { workFormat });
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
result.work = work;
|
|
9988
|
-
}
|
|
10225
|
+
const workFile = typeof result.work_file === "string" ? result.work_file : void 0;
|
|
10226
|
+
const work = (options.inline || domain === "flow-template" && options.summary) && workFile ? await readJsonFile(workFile) : void 0;
|
|
10227
|
+
if (domain === "flow-template" && options.summary) {
|
|
10228
|
+
result.summary = summarizeFlowTemplateWork(work);
|
|
10229
|
+
}
|
|
10230
|
+
if (options.inline) {
|
|
10231
|
+
result.work = work;
|
|
9989
10232
|
}
|
|
9990
10233
|
await saveConfig(configData);
|
|
9991
10234
|
printResult(options.format, result);
|
|
@@ -10066,6 +10309,29 @@ function registerConfigCommands(program2) {
|
|
|
10066
10309
|
printResult(options.format, result);
|
|
10067
10310
|
});
|
|
10068
10311
|
if (domain === "dataset") {
|
|
10312
|
+
const relationFields = domainCommand.command("relation-fields").description("Manage dataset relationFields through the typed dataset adapter");
|
|
10313
|
+
relationFields.command("submit").description("Submit dataset relationFields payload with the standard dataset evidence response").requiredOption("--id <id>", "Remote dataset id").requiredOption("--payload <file>", "Submit payload JSON file produced by config dataset build").option("--profile <profile>", "Profile name").option("--confirm <text>", "Exact confirmation text").option("--response-out <file>", "Write the full JSON response to a file").option("--format <format>", "Output format", "pretty").action(async (options) => {
|
|
10314
|
+
const configData = await loadConfig();
|
|
10315
|
+
const resolved = resolveProfile(configData, options.profile);
|
|
10316
|
+
const result = await submitConfigDomain(
|
|
10317
|
+
configData,
|
|
10318
|
+
resolved,
|
|
10319
|
+
"dataset",
|
|
10320
|
+
options.id,
|
|
10321
|
+
options.payload,
|
|
10322
|
+
options.confirm
|
|
10323
|
+
);
|
|
10324
|
+
await saveConfig(configData);
|
|
10325
|
+
await writeResponseOut(options.responseOut, result);
|
|
10326
|
+
printResult(options.format, result);
|
|
10327
|
+
});
|
|
10328
|
+
relationFields.command("readback").description("Read back dataset relationFields evidence using the unified readback shape").requiredOption("--id <id>", "Remote dataset id").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (options) => {
|
|
10329
|
+
const configData = await loadConfig();
|
|
10330
|
+
const resolved = resolveProfile(configData, options.profile);
|
|
10331
|
+
const result = await readbackConfigDomain(configData, resolved, "dataset", options.id);
|
|
10332
|
+
await saveConfig(configData);
|
|
10333
|
+
printResult(options.format, result);
|
|
10334
|
+
});
|
|
10069
10335
|
[
|
|
10070
10336
|
["publish", "Publish/start a dataset and trigger ES batch generation"],
|
|
10071
10337
|
["pause", "Pause a published or pending dataset"],
|