@unbrained/pm-cli 2026.8.20 → 2026.8.21

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 (167) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +22 -0
  3. package/dist/cli/error-guidance.d.ts +20 -0
  4. package/dist/cli/error-guidance.js +29 -30
  5. package/dist/cli-bundle/bundle-manifest.json +151 -151
  6. package/dist/cli-bundle/chunks/chunk-2MA6ZQVZ.js +197 -0
  7. package/dist/cli-bundle/chunks/{chunk-K3EN3LK2.js → chunk-3AFAUHUE.js} +2 -2
  8. package/dist/cli-bundle/chunks/chunk-7VHZS727.js +5 -0
  9. package/dist/cli-bundle/chunks/{chunk-L4LGPBJU.js → chunk-BKYB45NQ.js} +68 -68
  10. package/dist/cli-bundle/chunks/{chunk-4GB2LTOQ.js → chunk-BUNIEJNE.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-XYDDWBZN.js → chunk-JSLOFXGA.js} +3 -3
  12. package/dist/cli-bundle/chunks/{chunk-TSMWLCHS.js → chunk-LARJJ3RK.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-7BRF2BX2.js → chunk-LOVTQ52Z.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-US2ZQW2M.js → chunk-N3DSV4CH.js} +47 -47
  15. package/dist/cli-bundle/chunks/chunk-OCLPLFAY.js +35 -0
  16. package/dist/cli-bundle/chunks/chunk-S4IRYKBU.js +13 -0
  17. package/dist/cli-bundle/chunks/{register-list-query-JSAQCVOC.js → register-list-query-F57EWDEF.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-mutation-XJPAW63D.js → register-mutation-7IY2D5KO.js} +2 -2
  19. package/dist/cli-bundle/chunks/{register-operations-DSOSB2XQ.js → register-operations-FALL3YTU.js} +2 -2
  20. package/dist/cli-bundle/chunks/{register-setup-QUR6QL2C.js → register-setup-HXU7IZZD.js} +2 -2
  21. package/dist/cli-bundle/focused-chunks/{chunk-FUREQLQN.js → chunk-2NIY5NKG.js} +2 -2
  22. package/dist/cli-bundle/focused-chunks/{chunk-G3C5ERXG.js → chunk-4ERLO7QD.js} +2 -2
  23. package/dist/cli-bundle/focused-chunks/chunk-7WZRLCYF.js +50 -0
  24. package/dist/cli-bundle/focused-chunks/{chunk-AZBACT5T.js → chunk-CKKQSJNN.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/chunk-EEFKYMDR.js +16 -0
  26. package/dist/cli-bundle/focused-chunks/{chunk-GXWQBE3T.js → chunk-F2A56DHV.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/{chunk-M32HFIQB.js → chunk-F4YEW5I2.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/{chunk-UGSS4F5X.js → chunk-FH6DYED3.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-TDR5OGG3.js → chunk-FJ22HNRP.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/chunk-FV5ACOK7.js +2 -0
  31. package/dist/cli-bundle/focused-chunks/{chunk-Q47EX4DI.js → chunk-JEAVFOWM.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/{chunk-OM65KHGF.js → chunk-KDNG7TKQ.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-NJ63LOP6.js +155 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-NXRTQ7HI.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-JWKEDZJI.js → chunk-TJ7EMJ46.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-5L7M4AI7.js → chunk-UZE7XUZK.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-325UXIO7.js → chunk-YKBKIEAJ.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-BLJCGGID.js → chunk-ZOSEELYJ.js} +2 -2
  39. package/dist/cli-bundle/main.js +12 -12
  40. package/dist/cli-bundle/sdk-authoring.js +1 -1
  41. package/dist/cli-bundle/sdk-contracts.js +2 -2
  42. package/dist/cli-bundle/sdk-core.js +40 -40
  43. package/dist/cli-bundle/sdk-governance.js +1 -1
  44. package/dist/cli-bundle/sdk-graph.js +1 -1
  45. package/dist/cli-bundle/sdk-merge.js +32 -32
  46. package/dist/cli-bundle/sdk-query.js +1 -1
  47. package/dist/cli-bundle/sdk-runtime.js +1 -1
  48. package/dist/cli-bundle/sdk-testing.js +1 -1
  49. package/dist/cli-bundle/sdk.js +5 -5
  50. package/dist/core/shared/errors.d.ts +16 -0
  51. package/dist/core/shared/errors.js +2 -2
  52. package/dist/core/store/item-store.js +6 -91
  53. package/dist/core/store/tracker-preflight.d.ts +7 -0
  54. package/dist/core/store/tracker-preflight.js +142 -0
  55. package/dist/sdk/agent/tracker-preflight-contracts.d.ts +63 -0
  56. package/dist/sdk/agent/tracker-preflight-contracts.js +127 -0
  57. package/dist/sdk/annotations.js +6 -7
  58. package/dist/sdk/config.d.ts +5 -0
  59. package/dist/sdk/config.js +5 -5
  60. package/dist/sdk/context-intent-runtime.js +7 -4
  61. package/dist/sdk/contracts.d.ts +1 -0
  62. package/dist/sdk/contracts.js +3 -2
  63. package/dist/sdk/dependencies.js +5 -7
  64. package/dist/sdk/dependency-flag-validation.d.ts +1 -1
  65. package/dist/sdk/dependency-flag-validation.js +10 -4
  66. package/dist/sdk/environment/tracker-preflight.d.ts +6 -0
  67. package/dist/sdk/environment/tracker-preflight.js +10 -0
  68. package/dist/sdk/eval.js +5 -7
  69. package/dist/sdk/files.js +6 -10
  70. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +39 -3
  71. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +69 -8
  72. package/dist/sdk/governance/assurance.d.ts +36 -2
  73. package/dist/sdk/governance/assurance.js +184 -10
  74. package/dist/sdk/governance/gc.js +5 -6
  75. package/dist/sdk/governance/health.js +5 -6
  76. package/dist/sdk/governance/reindex.js +5 -6
  77. package/dist/sdk/governance/validate.d.ts +1 -2
  78. package/dist/sdk/governance/validate.js +6 -12
  79. package/dist/sdk/graph/governance.d.ts +7 -5
  80. package/dist/sdk/graph/governance.js +32 -16
  81. package/dist/sdk/graph/run.js +5 -7
  82. package/dist/sdk/graph/traversal.js +14 -5
  83. package/dist/sdk/history-compact.js +6 -9
  84. package/dist/sdk/history-read.js +5 -7
  85. package/dist/sdk/history-redact.js +5 -6
  86. package/dist/sdk/history-repair.js +6 -9
  87. package/dist/sdk/improvement-ledger.js +7 -10
  88. package/dist/sdk/index.d.ts +2 -0
  89. package/dist/sdk/index.js +4 -2
  90. package/dist/sdk/lifecycle/append.d.ts +0 -5
  91. package/dist/sdk/lifecycle/append.js +5 -6
  92. package/dist/sdk/lifecycle/claim.d.ts +0 -5
  93. package/dist/sdk/lifecycle/claim.js +6 -9
  94. package/dist/sdk/lifecycle/close-many.d.ts +0 -5
  95. package/dist/sdk/lifecycle/close-many.js +5 -6
  96. package/dist/sdk/lifecycle/close.d.ts +0 -5
  97. package/dist/sdk/lifecycle/close.js +5 -6
  98. package/dist/sdk/lifecycle/copy.d.ts +0 -5
  99. package/dist/sdk/lifecycle/copy.js +5 -6
  100. package/dist/sdk/lifecycle/create.d.ts +0 -5
  101. package/dist/sdk/lifecycle/create.js +5 -9
  102. package/dist/sdk/lifecycle/delete.js +5 -6
  103. package/dist/sdk/lifecycle/focus.d.ts +0 -5
  104. package/dist/sdk/lifecycle/focus.js +5 -6
  105. package/dist/sdk/lifecycle/plan.d.ts +0 -5
  106. package/dist/sdk/lifecycle/plan.js +5 -6
  107. package/dist/sdk/lifecycle/restore.js +5 -6
  108. package/dist/sdk/lifecycle/update-many.d.ts +0 -5
  109. package/dist/sdk/lifecycle/update-many.js +5 -6
  110. package/dist/sdk/lifecycle/update.d.ts +0 -5
  111. package/dist/sdk/lifecycle/update.js +48 -9
  112. package/dist/sdk/linked-artifacts.js +6 -7
  113. package/dist/sdk/merge/install.js +5 -6
  114. package/dist/sdk/mutation-events.js +5 -7
  115. package/dist/sdk/package-import-adapters.js +6 -8
  116. package/dist/sdk/profile.js +6 -7
  117. package/dist/sdk/query/activity.js +5 -6
  118. package/dist/sdk/query/calendar.js +5 -6
  119. package/dist/sdk/query/get.d.ts +0 -5
  120. package/dist/sdk/query/get.js +5 -6
  121. package/dist/sdk/query/history.d.ts +0 -5
  122. package/dist/sdk/query/history.js +5 -6
  123. package/dist/sdk/query/list.js +5 -7
  124. package/dist/sdk/query/search.js +5 -7
  125. package/dist/sdk/relationship-kinds/contract.d.ts +8 -0
  126. package/dist/sdk/relationship-kinds/contract.js +13 -13
  127. package/dist/sdk/relationships.d.ts +1 -1
  128. package/dist/sdk/relationships.js +20 -2
  129. package/dist/sdk/schema-migration.js +6 -7
  130. package/dist/sdk/schema.js +5 -6
  131. package/dist/sdk/stats.js +5 -8
  132. package/dist/sdk/templates.js +5 -6
  133. package/dist/sdk/test/batch.js +5 -7
  134. package/dist/sdk/test/execution.js +4 -5
  135. package/dist/sdk/test/runs.js +5 -7
  136. package/docs/AGENT_UX_CONTRACTS.md +8 -1
  137. package/docs/DEPENDENCY_KIND_CONTRACT.md +12 -1
  138. package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +37 -0
  139. package/docs/RELATIONSHIP_GRAPH.md +92 -10
  140. package/docs/SDK_PRIMITIVE_INVENTORY.md +15 -1
  141. package/marketplace.json +2 -2
  142. package/package.json +1 -1
  143. package/packages/pm-beads/package.json +1 -1
  144. package/packages/pm-calendar/package.json +1 -1
  145. package/packages/pm-command-kit/package.json +1 -1
  146. package/packages/pm-digital-twin/package.json +1 -1
  147. package/packages/pm-governance-audit/package.json +1 -1
  148. package/packages/pm-guide-shell/package.json +1 -1
  149. package/packages/pm-kanban/package.json +1 -1
  150. package/packages/pm-lifecycle-hooks/package.json +1 -1
  151. package/packages/pm-linked-test-adapters/package.json +1 -1
  152. package/packages/pm-search-advanced/package.json +1 -1
  153. package/packages/pm-templates/package.json +1 -1
  154. package/packages/pm-todos/package.json +1 -1
  155. package/packages/pm-vcs/package.json +1 -1
  156. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  157. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  158. package/sdk/public-surface.json +255 -21
  159. package/dist/cli-bundle/chunks/chunk-2RDVGYWE.js +0 -13
  160. package/dist/cli-bundle/chunks/chunk-BLVQHFSY.js +0 -35
  161. package/dist/cli-bundle/chunks/chunk-CU25EQVV.js +0 -5
  162. package/dist/cli-bundle/chunks/chunk-RS3IV2R6.js +0 -197
  163. package/dist/cli-bundle/focused-chunks/chunk-6AHG2YW7.js +0 -50
  164. package/dist/cli-bundle/focused-chunks/chunk-KYZ6JGPL.js +0 -155
  165. package/dist/cli-bundle/focused-chunks/chunk-RIHDMCUM.js +0 -2
  166. package/dist/cli-bundle/focused-chunks/chunk-T4ZFY7ZJ.js +0 -16
  167. package/dist/cli-bundle/focused-chunks/chunk-Z3PLWSGM.js +0 -2
@@ -4,7 +4,8 @@
4
4
  * Implements the pm search 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]="c650f22f-5fcd-5489-aa9b-da11c2d1db63")}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]="a4117e19-af3e-50f5-b3cc-86c39aa4b439")}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 { toNonEmptyStringOrUndefined } from "../../core/shared/primitives.js";
