@unbrained/pm-cli 2026.8.8 → 2026.8.9

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 (144) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +19 -0
  3. package/dist/cli-bundle/bundle-manifest.json +154 -154
  4. package/dist/cli-bundle/chunks/chunk-2DTCZXSD.js +13 -0
  5. package/dist/cli-bundle/chunks/{chunk-ALDHXLPS.js → chunk-5JO6R4BS.js} +2 -2
  6. package/dist/cli-bundle/chunks/chunk-5KN4DZYV.js +194 -0
  7. package/dist/cli-bundle/chunks/chunk-EF43KODO.js +2 -0
  8. package/dist/cli-bundle/chunks/{chunk-NUXRRNAB.js → chunk-GMX5YOI3.js} +25 -25
  9. package/dist/cli-bundle/chunks/chunk-HUV2Z7IS.js +28 -0
  10. package/dist/cli-bundle/chunks/{chunk-SQ7QZFQ6.js → chunk-MHBVCUF2.js} +2 -2
  11. package/dist/cli-bundle/chunks/chunk-PYO5GZU6.js +5 -0
  12. package/dist/cli-bundle/chunks/{chunk-CBLA33YK.js → chunk-RJC7TPF4.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-2ZMXX3Q6.js → chunk-YC3UF2IO.js} +64 -64
  14. package/dist/cli-bundle/chunks/{register-list-query-WFZAMJHZ.js → register-list-query-BUE7PTCU.js} +2 -2
  15. package/dist/cli-bundle/chunks/{register-mutation-SOKKOTHQ.js → register-mutation-FC3XLVIK.js} +2 -2
  16. package/dist/cli-bundle/chunks/{register-operations-5XQETS6E.js → register-operations-YH2WAOXU.js} +2 -2
  17. package/dist/cli-bundle/chunks/{register-setup-2HL5ZHMK.js → register-setup-UQDTNTLJ.js} +2 -2
  18. package/dist/cli-bundle/focused-chunks/chunk-2VVP5RAA.js +153 -0
  19. package/dist/cli-bundle/focused-chunks/{chunk-IAS7PMLG.js → chunk-3GSFUDAI.js} +2 -2
  20. package/dist/cli-bundle/focused-chunks/chunk-3WVHTUAW.js +5 -0
  21. package/dist/cli-bundle/focused-chunks/chunk-4H6MVCK3.js +16 -0
  22. package/dist/cli-bundle/focused-chunks/{chunk-ZOLDTUU7.js → chunk-54TZJ4BM.js} +2 -2
  23. package/dist/cli-bundle/focused-chunks/{chunk-YKPE4PPY.js → chunk-5NK5TJ5D.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/{chunk-ANTMGYLI.js → chunk-6DO4YQWZ.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/chunk-73FIJONU.js +2 -0
  26. package/dist/cli-bundle/focused-chunks/{chunk-PL2EYDJK.js → chunk-C3GCHDSQ.js} +29 -27
  27. package/dist/cli-bundle/focused-chunks/{chunk-U646T7Z6.js → chunk-JGRSQZJT.js} +3 -3
  28. package/dist/cli-bundle/focused-chunks/{chunk-YSAHYUXX.js → chunk-KNEHLPBF.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-MRWVJ3ZG.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/chunk-NL57J7BZ.js +4 -0
  31. package/dist/cli-bundle/focused-chunks/{chunk-DMKOMTTY.js → chunk-P6BBIQRG.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/{chunk-GWI6YIKJ.js → chunk-PZAGVQNN.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-QDAO3XEK.js +14 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-SM2PJGP3.js → chunk-T4IGQCSY.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/chunk-U46GQJNY.js +2 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-TCSAPH33.js → chunk-VRXJSGIT.js} +6 -6
  37. package/dist/cli-bundle/focused-chunks/{chunk-FI6DWU2M.js → chunk-XC2ZW3CJ.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-ZG54B4XG.js +2 -0
  39. package/dist/cli-bundle/main.js +2 -2
  40. package/dist/cli-bundle/sdk-authoring.js +1 -1
  41. package/dist/cli-bundle/sdk-contracts.js +1 -1
  42. package/dist/cli-bundle/sdk-core.js +29 -29
  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 +1 -1
  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 +2 -2
  50. package/dist/core/diagnostics/remediation.js +12 -2
  51. package/dist/core/history/history.js +13 -4
  52. package/dist/core/item/actionability.d.ts +7 -1
  53. package/dist/core/item/actionability.js +71 -15
  54. package/dist/core/shared/author.d.ts +25 -0
  55. package/dist/core/shared/author.js +114 -9
  56. package/dist/sdk/actionability.d.ts +1 -1
  57. package/dist/sdk/actionability.js +3 -3
  58. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +8 -0
  59. package/dist/sdk/cli-contracts/runtime-contracts.js +17 -2
  60. package/dist/sdk/core-governance.d.ts +1 -1
  61. package/dist/sdk/core-governance.js +3 -3
  62. package/dist/sdk/dependencies.d.ts +2 -0
  63. package/dist/sdk/dependencies.js +7 -6
  64. package/dist/sdk/extension/bundled-catalog.js +19 -6
  65. package/dist/sdk/generated-error-code-catalog.js +38 -2
  66. package/dist/sdk/governance/health.js +29 -10
  67. package/dist/sdk/governance/provenance-health.d.ts +26 -0
  68. package/dist/sdk/governance/provenance-health.js +139 -0
  69. package/dist/sdk/governance/validate.js +13 -8
  70. package/dist/sdk/governance.d.ts +1 -0
  71. package/dist/sdk/governance.js +3 -2
  72. package/dist/sdk/graph/assembly.d.ts +4 -0
  73. package/dist/sdk/graph/assembly.js +22 -2
  74. package/dist/sdk/graph/run.d.ts +2 -0
  75. package/dist/sdk/graph/run.js +3 -2
  76. package/dist/sdk/lifecycle/close.js +13 -8
  77. package/dist/sdk/lifecycle/create.js +6 -12
  78. package/dist/sdk/lifecycle/plan.js +6 -3
  79. package/dist/sdk/lifecycle/update.js +6 -20
  80. package/dist/sdk/merge/driver.d.ts +2 -1
  81. package/dist/sdk/merge/driver.js +7 -4
  82. package/dist/sdk/merge/install.js +3 -3
  83. package/dist/sdk/merge/receipts.d.ts +14 -1
  84. package/dist/sdk/merge/receipts.js +36 -8
  85. package/dist/sdk/merge/reconcile.js +21 -4
  86. package/dist/sdk/merge/three-way.d.ts +6 -2
  87. package/dist/sdk/merge/three-way.js +24 -10
  88. package/dist/sdk/query/get.d.ts +11 -0
  89. package/dist/sdk/query/get.js +37 -3
  90. package/dist/sdk/read-output-contracts.d.ts +1 -1
  91. package/dist/sdk/read-output-contracts.js +23 -4
  92. package/dist/sdk/relationship-kinds/contract.d.ts +48 -0
  93. package/dist/sdk/relationship-kinds/contract.js +22 -0
  94. package/dist/sdk/relationships.d.ts +6 -41
  95. package/dist/sdk/relationships.js +12 -126
  96. package/dist/sdk/runtime-primitives.d.ts +1 -1
  97. package/dist/sdk/runtime-primitives.js +3 -3
  98. package/dist/sdk/similarity.d.ts +5 -0
  99. package/dist/sdk/similarity.js +40 -10
  100. package/dist/sdk/structured-mutations.js +5 -2
  101. package/dist/sdk/test/linked-command-detection.d.ts +2 -7
  102. package/dist/sdk/test/linked-command-detection.js +22 -9
  103. package/docs/AGENT_GUIDE.md +2 -1
  104. package/docs/COMMANDS.md +19 -1
  105. package/docs/DEPENDENCY_KIND_CONTRACT.md +29 -0
  106. package/docs/ITEM_READ_PROJECTIONS.md +26 -0
  107. package/docs/MERGE_SAFETY.md +10 -3
  108. package/docs/RELATIONSHIP_GRAPH.md +1 -1
  109. package/docs/SDK_AGENT_SESSION_CONTEXT.md +35 -2
  110. package/docs/SDK_CONTEXT_INTEGRITY.md +16 -1
  111. package/docs/SENTRY_CONTRACT_EPOCHS.md +20 -0
  112. package/docs/agent-task-token-baseline.json +2 -2
  113. package/marketplace.json +2 -2
  114. package/package.json +1 -1
  115. package/packages/pm-beads/package.json +1 -1
  116. package/packages/pm-calendar/package.json +1 -1
  117. package/packages/pm-command-kit/package.json +1 -1
  118. package/packages/pm-digital-twin/package.json +1 -1
  119. package/packages/pm-governance-audit/package.json +1 -1
  120. package/packages/pm-guide-shell/package.json +1 -1
  121. package/packages/pm-kanban/package.json +1 -1
  122. package/packages/pm-lifecycle-hooks/package.json +1 -1
  123. package/packages/pm-linked-test-adapters/package.json +1 -1
  124. package/packages/pm-search-advanced/package.json +1 -1
  125. package/packages/pm-templates/package.json +1 -1
  126. package/packages/pm-todos/package.json +1 -1
  127. package/packages/pm-vcs/package.json +1 -1
  128. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  129. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  130. package/sdk/public-surface.json +231 -27
  131. package/dist/cli-bundle/chunks/chunk-GKA54IJM.js +0 -5
  132. package/dist/cli-bundle/chunks/chunk-KRY7SRUO.js +0 -2
  133. package/dist/cli-bundle/chunks/chunk-MNJ4NNSY.js +0 -26
  134. package/dist/cli-bundle/chunks/chunk-OJPCFDDY.js +0 -13
  135. package/dist/cli-bundle/chunks/chunk-PFSD3DAN.js +0 -194
  136. package/dist/cli-bundle/focused-chunks/chunk-54EU2UVO.js +0 -2
  137. package/dist/cli-bundle/focused-chunks/chunk-5FLBTZJQ.js +0 -2
  138. package/dist/cli-bundle/focused-chunks/chunk-5GJ57YKN.js +0 -2
  139. package/dist/cli-bundle/focused-chunks/chunk-CMDS3KYT.js +0 -14
  140. package/dist/cli-bundle/focused-chunks/chunk-F5B3HBEZ.js +0 -5
  141. package/dist/cli-bundle/focused-chunks/chunk-FNOKJG6N.js +0 -16
  142. package/dist/cli-bundle/focused-chunks/chunk-FPDYXZBK.js +0 -4
  143. package/dist/cli-bundle/focused-chunks/chunk-HCUC62AB.js +0 -2
  144. package/dist/cli-bundle/focused-chunks/chunk-HGNKPSCB.js +0 -153
@@ -24,6 +24,17 @@ type GetItemProjection = Partial<ItemMetadata> & {
24
24
  notes_count?: number;
25
25
  /** Number of linked tests omitted by a token-bounded projection. */
26
26
  tests_count?: number;
27
+ /** Stable cardinalities for every collection mutation surface. */
28
+ collection_counts?: Readonly<{
29
+ comments: number;
30
+ notes: number;
31
+ learnings: number;
32
+ files: number;
33
+ tests: number;
34
+ docs: number;
35
+ reminders: number;
36
+ events: number;
37
+ }>;
27
38
  };
28
39
  /** Documents the get result payload exchanged by command, SDK, and package integrations. */
29
40
  export interface GetResult {
@@ -4,7 +4,7 @@
4
4
  * Implements the SDK-owned item query shared by every surface.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5536c6eb-5d51-5b67-879d-c1d0bfa5b692")}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]="f68f4074-51ba-5065-8cca-fe16acd48927")}catch(e){}}();
8
8
  import { pathExists, getActiveExtensionRegistrations, toItemRecord, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, ITEM_METADATA_KEY_ORDER, TYPE_TO_FOLDER, PmCliError, buildItemNotFoundError, listAllItemMetadataLight, locateItem, readLocatedItem, getHistoryPath, getSettingsPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
9
9
  import { readHistoryEntries } from "../history-read.js";
10
10
  import { recordContextUsageTouches } from "../context-usage.js";
@@ -21,6 +21,23 @@ const AUTOMATIC_CHILD_ROLLUP_TYPES = new Set([
21
21
  "plan",
22
22
  ]);
23
23
  const BUILTIN_ITEM_TYPES = new Set(Object.keys(TYPE_TO_FOLDER).map((type) => type.toLowerCase()));
24
+ function itemCollectionCounts(item) {
25
+ const lengths = Object.fromEntries([
26
+ "comments",
27
+ "notes",
28
+ "learnings",
29
+ "files",
30
+ "tests",
31
+ "docs",
32
+ "reminders",
33
+ "events",
34
+ ].map((key) => [
35
+ key,
36
+ item[key]
37
+ ?.length ?? 0,
38
+ ]));
39
+ return lengths;
40
+ }
24
41
  /** Decide whether a normal read should pay for a workspace-wide child projection. */
25
42
  function shouldAutoIncludeGetChildren(itemType) {
26
43
  const normalizedType = itemType.trim().toLowerCase();
@@ -65,14 +82,29 @@ function parseGetDepth(raw) {
65
82
  throw new PmCliError("Get --depth must be one of brief|standard|deep|full", EXIT_CODE.USAGE);
66
83
  }
67
84
  function projectItemForDepth(item, depth) {
85
+ const collectionCounts = itemCollectionCounts(item);
68
86
  if (depth === "deep") {
69
- return item;
87
+ return {
88
+ ...item,
89
+ comments: item.comments ?? [],
90
+ notes: item.notes ?? [],
91
+ learnings: item.learnings ?? [],
92
+ files: item.files ?? [],
93
+ tests: item.tests ?? [],
94
+ docs: item.docs ?? [],
95
+ reminders: item.reminders ?? [],
96
+ events: item.events ?? [],
97
+ notes_count: collectionCounts.notes,
98
+ tests_count: collectionCounts.tests,
99
+ collection_counts: collectionCounts,
100
+ };
70
101
  }
71
102
  const { comments: _comments, notes: _notes, learnings: _learnings, files: _files, tests: _tests, docs: _docs, reminders: _reminders, events: _events, ...projected } = item;
72
103
  return {
73
104
  ...projected,
74
105
  notes_count: item.notes?.length ?? 0,
75
106
  tests_count: item.tests?.length ?? 0,
107
+ collection_counts: collectionCounts,
76
108
  };
77
109
  }
78
110
  function parseGetFields(raw) {
@@ -100,6 +132,7 @@ function validateGetFields(fields, runtimeMetadataKeys) {
100
132
  ...runtimeMetadataKeys,
101
133
  "notes_count",
102
134
  "tests_count",
135
+ "collection_counts",
103
136
  ]);
104
137
  const allowedRootFields = new Set([
105
138
  "body",
@@ -151,6 +184,7 @@ function projectItemForFields(item, fields) {
151
184
  const omittedCounts = {
152
185
  notes_count: item.notes?.length ?? 0,
153
186
  tests_count: item.tests?.length ?? 0,
187
+ collection_counts: itemCollectionCounts(item),
154
188
  };
155
189
  const projected = {};
156
190
  for (const field of fields) {
@@ -387,4 +421,4 @@ export const _testOnlyGetCommand = {
387
421
  shouldAutoIncludeGetChildren,
388
422
  };
389
423
  //# sourceMappingURL=get.js.map
390
- //# debugId=5536c6eb-5d51-5b67-879d-c1d0bfa5b692
424
+ //# debugId=f68f4074-51ba-5065-8cca-fe16acd48927
@@ -4,7 +4,7 @@ export declare const PM_READ_OUTPUT_DIMENSIONS: readonly ["include", "amount", "
4
4
  /** One member of the universal read-output dimension set. */
5
5
  export type PmReadOutputDimension = (typeof PM_READ_OUTPUT_DIMENSIONS)[number];
6
6
  /** Built-in command roots whose primary operation is a read. */
7
- export declare const PM_READ_OUTPUT_SURFACES: readonly ["list", "context", "search", "get", "next", "health", "deps", "graph", "history", "activity", "validate", "events", "contracts", "comments", "notes", "files", "docs", "stats", "aggregate"];
7
+ export declare const PM_READ_OUTPUT_SURFACES: readonly ["list", "context", "search", "get", "next", "health", "deps", "graph", "history", "activity", "validate", "events", "contracts", "comments", "notes", "files", "docs", "stats", "aggregate", "package-manage"];
8
8
  /** Built-in read command supported by the universal output contract. */
9
9
  export type PmReadOutputSurface = (typeof PM_READ_OUTPUT_SURFACES)[number];
10
10
  /** Canonical output controls accepted by every built-in read action. */
@@ -5,7 +5,7 @@
5
5
  * surface without coupling package authors to command-specific option names.
6
6
  */
7
7
 
8
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="27f3a09b-9b90-5c85-9e41-21cfed5dc0ce")}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]="819ac44d-0add-581c-90e8-ac6e8247b04b")}catch(e){}}();
9
9
  import { EXIT_CODE } from "../core/shared/constants.js";
10
10
  import { PmCliError } from "../core/shared/errors.js";
11
11
  import { compactReadOutputToBudget, updateReadOutputReceiptEstimate, } from "./read-output-budget.js";
@@ -39,6 +39,7 @@ export const PM_READ_OUTPUT_SURFACES = [
39
39
  "docs",
40
40
  "stats",
41
41
  "aggregate",
42
+ "package-manage",
42
43
  ];
43
44
  const READ_OUTPUT_PRECEDENCE = [
44
45
  "canonical",
@@ -126,6 +127,7 @@ const LEGACY_FLAGS_BY_COMMAND = {
126
127
  docs: {},
127
128
  stats: {},
128
129
  aggregate: {},
130
+ "package-manage": {},
129
131
  };
130
132
  const VALUE_BEARING_INCLUDE_ALIASES = new Set(["--fields", "--section"]);
131
133
  const BEHAVIOR_PRESERVING_MIGRATION_HINTS = Object.freeze({
@@ -186,7 +188,14 @@ const SURFACE_CONTRACT_BY_COMMAND = new Map(PM_READ_OUTPUT_SURFACE_CONTRACTS.map
186
188
  ]));
187
189
  /** Resolve a command or list/context alias to its canonical read-output surface. */
188
190
  export function resolveReadOutputSurface(command) {
189
- const root = command.trim().toLowerCase().split(/\s+/u)[0];
191
+ const normalizedCommand = command
192
+ .trim()
193
+ .toLowerCase()
194
+ .replaceAll(/\s+/gu, " ");
195
+ const root = normalizedCommand === "package manage" ||
196
+ normalizedCommand === "package-manage"
197
+ ? "package-manage"
198
+ : normalizedCommand.split(" ")[0];
190
199
  const normalized = root.startsWith("list-")
191
200
  ? "list"
192
201
  : root === "ctx"
@@ -423,13 +432,23 @@ const ENVELOPE_KEYS = new Set([
423
432
  "total",
424
433
  "truncated",
425
434
  ]);
435
+ const GET_STABLE_DERIVED_ITEM_SELECTORS = [
436
+ "collection_counts",
437
+ "notes_count",
438
+ "tests_count",
439
+ ];
426
440
  function projectRecordFields(value, selectors) {
427
441
  const selected = new Set(selectors.map((selector) => selector.split(".")[0]));
428
442
  return Object.fromEntries(Object.entries(value).filter(([key]) => selected.has(key)));
429
443
  }
430
444
  function getProjectionVocabulary(result) {
431
445
  const item = isRecord(result.item) ? result.item : {};
432
- const itemFields = Object.keys(item).sort((left, right) => left.localeCompare(right));
446
+ const itemFields = [
447
+ ...new Set([
448
+ ...Object.keys(item),
449
+ ...GET_STABLE_DERIVED_ITEM_SELECTORS.filter((key) => Object.hasOwn(item, key)),
450
+ ]),
451
+ ].sort((left, right) => left.localeCompare(right));
433
452
  const sections = Object.keys(result)
434
453
  .filter((key) => key !== "item" && key !== "read_output" && !ENVELOPE_KEYS.has(key))
435
454
  .sort((left, right) => left.localeCompare(right));
@@ -676,4 +695,4 @@ export function resolveReadOutputEncoding(command, options) {
676
695
  : undefined;
677
696
  }
678
697
  //# sourceMappingURL=read-output-contracts.js.map
679
- //# debugId=27f3a09b-9b90-5c85-9e41-21cfed5dc0ce
698
+ //# debugId=819ac44d-0add-581c-90e8-ac6e8247b04b
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @module sdk/relationship-kinds/contract
3
+ *
4
+ * Dependency-free relationship ontology shared by contracts and graph runtime.
5
+ */
6
+ /** Direction exposed by a relationship kind. */
7
+ export type RelationshipDirection = "directed" | "undirected";
8
+ /** Cardinality constraint applied independently to outgoing and incoming edges. */
9
+ export type RelationshipCardinality = "one" | "many";
10
+ /** Lifecycle policy for a relationship kind. */
11
+ export type RelationshipLifecycle = "persistent" | "supersedable" | "ephemeral";
12
+ /** Direction in which an ordering edge contributes to execution precedence. */
13
+ export type RelationshipPrecedence = "source_before_target" | "target_before_source";
14
+ /** Endpoint that represents the structural parent for hierarchy kinds. */
15
+ export type RelationshipHierarchyDirection = "source_parent" | "target_parent";
16
+ /** Versioned semantic definition for a built-in or application-defined edge kind. */
17
+ export interface RelationshipKindDefinition {
18
+ /** Canonical, case-insensitive kind identifier. */
19
+ kind: string;
20
+ /** Whether traversing source to target has distinct meaning from the reverse. */
21
+ direction: RelationshipDirection;
22
+ /** Optional canonical kind used when traversing a directed edge in reverse. */
23
+ inverse?: string;
24
+ /** Whether the kind participates in execution-order cycle checks. */
25
+ ordering: boolean;
26
+ /** Execution direction for ordering kinds; defaults to source before target. */
27
+ precedence?: RelationshipPrecedence;
28
+ /** Whether the kind contributes to structural ancestry. */
29
+ hierarchy: boolean;
30
+ /** Endpoint that represents the parent; defaults to source for custom kinds. */
31
+ hierarchyDirection?: RelationshipHierarchyDirection;
32
+ /** Maximum logical outgoing edges of this kind from one node. */
33
+ outgoing: RelationshipCardinality;
34
+ /** Maximum logical incoming edges of this kind to one node. */
35
+ incoming: RelationshipCardinality;
36
+ /** Edge replacement and retention behavior. */
37
+ lifecycle: RelationshipLifecycle;
38
+ /** JSON Schema for optional application-owned payloads. */
39
+ payloadSchema?: Readonly<Record<string, unknown>>;
40
+ /** Legacy spellings normalized to this definition. */
41
+ aliases?: readonly string[];
42
+ /** Compatibility version of this semantic contract. */
43
+ compatibilityVersion: number;
44
+ /** Whether source and target may be the same node. */
45
+ allowSelf: boolean;
46
+ }
47
+ /** Stable built-in relationship ontology without graph or storage dependencies. */
48
+ export declare const BUILTIN_RELATIONSHIP_KINDS: readonly RelationshipKindDefinition[];
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module sdk/relationship-kinds/contract
3
+ *
4
+ * Dependency-free relationship ontology shared by contracts and graph runtime.
5
+ */
6
+ /** Stable built-in relationship ontology without graph or storage dependencies. */
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]="49a83ce3-4c55-5b3f-b061-bc21b716d498")}catch(e){}}();
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: "verifies", direction: "directed", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "persistent", compatibilityVersion: 1, allowSelf: false },
19
+ { kind: "supersedes", direction: "directed", ordering: false, hierarchy: false, outgoing: "many", incoming: "many", lifecycle: "supersedable", compatibilityVersion: 1, allowSelf: false },
20
+ ];
21
+ //# sourceMappingURL=contract.js.map
22
+ //# debugId=49a83ce3-4c55-5b3f-b061-bc21b716d498
@@ -5,47 +5,8 @@
5
5
  * kernel shared by the SDK, CLI, MCP adapters, extensions, and non-PM apps.
6
6
  */
7
7
  import type { Dependency, ItemMetadata } from "../types/index.js";
8
- /** Direction exposed by a relationship kind. */
9
- export type RelationshipDirection = "directed" | "undirected";
10
- /** Cardinality constraint applied independently to outgoing and incoming edges. */
11
- export type RelationshipCardinality = "one" | "many";
12
- /** Lifecycle policy for a relationship kind. */
13
- export type RelationshipLifecycle = "persistent" | "supersedable" | "ephemeral";
14
- /** Direction in which an ordering edge contributes to execution precedence. */
15
- export type RelationshipPrecedence = "source_before_target" | "target_before_source";
16
- /** Endpoint that represents the structural parent for hierarchy kinds. */
17
- export type RelationshipHierarchyDirection = "source_parent" | "target_parent";
18
- /** Versioned semantic definition for a built-in or application-defined edge kind. */
19
- export interface RelationshipKindDefinition {
20
- /** Canonical, case-insensitive kind identifier. */
21
- kind: string;
22
- /** Whether traversing source to target has distinct meaning from the reverse. */
23
- direction: RelationshipDirection;
24
- /** Optional canonical kind used when traversing a directed edge in reverse. */
25
- inverse?: string;
26
- /** Whether the kind participates in execution-order cycle checks. */
27
- ordering: boolean;
28
- /** Execution direction for ordering kinds; defaults to source before target. */
29
- precedence?: RelationshipPrecedence;
30
- /** Whether the kind contributes to structural ancestry. */
31
- hierarchy: boolean;
32
- /** Endpoint that represents the parent; defaults to source for custom kinds. */
33
- hierarchyDirection?: RelationshipHierarchyDirection;
34
- /** Maximum logical outgoing edges of this kind from one node. */
35
- outgoing: RelationshipCardinality;
36
- /** Maximum logical incoming edges of this kind to one node. */
37
- incoming: RelationshipCardinality;
38
- /** Edge replacement and retention behavior. */
39
- lifecycle: RelationshipLifecycle;
40
- /** JSON Schema for optional application-owned payloads. */
41
- payloadSchema?: Readonly<Record<string, unknown>>;
42
- /** Legacy spellings normalized to this definition. */
43
- aliases?: readonly string[];
44
- /** Compatibility version of this semantic contract. */
45
- compatibilityVersion: number;
46
- /** Whether source and target may be the same node. */
47
- allowSelf: boolean;
48
- }
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, } from "./relationship-kinds/contract.js";
49
10
  /** One normalized relationship edge indexed by the graph kernel. */
50
11
  export interface RelationshipEdge {
51
12
  /** Source node identifier. */
@@ -124,6 +85,10 @@ export declare class RelationshipKindRegistry {
124
85
  }
125
86
  /** Create a registry containing the built-in relationship ontology. */
126
87
  export declare function createRelationshipKindRegistry(): RelationshipKindRegistry;
88
+ /** Resolve an accepted built-in relationship spelling to its canonical stored kind. */
89
+ export declare function canonicalizeRelationshipKind(kind: string): string;
90
+ /** Resolve an accepted built-in relationship spelling, returning undefined for unknown kinds. */
91
+ export declare function resolveCanonicalRelationshipKind(kind: unknown): string | undefined;
127
92
  /** Report whether a kind participates in execution-order cycle detection. */
128
93
  export declare function isOrderingRelationshipKind(kind: string, registry?: RelationshipKindRegistry): boolean;
129
94
  /**
@@ -1,129 +1,7 @@
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]="a89f0df7-e280-5ce4-8515-1f107a4aeaab")}catch(e){}}();
3
- const BUILTIN_RELATIONSHIP_KINDS = [
4
- {
5
- kind: "blocked_by",
6
- direction: "directed",
7
- inverse: "blocks",
8
- ordering: true,
9
- precedence: "target_before_source",
10
- hierarchy: false,
11
- outgoing: "many",
12
- incoming: "many",
13
- lifecycle: "persistent",
14
- aliases: ["depends_on"],
15
- compatibilityVersion: 1,
16
- allowSelf: false,
17
- },
18
- {
19
- kind: "blocks",
20
- direction: "directed",
21
- inverse: "blocked_by",
22
- ordering: true,
23
- precedence: "source_before_target",
24
- hierarchy: false,
25
- outgoing: "many",
26
- incoming: "many",
27
- lifecycle: "persistent",
28
- compatibilityVersion: 1,
29
- allowSelf: false,
30
- },
31
- {
32
- kind: "parent",
33
- direction: "directed",
34
- inverse: "child",
35
- ordering: false,
36
- hierarchy: true,
37
- hierarchyDirection: "target_parent",
38
- outgoing: "one",
39
- incoming: "many",
40
- lifecycle: "supersedable",
41
- aliases: ["child_of", "epic"],
42
- compatibilityVersion: 1,
43
- allowSelf: false,
44
- },
45
- {
46
- kind: "child",
47
- direction: "directed",
48
- inverse: "parent",
49
- ordering: false,
50
- hierarchy: true,
51
- hierarchyDirection: "source_parent",
52
- outgoing: "many",
53
- incoming: "one",
54
- lifecycle: "supersedable",
55
- aliases: ["parent_child", "task"],
56
- compatibilityVersion: 1,
57
- allowSelf: false,
58
- },
59
- {
60
- kind: "related",
61
- direction: "undirected",
62
- ordering: false,
63
- hierarchy: false,
64
- outgoing: "many",
65
- incoming: "many",
66
- lifecycle: "persistent",
67
- aliases: ["related_to"],
68
- compatibilityVersion: 1,
69
- allowSelf: false,
70
- },
71
- {
72
- kind: "discovered_from",
73
- direction: "directed",
74
- ordering: false,
75
- hierarchy: false,
76
- outgoing: "many",
77
- incoming: "many",
78
- lifecycle: "persistent",
79
- compatibilityVersion: 1,
80
- allowSelf: false,
81
- },
82
- {
83
- kind: "incident_from",
84
- direction: "directed",
85
- ordering: false,
86
- hierarchy: false,
87
- outgoing: "many",
88
- incoming: "many",
89
- lifecycle: "persistent",
90
- compatibilityVersion: 1,
91
- allowSelf: false,
92
- },
93
- {
94
- kind: "implements",
95
- direction: "directed",
96
- ordering: false,
97
- hierarchy: false,
98
- outgoing: "many",
99
- incoming: "many",
100
- lifecycle: "persistent",
101
- compatibilityVersion: 1,
102
- allowSelf: false,
103
- },
104
- {
105
- kind: "verifies",
106
- direction: "directed",
107
- ordering: false,
108
- hierarchy: false,
109
- outgoing: "many",
110
- incoming: "many",
111
- lifecycle: "persistent",
112
- compatibilityVersion: 1,
113
- allowSelf: false,
114
- },
115
- {
116
- kind: "supersedes",
117
- direction: "directed",
118
- ordering: false,
119
- hierarchy: false,
120
- outgoing: "many",
121
- incoming: "many",
122
- lifecycle: "supersedable",
123
- compatibilityVersion: 1,
124
- allowSelf: false,
125
- },
126
- ];
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]="05e01593-acb6-5e28-a5ac-8c8f74359c62")}catch(e){}}();
3
+ import { BUILTIN_RELATIONSHIP_KINDS, } from "./relationship-kinds/contract.js";
4
+ export { BUILTIN_RELATIONSHIP_KINDS, } from "./relationship-kinds/contract.js";
127
5
  function normalizeKind(kind) {
128
6
  return kind.trim().toLowerCase().replaceAll("-", "_");
129
7
  }
@@ -278,6 +156,14 @@ export function createRelationshipKindRegistry() {
278
156
  return new RelationshipKindRegistry();
279
157
  }
280
158
  const defaultRegistry = createRelationshipKindRegistry();
159
+ /** Resolve an accepted built-in relationship spelling to its canonical stored kind. */
160
+ export function canonicalizeRelationshipKind(kind) {
161
+ return defaultRegistry.require(kind).kind;
162
+ }
163
+ /** Resolve an accepted built-in relationship spelling, returning undefined for unknown kinds. */
164
+ export function resolveCanonicalRelationshipKind(kind) {
165
+ return defaultRegistry.resolve(kind)?.kind;
166
+ }
281
167
  /** Report whether a kind participates in execution-order cycle detection. */
282
168
  export function isOrderingRelationshipKind(kind, registry = defaultRegistry) {
283
169
  return registry.resolve(kind)?.ordering === true;
@@ -657,4 +543,4 @@ export function dependencyToRelationship(source, dependency, registry = defaultR
657
543
  };
658
544
  }
659
545
  //# sourceMappingURL=relationships.js.map
660
- //# debugId=a89f0df7-e280-5ce4-8515-1f107a4aeaab
546
+ //# debugId=05e01593-acb6-5e28-a5ac-8c8f74359c62
@@ -51,7 +51,7 @@ export { type VectorizationEmbeddingIdentity, type VectorizationEmbeddingMetadat
51
51
  export { sentryCaptureCliError, sentryFinishCommandSpan, sentryFlush, sentryLogCliUsageError, sentrySetCommandContext, sentryStartCommandSpan, } from "../core/sentry/helpers.js";
52
52
  export { ensureSentryInit } from "../core/sentry/instrument.js";
53
53
  export { clearFocusedItem, getFocusedItem, setFocusedItem, } from "../core/session/session-state.js";
54
- export { readAuthorEnvironment, resolveAuthor, resolveClaimPrincipal, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, type AgentClientInfo, writeAuthorEnvironment, } from "../core/shared/author.js";
54
+ export { readAuthorEnvironment, diagnoseAgentIdentity, resolveAuthor, resolveClaimPrincipal, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, type AgentClientInfo, writeAuthorEnvironment, } from "../core/shared/author.js";
55
55
  export { agentSessionEnvironment, boundAgentEpisodeIdentity, runWithAgentSessionContext, resolveAgentSessionContextFromSignals, type AgentEpisodeIdentity, type AgentSessionContext, } from "../core/shared/agent-session-context.js";
56
56
  export { evaluateMutationGuard, isMutationAction, listMutationActions, scanMutationSecrets, type EvaluateMutationGuardOptions, type MutationGuardResult, type MutationGuardSettings, type SecretGuardFinding, type SecretGuardMode, } from "./mutation-guard.js";
57
57
  export { jaccardSimilarity, normalizeSimilarityText, scoreItemSimilarity, tokenizeSimilarityText, type ItemSimilarityScore, } from "./similarity-scoring.js";
@@ -7,7 +7,7 @@
7
7
  * prefer the typed operations exported by the main SDK barrel.
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]="febc7f96-1757-5c07-8d99-ed5fce742afa")}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]="17358714-bb54-58e5-bba0-61bfd1323ec2")}catch(e){}}();
11
11
  export { createCheckpointId, loadMutationCheckpoint, restoreCheckpointItems, writeMutationCheckpoint, } from "../core/checkpoint/mutation-checkpoint.js";
