@unbrained/pm-cli 2026.8.20 → 2026.8.22

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.
Files changed (228) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +38 -0
  3. package/dist/cli/error-guidance.d.ts +29 -4
  4. package/dist/cli/error-guidance.js +43 -43
  5. package/dist/cli/main.d.ts +3 -0
  6. package/dist/cli/main.js +40 -7
  7. package/dist/cli-bundle/bundle-manifest.json +150 -150
  8. package/dist/cli-bundle/chunks/{chunk-L4LGPBJU.js → chunk-BWX4SK46.js} +58 -58
  9. package/dist/cli-bundle/chunks/chunk-EMWDM5FI.js +13 -0
  10. package/dist/cli-bundle/chunks/chunk-HYG6LRL4.js +200 -0
  11. package/dist/cli-bundle/chunks/{chunk-TSMWLCHS.js → chunk-MYYI3ZOA.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-4GB2LTOQ.js → chunk-MZTZQTMS.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-7BRF2BX2.js → chunk-QI2CT3IX.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-SMWXHMVB.js +35 -0
  15. package/dist/cli-bundle/chunks/{chunk-US2ZQW2M.js → chunk-U6GQ4VMV.js} +47 -47
  16. package/dist/cli-bundle/chunks/{chunk-K3EN3LK2.js → chunk-VMMIL3SI.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-WG4STC36.js +5 -0
  18. package/dist/cli-bundle/chunks/{chunk-XYDDWBZN.js → chunk-YBPJAOQQ.js} +3 -3
  19. package/dist/cli-bundle/chunks/{register-list-query-JSAQCVOC.js → register-list-query-HZKBQNWW.js} +2 -2
  20. package/dist/cli-bundle/chunks/{register-mutation-XJPAW63D.js → register-mutation-HTKEEGRD.js} +2 -2
  21. package/dist/cli-bundle/chunks/{register-operations-DSOSB2XQ.js → register-operations-6EMRWJJY.js} +2 -2
  22. package/dist/cli-bundle/chunks/{register-setup-QUR6QL2C.js → register-setup-QK4OTOXN.js} +2 -2
  23. package/dist/cli-bundle/focused-chunks/{chunk-TDR5OGG3.js → chunk-2ARQGDDW.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/{chunk-AZBACT5T.js → chunk-2AZT5WXZ.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/{chunk-M32HFIQB.js → chunk-2POVTNLY.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/chunk-3LKU6PTJ.js +4 -0
  27. package/dist/cli-bundle/focused-chunks/chunk-5SHSBMX2.js +2 -0
  28. package/dist/cli-bundle/focused-chunks/{chunk-UGSS4F5X.js → chunk-6S2MO3Q3.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-5L7M4AI7.js → chunk-A2BC5PQL.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/chunk-C4S4A4JJ.js +5 -0
  31. package/dist/cli-bundle/focused-chunks/{chunk-OM65KHGF.js → chunk-D6RBZEJJ.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-E2EWYPY6.js +16 -0
  33. package/dist/cli-bundle/focused-chunks/{chunk-G3C5ERXG.js → chunk-GMYPD4FX.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/chunk-L5LDSRO2.js +155 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-BLJCGGID.js → chunk-MB37AYN6.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/chunk-MCOR37QK.js +2 -0
  37. package/dist/cli-bundle/focused-chunks/{chunk-FUREQLQN.js → chunk-PH2OXXVZ.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-325UXIO7.js → chunk-PMGJUFNQ.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/chunk-R6SR45XU.js +50 -0
  40. package/dist/cli-bundle/focused-chunks/chunk-WZE4LIPW.js +8 -0
  41. package/dist/cli-bundle/main.js +13 -13
  42. package/dist/cli-bundle/sdk-authoring.js +1 -1
  43. package/dist/cli-bundle/sdk-contracts.js +2 -2
  44. package/dist/cli-bundle/sdk-core.js +40 -40
  45. package/dist/cli-bundle/sdk-governance.js +1 -1
  46. package/dist/cli-bundle/sdk-graph.js +1 -1
  47. package/dist/cli-bundle/sdk-merge.js +32 -32
  48. package/dist/cli-bundle/sdk-query.js +1 -1
  49. package/dist/cli-bundle/sdk-runtime.js +1 -1
  50. package/dist/cli-bundle/sdk-testing.js +1 -1
  51. package/dist/cli-bundle/sdk.js +5 -5
  52. package/dist/core/extensions/extension-hook-runtime.js +22 -20
  53. package/dist/core/extensions/extension-types.d.ts +8 -1
  54. package/dist/core/extensions/extension-types.js +2 -2
  55. package/dist/core/extensions/loader.js +7 -3
  56. package/dist/core/extensions/service-ownership.d.ts +8 -0
  57. package/dist/core/extensions/service-ownership.js +20 -0
  58. package/dist/core/item/id.js +20 -5
  59. package/dist/core/item/item-format.js +27 -2
  60. package/dist/core/shared/errors.d.ts +20 -0
  61. package/dist/core/shared/errors.js +2 -2
  62. package/dist/core/store/item-store.js +6 -91
  63. package/dist/core/store/tracker-preflight.d.ts +7 -0
  64. package/dist/core/store/tracker-preflight.js +142 -0
  65. package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
  66. package/dist/sdk/agent/tracker-preflight-contracts.d.ts +63 -0
  67. package/dist/sdk/agent/tracker-preflight-contracts.js +127 -0
  68. package/dist/sdk/annotations.js +6 -7
  69. package/dist/sdk/authoring.d.ts +1 -1
  70. package/dist/sdk/authoring.js +2 -2
  71. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +77 -0
  72. package/dist/sdk/cli-contracts/agent-output-contracts.js +324 -2
  73. package/dist/sdk/cli-contracts/commander-mutation-options.js +3 -3
  74. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +3 -1
  75. package/dist/sdk/cli-contracts/runtime-contracts.js +4 -3
  76. package/dist/sdk/cli-contracts.d.ts +1 -1
  77. package/dist/sdk/cli-contracts.js +3 -3
  78. package/dist/sdk/config.d.ts +5 -0
  79. package/dist/sdk/config.js +5 -5
  80. package/dist/sdk/context-intent-runtime.js +7 -4
  81. package/dist/sdk/contracts.d.ts +1 -0
  82. package/dist/sdk/contracts.js +3 -2
  83. package/dist/sdk/dependencies.js +5 -7
  84. package/dist/sdk/dependency-flag-validation.d.ts +1 -1
  85. package/dist/sdk/dependency-flag-validation.js +10 -4
  86. package/dist/sdk/environment/tracker-preflight.d.ts +6 -0
  87. package/dist/sdk/environment/tracker-preflight.js +10 -0
  88. package/dist/sdk/eval.js +5 -7
  89. package/dist/sdk/extension/install-sources.d.ts +1 -1
  90. package/dist/sdk/extension/install-sources.js +6 -3
  91. package/dist/sdk/extension/output-ownership.d.ts +1 -0
  92. package/dist/sdk/extension/output-ownership.js +3 -2
  93. package/dist/sdk/files.js +6 -10
  94. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +75 -15
  95. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +81 -8
  96. package/dist/sdk/governance/assurance.d.ts +36 -2
  97. package/dist/sdk/governance/assurance.js +184 -10
  98. package/dist/sdk/governance/gc.js +5 -6
  99. package/dist/sdk/governance/health.d.ts +3 -0
  100. package/dist/sdk/governance/health.js +42 -11
  101. package/dist/sdk/governance/hierarchy-validation.d.ts +29 -0
  102. package/dist/sdk/governance/hierarchy-validation.js +109 -0
  103. package/dist/sdk/governance/reindex.js +5 -6
  104. package/dist/sdk/governance/validate.d.ts +2 -9
  105. package/dist/sdk/governance/validate.js +51 -109
  106. package/dist/sdk/graph/assembly.d.ts +6 -1
  107. package/dist/sdk/graph/assembly.js +16 -22
  108. package/dist/sdk/graph/governance-contracts.d.ts +1 -1
  109. package/dist/sdk/graph/governance-contracts.js +8 -2
  110. package/dist/sdk/graph/governance.d.ts +7 -5
  111. package/dist/sdk/graph/governance.js +76 -16
  112. package/dist/sdk/graph/hierarchy-integrity.d.ts +94 -0
  113. package/dist/sdk/graph/hierarchy-integrity.js +311 -0
  114. package/dist/sdk/graph/index.d.ts +2 -1
  115. package/dist/sdk/graph/index.js +3 -2
  116. package/dist/sdk/graph/remediation.js +32 -2
  117. package/dist/sdk/graph/run.d.ts +31 -2
  118. package/dist/sdk/graph/run.js +83 -36
  119. package/dist/sdk/graph/traversal.js +14 -5
  120. package/dist/sdk/graph/workspace-relationship-kind-registry.d.ts +8 -0
  121. package/dist/sdk/graph/workspace-relationship-kind-registry.js +28 -0
  122. package/dist/sdk/history-compact.js +6 -9
  123. package/dist/sdk/history-read.js +5 -7
  124. package/dist/sdk/history-redact.js +5 -6
  125. package/dist/sdk/history-repair.js +6 -9
  126. package/dist/sdk/improvement-ledger.js +7 -10
  127. package/dist/sdk/index.d.ts +4 -2
  128. package/dist/sdk/index.js +5 -3
  129. package/dist/sdk/item-children.js +21 -8
  130. package/dist/sdk/lifecycle/append.d.ts +0 -5
  131. package/dist/sdk/lifecycle/append.js +5 -6
  132. package/dist/sdk/lifecycle/claim.d.ts +0 -5
  133. package/dist/sdk/lifecycle/claim.js +6 -9
  134. package/dist/sdk/lifecycle/close-many.d.ts +0 -5
  135. package/dist/sdk/lifecycle/close-many.js +5 -6
  136. package/dist/sdk/lifecycle/close.d.ts +0 -5
  137. package/dist/sdk/lifecycle/close.js +5 -6
  138. package/dist/sdk/lifecycle/copy.d.ts +0 -5
  139. package/dist/sdk/lifecycle/copy.js +5 -6
  140. package/dist/sdk/lifecycle/create.d.ts +0 -5
  141. package/dist/sdk/lifecycle/create.js +127 -102
  142. package/dist/sdk/lifecycle/delete.js +5 -6
  143. package/dist/sdk/lifecycle/focus.d.ts +0 -5
  144. package/dist/sdk/lifecycle/focus.js +5 -6
  145. package/dist/sdk/lifecycle/hierarchy-mutation-lock.d.ts +15 -0
  146. package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +25 -0
  147. package/dist/sdk/lifecycle/plan.d.ts +0 -5
  148. package/dist/sdk/lifecycle/plan.js +5 -6
  149. package/dist/sdk/lifecycle/restore.js +5 -6
  150. package/dist/sdk/lifecycle/update-many.d.ts +0 -5
  151. package/dist/sdk/lifecycle/update-many.js +5 -6
  152. package/dist/sdk/lifecycle/update.d.ts +2 -5
  153. package/dist/sdk/lifecycle/update.js +211 -84
  154. package/dist/sdk/linked-artifacts.js +6 -7
  155. package/dist/sdk/merge/install.js +5 -6
  156. package/dist/sdk/mutation-events.js +5 -7
  157. package/dist/sdk/package-import-adapters.js +6 -8
  158. package/dist/sdk/profile.js +6 -7
  159. package/dist/sdk/query/activity.js +5 -6
  160. package/dist/sdk/query/calendar.js +5 -6
  161. package/dist/sdk/query/complete-list.d.ts +3 -3
  162. package/dist/sdk/query/complete-list.js +46 -3
  163. package/dist/sdk/query/get.d.ts +0 -5
  164. package/dist/sdk/query/get.js +5 -6
  165. package/dist/sdk/query/history.d.ts +0 -5
  166. package/dist/sdk/query/history.js +5 -6
  167. package/dist/sdk/query/list.d.ts +4 -3
  168. package/dist/sdk/query/list.js +92 -54
  169. package/dist/sdk/query/search.js +5 -7
  170. package/dist/sdk/read-output-contracts.d.ts +5 -1
  171. package/dist/sdk/read-output-contracts.js +87 -22
  172. package/dist/sdk/relationship-context.js +3 -4
  173. package/dist/sdk/relationship-kinds/contract.d.ts +8 -0
  174. package/dist/sdk/relationship-kinds/contract.js +13 -13
  175. package/dist/sdk/relationships.d.ts +1 -1
  176. package/dist/sdk/relationships.js +27 -2
  177. package/dist/sdk/runtime.d.ts +3 -2
  178. package/dist/sdk/runtime.js +3 -2
  179. package/dist/sdk/schema-migration.js +6 -7
  180. package/dist/sdk/schema.js +5 -6
  181. package/dist/sdk/stats.js +5 -8
  182. package/dist/sdk/templates.js +5 -6
  183. package/dist/sdk/test/batch.js +15 -9
  184. package/dist/sdk/test/execution.js +12 -5
  185. package/dist/sdk/test/runs.js +5 -7
  186. package/dist/types.d.ts +11 -0
  187. package/dist/types.js +2 -2
  188. package/docs/AGENT_UX_CONTRACTS.md +24 -1
  189. package/docs/COMMANDS.md +29 -14
  190. package/docs/DEPENDENCY_KIND_CONTRACT.md +40 -1
  191. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +98 -0
  192. package/docs/EXTENSIONS.md +2 -1
  193. package/docs/README.md +1 -0
  194. package/docs/READ_OUTPUT_CONTRACTS.md +9 -2
  195. package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +37 -0
  196. package/docs/RELATIONSHIP_GRAPH.md +97 -12
  197. package/docs/SDK_PRIMITIVE_INVENTORY.md +15 -1
  198. package/docs/TESTING.md +15 -0
  199. package/marketplace.json +2 -2
  200. package/package.json +1 -1
  201. package/packages/pm-beads/package.json +1 -1
  202. package/packages/pm-calendar/package.json +1 -1
  203. package/packages/pm-command-kit/package.json +1 -1
  204. package/packages/pm-digital-twin/package.json +1 -1
  205. package/packages/pm-governance-audit/package.json +1 -1
  206. package/packages/pm-guide-shell/package.json +1 -1
  207. package/packages/pm-kanban/package.json +1 -1
  208. package/packages/pm-lifecycle-hooks/package.json +1 -1
  209. package/packages/pm-linked-test-adapters/package.json +1 -1
  210. package/packages/pm-search-advanced/package.json +1 -1
  211. package/packages/pm-templates/package.json +1 -1
  212. package/packages/pm-todos/package.json +1 -1
  213. package/packages/pm-vcs/package.json +1 -1
  214. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  215. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  216. package/sdk/public-surface.json +848 -56
  217. package/dist/cli-bundle/chunks/chunk-2RDVGYWE.js +0 -13
  218. package/dist/cli-bundle/chunks/chunk-BLVQHFSY.js +0 -35
  219. package/dist/cli-bundle/chunks/chunk-CU25EQVV.js +0 -5
  220. package/dist/cli-bundle/chunks/chunk-RS3IV2R6.js +0 -197
  221. package/dist/cli-bundle/focused-chunks/chunk-6AHG2YW7.js +0 -50
  222. package/dist/cli-bundle/focused-chunks/chunk-GXWQBE3T.js +0 -8
  223. package/dist/cli-bundle/focused-chunks/chunk-JWKEDZJI.js +0 -4
  224. package/dist/cli-bundle/focused-chunks/chunk-KYZ6JGPL.js +0 -155
  225. package/dist/cli-bundle/focused-chunks/chunk-Q47EX4DI.js +0 -2
  226. package/dist/cli-bundle/focused-chunks/chunk-RIHDMCUM.js +0 -2
  227. package/dist/cli-bundle/focused-chunks/chunk-T4ZFY7ZJ.js +0 -16
  228. package/dist/cli-bundle/focused-chunks/chunk-Z3PLWSGM.js +0 -2
@@ -8,7 +8,8 @@
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]="5e1810a5-04b8-5929-8eee-7a63f1684860")}catch(e){}}();
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]="dea4137f-adbd-5dca-bfc7-b56c99c7aa79")}catch(e){}}();
12
+ import { assertInitializedTracker } from "../environment/tracker-preflight.js";
12
13
  import { isFileMissingError } from "../../core/fs/fs-utils.js";
13
14
  import { readFile, realpath, writeFile } from "node:fs/promises";
14
15
  import { execFile } from "node:child_process";
@@ -22,7 +23,7 @@ import { EXIT_CODE } from "../../core/shared/constants.js";
22
23
  import { PmCliError } from "../../core/shared/errors.js";
23
24
  import { resolveAuthor } from "../../core/shared/author.js";
24
25
  import { nowIso } from "../../core/shared/time.js";
25
- import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
26
+ import { resolvePmRoot } from "../../core/store/paths.js";
26
27
  import { readSettings, resolveGovernanceKnobs, } from "../../core/store/settings.js";
27
28
  import { isPathOutsideRoot } from "../workspace.js";
28
29
  import { resolveSourceContextWritePolicy } from "../environment/source-context.js";
@@ -453,9 +454,7 @@ export async function runMergeInstall(options, global) {
453
454
  environment: process.env,
454
455
  });
