@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,9 +4,9 @@
4
4
  * Implements the pm deps 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]="ee0547d9-ae0f-5762-8bff-e25f0a3cd4d5")}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]="74a825f3-1301-5dc5-a887-c6ff68f6d7ec")}catch(e){}}();
8
+ import { assertInitializedTracker } from "./environment/tracker-preflight.js";
8
9
  import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
9
- import { pathExists } from "../core/fs/fs-utils.js";
10
10
  import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
11
11
  import { isTerminalStatus } from "../core/item/status.js";
12
12
  import { resolveRuntimeStatusRegistry } from "../core/schema/runtime-schema.js";
@@ -14,7 +14,7 @@ import { EXIT_CODE } from "../core/shared/constants.js";
14
14
  import { PmCliError } from "../core/shared/errors.js";
15
15
  import { formatBuiltInOutput } from "../core/output/output.js";
16
16
  import { listAllItemMetadataLight, locateItem, readLocatedItem, } from "../core/store/item-store.js";
17
- import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
17
+ import { resolvePmRoot } from "../core/store/paths.js";
18
18
  import { readSettings } from "../core/store/settings.js";
19
19
  import { estimatePmOutputTokens } from "./cli-contracts/agent-output-contracts.js";
20
20
  import { assertProjectionModeChoice, attachOutputOmissionReceipt, } from "./output-projection.js";
@@ -659,9 +659,7 @@ function attachDepsProjection(result, summaryOnly, legacyAliasCounts = {}) {
659
659
  /** Implements run deps for the public runtime surface of this module. */
660
660
  export async function runDeps(id, options, global) {
661
661
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
662
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
663
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
664
- }
662
+ await assertInitializedTracker(pmRoot);
665
663
  const format = parseFormat(options.format);
666
664
  const maxDepth = parseMaxDepth(options.maxDepth);
667
665
  const collapse = parseCollapse(options.collapse);
@@ -718,4 +716,4 @@ export async function runDeps(id, options, global) {
718
716
  return attachDepsProjection(buildTreeOrGraphDepsResult(id, format, options, index, maxDepth, collapse, global.json === true ? "json" : "toon"), false, Object.fromEntries(Object.entries(assembleWorkspaceRelationshipGraph(items, (status) => isTerminalStatus(status, statusRegistry)).legacyAliasCounts)));
719
717
  }
720
718
  //# sourceMappingURL=dependencies.js.map
721
- //# debugId=ee0547d9-ae0f-5762-8bff-e25f0a3cd4d5
719
+ //# debugId=74a825f3-1301-5dc5-a887-c6ff68f6d7ec
@@ -1,7 +1,7 @@
1
1
  import type { Dependency, ItemFormat, RuntimeSchemaSettings } from "../types/index.js";
2
2
  import { type RelationshipKindRegistry } from "./relationships.js";
3
3
  /** Reject malformed shorthand before item-id prefix normalization can create a dangling graph node. */
4
- export declare function assertValidBareDependencyFlagValue(value: string, structured: boolean): void;
4
+ export declare function assertValidBareDependencyFlagValue(value: string, structured: boolean, flag?: string): void;
5
5
  /**
6
6
  * Validate prospective stored dependencies against the active relationship
7
7
  * ontology before a create or update mutation writes item or history state.
@@ -1,6 +1,6 @@
1
1
  /** @module cli/commands/dependency-flag-validation */
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f9c9b926-c912-548e-a9c7-64c2c69767cd")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d6f359cb-2bc9-5f96-8789-db91512d0bd5")}catch(e){}}();
4
4
  import { EXIT_CODE } from "../core/shared/constants.js";
5
5
  import { PmCliError } from "../core/shared/errors.js";
6
6
  import { toErrorMessage } from "../core/shared/primitives.js";
@@ -9,9 +9,15 @@ import { isExternalDependencySourceKind } from "./dependency-provenance.js";
9
9
  import { resolveWorkspaceRelationshipKindRegistry } from "./graph/assembly.js";
10
10
  import { assertRelationshipEdgeAllowed, } from "./relationships.js";
