@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
@@ -5,19 +5,19 @@
5
5
  */
6
6
  /** Stable built-in relationship ontology without graph or storage dependencies. */
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]="825e1dd9-4168-56f6-9183-b8cf75314b73")}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]="aa7d04c7-b057-569c-816a-f53322c74261")}catch(e){}}();
9
9
  export const BUILTIN_RELATIONSHIP_KINDS = [
10
- { kind: "blocked_by", direction: "directed", inverse: "blocks", ordering: true, precedence: "target_before_source", hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", aliases: ["depends_on"], compatibilityVersion: 1, allowSelf: false },
11
- { kind: "blocks", direction: "directed", inverse: "blocked_by", ordering: true, precedence: "source_before_target", hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", compatibilityVersion: 1, allowSelf: false },
12
- { kind: "parent", direction: "directed", inverse: "child", ordering: false, hierarchy: true, hierarchyDirection: "target_parent", outgoing: "one", incoming: "many", lifecycle: "supersedable", aliases: ["child_of", "epic"], compatibilityVersion: 1, allowSelf: false },
13
- { kind: "child", direction: "directed", inverse: "parent", ordering: false, hierarchy: true, hierarchyDirection: "source_parent", outgoing: "many", incoming: "one", lifecycle: "supersedable", aliases: ["parent_child", "task"], compatibilityVersion: 1, allowSelf: false },
14
- { kind: "related", direction: "undirected", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", aliases: ["related_to"], compatibilityVersion: 1, allowSelf: false },
15
- { kind: "discovered_from", direction: "directed", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", compatibilityVersion: 1, allowSelf: false },
16
- { kind: "incident_from", direction: "directed", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", compatibilityVersion: 1, allowSelf: false },
17
- { kind: "implements", direction: "directed", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", compatibilityVersion: 1, allowSelf: false },
18
- { kind: "recurs_from", direction: "directed", ordering: false, temporalOrder: "source_after_target", hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", compatibilityVersion: 1, allowSelf: false },
19
- { kind: "verifies", direction: "directed", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", compatibilityVersion: 1, allowSelf: false },
20
- { kind: "supersedes", direction: "directed", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "supersedable", compatibilityVersion: 1, allowSelf: false },
10
+ { kind: "blocked_by", direction: "directed", traversal: "ordering", inverse: "blocks", ordering: true, precedence: "target_before_source", hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", aliases: ["depends_on"], compatibilityVersion: 1, allowSelf: false },
11
+ { kind: "blocks", direction: "directed", traversal: "ordering", inverse: "blocked_by", ordering: true, precedence: "source_before_target", hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", compatibilityVersion: 1, allowSelf: false },
12
+ { kind: "parent", direction: "directed", traversal: "hierarchy", outcomeTraversal: "source_to_target", inverse: "child", ordering: false, hierarchy: true, hierarchyDirection: "target_parent", outgoing: "one", incoming: "many", lifecycle: "supersedable", aliases: ["child_of", "epic"], compatibilityVersion: 1, allowSelf: false },
13
+ { kind: "child", direction: "directed", traversal: "hierarchy", outcomeTraversal: "target_to_source", inverse: "parent", ordering: false, hierarchy: true, hierarchyDirection: "source_parent", outgoing: "many", incoming: "one", lifecycle: "supersedable", aliases: ["parent_child", "task"], compatibilityVersion: 1, allowSelf: false },
14
+ { kind: "related", direction: "undirected", traversal: "association", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", aliases: ["related_to"], compatibilityVersion: 1, allowSelf: false },
15
+ { kind: "discovered_from", direction: "directed", traversal: "semantic", outcomeTraversal: "source_to_target", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", compatibilityVersion: 1, allowSelf: false },
16
+ { kind: "incident_from", direction: "directed", traversal: "semantic", outcomeTraversal: "source_to_target", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", compatibilityVersion: 1, allowSelf: false },
17
+ { kind: "implements", direction: "directed", traversal: "semantic", outcomeTraversal: "source_to_target", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", compatibilityVersion: 1, allowSelf: false },
18
+ { kind: "recurs_from", direction: "directed", traversal: "semantic", outcomeTraversal: "source_to_target", ordering: false, temporalOrder: "source_after_target", hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", compatibilityVersion: 1, allowSelf: false },
19
+ { kind: "verifies", direction: "directed", traversal: "semantic", outcomeTraversal: "source_to_target", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", compatibilityVersion: 1, allowSelf: false },
20
+ { kind: "supersedes", direction: "directed", traversal: "semantic", outcomeTraversal: "both", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "supersedable", compatibilityVersion: 1, allowSelf: false },
21
21
  ];
22
22
  //# sourceMappingURL=contract.js.map
23
- //# debugId=825e1dd9-4168-56f6-9183-b8cf75314b73
23
+ //# debugId=aa7d04c7-b057-569c-816a-f53322c74261
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import type { Dependency, ItemMetadata } from "../types/index.js";
8
8
  import { type RelationshipKindDefinition } from "./relationship-kinds/contract.js";
9
- export { BUILTIN_RELATIONSHIP_KINDS, type RelationshipCardinality, type RelationshipDirection, type RelationshipHierarchyDirection, type RelationshipKindDefinition, type RelationshipLifecycle, type RelationshipPrecedence, type RelationshipTemporalOrder, } from "./relationship-kinds/contract.js";
9
+ export { BUILTIN_RELATIONSHIP_KINDS, type RelationshipCardinality, type RelationshipDirection, type RelationshipHierarchyDirection, type RelationshipKindDefinition, type RelationshipLifecycle, type RelationshipOutcomeTraversal, type RelationshipPrecedence, type RelationshipTemporalOrder, type RelationshipTraversalFamily, } from "./relationship-kinds/contract.js";
10
10
  /** One normalized relationship edge indexed by the graph kernel. */
11
11
  export interface RelationshipEdge {
12
12
  /** Source node identifier. */
@@ -1,5 +1,5 @@
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]="7f733de4-104b-50a9-9c0a-cd9850bfcd78")}catch(e){}}();
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]="d7d44fba-603b-5ef2-8490-51112b929433")}catch(e){}}();
3
3
  import { BUILTIN_RELATIONSHIP_KINDS, } from "./relationship-kinds/contract.js";
4
4
  export { BUILTIN_RELATIONSHIP_KINDS, } from "./relationship-kinds/contract.js";
5
5
  function normalizeKind(kind) {
@@ -82,6 +82,16 @@ function assertRelationshipKindSemantics(definition, kind) {
82
82
  throw new TypeError(`Invalid relationship lifecycle for ${kind}`);
83
83
  if (typeof definition.allowSelf !== "boolean")
84
84
  throw new TypeError(`Invalid relationship self-edge flag for ${kind}`);
85
+ if (definition.traversal !== undefined &&
86
+ !["hierarchy", "ordering", "semantic", "association"].includes(definition.traversal))
87
+ throw new TypeError(`Invalid relationship traversal family for ${kind}`);
88
+ if (definition.outcomeTraversal !== undefined &&
89
+ !["source_to_target", "target_to_source", "both"].includes(definition.outcomeTraversal))
90
+ throw new TypeError(`Invalid outcome traversal for ${kind}`);
91
+ if (definition.direction === "undirected" &&
92
+ definition.outcomeTraversal !== undefined &&
93
+ definition.outcomeTraversal !== "both")
94
+ throw new TypeError(`Undirected relationship kind cannot declare directional outcome traversal: ${kind}`);
85
95
  }
86
96
  /** Validate application payload-schema and compatibility-alias containers. */
87
97
  function assertRelationshipKindPayload(definition, kind) {
@@ -95,6 +105,17 @@ function assertRelationshipKindPayload(definition, kind) {
95
105
  definition.aliases.some((alias) => typeof alias !== "string")))
96
106
  throw new TypeError(`Invalid relationship aliases for ${kind}`);
97
107
  }
108
+ function resolveRelationshipTraversal(definition) {
109
+ if (definition.traversal)
110
+ return definition.traversal;
111
+ // Dual-family extension kinds use ordering precedence, matching relationship
112
+ // context role classification. Explicit traversal always remains authoritative.
113
+ if (definition.ordering)
114
+ return "ordering";
115
+ if (definition.hierarchy)
116
+ return "hierarchy";
117
+ return definition.direction === "undirected" ? "association" : "semantic";
118
+ }
98
119
  /** Mutable registry with immutable snapshots and collision-safe extension registration. */
99
120
  export class RelationshipKindRegistry {
100
121
  #definitions = new Map();
@@ -129,7 +150,11 @@ export class RelationshipKindRegistry {
129
150
  const normalized = Object.freeze({
130
151
  ...definition,
131
152
  kind,
153
+ traversal: resolveRelationshipTraversal(definition),
132
154
  hierarchy: definition.hierarchy ?? false,
155
+ hierarchyDirection: definition.hierarchy
156
+ ? (definition.hierarchyDirection ?? "source_parent")
157
+ : undefined,
133
158
  inverse,
134
159
  aliases: Object.freeze(aliases),
135
160
  payloadSchema: definition.payloadSchema
@@ -552,4 +577,4 @@ export function dependencyToRelationship(source, dependency, registry = defaultR
552
577
  };
553
578
  }
554
579
  //# sourceMappingURL=relationships.js.map
555
- //# debugId=7f733de4-104b-50a9-9c0a-cd9850bfcd78
580
+ //# debugId=d7d44fba-603b-5ef2-8490-51112b929433
@@ -6,6 +6,7 @@
6
6
  export { PM_GITIGNORE_END, PM_GITIGNORE_START, ensurePmGitignore, getPmGitignoreBlock, type EnsurePmGitignoreResult, } from "./workspace.js";
7
7
  export { SEARCH_EXTENSION_FLAG_DEFINITIONS } from "./extension-contracts.js";
8
8
  export type { FlagDefinition } from "../core/extensions/loader.js";
9
+ export * from "./cli-contracts/agent-output-contracts.js";
9
10
  import { EXIT_CODE } from "../core/shared/constants.js";
10
11
  import type { ItemMetadata } from "../types/index.js";
11
12
  import { type PmCompleteListOptions, type PmCompleteListResult } from "./query/complete-list.js";
@@ -155,7 +156,7 @@ export declare class PmClient {
155
156
  /** Return project tracker statistics with the same sections as `pm stats`. */
156
157
  stats<Options extends ReadOptions<StatsCommandOptions> = StatsCommandOptions>(options?: Options): ReadPromise<StatsResult, Options>;
157
158
  /** Discover existing duplicate clusters without mutating tracker state. */
158
- duplicates(options?: DuplicatesCommandOptions): Promise<DuplicatesResult>;
159
+ duplicates<Options extends ReadOptions<DuplicatesCommandOptions> = DuplicatesCommandOptions>(options?: Options): ReadPromise<DuplicatesResult, Options>;
159
160
  /** List, add, edit, or delete item comments. */
160
161
  comments<Options extends ReadOptions<CommentsCommandOptions> = CommentsCommandOptions>(id: string, options?: Options): ReadPromise<CommentsResult, Options>;
161
162
  /** List or append private item notes. */
@@ -371,7 +372,7 @@ export declare function aggregate<Options extends ReadOptions<AggregateOptions>
371
372
  /** Return project tracker statistics with the same sections as `pm stats` without constructing a reusable client. */
372
373
  export declare function stats<Options extends ReadOptions<StatsCommandOptions> = StatsCommandOptions>(options?: Options, clientOptions?: PmClientOptions): ReadPromise<StatsResult, Options>;
373
374
  /** Discover duplicate clusters without constructing a reusable client. */
374
- export declare function duplicates(options?: DuplicatesCommandOptions, clientOptions?: PmClientOptions): Promise<DuplicatesResult>;
375
+ export declare function duplicates<Options extends ReadOptions<DuplicatesCommandOptions> = DuplicatesCommandOptions>(options?: Options, clientOptions?: PmClientOptions): ReadPromise<DuplicatesResult, Options>;
375
376
  /** List, add, edit, or delete item comments without constructing a reusable client. */
376
377
  export declare function comments<Options extends ReadOptions<CommentsCommandOptions> = CommentsCommandOptions>(id: string, options?: Options, clientOptions?: PmClientOptions): ReadPromise<CommentsResult, Options>;
377
378
  /** List or append private item notes without constructing a reusable client. */
@@ -4,9 +4,10 @@
4
4
  * Defines public SDK APIs and package-author helpers for Runtime.
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]="c770afea-3eb6-5476-ba07-8ec1c5d9c699")}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]="a27b9b88-a8de-5e38-ab7f-dfcc61d1fad6")}catch(e){}}();
8
8
  export { PM_GITIGNORE_END, PM_GITIGNORE_START, ensurePmGitignore, getPmGitignoreBlock, } from "./workspace.js";
9
9
  export { SEARCH_EXTENSION_FLAG_DEFINITIONS } from "./extension-contracts.js";
10
+ export * from "./cli-contracts/agent-output-contracts.js";
10
11
  import { AsyncLocalStorage } from "node:async_hooks";
11
12
  import path from "node:path";
12
13
  import { createEmptyExtensionCommandRegistry, createEmptyExtensionHookRegistry, createEmptyExtensionParserRegistry, createEmptyExtensionPreflightRegistry, createEmptyExtensionRegistrationRegistry, createEmptyExtensionRendererRegistry, createEmptyExtensionServiceRegistry, } from "../core/extensions/extension-registries.js";
@@ -1944,4 +1945,4 @@ async function loadWorkspaceExtensionRegistrations(pmRoot, settings, cwd) {
1944
1945
  }
1945
1946
  }
1946
1947
  //# sourceMappingURL=runtime.js.map
1947
- //# debugId=c770afea-3eb6-5476-ba07-8ec1c5d9c699
1948
+ //# debugId=a27b9b88-a8de-5e38-ab7f-dfcc61d1fad6
@@ -7,11 +7,12 @@
7
7
  * guarantees.
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]="cd777de3-665f-5e01-ac98-8986f2a5a4c2")}catch(e){}}();
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]="60738c1f-3b44-5f8a-82c9-99d2b2de1e51")}catch(e){}}();
11
+ import { assertInitializedTracker } from "./environment/tracker-preflight.js";
11
12
  import { createHash } from "node:crypto";