455
456
  const pmRoot = context.pm_root;
456
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
457
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
458
- }
457
+ await assertInitializedTracker(pmRoot);
459
458
  const workspaceRoot = await resolveGitWorkspaceRoot(context.workspace_start);
460
459
  return installMergeFence({
461
460
  pmRoot,
@@ -561,4 +560,4 @@ export async function installMergeFence(options) {
561
560
  };
562
561
  }
563
562
  //# sourceMappingURL=install.js.map
564
- //# debugId=5e1810a5-04b8-5929-8eee-7a63f1684860
563
+ //# debugId=dea4137f-adbd-5dca-bfc7-b56c99c7aa79
@@ -5,15 +5,15 @@
5
5
  * history store without requiring a daemon or shell subprocess.
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]="e8cd5790-eacf-5ef7-bc0a-11ea3fe17d2d")}catch(e){}}();
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]="01043e67-99d4-5b68-a1b2-33f35f5cef5f")}catch(e){}}();
9
+ import { assertInitializedTracker } from "./environment/tracker-preflight.js";
9
10
  import { createHash } from "node:crypto";
10
11
  import { setTimeout as delay } from "node:timers/promises";
11
12
  import { queryHistoryEventIndex, queryHistoryEventStreams, rebuildHistoryEventIndex, } from "../core/history/event-index.js";