11
11
  /** Reject malformed shorthand before item-id prefix normalization can create a dangling graph node. */
12
- export function assertValidBareDependencyFlagValue(value, structured) {
12
+ export function assertValidBareDependencyFlagValue(value, structured, flag = "--dep") {
13
13
  if (!structured && /[:,=]/.test(value)) {
14
- throw new PmCliError(`Invalid --dep value "${value}". Use a bare item id or id=<id>,kind=<kind>.`, EXIT_CODE.USAGE);
14
+ throw new PmCliError(`Invalid ${flag} value "${value}". Use a bare item id or id=<id>,kind=<kind>.`, EXIT_CODE.USAGE, {
15
+ code: "dependency_flag_value_invalid",
16
+ reason: "malformed_dependency_shorthand",
17
+ flag,
18
+ value,
19
+ required: "Use a bare item id or an explicit id=<id>,kind=<kind> entry.",
20
+ });
15
21
  }
16
22
  }
17
23
  /**
@@ -148,4 +154,4 @@ export async function assertDependencyTargetsResolvable(params) {
148
154
  return missingTargets.map((target) => `dependency_target_unresolved:${target}`);
149
155
  }
150
156
  //# sourceMappingURL=dependency-flag-validation.js.map
151
- //# debugId=f9c9b926-c912-548e-a9c7-64c2c69767cd
157
+ //# debugId=d6f359cb-2bc9-5f96-8789-db91512d0bd5
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @module sdk/environment/tracker-preflight
3
+ *
4
+ * Exposes tracker initialization and filesystem preflight primitives to SDK consumers.
5
+ */
6
+ export { assertInitializedTracker, assertReadableTrackerRoot, buildTrackerInitializationRecovery, } from "../../core/store/tracker-preflight.js";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @module sdk/environment/tracker-preflight
3
+ *
4
+ * Exposes tracker initialization and filesystem preflight primitives to SDK consumers.
5
+ */
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]="745b9c3b-538c-558f-b018-b406ca4318f0")}catch(e){}}();
8
+ export { assertInitializedTracker, assertReadableTrackerRoot, buildTrackerInitializationRecovery, } from "../../core/store/tracker-preflight.js";
9
+ //# sourceMappingURL=tracker-preflight.js.map
10
+ //# debugId=745b9c3b-538c-558f-b018-b406ca4318f0
package/dist/sdk/eval.js CHANGED
@@ -10,15 +10,15 @@
10
10
  * instead of silently degrading retrieval quality.
11
11
  */
12
12
 
13
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b90a064c-f423-5bf7-9fbf-1fb273c7b5af")}catch(e){}}();
13
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9cc9405b-d2b8-59aa-893f-54892595788a")}catch(e){}}();
14
+ import { assertInitializedTracker } from "./environment/tracker-preflight.js";
14
15
  import fs from "node:fs/promises";
15
16
  import path from "node:path";
16
17
  import { aggregateEvalMetrics, DEFAULT_EVAL_K, EVAL_QUERY_SET_EXAMPLE, EVAL_QUERY_SET_SCHEMA_ID, evaluateRanking, parseEvalQuerySet, } from "../core/search/eval.js";
17
18
  import { EXIT_CODE } from "../core/shared/constants.js";
18
19
  import { PmCliError } from "../core/shared/errors.js";
19
20
  import { coercePositiveInteger } from "../core/shared/primitives.js";
20
- import { pathExists } from "../core/fs/fs-utils.js";
21
- import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
21
+ import { resolvePmRoot } from "../core/store/paths.js";
22
22
  import { runSearch } from "./query/search.js";
23
23
  export { EVAL_QUERY_SET_CONTRACT, EVAL_QUERY_SET_EXAMPLE, EVAL_QUERY_SET_SCHEMA_ID, parseEvalQuerySet, } from "../core/search/eval.js";
24
24
  /** Relative location (under the pm root) of the default golden-query set. A git-tracked, human-curated file so relevance ground truth lives alongside the tracker it evaluates. */