12
13
  import fs from "node:fs/promises";
13
14
  import path from "node:path";
14
- import { isFileMissingError, pathExists, readFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
15
+ import { isFileMissingError, readFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
15
16
  import { appendWorkspaceHistoryChange } from "../core/history/workspace-history.js";
16
17
  import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
17
18
  import { parseFieldsFile, serializeFieldsFile, } from "../core/schema/fields-file.js";
@@ -21,7 +22,7 @@ import { parseStatusDefsFile, serializeStatusDefsFile, } from "../core/schema/st
21
22
  import { normalizeStatusToken } from "../core/schema/status-token.js";
22
23
  import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
23
24
  import { listAllItemMetadataLight, locateItem, mutateItem, readLocatedItem, } from "../core/store/item-store.js";
24
- import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
25
+ import { resolvePmRoot } from "../core/store/paths.js";
25
26
  import { readSettings } from "../core/store/settings.js";
26
27
  import { EXIT_CODE } from "../core/shared/constants.js";
27
28
  import { PmCliError } from "../core/shared/errors.js";
@@ -725,9 +726,7 @@ async function appendSchemaReferenceHistory(params) {
725
726
  export async function runSchemaEvolutionMigration(requestInput, options, global) {
726
727
  const request = normalizedRequest(requestInput);
727
728
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
728
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
729
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
730
- }
729
+ await assertInitializedTracker(pmRoot);
731
730
  const migrationId = options.migrationId === undefined
732
731
  ? deriveSchemaEvolutionMigrationId(request, await fs.realpath(pmRoot))
733
732
  : requiredMigrationId(options.migrationId);
@@ -855,4 +854,4 @@ export const schemaMigrationTestOnly = {
855
854
  validateAndStoreMigrationPlan,
856
855
  };
857
856
  //# sourceMappingURL=schema-migration.js.map
858
- //# debugId=cd777de3-665f-5e01-ac98-8986f2a5a4c2
857
+ //# debugId=60738c1f-3b44-5f8a-82c9-99d2b2de1e51
@@ -4,7 +4,8 @@
4
4
  * Owns typed schema customization primitives shared by SDK, CLI, and MCP consumers.
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]="2ab8a5a9-dbea-526f-a541-b7ca2b106ac5")}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]="6112923d-5e06-5839-b452-a32818c6398d")}catch(e){}}();
8
+ import { assertInitializedTracker } from "./environment/tracker-preflight.js";
8
9
  import path from "node:path";