@@ -23,7 +24,6 @@ import { readVectorizationStatusLedger } from "../../core/search/cache.js";
23
24
  import { buildEventCorpus, buildPlanFlatCorpus, buildReminderCorpus, buildSearchCorpus, resolveSearchCorpusFields, } from "../../core/search/corpus.js";
24
25
  import { buildBm25Index, flattenSearchCorpusText, resolveBm25Params, scoreBm25Query, tokenizeBm25, } from "../../core/search/bm25.js";
25
26
  import { collectStaleVectorizationIds } from "../../core/search/staleness.js";
26
- import { pathExists } from "../../core/fs/fs-utils.js";
27
27
  import { parseItemDocument } from "../../core/item/item-format.js";
28
28
  import { toItemRecord } from "../../core/item/item-record.js";
29
29
  import { isTerminalStatus } from "../../core/item/status.js";
@@ -40,7 +40,7 @@ import { tokenizeAlphaNumeric } from "../../core/shared/text-normalization.js";
40
40
  import { compareTimestampStrings, matchesTimestampFilters, nowIso, } from "../../core/shared/time.js";
41
41
  import { listAllDocumentCandidatesCached } from "../../core/store/item-metadata-cache.js";
42
42
  import { listAllItemMetadata } from "../../core/store/item-store.js";
