@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.
Files changed (269) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +65 -0
  3. package/dist/cli/main.js +6 -3
  4. package/dist/cli/register-annotations.d.ts +11 -0
  5. package/dist/cli/register-annotations.js +195 -0
  6. package/dist/cli/register-history-author.js +7 -30
  7. package/dist/cli/register-mutation.js +25 -206
  8. package/dist/cli/register-operations.js +11 -2
  9. package/dist/cli/runtime-compatibility-boundary.d.ts +17 -0
  10. package/dist/cli/runtime-compatibility-boundary.js +43 -0
  11. package/dist/cli/stats-analytics-json.d.ts +9 -0
  12. package/dist/cli/stats-analytics-json.js +69 -0
  13. package/dist/cli-bundle/bundle-manifest.json +156 -692
  14. package/dist/cli-bundle/chunks/chunk-2ZMXX3Q6.js +2068 -0
  15. package/dist/cli-bundle/chunks/chunk-ALDHXLPS.js +3 -0
  16. package/dist/cli-bundle/chunks/chunk-CBLA33YK.js +8 -0
  17. package/dist/cli-bundle/chunks/chunk-GKA54IJM.js +5 -0
  18. package/dist/cli-bundle/chunks/chunk-KRY7SRUO.js +2 -0
  19. package/dist/cli-bundle/chunks/chunk-MNJ4NNSY.js +26 -0
  20. package/dist/cli-bundle/chunks/chunk-NUXRRNAB.js +77 -0
  21. package/dist/cli-bundle/chunks/chunk-OJPCFDDY.js +13 -0
  22. package/dist/cli-bundle/chunks/chunk-PFSD3DAN.js +194 -0
  23. package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +2 -0
  24. package/dist/cli-bundle/chunks/chunk-SQ7QZFQ6.js +2 -0
  25. package/dist/cli-bundle/chunks/{register-list-query-QH7ONPKU.js → register-list-query-WFZAMJHZ.js} +8 -8
  26. package/dist/cli-bundle/chunks/register-mutation-SOKKOTHQ.js +20 -0
  27. package/dist/cli-bundle/chunks/register-operations-5XQETS6E.js +2 -0
  28. package/dist/cli-bundle/chunks/register-setup-2HL5ZHMK.js +2 -0
  29. package/dist/cli-bundle/focused-chunks/chunk-54EU2UVO.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/{chunk-N7QN3NE6.js → chunk-5FLBTZJQ.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/chunk-5GJ57YKN.js +2 -0
  32. package/dist/cli-bundle/focused-chunks/{chunk-YLPZHWX7.js → chunk-ANTMGYLI.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-CMDS3KYT.js +14 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-EYO4F74Z.js → chunk-DMKOMTTY.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/{chunk-GSW2Y7VZ.js → chunk-F5B3HBEZ.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-27DK4A5O.js → chunk-FI6DWU2M.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-CL3NB7VW.js → chunk-FNOKJG6N.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-EAXXF2HW.js → chunk-FPDYXZBK.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-XNVXIQ4B.js → chunk-GWI6YIKJ.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-6KDHXURF.js → chunk-HCUC62AB.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-GEYU23YS.js → chunk-HGNKPSCB.js} +22 -22
  42. package/dist/cli-bundle/focused-chunks/chunk-IAS7PMLG.js +2 -0
  43. package/dist/cli-bundle/focused-chunks/{chunk-TQMFQYXR.js → chunk-PL2EYDJK.js} +29 -29
  44. package/dist/cli-bundle/focused-chunks/chunk-SM2PJGP3.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-4JC3AOGS.js → chunk-TCSAPH33.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/chunk-U646T7Z6.js +18 -0
  47. package/dist/cli-bundle/focused-chunks/chunk-YKPE4PPY.js +2 -0
  48. package/dist/cli-bundle/focused-chunks/{chunk-GIERI4YU.js → chunk-YSAHYUXX.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/chunk-ZOLDTUU7.js +2 -0
  50. package/dist/cli-bundle/main.js +13 -13
  51. package/dist/cli-bundle/sdk-authoring.js +1 -1
  52. package/dist/cli-bundle/sdk-contracts.js +1 -1
  53. package/dist/cli-bundle/sdk-core.js +38 -37
  54. package/dist/cli-bundle/sdk-governance.js +1 -1
  55. package/dist/cli-bundle/sdk-graph.js +1 -1
  56. package/dist/cli-bundle/sdk-merge.js +1 -1
  57. package/dist/cli-bundle/sdk-query.js +1 -1
  58. package/dist/cli-bundle/sdk-runtime.js +1 -1
  59. package/dist/cli-bundle/sdk-testing.js +1 -1
  60. package/dist/cli-bundle/sdk.js +2 -1
  61. package/dist/cli.js +14 -4
  62. package/dist/core/extensions/reserved-host-flags.js +3 -2
  63. package/dist/core/history/workspace-history.d.ts +22 -2
  64. package/dist/core/history/workspace-history.js +60 -36
  65. package/dist/core/output/output.d.ts +2 -0
  66. package/dist/core/output/output.js +10 -2
  67. package/dist/core/sentry/helpers.d.ts +10 -0
  68. package/dist/core/sentry/helpers.js +59 -4
  69. package/dist/core/shared/command-types.d.ts +2 -0
  70. package/dist/core/shared/command-types.js +2 -2
  71. package/dist/core/shared/constants.d.ts +2 -0
  72. package/dist/core/shared/constants.js +4 -2
  73. package/dist/mcp/tool-definitions.js +6 -2
  74. package/dist/sdk/annotations.d.ts +40 -0
  75. package/dist/sdk/annotations.js +61 -9
  76. package/dist/sdk/author-attribution.d.ts +12 -0
  77. package/dist/sdk/author-attribution.js +87 -9
  78. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  79. package/dist/sdk/cli-bootstrap.js +7 -2
  80. package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +118 -0
  81. package/dist/sdk/cli-contracts/command-exit-contracts.js +152 -0
  82. package/dist/sdk/cli-contracts/completeness.js +54 -5
  83. package/dist/sdk/cli-contracts/flag-contracts.js +6 -2
  84. package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
  85. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +11 -0
  86. package/dist/sdk/cli-contracts/runtime-contracts.js +41 -8
  87. package/dist/sdk/cli-contracts/tool-parameter-tables.js +129 -10
  88. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  89. package/dist/sdk/cli-contracts/tool-schema.js +22 -3
  90. package/dist/sdk/cli-program.js +3 -2
  91. package/dist/sdk/comments.d.ts +7 -0
  92. package/dist/sdk/comments.js +2 -2
  93. package/dist/sdk/completion.js +12 -5
  94. package/dist/sdk/contracts.d.ts +2 -0
  95. package/dist/sdk/contracts.js +3 -2
  96. package/dist/sdk/core.d.ts +3 -1
  97. package/dist/sdk/core.js +4 -3
  98. package/dist/sdk/environment/host-environment-errors.d.ts +27 -0
  99. package/dist/sdk/environment/host-environment-errors.js +124 -0
  100. package/dist/sdk/environment/project-runtime-compatibility.d.ts +65 -0
  101. package/dist/sdk/environment/project-runtime-compatibility.js +385 -0
  102. package/dist/sdk/environment/source-context.d.ts +23 -0
  103. package/dist/sdk/environment/source-context.js +29 -0
  104. package/dist/sdk/error-code-catalog.d.ts +6 -0
  105. package/dist/sdk/error-code-catalog.js +62 -8
  106. package/dist/sdk/extension.js +9 -11
  107. package/dist/sdk/generated-error-code-catalog.js +739 -3
  108. package/dist/sdk/governance/health.d.ts +11 -3
  109. package/dist/sdk/governance/health.js +5 -5
  110. package/dist/sdk/history-analytics.d.ts +141 -0
  111. package/dist/sdk/history-analytics.js +283 -0
  112. package/dist/sdk/improvement-ledger-validation.d.ts +3 -0
  113. package/dist/sdk/improvement-ledger-validation.js +63 -0
  114. package/dist/sdk/improvement-ledger.d.ts +139 -0
  115. package/dist/sdk/improvement-ledger.js +261 -0
  116. package/dist/sdk/index.d.ts +13 -5
  117. package/dist/sdk/index.js +15 -7
  118. package/dist/sdk/learnings.d.ts +15 -0
  119. package/dist/sdk/learnings.js +2 -2
  120. package/dist/sdk/lifecycle/close-many.d.ts +6 -1
  121. package/dist/sdk/lifecycle/close-many.js +43 -5
  122. package/dist/sdk/lifecycle/plan.js +6 -3
  123. package/dist/sdk/lifecycle/update-many.d.ts +2 -1
  124. package/dist/sdk/lifecycle/update-many.js +29 -5
  125. package/dist/sdk/merge/index.d.ts +1 -1
  126. package/dist/sdk/merge/index.js +3 -3
  127. package/dist/sdk/merge/install.d.ts +21 -0
  128. package/dist/sdk/merge/install.js +58 -20
  129. package/dist/sdk/notes.d.ts +7 -0
  130. package/dist/sdk/notes.js +2 -2
  131. package/dist/sdk/read-output-budget.js +24 -22
  132. package/dist/sdk/read-output-contracts.d.ts +10 -2
  133. package/dist/sdk/read-output-contracts.js +204 -66
  134. package/dist/sdk/read-output-rows.d.ts +29 -0
  135. package/dist/sdk/read-output-rows.js +100 -0
  136. package/dist/sdk/read-output-session.d.ts +69 -0
  137. package/dist/sdk/read-output-session.js +200 -0
  138. package/dist/sdk/runtime-input.d.ts +2 -0
  139. package/dist/sdk/runtime-input.js +14 -2
  140. package/dist/sdk/runtime-primitives.d.ts +1 -1
  141. package/dist/sdk/runtime-primitives.js +3 -3
  142. package/dist/sdk/runtime-stats-options.d.ts +9 -0
  143. package/dist/sdk/runtime-stats-options.js +38 -0
  144. package/dist/sdk/runtime.d.ts +1 -0
  145. package/dist/sdk/runtime.js +13 -50
  146. package/dist/sdk/stats.d.ts +40 -0
  147. package/dist/sdk/stats.js +112 -29
  148. package/dist/sdk/test/execution.js +4 -2
  149. package/dist/sdk/test/parsers.js +5 -2
  150. package/dist/sdk/workspace-snapshot.d.ts +9 -0
  151. package/dist/sdk/workspace-snapshot.js +48 -16
  152. package/docs/AGENT_RUNTIME_PRIMITIVES.md +11 -4
  153. package/docs/IMPROVEMENT_ANALYTICS.md +103 -0
  154. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +5 -5
  155. package/docs/README.md +2 -0
  156. package/docs/READ_OUTPUT_CONTRACTS.md +60 -1
  157. package/docs/RELEASING.md +27 -2
  158. package/docs/SCRIPTING.md +27 -1
  159. package/docs/SDK_CONTEXT_INTEGRITY.md +66 -0
  160. package/docs/SDK_RUNTIME_BOUNDARIES.md +58 -0
  161. package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
  162. package/docs/TESTING.md +17 -0
  163. package/marketplace.json +2 -2
  164. package/package.json +6 -4
  165. package/packages/pm-beads/package.json +1 -1
  166. package/packages/pm-calendar/package.json +1 -1
  167. package/packages/pm-command-kit/package.json +1 -1
  168. package/packages/pm-digital-twin/package.json +1 -1
  169. package/packages/pm-governance-audit/package.json +1 -1
  170. package/packages/pm-guide-shell/package.json +1 -1
  171. package/packages/pm-kanban/package.json +1 -1
  172. package/packages/pm-lifecycle-hooks/package.json +1 -1
  173. package/packages/pm-linked-test-adapters/package.json +1 -1
  174. package/packages/pm-search-advanced/package.json +1 -1
  175. package/packages/pm-templates/package.json +1 -1
  176. package/packages/pm-todos/package.json +1 -1
  177. package/packages/pm-vcs/package.json +1 -1
  178. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  179. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  180. package/sdk/public-surface.json +875 -827
  181. package/dist/cli-bundle/chunks/append-XAJ5Z4XS.js +0 -2
  182. package/dist/cli-bundle/chunks/chunk-343QETLI.js +0 -2
  183. package/dist/cli-bundle/chunks/chunk-3KFVGGRE.js +0 -2
  184. package/dist/cli-bundle/chunks/chunk-3ZJRFYY2.js +0 -23
  185. package/dist/cli-bundle/chunks/chunk-4AVFKHHC.js +0 -2
  186. package/dist/cli-bundle/chunks/chunk-4OVGQW22.js +0 -2
  187. package/dist/cli-bundle/chunks/chunk-5PBP2ZP3.js +0 -2
  188. package/dist/cli-bundle/chunks/chunk-5ZKQPA44.js +0 -2
  189. package/dist/cli-bundle/chunks/chunk-A3XQ7VPU.js +0 -2
  190. package/dist/cli-bundle/chunks/chunk-A6KGKEWT.js +0 -2
  191. package/dist/cli-bundle/chunks/chunk-AJE3AHPD.js +0 -8
  192. package/dist/cli-bundle/chunks/chunk-AOBDLU4T.js +0 -2
  193. package/dist/cli-bundle/chunks/chunk-AYRUGRNS.js +0 -3
  194. package/dist/cli-bundle/chunks/chunk-BP6EMEDP.js +0 -5
  195. package/dist/cli-bundle/chunks/chunk-BXCSXK4J.js +0 -2
  196. package/dist/cli-bundle/chunks/chunk-C3YABSJK.js +0 -2
  197. package/dist/cli-bundle/chunks/chunk-CA3BURYF.js +0 -2
  198. package/dist/cli-bundle/chunks/chunk-CHOQ2VAW.js +0 -2
  199. package/dist/cli-bundle/chunks/chunk-D7I3TUGV.js +0 -2
  200. package/dist/cli-bundle/chunks/chunk-DQGJ2RWT.js +0 -3
  201. package/dist/cli-bundle/chunks/chunk-DWOAOZHZ.js +0 -2
  202. package/dist/cli-bundle/chunks/chunk-E2ZSLTOP.js +0 -2
  203. package/dist/cli-bundle/chunks/chunk-E7BFPLUZ.js +0 -5
  204. package/dist/cli-bundle/chunks/chunk-F4NREH3G.js +0 -2
  205. package/dist/cli-bundle/chunks/chunk-FB7G2HY2.js +0 -2
  206. package/dist/cli-bundle/chunks/chunk-FDBRXV25.js +0 -2
  207. package/dist/cli-bundle/chunks/chunk-GU3TSEHD.js +0 -2
  208. package/dist/cli-bundle/chunks/chunk-HS7OVAUN.js +0 -164
  209. package/dist/cli-bundle/chunks/chunk-JC6FKIFM.js +0 -2
  210. package/dist/cli-bundle/chunks/chunk-JFZIS6JF.js +0 -2
  211. package/dist/cli-bundle/chunks/chunk-JQ4NZ5EB.js +0 -2
  212. package/dist/cli-bundle/chunks/chunk-L6LGKJX3.js +0 -2
  213. package/dist/cli-bundle/chunks/chunk-LEPJJ6QC.js +0 -2
  214. package/dist/cli-bundle/chunks/chunk-M357ZCOR.js +0 -2
  215. package/dist/cli-bundle/chunks/chunk-M4VEE3FK.js +0 -2
  216. package/dist/cli-bundle/chunks/chunk-MCS73BKB.js +0 -3
  217. package/dist/cli-bundle/chunks/chunk-MDTH7SAE.js +0 -19
  218. package/dist/cli-bundle/chunks/chunk-NE5VRDAI.js +0 -2
  219. package/dist/cli-bundle/chunks/chunk-OXY3SJ3N.js +0 -2
  220. package/dist/cli-bundle/chunks/chunk-PECV7L5T.js +0 -2
  221. package/dist/cli-bundle/chunks/chunk-Q3VOP62W.js +0 -2
  222. package/dist/cli-bundle/chunks/chunk-QJ7C3JIW.js +0 -2
  223. package/dist/cli-bundle/chunks/chunk-R6LSRGPS.js +0 -8
  224. package/dist/cli-bundle/chunks/chunk-R6RKEYYW.js +0 -2
  225. package/dist/cli-bundle/chunks/chunk-RAFUN7IX.js +0 -2005
  226. package/dist/cli-bundle/chunks/chunk-RSIC5OPE.js +0 -2
  227. package/dist/cli-bundle/chunks/chunk-RUAU5OSH.js +0 -2
  228. package/dist/cli-bundle/chunks/chunk-SD3YXU2U.js +0 -56
  229. package/dist/cli-bundle/chunks/chunk-SV3YQ4RY.js +0 -2
  230. package/dist/cli-bundle/chunks/chunk-SVV3DQES.js +0 -2
  231. package/dist/cli-bundle/chunks/chunk-SXECIECW.js +0 -5
  232. package/dist/cli-bundle/chunks/chunk-T45OHXDW.js +0 -8
  233. package/dist/cli-bundle/chunks/chunk-TPKDJ5WL.js +0 -2
  234. package/dist/cli-bundle/chunks/chunk-UVVXHGYS.js +0 -3
  235. package/dist/cli-bundle/chunks/chunk-V663653R.js +0 -20
  236. package/dist/cli-bundle/chunks/chunk-WSI5KZQJ.js +0 -55
  237. package/dist/cli-bundle/chunks/chunk-XPOQQJTX.js +0 -13
  238. package/dist/cli-bundle/chunks/chunk-YCCDXBNU.js +0 -2
  239. package/dist/cli-bundle/chunks/chunk-ZFBWCKYF.js +0 -2
  240. package/dist/cli-bundle/chunks/close-DI66JMSB.js +0 -2
  241. package/dist/cli-bundle/chunks/close-many-VFKT6U3O.js +0 -2
  242. package/dist/cli-bundle/chunks/comments-E73HIEZJ.js +0 -2
  243. package/dist/cli-bundle/chunks/copy-WBYVLCPC.js +0 -2
  244. package/dist/cli-bundle/chunks/create-TG67IVFI.js +0 -2
  245. package/dist/cli-bundle/chunks/delete-6XKUVVQN.js +0 -2
  246. package/dist/cli-bundle/chunks/deps-AJUGP2OH.js +0 -2
  247. package/dist/cli-bundle/chunks/docs-QOCLDRKJ.js +0 -2
  248. package/dist/cli-bundle/chunks/files-3ST5TY64.js +0 -2
  249. package/dist/cli-bundle/chunks/focus-R2AWS63Y.js +0 -2
  250. package/dist/cli-bundle/chunks/history-compact-7BJFML4S.js +0 -2
  251. package/dist/cli-bundle/chunks/history-redact-WJN3HYXR.js +0 -2
  252. package/dist/cli-bundle/chunks/history-repair-XDNZUB7F.js +0 -2
  253. package/dist/cli-bundle/chunks/learnings-SZMUPVNA.js +0 -2
  254. package/dist/cli-bundle/chunks/profile-KL53JIAC.js +0 -2
  255. package/dist/cli-bundle/chunks/register-mutation-OCRQNZK4.js +0 -20
  256. package/dist/cli-bundle/chunks/register-operations-HIBJXRGB.js +0 -2
  257. package/dist/cli-bundle/chunks/register-setup-QWBQ6HBS.js +0 -2
  258. package/dist/cli-bundle/chunks/restore-FXA5QPM7.js +0 -2
  259. package/dist/cli-bundle/chunks/schema-QJ27OTRV.js +0 -2
  260. package/dist/cli-bundle/chunks/update-7GBO4SXG.js +0 -2
  261. package/dist/cli-bundle/chunks/update-many-VF6ZKQUO.js +0 -2
  262. package/dist/cli-bundle/focused-chunks/chunk-74CWP3A4.js +0 -2
  263. package/dist/cli-bundle/focused-chunks/chunk-7AZDTGPA.js +0 -2
  264. package/dist/cli-bundle/focused-chunks/chunk-7YTZ7A4E.js +0 -2
  265. package/dist/cli-bundle/focused-chunks/chunk-LKQXXO62.js +0 -2
  266. package/dist/cli-bundle/focused-chunks/chunk-MBBMTDD3.js +0 -12
  267. package/dist/cli-bundle/focused-chunks/chunk-ME4XVOBJ.js +0 -8
  268. package/dist/cli-bundle/focused-chunks/chunk-QL5H3AQH.js +0 -2
  269. package/dist/cli-bundle/focused-chunks/chunk-YHDCGUIW.js +0 -14
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @module sdk/environment/source-context
3
+ *
4
+ * Defines the inherited source-workspace access contract used by sandboxed
5
+ * commands that retain read-only project identity.
6
+ */
7
+ /** Environment key declaring how a child may use inherited source coordinates. */
8
+ export declare const SOURCE_CONTEXT_ACCESS_ENV = "PM_SOURCE_CONTEXT_ACCESS";
9
+ /** Environment key permitting one explicit source-context write invocation. */
10
+ export declare const SOURCE_CONTEXT_WRITE_OVERRIDE_ENV = "PM_ALLOW_SOURCE_CONTEXT_WRITES";
11
+ /** Supported inherited source-context access modes. */
12
+ export type SourceContextAccessMode = "read_only" | "write";
13
+ /** Structured policy used by SDK adapters before selecting source coordinates. */
14
+ export interface SourceContextWritePolicy {
15
+ /** Declared access mode, with absent legacy context retaining write behavior. */
16
+ access: SourceContextAccessMode;
17
+ /** Whether the one-invocation write override was accepted. */
18
+ write_override_applied: boolean;
19
+ /** Whether a mutation may select inherited source coordinates. */
20
+ source_writes_allowed: boolean;
21
+ }
22
+ /** Resolve inherited source-coordinate write policy without reading filesystem state. */
23
+ export declare function resolveSourceContextWritePolicy(environment: Readonly<Record<string, string | undefined>>): SourceContextWritePolicy;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @module sdk/environment/source-context
3
+ *
4
+ * Defines the inherited source-workspace access contract used by sandboxed
5
+ * commands that retain read-only project identity.
6
+ */
7
+ /** Environment key declaring how a child may use inherited source coordinates. */
8
+
9
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f97516b2-f75c-5ce0-82dc-f850466284c7")}catch(e){}}();
10
+ export const SOURCE_CONTEXT_ACCESS_ENV = "PM_SOURCE_CONTEXT_ACCESS";
11
+ /** Environment key permitting one explicit source-context write invocation. */
12
+ export const SOURCE_CONTEXT_WRITE_OVERRIDE_ENV = "PM_ALLOW_SOURCE_CONTEXT_WRITES";
13
+ /** Resolve inherited source-coordinate write policy without reading filesystem state. */
14
+ export function resolveSourceContextWritePolicy(environment) {
15
+ const declaredAccess = environment[SOURCE_CONTEXT_ACCESS_ENV];
16
+ const access = declaredAccess === undefined ||
17
+ declaredAccess.trim().toLowerCase() === "write"
18
+ ? "write"
19
+ : "read_only";
20
+ const writeOverrideApplied = access === "read_only" &&
21
+ environment[SOURCE_CONTEXT_WRITE_OVERRIDE_ENV]?.trim() === "1";
22
+ return {
23
+ access,
24
+ write_override_applied: writeOverrideApplied,
25
+ source_writes_allowed: access === "write" || writeOverrideApplied,
26
+ };
27
+ }
28
+ //# sourceMappingURL=source-context.js.map
29
+ //# debugId=f97516b2-f75c-5ce0-82dc-f850466284c7
@@ -43,8 +43,14 @@ export interface PmErrorCodeContract {
43
43
  sources: string[];
44
44
  /** CLI command roots inferred from executable declaration ownership. */
45
45
  emitting_commands: string[];
46
+ /** Canonical machine identifier for this compatibility group. */
47
+ canonical_code?: string;
48
+ /** Stable compatibility spellings that resolve to this canonical code. */
49
+ aliases?: string[];
46
50
  }
47
51
  /** Validate, normalize, sort, and freeze an error-code catalog. */
48
52
  export declare function definePmErrorCodeCatalog(declarations: readonly PmErrorCodeContract[]): readonly PmErrorCodeContract[];
53
+ /** Resolve an emitted code through its stable compatibility alias group. */
54
+ export declare function resolveCanonicalPmErrorCodeContract(code: string, catalog: readonly PmErrorCodeContract[]): PmErrorCodeContract;
49
55
  /** Resolve one declared error contract and fail closed for unknown vocabulary. */
50
56
  export declare function resolvePmErrorCodeContract(code: string, catalog: readonly PmErrorCodeContract[]): PmErrorCodeContract;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  /** Stable shell exit-code taxonomy shared by every structured error. */
8
8
 
9
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="479dd590-7f54-54ae-bbaf-8f183fd6b6b4")}catch(e){}}();
9
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="393243a5-dd90-52c1-a9c1-588fd33f8b6a")}catch(e){}}();
10
10
  export const PM_ERROR_CODE_EXIT_CLASS_CONTRACTS = [
11
11
  { exit_code: 1, class: "generic_failure" },
12
12
  { exit_code: 2, class: "usage" },
@@ -21,6 +21,55 @@ function normalizeContractList(values) {
21
21
  ...new Set(values.map((value) => value.trim()).filter(Boolean)),
22
22
  ].sort();
23
23
  }