9
10
  import { mkdir } from "node:fs/promises";
10
11
  import { resolveAuthor } from "../core/shared/author.js";
@@ -24,7 +25,7 @@ import { EXIT_CODE } from "../core/shared/constants.js";
24
25
  import { PmCliError } from "../core/shared/errors.js";
25
26
  import { nowIso } from "../core/shared/time.js";
26
27
  import { getActiveExtensionRegistrations, runActiveOnWriteHooks, } from "../core/extensions/index.js";
27
- import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
28
+ import { resolvePmRoot } from "../core/store/paths.js";
28
29
  import { readSettings, resolveGovernanceKnobs, } from "../core/store/settings.js";
29
30
  import { resolvePmToolCustomFieldCollision } from "./cli-contracts/tool-schema.js";
30
31
  /** Public contract for schema subcommands, shared by SDK and presentation-layer consumers. */
@@ -160,9 +161,7 @@ export async function runSchemaAddType(name, options, global) {
160
161
  };
161
162
  }
162
163
  async function ensureInitialized(pmRoot) {
163
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
164
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
165
- }
164
+ await assertInitializedTracker(pmRoot);
166
165
  }
167
166
  /**
168
167
  * Reconcile the committed merge-driver fence with the type folders that exist
@@ -1365,4 +1364,4 @@ export const _testOnlySchemaCommand = {
1365
1364
  workflowSlotsReferencing,
1366
1365
  };
1367
1366
  //# sourceMappingURL=schema.js.map
1368
- //# debugId=2ab8a5a9-dbea-526f-a541-b7ca2b106ac5
1367
+ //# debugId=6112923d-5e06-5839-b452-a32818c6398d
package/dist/sdk/stats.js CHANGED
@@ -4,7 +4,8 @@
4
4
  * Implements the pm stats 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]="d28c7ac7-9801-5b0c-84c9-51deede398be")}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]="b56db1fc-d989-5d18-8b29-336a03f1e525")}catch(e){}}();
8
+ import { assertInitializedTracker } from "./environment/tracker-preflight.js";
8
9
  import fs from "node:fs/promises";
9
10
  import path from "node:path";
10
11
  import { getActiveExtensionRegistrations, runActiveOnReadHooks, } from "../core/extensions/index.js";
@@ -15,11 +16,9 @@ import { enforceHistoryStreamPolicyForItems } from "../core/history/history-stre
15
16
  import { computeHistoryStorageStats, } from "../core/history/history-storage-stats.js";
16
17
  import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
17
18
  import { resolveRuntimeStatusRegistry } from "../core/schema/runtime-schema.js";
18
- import { EXIT_CODE } from "../core/shared/constants.js";
19
- import { PmCliError } from "../core/shared/errors.js";
20
19
  import { nowIso } from "../core/shared/time.js";
21
20
  import { listAllItemMetadataLight, listAllItemMetadataWithBody, } from "../core/store/item-store.js";
22
- import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
21
+ import { resolvePmRoot } from "../core/store/paths.js";
23
22
  import { readSettings } from "../core/store/settings.js";
24
23
  import { recordImprovementObservation, readImprovementLedger, } from "./improvement-ledger.js";
25
24
  import { projectFleetAttributionAnalytics, projectProvenanceCoverageAnalytics, readHistoryAnalyticsWindow, } from "./history-analytics.js";
@@ -210,9 +209,7 @@ function assembleStatsResult(totals, byType, byStatus, omittedZeroBuckets, optio
210
209
  /** Implements run stats for the public runtime surface of this module. */