43
- import { getItemPath, getSettingsPath, resolveGlobalPmRoot, resolvePmRoot, } from "../../core/store/paths.js";
43
+ import { getItemPath, resolveGlobalPmRoot, resolvePmRoot, } from "../../core/store/paths.js";
44
44
  import { readSettings } from "../../core/store/settings.js";
45
45
  import { resolveSearchPage } from "./search-pagination.js";
46
46
  import { normalizeSearchPhrase, parseMinScoreOverride, parseSearchBoolean, parseSearchDeadline, parseSearchMatchMode, parseSearchMode, parseSearchProjection, parseSearchTokens, parseSemanticWeightOverride, parseTimestampWindow, resolveHybridSemanticWeight, resolveSearchMaxResults, resolveSearchScoreThreshold, resolveSearchTuning, validateSearchProjectionFields, } from "./search-contracts.js";
@@ -1571,9 +1571,7 @@ function prepareSearchInput(rawQuery, rawOptions) {
1571
1571
  }
1572
1572
  async function resolveSearchRuntimeContext(prepared, global) {
1573
1573
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
1574
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
1575
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
1576
- }
1574
+ await assertInitializedTracker(pmRoot);
1577
1575
  const storedSettings = await readSettings(pmRoot);
1578
1576
  const settings = resolveSettingsWithSemanticRuntimeDefaults(storedSettings).settings;