@@ -170,9 +170,7 @@ const buildEvalResult = (k, reports, rawMetrics, failUnder) => {
170
170
  */
171
171
  export const runEval = async (options, global) => {
172
172
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
173
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
174
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
175
- }
173
+ await assertInitializedTracker(pmRoot);
176
174
  const k = parseEvalK(options.k);
177
175
  const defaultMode = parseEvalMode(options.mode);
178
176
  const failUnder = parseFailUnder(options.failUnder);
@@ -190,4 +188,4 @@ export const runEval = async (options, global) => {
190
188
  return buildEvalResult(k, reports, rawMetrics, failUnder);
191
189
  };
192
190
  //# sourceMappingURL=eval.js.map
193
- //# debugId=b90a064c-f423-5bf7-9fbf-1fb273c7b5af
191
+ //# debugId=9cc9405b-d2b8-59aa-893f-54892595788a
package/dist/sdk/files.js CHANGED
@@ -4,10 +4,10 @@
4
4
  * Implements the pm files 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]="515cd35c-8e0e-51d4-8ad9-1cea5be8a572")}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]="ed504f2b-8b78-5fca-a4a7-7b0709a65533")}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
- import { pathExists } from "../core/fs/fs-utils.js";
11
11
  import { getActiveExtensionRegistrations, hasActiveOnReadHooks, } from "../core/extensions/index.js";
12
12
  import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
13
13
  import { EXIT_CODE } from "../core/shared/constants.js";
@@ -15,7 +15,7 @@ import { PmCliError } from "../core/shared/errors.js";
15
15
  import { locateItem, listAllItemMetadata, mutateItem, readLocatedItem, } from "../core/store/item-store.js";
16
16
  import { readItemMetadataDerivedIndexState } from "../core/store/item-metadata-cache.js";
17
17
  import { queryLinkedFileMetadataIndex } from "../core/store/item-metadata-query-index.js";
18
- import { getSettingsPath, resolvePmRoot, resolveWorkspaceRoot, } from "../core/store/paths.js";
18
+ import { resolvePmRoot, resolveWorkspaceRoot, } from "../core/store/paths.js";
19
19
  import { readSettings } from "../core/store/settings.js";
20
20
  import { resolveAuthor } from "../core/shared/author.js";
21
21
  import { isPathWithinDirectory } from "../core/fs/path-utils.js";