211
210
  export async function runStats(global, options = {}) {
212
211
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
213
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
214
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
215
- }
212
+ await assertInitializedTracker(pmRoot);
216
213
  const settings = await readSettings(pmRoot);
217
214
  const recordedObservations = await recordStatsObservations(global, options);
218
215
  const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
@@ -271,4 +268,4 @@ export async function runStats(global, options = {}) {
271
268
  });
272
269
  }
273
270
  //# sourceMappingURL=stats.js.map
274
- //# debugId=d28c7ac7-9801-5b0c-84c9-51deede398be
271
+ //# debugId=b56db1fc-d989-5d18-8b29-336a03f1e525
@@ -4,7 +4,8 @@
4
4
  * Implements the pm templates 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]="f232e106-54f4-572e-8f6e-054f52290267")}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]="5c70da27-21f6-5d31-b506-96e1818996d6")}catch(e){}}();
8
+ import { assertInitializedTracker } from "./environment/tracker-preflight.js";
8
9
  import fs from "node:fs/promises";
9
10
  import path from "node:path";
10
11
  import { pathExists, readFileIfExists, } from "../core/fs/fs-utils.js";
@@ -13,7 +14,7 @@ import { resolveAuthor } from "../core/shared/author.js";
13
14
  import { EXIT_CODE } from "../core/shared/constants.js";
