@unbrained/pm-cli 2026.8.23 → 2026.8.25
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/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +27 -1
- package/dist/cli/description-stdin.js +5 -4
- package/dist/cli/extension-command-help.d.ts +5 -0
- package/dist/cli/extension-command-help.js +6 -2
- package/dist/cli/help-content.d.ts +5 -0
- package/dist/cli/help-content.js +56 -3
- package/dist/cli/help-json-payload.d.ts +5 -2
- package/dist/cli/help-json-payload.js +57 -17
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +28 -3
- package/dist/cli/register-annotations.js +5 -5
- package/dist/cli/register-mutation.js +73 -27
- package/dist/cli-bundle/bundle-manifest.json +152 -152
- package/dist/cli-bundle/chunks/{chunk-HWZ6CELB.js → chunk-244MI4GS.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-QDVHNHAQ.js → chunk-2F3LUFMW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-EG6CLDZT.js → chunk-5I5RWIJC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-KPH73XXJ.js → chunk-65MHLHAA.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-6C7GIMIL.js +13 -0
- package/dist/cli-bundle/chunks/chunk-OWHNAR2B.js +2 -0
- package/dist/cli-bundle/chunks/chunk-QKGMHGEI.js +202 -0
- package/dist/cli-bundle/chunks/chunk-QLUORNIB.js +2092 -0
- package/dist/cli-bundle/chunks/{chunk-JB4KZWBF.js → chunk-T2ENPRXF.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-F3AI2JFL.js → chunk-TPQIBSL2.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-YQMYF3YD.js +35 -0
- package/dist/cli-bundle/chunks/{register-list-query-UJB5FMV2.js → register-list-query-XVN2ZLI7.js} +2 -2
- package/dist/cli-bundle/chunks/register-mutation-QCKAEGIJ.js +20 -0
- package/dist/cli-bundle/chunks/{register-operations-RXIJIYXC.js → register-operations-SDEAXE7E.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-GFUZEKRE.js → register-setup-LXVBRCJ3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-QGFNI65N.js → chunk-2UIWOP3O.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-42S3GGZ7.js +50 -0
- package/dist/cli-bundle/focused-chunks/{chunk-OGLQBL46.js → chunk-7I23XGWO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-7YCDTCBC.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-OFVUGTLJ.js → chunk-A644DUFQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-AUFH5H35.js → chunk-GQR3WH3F.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3UPTYG44.js → chunk-H5JZEIQV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-IBZZZGK3.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-LMKG3DFE.js +5 -0
- package/dist/cli-bundle/focused-chunks/{chunk-LYVSW5VM.js → chunk-N7W67YIG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-37Z4OEAP.js → chunk-NOOZGIXP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FZS4H32O.js → chunk-OHIHZ7HS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ONYQCALA.js +19 -0
- package/dist/cli-bundle/focused-chunks/chunk-OVJL6NZE.js +4 -0
- package/dist/cli-bundle/focused-chunks/chunk-RAFKLNZX.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-IFLWKY2R.js → chunk-VXWATRFL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-R27IDGHD.js → chunk-XUQPEKRN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JOWDB2MH.js → chunk-YO3ZF3FI.js} +2 -2
- package/dist/cli-bundle/main.js +18 -17
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +32 -32
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +32 -33
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +6 -5
- package/dist/core/diagnostics/remediation.js +17 -2
- package/dist/core/extensions/command-metadata-contract.d.ts +10 -0
- package/dist/core/extensions/command-metadata-contract.js +23 -0
- package/dist/core/extensions/command-visibility-tier.js +12 -2
- package/dist/core/extensions/extension-types.d.ts +6 -0
- package/dist/core/extensions/extension-types.js +2 -2
- package/dist/core/extensions/loader.js +4 -3
- package/dist/core/io/body-file.js +7 -2
- package/dist/core/io/bulk-ids-input.d.ts +24 -0
- package/dist/core/io/bulk-ids-input.js +113 -0
- package/dist/core/item/parse.d.ts +22 -2
- package/dist/core/item/parse.js +97 -4
- package/dist/mcp/server.d.ts +3 -2
- package/dist/mcp/server.js +16 -9
- package/dist/sdk/agent/refusal-closure-census.d.ts +66 -0
- package/dist/sdk/agent/refusal-closure-census.js +144 -0
- package/dist/sdk/agent-capability-contracts.d.ts +34 -1
- package/dist/sdk/agent-capability-contracts.js +104 -6
- package/dist/sdk/annotations.d.ts +2 -0
- package/dist/sdk/annotations.js +25 -7
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +10 -0
- package/dist/sdk/cli-contracts/runtime-contracts.js +20 -3
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +38 -2
- package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +4 -1
- package/dist/sdk/cli-contracts/typed-action-inputs.js +2 -2
- package/dist/sdk/comments.js +15 -7
- package/dist/sdk/flag-invocation-contracts.d.ts +2 -0
- package/dist/sdk/flag-invocation-contracts.js +28 -3
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +109 -52
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +62 -2
- package/dist/sdk/governance/health.js +98 -11
- package/dist/sdk/governance/validate.js +15 -9
- package/dist/sdk/guide-topics.d.ts +0 -5
- package/dist/sdk/guide-topics.js +28 -2
- package/dist/sdk/history-compact.d.ts +2 -1
- package/dist/sdk/history-compact.js +24 -5
- package/dist/sdk/history-mcp.js +11 -10
- package/dist/sdk/history-repair.d.ts +24 -0
- package/dist/sdk/history-repair.js +145 -4
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +3 -2
- package/dist/sdk/item-transaction.js +19 -12
- package/dist/sdk/lifecycle/append.js +4 -4
- package/dist/sdk/lifecycle/close-many.js +16 -7
- package/dist/sdk/lifecycle/create.js +29 -21
- package/dist/sdk/lifecycle/plan.js +24 -6
- package/dist/sdk/lifecycle/update-many.js +15 -8
- package/dist/sdk/lifecycle/update.d.ts +2 -0
- package/dist/sdk/lifecycle/update.js +34 -24
- package/dist/sdk/merge/driver.js +25 -4
- package/dist/sdk/merge/receipt-file-boundary.d.ts +21 -0
- package/dist/sdk/merge/receipt-file-boundary.js +47 -0
- package/dist/sdk/merge/receipts.d.ts +24 -1
- package/dist/sdk/merge/receipts.js +342 -36
- package/dist/sdk/merge/reconcile.js +117 -47
- package/dist/sdk/read-output/continuation.d.ts +15 -2
- package/dist/sdk/read-output/continuation.js +86 -6
- package/dist/sdk/read-output-contracts.d.ts +4 -1
- package/dist/sdk/read-output-contracts.js +9 -6
- package/dist/sdk/runtime-extended-actions.js +5 -3
- package/dist/sdk/runtime-input.d.ts +4 -0
- package/dist/sdk/runtime-input.js +98 -23
- package/dist/sdk/runtime-primitives.d.ts +2 -1
- package/dist/sdk/runtime-primitives.js +4 -3
- package/dist/sdk/runtime.js +7 -20
- package/dist/sdk/scheduling-shortcuts.js +5 -3
- package/dist/sdk/structured-mutations.js +10 -3
- package/dist/sdk/workspace-contracts.d.ts +3 -0
- package/dist/sdk/workspace-contracts.js +3 -2
- package/docs/MERGE_SAFETY.md +34 -5
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +13 -1
- package/docs/README.md +2 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +25 -2
- package/docs/RELEASING.md +40 -21
- package/docs/SCRIPTING.md +62 -3
- package/docs/SDK.md +8 -0
- package/docs/generated/AGENT_CAPABILITY_ROUTING.md +17 -0
- package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -1
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +359 -0
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/README.md +9 -11
- package/packages/pm-command-kit/extensions/command-kit/index.ts +3 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/extensions/guide-shell/index.ts +10 -0
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/scripts/generate-agent-capability-surfaces.mjs +27 -1
- package/sdk/public-surface.json +351 -26
- package/dist/cli-bundle/chunks/chunk-3ENVHX6C.js +0 -36
- package/dist/cli-bundle/chunks/chunk-DW2CGEMU.js +0 -2
- package/dist/cli-bundle/chunks/chunk-HZBMLSZI.js +0 -201
- package/dist/cli-bundle/chunks/chunk-KXPMB2YL.js +0 -2092
- package/dist/cli-bundle/chunks/chunk-TFI5V5N2.js +0 -13
- package/dist/cli-bundle/chunks/register-mutation-NX5XE4VX.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-5S7E72FY.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-E7X25GC3.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-FQCSTBWE.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-MRCNF3U6.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-OY7QAV4Y.js +0 -51
- package/dist/cli-bundle/focused-chunks/chunk-UYRFYCDQ.js +0 -5
- package/dist/cli-bundle/focused-chunks/chunk-ZHVA42R5.js +0 -18
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* Implements the pm history repair command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7a21ee76-ed53-57a0-9776-c787297ed7b6")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "./environment/tracker-preflight.js";
|
|
9
|
+
import { realpath } from "node:fs/promises";
|
|
10
|
+
import path from "node:path";
|
|
9
11
|
import jsonPatch from "fast-json-patch";
|
|
10
12
|
import { patchPathToChangedField } from "../core/history/history-diff.js";
|
|
11
13
|
import { pathExists, readFileIfExists } from "../core/fs/fs-utils.js";
|
|
@@ -19,11 +21,13 @@ import { EXIT_CODE } from "../core/shared/constants.js";
|
|
|
19
21
|
import { PmCliError } from "../core/shared/errors.js";
|
|
20
22
|
import { resolveAuthor } from "../core/shared/author.js";
|
|
21
23
|
import { nowIso } from "../core/shared/time.js";
|
|
24
|
+
import { sha256Hex, stableStringify } from "../core/shared/serialization.js";
|
|
22
25
|
import { getActiveExtensionRegistrations, runActiveOnWriteHooks, } from "../core/extensions/index.js";
|
|
23
26
|
import { listAllItemMetadataWithBody, readLocatedItem, } from "../core/store/item-store.js";
|
|
24
27
|
import { resolvePmRoot } from "../core/store/paths.js";
|
|
25
28
|
import { readSettings } from "../core/store/settings.js";
|
|
26
29
|
import { resolveHistorySubject } from "./history-redact.js";
|
|
30
|
+
import { summarizeMergeReceipt, } from "./merge/receipts.js";
|
|
27
31
|
import { listInvalidProvenanceHistoryStreamIds, normalizeInvalidHistoryProvenance, } from "./governance/provenance-health.js";
|
|
28
32
|
function replayFieldValue(document, field) {
|
|
29
33
|
return field === "body"
|
|
@@ -135,6 +139,130 @@ export function analyzeReconciliationDiscard(entries, finalReplay, currentItemRe
|
|
|
135
139
|
: null,
|
|
136
140
|
};
|
|
137
141
|
}
|
|
142
|
+
async function canonicalRealPath(value) {
|
|
143
|
+
try {
|
|
144
|
+
return await realpath(value);
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
async function verifyReceiptAgainstSnapshot(params) {
|
|
151
|
+
if (params.receipt.evidence_source !== "clone_local")
|
|
152
|
+
return null;
|
|
153
|
+
const receiptPath = await canonicalRealPath(path.resolve(params.gitWorkspaceRoot, params.receipt.item_path));
|
|
154
|
+
if (receiptPath !== params.currentPath)
|
|
155
|
+
return null;
|
|
156
|
+
const declaredFields = [
|
|
157
|
+
...new Set([
|
|
158
|
+
...params.receipt.fields_from_theirs,
|
|
159
|
+
...params.receipt.union_fields,
|
|
160
|
+
...params.receipt.decisions.map((decision) => decision.field),
|
|
161
|
+
]),
|
|
162
|
+
].sort((left, right) => left.localeCompare(right));
|
|
163
|
+
const hashes = params.receipt.merged_field_hashes;
|
|
164
|
+
if (!hashes || declaredFields.length === 0)
|
|
165
|
+
return null;
|
|
166
|
+
const hashFields = Object.keys(hashes).sort((left, right) => left.localeCompare(right));
|
|
167
|
+
if (declaredFields.length !== hashFields.length ||
|
|
168
|
+
declaredFields.some((field, index) => field !== hashFields[index])) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
const currentMetadata = params.currentItemReplay.metadata;
|
|
172
|
+
const valuesMatch = declaredFields.every((field) => {
|
|
173
|
+
const value = field === "body" ? params.currentItemReplay.body : currentMetadata[field];
|
|
174
|
+
return hashes[field] === sha256Hex(stableStringify(value));
|
|
175
|
+
});
|
|
176
|
+
return valuesMatch ? { receipt: params.receipt, declaredFields } : null;
|
|
177
|
+
}
|
|
178
|
+
async function verifyMergeReceiptProof(params) {
|
|
179
|
+
if (params.proof.gitWorkspaceRoot === null) {
|
|
180
|
+
return {
|
|
181
|
+
trusted: false,
|
|
182
|
+
reason: "git_workspace_unavailable",
|
|
183
|
+
receipt_ids: [],
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
if (params.itemPath === null || params.currentItemReplay === null) {
|
|
187
|
+
return {
|
|
188
|
+
trusted: false,
|
|
189
|
+
reason: "item_path_unavailable",
|
|
190
|
+
receipt_ids: [],
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const itemReceipts = params.proof.receipts.filter((receipt) => receipt.item_id === params.id);
|
|
194
|
+
if (itemReceipts.length === 0) {
|
|
195
|
+
return { trusted: false, reason: "no_item_receipts", receipt_ids: [] };
|
|
196
|
+
}
|
|
197
|
+
const currentPath = await realpath(params.itemPath);
|
|
198
|
+
const trustedReceipts = [];
|
|
199
|
+
for (const receipt of itemReceipts) {
|
|
200
|
+
const trusted = await verifyReceiptAgainstSnapshot({
|
|
201
|
+
receipt,
|
|
202
|
+
gitWorkspaceRoot: params.proof.gitWorkspaceRoot,
|
|
203
|
+
currentPath,
|
|
204
|
+
currentItemReplay: params.currentItemReplay,
|
|
205
|
+
});
|
|
206
|
+
if (trusted)
|
|
207
|
+
trustedReceipts.push(trusted);
|
|
208
|
+
}
|
|
209
|
+
const trustedFields = new Set(trustedReceipts.flatMap(({ declaredFields }) => declaredFields));
|
|
210
|
+
const reconciliationFields = params.reconciliation?.reconciled_fields;
|
|
211
|
+
if (trustedReceipts.length > 0 &&
|
|
212
|
+
(reconciliationFields === undefined ||
|
|
213
|
+
(reconciliationFields.length > 0 &&
|
|
214
|
+
reconciliationFields.every((field) => trustedFields.has(field))))) {
|
|
215
|
+
return {
|
|
216
|
+
trusted: true,
|
|
217
|
+
reason: "trusted_clone_local_driver_evidence",
|
|
218
|
+
receipt_ids: trustedReceipts.map(({ receipt }) => receipt.id),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
trusted: false,
|
|
223
|
+
reason: "no_receipt_set_proves_snapshot",
|
|
224
|
+
receipt_ids: [],
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
async function resolveHistoryRepairMergeEvidence(params) {
|
|
228
|
+
const subjectMergeReceipts = params.options.mergeReceiptProof?.receipts.filter((receipt) => receipt.item_id === params.subjectId) ?? [];
|
|
229
|
+
const mergeReceiptProof = params.options.mergeReceiptProof
|
|
230
|
+
? await verifyMergeReceiptProof({
|
|
231
|
+
proof: {
|
|
232
|
+
...params.options.mergeReceiptProof,
|
|
233
|
+
receipts: subjectMergeReceipts,
|
|
234
|
+
},
|
|
235
|
+
id: params.subjectId,
|
|
236
|
+
itemPath: params.itemReplayContext.currentItemPath,
|
|
237
|
+
currentItemReplay: params.itemReplayContext.currentItemReplay,
|
|
238
|
+
reconciliation: params.reconciliation,
|
|
239
|
+
})
|
|
240
|
+
: undefined;
|
|
241
|
+
if (mergeReceiptProof &&
|
|
242
|
+
!mergeReceiptProof.trusted &&
|
|
243
|
+
params.options.dryRun !== true &&
|
|
244
|
+
params.options.force !== true) {
|
|
245
|
+
throw new PmCliError(`Merge receipt evidence for ${params.subjectId} does not prove the exact item snapshot (${mergeReceiptProof.reason}).`, EXIT_CODE.CONFLICT, {
|
|
246
|
+
code: "merge_reconcile_receipt_evidence_untrusted",
|
|
247
|
+
required: "Use clone-local driver evidence whose canonical path, declared fields, and merged-value hashes match the current item, or review the mismatch and rerun with --force.",
|
|
248
|
+
recovery: { suggested_retry: "pm merge reconcile --dry-run" },
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
const provenMergeReceipts = mergeReceiptProof?.trusted
|
|
252
|
+
? subjectMergeReceipts.filter((receipt) => mergeReceiptProof.receipt_ids.includes(receipt.id))
|
|
253
|
+
: [];
|
|
254
|
+
return {
|
|
255
|
+
mergeReceiptProof,
|
|
256
|
+
effectiveAuditContext: provenMergeReceipts.length > 0 && params.options.force !== true
|
|
257
|
+
? {
|
|
258
|
+
...params.options.auditContext,
|
|
259
|
+
merge: {
|
|
260
|
+
receipts: provenMergeReceipts.map(summarizeMergeReceipt),
|
|
261
|
+
},
|
|
262
|
+
}
|
|
263
|
+
: params.options.auditContext,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
138
266
|
async function loadHistoryRepairItemReplay(subject, settings, historyEntries, itemHashVersion) {
|
|
139
267
|
const currentItemPath = subject.located?.itemPath ?? null;
|
|
140
268
|
const loadedItem = subject.located
|
|
@@ -275,6 +403,12 @@ export async function runHistoryRepair(id, options, global) {
|
|
|
275
403
|
const reconciliation = reconcileNeeded && itemReplayContext.currentItemReplay
|
|
276
404
|
? analyzeReconciliationDiscard(reanchor.entries, finalReplay, itemReplayContext.currentItemReplay)
|
|
277
405
|
: undefined;
|
|
406
|
+
const { mergeReceiptProof, effectiveAuditContext } = await resolveHistoryRepairMergeEvidence({
|
|
407
|
+
options,
|
|
408
|
+
subjectId: subject.id,
|
|
409
|
+
itemReplayContext,
|
|
410
|
+
reconciliation,
|
|
411
|
+
});
|
|
278
412
|
const changed = [
|
|
279
413
|
reanchor.entriesRehashed > 0,
|
|
280
414
|
reanchor.entriesPatchRepaired > 0,
|
|
@@ -301,10 +435,10 @@ export async function runHistoryRepair(id, options, global) {
|
|
|
301
435
|
auditOperation: options.auditOperation ?? "history_repair",
|
|
302
436
|
auditContext: provenanceNormalization.receipt.changed
|
|
303
437
|
? {
|
|
304
|
-
...
|
|
438
|
+
...effectiveAuditContext,
|
|
305
439
|
provenance_normalization: provenanceNormalization.receipt,
|
|
306
440
|
}
|
|
307
|
-
:
|
|
441
|
+
: effectiveAuditContext,
|
|
308
442
|
itemHashVersion,
|
|
309
443
|
explicitItemHashVersion: reanchor.explicitItemHashVersion,
|
|
310
444
|
});
|
|
@@ -360,6 +494,7 @@ export async function runHistoryRepair(id, options, global) {
|
|
|
360
494
|
...provenanceNormalization.receipt,
|
|
361
495
|
},
|
|
362
496
|
...(reconciliation ? { reconciliation } : {}),
|
|
497
|
+
...(mergeReceiptProof ? { merge_receipt_proof: mergeReceiptProof } : {}),
|
|
363
498
|
warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),
|
|
364
499
|
generated_at: nowIso(),
|
|
365
500
|
};
|
|
@@ -397,6 +532,9 @@ export async function runHistoryRepairAll(options, global) {
|
|
|
397
532
|
...options,
|
|
398
533
|
auditContext: options.auditContextById?.[driftedId],
|
|
399
534
|
auditContextById: undefined,
|
|
535
|
+
mergeReceiptProof: options.mergeReceiptProofById?.[driftedId] ??
|
|
536
|
+
options.mergeReceiptProof,
|
|
537
|
+
mergeReceiptProofById: undefined,
|
|
400
538
|
}, global);
|
|
401
539
|
/* c8 ignore next -- mixed repaired/clean outcomes depend on live drift composition. */
|
|
402
540
|
const outcome = result.changed ? "repaired" : "skipped_clean";
|
|
@@ -411,6 +549,9 @@ export async function runHistoryRepairAll(options, global) {
|
|
|
411
549
|
...(result.reconciliation
|
|
412
550
|
? { reconciliation: result.reconciliation }
|
|
413
551
|
: {}),
|
|
552
|
+
...(result.merge_receipt_proof
|
|
553
|
+
? { merge_receipt_proof: result.merge_receipt_proof }
|
|
554
|
+
: {}),
|
|
414
555
|
warnings: result.warnings,
|
|
415
556
|
});
|
|
416
557
|
}
|
|
@@ -440,4 +581,4 @@ export async function runHistoryRepairAll(options, global) {
|
|
|
440
581
|
};
|
|
441
582
|
}
|
|
442
583
|
//# sourceMappingURL=history-repair.js.map
|
|
443
|
-
//# debugId=
|
|
584
|
+
//# debugId=7a21ee76-ed53-57a0-9776-c787297ed7b6
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -124,6 +124,7 @@ export * from "./error-runtime.js";
|
|
|
124
124
|
export * from "./error-code-catalog.js";
|
|
125
125
|
export * from "./generated-error-code-catalog.js";
|
|
126
126
|
export * from "./agent/refusal-reachability.js";
|
|
127
|
+
export * from "./agent/refusal-closure-census.js";
|
|
127
128
|
export * from "./agent/refusal-closure.js";
|
|
128
129
|
export * from "./agent/closed-domain-contracts.js";
|
|
129
130
|
export * from "./agent/refusal-corpus-contracts.js";
|
package/dist/sdk/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Defines public SDK APIs and package-author helpers for Index.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="805c081a-a781-50c3-8919-81492208913b")}catch(e){}}();
|
|
8
8
|
export { PM_COMMAND_CAPABILITY_CONTRACTS, PM_COMMAND_VISIBILITY_CONTRACTS, PM_MCP_PROMPT_CONTRACTS, PM_MCP_RESOURCE_CONTRACTS, PM_MCP_TOOL_COMMAND_CONTRACTS, listPmCommandsForFamily, listPmCommandsForTier, listPmMcpToolsForProfile, renderPmCommandVisibilityMarkdown, resolvePmCommandCapabilityFamily, resolvePmCommandVisibilityTier, } from "./agent-capability-contracts.js";
|
|
9
9
|
export * from "./cli-contracts/grammar-contracts.js";
|
|
10
10
|
export * from "./agent-session-context.js";
|
|
@@ -121,6 +121,7 @@ export * from "./error-runtime.js";
|
|
|
121
121
|
export * from "./error-code-catalog.js";
|
|
122
122
|
export * from "./generated-error-code-catalog.js";
|
|
123
123
|
export * from "./agent/refusal-reachability.js";
|
|
124
|
+
export * from "./agent/refusal-closure-census.js";
|
|
124
125
|
export * from "./agent/refusal-closure.js";
|
|
125
126
|
export * from "./agent/closed-domain-contracts.js";
|
|
126
127
|
export * from "./agent/refusal-corpus-contracts.js";
|
|
@@ -166,4 +167,4 @@ export * from "./governance.js";
|
|
|
166
167
|
export * from "./query.js";
|
|
167
168
|
export * from "./testing.js";
|
|
168
169
|
//# sourceMappingURL=index.js.map
|
|
169
|
-
//# debugId=
|
|
170
|
+
//# debugId=805c081a-a781-50c3-8919-81492208913b
|
|
@@ -6,15 +6,22 @@
|
|
|
6
6
|
* with correct-by-construction inspection and compensation wiring.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
9
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ea10685a-3187-533c-9699-73c23d377705")}catch(e){}}();
|
|
10
10
|
import crypto from "node:crypto";
|
|
11
11
|
import path from "node:path";
|
|
12
|
+
import { transferMutationStdinTokenPolicy, } from "../core/item/parse.js";
|
|
12
13
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
13
14
|
import { PmCliError } from "../core/shared/errors.js";
|
|
14
15
|
import { stableStringify } from "../core/shared/serialization.js";
|
|
15
16
|
import { readHistoryEntries } from "./history-read.js";
|
|
16
17
|
import { close, create, deleteItem, get, release, restore, update, } from "./runtime.js";
|
|
17
18
|
import { commitWorkspaceTransaction, } from "./workspace-transaction.js";
|
|
19
|
+
function mergeTransactionMutationOptions(source, additions) {
|
|
20
|
+
const merged = { ...source, ...additions };
|
|
21
|
+
return source === undefined
|
|
22
|
+
? merged
|
|
23
|
+
: transferMutationStdinTokenPolicy(source, merged);
|
|
24
|
+
}
|
|
18
25
|
/** Read one item's transaction-relevant fields, mapping not-found to undefined. */
|
|
19
26
|
async function readItemSnapshot(pmRoot, id) {
|
|
20
27
|
try {
|
|
@@ -112,7 +119,10 @@ function buildCreateStep(config, mutation, stepId) {
|
|
|
112
119
|
return { state: "applied", result: { id: snapshot.id, op: "create" } };
|
|
113
120
|
},
|
|
114
121
|
async apply() {
|
|
115
|
-
const created = await create(
|
|
122
|
+
const created = await create(mergeTransactionMutationOptions(mutation.options, {
|
|
123
|
+
author: config.author,
|
|
124
|
+
id: mutation.id,
|
|
125
|
+
}), { pmRoot: config.pmRoot });
|
|
116
126
|
const createdItem = created.item;
|
|
117
127
|
return { id: String(createdItem.id), op: "create" };
|
|
118
128
|
},
|
|
@@ -155,11 +165,10 @@ function buildUpdateStep(config, mutation, stepId) {
|
|
|
155
165
|
return prepareRestoreCompensation(config.pmRoot, mutation);
|
|
156
166
|
},
|
|
157
167
|
async apply() {
|
|
158
|
-
const updated = await update(mutation.id, {
|
|
159
|
-
...mutation.options,
|
|
168
|
+
const updated = await update(mutation.id, mergeTransactionMutationOptions(mutation.options, {
|
|
160
169
|
author: config.author,
|
|
161
170
|
message: bulkHistoryMarker(config.transactionId, stepId, "apply"),
|
|
162
|
-
}, { pmRoot: config.pmRoot });
|
|
171
|
+
}), { pmRoot: config.pmRoot });
|
|
163
172
|
const updatedItem = updated.item;
|
|
164
173
|
return { id: String(updatedItem.id), op: "update" };
|
|
165
174
|
},
|
|
@@ -191,11 +200,10 @@ function buildCloseStep(config, mutation, stepId) {
|
|
|
191
200
|
return prepareRestoreCompensation(config.pmRoot, mutation);
|
|
192
201
|
},
|
|
193
202
|
async apply() {
|
|
194
|
-
const closed = await close(mutation.id, mutation.reason, {
|
|
195
|
-
...mutation.options,
|
|
203
|
+
const closed = await close(mutation.id, mutation.reason, mergeTransactionMutationOptions(mutation.options, {
|
|
196
204
|
author: config.author,
|
|
197
205
|
message: bulkHistoryMarker(config.transactionId, stepId, "apply"),
|
|
198
|
-
}, { pmRoot: config.pmRoot });
|
|
206
|
+
}), { pmRoot: config.pmRoot });
|
|
199
207
|
const closedItem = closed.item;
|
|
200
208
|
return { id: String(closedItem.id), op: "close" };
|
|
201
209
|
},
|
|
@@ -226,11 +234,10 @@ function buildReleaseStep(config, mutation, stepId) {
|
|
|
226
234
|
return prepareRestoreCompensation(config.pmRoot, mutation);
|
|
227
235
|
},
|
|
228
236
|
async apply() {
|
|
229
|
-
const released = await release(mutation.id, {
|
|
230
|
-
...mutation.options,
|
|
237
|
+
const released = await release(mutation.id, mergeTransactionMutationOptions(mutation.options, {
|
|
231
238
|
author: config.author,
|
|
232
239
|
message: bulkHistoryMarker(config.transactionId, stepId, "apply"),
|
|
233
|
-
}, { pmRoot: config.pmRoot });
|
|
240
|
+
}), { pmRoot: config.pmRoot });
|
|
234
241
|
const releasedItem = released.item;
|
|
235
242
|
return { id: String(releasedItem.id), op: "release" };
|
|
236
243
|
},
|
|
@@ -387,4 +394,4 @@ export const _testOnlyItemTransaction = {
|
|
|
387
394
|
readItemSnapshot,
|
|
388
395
|
};
|
|
389
396
|
//# sourceMappingURL=item-transaction.js.map
|
|
390
|
-
//# debugId=
|
|
397
|
+
//# debugId=ea10685a-3187-533c-9699-73c23d377705
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Implements the pm append command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b4b1f63b-12f9-574c-8e92-a5cc9c6178c1")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
|
-
import { EXIT_CODE, PmCliError, resolveAuthor, toItemRecord, createStdinTokenResolver, mutateItem, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
|
|
9
|
+
import { EXIT_CODE, PmCliError, resolveAuthor, toItemRecord, createStdinTokenResolver, shouldResolveMutationStdinTokenField, mutateItem, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
|
|
10
10
|
/** Implements run append for the public runtime surface of this module. */
|
|
11
11
|
export async function runAppend(id, options, global) {
|
|
12
12
|
if (options.body === undefined) {
|
|
@@ -18,7 +18,7 @@ export async function runAppend(id, options, global) {
|
|
|
18
18
|
const settings = await readSettings(pmRoot);
|
|
19
19
|
const author = resolveAuthor(options.author, settings.author_default);
|
|
20
20
|
// options.body is guaranteed defined by the guard above, so resolveValue returns a defined string.
|
|
21
|
-
const bodyInput = await stdinResolver.resolveValue(options.body, "--body");
|
|
21
|
+
const bodyInput = await stdinResolver.resolveValue(options.body, "--body", shouldResolveMutationStdinTokenField(options, "body"));
|
|
22
22
|
const appended = bodyInput.trim();
|
|
23
23
|
if (appended.length === 0) {
|
|
24
24
|
throw new PmCliError("--body text cannot be empty; append requires non-blank content and empty appends would only rewrite updated_at.", EXIT_CODE.USAGE, {
|
|
@@ -51,4 +51,4 @@ export async function runAppend(id, options, global) {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
//# sourceMappingURL=append.js.map
|
|
54
|
-
//# debugId=
|
|
54
|
+
//# debugId=b4b1f63b-12f9-574c-8e92-a5cc9c6178c1
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm close many command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a97a3cf0-beef-5967-8f5b-2372a6c9f2f7")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
9
|
import { createCheckpointId, loadMutationCheckpoint, restoreCheckpointItems, writeMutationCheckpoint, getActiveExtensionRegistrations, isTerminalStatus, resolveItemTypeRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, PmCliError, toErrorMessage, resolveAuthor, nowIso, listAllItemMetadataLight, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
|
|
10
10
|
import { runClose } from "./close.js";
|
|
@@ -280,7 +280,14 @@ async function buildCloseManyPlanContext(params) {
|
|
|
280
280
|
.map((entry) => entry.trim())
|
|
281
281
|
.filter((entry) => entry.length > 0)),
|
|
282
282
|
];
|
|
283
|
-
const
|
|
283
|
+
const existenceItems = requestedIds.length === 0
|
|
284
|
+
? []
|
|
285
|
+
: (await runList(undefined, {
|
|
286
|
+
ids: requestedIds.join(","),
|
|
287
|
+
noTruncate: true,
|
|
288
|
+
full: true,
|
|
289
|
+
}, params.global)).items;
|
|
290
|
+
const existingIds = new Set(existenceItems.map((item) => item.id));
|
|
284
291
|
const closePlannedIds = resolveCloseManyPlannedIds(matched, statusRegistry, force);
|
|
285
292
|
return {
|
|
286
293
|
pmRoot: params.pmRoot,
|
|
@@ -291,7 +298,9 @@ async function buildCloseManyPlanContext(params) {
|
|
|
291
298
|
force,
|
|
292
299
|
listed,
|
|
293
300
|
matched,
|
|
294
|
-
unmatchedIds: requestedIds.
|
|
301
|
+
unmatchedIds: requestedIds.length === 0
|
|
302
|
+
? undefined
|
|
303
|
+
: requestedIds.filter((id) => !existingIds.has(id)),
|
|
295
304
|
planRows: planCloseManyRows(matched, childrenByParent, closePlannedIds, statusRegistry, force),
|
|
296
305
|
};
|
|
297
306
|
}
|
|
@@ -309,7 +318,7 @@ function buildCloseManyDryRunResult(context) {
|
|
|
309
318
|
: {}),
|
|
310
319
|
item_plans: context.planRows,
|
|
311
320
|
ids: [],
|
|
312
|
-
...(context.unmatchedIds
|
|
321
|
+
...(context.unmatchedIds !== undefined
|
|
313
322
|
? {
|
|
314
323
|
unmatched_ids: context.unmatchedIds,
|
|
315
324
|
unmatched_count: context.unmatchedIds.length,
|
|
@@ -392,7 +401,7 @@ export async function runCloseMany(options, global) {
|
|
|
392
401
|
applied: closedCount,
|
|
393
402
|
skipped: skippedCount,
|
|
394
403
|
failed: failedCount,
|
|
395
|
-
unmatched: context.unmatchedIds
|
|
404
|
+
unmatched: context.unmatchedIds?.length ?? 0,
|
|
396
405
|
}),
|
|
397
406
|
mode: "apply",
|
|
398
407
|
matched_count: context.matched.length,
|
|
@@ -408,7 +417,7 @@ export async function runCloseMany(options, global) {
|
|
|
408
417
|
failed_count: failedCount,
|
|
409
418
|
rows,
|
|
410
419
|
ids: closedIds,
|
|
411
|
-
...(context.unmatchedIds
|
|
420
|
+
...(context.unmatchedIds !== undefined
|
|
412
421
|
? {
|
|
413
422
|
unmatched_ids: context.unmatchedIds,
|
|
414
423
|
unmatched_count: context.unmatchedIds.length,
|
|
@@ -427,4 +436,4 @@ export const _testOnly = {
|
|
|
427
436
|
resolveReason,
|
|
428
437
|
};
|
|
429
438
|
//# sourceMappingURL=close-many.js.map
|
|
430
|
-
//# debugId=
|
|
439
|
+
//# debugId=a97a3cf0-beef-5967-8f5b-2372a6c9f2f7
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Implements the pm create command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="02c41ea1-8d4e-5239-b95a-a07210b63d7f")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
|
-
import {
|
|
9
|
+
import { resolveMutationStdinTokenFields } from "../../core/item/parse.js";
|
|
10
|
+
import { removeFileIfExists, writeFileAtomic, appendHistoryEntry, createHistoryEntry, generateItemId, normalizeItemId, canonicalDocument, normalizeItemMetadata, serializeItemDocument, assertParentReferenceIsNotSelf, isPlaceholderReferenceToken, normalizeParentReferenceValue, validateMissingParentReference, validateSprintOrReleaseValue, assertNoUnknownCsvKeys, looksLikeGenericKeyValueEntry, mergeAdditiveTags, parseCsvKv, parseOptionalNonNegativeInteger, parseOptionalNumber, parseTags, shouldResolveMutationStdinTokens, transferMutationStdinTokenPolicy, resolvePriority, getFocusedItem, normalizeStatusInput, isTerminalStatus, canonicalizeCommandOptionKey, commandOptionFlagLabel, resolveItemTypeRegistry, resolveCommandOptionPolicyState, resolveTypeDefinition, resolveTypeName, validateTypeOptions, acquireLock, printError, buildInvalidTypeError, resolveTypeSynonym, collectRuntimeCreateFieldValues, resolveItemTypesFilePath, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, ITEM_METADATA_KEY_ORDER, PmCliError, nowIso, resolveIsoOrRelative, getActiveExtensionRegistrations, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, runActiveCommandHandler, runActiveBeforeMutationHooks, runActiveOnWriteHooks, collectRegisteredItemFieldNames, applyRegisteredItemFieldDefaultsAndValidation, parseRegisteredItemFieldAssignments, listAllItemMetadataLight, locateItem, createMutationGuardSdk, getHistoryPath, getItemPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
|
|
10
11
|
import { requireTerminalReasonWithRecovery } from "../lifecycle-policy.js";
|
|
11
12
|
import { evaluateSimilarityGovernance, similarityAdvisoryWarnings, } from "../similarity.js";
|
|
12
13
|
import { acquireItemMetadataDerivedIndexLock, refreshItemMetadataDerivedIndex, } from "../item-metadata-index.js";
|
|
@@ -134,7 +135,7 @@ function normalizeLegacyNoneCreateOptions(options) {
|
|
|
134
135
|
normalized[optionKey] = undefined;
|
|
135
136
|
/* c8 ignore stop */
|
|
136
137
|
}
|
|
137
|
-
return applyLegacyNoneCollectionNormalizers(normalized, CREATE_LEGACY_NONE_COLLECTION_NORMALIZERS);
|
|
138
|
+
return transferMutationStdinTokenPolicy(options, applyLegacyNoneCollectionNormalizers(normalized, CREATE_LEGACY_NONE_COLLECTION_NORMALIZERS));
|
|
138
139
|
}
|
|
139
140
|
function parseOptionalString(value) {
|
|
140
141
|
if (value === undefined)
|
|
@@ -544,22 +545,29 @@ function parseTypeOptions(raw) {
|
|
|
544
545
|
};
|
|
545
546
|
}
|
|
546
547
|
async function resolveCreateStdinInputs(options) {
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
548
|
+
const scalarFields = [
|
|
549
|
+
["body", "--body"],
|
|
550
|
+
["description", "--description"],
|
|
551
|
+
];
|
|
552
|
+
const listFields = [
|
|
553
|
+
["dep", "--dep"],
|
|
554
|
+
["comment", "--comment"],
|
|
555
|
+
["note", "--note"],
|
|
556
|
+
["learning", "--learning"],
|
|
557
|
+
["file", "--file"],
|
|
558
|
+
["test", "--test"],
|
|
559
|
+
["doc", "--doc"],
|
|
560
|
+
["reminder", "--reminder"],
|
|
561
|
+
["event", "--event"],
|
|
562
|
+
["typeOption", "--type-option"],
|
|
563
|
+
["field", "--field"],
|
|
564
|
+
];
|
|
565
|
+
return await resolveMutationStdinTokenFields(options, scalarFields, listFields);
|
|
566
|
+
}
|
|
567
|
+
async function resolveCreateTransportInputs(options) {
|
|
568
|
+
return shouldResolveMutationStdinTokens(options)
|
|
569
|
+
? await resolveCreateStdinInputs(options)
|
|
570
|
+
: options;
|
|
563
571
|
}
|
|
564
572
|
function resolveCreateMode(createMode, defaultMode) {
|
|
565
573
|
if (createMode === undefined) {
|
|
@@ -1584,7 +1592,7 @@ async function writeCreatedItem(params) {
|
|
|
1584
1592
|
}
|
|
1585
1593
|
/** Implements run create for the public runtime surface of this module. */
|
|
1586
1594
|
export async function runCreate(options, global) {
|
|
1587
|
-
let resolvedOptions = normalizeLegacyNoneCreateOptions(await
|
|
1595
|
+
let resolvedOptions = normalizeLegacyNoneCreateOptions(await resolveCreateTransportInputs(options));
|
|
1588
1596
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
1589
1597
|
await ensureInitHasRun(pmRoot);
|
|
1590
1598
|
const settings = await readSettings(pmRoot);
|
|
@@ -1918,4 +1926,4 @@ export const _testOnlyCreateCommand = {
|
|
|
1918
1926
|
typeOptionExampleValue,
|
|
1919
1927
|
};
|
|
1920
1928
|
//# sourceMappingURL=create.js.map
|
|
1921
|
-
//# debugId=
|
|
1929
|
+
//# debugId=02c41ea1-8d4e-5239-b95a-a07210b63d7f
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Implements the pm plan command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f7e870b6-fd80-5742-bc81-826d8f102d30")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
|
-
import { getActiveExtensionRegistrations, isTerminalStatus, resolveItemTypeRegistry, resolveRuntimeStatusRegistry, resolveTypeName, EXIT_CODE, PmCliError, splitCommaList, nowIso, locateItem, mutateItem, readLocatedItem, resolvePmRoot, readSettings, resolveAuthor, isTerminalPlanMode, } from "../runtime-primitives.js";
|
|
9
|
+
import { getActiveExtensionRegistrations, isTerminalStatus, resolveItemTypeRegistry, resolveRuntimeStatusRegistry, resolveTypeName, EXIT_CODE, PmCliError, splitCommaList, nowIso, locateItem, mutateItem, readLocatedItem, resolvePmRoot, readSettings, resolveAuthor, isTerminalPlanMode, preserveMutationStdinTokenFields, transferMutationStdinTokenPolicy, } from "../runtime-primitives.js";
|
|
10
10
|
import { PLAN_HARNESS_VALUES, PLAN_MODE_VALUES, PLAN_STEP_LINK_KIND_VALUES, PLAN_STEP_STATUS_VALUES, } from "../../types/index.js";
|
|
11
11
|
import { runCreate, } from "./create.js";
|
|
12
12
|
import { createUnknownSubcommandError } from "../agent/subcommand-recovery.js";
|
|
@@ -692,6 +692,12 @@ function buildInitialSteps(options) {
|
|
|
692
692
|
hasPerStepDetailOptions: hasDetailOptions,
|
|
693
693
|
};
|
|
694
694
|
}
|
|
695
|
+
function preservePlanCreateStdinPolicy(source, createOptions, derivedLiteralFields = []) {
|
|
696
|
+
transferMutationStdinTokenPolicy(source, createOptions);
|
|
697
|
+
if (derivedLiteralFields.length > 0) {
|
|
698
|
+
preserveMutationStdinTokenFields(createOptions, derivedLiteralFields);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
695
701
|
async function planCreate(options, global, ctx) {
|
|
696
702
|
const title = options.title?.trim();
|
|
697
703
|
if (!title) {
|
|
@@ -738,6 +744,7 @@ async function planCreate(options, global, ctx) {
|
|
|
738
744
|
message: options.message ??
|
|
739
745
|
(fromSearch ? `plan create (search: ${fromSearch})` : `plan create`),
|
|
740
746
|
};
|
|
747
|
+
preservePlanCreateStdinPolicy(options, createOptions);
|
|
741
748
|
const createResult = await runCreate(createOptions, global);
|
|
742
749
|
// Seed every Plan-specific field before assigning the requested owner so
|
|
743
750
|
// cross-owner creation cannot reject a follow-up enrichment and leave a
|
|
@@ -1380,7 +1387,7 @@ async function createMaterializedStepItems(params) {
|
|
|
1380
1387
|
materializeFields[fieldKey] = value;
|
|
1381
1388
|
}
|
|
1382
1389
|
for (const step of params.targets) {
|
|
1383
|
-
const
|
|
1390
|
+
const createOptions = {
|
|
1384
1391
|
...materializeFields,
|
|
1385
1392
|
title: step.title,
|
|
1386
1393
|
description: step.body?.trim() || step.title,
|
|
@@ -1391,7 +1398,15 @@ async function createMaterializedStepItems(params) {
|
|
|
1391
1398
|
message: params.options.message ??
|
|
1392
1399
|
`materialized from plan ${params.planItemId} step ${step.id}`,
|
|
1393
1400
|
dep: buildMaterializeDependencies(params.parent, params.planItemId, step),
|
|
1394
|
-
}
|
|
1401
|
+
};
|
|
1402
|
+
preservePlanCreateStdinPolicy(params.options, createOptions, [
|
|
1403
|
+
"description",
|
|
1404
|
+
...Object.keys(materializeFields),
|
|
1405
|
+
]);
|
|
1406
|
+
const created = await runCreate(createOptions, {
|
|
1407
|
+
...{},
|
|
1408
|
+
path: params.pmRoot,
|
|
1409
|
+
});
|
|
1395
1410
|
materialized.push({
|
|
1396
1411
|
id: created.item.id,
|
|
1397
1412
|
title: created.item.title,
|
|
@@ -1489,7 +1504,10 @@ function normalizePlanStepAliasInput(input) {
|
|
|
1489
1504
|
if (stepValues.length === 1 && !input.options.stepTitle?.trim()) {
|
|
1490
1505
|
return {
|
|
1491
1506
|
...input,
|
|
1492
|
-
options:
|
|
1507
|
+
options: transferMutationStdinTokenPolicy(input.options, {
|
|
1508
|
+
...input.options,
|
|
1509
|
+
stepTitle: stepValues[0],
|
|
1510
|
+
}),
|
|
1493
1511
|
};
|
|
1494
1512
|
}
|
|
1495
1513
|
return input;
|
|
@@ -1586,4 +1604,4 @@ export const _testOnlyPlanCommand = {
|
|
|
1586
1604
|
changedPlanMetadataFields,
|
|
1587
1605
|
};
|
|
1588
1606
|
//# sourceMappingURL=plan.js.map
|
|
1589
|
-
//# debugId=
|
|
1607
|
+
//# debugId=f7e870b6-fd80-5742-bc81-826d8f102d30
|