@@ -371,9 +371,7 @@ async function queryFilesLookupSource(params) {
371
371
  export async function runFilesLookup(options, global) {
372
372
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
373
373
  const workspaceRoot = resolveWorkspaceRoot(pmRoot);
374
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
375
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
376
- }
374
+ await assertInitializedTracker(pmRoot);
377
375
  const paths = await normalizeFilesLookupPaths(options.paths, workspaceRoot);
378
376
  if (options.lineRange && paths.length !== 1) {
379
377
  throw new PmCliError("Files lookup line attribution requires exactly one source path.", EXIT_CODE.USAGE);
@@ -428,9 +426,7 @@ export async function runFilesLookup(options, global) {
428
426
  export async function runFilesDiscover(id, options, global) {
429
427
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
430
428
  const workspaceRoot = resolveWorkspaceRoot(pmRoot);
431
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
432
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
433
- }
429
+ await assertInitializedTracker(pmRoot);
434
430
  const settings = await readSettings(pmRoot);
435
431
  const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
436
432
  const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
@@ -537,4 +533,4 @@ export async function runFilesDiscover(id, options, global) {
537
533
  };
538
534
  }
539
535
  //# sourceMappingURL=files.js.map
540
- //# debugId=515cd35c-8e0e-51d4-8ad9-1cea5be8a572
536
+ //# debugId=ed504f2b-8b78-5fca-a4a7-7b0709a65533
@@ -1,6 +1,6 @@
1
1
  /** Generated partition 1 of the exhaustive error-code catalog. */
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="145e12fa-839c-59da-840b-e2a0f3f13065")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4959a1ef-29e6-50ae-aaf8-fe078001bff6")}catch(e){}}();
4
4
  export const PM_ERROR_CODE_CATALOG_PART_1 = [
5
5
  {
6
6
  code: "acceptance_criteria_mutation_conflict",
@@ -494,6 +494,30 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
494
494
  canonical_code: "dependency_edge_not_allowed",
495
495
  aliases: [],
496
496
  },
497
+ {
498
+ code: "dependency_flag_value_invalid",
499
+ meaning: "Dependency flag value invalid condition.",
500
+ stability: "provisional",
501
+ exit_code: 2,
502
+ class: "usage",
503
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
504
+ sources: ["sdk/dependency-flag-validation.ts"],
505
+ emitting_commands: ["*"],
506
+ canonical_code: "dependency_flag_value_invalid",
507
+ aliases: [],
508
+ },
509
+ {
510
+ code: "dependency_remove_no_match",
511
+ meaning: "Dependency remove no match condition.",
512
+ stability: "provisional",
513
+ exit_code: 3,
514
+ class: "not_found",
515
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
516
+ sources: ["sdk/lifecycle/update.ts"],
517
+ emitting_commands: ["update"],
518
+ canonical_code: "dependency_remove_no_match",
519
+ aliases: [],
520
+ },
497
521
  {
498
522
  code: "dependency_target_not_found",
499
523
  meaning: "Dependency target not found condition.",
@@ -681,7 +705,7 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
681
705
  exit_code: 1,
682
706
  class: "generic_failure",
683
707
  recovery: "Inspect the structured error guidance and retry the suggested command.",
684
- sources: ["sdk/agent/refusal-closure.ts"],
708
+ sources: ["sdk/agent/refusal-closure.ts", "sdk/agent/tracker-preflight-contracts.ts"],
685
709
  emitting_commands: ["*"],
686
710
  canonical_code: "error_code_mismatch",
687
711
  aliases: [],
@@ -710,6 +734,18 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
710
734
  canonical_code: "event_index_unavailable",
711
735
  aliases: [],
712
736
  },
737
+ {
738
+ code: "exit_code_mismatch",
739
+ meaning: "Exit code mismatch condition.",
740
+ stability: "provisional",
741
+ exit_code: 1,
742
+ class: "generic_failure",
743
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
744
+ sources: ["sdk/agent/tracker-preflight-contracts.ts"],
745
+ emitting_commands: ["*"],
746
+ canonical_code: "exit_code_mismatch",
747
+ aliases: [],
748
+ },
713
749
  {
714
750
  code: "extension_command_activation_failed",
715
751
  meaning: "Extension command activation failed condition.",
@@ -1910,4 +1946,4 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
1910
1946
  },
1911
1947
  ];
1912
1948
  //# sourceMappingURL=generated-error-code-catalog-part-1.js.map
1913
- //# debugId=145e12fa-839c-59da-840b-e2a0f3f13065
1949
+ //# debugId=4959a1ef-29e6-50ae-aaf8-fe078001bff6
@@ -1,6 +1,6 @@
1
1
  /** Generated partition 2 of the exhaustive error-code catalog. */
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8555c35d-af49-53cd-b782-e9d2fbf65d2f")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d7f4f4f0-d044-5216-b2c4-d76b4d8854a9")}catch(e){}}();
4
4
  export const PM_ERROR_CODE_CATALOG_PART_2 = [
5
5
  {
6
6
  code: "missing_destination",
@@ -26,6 +26,18 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
26
26
  canonical_code: "missing_directory",
27
27
  aliases: [],
28
28
  },
29
+ {
30
+ code: "missing_init_recovery",
31
+ meaning: "Missing init recovery condition.",
32
+ stability: "provisional",
33
+ exit_code: 1,
34
+ class: "generic_failure",
35
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
36
+ sources: ["sdk/agent/tracker-preflight-contracts.ts"],
37
+ emitting_commands: ["*"],
38
+ canonical_code: "missing_init_recovery",
39
+ aliases: [],
40
+ },
29
41
  {
30
42
  code: "missing_lifecycle_target",
31
43
  meaning: "Missing lifecycle target condition.",
@@ -74,6 +86,18 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
74
86
  canonical_code: "missing_parameter_alias",
75
87
  aliases: [],
76
88
  },
89
+ {
90
+ code: "missing_probe",
91
+ meaning: "Missing probe condition.",
92
+ stability: "provisional",
93
+ exit_code: 1,
94
+ class: "generic_failure",
95
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
96
+ sources: ["sdk/agent/tracker-preflight-contracts.ts"],
97
+ emitting_commands: ["*"],
98
+ canonical_code: "missing_probe",
99
+ aliases: [],
100
+ },
77
101
  {
78
102
  code: "missing_required_argument",
79
103
  meaning: "Missing required argument condition.",
@@ -483,6 +507,18 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
483
507
  canonical_code: "read_output_cursor_stale",
484
508
  aliases: [],
485
509
  },
510
+ {
511
+ code: "recovery_kind_mismatch",
512
+ meaning: "Recovery kind mismatch condition.",
513
+ stability: "provisional",
514
+ exit_code: 1,
515
+ class: "generic_failure",
516
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
517
+ sources: ["sdk/agent/tracker-preflight-contracts.ts"],
518
+ emitting_commands: ["*"],
519
+ canonical_code: "recovery_kind_mismatch",
520
+ aliases: [],
521
+ },
486
522
  {
487
523
  code: "redundant_edge",
488
524
  meaning: "Redundant edge condition.",
@@ -586,7 +622,7 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
586
622
  exit_code: 1,
587
623
  class: "generic_failure",
588
624
  recovery: "Inspect the structured error guidance and retry the suggested command.",
589
- sources: ["sdk/agent/refusal-closure.ts"],
625
+ sources: ["sdk/agent/refusal-closure.ts", "sdk/agent/tracker-preflight-contracts.ts"],
590
626
  emitting_commands: ["*"],
591
627
  canonical_code: "retry_failed",
592
628
  aliases: [],
@@ -970,12 +1006,16 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
970
1006
  exit_code: 3,
971
1007
  class: "not_found",
972
1008
  recovery: "Inspect the structured error guidance and retry the suggested command.",
973
- sources: ["cli/error-guidance.ts", "core/telemetry/observability.ts"],
1009
+ sources: [
1010
+ "cli/error-guidance.ts",
1011
+ "core/store/tracker-preflight.ts",
1012
+ "core/telemetry/observability.ts",
1013
+ ],
974
1014
  emitting_commands: ["*"],
975
1015
  canonical_code: "tracker_not_initialized",
976
1016
  aliases: [],
977
1017
  owned_states: [
978
- { state: "selected_tracker_root_is_a_regular_file", probe_id: "tracker-root-regular-file", entrypoints: ["list"], expected_exit_class: "not_found" },
1018
+ { state: "selected_tracker_root_exists_without_settings", probe_id: "tracker-root-settings-missing", entrypoints: ["list"], expected_exit_class: "not_found" },
979
1019
  ],
980
1020
  },
981
1021
  {
@@ -985,10 +1025,13 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
985
1025
  exit_code: 3,
986
1026
  class: "not_found",
987
1027
  recovery: "Inspect the structured error guidance and retry the suggested command.",
988
- sources: ["core/store/item-store.ts"],
1028
+ sources: ["core/store/tracker-preflight.ts"],
989
1029
  emitting_commands: ["*"],
990
1030
  canonical_code: "tracker_root_missing",
991
1031
  aliases: [],
1032
+ owned_states: [
1033
+ { state: "selected_tracker_root_does_not_exist", probe_id: "tracker-root-missing", entrypoints: ["list"], expected_exit_class: "not_found" },
1034
+ ],
992
1035
  },
993
1036
  {
994
1037
  code: "tracker_root_not_directory",
@@ -997,10 +1040,13 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
997
1040
  exit_code: 2,
998
1041
  class: "usage",
999
1042
  recovery: "Inspect the structured error guidance and retry the suggested command.",
1000
- sources: ["core/store/item-store.ts"],
1043
+ sources: ["core/store/tracker-preflight.ts"],
1001
1044
  emitting_commands: ["*"],
1002
1045
  canonical_code: "tracker_root_not_directory",
1003
1046
  aliases: [],
1047
+ owned_states: [
1048
+ { state: "selected_tracker_root_is_a_regular_file", probe_id: "tracker-root-not-directory", entrypoints: ["list"], expected_exit_class: "usage" },
1049
+ ],
1004
1050
  },
1005
1051
  {
1006
1052
  code: "tracker_root_unreadable",
@@ -1009,10 +1055,13 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
1009
1055
  exit_code: 1,
1010
1056
  class: "generic_failure",
1011
1057
  recovery: "Inspect the structured error guidance and retry the suggested command.",
1012
- sources: ["core/store/item-store.ts"],
1058
+ sources: ["core/store/tracker-preflight.ts"],
1013
1059
  emitting_commands: ["*"],
1014
1060
  canonical_code: "tracker_root_unreadable",
1015
1061
  aliases: [],
1062
+ owned_states: [
1063
+ { state: "selected_tracker_root_is_not_readable", probe_id: "tracker-root-unreadable", entrypoints: ["list"], expected_exit_class: "generic_failure" },
1064
+ ],
1016
1065
  },
1017
1066
  {
1018
1067
  code: "type_duplicate",
@@ -1219,6 +1268,18 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
1219
1268
  { state: "package_lifecycle_token_is_not_declared", probe_id: "package-unknown-action", entrypoints: ["package"], expected_exit_class: "usage" },
1220
1269
  ],
1221
1270
  },