14
15
  import { PmCliError } from "../core/shared/errors.js";
15
16
  import { nowIso } from "../core/shared/time.js";
16
- import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
17
+ import { resolvePmRoot } from "../core/store/paths.js";
17
18
  import { readSettings } from "../core/store/settings.js";
18
19
  import { CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS } from "./cli-contracts.js";
19
20
  const TEMPLATE_DIRECTORY_NAME = "templates";
@@ -78,9 +79,7 @@ function templatePath(pmRoot, normalizedName) {
78
79
  return path.join(templatesDirectory(pmRoot), `${normalizedName}${TEMPLATE_FILE_EXTENSION}`);
79
80
  }
80
81
  async function ensureTrackerInitialized(pmRoot) {
81
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
82
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
83
- }
82
+ await assertInitializedTracker(pmRoot);
84
83
  }
85
84
  function sortTemplateOptions(options) {
86
85
  return Object.fromEntries(Object.entries(options).sort(([left], [right]) => left.localeCompare(right)));
@@ -291,4 +290,4 @@ export async function runTemplatesShow(rawTemplateName, global) {
291
290
  };
292
291
  }
293
292
  //# sourceMappingURL=templates.js.map
294
- //# debugId=f232e106-54f4-572e-8f6e-054f52290267
293
+ //# debugId=5c70da27-21f6-5d31-b506-96e1818996d6
@@ -4,8 +4,8 @@
4
4
  * Implements the pm test all 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]="7fea0ecb-35e2-5d40-931f-ffdd1a465fdc")}catch(e){}}();
8
- import { pathExists } from "../../core/fs/fs-utils.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]="bb2758a5-a5c1-5f6e-be42-0e173fe16fe3")}catch(e){}}();
8
+ import { assertInitializedTracker } from "../environment/tracker-preflight.js";
9
9
  import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
10
10
  import { resolveItemTypeRegistry } from "../../core/item/type-registry.js";
