@unbrained/pm-cli 2026.8.19 → 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 (229) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +41 -0
  3. package/dist/cli/error-guidance.d.ts +20 -0
  4. package/dist/cli/error-guidance.js +29 -30
  5. package/dist/cli/register-list-query.js +12 -10
  6. package/dist/cli/register-structured-mutation.d.ts +2 -0
  7. package/dist/cli/register-structured-mutation.js +29 -6
  8. package/dist/cli-bundle/bundle-manifest.json +156 -148
  9. package/dist/cli-bundle/chunks/chunk-2MA6ZQVZ.js +197 -0
  10. package/dist/cli-bundle/chunks/{chunk-4NRRH7AM.js → chunk-3AFAUHUE.js} +2 -2
  11. package/dist/cli-bundle/chunks/chunk-7VHZS727.js +5 -0
  12. package/dist/cli-bundle/chunks/chunk-BKYB45NQ.js +2092 -0
  13. package/dist/cli-bundle/chunks/{chunk-BHYMXLAE.js → chunk-BUNIEJNE.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-QXSH7BLM.js → chunk-JSLOFXGA.js} +3 -3
  15. package/dist/cli-bundle/chunks/chunk-LARJJ3RK.js +3 -0
  16. package/dist/cli-bundle/chunks/{chunk-TOXJM4WA.js → chunk-LOVTQ52Z.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-N3DSV4CH.js +77 -0
  18. package/dist/cli-bundle/chunks/chunk-OCLPLFAY.js +35 -0
  19. package/dist/cli-bundle/chunks/chunk-S4IRYKBU.js +13 -0
  20. package/dist/cli-bundle/chunks/register-list-query-F57EWDEF.js +11 -0
  21. package/dist/cli-bundle/chunks/{register-mutation-AUWVCW4M.js → register-mutation-7IY2D5KO.js} +20 -20
  22. package/dist/cli-bundle/chunks/{register-operations-PZQPHXW5.js → register-operations-FALL3YTU.js} +2 -2
  23. package/dist/cli-bundle/chunks/{register-setup-I4LUHGVW.js → register-setup-HXU7IZZD.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/chunk-2NIY5NKG.js +18 -0
  25. package/dist/cli-bundle/focused-chunks/{chunk-US7VEYZG.js → chunk-4ERLO7QD.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/chunk-7WZRLCYF.js +50 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-MCZXYZAF.js → chunk-CKKQSJNN.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/chunk-EEFKYMDR.js +16 -0
  29. package/dist/cli-bundle/focused-chunks/{chunk-ZBIQQYMI.js → chunk-F2A56DHV.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-ESISGDAY.js → chunk-F4YEW5I2.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-ODHQEECS.js → chunk-FH6DYED3.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-FJ22HNRP.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-FV5ACOK7.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-JEAVFOWM.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-EXBCLIBU.js → chunk-KDNG7TKQ.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/chunk-NJ63LOP6.js +155 -0
  37. package/dist/cli-bundle/focused-chunks/chunk-NXRTQ7HI.js +2 -0
  38. package/dist/cli-bundle/focused-chunks/{chunk-JDOMQ7VQ.js → chunk-TJ7EMJ46.js} +3 -3
  39. package/dist/cli-bundle/focused-chunks/chunk-UZE7XUZK.js +2 -0
  40. package/dist/cli-bundle/focused-chunks/{chunk-DKPLYW3L.js → chunk-YKBKIEAJ.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-VXDSU5MC.js → chunk-ZOSEELYJ.js} +2 -2
  42. package/dist/cli-bundle/main.js +12 -12
  43. package/dist/cli-bundle/sdk-authoring.js +1 -1
  44. package/dist/cli-bundle/sdk-contracts.js +2 -2
  45. package/dist/cli-bundle/sdk-core.js +41 -41
  46. package/dist/cli-bundle/sdk-governance.js +1 -1
  47. package/dist/cli-bundle/sdk-graph.js +1 -1
  48. package/dist/cli-bundle/sdk-merge.js +32 -32
  49. package/dist/cli-bundle/sdk-query.js +1 -1
  50. package/dist/cli-bundle/sdk-runtime.js +1 -1
  51. package/dist/cli-bundle/sdk-testing.js +1 -1
  52. package/dist/cli-bundle/sdk.js +5 -5
  53. package/dist/core/output/mutation-projection.js +26 -2
  54. package/dist/core/shared/constants.d.ts +1 -5
  55. package/dist/core/shared/constants.js +3 -81
  56. package/dist/core/shared/errors.d.ts +16 -0
  57. package/dist/core/shared/errors.js +2 -2
  58. package/dist/core/shared/item-metadata-contract.d.ts +14 -0
  59. package/dist/core/shared/item-metadata-contract.js +90 -0
  60. package/dist/core/store/item-store.d.ts +60 -0
  61. package/dist/core/store/item-store.js +26 -94
  62. package/dist/core/store/tracker-preflight.d.ts +7 -0
  63. package/dist/core/store/tracker-preflight.js +142 -0
  64. package/dist/sdk/agent/closed-domain-contracts.d.ts +25 -0
  65. package/dist/sdk/agent/closed-domain-contracts.js +140 -0
  66. package/dist/sdk/agent/refusal-closure.d.ts +13 -1
  67. package/dist/sdk/agent/refusal-closure.js +45 -3
  68. package/dist/sdk/agent/refusal-reachability.d.ts +26 -0
  69. package/dist/sdk/agent/refusal-reachability.js +26 -2
  70. package/dist/sdk/agent/tracker-preflight-contracts.d.ts +63 -0
  71. package/dist/sdk/agent/tracker-preflight-contracts.js +127 -0
  72. package/dist/sdk/agent-capability-contracts.js +6 -11
  73. package/dist/sdk/annotations.js +6 -7
  74. package/dist/sdk/cli-contracts/completeness.js +8 -2
  75. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -2
  76. package/dist/sdk/cli-contracts/enum-contracts.js +16 -6
  77. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  78. package/dist/sdk/cli-contracts/flag-contracts.js +11 -2
  79. package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +19 -2
  80. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +105 -5
  81. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +2 -2
  82. package/dist/sdk/cli-contracts/grammar-contracts.js +5 -2
  83. package/dist/sdk/cli-contracts/runtime-contracts.js +7 -3
  84. package/dist/sdk/cli-contracts/tool-schema.js +7 -2
  85. package/dist/sdk/cli-contracts.d.ts +2 -2
  86. package/dist/sdk/cli-contracts.js +4 -4
  87. package/dist/sdk/config.d.ts +5 -0
  88. package/dist/sdk/config.js +5 -5
  89. package/dist/sdk/context-intent-runtime.js +7 -4
  90. package/dist/sdk/contracts.d.ts +2 -0
  91. package/dist/sdk/contracts.js +4 -2
  92. package/dist/sdk/core.d.ts +1 -1
  93. package/dist/sdk/core.js +3 -3
  94. package/dist/sdk/dependencies.js +5 -7
  95. package/dist/sdk/dependency-flag-validation.d.ts +1 -1
  96. package/dist/sdk/dependency-flag-validation.js +10 -4
  97. package/dist/sdk/environment/tracker-preflight.d.ts +6 -0
  98. package/dist/sdk/environment/tracker-preflight.js +10 -0
  99. package/dist/sdk/eval.js +5 -7
  100. package/dist/sdk/files.js +6 -10
  101. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +110 -2
  102. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +179 -46
  103. package/dist/sdk/governance/assurance.d.ts +36 -2
  104. package/dist/sdk/governance/assurance.js +184 -10
  105. package/dist/sdk/governance/gc.js +5 -6
  106. package/dist/sdk/governance/health.js +5 -6
  107. package/dist/sdk/governance/reindex.js +5 -6
  108. package/dist/sdk/governance/validate.d.ts +1 -2
  109. package/dist/sdk/governance/validate.js +6 -12
  110. package/dist/sdk/graph/governance.d.ts +7 -5
  111. package/dist/sdk/graph/governance.js +32 -16
  112. package/dist/sdk/graph/run.js +5 -7
  113. package/dist/sdk/graph/traversal.js +14 -5
  114. package/dist/sdk/history-compact.js +6 -9
  115. package/dist/sdk/history-read.js +5 -7
  116. package/dist/sdk/history-redact.js +5 -6
  117. package/dist/sdk/history-repair.js +6 -9
  118. package/dist/sdk/improvement-ledger.js +7 -10
  119. package/dist/sdk/index.d.ts +7 -3
  120. package/dist/sdk/index.js +8 -4
  121. package/dist/sdk/init-agent-guidance.d.ts +5 -3
  122. package/dist/sdk/init-agent-guidance.js +69 -9
  123. package/dist/sdk/lifecycle/append.d.ts +0 -5
  124. package/dist/sdk/lifecycle/append.js +5 -6
  125. package/dist/sdk/lifecycle/claim.d.ts +0 -5
  126. package/dist/sdk/lifecycle/claim.js +6 -9
  127. package/dist/sdk/lifecycle/close-many.d.ts +0 -5
  128. package/dist/sdk/lifecycle/close-many.js +5 -6
  129. package/dist/sdk/lifecycle/close.d.ts +0 -5
  130. package/dist/sdk/lifecycle/close.js +5 -6
  131. package/dist/sdk/lifecycle/copy.d.ts +0 -5
  132. package/dist/sdk/lifecycle/copy.js +5 -6
  133. package/dist/sdk/lifecycle/create.d.ts +0 -5
  134. package/dist/sdk/lifecycle/create.js +5 -9
  135. package/dist/sdk/lifecycle/delete.js +5 -6
  136. package/dist/sdk/lifecycle/focus.d.ts +0 -5
  137. package/dist/sdk/lifecycle/focus.js +5 -6
  138. package/dist/sdk/lifecycle/mcp-actions.d.ts +18 -0
  139. package/dist/sdk/lifecycle/mcp-actions.js +52 -0
  140. package/dist/sdk/lifecycle/plan.d.ts +0 -5
  141. package/dist/sdk/lifecycle/plan.js +5 -6
  142. package/dist/sdk/lifecycle/reopen.d.ts +44 -0
  143. package/dist/sdk/lifecycle/reopen.js +69 -0
  144. package/dist/sdk/lifecycle/restore.js +5 -6
  145. package/dist/sdk/lifecycle/update-many.d.ts +0 -5
  146. package/dist/sdk/lifecycle/update-many.js +5 -6
  147. package/dist/sdk/lifecycle/update.d.ts +31 -5
  148. package/dist/sdk/lifecycle/update.js +140 -19
  149. package/dist/sdk/linked-artifacts.js +6 -7
  150. package/dist/sdk/merge/install.js +5 -6
  151. package/dist/sdk/mutation-events.js +5 -7
  152. package/dist/sdk/package-import-adapters.js +6 -8
  153. package/dist/sdk/profile.js +6 -7
  154. package/dist/sdk/query/activity.js +5 -6
  155. package/dist/sdk/query/calendar.js +5 -6
  156. package/dist/sdk/query/get.d.ts +1 -6
  157. package/dist/sdk/query/get.js +20 -55
  158. package/dist/sdk/query/history.d.ts +0 -5
  159. package/dist/sdk/query/history.js +5 -6
  160. package/dist/sdk/query/list.d.ts +7 -21
  161. package/dist/sdk/query/list.js +38 -54
  162. package/dist/sdk/query/projection-contracts.d.ts +33 -0
  163. package/dist/sdk/query/projection-contracts.js +185 -0
  164. package/dist/sdk/query/search-contracts.d.ts +2 -1
  165. package/dist/sdk/query/search-contracts.js +18 -87
  166. package/dist/sdk/query/search.d.ts +15 -0
  167. package/dist/sdk/query/search.js +34 -10
  168. package/dist/sdk/relationship-kinds/contract.d.ts +8 -0
  169. package/dist/sdk/relationship-kinds/contract.js +13 -13
  170. package/dist/sdk/relationships.d.ts +1 -1
  171. package/dist/sdk/relationships.js +20 -2
  172. package/dist/sdk/runtime-primitives.d.ts +1 -1
  173. package/dist/sdk/runtime-primitives.js +3 -3
  174. package/dist/sdk/runtime.d.ts +6 -0
  175. package/dist/sdk/runtime.js +18 -14
  176. package/dist/sdk/schema-migration.js +6 -7
  177. package/dist/sdk/schema.js +5 -6
  178. package/dist/sdk/similarity.d.ts +13 -0
  179. package/dist/sdk/similarity.js +32 -6
  180. package/dist/sdk/stats.js +5 -8
  181. package/dist/sdk/templates.js +5 -6
  182. package/dist/sdk/test/batch.js +5 -7
  183. package/dist/sdk/test/execution.js +4 -5
  184. package/dist/sdk/test/runs.js +5 -7
  185. package/docs/AGENT_UX_CONTRACTS.md +8 -1
  186. package/docs/COMMANDS.md +13 -1
  187. package/docs/DEPENDENCY_KIND_CONTRACT.md +12 -1
  188. package/docs/README.md +1 -0
  189. package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +151 -0
  190. package/docs/RELATIONSHIP_GRAPH.md +92 -10
  191. package/docs/SDK.md +10 -2
  192. package/docs/SDK_CONTEXT_INTEGRITY.md +45 -0
  193. package/docs/SDK_PRIMITIVE_INVENTORY.md +15 -1
  194. package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -1
  195. package/docs/performance/sdk-entrypoint-import-costs.md +14 -21
  196. package/marketplace.json +2 -2
  197. package/package.json +5 -5
  198. package/packages/pm-beads/package.json +1 -1
  199. package/packages/pm-calendar/package.json +1 -1
  200. package/packages/pm-command-kit/package.json +1 -1
  201. package/packages/pm-digital-twin/package.json +1 -1
  202. package/packages/pm-governance-audit/package.json +1 -1
  203. package/packages/pm-guide-shell/package.json +1 -1
  204. package/packages/pm-kanban/package.json +1 -1
  205. package/packages/pm-lifecycle-hooks/package.json +1 -1
  206. package/packages/pm-linked-test-adapters/package.json +1 -1
  207. package/packages/pm-search-advanced/package.json +1 -1
  208. package/packages/pm-templates/package.json +1 -1
  209. package/packages/pm-todos/package.json +1 -1
  210. package/packages/pm-vcs/package.json +1 -1
  211. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  212. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  213. package/sdk/public-surface.json +640 -44
  214. package/dist/cli-bundle/chunks/chunk-4THEB6PD.js +0 -13
  215. package/dist/cli-bundle/chunks/chunk-GWMXAQOD.js +0 -197
  216. package/dist/cli-bundle/chunks/chunk-HVFQTLYM.js +0 -35
  217. package/dist/cli-bundle/chunks/chunk-OI4XI562.js +0 -5
  218. package/dist/cli-bundle/chunks/chunk-OIOKV6NO.js +0 -2092
  219. package/dist/cli-bundle/chunks/chunk-SARFF5H5.js +0 -3
  220. package/dist/cli-bundle/chunks/chunk-YBMRWW4E.js +0 -77
  221. package/dist/cli-bundle/chunks/register-list-query-Y56KINDU.js +0 -11
  222. package/dist/cli-bundle/focused-chunks/chunk-34QBIYZI.js +0 -155
  223. package/dist/cli-bundle/focused-chunks/chunk-BJRYFVSH.js +0 -2
  224. package/dist/cli-bundle/focused-chunks/chunk-EF6ZS5GH.js +0 -50
  225. package/dist/cli-bundle/focused-chunks/chunk-L623ZPNK.js +0 -2
  226. package/dist/cli-bundle/focused-chunks/chunk-PRHY2IMX.js +0 -18
  227. package/dist/cli-bundle/focused-chunks/chunk-RZU5U6Q7.js +0 -2
  228. package/dist/cli-bundle/focused-chunks/chunk-YBMGXBFV.js +0 -16
  229. package/dist/cli-bundle/focused-chunks/chunk-YLVBJ6GF.js +0 -2
@@ -4,8 +4,9 @@
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]="1ba3eb17-c44c-5b62-8ae0-c2506fca9c62")}catch(e){}}();
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";
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]="ff82974e-a48d-5d18-893f-fb618e378795")}catch(e){}}();
8
+ import { assertInitializedTracker } from "../environment/tracker-preflight.js";
9
+ import { getActiveExtensionRegistrations, toItemRecord, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, TYPE_TO_FOLDER, PmCliError, buildItemNotFoundError, listAllItemMetadataLight, locateItem, readLocatedItem, getHistoryPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
9
10
  import { readHistoryEntries } from "../history-read.js";
10
11
  import { renderPmCommand } from "../command-line.js";
11
12
  import { recordContextUsageTouches } from "../context-usage.js";
@@ -15,7 +16,8 @@ import { getItemAt } from "../history-read.js";
15
16
  import { parseIntegerLimit } from "./parsers.js";
16
17
  import { runList } from "./list.js";
17
18
  import { registerOutputMaterialFieldGroups } from "../output-projection.js";
18
- const GET_DEPTH_VALUES = ["brief", "standard", "deep"];
19
+ import { GET_DEPTH_VALUES, listGetProjectionFields, } from "./projection-contracts.js";
20
+ export { GET_DEPTH_VALUES, listGetProjectionFields, } from "./projection-contracts.js";
19
21
  const AUTOMATIC_CHILD_ROLLUP_TYPES = new Set([
20
22
  "epic",
21
23
  "feature",
@@ -147,53 +149,12 @@ function validateGetFields(fields, runtimeMetadataKeys, id) {
147
149
  if (fields === null) {
148
150
  return;
149
151
  }
150
- const itemFields = new Set([
151
- ...ITEM_METADATA_KEY_ORDER,
152
- ...runtimeMetadataKeys,
153
- "notes_count",
154
- "tests_count",
155
- "collection_counts",
156
- ]);
157
- const allowedRootFields = new Set([
158
- "body",
159
- "linked",
160
- "claim_state",
161
- "children",
162
- "schedule",
163
- ]);
164
- const allowedLinkedFields = new Set([
165
- "linked.files",
166
- "linked.tests",
167
- "linked.docs",
168
- ]);
169
- const allowedClaimStateFields = new Set([
170
- "claim_state.claimed",
171
- "claim_state.assignee",
172
- "claim_state.last_claim",
173
- "claim_state.last_release",
174
- ]);
175
- const allowedScheduleFields = new Set([
176
- "schedule.deadline",
177
- "schedule.start_at",
178
- "schedule.end_at",
179
- "schedule.location",
180
- "schedule.reminders",
181
- "schedule.events",
182
- ]);
183
- const allowedValues = [
184
- ...[...itemFields].flatMap((field) => [field, `item.${field}`]),
185
- ...allowedRootFields,
186
- ...allowedLinkedFields,
187
- ...allowedClaimStateFields,
188
- ...allowedScheduleFields,
189
- ].sort();
152
+ const allowedValues = listGetProjectionFields(runtimeMetadataKeys);
153
+ const allowed = new Set(allowedValues);
190
154
  const unknown = fields.filter((field) => {
191
155
  const normalized = normalizeGetField(field);
192
- return (!itemFields.has(normalized) &&
193
- !allowedRootFields.has(normalized) &&
194
- !allowedLinkedFields.has(normalized) &&
195
- !allowedClaimStateFields.has(normalized) &&
196
- !allowedScheduleFields.has(normalized));
156
+ return (!allowed.has(field) &&
157
+ !allowed.has(normalized));
197
158
  });
198
159
  if (unknown.length > 0) {
199
160
  const suggestedRetryArguments = [
@@ -275,10 +236,16 @@ function fieldsIncludeRoot(fields, name) {
275
236
  return normalized === name || normalized.startsWith(`${name}.`);
276
237
  });
277
238
  }
278
- function resolveGetProjection(options) {
239
+ function resolveGetProjection(options, id) {
279
240
  if (options.full &&
280
241
  (options.fields !== undefined || options.depth !== undefined)) {
281
- throw new PmCliError("Get projection options are mutually exclusive; remove the extra projection flag and retry.", EXIT_CODE.USAGE);
242
+ throw new PmCliError("Get projection options are mutually exclusive; remove the extra projection flag and retry.", EXIT_CODE.USAGE, {
243
+ code: "projection_options_mutually_exclusive",
244
+ recovery: {
245
+ suggested_retry: renderPmCommand(["get", id, "--full"]),
246
+ suggested_retry_args: ["get", id, "--full"],
247
+ },
248
+ });
282
249
  }
283
250
  if (options.tree !== true && options.treeDepth !== undefined) {
284
251
  throw new PmCliError("Get --tree-depth requires --tree", EXIT_CODE.USAGE);
@@ -297,9 +264,7 @@ function resolveGetProjection(options) {
297
264
  }
298
265
  async function loadGetItemContext(id, global, at) {
299
266
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
300
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
301
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
302
- }
267
+ await assertInitializedTracker(pmRoot);
303
268
  const settings = await readSettings(pmRoot);
304
269
  const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
305
270
  if (at !== undefined) {
@@ -414,7 +379,7 @@ async function buildGetTree(context, options, treeDepth, global) {
414
379
  }
415
380
  /** Implements run get for the public runtime surface of this module. */
416
381
  export async function runGet(id, global, options = {}) {
417
- const projection = resolveGetProjection(options);
382
+ const projection = resolveGetProjection(options, id);
418
383
  const context = await loadGetItemContext(id, global, options.at);
419
384
  validateGetProjectionFields(projection.fields, context.settings, context.historical !== undefined, context.locatedId);
420
385
  const includeBody = shouldIncludeGetField({ ...projection, field: "body" });
@@ -482,4 +447,4 @@ export const _testOnlyGetCommand = {
482
447
  shouldAutoIncludeGetChildren,
483
448
  };
484
449
  //# sourceMappingURL=get.js.map
485
- //# debugId=1ba3eb17-c44c-5b62-8ae0-c2506fca9c62
450
+ //# debugId=ff82974e-a48d-5d18-893f-fb618e378795
@@ -1,8 +1,3 @@
1
- /**
2
- * @module cli/commands/history
3
- *
4
- * Implements the pm history command surface and its agent-facing runtime behavior.
5
- */
6
1
  import { type HistoryDiffValueEntry, verifyHistoryChain, type GlobalOptions } from "../runtime-primitives.js";
7
2
  import { type HistoryVerificationResult } from "../history-read.js";
8
3
  export { readHistoryEntries } from "../history-read.js";
@@ -4,8 +4,9 @@
4
4
  * Implements the pm history 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]="f18d7526-01eb-593b-bf50-788c08a35e5d")}catch(e){}}();
8
- import { pathExists, computeHistoryDiff, patchPathToChangedField, normalizeReplayPatchOps, verifyHistoryChain, enforceHistoryStreamPolicyForItem, EXIT_CODE, PmCliError, getActiveExtensionRegistrations, normalizeItemId, resolveItemTypeRegistry, locateItem, readLocatedItem, getHistoryPath, getWorkspaceHistoryPath, inspectWorkspaceHistoryState, getSettingsPath, resolvePmRoot, readSettings, WORKSPACE_HISTORY_ID, } from "../runtime-primitives.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]="314adea1-6837-5eeb-abc3-57337a495221")}catch(e){}}();
8
+ import { assertInitializedTracker } from "../environment/tracker-preflight.js";
9
+ import { pathExists, computeHistoryDiff, patchPathToChangedField, normalizeReplayPatchOps, verifyHistoryChain, enforceHistoryStreamPolicyForItem, EXIT_CODE, PmCliError, getActiveExtensionRegistrations, normalizeItemId, resolveItemTypeRegistry, locateItem, readLocatedItem, getHistoryPath, getWorkspaceHistoryPath, inspectWorkspaceHistoryState, resolvePmRoot, readSettings, WORKSPACE_HISTORY_ID, } from "../runtime-primitives.js";
9
10
  import { readHistoryEntries, verifyHistoryEntries, } from "../history-read.js";
10
11
  export { readHistoryEntries } from "../history-read.js";
11
12
  import { parseLimit } from "./parsers.js";
@@ -39,9 +40,7 @@ function buildDiffEntries(entries, startIndex) {
39
40
  }
40
41
  async function resolveHistoryReadTarget(id, global) {
41
42
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
42
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
43
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
44
- }
43
+ await assertInitializedTracker(pmRoot);
45
44
  const settings = await readSettings(pmRoot);
46
45
  const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
47
46
  const workspaceHistoryRequested = id.trim() === WORKSPACE_HISTORY_ID;
@@ -161,4 +160,4 @@ export async function runHistory(id, options, global) {
161
160
  return result;
162
161
  }
163
162
  //# sourceMappingURL=history.js.map
164
- //# debugId=f18d7526-01eb-593b-bf50-788c08a35e5d
163
+ //# debugId=314adea1-6837-5eeb-abc3-57337a495221
@@ -5,6 +5,8 @@ import { type RuntimeStatusRegistry } from "../../core/schema/runtime-schema.js"
5
5
  import type { GlobalOptions } from "../../core/shared/command-types.js";
6
6
  import type { ItemMetadata, ItemStatus } from "../../types/index.js";
7
7
  import type { SharedItemFilterOptions } from "./item-filter-options.js";
8
+ import { type ListCommandName, type ListProjectionMode } from "./projection-contracts.js";
9
+ export { BRIEF_LIST_FIELDS, DEFAULT_COMPACT_LIST_FIELDS, LIST_COMMAND_DEFAULT_PROJECTIONS, listListProjectionFields, type ListCommandName, type ListProjectionMode, } from "./projection-contracts.js";
8
10
  /** Documents the list options payload exchanged by command, SDK, and package integrations. */
9
11
  export interface ListOptions extends SharedItemFilterOptions {
10
12
  /** Value that configures or reports ids for this contract. */
@@ -62,6 +64,10 @@ export interface ListOptions extends SharedItemFilterOptions {
62
64
  /** Value that configures or reports filter metadata missing for this contract. */
63
65
  filterMetadataMissing?: boolean;
64
66
  }
67
+ /** Adapter-only list context that never expands the public SDK options contract. */
68
+ interface ListRuntimeOptions extends ListOptions {
69
+ projectionCommand?: ListCommandName;
70
+ }
65
71
  /** Extract the missing-metadata selection filters from list/update-many options. */
66
72
  export declare const resolveMissingMetadataFilters: (options: {
67
73
  filterAcMissing?: boolean;
@@ -114,8 +120,6 @@ export interface ListProjectedItemCore {
114
120
  export type ListProjectedItem = ListProjectedItemCore & Record<string, unknown>;
115
121
  /** Honest union of item shapes returned by the list engine. */
116
122
  export type ListResultItem = ListedItem | ListTreeItem | ListProjectedItem;
117
- /** Stable projection names emitted by list envelopes and command contracts. */
118
- export type ListProjectionMode = "full" | "compact" | "brief" | "fields";
119
123
  interface ListProjectionConfig {
120
124
  mode: ListProjectionMode;
121
125
  fields: string[];
@@ -128,23 +132,6 @@ export type ListSortField = (typeof LIST_SORT_FIELDS)[number];
128
132
  export declare const LIST_SORT_ORDER_VALUES: readonly ["asc", "desc"];
129
133
  /** Restricts list sort order values accepted by command, SDK, and storage contracts. */
130
134
  export type ListSortOrder = (typeof LIST_SORT_ORDER_VALUES)[number];
131
- /** Stable field order for the compact list projection. */
132
- export declare const DEFAULT_COMPACT_LIST_FIELDS: readonly ["id", "title", "status", "type", "priority", "parent", "updated_at"];
133
- /** Stable field order for the agent-optimized brief list projection. */
134
- export declare const BRIEF_LIST_FIELDS: readonly ["id", "status", "type", "title"];
135
- /** Machine-readable default projection contract for every list command. */
136
- export declare const LIST_COMMAND_DEFAULT_PROJECTIONS: {
137
- readonly list: "brief";
138
- readonly "list-all": "full";
139
- readonly "list-draft": "full";
140
- readonly "list-open": "brief";
141
- readonly "list-in-progress": "brief";
142
- readonly "list-blocked": "brief";
143
- readonly "list-closed": "full";
144
- readonly "list-canceled": "full";
145
- };
146
- /** Command names whose output defaults are described by the list projection contract. */
147
- export type ListCommandName = keyof typeof LIST_COMMAND_DEFAULT_PROJECTIONS;
148
135
  interface ListResultBase {
149
136
  items: ListResultItem[];
150
137
  count: number;
@@ -244,7 +231,7 @@ declare function resolveListUpdatedAfter(options: ListOptions): string | undefin
244
231
  declare function parseIdsFilter(raw: unknown): Set<string> | undefined;
245
232
  declare function parseOffset(raw: string | undefined): number | undefined;
246
233
  declare function parseFieldSelectors(raw: string | undefined): string[] | undefined;
247
- declare function parseProjectionConfig(options: ListOptions): ListProjectionConfig;
234
+ declare function parseProjectionConfig(options: ListRuntimeOptions, invokedCommand?: ListCommandName): ListProjectionConfig;
248
235
  declare function normalizeProjectionField(field: string): string;
249
236
  declare function parseSortField(raw: string | undefined): ListSortField | undefined;
250
237
  declare function parseSortOrder(raw: string | undefined): ListSortOrder | undefined;
@@ -309,4 +296,3 @@ export declare const _testOnly: {
309
296
  trimNonEmpty: typeof trimNonEmpty;
310
297
  withTreeMetadata: typeof withTreeMetadata;
311
298
  };
312
- export {};
@@ -4,8 +4,8 @@
4
4
  * Implements the pm list 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]="e2cb56ba-2f89-5589-8abf-f08cc7fa2b6b")}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]="361f891a-5f10-529c-8161-dc5193c7e12a")}catch(e){}}();
8
+ import { assertInitializedTracker } from "../environment/tracker-preflight.js";
9
9
  import { getActiveExtensionRegistrations, hasActiveOnReadHooks, } from "../../core/extensions/index.js";
10
10
  import { toItemRecord } from "../../core/item/item-record.js";
11
11
  import { isTerminalStatus } from "../../core/item/status.js";
@@ -18,16 +18,18 @@ import { collectRuntimeFilterValues, matchesRuntimeFilters, } from "../../core/s
18
18
  import { hasMissingMetadataFilter, itemMatchesMissingMetadata, lifecycleClassifierFromStatusRegistry, } from "../../core/governance/metadata-coverage.js";
19
19
  import { contentFiltersNeedBody, contentFiltersNeedCollections, hasContentFieldFilter, itemMatchesContentFilters, } from "../../core/governance/content-fields.js";
20
20
  import { resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, } from "../../core/schema/runtime-schema.js";
21
- import { EXIT_CODE, ITEM_METADATA_KEY_ORDER, } from "../../core/shared/constants.js";
21
+ import { EXIT_CODE } from "../../core/shared/constants.js";
22
22
  import { PmCliError } from "../../core/shared/errors.js";
23
23
  import { compareTimestampStrings, matchesTimestampFilters, nowIso, resolveIsoOrRelative, } from "../../core/shared/time.js";
24
24
  import { listAllItemMetadata, listAllItemMetadataLight, listAllItemMetadataWithBody, } from "../../core/store/item-store.js";
25
25
  import { HEAVY_METADATA_KEYS, readItemMetadataDerivedIndexState, } from "../../core/store/item-metadata-cache.js";
26
26
  import { queryItemMetadataIndex } from "../../core/store/item-metadata-query-index.js";
27
- import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
27
+ import { resolvePmRoot } from "../../core/store/paths.js";
28
28
  import { readSettings } from "../../core/store/settings.js";
29
29
  import { LIST_FILTER_FLAG_CONTRACTS } from "../cli-contracts/flag-contracts.js";
30
30
  import { createQueryFingerprint, encodeQueryCursor, resolveQueryCursorStart, selectCursorSemanticOptions, } from "../pagination.js";
31
+ import { BRIEF_LIST_FIELDS, DEFAULT_COMPACT_LIST_FIELDS, listListProjectionFields, } from "./projection-contracts.js";
32
+ export { BRIEF_LIST_FIELDS, DEFAULT_COMPACT_LIST_FIELDS, LIST_COMMAND_DEFAULT_PROJECTIONS, listListProjectionFields, } from "./projection-contracts.js";
31
33
  /** Extract the missing-metadata selection filters from list/update-many options. */
32
34
  export const resolveMissingMetadataFilters = (options) => {
33
35
  return {
@@ -134,35 +136,6 @@ export const LIST_SORT_FIELDS = [
134
136
  ];
135
137
  /** Supported values accepted by the list sort order contract. */
136
138
  export const LIST_SORT_ORDER_VALUES = ["asc", "desc"];
137
- /** Stable field order for the compact list projection. */
138
- export const DEFAULT_COMPACT_LIST_FIELDS = [
139
- "id",
140
- "title",
141
- "status",
142
- "type",
143
- "priority",
144
- "parent",
145
- "updated_at",
146
- ];
147
- /** Stable field order for the agent-optimized brief list projection. */
148
- export const BRIEF_LIST_FIELDS = ["id", "status", "type", "title"];
149
- /** Machine-readable default projection contract for every list command. */
150
- export const LIST_COMMAND_DEFAULT_PROJECTIONS = {
151
- list: "brief",
152
- "list-all": "full",
153
- "list-draft": "full",
154
- "list-open": "brief",
155
- "list-in-progress": "brief",
156
- "list-blocked": "brief",
157
- "list-closed": "full",
158
- "list-canceled": "full",
159
- };
160
- const TREE_METADATA_FIELDS = [
161
- "tree_depth",
162
- "tree_parent",
163
- "tree_children",
164
- "tree_title",
165
- ];
166
139
  // A projection that selects any heavy collection field (or `--full`, which returns
167
140
  // items verbatim) must load the full metadata; everything else takes the light path.
168
141
  // Sourced from the single HEAVY_METADATA_KEYS definition in the cache layer so the
@@ -479,7 +452,7 @@ function parseFieldSelectors(raw) {
479
452
  }
480
453
  return [...new Set(selectors)];
481
454
  }
482
- function parseProjectionConfig(options) {
455
+ function parseProjectionConfig(options, invokedCommand = options.projectionCommand ?? "list") {
483
456
  const compactRequested = options.compact === true;
484
457
  const briefRequested = options.brief === true;
485
458
  const fullRequested = options.full === true;
@@ -489,7 +462,13 @@ function parseProjectionConfig(options) {
489
462
  Number(fullRequested) +
490
463
  Number(fieldSelectors !== undefined);
491
464
  if (enabledModes > 1) {
492
- throw new PmCliError("List projection options are mutually exclusive. Use one of --compact, --brief, --full, or --fields.", EXIT_CODE.USAGE);
465
+ throw new PmCliError("List projection options are mutually exclusive. Use one of --compact, --brief, --full, or --fields.", EXIT_CODE.USAGE, {
466
+ code: "projection_options_mutually_exclusive",
467
+ recovery: {
468
+ suggested_retry: `pm ${invokedCommand} --brief`,
469
+ suggested_retry_args: [invokedCommand, "--brief"],
470
+ },
471
+ });
493
472
  }
494
473
  if (fullRequested) {
495
474
  return {
@@ -512,7 +491,9 @@ function parseProjectionConfig(options) {
512
491
  if (fieldSelectors) {
513
492
  return {
514
493
  mode: "fields",
515
- fields: fieldSelectors,
494
+ fields: [
495
+ ...new Set(fieldSelectors.map((field) => normalizeProjectionField(field))),
496
+ ],
516
497
  };
517
498
  }
518
499
  return {
@@ -523,19 +504,12 @@ function parseProjectionConfig(options) {
523
504
  function normalizeProjectionField(field) {
524
505
  return field.startsWith("item.") ? field.slice("item.".length) : field;
525
506
  }
526
- function validateListProjectionFields(projection, runtimeMetadataKeys) {
507
+ function validateListProjectionFields(projection, runtimeMetadataKeys, invokedCommand) {
527
508
  if (projection.mode !== "fields") {
528
509
  return;
529
510
  }
530
- const allowed = new Set([
531
- ...ITEM_METADATA_KEY_ORDER,
532
- "body",
533
- ...TREE_METADATA_FIELDS,
534
- ...runtimeMetadataKeys,
535
- ]);
536
- const allowedValues = [...allowed]
537
- .flatMap((field) => [field, `item.${field}`])
538
- .sort();
511
+ const allowedValues = listListProjectionFields(runtimeMetadataKeys);
512
+ const allowed = new Set(allowedValues.map((field) => normalizeProjectionField(field)));
539
513
  const unknown = projection.fields.filter((field) => !allowed.has(normalizeProjectionField(field)));
540
514
  if (unknown.length > 0) {
541
515
  throw new PmCliError(`Unknown list --fields value(s): ${unknown.join(", ")}`, EXIT_CODE.USAGE, {
@@ -547,9 +521,9 @@ function validateListProjectionFields(projection, runtimeMetadataKeys) {
547
521
  ],
548
522
  recovery: {
549
523
  allowed_values: allowedValues,
550
- suggested_retry: "pm list --fields id,title,status --limit 10",
524
+ suggested_retry: `pm ${invokedCommand} --fields id,title,status --limit 10`,
551
525
  suggested_retry_args: [
552
- "list",
526
+ invokedCommand,
553
527
  "--fields",
554
528
  "id,title,status",
555
529
  "--limit",
@@ -917,14 +891,13 @@ function buildListPageExtras(limit, hasMore, nextCursor) {
917
891
  }
918
892
  async function resolveListRuntimeContext(options, global) {
919
893
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
920
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
921
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
922
- }
894
+ await assertInitializedTracker(pmRoot);
923
895
  const settings = await readSettings(pmRoot);
924
896
  const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
925
897
  const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
926
- const projection = parseProjectionConfig(options);
927
- validateListProjectionFields(projection, runtimeMetadataKeysForProjection(runtimeFieldRegistry.definitions));
898
+ const invokedCommand = options.projectionCommand ?? "list";
899
+ const projection = parseProjectionConfig(options, invokedCommand);
900
+ validateListProjectionFields(projection, runtimeMetadataKeysForProjection(runtimeFieldRegistry.definitions), invokedCommand);
928
901
  return {
929
902
  pmRoot,
930
903
  settings,
@@ -1035,7 +1008,18 @@ async function tryLoadIndexedListPage(params) {
1035
1008
  "stream",
1036
1009
  "includeBody",
1037
1010
  "excludeTerminal",
1011
+ "dependencyBlocked",
1038
1012
  "noTruncate",
1013
+ "projectionCommand",
1014
+ "truncate",
1015
+ "notes",
1016
+ "learnings",
1017
+ "files",
1018
+ "docs",
1019
+ "tests",
1020
+ "comments",
1021
+ "deps",
1022
+ "linkedCommand",
1039
1023
  ]);
1040
1024
  const projectionNeedsHeavyData = [
1041
1025
  runtime.projection.mode === "full",
@@ -1257,4 +1241,4 @@ export const _testOnly = {
1257
1241
  withTreeMetadata,
1258
1242
  };
1259
1243
  //# sourceMappingURL=list.js.map
1260
- //# debugId=e2cb56ba-2f89-5589-8abf-f08cc7fa2b6b
1244
+ //# debugId=361f891a-5f10-529c-8161-dc5193c7e12a
@@ -0,0 +1,33 @@
1
+ /** Stable projection names emitted by list envelopes and command contracts. */
2
+ export type ListProjectionMode = "full" | "compact" | "brief" | "fields";
3
+ /** Stable field order for the compact list projection. */
4
+ export declare const DEFAULT_COMPACT_LIST_FIELDS: readonly ["id", "title", "status", "type", "priority", "parent", "updated_at"];
5
+ /** Stable field order for the agent-optimized brief list projection. */
6
+ export declare const BRIEF_LIST_FIELDS: readonly ["id", "status", "type", "title"];
7
+ /** Machine-readable default projection contract for every list command. */
8
+ export declare const LIST_COMMAND_DEFAULT_PROJECTIONS: {
9
+ readonly list: "brief";
10
+ readonly "list-all": "full";
11
+ readonly "list-draft": "full";
12
+ readonly "list-open": "brief";
13
+ readonly "list-in-progress": "brief";
14
+ readonly "list-blocked": "brief";
15
+ readonly "list-closed": "full";
16
+ readonly "list-canceled": "full";
17
+ };
18
+ /** Command names whose output defaults are described by the list projection contract. */
19
+ export type ListCommandName = keyof typeof LIST_COMMAND_DEFAULT_PROJECTIONS;
20
+ /** Return every accepted list projection selector for core and runtime metadata. */
21
+ export declare function listListProjectionFields(runtimeMetadataKeys?: Iterable<string>): string[];
22
+ /** Canonical get depth values. The CLI also accepts full as an alias for deep. */
23
+ export declare const GET_DEPTH_VALUES: readonly ["brief", "standard", "deep"];
24
+ /** Return every accepted get projection selector for core and runtime metadata. */
25
+ export declare function listGetProjectionFields(runtimeMetadataKeys?: Iterable<string>): string[];
26
+ /** Stable field order for compact search results. */
27
+ export declare const DEFAULT_COMPACT_SEARCH_FIELDS: readonly ["id", "title", "status", "type", "priority", "updated_at", "score", "matched_fields"];
28
+ /** Search-result fields that live beside the nested item projection. */
29
+ export declare const SEARCH_HIT_FIELD_KEYS: readonly ["score", "matched_fields", "highlights"];
30
+ /** Core item fields accepted by explicit search projections. */
31
+ export declare const SEARCH_ITEM_FIELD_KEYS: readonly ["id", "title", "description", "type", "status", "priority", "tags", "created_at", "updated_at", "deadline", "assignee", "author", "estimated_minutes", "acceptance_criteria", "dependencies", "comments", "notes", "learnings", "reminders", "events", "files", "tests", "docs", "close_reason", "parent", "reviewer", "risk", "confidence", "sprint", "release", "blocked_by", "blocked_reason", "reporter", "severity", "environment", "repro_steps", "resolution", "expected_result", "actual_result", "affected_version", "fixed_version", "component", "regression", "customer_impact", "definition_of_ready", "order", "rank", "goal", "objective", "value", "impact", "outcome", "why_now", "plan"];
32
+ /** Return every accepted search projection selector for core and runtime metadata. */
33
+ export declare function listSearchProjectionFields(runtimeMetadataKeys?: Iterable<string>): string[];
@@ -0,0 +1,185 @@
1
+ /**
2
+ * @module sdk/query/projection-contracts
3
+ *
4
+ * Declares dependency-light projection vocabularies for list, get, and search
5
+ * so contract-only SDK imports do not initialize query runtimes or storage.
6
+ */
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]="5bb71ec1-7eb1-558e-a965-acd779570c2e")}catch(e){}}();
9
+ import { ITEM_METADATA_KEY_ORDER } from "../../core/shared/item-metadata-contract.js";
10
+ /** Stable field order for the compact list projection. */
11
+ export const DEFAULT_COMPACT_LIST_FIELDS = [
12
+ "id",
13
+ "title",
14
+ "status",
15
+ "type",
16
+ "priority",
17
+ "parent",
18
+ "updated_at",
19
+ ];
20
+ /** Stable field order for the agent-optimized brief list projection. */
21
+ export const BRIEF_LIST_FIELDS = ["id", "status", "type", "title"];
22
+ /** Machine-readable default projection contract for every list command. */
23
+ export const LIST_COMMAND_DEFAULT_PROJECTIONS = {
24
+ list: "brief",
25
+ "list-all": "full",
26
+ "list-draft": "full",
27
+ "list-open": "brief",
28
+ "list-in-progress": "brief",
29
+ "list-blocked": "brief",
30
+ "list-closed": "full",
31
+ "list-canceled": "full",
32
+ };
33
+ const TREE_METADATA_FIELDS = [
34
+ "tree_depth",
35
+ "tree_parent",
36
+ "tree_children",
37
+ "tree_title",
38
+ ];
39
+ /** Return every accepted list projection selector for core and runtime metadata. */
40
+ export function listListProjectionFields(runtimeMetadataKeys = []) {
41
+ return [
42
+ ...new Set([
43
+ ...ITEM_METADATA_KEY_ORDER,
44
+ "body",
45
+ ...TREE_METADATA_FIELDS,
46
+ ...runtimeMetadataKeys,
47
+ ]),
48
+ ]
49
+ .flatMap((field) => [field, `item.${field}`])
50
+ .sort();
51
+ }
52
+ /** Canonical get depth values. The CLI also accepts full as an alias for deep. */
53
+ export const GET_DEPTH_VALUES = ["brief", "standard", "deep"];
54
+ const GET_ROOT_PROJECTION_FIELDS = [
55
+ "body",
56
+ "linked",
57
+ "claim_state",
58
+ "children",
59
+ "schedule",
60
+ ];
61
+ const GET_LINKED_PROJECTION_FIELDS = [
62
+ "linked.files",
63
+ "linked.tests",
64
+ "linked.docs",
65
+ ];
66
+ const GET_CLAIM_STATE_PROJECTION_FIELDS = [
67
+ "claim_state.claimed",
68
+ "claim_state.assignee",
69
+ "claim_state.last_claim",
70
+ "claim_state.last_release",
71
+ ];
72
+ const GET_SCHEDULE_PROJECTION_FIELDS = [
73
+ "schedule.deadline",
74
+ "schedule.start_at",
75
+ "schedule.end_at",
76
+ "schedule.location",
77
+ "schedule.reminders",
78
+ "schedule.events",
79
+ ];
80
+ /** Return every accepted get projection selector for core and runtime metadata. */
81
+ export function listGetProjectionFields(runtimeMetadataKeys = []) {
82
+ const itemFields = [
83
+ ...new Set([
84
+ ...ITEM_METADATA_KEY_ORDER,
85
+ ...runtimeMetadataKeys,
86
+ "notes_count",
87
+ "tests_count",
88
+ "collection_counts",
89
+ ]),
90
+ ];
91
+ return [
92
+ ...itemFields.flatMap((field) => [field, `item.${field}`]),
93
+ ...GET_ROOT_PROJECTION_FIELDS,
94
+ ...GET_LINKED_PROJECTION_FIELDS,
95
+ ...GET_CLAIM_STATE_PROJECTION_FIELDS,
96
+ ...GET_SCHEDULE_PROJECTION_FIELDS,
97
+ ].sort();
98
+ }
99
+ /** Stable field order for compact search results. */
100
+ export const DEFAULT_COMPACT_SEARCH_FIELDS = [
101
+ "id",
102
+ "title",
103
+ "status",
104
+ "type",
105
+ "priority",
106
+ "updated_at",
107
+ "score",
108
+ "matched_fields",
109
+ ];
110
+ /** Search-result fields that live beside the nested item projection. */
111
+ export const SEARCH_HIT_FIELD_KEYS = [
112
+ "score",
113
+ "matched_fields",
114
+ "highlights",
115
+ ];
116
+ /** Core item fields accepted by explicit search projections. */
117
+ export const SEARCH_ITEM_FIELD_KEYS = [
118
+ "id",
119
+ "title",
120
+ "description",
121
+ "type",
122
+ "status",
123
+ "priority",
124
+ "tags",
125
+ "created_at",
126
+ "updated_at",
127
+ "deadline",
128
+ "assignee",
129
+ "author",
130
+ "estimated_minutes",
131
+ "acceptance_criteria",
132
+ "dependencies",
133
+ "comments",
134
+ "notes",
135
+ "learnings",
136
+ "reminders",
137
+ "events",
138
+ "files",
139
+ "tests",
140
+ "docs",
141
+ "close_reason",
142
+ "parent",
143
+ "reviewer",
144
+ "risk",
145
+ "confidence",
146
+ "sprint",
147
+ "release",
148
+ "blocked_by",
149
+ "blocked_reason",
150
+ "reporter",
151
+ "severity",
152
+ "environment",
153
+ "repro_steps",
154
+ "resolution",
155
+ "expected_result",
156
+ "actual_result",
157
+ "affected_version",
158
+ "fixed_version",
159
+ "component",
160
+ "regression",
161
+ "customer_impact",
162
+ "definition_of_ready",
163
+ "order",
164
+ "rank",
165
+ "goal",
166
+ "objective",
167
+ "value",
168
+ "impact",
169
+ "outcome",
170
+ "why_now",
171
+ "plan",
172
+ ];
173
+ /** Return every accepted search projection selector for core and runtime metadata. */
174
+ export function listSearchProjectionFields(runtimeMetadataKeys = []) {
175
+ const runtimeKeys = [...new Set(runtimeMetadataKeys)];
176
+ return [
177
+ ...SEARCH_HIT_FIELD_KEYS,
178
+ ...SEARCH_ITEM_FIELD_KEYS,
179
+ ...SEARCH_ITEM_FIELD_KEYS.map((field) => `item.${field}`),
180
+ ...runtimeKeys,
181
+ ...runtimeKeys.map((field) => `item.${field}`),
182
+ ].sort();
183
+ }
184
+ //# sourceMappingURL=projection-contracts.js.map
185
+ //# debugId=5bb71ec1-7eb1-558e-a965-acd779570c2e
@@ -1,6 +1,7 @@
1
1
  import type { RuntimeFieldRegistry } from "../../core/schema/runtime-schema.js";
2
2
  import type { SharedItemFilterOptions } from "./item-filter-options.js";
3
3
  import type { SearchMode } from "./search-rendering.js";
4
+ export { DEFAULT_COMPACT_SEARCH_FIELDS, SEARCH_HIT_FIELD_KEYS, SEARCH_ITEM_FIELD_KEYS, listSearchProjectionFields, } from "./projection-contracts.js";
4
5
  /** Documents the search options payload exchanged by command, SDK, and package integrations. */
5
6
  export interface SearchOptions extends SharedItemFilterOptions {
6
7
  /** Value that configures or reports mode for this contract. */
@@ -60,7 +61,7 @@ export declare function normalizeSearchPhrase(value: string): string;
60
61
  /** Parse an optional deadline filter. */
61
62
  export declare function parseSearchDeadline(raw: string | undefined, fieldLabel: string): string | undefined;
62
63
  /** Resolve mutually exclusive compact, full, or explicit-field projection. */
63
- export declare function parseSearchProjection(options: SearchOptions): SearchProjectionConfig;
64
+ export declare function parseSearchProjection(options: SearchOptions, query?: string): SearchProjectionConfig;
64
65
  /** Validate explicit projection fields against core and runtime metadata. */
65
66
  export declare function validateSearchProjectionFields(projection: SearchProjectionConfig, runtimeFieldRegistry: RuntimeFieldRegistry, query?: string): void;
66
67
  /** Parse a non-empty normalized query into lexical tokens. */