@unbrained/pm-cli 2026.8.6 → 2026.8.8
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 +65 -0
- package/dist/cli/main.js +6 -3
- package/dist/cli/register-annotations.d.ts +11 -0
- package/dist/cli/register-annotations.js +195 -0
- package/dist/cli/register-history-author.js +7 -30
- package/dist/cli/register-mutation.js +25 -206
- package/dist/cli/register-operations.js +11 -2
- package/dist/cli/runtime-compatibility-boundary.d.ts +17 -0
- package/dist/cli/runtime-compatibility-boundary.js +43 -0
- package/dist/cli/stats-analytics-json.d.ts +9 -0
- package/dist/cli/stats-analytics-json.js +69 -0
- package/dist/cli-bundle/bundle-manifest.json +156 -692
- package/dist/cli-bundle/chunks/chunk-2ZMXX3Q6.js +2068 -0
- package/dist/cli-bundle/chunks/chunk-ALDHXLPS.js +3 -0
- package/dist/cli-bundle/chunks/chunk-CBLA33YK.js +8 -0
- package/dist/cli-bundle/chunks/chunk-GKA54IJM.js +5 -0
- package/dist/cli-bundle/chunks/chunk-KRY7SRUO.js +2 -0
- package/dist/cli-bundle/chunks/chunk-MNJ4NNSY.js +26 -0
- package/dist/cli-bundle/chunks/chunk-NUXRRNAB.js +77 -0
- package/dist/cli-bundle/chunks/chunk-OJPCFDDY.js +13 -0
- package/dist/cli-bundle/chunks/chunk-PFSD3DAN.js +194 -0
- package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +2 -0
- package/dist/cli-bundle/chunks/chunk-SQ7QZFQ6.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-QH7ONPKU.js → register-list-query-WFZAMJHZ.js} +8 -8
- package/dist/cli-bundle/chunks/register-mutation-SOKKOTHQ.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-5XQETS6E.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-2HL5ZHMK.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-54EU2UVO.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-N7QN3NE6.js → chunk-5FLBTZJQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-5GJ57YKN.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YLPZHWX7.js → chunk-ANTMGYLI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-CMDS3KYT.js +14 -0
- package/dist/cli-bundle/focused-chunks/{chunk-EYO4F74Z.js → chunk-DMKOMTTY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-GSW2Y7VZ.js → chunk-F5B3HBEZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-27DK4A5O.js → chunk-FI6DWU2M.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-CL3NB7VW.js → chunk-FNOKJG6N.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EAXXF2HW.js → chunk-FPDYXZBK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-XNVXIQ4B.js → chunk-GWI6YIKJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-6KDHXURF.js → chunk-HCUC62AB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-GEYU23YS.js → chunk-HGNKPSCB.js} +22 -22
- package/dist/cli-bundle/focused-chunks/chunk-IAS7PMLG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TQMFQYXR.js → chunk-PL2EYDJK.js} +29 -29
- package/dist/cli-bundle/focused-chunks/chunk-SM2PJGP3.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4JC3AOGS.js → chunk-TCSAPH33.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-U646T7Z6.js +18 -0
- package/dist/cli-bundle/focused-chunks/chunk-YKPE4PPY.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-GIERI4YU.js → chunk-YSAHYUXX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZOLDTUU7.js +2 -0
- package/dist/cli-bundle/main.js +13 -13
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +38 -37
- 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 +1 -1
- 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 +2 -1
- package/dist/cli.js +14 -4
- package/dist/core/extensions/reserved-host-flags.js +3 -2
- package/dist/core/history/workspace-history.d.ts +22 -2
- package/dist/core/history/workspace-history.js +60 -36
- package/dist/core/output/output.d.ts +2 -0
- package/dist/core/output/output.js +10 -2
- package/dist/core/sentry/helpers.d.ts +10 -0
- package/dist/core/sentry/helpers.js +59 -4
- package/dist/core/shared/command-types.d.ts +2 -0
- package/dist/core/shared/command-types.js +2 -2
- package/dist/core/shared/constants.d.ts +2 -0
- package/dist/core/shared/constants.js +4 -2
- package/dist/mcp/tool-definitions.js +6 -2
- package/dist/sdk/annotations.d.ts +40 -0
- package/dist/sdk/annotations.js +61 -9
- package/dist/sdk/author-attribution.d.ts +12 -0
- package/dist/sdk/author-attribution.js +87 -9
- package/dist/sdk/cli-bootstrap.d.ts +2 -0
- package/dist/sdk/cli-bootstrap.js +7 -2
- package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +118 -0
- package/dist/sdk/cli-contracts/command-exit-contracts.js +152 -0
- package/dist/sdk/cli-contracts/completeness.js +54 -5
- package/dist/sdk/cli-contracts/flag-contracts.js +6 -2
- package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +11 -0
- package/dist/sdk/cli-contracts/runtime-contracts.js +41 -8
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +129 -10
- package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +22 -3
- package/dist/sdk/cli-program.js +3 -2
- package/dist/sdk/comments.d.ts +7 -0
- package/dist/sdk/comments.js +2 -2
- package/dist/sdk/completion.js +12 -5
- package/dist/sdk/contracts.d.ts +2 -0
- package/dist/sdk/contracts.js +3 -2
- package/dist/sdk/core.d.ts +3 -1
- package/dist/sdk/core.js +4 -3
- package/dist/sdk/environment/host-environment-errors.d.ts +27 -0
- package/dist/sdk/environment/host-environment-errors.js +124 -0
- package/dist/sdk/environment/project-runtime-compatibility.d.ts +65 -0
- package/dist/sdk/environment/project-runtime-compatibility.js +385 -0
- package/dist/sdk/environment/source-context.d.ts +23 -0
- package/dist/sdk/environment/source-context.js +29 -0
- package/dist/sdk/error-code-catalog.d.ts +6 -0
- package/dist/sdk/error-code-catalog.js +62 -8
- package/dist/sdk/extension.js +9 -11
- package/dist/sdk/generated-error-code-catalog.js +739 -3
- package/dist/sdk/governance/health.d.ts +11 -3
- package/dist/sdk/governance/health.js +5 -5
- package/dist/sdk/history-analytics.d.ts +141 -0
- package/dist/sdk/history-analytics.js +283 -0
- package/dist/sdk/improvement-ledger-validation.d.ts +3 -0
- package/dist/sdk/improvement-ledger-validation.js +63 -0
- package/dist/sdk/improvement-ledger.d.ts +139 -0
- package/dist/sdk/improvement-ledger.js +261 -0
- package/dist/sdk/index.d.ts +13 -5
- package/dist/sdk/index.js +15 -7
- package/dist/sdk/learnings.d.ts +15 -0
- package/dist/sdk/learnings.js +2 -2
- package/dist/sdk/lifecycle/close-many.d.ts +6 -1
- package/dist/sdk/lifecycle/close-many.js +43 -5
- package/dist/sdk/lifecycle/plan.js +6 -3
- package/dist/sdk/lifecycle/update-many.d.ts +2 -1
- package/dist/sdk/lifecycle/update-many.js +29 -5
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +3 -3
- package/dist/sdk/merge/install.d.ts +21 -0
- package/dist/sdk/merge/install.js +58 -20
- package/dist/sdk/notes.d.ts +7 -0
- package/dist/sdk/notes.js +2 -2
- package/dist/sdk/read-output-budget.js +24 -22
- package/dist/sdk/read-output-contracts.d.ts +10 -2
- package/dist/sdk/read-output-contracts.js +204 -66
- package/dist/sdk/read-output-rows.d.ts +29 -0
- package/dist/sdk/read-output-rows.js +100 -0
- package/dist/sdk/read-output-session.d.ts +69 -0
- package/dist/sdk/read-output-session.js +200 -0
- package/dist/sdk/runtime-input.d.ts +2 -0
- package/dist/sdk/runtime-input.js +14 -2
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime-stats-options.d.ts +9 -0
- package/dist/sdk/runtime-stats-options.js +38 -0
- package/dist/sdk/runtime.d.ts +1 -0
- package/dist/sdk/runtime.js +13 -50
- package/dist/sdk/stats.d.ts +40 -0
- package/dist/sdk/stats.js +112 -29
- package/dist/sdk/test/execution.js +4 -2
- package/dist/sdk/test/parsers.js +5 -2
- package/dist/sdk/workspace-snapshot.d.ts +9 -0
- package/dist/sdk/workspace-snapshot.js +48 -16
- package/docs/AGENT_RUNTIME_PRIMITIVES.md +11 -4
- package/docs/IMPROVEMENT_ANALYTICS.md +103 -0
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +5 -5
- package/docs/README.md +2 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +60 -1
- package/docs/RELEASING.md +27 -2
- package/docs/SCRIPTING.md +27 -1
- package/docs/SDK_CONTEXT_INTEGRITY.md +66 -0
- package/docs/SDK_RUNTIME_BOUNDARIES.md +58 -0
- package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
- package/docs/TESTING.md +17 -0
- package/marketplace.json +2 -2
- package/package.json +6 -4
- 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-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +875 -827
- package/dist/cli-bundle/chunks/append-XAJ5Z4XS.js +0 -2
- package/dist/cli-bundle/chunks/chunk-343QETLI.js +0 -2
- package/dist/cli-bundle/chunks/chunk-3KFVGGRE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-3ZJRFYY2.js +0 -23
- package/dist/cli-bundle/chunks/chunk-4AVFKHHC.js +0 -2
- package/dist/cli-bundle/chunks/chunk-4OVGQW22.js +0 -2
- package/dist/cli-bundle/chunks/chunk-5PBP2ZP3.js +0 -2
- package/dist/cli-bundle/chunks/chunk-5ZKQPA44.js +0 -2
- package/dist/cli-bundle/chunks/chunk-A3XQ7VPU.js +0 -2
- package/dist/cli-bundle/chunks/chunk-A6KGKEWT.js +0 -2
- package/dist/cli-bundle/chunks/chunk-AJE3AHPD.js +0 -8
- package/dist/cli-bundle/chunks/chunk-AOBDLU4T.js +0 -2
- package/dist/cli-bundle/chunks/chunk-AYRUGRNS.js +0 -3
- package/dist/cli-bundle/chunks/chunk-BP6EMEDP.js +0 -5
- package/dist/cli-bundle/chunks/chunk-BXCSXK4J.js +0 -2
- package/dist/cli-bundle/chunks/chunk-C3YABSJK.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CA3BURYF.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CHOQ2VAW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-D7I3TUGV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-DQGJ2RWT.js +0 -3
- package/dist/cli-bundle/chunks/chunk-DWOAOZHZ.js +0 -2
- package/dist/cli-bundle/chunks/chunk-E2ZSLTOP.js +0 -2
- package/dist/cli-bundle/chunks/chunk-E7BFPLUZ.js +0 -5
- package/dist/cli-bundle/chunks/chunk-F4NREH3G.js +0 -2
- package/dist/cli-bundle/chunks/chunk-FB7G2HY2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-FDBRXV25.js +0 -2
- package/dist/cli-bundle/chunks/chunk-GU3TSEHD.js +0 -2
- package/dist/cli-bundle/chunks/chunk-HS7OVAUN.js +0 -164
- package/dist/cli-bundle/chunks/chunk-JC6FKIFM.js +0 -2
- package/dist/cli-bundle/chunks/chunk-JFZIS6JF.js +0 -2
- package/dist/cli-bundle/chunks/chunk-JQ4NZ5EB.js +0 -2
- package/dist/cli-bundle/chunks/chunk-L6LGKJX3.js +0 -2
- package/dist/cli-bundle/chunks/chunk-LEPJJ6QC.js +0 -2
- package/dist/cli-bundle/chunks/chunk-M357ZCOR.js +0 -2
- package/dist/cli-bundle/chunks/chunk-M4VEE3FK.js +0 -2
- package/dist/cli-bundle/chunks/chunk-MCS73BKB.js +0 -3
- package/dist/cli-bundle/chunks/chunk-MDTH7SAE.js +0 -19
- package/dist/cli-bundle/chunks/chunk-NE5VRDAI.js +0 -2
- package/dist/cli-bundle/chunks/chunk-OXY3SJ3N.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PECV7L5T.js +0 -2
- package/dist/cli-bundle/chunks/chunk-Q3VOP62W.js +0 -2
- package/dist/cli-bundle/chunks/chunk-QJ7C3JIW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-R6LSRGPS.js +0 -8
- package/dist/cli-bundle/chunks/chunk-R6RKEYYW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RAFUN7IX.js +0 -2005
- package/dist/cli-bundle/chunks/chunk-RSIC5OPE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RUAU5OSH.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SD3YXU2U.js +0 -56
- package/dist/cli-bundle/chunks/chunk-SV3YQ4RY.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SVV3DQES.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SXECIECW.js +0 -5
- package/dist/cli-bundle/chunks/chunk-T45OHXDW.js +0 -8
- package/dist/cli-bundle/chunks/chunk-TPKDJ5WL.js +0 -2
- package/dist/cli-bundle/chunks/chunk-UVVXHGYS.js +0 -3
- package/dist/cli-bundle/chunks/chunk-V663653R.js +0 -20
- package/dist/cli-bundle/chunks/chunk-WSI5KZQJ.js +0 -55
- package/dist/cli-bundle/chunks/chunk-XPOQQJTX.js +0 -13
- package/dist/cli-bundle/chunks/chunk-YCCDXBNU.js +0 -2
- package/dist/cli-bundle/chunks/chunk-ZFBWCKYF.js +0 -2
- package/dist/cli-bundle/chunks/close-DI66JMSB.js +0 -2
- package/dist/cli-bundle/chunks/close-many-VFKT6U3O.js +0 -2
- package/dist/cli-bundle/chunks/comments-E73HIEZJ.js +0 -2
- package/dist/cli-bundle/chunks/copy-WBYVLCPC.js +0 -2
- package/dist/cli-bundle/chunks/create-TG67IVFI.js +0 -2
- package/dist/cli-bundle/chunks/delete-6XKUVVQN.js +0 -2
- package/dist/cli-bundle/chunks/deps-AJUGP2OH.js +0 -2
- package/dist/cli-bundle/chunks/docs-QOCLDRKJ.js +0 -2
- package/dist/cli-bundle/chunks/files-3ST5TY64.js +0 -2
- package/dist/cli-bundle/chunks/focus-R2AWS63Y.js +0 -2
- package/dist/cli-bundle/chunks/history-compact-7BJFML4S.js +0 -2
- package/dist/cli-bundle/chunks/history-redact-WJN3HYXR.js +0 -2
- package/dist/cli-bundle/chunks/history-repair-XDNZUB7F.js +0 -2
- package/dist/cli-bundle/chunks/learnings-SZMUPVNA.js +0 -2
- package/dist/cli-bundle/chunks/profile-KL53JIAC.js +0 -2
- package/dist/cli-bundle/chunks/register-mutation-OCRQNZK4.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-HIBJXRGB.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-QWBQ6HBS.js +0 -2
- package/dist/cli-bundle/chunks/restore-FXA5QPM7.js +0 -2
- package/dist/cli-bundle/chunks/schema-QJ27OTRV.js +0 -2
- package/dist/cli-bundle/chunks/update-7GBO4SXG.js +0 -2
- package/dist/cli-bundle/chunks/update-many-VF6ZKQUO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-74CWP3A4.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-7AZDTGPA.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-7YTZ7A4E.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-LKQXXO62.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-MBBMTDD3.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-ME4XVOBJ.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-QL5H3AQH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-YHDCGUIW.js +0 -14
|
@@ -4,12 +4,13 @@
|
|
|
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]="4da07a98-855e-59cf-a6a4-2f59a8b3c0bd")}catch(e){}}();
|
|
8
8
|
import { pathExists, createCheckpointId, loadMutationCheckpoint, restoreCheckpointItems, writeMutationCheckpoint, getActiveExtensionRegistrations, isTerminalStatus, resolveItemTypeRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, PmCliError, toErrorMessage, resolveAuthor, nowIso, listAllItemMetadataLight, getSettingsPath, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
|
|
9
9
|
import { runClose } from "./close.js";
|
|
10
10
|
import { hasListFilters } from "../query/list-filter-shared.js";
|
|
11
11
|
import { runList } from "../query/list.js";
|
|
12
12
|
import { runRestore } from "./restore.js";
|
|
13
|
+
import { derivePmBulkMutationEffect, } from "../cli-contracts/command-exit-contracts.js";
|
|
13
14
|
const CLOSE_MANY_CHECKPOINT_SCHEMA_VERSION = 1;
|
|
14
15
|
const CLOSE_MANY_CHECKPOINT_SUBDIR = "close-many";
|
|
15
16
|
const CLOSE_MANY_FILTER_GUIDANCE = [
|
|
@@ -139,6 +140,12 @@ async function runCloseManyRollback(params) {
|
|
|
139
140
|
const restoreMessage = params.options.message ?? `Rollback close-many checkpoint ${checkpoint.id}`;
|
|
140
141
|
const rollback = await restoreCheckpointItems(checkpoint.items, (id, targetUpdatedAt) => runRestore(id, targetUpdatedAt, { author: params.options.author, message: restoreMessage, force: true }, params.global));
|
|
141
142
|
return {
|
|
143
|
+
...derivePmBulkMutationEffect({
|
|
144
|
+
applied: rollback.restored_ids.length,
|
|
145
|
+
skipped: 0,
|
|
146
|
+
failed: rollback.failed_count,
|
|
147
|
+
unmatched: 0,
|
|
148
|
+
}),
|
|
142
149
|
mode: "rollback",
|
|
143
150
|
matched_count: checkpoint.items.length,
|
|
144
151
|
dry_run: false,
|
|
@@ -266,6 +273,13 @@ async function buildCloseManyPlanContext(params) {
|
|
|
266
273
|
const listed = await runList(params.options.status, activeListOptions(params.options.list), params.global);
|
|
267
274
|
const { childrenByParent, parentByChild } = await buildActiveChildrenByParent(params.pmRoot, params.settings);
|
|
268
275
|
const matched = sortCloseManyMatchedItems(listed.items, parentByChild);
|
|
276
|
+
const requestedIds = [
|
|
277
|
+
...new Set(String(params.options.list?.ids ?? "")
|
|
278
|
+
.split(",")
|
|
279
|
+
.map((entry) => entry.trim())
|
|
280
|
+
.filter((entry) => entry.length > 0)),
|
|
281
|
+
];
|
|
282
|
+
const matchedIds = new Set(matched.map((item) => item.id));
|
|
269
283
|
const closePlannedIds = resolveCloseManyPlannedIds(matched, statusRegistry, force);
|
|
270
284
|
return {
|
|
271
285
|
pmRoot: params.pmRoot,
|
|
@@ -276,11 +290,14 @@ async function buildCloseManyPlanContext(params) {
|
|
|
276
290
|
force,
|
|
277
291
|
listed,
|
|
278
292
|
matched,
|
|
293
|
+
unmatchedIds: requestedIds.filter((id) => !matchedIds.has(id)),
|
|
279
294
|
planRows: planCloseManyRows(matched, childrenByParent, closePlannedIds, statusRegistry, force),
|
|
280
295
|
};
|
|
281
296
|
}
|
|
282
297
|
function buildCloseManyDryRunResult(context) {
|
|
283
298
|
return {
|
|
299
|
+
outcome: "effect",
|
|
300
|
+
exit_code: EXIT_CODE.SUCCESS,
|
|
284
301
|
mode: "dry_run",
|
|
285
302
|
matched_count: context.matched.length,
|
|
286
303
|
dry_run: true,
|
|
@@ -291,6 +308,12 @@ function buildCloseManyDryRunResult(context) {
|
|
|
291
308
|
: {}),
|
|
292
309
|
item_plans: context.planRows,
|
|
293
310
|
ids: [],
|
|
311
|
+
...(context.unmatchedIds.length > 0
|
|
312
|
+
? {
|
|
313
|
+
unmatched_ids: context.unmatchedIds,
|
|
314
|
+
unmatched_count: context.unmatchedIds.length,
|
|
315
|
+
}
|
|
316
|
+
: {}),
|
|
294
317
|
};
|
|
295
318
|
}
|
|
296
319
|
async function resolveCloseManyCheckpointInfo(params) {
|
|
@@ -362,7 +385,16 @@ export async function runCloseMany(options, global) {
|
|
|
362
385
|
closeOptions,
|
|
363
386
|
global,
|
|
364
387
|
});
|
|
388
|
+
const closedCount = rows.filter((row) => row.status === "closed").length;
|
|
389
|
+
const skippedCount = rows.filter((row) => row.status === "skipped").length;
|
|
390
|
+
const failedCount = rows.filter((row) => row.status === "failed").length;
|
|
365
391
|
return {
|
|
392
|
+
...derivePmBulkMutationEffect({
|
|
393
|
+
applied: closedCount,
|
|
394
|
+
skipped: skippedCount,
|
|
395
|
+
failed: failedCount,
|
|
396
|
+
unmatched: context.unmatchedIds.length,
|
|
397
|
+
}),
|
|
366
398
|
mode: "apply",
|
|
367
399
|
matched_count: context.matched.length,
|
|
368
400
|
dry_run: false,
|
|
@@ -372,11 +404,17 @@ export async function runCloseMany(options, global) {
|
|
|
372
404
|
? { validate_close: context.validateCloseMode }
|
|
373
405
|
: {}),
|
|
374
406
|
...(checkpointInfo ? { checkpoint: checkpointInfo } : {}),
|
|
375
|
-
closed_count:
|
|
376
|
-
skipped_count:
|
|
377
|
-
failed_count:
|
|
407
|
+
closed_count: closedCount,
|
|
408
|
+
skipped_count: skippedCount,
|
|
409
|
+
failed_count: failedCount,
|
|
378
410
|
rows,
|
|
379
411
|
ids: closedIds,
|
|
412
|
+
...(context.unmatchedIds.length > 0
|
|
413
|
+
? {
|
|
414
|
+
unmatched_ids: context.unmatchedIds,
|
|
415
|
+
unmatched_count: context.unmatchedIds.length,
|
|
416
|
+
}
|
|
417
|
+
: {}),
|
|
380
418
|
};
|
|
381
419
|
}
|
|
382
420
|
/** Public contract for test only, shared by SDK and presentation-layer consumers. */
|
|
@@ -390,4 +428,4 @@ export const _testOnly = {
|
|
|
390
428
|
resolveReason,
|
|
391
429
|
};
|
|
392
430
|
//# sourceMappingURL=close-many.js.map
|
|
393
|
-
//# debugId=
|
|
431
|
+
//# debugId=4da07a98-855e-59cf-a6a4-2f59a8b3c0bd
|
|
@@ -4,7 +4,7 @@
|
|
|
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]="5d3c68a6-0b40-56b5-ae9e-776e1830ed3e")}catch(e){}}();
|
|
8
8
|
import { pathExists, getActiveExtensionRegistrations, isTerminalStatus, resolveItemTypeRegistry, resolveRuntimeStatusRegistry, resolveTypeName, EXIT_CODE, PmCliError, splitCommaList, nowIso, locateItem, mutateItem, readLocatedItem, getSettingsPath, resolvePmRoot, readSettings, resolveAuthor, isTerminalPlanMode, } from "../runtime-primitives.js";
|
|
9
9
|
import { PLAN_HARNESS_VALUES, PLAN_MODE_VALUES, PLAN_STEP_LINK_KIND_VALUES, PLAN_STEP_STATUS_VALUES, } from "../../types/index.js";
|
|
10
10
|
import { runCreate, } from "./create.js";
|
|
@@ -726,7 +726,10 @@ async function planCreate(options, global, ctx) {
|
|
|
726
726
|
test: toSpecArray(options.test),
|
|
727
727
|
doc: toSpecArray(options.doc),
|
|
728
728
|
field: toSpecArray(options.field),
|
|
729
|
-
|
|
729
|
+
// Ownership is assigned by the atomic Plan metadata mutation below. The
|
|
730
|
+
// base create must remain author-owned so strict ownership governance does
|
|
731
|
+
// not reject the metadata seed as a cross-owner follow-up mutation.
|
|
732
|
+
assignee: resolveAuthor(options.author, ctx.settings.author_default),
|
|
730
733
|
blockedBy: undefined,
|
|
731
734
|
dep: buildPlanCreateDependencies(options),
|
|
732
735
|
message: options.message ??
|
|
@@ -1576,4 +1579,4 @@ export const _testOnlyPlanCommand = {
|
|
|
1576
1579
|
changedPlanMetadataFields,
|
|
1577
1580
|
};
|
|
1578
1581
|
//# sourceMappingURL=plan.js.map
|
|
1579
|
-
//# debugId=
|
|
1582
|
+
//# debugId=5d3c68a6-0b40-56b5-ae9e-776e1830ed3e
|
|
@@ -8,6 +8,7 @@ import type { ItemStatus, PmSettings } from "../../types/index.js";
|
|
|
8
8
|
import { hasListFilters } from "../query/list-filter-shared.js";
|
|
9
9
|
import { type ListOptions, type ListedItem } from "../query/list.js";
|
|
10
10
|
import { type UpdateCommandOptions } from "./update.js";
|
|
11
|
+
import { type PmCommandEffectReceipt } from "../cli-contracts/command-exit-contracts.js";
|
|
11
12
|
/** Documents the update many command options payload exchanged by command, SDK, and package integrations. */
|
|
12
13
|
export interface UpdateManyCommandOptions {
|
|
13
14
|
/** Lifecycle state reported for status. */
|
|
@@ -50,7 +51,7 @@ interface UpdateManyRollbackResultRow {
|
|
|
50
51
|
error?: string;
|
|
51
52
|
}
|
|
52
53
|
/** Documents the update many result payload exchanged by command, SDK, and package integrations. */
|
|
53
|
-
export interface UpdateManyResult {
|
|
54
|
+
export interface UpdateManyResult extends PmCommandEffectReceipt {
|
|
54
55
|
/** Value that configures or reports mode for this contract. */
|
|
55
56
|
mode: "dry_run" | "apply" | "rollback";
|
|
56
57
|
/** Number of matched entries represented by this result. */
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* Implements the pm update 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]="67f8958d-60d5-5657-93ce-9803859acd9e")}catch(e){}}();
|
|
8
8
|
import { pathExists, createCheckpointId, loadMutationCheckpoint, restoreCheckpointItems, writeMutationCheckpoint, toItemRecord, applyAcceptanceCriteriaMutations, applyTagRemovals, mergeAdditiveTags, parseOptionalNonNegativeInteger, parseTags, splitAcceptanceCriteria, resolvePriority, normalizeStatusInput, resolveItemTypeRegistry, resolveTypeName, collectRuntimeUpdateFieldValues, buildInvalidTypeError, resolveItemTypesFilePath, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, PmCliError, toErrorMessage, stableValueEquals, nowIso, resolveIsoOrRelative, getActiveExtensionRegistrations, getSettingsPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
|
|
9
9
|
import { parseStatusFilterCsv } from "../../core/item/status-filter.js";
|
|
10
10
|
import { hasListFilters } from "../query/list-filter-shared.js";
|
|
11
11
|
import { runList, } from "../query/list.js";
|
|
12
12
|
import { runRestore } from "./restore.js";
|
|
13
13
|
import { runUpdate } from "./update.js";
|
|
14
|
+
import { derivePmBulkMutationEffect, } from "../cli-contracts/command-exit-contracts.js";
|
|
14
15
|
const UPDATE_MANY_CHECKPOINT_SCHEMA_VERSION = 1;
|
|
15
16
|
const UPDATE_MANY_CHECKPOINT_SUBDIR = "update-many";
|
|
16
17
|
const NON_MUTATION_UPDATE_OPTION_KEYS = new Set([
|
|
@@ -519,6 +520,12 @@ const runUpdateManyRollback = async (params) => {
|
|
|
519
520
|
force: params.options.update?.force ?? true,
|
|
520
521
|
}, params.global));
|
|
521
522
|
return {
|
|
523
|
+
...derivePmBulkMutationEffect({
|
|
524
|
+
applied: rollback.restored_ids.length,
|
|
525
|
+
skipped: 0,
|
|
526
|
+
failed: rollback.failed_count,
|
|
527
|
+
unmatched: 0,
|
|
528
|
+
}),
|
|
522
529
|
mode: "rollback",
|
|
523
530
|
matched_count: checkpoint.items.length,
|
|
524
531
|
dry_run: false,
|
|
@@ -642,6 +649,8 @@ const buildUpdateManyPlan = async (params) => {
|
|
|
642
649
|
};
|
|
643
650
|
/** Builds the non-mutating preview response for a prepared update-many plan. */
|
|
644
651
|
const buildUpdateManyDryRunResult = (plan) => ({
|
|
652
|
+
outcome: "effect",
|
|
653
|
+
exit_code: EXIT_CODE.SUCCESS,
|
|
645
654
|
mode: "dry_run",
|
|
646
655
|
matched_count: plan.listed.items.length,
|
|
647
656
|
dry_run: true,
|
|
@@ -653,6 +662,12 @@ const buildUpdateManyDryRunResult = (plan) => ({
|
|
|
653
662
|
});
|
|
654
663
|
/** Builds the apply response for a plan whose rows are all already current. */
|
|
655
664
|
const buildUpdateManyNoopResult = (plan) => ({
|
|
665
|
+
...derivePmBulkMutationEffect({
|
|
666
|
+
applied: 0,
|
|
667
|
+
skipped: plan.listed.items.length,
|
|
668
|
+
failed: 0,
|
|
669
|
+
unmatched: plan.unmatchedIds?.length ?? 0,
|
|
670
|
+
}),
|
|
656
671
|
mode: "apply",
|
|
657
672
|
matched_count: plan.listed.items.length,
|
|
658
673
|
dry_run: false,
|
|
@@ -742,16 +757,25 @@ const applyUpdateManyPlan = async (params) => {
|
|
|
742
757
|
});
|
|
743
758
|
/** Counts apply rows with one terminal status. */
|
|
744
759
|
const countStatus = (status) => applied.rows.filter((row) => row.status === status).length;
|
|
760
|
+
const updatedCount = countStatus("updated");
|
|
761
|
+
const skippedCount = countStatus("skipped");
|
|
762
|
+
const failedCount = countStatus("failed");
|
|
745
763
|
return {
|
|
764
|
+
...derivePmBulkMutationEffect({
|
|
765
|
+
applied: updatedCount,
|
|
766
|
+
skipped: skippedCount,
|
|
767
|
+
failed: failedCount,
|
|
768
|
+
unmatched: params.plan.unmatchedIds?.length ?? 0,
|
|
769
|
+
}),
|
|
746
770
|
mode: "apply",
|
|
747
771
|
matched_count: params.plan.listed.items.length,
|
|
748
772
|
dry_run: false,
|
|
749
773
|
filters: params.plan.listed.filters,
|
|
750
774
|
planned_update_options: params.plan.updateSummary,
|
|
751
775
|
...(checkpointInfo ? { checkpoint: checkpointInfo } : {}),
|
|
752
|
-
updated_count:
|
|
753
|
-
skipped_count:
|
|
754
|
-
failed_count:
|
|
776
|
+
updated_count: updatedCount,
|
|
777
|
+
skipped_count: skippedCount,
|
|
778
|
+
failed_count: failedCount,
|
|
755
779
|
rows: applied.rows,
|
|
756
780
|
ids: applied.updatedIds,
|
|
757
781
|
...buildUnmatchedIdFields(params.plan),
|
|
@@ -804,4 +828,4 @@ export const _testOnlyUpdateManyCommand = {
|
|
|
804
828
|
toComparablePreviewValue,
|
|
805
829
|
};
|
|
806
830
|
//# sourceMappingURL=update-many.js.map
|
|
807
|
-
//# debugId=
|
|
831
|
+
//# debugId=67f8958d-60d5-5657-93ce-9803859acd9e
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
export { ITEM_LATEST_TIMESTAMP_FIELDS, ITEM_UNION_COLLECTION_FIELDS, mergeHistoryStreams, mergeItemDocuments, mergeJsonDocuments, mergeRelationshipEventStreams, type HistoryMergeResult, type HistoryMergeStrategy, type ItemDocumentMergeResult, type JsonDocumentMergeResult, type ItemMergeConflictDecision, type MergePreferredSide, type RelationshipStreamMergeResult, } from "./three-way.js";
|
|
10
10
|
export { listMergeReceipts, markMergeReceiptReconciled, runMergeReceiptReport, summarizeMergeReceipt, type MergeDecisionReceipt, type MergeDecisionReceiptSummary, type MergeReceiptReport, } from "./receipts.js";
|
|
11
11
|
export { MERGE_DRIVER_ARTIFACT_VALUES, runMergeDriver, type MergeDriverArtifact, type MergeDriverOptions, type MergeDriverResult, } from "./driver.js";
|
|
12
|
-
export { auditMergeAttributeFence, auditMergeDriverConfiguration, buildMergeAttributePatterns, findGitWorkspaceRoot, PM_GITATTRIBUTES_END, PM_GITATTRIBUTES_START, refreshMergeAttributeFenceIfInstalled, runMergeInstall, type MergeFenceAuditResult, type MergeDriverConfigurationAuditResult, type MergeFenceRefreshOutcome, type MergeInstallOptions, type MergeInstallResult, } from "./install.js";
|
|
12
|
+
export { auditMergeAttributeFence, auditMergeDriverConfiguration, buildMergeAttributePatterns, findGitWorkspaceRoot, PM_GITATTRIBUTES_END, PM_GITATTRIBUTES_START, refreshMergeAttributeFenceIfInstalled, resolveMergeInstallContext, runMergeInstall, type MergeFenceAuditResult, type MergeDriverConfigurationAuditResult, type MergeFenceRefreshOutcome, type MergeInstallOptions, type MergeInstallContextResolution, type MergeInstallResult, } from "./install.js";
|
|
13
13
|
export { runMergeReconcile, type MergeReconcileOptions, type MergeReconcileResult, } from "./reconcile.js";
|
package/dist/sdk/merge/index.js
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
* this module so packages and hosts can reuse the same merge behavior.
|
|
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]="a8072065-092c-564b-a84f-cf687f795a92")}catch(e){}}();
|
|
11
11
|
export { ITEM_LATEST_TIMESTAMP_FIELDS, ITEM_UNION_COLLECTION_FIELDS, mergeHistoryStreams, mergeItemDocuments, mergeJsonDocuments, mergeRelationshipEventStreams, } from "./three-way.js";
|
|
12
12
|
export { listMergeReceipts, markMergeReceiptReconciled, runMergeReceiptReport, summarizeMergeReceipt, } from "./receipts.js";
|
|
13
13
|
export { MERGE_DRIVER_ARTIFACT_VALUES, runMergeDriver, } from "./driver.js";
|
|
14
|
-
export { auditMergeAttributeFence, auditMergeDriverConfiguration, buildMergeAttributePatterns, findGitWorkspaceRoot, PM_GITATTRIBUTES_END, PM_GITATTRIBUTES_START, refreshMergeAttributeFenceIfInstalled, runMergeInstall, } from "./install.js";
|
|
14
|
+
export { auditMergeAttributeFence, auditMergeDriverConfiguration, buildMergeAttributePatterns, findGitWorkspaceRoot, PM_GITATTRIBUTES_END, PM_GITATTRIBUTES_START, refreshMergeAttributeFenceIfInstalled, resolveMergeInstallContext, runMergeInstall, } from "./install.js";
|
|
15
15
|
export { runMergeReconcile, } from "./reconcile.js";
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
|
17
|
-
//# debugId=
|
|
17
|
+
//# debugId=a8072065-092c-564b-a84f-cf687f795a92
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GlobalOptions } from "../../core/shared/command-types.js";
|
|
2
2
|
import { readSettings } from "../../core/store/settings.js";
|
|
3
|
+
import { resolveSourceContextWritePolicy } from "../environment/source-context.js";
|
|
3
4
|
/** Opening marker for the pm-owned merge-driver `.gitattributes` block. */
|
|
4
5
|
export declare const PM_GITATTRIBUTES_START = "# pm-cli:merge-drivers:start";
|
|
5
6
|
/** Closing marker for the pm-owned merge-driver `.gitattributes` block. */
|
|
@@ -37,6 +38,26 @@ export interface MergeInstallResult {
|
|
|
37
38
|
/** ISO 8601 timestamp recording when generated occurred. */
|
|
38
39
|
generated_at: string;
|
|
39
40
|
}
|
|
41
|
+
/** Resolved tracker and workspace selection for one merge-install invocation. */
|
|
42
|
+
export interface MergeInstallContextResolution {
|
|
43
|
+
/** Tracker root selected without performing filesystem writes. */
|
|
44
|
+
pm_root: string;
|
|
45
|
+
/** Starting path used to discover the enclosing Git workspace. */
|
|
46
|
+
workspace_start: string;
|
|
47
|
+
/** Whether complete inherited source coordinates were present. */
|
|
48
|
+
source_coordinates_available: boolean;
|
|
49
|
+
/** Whether inherited source coordinates were selected. */
|
|
50
|
+
source_context_selected: boolean;
|
|
51
|
+
/** Source-coordinate write policy active for the invocation. */
|
|
52
|
+
source_policy: ReturnType<typeof resolveSourceContextWritePolicy>;
|
|
53
|
+
}
|
|
54
|
+
/** Resolve explicit, inherited-source, and current-workspace precedence without I/O. */
|
|
55
|
+
export declare function resolveMergeInstallContext(options: {
|
|
56
|
+
cwd: string;
|
|
57
|
+
explicitPath?: string;
|
|
58
|
+
dryRun: boolean;
|
|
59
|
+
environment: Readonly<Record<string, string | undefined>>;
|
|
60
|
+
}): MergeInstallContextResolution;
|
|
40
61
|
/** Result of auditing clone-local driver definitions behind a committed fence. */
|
|
41
62
|
export interface MergeDriverConfigurationAuditResult {
|
|
42
63
|
/** Whether every required driver definition exactly matches this installation. */
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* mutations refresh the fenced block automatically once it is installed.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
!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]="
|
|
11
|
+
!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]="fce8fc1d-b9ca-55bc-9c5a-f4f9728a7158")}catch(e){}}();
|
|
12
12
|
import { readFile, realpath, writeFile } from "node:fs/promises";
|
|
13
13
|
import { execFile } from "node:child_process";
|
|
14
14
|
import path from "node:path";
|
|
@@ -24,6 +24,7 @@ import { nowIso } from "../../core/shared/time.js";
|
|
|
24
24
|
import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
|
|
25
25
|
import { readSettings, resolveGovernanceKnobs, } from "../../core/store/settings.js";
|
|
26
26
|
import { isPathOutsideRoot } from "../workspace.js";
|
|
27
|
+
import { resolveSourceContextWritePolicy } from "../environment/source-context.js";
|
|
27
28
|
const execFileAsync = promisify(execFile);
|
|
28
29
|
/** Opening marker for the pm-owned merge-driver `.gitattributes` block. */
|
|
29
30
|
export const PM_GITATTRIBUTES_START = "# pm-cli:merge-drivers:start";
|
|
@@ -80,6 +81,45 @@ const MERGE_DRIVER_DEFINITIONS = [
|
|
|
80
81
|
itemPath: undefined,
|
|
81
82
|
},
|
|
82
83
|
];
|
|
84
|
+
/** Resolve explicit, inherited-source, and current-workspace precedence without I/O. */
|
|
85
|
+
export function resolveMergeInstallContext(options) {
|
|
86
|
+
const explicitPath = options.explicitPath?.trim();
|
|
87
|
+
const sourceWorkspaceRoot = options.environment.PM_SOURCE_WORKSPACE_ROOT?.trim();
|
|
88
|
+
const sourcePmRoot = options.environment.PM_SOURCE_PM_PATH?.trim();
|
|
89
|
+
const sourcePolicy = resolveSourceContextWritePolicy(options.environment);
|
|
90
|
+
const sourceCoordinatesAvailable = Boolean(sourceWorkspaceRoot && sourcePmRoot);
|
|
91
|
+
const sourceContextSelected = explicitPath === undefined &&
|
|
92
|
+
sourceCoordinatesAvailable &&
|
|
93
|
+
(options.dryRun || sourcePolicy.source_writes_allowed);
|
|
94
|
+
if (explicitPath !== undefined) {
|
|
95
|
+
const pmRoot = resolvePmRoot(options.cwd, explicitPath);
|
|
96
|
+
return {
|
|
97
|
+
pm_root: pmRoot,
|
|
98
|
+
workspace_start: pmRoot,
|
|
99
|
+
source_coordinates_available: sourceCoordinatesAvailable,
|
|
100
|
+
source_context_selected: false,
|
|
101
|
+
source_policy: sourcePolicy,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
if (sourceContextSelected) {
|
|
105
|
+
return {
|
|
106
|
+
pm_root: path.resolve(sourcePmRoot),
|
|
107
|
+
workspace_start: path.resolve(sourceWorkspaceRoot),
|
|
108
|
+
source_coordinates_available: true,
|
|
109
|
+
source_context_selected: true,
|
|
110
|
+
source_policy: sourcePolicy,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
pm_root: sourceCoordinatesAvailable
|
|
115
|
+
? resolvePmRoot(options.cwd, ".agents/pm")
|
|
116
|
+
: resolvePmRoot(options.cwd),
|
|
117
|
+
workspace_start: options.cwd,
|
|
118
|
+
source_coordinates_available: sourceCoordinatesAvailable,
|
|
119
|
+
source_context_selected: false,
|
|
120
|
+
source_policy: sourcePolicy,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
83
123
|
/** Resolve the enclosing Git worktree root or return null outside Git. */
|
|
84
124
|
export async function findGitWorkspaceRoot(cwd) {
|
|
85
125
|
try {
|
|
@@ -185,6 +225,14 @@ export function buildMergeAttributePatterns(trackerRelativeRoot, typeFolders) {
|
|
|
185
225
|
patterns.push(`${quoteGitAttributePattern(`${prefix}history/*.jsonl`)} merge=pm-history`);
|
|
186
226
|
patterns.push(`${quoteGitAttributePattern(`${prefix}settings.json`)} merge=pm-json`);
|
|
187
227
|
patterns.push(`${quoteGitAttributePattern(`${prefix}**/*.json`)} merge=pm-json`);
|
|
228
|
+
// Extensions are package assets, not tracker item streams. The broad
|
|
229
|
+
// fallback patterns above intentionally protect unknown contributed item
|
|
230
|
+
// folders, so this last-match escape hatch must explicitly unset merge for
|
|
231
|
+
// every file beneath the reserved extension package root.
|
|
232
|
+
patterns.push(`${quoteGitAttributePattern(`${prefix}extensions/**`)} -merge`);
|
|
233
|
+
// The managed extension inventory is tracker state rather than package
|
|
234
|
+
// content, so restore its structured JSON driver after the asset exclusion.
|
|
235
|
+
patterns.push(`${quoteGitAttributePattern(`${prefix}extensions/.managed-extensions.json`)} merge=pm-json`);
|
|
188
236
|
return patterns;
|
|
189
237
|
}
|
|
190
238
|
async function reconcileGitattributesBlock(workspaceRoot, patterns, dryRun) {
|
|
@@ -385,27 +433,17 @@ export async function refreshMergeAttributeFenceIfInstalled(pmRoot) {
|
|
|
385
433
|
* per checkout). Requires an initialized tracker and a git repository.
|
|
386
434
|
*/
|
|
387
435
|
export async function runMergeInstall(options, global) {
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
sourcePmRoot.length > 0;
|
|
396
|
-
const pmRoot = explicitPath !== undefined
|
|
397
|
-
? resolvePmRoot(process.cwd(), explicitPath)
|
|
398
|
-
: usesLinkedTestSourceContext
|
|
399
|
-
? path.resolve(sourcePmRoot)
|
|
400
|
-
: resolvePmRoot(process.cwd());
|
|
436
|
+
const context = resolveMergeInstallContext({
|
|
437
|
+
cwd: process.cwd(),
|
|
438
|
+
explicitPath: global.path,
|
|
439
|
+
dryRun: options.dryRun === true,
|
|
440
|
+
environment: process.env,
|
|
441
|
+
});
|
|
442
|
+
const pmRoot = context.pm_root;
|
|
401
443
|
if (!(await pathExists(getSettingsPath(pmRoot)))) {
|
|
402
444
|
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
403
445
|
}
|
|
404
|
-
const workspaceRoot = await resolveGitWorkspaceRoot(
|
|
405
|
-
? pmRoot
|
|
406
|
-
: usesLinkedTestSourceContext
|
|
407
|
-
? path.resolve(sourceWorkspaceRoot)
|
|
408
|
-
: process.cwd());
|
|
446
|
+
const workspaceRoot = await resolveGitWorkspaceRoot(context.workspace_start);
|
|
409
447
|
return installMergeFence({
|
|
410
448
|
pmRoot,
|
|
411
449
|
workspaceRoot,
|
|
@@ -510,4 +548,4 @@ export async function installMergeFence(options) {
|
|
|
510
548
|
};
|
|
511
549
|
}
|
|
512
550
|
//# sourceMappingURL=install.js.map
|
|
513
|
-
//# debugId=
|
|
551
|
+
//# debugId=fce8fc1d-b9ca-55bc-9c5a-f4f9728a7158
|
package/dist/sdk/notes.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type GlobalOptions } from "./runtime-primitives.js";
|
|
7
7
|
import type { LogNote } from "../types/index.js";
|
|
8
|
+
import { type AnnotationMutationReceipt, type AnnotationOmissionReceipt } from "./annotations.js";
|
|
8
9
|
/** Documents the notes command options payload exchanged by command, SDK, and package integrations. */
|
|
9
10
|
export interface NotesCommandOptions {
|
|
10
11
|
/** Value that configures or reports add for this contract. */
|
|
@@ -27,6 +28,8 @@ export interface NotesCommandOptions {
|
|
|
27
28
|
eventType?: string;
|
|
28
29
|
/** Include total, returned, and truncation metadata. */
|
|
29
30
|
includeMeta?: boolean;
|
|
31
|
+
/** Return complete note history after a mutation instead of a bounded receipt. */
|
|
32
|
+
fullHistory?: boolean;
|
|
30
33
|
/** Value that configures or reports author for this contract. */
|
|
31
34
|
author?: string;
|
|
32
35
|
/** Human-readable explanation suitable for logs and agent-facing output. */
|
|
@@ -52,6 +55,10 @@ export interface NotesResult {
|
|
|
52
55
|
limit?: number;
|
|
53
56
|
/** Number of structured context events in the returned projection. */
|
|
54
57
|
structured_event_count?: number;
|
|
58
|
+
/** Mutation identity when this result changed the collection. */
|
|
59
|
+
mutation_receipt?: AnnotationMutationReceipt;
|
|
60
|
+
/** Declares whether older notes were withheld from a mutation response. */
|
|
61
|
+
omission_receipt?: AnnotationOmissionReceipt;
|
|
55
62
|
}
|
|
56
63
|
/** Implements run notes for the public runtime surface of this module. */
|
|
57
64
|
export declare function runNotes(id: string, options: NotesCommandOptions, global: GlobalOptions): Promise<NotesResult>;
|
package/dist/sdk/notes.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm notes 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]="ebd9f151-593f-5081-97da-d78f83de4914")}catch(e){}}();
|
|
8
8
|
import { EXIT_CODE, PmCliError, parseLimit, stableStringify, } from "./runtime-primitives.js";
|
|
9
9
|
import { limitAnnotationEntries, parseAnnotationTextInput, resolveAnnotationInput, runAnnotationCommand, } from "./annotations.js";
|
|
10
10
|
function parseStructuredEventPayload(raw) {
|
|
@@ -137,4 +137,4 @@ export async function runNotes(id, options, global) {
|
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
//# sourceMappingURL=notes.js.map
|
|
140
|
-
//# debugId=
|
|
140
|
+
//# debugId=ebd9f151-593f-5081-97da-d78f83de4914
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
!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]="
|
|
2
|
+
!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]="1726fdce-dc71-5707-ae75-b588691e813d")}catch(e){}}();
|
|
3
|
+
import { countReadOutputRows, readOutputRowCollections, } from "./read-output-rows.js";
|
|
3
4
|
const MAX_ESTIMATE_ITERATIONS = 8;
|
|
4
5
|
const MAX_COMPACTION_ITERATIONS = 64;
|
|
5
6
|
/** Return whether a value is a non-array object record. */
|
|
6
7
|
function isRecord(value) {
|
|
7
8
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
8
9
|
}
|
|
9
|
-
/** Resolve declared row keys, falling back to top-level array properties. */
|
|
10
|
-
function rowKeys(result) {
|
|
11
|
-
const contract = result.row_contract;
|
|
12
|
-
if (isRecord(contract) && Array.isArray(contract.row_keys)) {
|
|
13
|
-
return contract.row_keys.filter((entry) => typeof entry === "string");
|
|
14
|
-
}
|
|
15
|
-
return Object.entries(result)
|
|
16
|
-
.filter(([, value]) => Array.isArray(value))
|
|
17
|
-
.map(([key]) => key);
|
|
18
|
-
}
|
|
19
10
|
/** Recursively shorten explanatory strings and record whether content changed. */
|
|
20
11
|
function compactStrings(value, state) {
|
|
21
12
|
if (typeof value === "string") {
|
|
@@ -48,27 +39,38 @@ export function updateReadOutputReceiptEstimate(result, receipt) {
|
|
|
48
39
|
}
|
|
49
40
|
/** Reduce the largest row collection until the budget fits or no rows can move. */
|
|
50
41
|
function compactRowsToBudget(result, receipt, budget) {
|
|
51
|
-
const keys = rowKeys(result);
|
|
52
42
|
for (let iteration = 0; iteration < MAX_COMPACTION_ITERATIONS; iteration += 1) {
|
|
53
43
|
updateReadOutputReceiptEstimate(result, receipt);
|
|
54
44
|
if (receipt.estimated_tokens <= budget)
|
|
55
45
|
return;
|
|
56
|
-
const candidate =
|
|
57
|
-
.
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
const candidate = readOutputRowCollections(result)
|
|
47
|
+
.filter((collection) => (Array.isArray(collection.value)
|
|
48
|
+
? collection.value.length
|
|
49
|
+
: Object.keys(collection.value).length) > 1)
|
|
50
|
+
.map((collection) => ({
|
|
51
|
+
collection,
|
|
52
|
+
length: Array.isArray(collection.value)
|
|
53
|
+
? collection.value.length
|
|
54
|
+
: Object.keys(collection.value).length,
|
|
60
55
|
}))
|
|
61
|
-
.
|
|
62
|
-
.
|
|
63
|
-
left.key.localeCompare(right.key))[0];
|
|
56
|
+
.sort((left, right) => right.length - left.length ||
|
|
57
|
+
left.collection.path.localeCompare(right.collection.path))[0]?.collection;
|
|
64
58
|
if (!candidate)
|
|
65
59
|
return;
|
|
66
|
-
|
|
60
|
+
if (Array.isArray(candidate.value)) {
|
|
61
|
+
candidate.value.splice(-Math.max(1, Math.ceil(candidate.value.length / 2)));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const keys = Object.keys(candidate.value);
|
|
65
|
+
for (const key of keys.slice(-Math.max(1, Math.ceil(keys.length / 2)))) {
|
|
66
|
+
delete candidate.value[key];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
67
69
|
receipt.rows_compacted = true;
|
|
68
70
|
result.has_more = true;
|
|
69
71
|
result.truncated = true;
|
|
70
72
|
if (typeof result.count === "number") {
|
|
71
|
-
result.count =
|
|
73
|
+
result.count = countReadOutputRows(result);
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
}
|
|
@@ -83,4 +85,4 @@ export function compactReadOutputToBudget(result, receipt, budget) {
|
|
|
83
85
|
return compacted;
|
|
84
86
|
}
|
|
85
87
|
//# sourceMappingURL=read-output-budget.js.map
|
|
86
|
-
//# debugId=
|
|
88
|
+
//# debugId=1726fdce-dc71-5707-ae75-b588691e813d
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PmReadOutputSessionReceipt, type PmReadOutputSessionState } from "./read-output-session.js";
|
|
1
2
|
/** Stable output dimensions shared by every read surface. */
|
|
2
3
|
export declare const PM_READ_OUTPUT_DIMENSIONS: readonly ["include", "amount", "cost", "encoding"];
|
|
3
4
|
/** One member of the universal read-output dimension set. */
|
|
@@ -16,6 +17,8 @@ export interface PmReadOutputOptions {
|
|
|
16
17
|
outputBudget?: string | number;
|
|
17
18
|
/** Requested static renderer encoding; streaming remains a command behavior. */
|
|
18
19
|
outputFormat?: "json" | "toon";
|
|
20
|
+
/** Caller-carried cross-call budget and served-fact state. */
|
|
21
|
+
outputSession?: string | PmReadOutputSessionState;
|
|
19
22
|
}
|
|
20
23
|
/** Compatibility spelling retained for a command-specific output control. */
|
|
21
24
|
export interface PmReadOutputLegacyAlias {
|
|
@@ -118,11 +121,16 @@ export interface PmReadOutputBudgetExceeded {
|
|
|
118
121
|
/** Read result with an optional shaping receipt or a discriminated omission. */
|
|
119
122
|
export type PmReadOutputResult<Result> = (Result & {
|
|
120
123
|
read_output?: PmReadOutputReceipt;
|
|
121
|
-
|
|
124
|
+
read_session?: PmReadOutputSessionReceipt;
|
|
125
|
+
}) | (PmReadOutputBudgetExceeded & {
|
|
126
|
+
read_session?: PmReadOutputSessionReceipt;
|
|
127
|
+
});
|
|
122
128
|
/** Select the omission-aware result type when an option shape can request a budget. */
|
|
123
|
-
export type PmReadOutputResultFor<Result, Options> = "outputBudget" extends keyof Options ? PmReadOutputResult<Result> : Result;
|
|
129
|
+
export type PmReadOutputResultFor<Result, Options> = "outputBudget" extends keyof Options ? PmReadOutputResult<Result> : "outputSession" extends keyof Options ? PmReadOutputResult<Result> : Result;
|
|
124
130
|
/** Canonical CLI flags that opt a read invocation into universal output shaping. */
|
|
125
131
|
export declare const PM_READ_OUTPUT_OPTION_FLAGS: readonly string[];
|
|
132
|
+
/** Canonical control that composes the four per-call dimensions across reads. */
|
|
133
|
+
export declare const PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS: readonly ["--output-session"];
|
|
126
134
|
/** Universal output contract for every built-in read surface. */
|
|
127
135
|
export declare const PM_READ_OUTPUT_SURFACE_CONTRACTS: readonly PmReadOutputSurfaceContract[];
|
|
128
136
|
/** Resolve a command or list/context alias to its canonical read-output surface. */
|