11
11
  import { parseOptionalNumber } from "../../core/item/parse.js";
@@ -15,7 +15,7 @@ import { EXIT_CODE } from "../../core/shared/constants.js";
15
15
  import { PmCliError } from "../../core/shared/errors.js";
16
16
  import { nowIso } from "../../core/shared/time.js";
17
17
  import { listAllItemMetadataLight } from "../../core/store/item-store.js";
18
- import { getSettingsPath, resolveGlobalPmRoot, resolvePmRoot, } from "../../core/store/paths.js";
18
+ import { resolveGlobalPmRoot, resolvePmRoot } from "../../core/store/paths.js";
19
19
  import { readSettings } from "../../core/store/settings.js";
20
20
  import { appendTrackedTestRunSummary } from "../../core/test/item-test-run-tracking.js";
21
21
  import { resolveAuthor } from "../../core/shared/author.js";
@@ -245,7 +245,7 @@ const runTestAllItem = async (entry, context) => {
245
245
  });
246
246
  const summary = countStatuses(runResults);
247
247
  const failureCategories = countFailureCategories(runResults);
248
- const trackingWarnings = await appendTestAllItemTracking(entry, summary, context);
248
+ const trackingWarnings = await appendTestAllItemTracking(entry, summary, runResults, context);
249
249
  return {
250
250
  passed: summary.passed,
251
251
  failed: summary.failed,
@@ -273,7 +273,7 @@ const trackedRunFailed = (summary, options) => [
273
273
  ].includes(true);
274
274
  /** Projects true flags while keeping false values absent from persisted rows. */
275
275
  const optionalTrue = (value) => value ? true : undefined;
276
- const appendTestAllItemTracking = async (entry, summary, context) => {
276
+ const appendTestAllItemTracking = async (entry, summary, runResults, context) => {
277
277
  if (!context.trackingEnabled) {
278
278
  return [];
279
279
  }
@@ -300,6 +300,14 @@ const appendTestAllItemTracking = async (entry, summary, context) => {
300
300
  items: 1,
301
301
  linked_tests: entry.tests.length,
302
302
  fail_on_skipped_triggered: optionalTrue(context.options.failOnSkipped === true && summary.skipped > 0),
303
+ executions: runResults
304
+ .filter((result) => result.command?.trim())
305
+ .slice(0, 32)
306
+ .map((result) => ({
307
+ command: result.command.trim(),
308
+ requested_pm_context_mode: result.execution_context?.requested_pm_context_mode,
309
+ pm_context_mode: result.execution_context?.pm_context_mode,
310
+ })),
303
311
  },
304
312
  });
305
313
  }
@@ -421,9 +429,7 @@ const buildTestAllSelectionProgress = (params) => [
421
429
  /** Loads the tracker selection and linked tests for one test-all run. */
422
430
  const prepareTestAllRun = async (options, global) => {
423
431
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
424
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
425
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
426
- }
432
+ await assertInitializedTracker(pmRoot);
427
433
  const settings = await readSettings(pmRoot);
428
434
  const selection = await selectTestAllItems({ pmRoot, settings, options });
429
435
  const defaultTimeoutSeconds = parseTimeout(options.timeout);
@@ -489,4 +495,4 @@ export const _testOnlyTestAll = {
489
495
  formatTrackingError,
490
496
  };
491
497
  //# sourceMappingURL=batch.js.map
492
- //# debugId=7fea0ecb-35e2-5d40-931f-ffdd1a465fdc
498
+ //# debugId=bb2758a5-a5c1-5f6e-be42-0e173fe16fe3
@@ -4,7 +4,8 @@
4
4
  * Implements the pm test 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]="4322c352-6b95-5796-94eb-5a68745d53bc")}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]="5fe0ee3e-9590-56fc-b238-e56ff1970e52")}catch(e){}}();
8
+ import { assertInitializedTracker } from "../environment/tracker-preflight.js";
8
9
  import { spawn } from "node:child_process";
9
10
  import { cp, mkdir, mkdtemp, open, readdir, rm } from "node:fs/promises";
10
11
  import { tmpdir } from "node:os";
@@ -1790,6 +1791,14 @@ function buildTrackedTestRunSummary(params) {
1790
1791
  skipped: summary.skipped,
1791
1792
  fail_on_skipped_triggered: params.failOnSkippedTriggered ? true : undefined,
1792
1793
  measurements: measurements.length > 0 ? measurements : undefined,
1794
+ executions: params.runResults
1795
+ .filter((result) => result.command?.trim())
1796
+ .slice(0, 32)
1797
+ .map((result) => ({
1798
+ command: result.command.trim(),
1799
+ requested_pm_context_mode: result.execution_context?.requested_pm_context_mode,
1800
+ pm_context_mode: result.execution_context?.pm_context_mode,
1801
+ })),
1793
1802
  };