1579
1577
  const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
@@ -1987,4 +1985,4 @@ export async function runSearch(rawQuery, rawOptions, global) {
1987
1985
  return withSearchWorkspaceMemory(buildSearchResultForHits(response, projectedItems, total, page.limited.length, effectiveProjection, page.pageExtras), workspaceMemoryResult);
1988
1986
  }
1989
1987
  //# sourceMappingURL=search.js.map
1990
- //# debugId=c650f22f-5fcd-5489-aa9b-da11c2d1db63
1988
+ //# debugId=a4117e19-af3e-50f5-b3cc-86c39aa4b439
@@ -15,12 +15,20 @@ export type RelationshipTemporalOrder = "source_after_target";
15
15
  export type RelationshipPrecedence = "source_before_target" | "target_before_source";
16
16
  /** Endpoint that represents the structural parent for hierarchy kinds. */
17
17
  export type RelationshipHierarchyDirection = "source_parent" | "target_parent";
18
+ /** Closure family that gives a relationship its default traversal vocabulary. */
19
+ export type RelationshipTraversalFamily = "hierarchy" | "ordering" | "semantic" | "association";
20
+ /** Direction in which an edge can carry a node toward a declared outcome. */
21
+ export type RelationshipOutcomeTraversal = "source_to_target" | "target_to_source" | "both";
18
22
  /** Versioned semantic definition for a built-in or application-defined edge kind. */