12
- import { pathExists } from "../core/fs/fs-utils.js";
13
13
  import { EXIT_CODE } from "../core/shared/constants.js";
14
14
  import { PmCliError } from "../core/shared/errors.js";
15
15
  import { stableStringify } from "../core/shared/serialization.js";
16
- import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
16
+ import { resolvePmRoot } from "../core/store/paths.js";
17
17
  import { readSettings } from "../core/store/settings.js";
18
18
  import { parseHistoryProvenanceFilters, projectHistoryProvenance, resolveHistoryProvenanceDimensions, summarizeHistoryProvenance, } from "./history-provenance.js";
19
19
  const MUTATION_EVENT_CURSOR_VERSION = 1;
@@ -150,9 +150,7 @@ function resolveMutationEventCursorMode(value) {
150
150
  /** Read one bounded page of mutation events from the persistent projection. */
151
151
  export async function listMutationEvents(options = {}) {
152
152
  const pmRoot = resolvePmRoot(options.cwd ?? process.cwd(), options.pmRoot);
153
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
154
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
155
- }
153
+ await assertInitializedTracker(pmRoot);
156
154
  const requestedLimit = parseMutationEventLimit(options.limit);
157
155
  const cursorMode = resolveMutationEventCursorMode(options.cursorMode);
158
156
  if (options.full === true && options.provenance === true) {
@@ -292,4 +290,4 @@ export const _testOnlyMutationEvents = {
292
290
  resolveMutationEventStart,
293
291
  };
294
292
  //# sourceMappingURL=mutation-events.js.map
295
- //# debugId=e8cd5790-eacf-5ef7-bc0a-11ea3fe17d2d
293
+ //# debugId=01043e67-99d4-5b68-a1b2-33f35f5cef5f
@@ -13,19 +13,20 @@
13
13
  * helper bodies while keeping each package's explicit field mapping in the package.
14
14
  */
15
15
 
16
- !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]="c2567f6a-cd1c-56b5-a93d-41e92ed574bf")}catch(e){}}();
16
+ !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]="863df651-49e0-552f-a7f0-92c3cc9a12a2")}catch(e){}}();
17
17
  import { appendHistoryEntry, createHistoryEntry, } from "../core/history/history.js";