1794
1803
  }
1795
1804
  async function recordTestRunSummary(params) {
@@ -1849,9 +1858,7 @@ function buildTestMeasurementProjection(options, runs, recordedRun) {
1849
1858
  export async function runTest(id, options, global) {
1850
1859
  const stdinResolver = createStdinTokenResolver();
1851
1860
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
1852
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
1853
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
1854
- }
1861
+ await assertInitializedTracker(pmRoot);
1855
1862
  const settings = await readSettings(pmRoot);
1856
1863
  if ((options.measure?.length ?? 0) > 0 && options.run !== true) {
1857
1864
  throw new PmCliError("--measure requires --run", EXIT_CODE.USAGE);
@@ -1965,4 +1972,4 @@ export const _testOnlyTestCommand = {
1965
1972
  summarizeRunResultStatuses,
1966
1973
  };
1967
1974
  //# sourceMappingURL=execution.js.map
1968
- //# debugId=4322c352-6b95-5796-94eb-5a68745d53bc
1975
+ //# debugId=5fe0ee3e-9590-56fc-b238-e56ff1970e52
@@ -4,14 +4,14 @@
4
4
  * Implements the pm test runs 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]="8f02f498-5cee-59fa-9f4e-fd882c58d401")}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]="1cbb3565-26d8-5657-b724-602658bec852")}catch(e){}}();
8
+ import { assertInitializedTracker } from "../environment/tracker-preflight.js";
8
9
  import os from "node:os";
9
- import { pathExists } from "../../core/fs/fs-utils.js";
10
10
  import { EXIT_CODE } from "../../core/shared/constants.js";
11
11
  import { PmCliError } from "../../core/shared/errors.js";
12
12
  import { readAuthorEnvironment } from "../../core/shared/author.js";
13
13
  import { getBackgroundTestRunStatus, listBackgroundTestRuns, readBackgroundTestRunLogs, resumeBackgroundTestRun, runBackgroundTestRunWorker, spawnBackgroundTestRunWorker, startBackgroundTestRun, stopBackgroundTestRun, } from "../../core/test/background-runs.js";
14
- import { getSettingsPath, resolveGlobalPmRoot, resolvePmRoot, } from "../../core/store/paths.js";
14
+ import { resolveGlobalPmRoot, resolvePmRoot, } from "../../core/store/paths.js";
15
15
  import { readSettings } from "../../core/store/settings.js";
16
16
  import { parseLimit } from "../../core/shared/numeric-parsers.js";
17
17
  const BACKGROUND_STATUS_VALUES = [
@@ -81,9 +81,7 @@ function resolveRequestedBy(author, fallback) {
81
81
  return "unknown";
82
82
  }
83
83
  async function ensureInitialized(pmRoot) {
84
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
85
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
86
- }
84
+ await assertInitializedTracker(pmRoot);
87
85
  }
88
86
  /** Implements run start background run for the public runtime surface of this module. */
89
87
  export async function runStartBackgroundRun(options, global) {
@@ -193,4 +191,4 @@ export async function runTestRunsWorker(runId, global) {
193
191
  };
194
192
  }
195
193
  //# sourceMappingURL=runs.js.map
196
- //# debugId=8f02f498-5cee-59fa-9f4e-fd882c58d401
194
+ //# debugId=1cbb3565-26d8-5657-b724-602658bec852
package/dist/types.d.ts CHANGED
@@ -558,6 +558,15 @@ export interface TestRunMeasurement {
558
558
  /** ISO 8601 timestamp binding the measurement to its producing run. */
559
559
  recorded_at: string;
560
560
  }
561
+ /** Bounded command and tracker-context provenance for one linked-test execution. */
562
+ export interface ItemTestRunExecution {
563
+ /** Exact linked command selected for execution. */
564
+ command: string;
565
+ /** Context mode requested before linked-test overrides or auto-remediation. */
566
+ requested_pm_context_mode?: "schema" | "tracker" | "auto";
567
+ /** Effective context mode used by the linked command. */
568
+ pm_context_mode?: "schema" | "tracker" | "auto";
569
+ }
561
570
  /** Documents the item test run summary payload exchanged by command, SDK, and package integrations. */