19
23
  export interface RelationshipKindDefinition {
20
24
  /** Canonical, case-insensitive kind identifier. */
21
25
  kind: string;
22
26
  /** Whether traversing source to target has distinct meaning from the reverse. */
23
27
  direction: RelationshipDirection;
28
+ /** Default closure vocabulary; omitted custom definitions infer it from legacy flags. */
29
+ traversal?: RelationshipTraversalFamily;
30
+ /** Direction this kind contributes to typed outcome reachability, when any. */
31
+ outcomeTraversal?: RelationshipOutcomeTraversal;
24
32
  /** Optional canonical kind used when traversing a directed edge in reverse. */
25
33
  inverse?: string;
26
34
  /** Whether the kind participates in execution-order cycle checks. */
@@ -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]="b1c32b57-0231-5bea-ade4-99247504f938")}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) {
@@ -129,6 +139,14 @@ export class RelationshipKindRegistry {
129
139
  const normalized = Object.freeze({
130
140
  ...definition,
131
141
  kind,
142
+ traversal: definition.traversal ??
143
+ (definition.hierarchy
144
+ ? "hierarchy"
145
+ : definition.ordering
146
+ ? "ordering"
147
+ : definition.direction === "undirected"
148
+ ? "association"
149
+ : "semantic"),
132
150
  hierarchy: definition.hierarchy ?? false,
133
151
  inverse,
134
152
  aliases: Object.freeze(aliases),
@@ -552,4 +570,4 @@ export function dependencyToRelationship(source, dependency, registry = defaultR
552
570
  };
553
571
  }
554
572
  //# sourceMappingURL=relationships.js.map
555
- //# debugId=7f733de4-104b-50a9-9c0a-cd9850bfcd78
573
+ //# debugId=b1c32b57-0231-5bea-ade4-99247504f938
@@ -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]="aeb0a1a7-bc73-5c56-bbed-9472c651b5f6")}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";
@@ -421,9 +421,7 @@ const buildTestAllSelectionProgress = (params) => [
421
421
  /** Loads the tracker selection and linked tests for one test-all run. */
422
422
  const prepareTestAllRun = async (options, global) => {
423
423
  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
- }
424
+ await assertInitializedTracker(pmRoot);
427
425
  const settings = await readSettings(pmRoot);
428
426
  const selection = await selectTestAllItems({ pmRoot, settings, options });
429
427
  const defaultTimeoutSeconds = parseTimeout(options.timeout);
@@ -489,4 +487,4 @@ export const _testOnlyTestAll = {
489
487
  formatTrackingError,
490
488
  };
491
489
  //# sourceMappingURL=batch.js.map
492
- //# debugId=7fea0ecb-35e2-5d40-931f-ffdd1a465fdc
490
+ //# debugId=aeb0a1a7-bc73-5c56-bbed-9472c651b5f6
@@ -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]="2354c553-3a81-59d8-9c0a-3d19cd3cedd2")}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";
@@ -1849,9 +1850,7 @@ function buildTestMeasurementProjection(options, runs, recordedRun) {
1849
1850
  export async function runTest(id, options, global) {
1850
1851
  const stdinResolver = createStdinTokenResolver();
1851
1852
  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
- }
1853
+ await assertInitializedTracker(pmRoot);
1855
1854
  const settings = await readSettings(pmRoot);
1856
1855
  if ((options.measure?.length ?? 0) > 0 && options.run !== true) {
1857
1856
  throw new PmCliError("--measure requires --run", EXIT_CODE.USAGE);
@@ -1965,4 +1964,4 @@ export const _testOnlyTestCommand = {
1965
1964
  summarizeRunResultStatuses,
1966
1965
  };
1967
1966
  //# sourceMappingURL=execution.js.map
1968
- //# debugId=4322c352-6b95-5796-94eb-5a68745d53bc
1967
+ //# debugId=2354c553-3a81-59d8-9c0a-3d19cd3cedd2
@@ -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
@@ -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), and [pm-flnefm](../.agents/pm/issues/pm-flnefm.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,13 @@ 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
+ duplicate rows can be normalized without delete-then-add risk by re-adding the
17
+ same `id`, `kind`, and `source_kind`; the mutation keeps one canonical row and
18
+ never removes the logical edge.
19
+
13
20
  `pm graph audit` uses two explicit units:
14
21
 
15
22
  - `finding_count`, `findings_by_severity`, and `findings_by_code` count finding rows.
@@ -1,6 +1,6 @@
1
1
  # Dependency-kind contract
2
2
 
3
- Tracker: [pm-4020c5](../.agents/pm/issues/pm-4020c5.toon), [pm-jkbqt8](../.agents/pm/issues/pm-jkbqt8.toon), [pm-q6n8sj](../.agents/pm/issues/pm-q6n8sj.toon), [pm-ouyq3n](../.agents/pm/issues/pm-ouyq3n.toon)
3
+ Tracker: [pm-4020c5](../.agents/pm/issues/pm-4020c5.toon), [pm-jkbqt8](../.agents/pm/issues/pm-jkbqt8.toon), [pm-q6n8sj](../.agents/pm/issues/pm-q6n8sj.toon), [pm-ouyq3n](../.agents/pm/issues/pm-ouyq3n.toon), [pm-gos426](../.agents/pm/issues/pm-gos426.toon), and [pm-flnefm](../.agents/pm/issues/pm-flnefm.toon).
4
4
 
5
5
  Dependency rows have one canonical stored spelling per relationship meaning. Command inputs remain compatibility-friendly: hyphens normalize to underscores and the aliases below are accepted, but `pm create` and `pm update` persist the canonical kind. Existing historical rows are never rewritten implicitly.
6
6
 
@@ -15,6 +15,17 @@ Dependency rows have one canonical stored spelling per relationship meaning. Com
15
15
 
16
16
  The SDK relationship registry is authoritative. `canonicalizeRelationshipKind()` rejects unknown spellings, while `resolveCanonicalRelationshipKind()` supports validation flows that need an undefined result. `pm contracts` publishes `relationship_kind_contracts` with canonical names, aliases, inverses, and ordering/hierarchy semantics.
17
17
 
18
+ Dependency additions and removals share the same lossless input grammar. A
19
+ bare value is an item id; structured input uses `id=<id>` plus an optional
20
+ canonical `kind`/`type` and `source_kind`. Punctuation-shaped shorthand such as
21
+ `OTHER,related` is rejected with `dependency_flag_value_invalid` on both
22
+ `--dep` and `--dep-remove`, before prefix normalization can turn it into a
23
+ dangling id. A removal selector that matches no stored row fails with
24
+ `dependency_remove_no_match` and returns the unmatched selectors plus compact
25
+ available identities. Re-adding a stored dependency identity is idempotent; if
26
+ legacy storage contains that exact identity more than once, the same mutation
27
+ collapses the touched copies to one without creating an edge-absence window.
28
+
18
29
  `recurs_from` has no alias: a later occurrence points to an earlier occurrence.
19
30
  It is persistent after both items become terminal and carries temporal identity,
20
31
  not execution precedence. `supersedes` keeps replacement semantics, while
@@ -65,6 +65,43 @@ Generic action hosts use `item-reopen` with required `id` and `reason` fields.
65
65
  The action participates in the generated action schema, SDK dispatch coverage,
66
66
  CLI/SDK parameter parity, command grammar, and MCP `pm_run` surface.
67
67
 
68
+ ## Tracker Preflight Recovery
69
+
70
+ Every SDK command that requires project state now enters through one shared
71
+ filesystem preflight instead of maintaining a command-local settings check.
72
+ The public aggregate SDK exposes the same primitive for packages and embedded
73
+ hosts:
74
+
75
+ ```ts
76
+ import {
77
+ assertInitializedTracker,
78
+ assertReadableTrackerRoot,
79
+ } from "@unbrained/pm-cli/sdk";
80
+
81
+ await assertReadableTrackerRoot(candidateRoot); // an empty directory is valid
82
+ await assertInitializedTracker(projectRoot); // settings.json is required
83
+ ```
84
+
85
+ The refusal contract distinguishes four states before any command-specific
86
+ read or mutation begins:
87
+
88
+ | Selected root state | Code | Exit | Recovery |
89
+ | --- | --- | ---: | --- |
90
+ | Path does not exist | `tracker_root_missing` | 3 | Tokenized, non-interactive `pm --pm-path <path> init --defaults --agent-guidance skip` |
91
+ | Directory exists but `settings.json` does not | `tracker_not_initialized` | 3 | The same initialization retry |
92
+ | Path or ancestor is a regular file | `tracker_root_not_directory` | 2 | Select a directory; never suggest `pm init` against the file |
93
+ | Directory cannot be read or searched | `tracker_root_unreadable` | 1 | Repair permissions, then retry the same selected root |
94
+
95
+ `listTrackerPreflightRecoveryContracts` publishes this four-state corpus from
96
+ `@unbrained/pm-cli/sdk/contracts`.
97
+ `scoreTrackerPreflightRecoveryClosure` verifies code, exit class, recovery kind,
98
+ and executable retry evidence. The repository recovery gate runs these probes
99
+ beside the 18 closed-domain probes, so its ratcheted corpus is 22 and a removed
100
+ state, failed retry, or unsafe file-path initialization suggestion blocks the
101
+ release. The surface-replication gate separately requires at least 50 shared
102
+ preflight invocations across the 45 migrated SDK modules and forbids the former
103
+ inline error body from returning.
104
+
68
105
  ## Duplicate Intake
69
106
 
70
107
  Create and copy similarity governance inspect all lifecycle statuses. The