18
18
  import { acquireLock } from "../core/lock/lock.js";
19
19
  import { parseTags } from "../core/item/parse.js";
20
20
  import { normalizeStatusInput } from "../core/item/status.js";
21
21
  import { serializeItemDocument } from "../core/item/item-format.js";
22
- import { getHistoryPath, getSettingsPath } from "../core/store/paths.js";
23
- import { pathExists, removeFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
22
+ import { getHistoryPath } from "../core/store/paths.js";
23
+ import { removeFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
24
24
  import { runActiveOnWriteHooks } from "../core/extensions/index.js";
25
25
  import { EXIT_CODE } from "../core/shared/constants.js";
26
26
  import { PmCliError } from "../core/shared/errors.js";
27
27
  import { resolveAuthor } from "../core/shared/author.js";
28
28
  import { nowIso } from "../core/shared/time.js";
29
+ import { assertInitializedTracker } from "./environment/tracker-preflight.js";
29
30
  /** Returns the trimmed string when `value` is a non-empty string, else undefined. */
30
31
  export function toNonEmptyImportString(value) {
31
32
  if (typeof value !== "string") {
@@ -367,10 +368,7 @@ function toImportLinkedTestAssertions(entry) {
367
368
  }
368
369
  /** Throws a NOT_FOUND PmCliError when the tracker has not been initialized. */
369
370
  export async function ensureTrackerInitialized(pmRoot) {
370
- const exists = await pathExists(getSettingsPath(pmRoot));
371
- if (!exists) {
372
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
373
- }
371
+ await assertInitializedTracker(pmRoot);
374
372
  }
375
373
  /** Returns an empty item document used as the `before` state on import. */
376
374
  export function emptyImportedDocument() {
@@ -442,4 +440,4 @@ export async function commitImportedItem(params) {
442
440
  }
443
441
  }
444
442
  //# sourceMappingURL=package-import-adapters.js.map
445
- //# debugId=c2567f6a-cd1c-56b5-a93d-41e92ed574bf
443
+ //# debugId=863df651-49e0-552f-a7f0-92c3cc9a12a2
@@ -10,16 +10,17 @@
10
10
  * and human formatting around it.
11
11
  */
12
12
 
13
- !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]="a1e34cfb-3d4e-5b79-8585-3162e71e574c")}catch(e){}}();
13
+ !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]="f65b4f1f-5501-5829-a04b-d4fbcfb59f5c")}catch(e){}}();
14
+ import { assertInitializedTracker } from "./environment/tracker-preflight.js";
14
15
  import path from "node:path";