562
571
  export interface ItemTestRunSummary {
563
572
  /** Executes the id operation through the package runtime. */
@@ -590,6 +599,8 @@ export interface ItemTestRunSummary {
590
599
  fail_on_skipped_triggered?: boolean;
591
600
  /** Bounded, deterministic quantitative evidence produced by this run. */
592
601
  measurements?: TestRunMeasurement[];
602
+ /** Commands and effective tracker contexts bound to this recorded run. */
603
+ executions?: ItemTestRunExecution[];
593
604
  }
594
605
  /** Documents the item metadata payload exchanged by command, SDK, and package integrations. */
595
606
  export interface ItemMetadata {
package/dist/types.js CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  /** Supported values accepted by the builtin item type contract. */
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]="f6ab5bae-53b3-5feb-b89f-46e64afe7058")}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]="13c65470-8f5f-59ca-acb5-50c926c68870")}catch(e){}}();
9
9
  export const BUILTIN_ITEM_TYPE_VALUES = [
10
10
  "Epic",
11
11
  "Feature",
@@ -243,4 +243,4 @@ export const CONTEXT_SECTION_VALUES = [
243
243
  "tests",
244
244
  ];
245
245
  //# sourceMappingURL=types.js.map
246
- //# debugId=f6ab5bae-53b3-5feb-b89f-46e64afe7058
246
+ //# debugId=13c65470-8f5f-59ca-acb5-50c926c68870
@@ -1,6 +1,6 @@
1
1
  # Agent UX Contracts
2
2
 
3
- Tracker references: [pm-v1yo](../.agents/pm/issues/pm-v1yo.toon), [pm-i6pi](../.agents/pm/issues/pm-i6pi.toon), [pm-um4g](../.agents/pm/issues/pm-um4g.toon), [pm-tmhs](../.agents/pm/issues/pm-tmhs.toon), [pm-6m1i](../.agents/pm/issues/pm-6m1i.toon), [pm-cj9v](../.agents/pm/issues/pm-cj9v.toon), [pm-yp56](../.agents/pm/issues/pm-yp56.toon).
3
+ Tracker references: [pm-v1yo](../.agents/pm/issues/pm-v1yo.toon), [pm-i6pi](../.agents/pm/issues/pm-i6pi.toon), [pm-um4g](../.agents/pm/issues/pm-um4g.toon), [pm-tmhs](../.agents/pm/issues/pm-tmhs.toon), [pm-6m1i](../.agents/pm/issues/pm-6m1i.toon), [pm-cj9v](../.agents/pm/issues/pm-cj9v.toon), [pm-yp56](../.agents/pm/issues/pm-yp56.toon), [pm-gos426](../.agents/pm/issues/pm-gos426.toon), [pm-flnefm](../.agents/pm/issues/pm-flnefm.toon), [pm-rggtvd](../.agents/pm/issues/pm-rggtvd.toon), and [pm-vk7zek](../.agents/pm/issues/pm-vk7zek.toon).
4
4
 
5
5
  These contracts keep common agent loops deterministic, token-efficient, and recoverable. Runtime contracts and `--help --json` remain the exact source for available flags.
6
6
 
@@ -10,6 +10,29 @@ These contracts keep common agent loops deterministic, token-efficient, and reco
10
10
 
11
11
  The public SDK exports `collectNewOrderingCycleWarnings(beforeItems, afterItems, changedItemId)` from `@unbrained/pm-cli/sdk`. Package authors can apply the same immutable-snapshot advisory to custom mutation workflows; activated custom relationship kinds participate through the shared registry.
12
12
 
13
+ Dependency removal is lossless. `--dep-remove` rejects the same malformed
14
+ shorthand as `--dep`, and a selector that matches nothing returns the typed
15
+ `dependency_remove_no_match` refusal instead of a successful no-op. Exact
16
+ rows can be retired by selecting `id`, `kind` (or its input-only `type` alias),
17
+ `source_kind`, `author`, and `created_at`; omitted coordinates intentionally broaden the match. Exact
18
+ duplicate rows can still be normalized without delete-then-add risk by
19
+ re-adding the same identity; the mutation keeps one canonical row and never
20
+ removes the logical edge. Identity comparison includes normalized `id`, `kind`,
21
+ `source_kind`, `author`, and creation instant, preserving provenance-distinct
22
+ siblings.
23
+
24
+ Hierarchy mutations are stricter than ordering advisories. `pm create` and
25
+ `pm update` refuse a new cycle, registry cardinality breach, or contradictory
26
+ scalar/dependency parent before writing. The structured refusal names the
27
+ changed holder plus the cycle members or competing parents. Existing legacy
28
+ debt remains mutable only toward a cleaner state, so repair does not require a
29
+ global bypass. Read paths canonicalize every registry-declared hierarchy kind;
30
+ an item cannot disappear from `pm list --parent` or `pm get --tree` merely
31
+ because an integration used a dependency row instead of the scalar field.
32
+ `pm update-many` applies the same hierarchy guard independently to each matched
33
+ item: one refused row is reported as failed while other rows may still commit,
34
+ so a bulk hierarchy mutation is not atomic across the complete match set.
35
+
13
36
  `pm graph audit` uses two explicit units:
14
37
 
15
38
  - `finding_count`, `findings_by_severity`, and `findings_by_code` count finding rows.