1271
+ {
1272
+ code: "unsafe_init_recovery",
1273
+ meaning: "Unsafe init recovery condition.",
1274
+ stability: "provisional",
1275
+ exit_code: 1,
1276
+ class: "generic_failure",
1277
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
1278
+ sources: ["sdk/agent/tracker-preflight-contracts.ts"],
1279
+ emitting_commands: ["*"],
1280
+ canonical_code: "unsafe_init_recovery",
1281
+ aliases: [],
1282
+ },
1222
1283
  {
1223
1284
  code: "unsupported_update_option",
1224
1285
  meaning: "Unsupported update option condition.",
@@ -1917,4 +1978,4 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
1917
1978
  },
1918
1979
  ];
1919
1980
  //# sourceMappingURL=generated-error-code-catalog-part-2.js.map
1920
- //# debugId=8555c35d-af49-53cd-b782-e9d2fbf65d2f
1981
+ //# debugId=d7f4f4f0-d044-5216-b2c4-d76b4d8854a9
@@ -3,7 +3,7 @@ export declare const ASSURANCE_DOCUMENT_VERSION: 1;
3
3
  /** Supported lifecycle points that can evaluate a gate. */
4
4
  export declare const ASSURANCE_GATE_TRIGGERS: readonly ["pre-commit", "pre-push", "pre-merge", "ci", "pre-release", "post-release", "scheduled", "on-claim", "on-close"];