24
+ function isValidNormalizedErrorCodeContract(declaration, sources, emittingCommands, canonicalCode, aliases) {
25
+ return ![
26
+ [1, 2, 3, 4, 5].includes(declaration.exit_code),
27
+ declaration.meaning.trim().length > 0,
28
+ declaration.recovery.trim().length > 0,
29
+ sources.length > 0,
30
+ emittingCommands.length > 0,
31
+ /^[a-z][a-z0-9_]*$/.test(canonicalCode),
32
+ aliases.every((alias) => /^[a-z][a-z0-9_]*$/.test(alias)),
33
+ ERROR_CLASS_BY_EXIT_CODE.get(declaration.exit_code) === declaration.class,
34
+ ].includes(false);
35
+ }
36
+ function resolveCanonicalErrorCodeDeclaration(declaration, byCode) {
37
+ let current = declaration;
38
+ const path = new Set();
39
+ while (current.canonical_code !== current.code) {
40
+ if (path.has(current.code)) {
41
+ throw new TypeError(`Alias cycle in pm error code catalog: ${declaration.code}`);
42
+ }
43
+ path.add(current.code);
44
+ const target = byCode.get(current.canonical_code);
45
+ if (!target) {
46
+ throw new TypeError(`Invalid pm error code contract: ${declaration.code}`);
47
+ }
48
+ current = target;
49
+ }
50
+ return current;
51
+ }
52
+ function validateErrorCodeAliases(declarations) {
53
+ const byCode = new Map(declarations.map((entry) => [entry.code, entry]));
54
+ for (const declaration of declarations) {
55
+ const canonical = resolveCanonicalErrorCodeDeclaration(declaration, byCode);
56
+ if (canonical.exit_code !== declaration.exit_code ||
57
+ canonical.class !== declaration.class) {
58
+ throw new TypeError(`Alias transport mismatch for pm error code: ${declaration.code}`);
59
+ }
60
+ const expectedAliases = declarations
61
+ .filter((candidate) => candidate.code !== canonical.code &&
62
+ candidate.canonical_code === canonical.code)
63
+ .map((candidate) => candidate.code)
64
+ .sort();
65
+ if (declaration.code === canonical.code
66
+ ? JSON.stringify(declaration.aliases) !==
67
+ JSON.stringify(expectedAliases)
68
+ : declaration.aliases.length > 0) {
69
+ throw new TypeError(`Invalid pm error code contract: ${declaration.code}`);
70
+ }
71
+ }
72
+ }
24
73
  /** Validate, normalize, sort, and freeze an error-code catalog. */