15
- import { pathExists, readFileIfExists, } from "../core/fs/fs-utils.js";
16
+ import { readFileIfExists, } from "../core/fs/fs-utils.js";
16
17
  import { writeWorkspaceJsonWithHistory } from "../core/history/workspace-history.js";
17
18
  import { acquireLock } from "../core/lock/lock.js";
18
19
  import { EXIT_CODE } from "../core/shared/constants.js";
19
20
  import { PmCliError } from "../core/shared/errors.js";
20
21
  import { resolveAuthor } from "../core/shared/author.js";
21
22
  import { nowIso } from "../core/shared/time.js";
22
- import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
23
+ import { resolvePmRoot } from "../core/store/paths.js";
23
24
  import { readSettings, resolveGovernanceKnobs, writeSettings, } from "../core/store/settings.js";
24
25
  import { DEFAULT_RUNTIME_SCHEMA_FILE_PATHS, filePathForSchemaSection, normalizeRuntimeSchemaSettings, } from "../core/schema/runtime-schema.js";
25
26
  import { normalizeAddTypeInput, serializeItemTypesFile, } from "../core/schema/item-types-file.js";
@@ -198,9 +199,7 @@ function buildApplyResult(profile, plan, applied, dryRun, warnings) {
198
199
  };
199
200
  }
200
201
  async function assertProfileTrackerInitialized(pmRoot) {
201
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
202
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
203
- }
202
+ await assertInitializedTracker(pmRoot);
204
203
  }
205
204
  function resolveProfileForCommand(name) {
206
205
  try {
@@ -453,4 +452,4 @@ export function formatProfileApplyHuman(result) {
453
452
  }
454
453
  /* c8 ignore stop */
455
454
  //# sourceMappingURL=profile.js.map
456
- //# debugId=a1e34cfb-3d4e-5b79-8585-3162e71e574c
455
+ //# debugId=f65b4f1f-5501-5829-a04b-d4fbcfb59f5c
@@ -4,11 +4,12 @@
4
4
  * Implements the pm activity 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]="49304d18-d722-5413-8e4d-4f2c3df4a1ca")}catch(e){}}();
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]="7005305a-5fd4-56b8-a0a0-5612e8bf48cc")}catch(e){}}();
8
+ import { assertInitializedTracker } from "../environment/tracker-preflight.js";
8
9
  import { isFileMissingError } from "../../core/fs/fs-utils.js";
9
10
  import fs from "node:fs/promises";
10
11
  import path from "node:path";
11
- import { getActiveExtensionRegistrations, runActiveOnReadHooks, pathExists, enforceHistoryStreamPolicyForItems, resolveItemTypeRegistry, EXIT_CODE, PmCliError, compareTimestampStrings, nowIso, resolveIsoOrRelative, listAllItemMetadataLight, getSettingsPath, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
12
+ import { getActiveExtensionRegistrations, runActiveOnReadHooks, enforceHistoryStreamPolicyForItems, resolveItemTypeRegistry, EXIT_CODE, PmCliError, compareTimestampStrings, nowIso, resolveIsoOrRelative, listAllItemMetadataLight, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
12
13
  import { readHistoryEntries } from "../history-read.js";
13
14
  import { parseLimit } from "./parsers.js";
14
15
  import { resolveModePairedOutputOmissionReceipt, } from "../output-projection.js";
@@ -168,9 +169,7 @@ function resolveActivityFilters(options, projectionMode) {
168
169
  }
169
170
  async function resolveActivityRuntimeContext(global) {
170
171
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
171
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
172
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
173
- }
172
+ await assertInitializedTracker(pmRoot);
174
173
  return {
175
174
  pmRoot,
176
175
  settings: await readSettings(pmRoot),
@@ -400,4 +399,4 @@ export async function runActivity(options, global) {
400
399
  };
401
400
  }
402
401
  //# sourceMappingURL=activity.js.map
403
- //# debugId=49304d18-d722-5413-8e4d-4f2c3df4a1ca
402
+ //# debugId=7005305a-5fd4-56b8-a0a0-5612e8bf48cc
@@ -4,9 +4,10 @@
4
4
  * Implements the pm calendar 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]="f1677c6e-872e-5c42-ae3d-f73f4ec73616")}catch(e){}}();
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]="47de55f1-589f-5743-bcb8-3b7a6302dfbb")}catch(e){}}();
8
+ import { assertInitializedTracker } from "../environment/tracker-preflight.js";
8
9
  import { encode as encodeToon } from "@toon-format/toon";