12
12
  export { flattenFlagListValue, resolveFlagValueKind, } from "../core/extensions/flag-value-types.js";
13
13
  export { activateExtensions, clearActiveExtensionHooks, consumeAfterCommandAffectedItems, createCoreCommandHookContext, createEmptyExtensionRegistrationRegistry, discoverExtensions, getActiveCommandResult, getActiveExtensionRegistrations, loadExtensions, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, resetActiveExtensionRuntimeState, runActiveCommandHandler, runActiveBeforeMutationHooks, runActiveOnIndexHooks, runActiveOnReadHooks, runActiveOnWriteHooks, runActiveParserOverride, runActivePreflightOverride, runActiveServiceOverride, runAfterCommandHooks, runBeforeCommandHooks, setActiveCommandContext, setActiveCommandResult, setActiveExtensionCommands, setActiveExtensionHooks, setActiveExtensionParsers, setActiveExtensionPreflight, setActiveExtensionRegistrations, setActiveExtensionRenderers, setActiveExtensionServices, } from "../core/extensions/index.js";
@@ -53,7 +53,7 @@ export { buildVectorizationEmbeddingIdentity, buildVectorizationEmbeddingMetadat
53
53
  export { sentryCaptureCliError, sentryFinishCommandSpan, sentryFlush, sentryLogCliUsageError, sentrySetCommandContext, sentryStartCommandSpan, } from "../core/sentry/helpers.js";
54
54
  export { ensureSentryInit } from "../core/sentry/instrument.js";
55
55
  export { clearFocusedItem, getFocusedItem, setFocusedItem, } from "../core/session/session-state.js";
56
- export { readAuthorEnvironment, resolveAuthor, resolveClaimPrincipal, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, writeAuthorEnvironment, } from "../core/shared/author.js";
56
+ export { readAuthorEnvironment, diagnoseAgentIdentity, resolveAuthor, resolveClaimPrincipal, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, writeAuthorEnvironment, } from "../core/shared/author.js";
57
57
  export { agentSessionEnvironment, boundAgentEpisodeIdentity, runWithAgentSessionContext, resolveAgentSessionContextFromSignals, } from "../core/shared/agent-session-context.js";
58
58
  export { evaluateMutationGuard, isMutationAction, listMutationActions, scanMutationSecrets, } from "./mutation-guard.js";
59
59
  export { jaccardSimilarity, normalizeSimilarityText, scoreItemSimilarity, tokenizeSimilarityText, } from "./similarity-scoring.js";
@@ -79,4 +79,4 @@ export { maybeRunFirstUseTelemetryPrompt } from "../core/telemetry/consent.js";
79
79
  export { deriveTelemetryCommandResolution, } from "../core/telemetry/observability.js";
80
80
  export { emitTelemetryErrorEvent, finishTelemetryCommand, startTelemetryCommand, } from "../core/telemetry/runtime.js";
81
81
  //# sourceMappingURL=runtime-primitives.js.map
82
- //# debugId=febc7f96-1757-5c07-8d99-ed5fce742afa
82
+ //# debugId=17358714-bb54-58e5-bba0-61bfd1323ec2
@@ -88,6 +88,11 @@ export interface DuplicateClustersResult {
88
88
  threshold: number;
89
89
  /** Retrieval path used for this whole-workspace sweep. */
90
90
  source: "metadata_scan";
91
+ /** Effective lifecycle filter; null means the complete all-status corpus. */
92
+ filters: {
93
+ statuses: string[] | null;
94
+ since: string | null;
95
+ };
91
96
  /** Work performed after the single metadata read. */
92
97
  cost: {
93
98
  /** Items retained after filters. */
@@ -5,10 +5,12 @@
5
5
  * governance and package-owned duplicate analysis.
6
6
  */
7
7
 
8
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="078456b8-ed61-5c47-afc7-7553833934e1")}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]="a2fad90a-3575-5f3e-8cbe-ac380ac45591")}catch(e){}}();
9
9
  import { EXIT_CODE } from "../core/shared/constants.js";