25
74
  export function definePmErrorCodeCatalog(declarations) {
26
75
  const seen = new Set();
@@ -35,12 +84,9 @@ export function definePmErrorCodeCatalog(declarations) {
35
84
  seen.add(code);
36
85
  const sources = normalizeContractList(declaration.sources);
37
86
  const emittingCommands = normalizeContractList(declaration.emitting_commands);
38
- if (![1, 2, 3, 4, 5].includes(declaration.exit_code) ||
39
- declaration.meaning.trim().length === 0 ||
40
- declaration.recovery.trim().length === 0 ||
41
- sources.length === 0 ||
42
- emittingCommands.length === 0 ||
43
- ERROR_CLASS_BY_EXIT_CODE.get(declaration.exit_code) !== declaration.class) {
87
+ const canonicalCode = (declaration.canonical_code ?? code).trim();
88
+ const aliases = normalizeContractList(declaration.aliases ?? []);
89
+ if (!isValidNormalizedErrorCodeContract(declaration, sources, emittingCommands, canonicalCode, aliases)) {
44
90
  throw new TypeError(`Invalid pm error code contract: ${code}`);
45
91
  }
46
92
  return Object.freeze({
@@ -50,10 +96,18 @@ export function definePmErrorCodeCatalog(declarations) {
50
96
  recovery: declaration.recovery.trim(),
51
97
  sources,
52
98
  emitting_commands: emittingCommands,
99
+ canonical_code: canonicalCode,
100
+ aliases,
53
101
  });
54
102
  });
103
+ validateErrorCodeAliases(normalized);
55
104
  return Object.freeze(normalized.sort((left, right) => left.code.localeCompare(right.code)));
56
105
  }
106
+ /** Resolve an emitted code through its stable compatibility alias group. */
107
+ export function resolveCanonicalPmErrorCodeContract(code, catalog) {
108
+ const emitted = resolvePmErrorCodeContract(code, catalog);
109
+ return resolvePmErrorCodeContract(emitted.canonical_code ?? emitted.code, catalog);
110
+ }
57
111
  /** Resolve one declared error contract and fail closed for unknown vocabulary. */
58
112
  export function resolvePmErrorCodeContract(code, catalog) {
59
113
  const normalized = code.trim();
@@ -64,4 +118,4 @@ export function resolvePmErrorCodeContract(code, catalog) {
64
118
  return contract;
65
119
  }
66
120
  //# sourceMappingURL=error-code-catalog.js.map
67
- //# debugId=479dd590-7f54-54ae-bbaf-8f183fd6b6b4
121
+ //# debugId=393243a5-dd90-52c1-a9c1-588fd33f8b6a
@@ -4,9 +4,8 @@
4
4
  * Implements the pm extension 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]="f4f1a871-b632-5263-aec0-cb00bcdbe1b3")}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]="f4b47053-cc05-51f2-b5cb-cc6dba3365c2")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