9
- import { pathExists, getActiveExtensionRegistrations, resolveItemTypeRegistry, normalizeStatusInput, collectRuntimeFilterValues, matchesRuntimeFilters, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, PmCliError, levenshteinDistanceWithinLimit, compareTimestampStrings, nowIso, resolveIsoOrRelative, listAllItemMetadataLight, getSettingsPath, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
10
+ import { getActiveExtensionRegistrations, resolveItemTypeRegistry, normalizeStatusInput, collectRuntimeFilterValues, matchesRuntimeFilters, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, PmCliError, levenshteinDistanceWithinLimit, compareTimestampStrings, nowIso, resolveIsoOrRelative, listAllItemMetadataLight, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
10
11
  import { parseIntegerLimit, parsePriority, parseType, } from "./parsers.js";
11
12
  import { weekdayOrderIndex, } from "../../types/index.js";
12
13
  const CALENDAR_VIEW_VALUES = ["agenda", "day", "week", "month"];
@@ -928,9 +929,7 @@ function buildCalendarRangeResult(options, rangeBounds) {
928
929
  /** Implements run calendar for the public runtime surface of this module. */
929
930
  export async function runCalendar(options, global) {
930
931
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
931
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
932
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
933
- }
932
+ await assertInitializedTracker(pmRoot);
934
933
  const inputs = resolveCalendarExecutionInputs(options);
935
934
  const settings = await readSettings(pmRoot);
936
935
  const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
@@ -963,4 +962,4 @@ export async function runCalendar(options, global) {
963
962
  };
964
963
  }
965
964
  //# sourceMappingURL=calendar.js.map
966
- //# debugId=f1677c6e-872e-5c42-ae3d-f73f4ec73616
965
+ //# debugId=47de55f1-589f-5743-bcb8-3b7a6302dfbb
@@ -6,7 +6,7 @@
6
6
  import type { PmReadOutputReceipt } from "../read-output-contracts.js";
7
7
  import type { ListFullResult, ListOptions } from "./list.js";
8
8
  /** Stable reasons a purported whole-workspace list cannot be trusted. */
9
- export declare const PM_COMPLETE_LIST_FINDING_CODES: readonly ["invalid_envelope", "source_incomplete", "source_unchecked", "filtered_corpus", "terminal_items_excluded", "strict_read_unproven", "page_incomplete", "count_mismatch", "projection_incomplete", "field_omission", "budget_compaction", "budget_omission", "session_projection", "invalid_item_id", "duplicate_item_id"];
9
+ export declare const PM_COMPLETE_LIST_FINDING_CODES: readonly ["invalid_envelope", "source_incomplete", "source_unchecked", "filtered_corpus", "terminal_items_excluded", "strict_read_unproven", "page_incomplete", "count_mismatch", "projection_incomplete", "field_omission", "omission_receipt_missing", "omission_receipt_invalid", "read_output_missing", "read_output_invalid", "read_output_dimensions_incomplete", "budget_compaction", "budget_omission", "session_projection", "invalid_item_id", "duplicate_item_id"];
10
10
  /** Machine-readable reason a complete-list candidate failed certification. */
11
11
  export type PmCompleteListFindingCode = (typeof PM_COMPLETE_LIST_FINDING_CODES)[number];
12
12
  /** One independently actionable complete-list contract violation. */
@@ -39,8 +39,8 @@ export interface PmCompleteListCertificate {
39
39
  export interface PmCompleteListResult extends ListFullResult {
40
40
  /** Exact proof that the returned rows represent the full tracker corpus. */
41
41
  complete_list: PmCompleteListCertificate;
42
- /** Universal read receipt when the runtime attached one. */
43
- read_output?: PmReadOutputReceipt;
42
+ /** Mandatory universal read receipt proving unbounded, uncompacted delivery. */
43
+ read_output: PmReadOutputReceipt;
44
44
  }
45
45
  /** Inspection report returned without throwing for policy and UI consumers. */
46
46
  export interface PmCompleteListInspection {
@@ -1,6 +1,6 @@
1
1
  /** Stable reasons a purported whole-workspace list cannot be trusted. */
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]="cc342d27-aa2d-5e84-8441-46a35c42dc00")}catch(e){}}();
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]="c14a67b4-102d-5219-b2b3-15d39da36627")}catch(e){}}();
4
4
  export const PM_COMPLETE_LIST_FINDING_CODES = [
5
5
  "invalid_envelope",
6
6
  "source_incomplete",
@@ -12,6 +12,11 @@ export const PM_COMPLETE_LIST_FINDING_CODES = [
12
12
  "count_mismatch",
13
13
  "projection_incomplete",
14
14
  "field_omission",
15
+ "omission_receipt_missing",
16
+ "omission_receipt_invalid",
17
+ "read_output_missing",
18
+ "read_output_invalid",
19
+ "read_output_dimensions_incomplete",
15
20
  "budget_compaction",
16
21
  "budget_omission",
17
22
  "session_projection",
@@ -31,7 +36,7 @@ export class PmCompleteListValidationError extends Error {
31
36
  contract: "complete_list",
32
37
  findings,
33
38
  recovery: {
34
- suggested_retry: "pm list-all --full --strict-read --no-truncate --output-budget unbounded --json",
39
+ suggested_retry: "pm list --all --output-include full --strict-read --no-truncate --output-budget unbounded --output-limit unbounded --json",
35
40
  sdk: "await client.listAllComplete()",
36
41
  },
37
42
  };
@@ -67,6 +72,17 @@ function inspectSourceScope(candidate, findings) {
67
72
  : {};
68
73
  addFinding(findings, completeness.status === "partial", "source_incomplete", "The source scan reported unreadable tracker artifacts.");
69
74
  addFinding(findings, completeness.status !== "complete" && completeness.status !== "partial", "source_unchecked", "The source scan did not prove completeness.");
75
+ const unreadableItemCount = completeness.unreadable_item_count;
76
+ const unreadableDirectoryCount = completeness.unreadable_directory_count;
77
+ addFinding(findings, completeness.status === "complete" &&
78
+ (unreadableItemCount !== 0 || unreadableDirectoryCount !== 0) &&
79
+ Number.isSafeInteger(unreadableItemCount) &&
80
+ Number.isSafeInteger(unreadableDirectoryCount), "source_incomplete", "The source scan reports unreadable tracker artifacts despite a complete status.");
81
+ addFinding(findings, completeness.status === "complete" &&
82
+ (!Number.isSafeInteger(unreadableItemCount) ||
83
+ !Number.isSafeInteger(unreadableDirectoryCount) ||
84
+ Number(unreadableItemCount) < 0 ||
85
+ Number(unreadableDirectoryCount) < 0), "source_unchecked", "The source scan did not report safe non-negative unreadable counts.");
70
86
  const filters = isRecord(candidate.filters) ? candidate.filters : {};
71
87
  const runtimeFilters = isRecord(filters.runtime_filters)
72
88
  ? filters.runtime_filters
@@ -100,13 +116,40 @@ function inspectEnvelopeShape(candidate, filters, findings) {
100
116
  const omissionReceipt = isRecord(candidate.omission_receipt)
101
117
  ? candidate.omission_receipt
102
118
  : undefined;
119
+ addFinding(findings, omissionReceipt === undefined, "omission_receipt_missing", "The result carries no field-omission receipt.");
120
+ addFinding(findings, omissionReceipt !== undefined &&
121
+ (omissionReceipt.has_omissions !== false ||
122
+ omissionReceipt.omitted_field_group_count !== 0 ||
123
+ !Number.isSafeInteger(omissionReceipt.omitted_field_group_count) ||
124
+ !Array.isArray(omissionReceipt.omitted_field_groups) ||
125
+ omissionReceipt.omitted_field_groups.length !== 0), "omission_receipt_invalid", "The field-omission receipt is malformed or contradicts its no-omission claim.");
103
126
  addFinding(findings, omissionReceipt?.has_omissions === true, "field_omission", "The omission receipt reports withheld field groups.");
104
127
  }
128
+ /** Return whether a universal read receipt cannot prove an intact list result. */
129
+ function isInvalidCompleteListReadOutput(readOutput) {
130
+ return (readOutput.contract_version !== 1 ||
131
+ readOutput.command !== "list" ||
132
+ readOutput.within_budget !== true ||
133
+ readOutput.strings_compacted !== false ||
134
+ readOutput.rows_compacted !== false ||
135
+ readOutput.result_omitted !== false);
136
+ }
137
+ /** Return whether the receipt proves every dimension required for an unbounded full read. */
138
+ function hasCompleteListReadOutputDimensions(readOutput) {
139
+ if (!Array.isArray(readOutput.requested_dimensions))
140
+ return false;
141
+ const requestedDimensions = new Set(readOutput.requested_dimensions);
142
+ return ["include", "amount", "cost"].every((dimension) => requestedDimensions.has(dimension));
143
+ }
105
144
  /** Append universal-output and cross-call-session findings. */
106
145
  function inspectOutputScope(candidate, findings) {
107
146
  const readOutput = isRecord(candidate.read_output)
108
147
  ? candidate.read_output
109
148
  : undefined;
149
+ addFinding(findings, readOutput === undefined, "read_output_missing", "The result carries no universal read-output receipt.");
150
+ addFinding(findings, readOutput !== undefined && isInvalidCompleteListReadOutput(readOutput), "read_output_invalid", "The universal read-output receipt does not prove an intact list result.");
151
+ addFinding(findings, readOutput !== undefined &&
152
+ !hasCompleteListReadOutputDimensions(readOutput), "read_output_dimensions_incomplete", "The universal read-output receipt does not prove full, unbounded include, amount, and cost dimensions.");
110
153
  addFinding(findings, readOutput?.strings_compacted === true ||
111
154
  readOutput?.rows_compacted === true ||
112
155
  candidate.output_budget_truncation !== undefined, "budget_compaction", "Universal output shaping compacted the result.");
@@ -170,4 +213,4 @@ export function assertCompleteListResult(candidate) {
170
213
  certifyCompleteListResult(candidate);
171
214
  }
172
215
  //# sourceMappingURL=complete-list.js.map
173
- //# debugId=cc342d27-aa2d-5e84-8441-46a35c42dc00
216
+ //# debugId=c14a67b4-102d-5219-b2b3-15d39da36627
@@ -1,8 +1,3 @@
1
- /**
2
- * @module sdk/query/get
3
- *
4
- * Implements the SDK-owned item query shared by every surface.
5
- */
6
1
  import { type GlobalOptions } from "../runtime-primitives.js";
7
2
  import { type ChildRollupContext } from "../item-children.js";
8
3
  import { type ItemScheduleContext } from "../item-schedule.js";
@@ -4,8 +4,9 @@
4
4
  * Implements the SDK-owned item query shared by every surface.
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]="16d0a1cf-467d-5041-ab36-e2a9033a9342")}catch(e){}}();
8
- import { pathExists, getActiveExtensionRegistrations, toItemRecord, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, TYPE_TO_FOLDER, PmCliError, buildItemNotFoundError, listAllItemMetadataLight, locateItem, readLocatedItem, getHistoryPath, getSettingsPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
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]="ff82974e-a48d-5d18-893f-fb618e378795")}catch(e){}}();
8
+ import { assertInitializedTracker } from "../environment/tracker-preflight.js";
9
+ import { getActiveExtensionRegistrations, toItemRecord, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, TYPE_TO_FOLDER, PmCliError, buildItemNotFoundError, listAllItemMetadataLight, locateItem, readLocatedItem, getHistoryPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
9
10
  import { readHistoryEntries } from "../history-read.js";
10
11
  import { renderPmCommand } from "../command-line.js";
11
12
  import { recordContextUsageTouches } from "../context-usage.js";
@@ -263,9 +264,7 @@ function resolveGetProjection(options, id) {
263
264
  }
264
265
  async function loadGetItemContext(id, global, at) {
265
266
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
266
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
267
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
268
- }
267
+ await assertInitializedTracker(pmRoot);
269
268
  const settings = await readSettings(pmRoot);
270
269
  const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
271
270
  if (at !== undefined) {
@@ -448,4 +447,4 @@ export const _testOnlyGetCommand = {
448
447
  shouldAutoIncludeGetChildren,
449
448
  };
450
449
  //# sourceMappingURL=get.js.map
451
- //# debugId=16d0a1cf-467d-5041-ab36-e2a9033a9342
450
+ //# debugId=ff82974e-a48d-5d18-893f-fb618e378795
@@ -1,8 +1,3 @@
1
- /**
2
- * @module cli/commands/history
3
- *
4
- * Implements the pm history command surface and its agent-facing runtime behavior.
5
- */
6
1
  import { type HistoryDiffValueEntry, verifyHistoryChain, type GlobalOptions } from "../runtime-primitives.js";
7
2
  import { type HistoryVerificationResult } from "../history-read.js";
8
3
  export { readHistoryEntries } from "../history-read.js";
@@ -4,8 +4,9 @@
4
4
  * Implements the pm history 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]="f18d7526-01eb-593b-bf50-788c08a35e5d")}catch(e){}}();