10
10
  import { PmCliError } from "../core/shared/errors.js";
11
11
  import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
12
+ import { normalizeStatusInput } from "../core/item/status.js";
13
+ import { resolveRuntimeStatusRegistry } from "../core/schema/runtime-schema.js";
12
14
  import { listAllItemMetadataLight } from "../core/store/item-store.js";
13
15
  import { resolvePmRoot } from "../core/store/paths.js";
14
16
  import { readSettings } from "../core/store/settings.js";
@@ -62,14 +64,38 @@ async function loadPreparedDuplicateItems(options, since) {
62
64
  const pmRoot = resolvePmRoot(options.cwd ?? process.cwd(), options.pmRoot);
63
65
  const settings = await readSettings(pmRoot);
64
66
  const typeRegistry = resolveItemTypeRegistry(settings);
65
- const allowedStatuses = options.statuses
66
- ? new Set(options.statuses.map((status) => status.trim()).filter(Boolean))
67
+ const requestedStatuses = options.statuses
68
+ ?.map((status) => status.trim().toLowerCase())
69
+ .filter(Boolean);
70
+ if (options.statuses !== undefined && requestedStatuses?.length === 0) {
71
+ throw new PmCliError("Duplicate cluster statuses must include at least one lifecycle status or all.", EXIT_CODE.USAGE);
72
+ }
73
+ const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
74
+ const normalizedStatuses = requestedStatuses?.map((status) => {
75
+ if (status === "all")
76
+ return status;
77
+ const normalized = normalizeStatusInput(status, statusRegistry);
78
+ if (!normalized) {
79
+ throw new PmCliError(`Unknown duplicate-cluster status "${status}". Allowed: all, ${statusRegistry.definitions.map((entry) => entry.id).join(", ")}.`, EXIT_CODE.USAGE);
80
+ }
81
+ return normalized;
82
+ });
83
+ const hasAll = normalizedStatuses?.includes("all") === true;
84
+ if (hasAll && normalizedStatuses?.some((status) => status !== "all")) {
85
+ throw new PmCliError('The "all" status cannot be combined with other statuses.', EXIT_CODE.USAGE);
86
+ }
87
+ const effectiveStatuses = hasAll ? undefined : normalizedStatuses;
88
+ const allowedStatuses = effectiveStatuses
89
+ ? new Set(effectiveStatuses)
67
90
  : undefined;
68
- return (await listAllItemMetadataLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema))
69
- .filter((item) => (!allowedStatuses || allowedStatuses.has(item.status)) &&
70
- (!since || new Date(item.created_at).getTime() >= since.getTime()))
71
- .sort((left, right) => left.id.localeCompare(right.id))
72
- .map((item) => ({ item, prepared: prepareSimilarityText(item.title) }));
91
+ return {
92
+ items: (await listAllItemMetadataLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema))
93
+ .filter((item) => (!allowedStatuses || allowedStatuses.has(item.status)) &&
94
+ (!since || new Date(item.created_at).getTime() >= since.getTime()))
95
+ .sort((left, right) => left.id.localeCompare(right.id))
96
+ .map((item) => ({ item, prepared: prepareSimilarityText(item.title) })),
97
+ statuses: effectiveStatuses,
98
+ };
73
99
  }