5
5
  /** Supported discriminants for built-in, delegated, and derived measurements. */
6
- export declare const ASSURANCE_MEASUREMENT_SOURCE_KINDS: readonly ["items", "dependency_kind", "graph", "validate", "health", "history", "links", "provider", "derived"];
6
+ export declare const ASSURANCE_MEASUREMENT_SOURCE_KINDS: readonly ["items", "dependency_kind", "prose_edge_gap", "graph", "validate", "health", "history", "links", "provider", "derived"];
7
7
  /** Gate lifecycle trigger. */
8
8
  export type AssuranceGateTrigger = (typeof ASSURANCE_GATE_TRIGGERS)[number];
9
9
  /** Assertion enforcement strength. */
@@ -20,6 +20,8 @@ export interface AssuranceDependencyRecord {
20
20
  id: string;
21
21
  /** Typed relationship kind. */
22
22
  kind: string;
23
+ /** Provenance channel that created or justified the edge. */
24
+ source_kind?: string;
23
25
  }
24
26
  /** Minimal item projection consumed by built-in measurement sources. */
25
27
  export interface AssuranceItemRecord {
@@ -80,6 +82,32 @@ export interface AssuranceDependencyKindSource {
80
82
  kind: "dependency_kind";
81
83
  /** Relationship kind to count. */
82
84
  dependency_kind: string;
85
+ /** Require an exact dependency provenance channel. */
86
+ source_kind?: string;
87
+ /** Require a dependency provenance channel with this prefix. */
88
+ source_kind_prefix?: string;
89
+ /** Require dependency provenance to be present or missing. */
90
+ source_kind_state?: "present" | "missing";
91
+ }
92
+ /** Evidence-backed exemption from prose-to-edge parity. */
93
+ export interface AssuranceProseEdgeExemption {
94
+ /** Holder whose prose contains the reference. */
95
+ holder_id: string;
96
+ /** Optional referenced item; omission exempts every matching pair on the holder. */
97
+ target_id?: string;
98
+ /** Optional literal that must occur in the same prose segment as the reference. */
99
+ text_contains?: string;
100
+ /** Reviewable explanation for why no typed edge should exist. */
101
+ reason: string;
102
+ }
103
+ /** Prose-reference parity source evaluated directly over authoritative item rows. */
104
+ export interface AssuranceProseEdgeGapSource {
105
+ /** Source discriminant. */
106
+ kind: "prose_edge_gap";
107
+ /** Explicit false-positive ledger; every row requires a reason. */
108
+ exemptions?: AssuranceProseEdgeExemption[];
109
+ /** Maximum diagnostic contributors retained after the counts are computed. */
110
+ sample_limit?: number;
83
111
  }
84
112
  /** Graph-analytics source delegated to a host adapter. */
85
113
  export interface AssuranceGraphSource {
@@ -170,7 +198,7 @@ export interface AssuranceDerivedSource {
170
198
  expression: AssuranceDerivedExpression;
171
199
  }
172
200
  /** Complete measurement source vocabulary. */
173
- export type AssuranceMeasurementSource = AssuranceItemsSource | AssuranceDependencyKindSource | AssuranceGraphSource | AssuranceValidateSource | AssuranceHealthSource | AssuranceHistorySource | AssuranceLinksSource | AssuranceProviderSource | AssuranceDerivedSource;
201
+ export type AssuranceMeasurementSource = AssuranceItemsSource | AssuranceDependencyKindSource | AssuranceProseEdgeGapSource | AssuranceGraphSource | AssuranceValidateSource | AssuranceHealthSource | AssuranceHistorySource | AssuranceLinksSource | AssuranceProviderSource | AssuranceDerivedSource;
174
202
  /** Persisted measurement declaration. */
175
203
  export interface AssuranceMeasurementDefinition {
176
204
  /** Stable registry id. */
@@ -302,6 +330,8 @@ export interface AssuranceExternalMeasurementResult {
302
330
  cost: number;
303
331
  /** Optional contributors that moved the value. */
304
332
  contributors?: string[];
333
+ /** Optional exact named sub-populations within the observed value. */
334
+ partitions?: Readonly<Record<string, number>>;
305
335
  }
306
336
  /** SDK evaluation inputs supplied by a host. */
307
337
  export interface AssuranceEvaluationContext {
@@ -348,6 +378,8 @@ export interface AssuranceMeasurementResult {
348
378
  cost: AssuranceMeasurementCost;
349
379
  /** Optional contributors. */
350
380
  contributors: string[];
381
+ /** Optional exact named sub-populations within the observed value. */
382
+ partitions?: Readonly<Record<string, number>>;
351
383
  }
352
384
  /** Structured assertion bound. */
353
385
  export interface AssuranceBound {
@@ -384,6 +416,8 @@ export interface AssuranceAssertionVerdict {
384
416
  cost: AssuranceMeasurementCost;
385
417
  /** Optional contributors. */
386
418
  contributors: string[];
419
+ /** Optional exact named sub-populations within the observed value. */
420
+ partitions?: Readonly<Record<string, number>>;
387
421
  }
388
422
  /** Complete gate verdict shared by every presentation and execution surface. */
389
423
  export interface AssuranceGateVerdict {