- import os from "node:os";
10
9
  import path from "node:path";
11
10
  import { activateExtensions, createSerialQueue, loadExtensions, nextExtensionReloadToken, } from "../core/extensions/index.js";
12
11
  import { describeExtensionActivation } from "../core/extensions/activation-summary.js";
@@ -643,10 +642,10 @@ const resolveInstallRuntimeActivationStatus = (extensionName, scope, runtimeInst
643
642
  (installActivationFailure ? "failed" : "unknown"));
644
643
  };
645
644
  /** Probe a temporary installed extension for runtime command registrations. */
646
- const probeRuntimeCommandPathsForInstall = (pmRoot, settings, refreshedInstalled, global) => {
645
+ const probeRuntimeCommandPathsForInstall = (pmRoot, parent, settings, refreshedInstalled, global) => {
647
646
  return extensionRuntimeProbeQueue.enqueue(async () => {
648
647
  const originalPackageRoot = process.env.PM_CLI_PACKAGE_ROOT;
649
- const moduleGraphSnapshotRoot = await fs.mkdtemp(path.join(os.tmpdir(), "pm-extension-module-graph-"));
648
+ const snapshotRoot = await fs.mkdtemp(path.join(parent, ".pm-module-graph-"));
650
649
  process.env.PM_CLI_PACKAGE_ROOT = resolvePmPackageRootFromModule(import.meta.url, ["../.."]);
651
650
  try {
652
651
  const loadResult = await loadExtensions({
@@ -656,11 +655,10 @@ const probeRuntimeCommandPathsForInstall = (pmRoot, settings, refreshedInstalled
656
655
  noExtensions: global.noExtensions === true,
657
656
  reload_token: nextExtensionReloadToken(),
658
657
  cache_bust: true,
659
- module_graph_snapshot_root: moduleGraphSnapshotRoot,
658
+ module_graph_snapshot_root: snapshotRoot,
660
659
  });
661
660
  const activationResult = await activateExtensions({
662
661
  ...loadResult,
663
- loaded: loadResult.loaded,
664
662
  });
665
663
  const runtimeFailures = [
666
664
  ...loadResult.failed.map((failure) => ({
@@ -687,7 +685,7 @@ const probeRuntimeCommandPathsForInstall = (pmRoot, settings, refreshedInstalled
687
685
  };
688
686
  }
689
687
  finally {
690
- await fs.rm(moduleGraphSnapshotRoot, { recursive: true, force: true });
688
+ await fs.rm(snapshotRoot, { recursive: true, force: true });
691
689
  if (originalPackageRoot === undefined) {
692
690
  delete process.env.PM_CLI_PACKAGE_ROOT;
693
691
  }
@@ -1275,7 +1273,7 @@ const buildInstalledExtensionActivation = (ctx, extensionName, runtimeProbe, com
1275
1273
  registered_commands: commandSummary.command_paths,
1276
1274
  registered_actions: commandSummary.action_paths,
1277
1275
  registered_item_types: installedItemTypes,
1278
- module_graph_verification: "fresh_snapshot",
1276
+ module_graph_verification: "fresh_in_topology_snapshot",
1279
1277
  health: healthByActivation[String(activated)],
1280
1278
  },
1281
1279
  };
@@ -1287,7 +1285,7 @@ const performExtensionInstallUnderLock = async (ctx, input) => {
1287
1285
  const persisted = await persistExtensionInstall(ctx, input);
1288
1286
  const refreshedInstalled = await listInstalledExtensions(resolvedRoots.selected_root, scope, persisted.settings, persisted.managedState);
1289
1287
  warnings.push(...refreshedInstalled.warnings);
1290
- const runtimeProbe = await probeRuntimeCommandPathsForInstall(resolvedRoots.pm_root, persisted.settings, refreshedInstalled.extensions, global);
1288
+ const runtimeProbe = await probeRuntimeCommandPathsForInstall(resolvedRoots.pm_root, path.dirname(resolvedRoots.selected_root), persisted.settings, refreshedInstalled.extensions, global);
1291
1289
  warnings.push(...runtimeProbe.warnings);
1292
1290
  // Scaffold the folders for any item types the installed package contributes
1293
1291
  // so the tracker is immediately healthy — matching `pm schema add-type` and
@@ -1636,7 +1634,7 @@ const runExtensionActivateDeactivateAction = async (ctx) => {
1636
1634
  await writeSettings(resolvedRoots.settings_root, settings, "settings:write");
1637
1635
  }
1638
1636
  const activationFailure = action === "activate"
1639
- ? await probeRuntimeCommandPathsForInstall(resolvedRoots.pm_root, settings, [candidate], global).then((probe) => {
1637
+ ? await probeRuntimeCommandPathsForInstall(resolvedRoots.pm_root, path.dirname(resolvedRoots.selected_root), settings, [candidate], global).then((probe) => {
1640
1638
  warnings.push(...probe.warnings);
1641
1639
  return findActivationFailureByName(candidate.name, probe.activation_failures, ctx.scope);
1642
1640
  })
@@ -2192,4 +2190,4 @@ export const _testOnly = {
2192
2190
  withExtensionInstallLock,
2193
2191
  };
2194
2192
  //# sourceMappingURL=extension.js.map
2195
- //# debugId=f4f1a871-b632-5263-aec0-cb00bcdbe1b3
2193
+ //# debugId=f4b47053-cc05-51f2-b5cb-cc6dba3365c2