74
100
  function collectDuplicateCandidatePairs(items, maxPairEvaluations = MAX_BATCH_PAIR_EVALUATIONS) {
75
101
  const candidates = new Set();
@@ -233,7 +259,7 @@ export async function findDuplicateClusters(options = {}) {
233
259
  limit: undefined,
234
260
  });
235
261
  const { limit, since } = validateDuplicateClusterOptions(options);
236
- const items = await loadPreparedDuplicateItems(options, since);
262
+ const { items, statuses } = await loadPreparedDuplicateItems(options, since);
237
263
  const candidates = collectDuplicateCandidatePairs(items);
238
264
  const union = createDuplicateUnionFind(items.length);
239
265
  const matches = scoreDuplicateCandidates(items, candidates, threshold, union);
@@ -243,6 +269,10 @@ export async function findDuplicateClusters(options = {}) {
243
269
  count: clusters.length,
244
270
  threshold,
245
271
  source: "metadata_scan",
272
+ filters: {
273
+ statuses: statuses ?? null,
274
+ since: options.since ?? null,
275
+ },
246
276
  cost: {
247
277
  item_count: items.length,
248
278
  candidate_pairs: candidates.size,
@@ -273,4 +303,4 @@ export async function evaluateSimilarityGovernance(candidate, options) {
273
303
  return { mode: options.mode, bypassed, result };
274
304
  }
275
305
  //# sourceMappingURL=similarity.js.map
276
- //# debugId=078456b8-ed61-5c47-afc7-7553833934e1
306
+ //# debugId=a2fad90a-3575-5f3e-8cbe-ac380ac45591
@@ -5,7 +5,7 @@
5
5
  * transaction contract and normalizes full item documents for CLI round trips.
6
6
  */
7
7
 
8
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="91be2c5d-c495-54bc-ac79-b4c645ad2c6e")}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]="07876c03-63a8-5c69-9c6c-c3446076a382")}catch(e){}}();
9
9
  import crypto from "node:crypto";
10
10
  import { normalizeItemId, normalizePrefix } from "../core/item/id.js";
11
11
  import { EXIT_CODE, ITEM_PROJECT_CONTEXT_KEYS, } from "../core/shared/constants.js";
@@ -43,6 +43,9 @@ const READ_ONLY_ITEM_KEYS = new Set([
43
43
  "format_version",
44
44
  "path",
45
45
  "author",
46
+ "collection_counts",
47
+ "notes_count",
48
+ "tests_count",
46
49
  ]);
47
50
  const UPDATE_READ_ONLY_ITEM_KEYS = new Set([
48
51
  ...READ_ONLY_ITEM_KEYS,
@@ -568,4 +571,4 @@ export function validateItemMutationRows(value) {
568
571
  return parseItemMutationBatch(JSON.stringify(value));
569
572
  }
570
573
  //# sourceMappingURL=structured-mutations.js.map
571
- //# debugId=91be2c5d-c495-54bc-ac79-b4c645ad2c6e
574
+ //# debugId=07876c03-63a8-5c69-9c6c-c3446076a382