8
- import { pathExists, computeHistoryDiff, patchPathToChangedField, normalizeReplayPatchOps, verifyHistoryChain, enforceHistoryStreamPolicyForItem, EXIT_CODE, PmCliError, getActiveExtensionRegistrations, normalizeItemId, resolveItemTypeRegistry, locateItem, readLocatedItem, getHistoryPath, getWorkspaceHistoryPath, inspectWorkspaceHistoryState, getSettingsPath, resolvePmRoot, readSettings, WORKSPACE_HISTORY_ID, } from "../runtime-primitives.js";
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]="314adea1-6837-5eeb-abc3-57337a495221")}catch(e){}}();
8
+ import { assertInitializedTracker } from "../environment/tracker-preflight.js";
9
+ import { pathExists, computeHistoryDiff, patchPathToChangedField, normalizeReplayPatchOps, verifyHistoryChain, enforceHistoryStreamPolicyForItem, EXIT_CODE, PmCliError, getActiveExtensionRegistrations, normalizeItemId, resolveItemTypeRegistry, locateItem, readLocatedItem, getHistoryPath, getWorkspaceHistoryPath, inspectWorkspaceHistoryState, resolvePmRoot, readSettings, WORKSPACE_HISTORY_ID, } from "../runtime-primitives.js";
9
10
  import { readHistoryEntries, verifyHistoryEntries, } from "../history-read.js";
