@unbrained/pm-cli 2026.8.31 → 2026.9.2
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/AGENTS.md +15 -13
- package/CHANGELOG.md +33 -6
- package/README.md +3 -3
- package/dist/cli/commands/merge.d.ts +1 -1
- package/dist/cli/commands/merge.js +3 -3
- package/dist/cli/register-mutation.js +8 -5
- package/dist/cli-bundle/bundle-manifest.json +129 -129
- package/dist/cli-bundle/chunks/{chunk-52JXYSDW.js → chunk-3WICXLVT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JIFYOJF7.js → chunk-DTGWEL23.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-SXMHPK4V.js → chunk-FZ4Z2J4F.js} +4 -4
- package/dist/cli-bundle/chunks/chunk-GOACULJW.js +13 -0
- package/dist/cli-bundle/chunks/{chunk-NW6LV3TU.js → chunk-NOPL37X4.js} +64 -64
- package/dist/cli-bundle/chunks/{chunk-OUGDA7NR.js → chunk-T6H5BZCP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-IEFJ3ZEB.js → chunk-TAG4VC22.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-MWIN6OH2.js → chunk-UDW64J2W.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5DH5XCJL.js → chunk-X4RCGLTX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QZCIBZR3.js → chunk-Y7VOMSZT.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-ZLJIFSOE.js +35 -0
- package/dist/cli-bundle/chunks/{register-list-query-7C7DKZ2U.js → register-list-query-XYNX4ASQ.js} +2 -2
- package/dist/cli-bundle/chunks/register-mutation-WFQ7MJTX.js +20 -0
- package/dist/cli-bundle/chunks/{register-operations-IIMA5OKO.js → register-operations-JVTI7JPP.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-52H36QCB.js → register-setup-KVNC5KPL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-VJ7EFMFL.js → chunk-242AXYB2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-7VATS5QY.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-FOMZ6NG5.js → chunk-MKHG3T76.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JCOOAUHK.js → chunk-O67VDLOT.js} +48 -48
- package/dist/cli-bundle/focused-chunks/{chunk-UN34D63M.js → chunk-PF3E6Q36.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-APN4QN6R.js → chunk-RMRCQPWU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BPWJ4QM5.js → chunk-S4U5CN5Q.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-T2LXXSOD.js +158 -0
- package/dist/cli-bundle/main.js +2 -2
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +25 -25
- 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 -32
- 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 +10 -10
- package/dist/core/diagnostics/remediation.js +9 -4
- package/dist/core/history/drift-scan.js +6 -6
- package/dist/core/history/history.d.ts +6 -0
- package/dist/core/history/history.js +47 -5
- package/dist/core/history/replay.d.ts +12 -1
- package/dist/core/history/replay.js +60 -39
- package/dist/mcp/server.d.ts +2 -2
- package/dist/mcp/server.js +78 -15
- package/dist/mcp/tool-definitions.js +56 -2
- package/dist/sdk/agent-capability-contracts.js +4 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +14 -2
- package/dist/sdk/governance/health.js +77 -11
- package/dist/sdk/governance/validate.js +4 -2
- package/dist/sdk/history-read.js +14 -6
- package/dist/sdk/history-repair.js +17 -10
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +3 -2
- package/dist/sdk/init-agent-guidance.js +4 -4
- package/dist/sdk/lifecycle/update.js +23 -10
- package/dist/sdk/mcp/discovery.d.ts +152 -0
- package/dist/sdk/mcp/discovery.js +495 -0
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +3 -3
- package/dist/sdk/merge/receipts.d.ts +51 -1
- package/dist/sdk/merge/receipts.js +146 -35
- package/dist/sdk/merge/three-way.d.ts +3 -1
- package/dist/sdk/merge/three-way.js +9 -7
- package/dist/sdk/runtime-extended-actions.js +4 -4
- package/docs/AGENT_GUIDE.md +11 -3
- package/docs/ARCHITECTURE.md +5 -0
- package/docs/CLAUDE_CODE_PLUGIN.md +2 -2
- package/docs/CONTEXT_RECOVERY_PRIMITIVES.md +24 -6
- package/docs/MCP_2026_07_28.md +9 -5
- package/docs/MCP_CAPABILITY_SURFACES.md +7 -1
- package/docs/MCP_REMOTE_TRANSPORT_SECURITY.md +11 -1
- package/docs/MERGE_SAFETY.md +44 -2
- package/docs/OUTPUT_TOKEN_ACCOUNTING.md +5 -3
- package/docs/PROGRESSIVE_TOOL_DISCOVERY.md +42 -0
- package/docs/README.md +1 -0
- package/docs/agent-task-token-baseline.json +157 -3
- package/docs/agent-task-transcripts.json +143 -0
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
- package/docs/performance/cli-transport-overhead.md +8 -6
- package/marketplace.json +2 -2
- package/package.json +2 -2
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -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/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-claude/README.md +4 -3
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +168 -2
- package/dist/cli-bundle/chunks/chunk-2XVV45NJ.js +0 -35
- package/dist/cli-bundle/chunks/chunk-3FCSFWZT.js +0 -13
- package/dist/cli-bundle/chunks/register-mutation-OI4BJLUX.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-BMD42PUG.js +0 -158
- package/dist/cli-bundle/focused-chunks/chunk-EUTABA4M.js +0 -16
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Defines the Tool Definitions module for pm CLI source.
|
|
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]="5ceccf7d-78cb-5750-8e4b-793efa6e716c")}catch(e){}}();
|
|
8
8
|
import { GRAPH_SUBCOMMAND_VALUES, PM_DISCOVERABLE_TOOL_ACTIONS, } from "../sdk/cli-contracts/enum-contracts.js";
|
|
9
9
|
import { buildPmActionToolInputSchema } from "../sdk/cli-contracts/tool-schema.js";
|
|
10
10
|
import { RUNTIME_STATUS_ROLE_VALUES } from "../types.js";
|
|
@@ -149,6 +149,60 @@ const RAW_TOOLS = [
|
|
|
149
149
|
...READ_OUTPUT_TOOL_PROPERTIES,
|
|
150
150
|
}, ["action"]),
|
|
151
151
|
},
|
|
152
|
+
{
|
|
153
|
+
name: "pm_discover",
|
|
154
|
+
description: "Discover the smallest relevant authorized pm tool catalog under an explicit token budget. " +
|
|
155
|
+
"Ranking is deterministic and returns public lexical, semantic, graph, permission, freshness, and usage signal explanations. " +
|
|
156
|
+
"Continue with next_cursor; set includeSchema=true only when complete input schemas are needed.",
|
|
157
|
+
inputSchema: objectSchema({
|
|
158
|
+
query: {
|
|
159
|
+
type: "string",
|
|
160
|
+
maxLength: 4096,
|
|
161
|
+
description: "Free-text capability intent. Empty text lists by stable policy order.",
|
|
162
|
+
},
|
|
163
|
+
family: {
|
|
164
|
+
type: "string",
|
|
165
|
+
enum: [
|
|
166
|
+
"workspace",
|
|
167
|
+
"intake",
|
|
168
|
+
"context",
|
|
169
|
+
"lifecycle",
|
|
170
|
+
"evidence",
|
|
171
|
+
"graph",
|
|
172
|
+
"quality",
|
|
173
|
+
"automation",
|
|
174
|
+
"extensions",
|
|
175
|
+
"internal",
|
|
176
|
+
],
|
|
177
|
+
description: "Optional stable capability-family filter.",
|
|
178
|
+
},
|
|
179
|
+
tier: {
|
|
180
|
+
type: "string",
|
|
181
|
+
enum: ["core", "standard", "full"],
|
|
182
|
+
description: "Maximum command visibility tier included in results.",
|
|
183
|
+
},
|
|
184
|
+
limit: {
|
|
185
|
+
type: "integer",
|
|
186
|
+
minimum: 1,
|
|
187
|
+
maximum: 100,
|
|
188
|
+
description: "Maximum result rows; defaults to 10.",
|
|
189
|
+
},
|
|
190
|
+
cursor: {
|
|
191
|
+
type: "string",
|
|
192
|
+
minLength: 1,
|
|
193
|
+
maxLength: 4096,
|
|
194
|
+
description: "Opaque next_cursor from an equivalent discovery request.",
|
|
195
|
+
},
|
|
196
|
+
includeSchema: {
|
|
197
|
+
type: "boolean",
|
|
198
|
+
description: "Include complete tool input schemas; false by default.",
|
|
199
|
+
},
|
|
200
|
+
outputBudget: {
|
|
201
|
+
anyOf: [{ type: "integer", minimum: 128 }, { const: "unbounded" }],
|
|
202
|
+
description: "Estimated-token ceiling; defaults to 1200.",
|
|
203
|
+
},
|
|
204
|
+
}),
|
|
205
|
+
},
|
|
152
206
|
{
|
|
153
207
|
name: "pm_context",
|
|
154
208
|
description: "Return the agent-oriented project context snapshot. " +
|
|
@@ -748,4 +802,4 @@ export function buildMcpToolContracts() {
|
|
|
748
802
|
}).sort((left, right) => left.name.localeCompare(right.name));
|
|
749
803
|
}
|
|
750
804
|
//# sourceMappingURL=tool-definitions.js.map
|
|
751
|
-
//# debugId=
|
|
805
|
+
//# debugId=5ceccf7d-78cb-5750-8e4b-793efa6e716c
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* surfaces from one public SDK contract.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
!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]="
|
|
8
|
+
!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]="f3f07ca8-7823-536d-b523-6d8f87c35f4a")}catch(e){}}();
|
|
9
9
|
import { PM_CORE_COMMAND_NAMES } from "./cli-contracts/enum-contracts.js";
|
|
10
10
|
const CORE_COMMANDS = new Set([
|
|
11
11
|
"claim",
|
|
@@ -176,6 +176,7 @@ export const PM_CORE_HELP_BUDGET = Object.freeze({
|
|
|
176
176
|
/** Root options retained in the compact progressive-disclosure help screen. */
|
|
177
177
|
export const PM_CORE_HELP_OPTION_FLAGS = Object.freeze([
|
|
178
178
|
"-V, --version",
|
|
179
|
+
"--all",
|
|
179
180
|
"--json",
|
|
180
181
|
"--output-include <fields>",
|
|
181
182
|
"--output-limit <count>",
|
|
@@ -277,6 +278,7 @@ export const PM_MCP_TOOL_COMMAND_CONTRACTS = Object.freeze({
|
|
|
277
278
|
pm_copy: "copy",
|
|
278
279
|
pm_create: "create",
|
|
279
280
|
pm_deps: "deps",
|
|
281
|
+
pm_discover: "help",
|
|
280
282
|
pm_docs: "docs",
|
|
281
283
|
pm_events: "history",
|
|
282
284
|
pm_files: "files",
|
|
@@ -424,4 +426,4 @@ export function renderPmCapabilityRoutingMarkdown(contracts = PM_COMMAND_CAPABIL
|
|
|
424
426
|
].join("\n");
|
|
425
427
|
}
|
|
426
428
|
//# sourceMappingURL=agent-capability-contracts.js.map
|
|
427
|
-
//# debugId=
|
|
429
|
+
//# debugId=f3f07ca8-7823-536d-b523-6d8f87c35f4a
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Generated partition 1 of the exhaustive error-code catalog. */
|
|
2
2
|
|
|
3
|
-
!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]="
|
|
3
|
+
!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]="4734edf6-c174-50d0-b4e9-1003bc8a20bf")}catch(e){}}();
|
|
4
4
|
export const PM_ERROR_CODE_CATALOG_PART_1 = [
|
|
5
5
|
{
|
|
6
6
|
code: "acceptance_criteria_mutation_conflict",
|
|
@@ -2076,6 +2076,18 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
|
|
|
2076
2076
|
canonical_code: "merge_receipt_evidence_invalid",
|
|
2077
2077
|
aliases: [],
|
|
2078
2078
|
},
|
|
2079
|
+
{
|
|
2080
|
+
code: "merge_receipt_history_reference_missing",
|
|
2081
|
+
meaning: "Merge receipt history reference missing condition.",
|
|
2082
|
+
stability: "provisional",
|
|
2083
|
+
exit_code: 1,
|
|
2084
|
+
class: "generic_failure",
|
|
2085
|
+
recovery: "Inspect the structured error guidance and retry the suggested command.",
|
|
2086
|
+
sources: ["core/diagnostics/remediation.ts"],
|
|
2087
|
+
emitting_commands: ["*"],
|
|
2088
|
+
canonical_code: "merge_receipt_history_reference_missing",
|
|
2089
|
+
aliases: [],
|
|
2090
|
+
},
|
|
2079
2091
|
{
|
|
2080
2092
|
code: "merge_receipts_pending",
|
|
2081
2093
|
meaning: "Merge receipts pending condition.",
|
|
@@ -2150,4 +2162,4 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
|
|
|
2150
2162
|
},
|
|
2151
2163
|
];
|
|
2152
2164
|
//# sourceMappingURL=generated-error-code-catalog-part-1.js.map
|
|
2153
|
-
//# debugId=
|
|
2165
|
+
//# debugId=4734edf6-c174-50d0-b4e9-1003bc8a20bf
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm health 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]="f27cb24d-f2c8-5034-b655-84c577de7a16")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
@@ -28,6 +28,7 @@ import { EXIT_CODE, PM_CORE_REQUIRED_SUBDIRS, TYPE_TO_FOLDER, } from "../../core
|
|
|
28
28
|
import { findFirstMergeConflictMarker } from "../../core/shared/conflict-markers.js";
|
|
29
29
|
import { PmCliError } from "../../core/shared/errors.js";
|
|
30
30
|
import { toNonEmptyStringOrUndefined } from "../../core/shared/primitives.js";
|
|
31
|
+
import { sha256Hex } from "../../core/shared/serialization.js";
|
|
31
32
|
import { nowIso } from "../../core/shared/time.js";
|
|
32
33
|
import { parseItemDocument } from "../../core/item/item-format.js";
|
|
33
34
|
import { effectiveItemFormatVersion, scanItemFormatVersions, } from "../../core/item/item-format-version.js";
|
|
@@ -46,7 +47,7 @@ import { buildCapabilityContractMetadata, buildRegistrationCollisionRemediation,
|
|
|
46
47
|
import { scanStaleInProgressItems, } from "./stale-work.js";
|
|
47
48
|
import { scanTrackedRuntimeCache } from "./tracked-runtime-cache.js";
|
|
48
49
|
import { auditMergeDriverConfiguration, findGitWorkspaceRoot, } from "../merge/install.js";
|
|
49
|
-
import { inspectMergeReceiptEvidence, partitionMergeReceipts, } from "../merge/receipts.js";
|
|
50
|
+
import { inspectMergeReceiptEvidence, isSafeReceiptId, partitionMergeReceipts, } from "../merge/receipts.js";
|
|
50
51
|
import { runHistoryRepair } from "../history-repair.js";
|
|
51
52
|
import { resolveWorkspaceRelationshipKindRegistry } from "../graph/assembly.js";
|
|
52
53
|
import { analyzeHierarchyIntegrity, } from "../graph/hierarchy-integrity.js";
|
|
@@ -278,11 +279,41 @@ async function scanItemIntegrity(pmRoot, typeToFolder, schema) {
|
|
|
278
279
|
}
|
|
279
280
|
return { paths, unreadable, conflictMarkers, parseFailures, formatVersions };
|
|
280
281
|
}
|
|
282
|
+
function mergeReceiptIdsFromHistoryEntry(value) {
|
|
283
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
284
|
+
return [];
|
|
285
|
+
}
|
|
286
|
+
const context = value.context;
|
|
287
|
+
if (typeof context !== "object" ||
|
|
288
|
+
context === null ||
|
|
289
|
+
Array.isArray(context)) {
|
|
290
|
+
return [];
|
|
291
|
+
}
|
|
292
|
+
const merge = context.merge;
|
|
293
|
+
if (typeof merge !== "object" || merge === null || Array.isArray(merge)) {
|
|
294
|
+
return [];
|
|
295
|
+
}
|
|
296
|
+
const receipts = merge.receipts;
|
|
297
|
+
if (!Array.isArray(receipts))
|
|
298
|
+
return [];
|
|
299
|
+
return receipts.flatMap((receipt) => {
|
|
300
|
+
if (typeof receipt !== "object" ||
|
|
301
|
+
receipt === null ||
|
|
302
|
+
Array.isArray(receipt)) {
|
|
303
|
+
return [];
|
|
304
|
+
}
|
|
305
|
+
const receiptId = receipt.receipt_id;
|
|
306
|
+
return typeof receiptId === "string" && receiptId.length > 0
|
|
307
|
+
? [receiptId]
|
|
308
|
+
: [];
|
|
309
|
+
});
|
|
310
|
+
}
|
|
281
311
|
async function scanHistoryIntegrity(pmRoot) {
|
|
282
312
|
const historyDir = path.join(pmRoot, "history");
|
|
283
313
|
const unreadable = [];
|
|
284
314
|
const conflictMarkers = [];
|
|
285
315
|
const invalidJson = [];
|
|
316
|
+
const mergeReceiptReferences = [];
|
|
286
317
|
let files = [];
|
|
287
318
|
try {
|
|
288
319
|
files = (await fs.readdir(historyDir))
|
|
@@ -314,14 +345,25 @@ async function scanHistoryIntegrity(pmRoot) {
|
|
|
314
345
|
if (!line.trim())
|
|
315
346
|
return;
|
|
316
347
|
try {
|
|
317
|
-
JSON.parse(line);
|
|
348
|
+
const parsed = JSON.parse(line);
|
|
349
|
+
mergeReceiptReferences.push(...mergeReceiptIdsFromHistoryEntry(parsed).map((receiptId) => ({
|
|
350
|
+
itemId,
|
|
351
|
+
line: index + 1,
|
|
352
|
+
receiptId,
|
|
353
|
+
})));
|
|
318
354
|
}
|
|
319
355
|
catch {
|
|
320
356
|
invalidJson.push({ id: itemId, line: index + 1 });
|
|
321
357
|
}
|
|
322
358
|
});
|
|
323
359
|
}
|
|
324
|
-
return {
|
|
360
|
+
return {
|
|
361
|
+
files,
|
|
362
|
+
unreadable,
|
|
363
|
+
conflictMarkers,
|
|
364
|
+
invalidJson,
|
|
365
|
+
mergeReceiptReferences,
|
|
366
|
+
};
|
|
325
367
|
}
|
|
326
368
|
function buildHierarchyIntegrityWarnings(analysis) {
|
|
327
369
|
return [
|
|
@@ -336,10 +378,15 @@ function buildHierarchyIntegrityWarnings(analysis) {
|
|
|
336
378
|
: `integrity_hierarchy_divergence:${finding.child_id}`),
|
|
337
379
|
];
|
|
338
380
|
}
|
|
339
|
-
function buildMergeReceiptEvidenceWarnings(
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
381
|
+
function buildMergeReceiptEvidenceWarnings(params) {
|
|
382
|
+
const warnings = [];
|
|
383
|
+
if (params.invalidEvidenceCount > 0) {
|
|
384
|
+
warnings.push(`merge_receipt_evidence_invalid:${params.invalidEvidenceCount}`);
|
|
385
|
+
}
|
|
386
|
+
if (params.missingHistoryReferenceCount > 0) {
|
|
387
|
+
warnings.push(`merge_receipt_history_reference_missing:${params.missingHistoryReferenceCount}`);
|
|
388
|
+
}
|
|
389
|
+
return warnings;
|
|
343
390
|
}
|
|
344
391
|
async function buildIntegrityCheck(pmRoot, typeToFolder, schema, requireMergeDrivers, items) {
|
|
345
392
|
const itemScan = await scanItemIntegrity(pmRoot, typeToFolder, schema);
|
|
@@ -353,10 +400,21 @@ async function buildIntegrityCheck(pmRoot, typeToFolder, schema, requireMergeDri
|
|
|
353
400
|
? null
|
|
354
401
|
: await auditMergeDriverConfiguration(gitWorkspaceRoot);
|
|
355
402
|
const mergeReceiptEvidence = await inspectMergeReceiptEvidence(gitWorkspaceRoot ?? pmRoot, {
|
|
403
|
+
includeReconciled: true,
|
|
356
404
|
includeLossless: true,
|
|
357
405
|
pmRoot,
|
|
358
406
|
});
|
|
359
|
-
const
|
|
407
|
+
const availableMergeReceiptIds = new Set(mergeReceiptEvidence.receipts.map((receipt) => receipt.id));
|
|
408
|
+
const missingMergeReceiptReferences = historyScan.mergeReceiptReferences
|
|
409
|
+
.filter((reference) => !availableMergeReceiptIds.has(reference.receiptId))
|
|
410
|
+
.map((reference) => ({
|
|
411
|
+
item_id: reference.itemId,
|
|
412
|
+
history_line: reference.line,
|
|
413
|
+
...(isSafeReceiptId(reference.receiptId)
|
|
414
|
+
? { receipt_id: reference.receiptId }
|
|
415
|
+
: { receipt_reference_hash: sha256Hex(reference.receiptId) }),
|
|
416
|
+
}));
|
|
417
|
+
const pendingMergeReceipts = mergeReceiptEvidence.receipts.filter((receipt) => receipt.state === "pending");
|
|
360
418
|
const { pendingDecisions: pendingMergeDecisions, lossless: losslessMergeReceipts, } = partitionMergeReceipts(pendingMergeReceipts);
|
|
361
419
|
const mergeDriverInstallationMissing = mergeDriverAudit?.status === "missing" &&
|
|
362
420
|
mergeDriverAudit.missing_keys.length === 5 &&
|
|
@@ -389,7 +447,10 @@ async function buildIntegrityCheck(pmRoot, typeToFolder, schema, requireMergeDri
|
|
|
389
447
|
...(losslessMergeReceipts.length > 0
|
|
390
448
|
? [`merge_receipts_pending:${losslessMergeReceipts.length}`]
|
|
391
449
|
: []),
|
|
392
|
-
...buildMergeReceiptEvidenceWarnings(
|
|
450
|
+
...buildMergeReceiptEvidenceWarnings({
|
|
451
|
+
invalidEvidenceCount: mergeReceiptEvidence.invalid_evidence_count,
|
|
452
|
+
missingHistoryReferenceCount: missingMergeReceiptReferences.length,
|
|
453
|
+
}),
|
|
393
454
|
];
|
|
394
455
|
const normalizedWarnings = [...new Set(warnings)].sort((left, right) => left.localeCompare(right));
|
|
395
456
|
const actionableWarnings = normalizedWarnings.filter((warning) => !warning.startsWith("integrity_legacy_hierarchy_"));
|
|
@@ -421,6 +482,7 @@ async function buildIntegrityCheck(pmRoot, typeToFolder, schema, requireMergeDri
|
|
|
421
482
|
pending_merge_decisions: pendingMergeDecisions.length,
|
|
422
483
|
lossless_merge_receipts: losslessMergeReceipts.length,
|
|
423
484
|
invalid_merge_receipt_evidence: mergeReceiptEvidence.invalid_evidence_count,
|
|
485
|
+
missing_merge_receipt_history_references: missingMergeReceiptReferences.length,
|
|
424
486
|
},
|
|
425
487
|
item_unreadable: itemScan.unreadable,
|
|
426
488
|
item_conflict_markers: itemScan.conflictMarkers,
|
|
@@ -452,6 +514,10 @@ async function buildIntegrityCheck(pmRoot, typeToFolder, schema, requireMergeDri
|
|
|
452
514
|
lossless_merge_receipt_items: [
|
|
453
515
|
...new Set(losslessMergeReceipts.map((receipt) => receipt.item_id)),
|
|
454
516
|
].sort((left, right) => left.localeCompare(right)),
|
|
517
|
+
invalid_merge_receipt_evidence_details: mergeReceiptEvidence.invalid_evidence,
|
|
518
|
+
invalid_merge_receipt_evidence_details_truncated: mergeReceiptEvidence.invalid_evidence_truncated,
|
|
519
|
+
missing_merge_receipt_history_reference_details: missingMergeReceiptReferences.slice(0, HEALTH_WARNING_LIMIT),
|
|
520
|
+
missing_merge_receipt_history_reference_details_truncated: missingMergeReceiptReferences.length > HEALTH_WARNING_LIMIT,
|
|
455
521
|
},
|
|
456
522
|
},
|
|
457
523
|
warnings: normalizedWarnings,
|
|
@@ -2309,4 +2375,4 @@ export const _testOnlyHealthCommand = {
|
|
|
2309
2375
|
warningCode,
|
|
2310
2376
|
};
|
|
2311
2377
|
//# sourceMappingURL=health.js.map
|
|
2312
|
-
//# debugId=
|
|
2378
|
+
//# debugId=f27cb24d-f2c8-5034-b655-84c577de7a16
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm validate 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]="0d466293-869d-54bb-b07d-facb3be51e8c")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
9
|
import fs from "node:fs/promises";
|
|
10
10
|
import { realpathSync } from "node:fs";
|
|
@@ -2053,6 +2053,8 @@ async function buildStorageIntegrityCheck(pmRoot, items, typeToFolder, settings)
|
|
|
2053
2053
|
].sort((left, right) => left.localeCompare(right)),
|
|
2054
2054
|
lossless_merge_receipt_count: losslessMergeReceipts.length,
|
|
2055
2055
|
invalid_merge_receipt_evidence_count: mergeReceiptEvidence.invalid_evidence_count,
|
|
2056
|
+
invalid_merge_receipt_evidence_details: mergeReceiptEvidence.invalid_evidence,
|
|
2057
|
+
invalid_merge_receipt_evidence_details_truncated: mergeReceiptEvidence.invalid_evidence_truncated,
|
|
2056
2058
|
lossless_merge_receipt_items: [
|
|
2057
2059
|
...new Set(losslessMergeReceipts.map((receipt) => receipt.item_id)),
|
|
2058
2060
|
].sort((left, right) => left.localeCompare(right)),
|
|
@@ -2273,4 +2275,4 @@ export async function runValidate(options, global, services = {}) {
|
|
|
2273
2275
|
}
|
|
2274
2276
|
/* c8 ignore stop */
|
|
2275
2277
|
//# sourceMappingURL=validate.js.map
|
|
2276
|
-
//# debugId=
|
|
2278
|
+
//# debugId=0d466293-869d-54bb-b07d-facb3be51e8c
|
package/dist/sdk/history-read.js
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
* systems without acquiring locks or appending history.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!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]="
|
|
10
|
+
!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]="f1ea4209-59d4-53f0-a8ea-2e060e385d14")}catch(e){}}();
|
|
11
11
|
import { assertInitializedTracker } from "./environment/tracker-preflight.js";
|
|
12
12
|
import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
|
|
13
13
|
import { applyHistoryPatch, ensureMaterializedHistoryTarget, extractPatchFailureContext, replayHistoryToTarget, resolveHistoryTarget, } from "../core/history/projection.js";
|
|
14
14
|
import { readHistoryEntries } from "../core/history/read.js";
|
|
15
|
-
import { hashDocument, hashEmptyDocument, } from "../core/history/history.js";
|
|
16
|
-
import { replayToCanonicalItemDocument,
|
|
15
|
+
import { hashDocument, hashDocumentVerificationCandidates, hashEmptyDocument, } from "../core/history/history.js";
|
|
16
|
+
import { replayToCanonicalItemDocument, verifyHistoryChainWithVersion, } from "../core/history/replay.js";
|
|
17
17
|
import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
|
|
18
18
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
19
19
|
import { PmCliError } from "../core/shared/errors.js";
|
|
@@ -28,11 +28,19 @@ import { resolveHistorySubject } from "./history-redact.js";
|
|
|
28
28
|
* document to compare.
|
|
29
29
|
*/
|
|
30
30
|
export function verifyHistoryEntries(history, currentDocument) {
|
|
31
|
-
const verification =
|
|
31
|
+
const verification = verifyHistoryChainWithVersion(history);
|
|
32
32
|
const latestAfterHash = history.length > 0
|
|
33
33
|
? history[history.length - 1].after_hash
|
|
34
34
|
: hashEmptyDocument();
|
|
35
|
-
const
|
|
35
|
+
const currentItemHashCandidates = currentDocument === undefined ||
|
|
36
|
+
verification.item_hash_version === undefined
|
|
37
|
+
? undefined
|
|
38
|
+
: hashDocumentVerificationCandidates(currentDocument, verification.item_hash_version);
|
|
39
|
+
const currentItemHash = currentDocument === undefined
|
|
40
|
+
? undefined
|
|
41
|
+
: currentItemHashCandidates === undefined
|
|
42
|
+
? hashDocument(currentDocument)
|
|
43
|
+
: currentItemHashCandidates[Math.max(0, currentItemHashCandidates.indexOf(latestAfterHash))];
|
|
36
44
|
const currentMatchesLatest = currentItemHash === undefined
|
|
37
45
|
? undefined
|
|
38
46
|
: currentItemHash === latestAfterHash;
|
|
@@ -83,4 +91,4 @@ export async function getItemAt(id, target, options = {}) {
|
|
|
83
91
|
}
|
|
84
92
|
export { applyHistoryPatch, ensureMaterializedHistoryTarget, extractPatchFailureContext, readHistoryEntries, replayHistoryToTarget, resolveHistoryTarget, };
|
|
85
93
|
//# sourceMappingURL=history-read.js.map
|
|
86
|
-
//# debugId=
|
|
94
|
+
//# debugId=f1ea4209-59d4-53f0-a8ea-2e060e385d14
|
|
@@ -4,7 +4,7 @@
|
|
|
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]="151e5d26-d6f5-5fcf-84ab-ce89e2b7664e")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "./environment/tracker-preflight.js";
|
|
9
9
|
import { realpath } from "node:fs/promises";
|
|
10
10
|
import path from "node:path";
|
|
@@ -12,7 +12,7 @@ import jsonPatch from "fast-json-patch";
|
|
|
12
12
|
import { patchPathToChangedField } from "../core/history/history-diff.js";
|
|
13
13
|
import { pathExists, readFileIfExists } from "../core/fs/fs-utils.js";
|
|
14
14
|
import { executeHistoryRewrite, writeHistoryRawWithRollback, } from "../core/history/history-rewrite.js";
|
|
15
|
-
import { historyEntriesToRaw, normalizeReplayPatchOps, reanchorHistoryEntries,
|
|
15
|
+
import { historyEntriesToRaw, normalizeReplayPatchOps, reanchorHistoryEntries, replayHashVerificationCandidates, resolveHistoryRepairItemHashVersion, toReplayDocument, verifyHistoryChain, verifyHistoryChainWithVersion, } from "../core/history/replay.js";
|
|
16
16
|
import { scanHistoryDrift } from "../core/history/drift-scan.js";
|
|
17
17
|
import { invalidateHistoryDriftCache } from "../core/history/drift-cache.js";
|
|
18
18
|
import { readHistoryEntries } from "../core/history/read.js";
|
|
@@ -287,11 +287,11 @@ async function loadHistoryRepairItemReplay(subject, settings, historyEntries, it
|
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
289
|
const currentItemReplay = toReplayDocument(loadedItem.document);
|
|
290
|
-
const lastOriginalAfterHash = historyEntries[historyEntries.length - 1]
|
|
290
|
+
const lastOriginalAfterHash = historyEntries[historyEntries.length - 1].after_hash;
|
|
291
291
|
return {
|
|
292
292
|
currentItemReplay,
|
|
293
293
|
currentItemPath,
|
|
294
|
-
matchedChainBefore:
|
|
294
|
+
matchedChainBefore: replayHashVerificationCandidates(currentItemReplay, itemHashVersion).includes(lastOriginalAfterHash),
|
|
295
295
|
currentItemRawBeforeLock: loadedItem.raw,
|
|
296
296
|
loadedItem,
|
|
297
297
|
};
|
|
@@ -312,6 +312,10 @@ function buildHistoryRepairEntries(params) {
|
|
|
312
312
|
const afterReplay = params.reconcileNeeded && params.currentItemReplay
|
|
313
313
|
? params.currentItemReplay
|
|
314
314
|
: params.finalReplay;
|
|
315
|
+
const beforeHashes = replayHashVerificationCandidates(params.finalReplay, params.itemHashVersion);
|
|
316
|
+
const previousAfterHash = params.reanchorEntries[params.reanchorEntries.length - 1].after_hash;
|
|
317
|
+
const semanticIndex = beforeHashes.indexOf(previousAfterHash);
|
|
318
|
+
const afterHashes = replayHashVerificationCandidates(afterReplay, params.itemHashVersion);
|
|
315
319
|
rewrittenEntries.push({
|
|
316
320
|
ts: nowIso(),
|
|
317
321
|
author: params.author,
|
|
@@ -319,8 +323,8 @@ function buildHistoryRepairEntries(params) {
|
|
|
319
323
|
patch: params.reconcileNeeded && params.currentItemReplay
|
|
320
324
|
? jsonPatch.compare(params.finalReplay, params.currentItemReplay)
|
|
321
325
|
: [],
|
|
322
|
-
before_hash:
|
|
323
|
-
after_hash:
|
|
326
|
+
before_hash: beforeHashes[semanticIndex],
|
|
327
|
+
after_hash: afterHashes[semanticIndex],
|
|
324
328
|
message: params.message,
|
|
325
329
|
...(params.explicitItemHashVersion
|
|
326
330
|
? { item_hash_version: params.itemHashVersion }
|
|
@@ -403,9 +407,12 @@ export async function runHistoryRepair(id, options, global) {
|
|
|
403
407
|
const reanchor = reanchorHistoryEntries(provenanceNormalization.entries, itemHashVersion);
|
|
404
408
|
const itemReplayContext = await loadHistoryRepairItemReplay(subject, settings, historyEntries, itemHashVersion);
|
|
405
409
|
const finalReplay = reanchor.finalDocument;
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
|
|
410
|
+
const finalReplayHashes = replayHashVerificationCandidates(finalReplay, itemHashVersion);
|
|
411
|
+
let reconcileNeeded = false;
|
|
412
|
+
if (itemReplayContext.currentItemReplay !== null) {
|
|
413
|
+
const currentItemReplayHashes = replayHashVerificationCandidates(itemReplayContext.currentItemReplay, itemHashVersion);
|
|
414
|
+
reconcileNeeded = !finalReplayHashes.some((hash, hashIndex) => hash === currentItemReplayHashes[hashIndex]);
|
|
415
|
+
}
|
|
409
416
|
// GH-603: reconciling toward the on-disk item can silently overwrite the
|
|
410
417
|
// replayed effect of other authors' events (classic after a lossy merge).
|
|
411
418
|
// Surface exactly what is being discarded before any write happens.
|
|
@@ -591,4 +598,4 @@ export async function runHistoryRepairAll(options, global) {
|
|
|
591
598
|
};
|
|
592
599
|
}
|
|
593
600
|
//# sourceMappingURL=history-repair.js.map
|
|
594
|
-
//# debugId=
|
|
601
|
+
//# debugId=151e5d26-d6f5-5fcf-84ab-ce89e2b7664e
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -182,6 +182,7 @@ export { describeProfileComposition, describeProjectProfile, type ProjectProfile
|
|
|
182
182
|
export { lintProjectProfile, PROFILE_LINT_CODES, PROFILE_LINT_DIMENSIONS, type ProfileLintCode, type ProfileLintDimension, type ProfileLintSeverity, type ProjectProfileLintFinding, type ProjectProfileLintReport, } from "../core/profile/profile-lint.js";
|
|
183
183
|
export * from "./authoring.js";
|
|
184
184
|
export * from "./governance.js";
|
|
185
|
+
export * from "./mcp/discovery.js";
|
|
185
186
|
export * from "./query.js";
|
|
186
187
|
export * from "./testing.js";
|
|
187
188
|
export type { GlobalOptions } from "../core/shared/command-types.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]="8a1a02de-32cb-5714-b950-6041ae8ce229")}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 "./mcp/protocol.js";
|
|
10
10
|
export * from "./mcp/interactions.js";
|
|
@@ -173,7 +173,8 @@ export { describeProfileComposition, describeProjectProfile, } from "../core/pro
|
|
|
173
173
|
export { lintProjectProfile, PROFILE_LINT_CODES, PROFILE_LINT_DIMENSIONS, } from "../core/profile/profile-lint.js";
|
|
174
174
|
export * from "./authoring.js";
|
|
175
175
|
export * from "./governance.js";
|
|
176
|
+
export * from "./mcp/discovery.js";
|
|
176
177
|
export * from "./query.js";
|
|
177
178
|
export * from "./testing.js";
|
|
178
179
|
//# sourceMappingURL=index.js.map
|
|
179
|
-
//# debugId=
|
|
180
|
+
//# debugId=8a1a02de-32cb-5714-b950-6041ae8ce229
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm init agent guidance 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]="542cd5ac-e4a7-51fe-8521-d0bacd9e6a07")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import readline from "node:readline/promises";
|
|
@@ -96,10 +96,10 @@ function buildAgentGuidanceBlock(lineEnding, projectTestCommand = "<your project
|
|
|
96
96
|
AGENT_GUIDANCE_START_MARKER,
|
|
97
97
|
"## pm Workflow (Agent Quickstart)",
|
|
98
98
|
"",
|
|
99
|
-
'-
|
|
99
|
+
'- Cold start with the measured canonical orientation: `pm context --limit 10 --for orient`; before item mutation, also run `pm search "<keywords>" --limit 10`, `pm list --status open --limit 20`, and `pm list --status in_progress --limit 20`.',
|
|
100
100
|
"- Claim and execute: `pm claim <id>` then `pm update <id> --status in_progress`.",
|
|
101
101
|
`- Link evidence while coding: \`pm files <id> --add ...\`, \`pm docs <id> --add ...\`, \`pm test <id> --add command="${projectTestCommand}"\`.`,
|
|
102
|
-
'- Verify and close: `pm test <id> --run --progress`, `pm close <id> "<
|
|
102
|
+
'- Verify and close: `pm test <id> --run --progress`, then atomically record closure evidence with `pm close <id> "<reason>" --resolution "<what changed>" --expected "<expected outcome>" --actual "<observed outcome>" --validate-close warn`, then `pm release <id>`.',
|
|
103
103
|
"- Author identity is automatic for supported agent harnesses; use `--author` only for an explicit override.",
|
|
104
104
|
"",
|
|
105
105
|
AGENT_GUIDANCE_END_MARKER,
|
|
@@ -494,4 +494,4 @@ export async function runInitAgentGuidance(options) {
|
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
496
|
//# sourceMappingURL=init-agent-guidance.js.map
|
|
497
|
-
//# debugId=
|
|
497
|
+
//# debugId=542cd5ac-e4a7-51fe-8521-d0bacd9e6a07
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm update 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]="78f8b369-1802-555d-a8cc-0147c0d8fb08")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
9
|
import { resolveMutationStdinTokenFields } from "../../core/item/parse.js";
|
|
10
10
|
import { COMMON_MUTATION_COMMAND_OPTION_KEYS, canonicalizeCommandOptionKey, commandOptionFlagLabel, resolveItemTypeRegistry, resolveCommandOptionPolicyState, resolveTypeDefinition, resolveTypeName, validateTypeOptions, normalizeItemId, toItemRecord, buildInvalidTypeError, assertParentReferenceIsNotSelf, normalizeParentReferenceValue, validateMissingParentReference, validateSprintOrReleaseValue, applyAcceptanceCriteriaMutations, applyTagRemovals, assertNoUnknownCsvKeys, looksLikeGenericKeyValueEntry, mergeAdditiveTags, parseCsvKv, parseOptionalNonNegativeInteger, parseOptionalNumber, parseTags, shouldResolveMutationStdinTokens, transferMutationStdinTokenPolicy, splitAcceptanceCriteria, resolvePriority, normalizeStatusInput, isTerminalStatus, collectRuntimeUpdateFieldValues, resolveItemTypesFilePath, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, describeAllowedTransitions, evaluateTransition, resolveTypeWorkflows, EXIT_CODE, PmCliError, stableValueEquals, resolveIsoOrRelative, getActiveExtensionRegistrations, collectRegisteredItemFieldNames, applyRegisteredItemFieldDefaultsAndValidation, parseRegisteredItemFieldAssignments, buildItemNotFoundError, listAllItemMetadataLight, locateItem, readLocatedItem, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
|
|
@@ -1273,6 +1273,25 @@ function applySimpleItemMutations(document, options, statusRegistry, changedFiel
|
|
|
1273
1273
|
return (normalizeStatusInput(document.metadata.status, statusRegistry) ??
|
|
1274
1274
|
document.metadata.status);
|
|
1275
1275
|
}
|
|
1276
|
+
const TERMINAL_EVIDENCE_METADATA_KEYS = [
|
|
1277
|
+
"closed_at",
|
|
1278
|
+
"completed_at",
|
|
1279
|
+
"close_reason",
|
|
1280
|
+
"resolution",
|
|
1281
|
+
"expected_result",
|
|
1282
|
+
"actual_result",
|
|
1283
|
+
"fixed_version",
|
|
1284
|
+
];
|
|
1285
|
+
/** Remove stale terminal evidence when work returns to an active lifecycle. */
|
|
1286
|
+
function clearTerminalEvidence(metadata, changedFields) {
|
|
1287
|
+
for (const key of TERMINAL_EVIDENCE_METADATA_KEYS) {
|
|
1288
|
+
if (metadata[key] === undefined) {
|
|
1289
|
+
continue;
|
|
1290
|
+
}
|
|
1291
|
+
delete metadata[key];
|
|
1292
|
+
changedFields.push(key);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1276
1295
|
function applyStatusMutation(document, context, statusInput, previousStatusNormalized, changedFields) {
|
|
1277
1296
|
const status = parseStatus(statusInput, context.statusRegistry);
|
|
1278
1297
|
document.metadata.status = status;
|
|
@@ -1286,14 +1305,8 @@ function applyStatusMutation(document, context, statusInput, previousStatusNorma
|
|
|
1286
1305
|
return;
|
|
1287
1306
|
}
|
|
1288
1307
|
if (!isTerminalStatus(status, context.statusRegistry) &&
|
|
1289
|
-
isTerminalStatus(previousStatusNormalized, context.statusRegistry)
|
|
1290
|
-
document.metadata
|
|
1291
|
-
delete document.metadata.closed_at;
|
|
1292
|
-
changedFields.push("closed_at");
|
|
1293
|
-
if (document.metadata.completed_at !== undefined) {
|
|
1294
|
-
delete document.metadata.completed_at;
|
|
1295
|
-
changedFields.push("completed_at");
|
|
1296
|
-
}
|
|
1308
|
+
isTerminalStatus(previousStatusNormalized, context.statusRegistry)) {
|
|
1309
|
+
clearTerminalEvidence(document.metadata, changedFields);
|
|
1297
1310
|
}
|
|
1298
1311
|
}
|
|
1299
1312
|
function applyStatusAndCompletionMutations(document, context, previousStatusNormalized, changedFields) {
|
|
@@ -2121,4 +2134,4 @@ export const _testOnlyUpdateCommand = {
|
|
|
2121
2134
|
resolveRuntimeUnsetDefinition: (token, registry) => resolveRuntimeUnsetFieldDefinition(token, "update", registry),
|
|
2122
2135
|
};
|
|
2123
2136
|
//# sourceMappingURL=update.js.map
|
|
2124
|
-
//# debugId=
|
|
2137
|
+
//# debugId=78f8b369-1802-555d-a8cc-0147c0d8fb08
|