10
11
  export { readHistoryEntries } from "../history-read.js";
11
12
  import { parseLimit } from "./parsers.js";
@@ -39,9 +40,7 @@ function buildDiffEntries(entries, startIndex) {
39
40
  }
40
41
  async function resolveHistoryReadTarget(id, global) {
41
42
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
42
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
43
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
44
- }
43
+ await assertInitializedTracker(pmRoot);
45
44
  const settings = await readSettings(pmRoot);
46
45
  const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
47
46
  const workspaceHistoryRequested = id.trim() === WORKSPACE_HISTORY_ID;
@@ -161,4 +160,4 @@ export async function runHistory(id, options, global) {
161
160
  return result;
162
161
  }
163
162
  //# sourceMappingURL=history.js.map
164
- //# debugId=f18d7526-01eb-593b-bf50-788c08a35e5d
163
+ //# debugId=314adea1-6837-5eeb-abc3-57337a495221
@@ -5,6 +5,7 @@ import { type RuntimeStatusRegistry } from "../../core/schema/runtime-schema.js"
5
5
  import type { GlobalOptions } from "../../core/shared/command-types.js";
6
6
  import type { ItemMetadata, ItemStatus } from "../../types/index.js";
7
7
  import type { SharedItemFilterOptions } from "./item-filter-options.js";
8
+ import { type HierarchyRelationIndexes } from "../graph/hierarchy-integrity.js";
8
9
  import { type ListCommandName, type ListProjectionMode } from "./projection-contracts.js";
9
10
  export { BRIEF_LIST_FIELDS, DEFAULT_COMPACT_LIST_FIELDS, LIST_COMMAND_DEFAULT_PROJECTIONS, listListProjectionFields, type ListCommandName, type ListProjectionMode, } from "./projection-contracts.js";
10
11
  /** Documents the list options payload exchanged by command, SDK, and package integrations. */
@@ -236,10 +237,10 @@ declare function normalizeProjectionField(field: string): string;
236
237
  declare function parseSortField(raw: string | undefined): ListSortField | undefined;
237
238
  declare function parseSortOrder(raw: string | undefined): ListSortOrder | undefined;
238
239
  declare function parseAssigneeFilter(raw: string | undefined): "assigned" | "unassigned" | undefined;
239
- declare function applyFilters(items: ListedItem[], status: ItemStatus[] | undefined, options: ListOptions, typeRegistry: ItemTypeRegistry, statusRegistry: RuntimeStatusRegistry, runtimeFieldFilters: Record<string, unknown>): ListedItem[];
240
+ declare function applyFilters(items: ListedItem[], status: ItemStatus[] | undefined, options: ListOptions, typeRegistry: ItemTypeRegistry, statusRegistry: RuntimeStatusRegistry, runtimeFieldFilters: Record<string, unknown>, parentsByChild?: HierarchyRelationIndexes["parents_by_child"]): ListedItem[];
240
241
  declare function trimNonEmpty(value: string | undefined): string | undefined;
241
- declare function withTreeMetadata(item: ListedItem, depth: number, childCount: number): ListTreeItem;
242
- declare function orderItemsAsTree(sortedItems: ListedItem[], parentRoot: string | undefined, maxDepth: number | undefined): ListedItem[];
242
+ declare function withTreeMetadata(item: ListedItem, depth: number, childCount: number, parentId?: string): ListTreeItem;
243
+ declare function orderItemsAsTree(sortedItems: ListedItem[], parentRoot: string | undefined, maxDepth: number | undefined, hierarchyIndexes?: HierarchyRelationIndexes, completeItems?: readonly ListedItem[]): ListedItem[];
243
244
  declare function compareNullableString(left: string | null, right: string | null): number;
244
245
  declare function compareNullableTimestamp(left: string | null, right: string | null): number;
245
246
  declare function compareBySortField(left: ListedItem, right: ListedItem, field: ListSortField): number;