@unbrained/pm-cli 2026.5.24 → 2026.5.28

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 (246) hide show
  1. package/CHANGELOG.md +953 -522
  2. package/README.md +2 -10
  3. package/dist/cli/bootstrap-args.d.ts +18 -1
  4. package/dist/cli/bootstrap-args.js +143 -3
  5. package/dist/cli/bootstrap-args.js.map +1 -1
  6. package/dist/cli/commander-usage.js +134 -11
  7. package/dist/cli/commander-usage.js.map +1 -1
  8. package/dist/cli/commands/append.js +4 -3
  9. package/dist/cli/commands/append.js.map +1 -1
  10. package/dist/cli/commands/claim.js +5 -4
  11. package/dist/cli/commands/claim.js.map +1 -1
  12. package/dist/cli/commands/close.d.ts +3 -0
  13. package/dist/cli/commands/close.js +26 -3
  14. package/dist/cli/commands/close.js.map +1 -1
  15. package/dist/cli/commands/completion.d.ts +2 -2
  16. package/dist/cli/commands/completion.js +109 -56
  17. package/dist/cli/commands/completion.js.map +1 -1
  18. package/dist/cli/commands/config.d.ts +1 -1
  19. package/dist/cli/commands/config.js +82 -4
  20. package/dist/cli/commands/config.js.map +1 -1
  21. package/dist/cli/commands/create.js +7 -272
  22. package/dist/cli/commands/create.js.map +1 -1
  23. package/dist/cli/commands/delete.js +4 -3
  24. package/dist/cli/commands/delete.js.map +1 -1
  25. package/dist/cli/commands/docs.d.ts +1 -12
  26. package/dist/cli/commands/docs.js +8 -312
  27. package/dist/cli/commands/docs.js.map +1 -1
  28. package/dist/cli/commands/extension/bundled-catalog.d.ts +14 -0
  29. package/dist/cli/commands/extension/bundled-catalog.js +268 -0
  30. package/dist/cli/commands/extension/bundled-catalog.js.map +1 -0
  31. package/dist/cli/commands/extension/doctor.d.ts +31 -0
  32. package/dist/cli/commands/extension/doctor.js +345 -0
  33. package/dist/cli/commands/extension/doctor.js.map +1 -0
  34. package/dist/cli/commands/extension/install-sources.d.ts +37 -0
  35. package/dist/cli/commands/extension/install-sources.js +384 -0
  36. package/dist/cli/commands/extension/install-sources.js.map +1 -0
  37. package/dist/cli/commands/extension/managed-state.d.ts +48 -0
  38. package/dist/cli/commands/extension/managed-state.js +172 -0
  39. package/dist/cli/commands/extension/managed-state.js.map +1 -0
  40. package/dist/cli/commands/extension/scaffold.d.ts +14 -0
  41. package/dist/cli/commands/extension/scaffold.js +202 -0
  42. package/dist/cli/commands/extension/scaffold.js.map +1 -0
  43. package/dist/cli/commands/extension/shared.d.ts +14 -0
  44. package/dist/cli/commands/extension/shared.js +106 -0
  45. package/dist/cli/commands/extension/shared.js.map +1 -0
  46. package/dist/cli/commands/extension.d.ts +36 -68
  47. package/dist/cli/commands/extension.js +143 -1422
  48. package/dist/cli/commands/extension.js.map +1 -1
  49. package/dist/cli/commands/files.d.ts +1 -12
  50. package/dist/cli/commands/files.js +11 -308
  51. package/dist/cli/commands/files.js.map +1 -1
  52. package/dist/cli/commands/get.js +4 -3
  53. package/dist/cli/commands/get.js.map +1 -1
  54. package/dist/cli/commands/health.js +17 -3
  55. package/dist/cli/commands/health.js.map +1 -1
  56. package/dist/cli/commands/history-redact.js +23 -18
  57. package/dist/cli/commands/history-redact.js.map +1 -1
  58. package/dist/cli/commands/history-repair.js +24 -18
  59. package/dist/cli/commands/history-repair.js.map +1 -1
  60. package/dist/cli/commands/legacy-none-tokens.d.ts +3 -0
  61. package/dist/cli/commands/legacy-none-tokens.js +39 -0
  62. package/dist/cli/commands/legacy-none-tokens.js.map +1 -0
  63. package/dist/cli/commands/linked-artifacts.d.ts +96 -0
  64. package/dist/cli/commands/linked-artifacts.js +335 -0
  65. package/dist/cli/commands/linked-artifacts.js.map +1 -0
  66. package/dist/cli/commands/linked-test-parsers.d.ts +28 -0
  67. package/dist/cli/commands/linked-test-parsers.js +192 -0
  68. package/dist/cli/commands/linked-test-parsers.js.map +1 -0
  69. package/dist/cli/commands/list.js +19 -5
  70. package/dist/cli/commands/list.js.map +1 -1
  71. package/dist/cli/commands/normalize.js +4 -3
  72. package/dist/cli/commands/normalize.js.map +1 -1
  73. package/dist/cli/commands/plan.d.ts +5 -0
  74. package/dist/cli/commands/plan.js +56 -8
  75. package/dist/cli/commands/plan.js.map +1 -1
  76. package/dist/cli/commands/recurrence-parsers.d.ts +26 -0
  77. package/dist/cli/commands/recurrence-parsers.js +98 -0
  78. package/dist/cli/commands/recurrence-parsers.js.map +1 -0
  79. package/dist/cli/commands/restore.js +19 -8
  80. package/dist/cli/commands/restore.js.map +1 -1
  81. package/dist/cli/commands/search.js +5 -8
  82. package/dist/cli/commands/search.js.map +1 -1
  83. package/dist/cli/commands/test/linked-command-detection.d.ts +37 -0
  84. package/dist/cli/commands/test/linked-command-detection.js +200 -0
  85. package/dist/cli/commands/test/linked-command-detection.js.map +1 -0
  86. package/dist/cli/commands/test.d.ts +1 -2
  87. package/dist/cli/commands/test.js +8 -350
  88. package/dist/cli/commands/test.js.map +1 -1
  89. package/dist/cli/commands/update-many.js +4 -3
  90. package/dist/cli/commands/update-many.js.map +1 -1
  91. package/dist/cli/commands/update.js +83 -356
  92. package/dist/cli/commands/update.js.map +1 -1
  93. package/dist/cli/commands/validate.js +32 -12
  94. package/dist/cli/commands/validate.js.map +1 -1
  95. package/dist/cli/error-guidance.d.ts +1 -0
  96. package/dist/cli/error-guidance.js +6 -2
  97. package/dist/cli/error-guidance.js.map +1 -1
  98. package/dist/cli/main.d.ts +11 -0
  99. package/dist/cli/main.js +76 -28
  100. package/dist/cli/main.js.map +1 -1
  101. package/dist/cli/register-list-query.d.ts +4 -1
  102. package/dist/cli/register-list-query.js +242 -203
  103. package/dist/cli/register-list-query.js.map +1 -1
  104. package/dist/cli/register-mutation.js +73 -11
  105. package/dist/cli/register-mutation.js.map +1 -1
  106. package/dist/cli/register-operations.js +3 -3
  107. package/dist/cli/register-operations.js.map +1 -1
  108. package/dist/cli/register-setup.js +12 -7
  109. package/dist/cli/register-setup.js.map +1 -1
  110. package/dist/cli/registration-helpers.js +3 -2
  111. package/dist/cli/registration-helpers.js.map +1 -1
  112. package/dist/cli.js +4 -3
  113. package/dist/cli.js.map +1 -1
  114. package/dist/core/config/positional-value.d.ts +44 -0
  115. package/dist/core/config/positional-value.js +109 -0
  116. package/dist/core/config/positional-value.js.map +1 -0
  117. package/dist/core/extensions/extension-capability-aliases.d.ts +14 -0
  118. package/dist/core/extensions/extension-capability-aliases.js +159 -0
  119. package/dist/core/extensions/extension-capability-aliases.js.map +1 -0
  120. package/dist/core/extensions/extension-hook-runtime.d.ts +13 -0
  121. package/dist/core/extensions/extension-hook-runtime.js +414 -0
  122. package/dist/core/extensions/extension-hook-runtime.js.map +1 -0
  123. package/dist/core/extensions/extension-policy.d.ts +69 -0
  124. package/dist/core/extensions/extension-policy.js +481 -0
  125. package/dist/core/extensions/extension-policy.js.map +1 -0
  126. package/dist/core/extensions/extension-registries.d.ts +8 -0
  127. package/dist/core/extensions/extension-registries.js +52 -0
  128. package/dist/core/extensions/extension-registries.js.map +1 -0
  129. package/dist/core/extensions/extension-runtime-helpers.d.ts +6 -0
  130. package/dist/core/extensions/extension-runtime-helpers.js +29 -0
  131. package/dist/core/extensions/extension-runtime-helpers.js.map +1 -0
  132. package/dist/core/extensions/extension-types.d.ts +13 -39
  133. package/dist/core/extensions/extension-types.js +34 -2
  134. package/dist/core/extensions/extension-types.js.map +1 -1
  135. package/dist/core/extensions/index.d.ts +7 -0
  136. package/dist/core/extensions/index.js +11 -2
  137. package/dist/core/extensions/index.js.map +1 -1
  138. package/dist/core/extensions/loader.d.ts +4 -22
  139. package/dist/core/extensions/loader.js +22 -1139
  140. package/dist/core/extensions/loader.js.map +1 -1
  141. package/dist/core/history/drift-scan.d.ts +11 -0
  142. package/dist/core/history/drift-scan.js +114 -32
  143. package/dist/core/history/drift-scan.js.map +1 -1
  144. package/dist/core/history/history-rewrite.d.ts +43 -0
  145. package/dist/core/history/history-rewrite.js +48 -0
  146. package/dist/core/history/history-rewrite.js.map +1 -0
  147. package/dist/core/history/history.js +5 -4
  148. package/dist/core/history/history.js.map +1 -1
  149. package/dist/core/history/replay.js +4 -3
  150. package/dist/core/history/replay.js.map +1 -1
  151. package/dist/core/item/item-record.d.ts +19 -0
  152. package/dist/core/item/item-record.js +24 -0
  153. package/dist/core/item/item-record.js.map +1 -0
  154. package/dist/core/output/mutation-projection.d.ts +31 -0
  155. package/dist/core/output/mutation-projection.js +103 -0
  156. package/dist/core/output/mutation-projection.js.map +1 -0
  157. package/dist/core/output/output.d.ts +2 -0
  158. package/dist/core/output/output.js +5 -3
  159. package/dist/core/output/output.js.map +1 -1
  160. package/dist/core/schema/runtime-schema.js +8 -38
  161. package/dist/core/schema/runtime-schema.js.map +1 -1
  162. package/dist/core/search/vector-stores.js +46 -9
  163. package/dist/core/search/vector-stores.js.map +1 -1
  164. package/dist/core/sentry/helpers.d.ts +1 -1
  165. package/dist/core/sentry/helpers.js +20 -3
  166. package/dist/core/sentry/helpers.js.map +1 -1
  167. package/dist/core/shared/command-types.d.ts +1 -0
  168. package/dist/core/shared/command-types.js +2 -2
  169. package/dist/core/shared/command-types.js.map +1 -1
  170. package/dist/core/shared/constants.d.ts +10 -1
  171. package/dist/core/shared/constants.js +56 -58
  172. package/dist/core/shared/constants.js.map +1 -1
  173. package/dist/core/shared/levenshtein.js +23 -7
  174. package/dist/core/shared/levenshtein.js.map +1 -1
  175. package/dist/core/shared/primitives.d.ts +23 -0
  176. package/dist/core/shared/primitives.js +39 -2
  177. package/dist/core/shared/primitives.js.map +1 -1
  178. package/dist/core/store/front-matter-cache.d.ts +16 -2
  179. package/dist/core/store/front-matter-cache.js +99 -33
  180. package/dist/core/store/front-matter-cache.js.map +1 -1
  181. package/dist/core/store/item-store.js +8 -73
  182. package/dist/core/store/item-store.js.map +1 -1
  183. package/dist/mcp/server.js +76 -28
  184. package/dist/mcp/server.js.map +1 -1
  185. package/dist/sdk/cli-contracts/enum-contracts.d.ts +20 -0
  186. package/dist/sdk/cli-contracts/enum-contracts.js +156 -0
  187. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -0
  188. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +14 -0
  189. package/dist/sdk/cli-contracts/tool-option-contracts.js +243 -0
  190. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -0
  191. package/dist/sdk/cli-contracts/tool-parameter-tables.d.ts +11 -0
  192. package/dist/sdk/cli-contracts/tool-parameter-tables.js +901 -0
  193. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -0
  194. package/dist/sdk/cli-contracts.d.ts +11 -33
  195. package/dist/sdk/cli-contracts.js +30 -1356
  196. package/dist/sdk/cli-contracts.js.map +1 -1
  197. package/dist/sdk/package-import-adapters.d.ts +74 -0
  198. package/dist/sdk/package-import-adapters.js +186 -0
  199. package/dist/sdk/package-import-adapters.js.map +1 -0
  200. package/dist/sdk/package-runtime-options.d.ts +26 -0
  201. package/dist/sdk/package-runtime-options.js +71 -0
  202. package/dist/sdk/package-runtime-options.js.map +1 -0
  203. package/dist/sdk/runtime.d.ts +2 -0
  204. package/dist/sdk/runtime.js +4 -2
  205. package/dist/sdk/runtime.js.map +1 -1
  206. package/docs/AGENT_GUIDE.md +6 -10
  207. package/docs/CLAUDE_CODE_PLUGIN.md +5 -28
  208. package/docs/CODEX_PLUGIN.md +5 -5
  209. package/docs/COMMANDS.md +19 -3
  210. package/docs/CONFIGURATION.md +15 -0
  211. package/docs/EXTENSIONS.md +4 -63
  212. package/docs/RELEASING.md +4 -4
  213. package/marketplace.json +7 -3
  214. package/package.json +9 -6
  215. package/packages/pm-beads/extensions/beads/index.js +2 -49
  216. package/packages/pm-beads/extensions/beads/index.ts +2 -54
  217. package/packages/pm-beads/extensions/beads/runtime-loader.js +86 -0
  218. package/packages/pm-beads/extensions/beads/runtime-loader.ts +88 -0
  219. package/packages/pm-beads/extensions/beads/runtime.js +26 -115
  220. package/packages/pm-beads/extensions/beads/runtime.ts +33 -132
  221. package/packages/pm-calendar/extensions/calendar/index.js +47 -2
  222. package/packages/pm-calendar/extensions/calendar/index.ts +52 -2
  223. package/packages/pm-calendar/extensions/calendar/runtime.js +1 -0
  224. package/packages/pm-calendar/extensions/calendar/runtime.ts +1 -0
  225. package/packages/pm-governance-audit/extensions/governance-audit/runtime.js +14 -41
  226. package/packages/pm-governance-audit/extensions/governance-audit/runtime.ts +25 -41
  227. package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +10 -50
  228. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +17 -50
  229. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.js +8 -40
  230. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.ts +10 -40
  231. package/packages/pm-search-advanced/extensions/search-advanced/index.js +1 -1
  232. package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +4 -37
  233. package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +6 -37
  234. package/packages/pm-todos/extensions/todos/index.js +3 -50
  235. package/packages/pm-todos/extensions/todos/index.ts +3 -55
  236. package/packages/pm-todos/extensions/todos/runtime-loader.js +86 -0
  237. package/packages/pm-todos/extensions/todos/runtime-loader.ts +88 -0
  238. package/packages/pm-todos/extensions/todos/runtime.js +24 -117
  239. package/packages/pm-todos/extensions/todos/runtime.ts +32 -129
  240. package/plugins/pm-claude/README.md +2 -2
  241. package/plugins/pm-claude/commands/pm-planner.md +1 -15
  242. package/plugins/pm-claude/scripts/pm-mcp-server.mjs +5 -2
  243. package/plugins/pm-claude/skills/pm-planner/SKILL.md +3 -21
  244. package/plugins/pm-codex/scripts/pm-mcp-server.mjs +15 -6
  245. package/plugins/pm-codex/skills/pm-native/SKILL.md +1 -13
  246. package/PRD.md +0 -1734
@@ -1 +1 @@
1
- {"version":3,"file":"close.js","sources":["cli/commands/close.ts"],"sourceRoot":"/","sourcesContent":["import { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { isTerminalStatus } from \"../../core/item/status.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { resolveRuntimeStatusRegistry, type RuntimeStatusRegistry } from \"../../core/schema/runtime-schema.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { listAllFrontMatter, mutateItem } from \"../../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport type { ItemFrontMatter } from \"../../types/index.js\";\n\nexport interface CloseCommandOptions {\n author?: string;\n message?: string;\n validateClose?: string;\n force?: boolean;\n}\n\nexport interface CloseResult {\n item: Record<string, unknown>;\n changed_fields: string[];\n warnings: string[];\n}\n\nfunction toAuthor(candidate: string | undefined, defaultAuthor: string): string {\n const resolved = candidate ?? process.env.PM_AUTHOR ?? defaultAuthor;\n const trimmed = resolved.trim();\n return trimmed || \"unknown\";\n}\n\nfunction ensureCloseReason(reasonText: string): string {\n const reason = reasonText.trim();\n if (reason.length === 0) {\n throw new PmCliError(\"Close reason text must not be empty\", EXIT_CODE.USAGE);\n }\n return reason;\n}\n\ntype ValidateCloseMode = \"off\" | \"warn\" | \"strict\";\n\nconst CLOSE_VALIDATION_FIELDS: Array<{ key: keyof Pick<ItemFrontMatter, \"resolution\" | \"expected_result\" | \"actual_result\">; label: string }> = [\n { key: \"resolution\", label: \"resolution\" },\n { key: \"expected_result\", label: \"expected_result\" },\n { key: \"actual_result\", label: \"actual_result\" },\n];\n\nfunction parseValidateCloseMode(raw: string | undefined): ValidateCloseMode | undefined {\n if (raw === undefined) {\n return undefined;\n }\n const normalized = raw.trim().toLowerCase();\n if (normalized.length === 0 || normalized === \"warn\") {\n return \"warn\";\n }\n if (normalized === \"off\" || normalized === \"none\" || normalized === \"disabled\") {\n return \"off\";\n }\n if (normalized === \"strict\") {\n return \"strict\";\n }\n throw new PmCliError(`Invalid --validate-close mode \"${raw}\" (expected \"off\", \"warn\", or \"strict\")`, EXIT_CODE.USAGE);\n}\n\nfunction findMissingCloseValidationFields(frontMatter: ItemFrontMatter): string[] {\n const missing: string[] = [];\n for (const field of CLOSE_VALIDATION_FIELDS) {\n const rawValue = frontMatter[field.key];\n if (typeof rawValue !== \"string\" || rawValue.trim().length === 0) {\n missing.push(field.label);\n }\n }\n return missing;\n}\n\nasync function findActiveChildIds(\n pmRoot: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n parentId: string,\n statusRegistry: RuntimeStatusRegistry,\n): Promise<string[]> {\n const typeRegistry = resolveItemTypeRegistry(settings);\n const items = await listAllFrontMatter(\n pmRoot,\n settings.item_format,\n typeRegistry.type_to_folder,\n undefined,\n settings.schema,\n );\n return items\n .filter((item) => item.parent === parentId && !isTerminalStatus(item.status, statusRegistry))\n .map((item) => item.id)\n .sort((left, right) => left.localeCompare(right));\n}\n\nexport async function runClose(\n id: string,\n closeReasonText: string,\n options: CloseCommandOptions,\n global: GlobalOptions,\n): Promise<CloseResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n const author = toAuthor(options.author, settings.author_default);\n const closeReason = ensureCloseReason(closeReasonText);\n const validateCloseMode = parseValidateCloseMode(options.validateClose) ?? settings.governance.close_validation_default;\n // C3 (pm-fu5d): scan for active children even under minimal governance so\n // closing a parent is never silently orphaning — off mode emits an\n // informational note instead of the warn/strict validation warning.\n const activeChildIds = await findActiveChildIds(pmRoot, settings, id, statusRegistry);\n\n const result = await mutateItem({\n pmRoot,\n settings,\n id,\n op: \"close\",\n author,\n message: options.message,\n force: options.force,\n mutate(document) {\n if (isTerminalStatus(document.metadata.status, statusRegistry) && !options.force) {\n throw new PmCliError(`Item ${document.metadata.id} is already terminal; use --force to close again.`, EXIT_CODE.CONFLICT);\n }\n const mutationWarnings: string[] = [];\n if (validateCloseMode !== \"off\") {\n const missingFields = findMissingCloseValidationFields(document.metadata);\n if (missingFields.length > 0) {\n if (validateCloseMode === \"strict\") {\n throw new PmCliError(\n `Cannot close item ${document.metadata.id}: missing ${missingFields.join(\", \")}. Populate fields or use --validate-close warn.`,\n EXIT_CODE.USAGE,\n );\n }\n mutationWarnings.push(`close_validation_missing_fields:${document.metadata.id}:${missingFields.join(\",\")}`);\n }\n if (activeChildIds.length > 0) {\n if (validateCloseMode === \"strict\") {\n throw new PmCliError(\n `Cannot close item ${document.metadata.id}: active child items remain open (${activeChildIds.join(\", \")}). Close, cancel, or re-parent them first, or use --validate-close warn.`,\n EXIT_CODE.USAGE,\n );\n }\n mutationWarnings.push(`close_validation_active_children:${document.metadata.id}:${activeChildIds.join(\",\")}`);\n }\n } else if (activeChildIds.length > 0) {\n // C3: minimal governance (validate-close off) should still tell the\n // agent it just closed a parent with open children, without blocking.\n mutationWarnings.push(`closed_with_active_children:${document.metadata.id}:${activeChildIds.join(\",\")}`);\n }\n\n document.metadata.status = statusRegistry.close_status;\n document.metadata.close_reason = closeReason;\n\n const changedFields = [\"status\", \"close_reason\"];\n if (document.metadata.assignee !== undefined) {\n delete document.metadata.assignee;\n changedFields.push(\"assignee\");\n }\n\n // C4 (pm-fu5d): a terminal item is no longer blocked. Clear every active\n // blocker signal independently — scalar blocked_by, blocked_reason, and the\n // blocked_by dependency edges (kept consistent with the kyd6 invariant) —\n // even if only some are present (e.g. an orphaned edge or a stale\n // blocked_reason left by manual edits), so closed work stops surfacing in\n // blockers views, and annotate the cleanup.\n const previousBlockedBy =\n typeof document.metadata.blocked_by === \"string\" ? document.metadata.blocked_by.trim() : \"\";\n const existingDeps = document.metadata.dependencies ?? [];\n const blockedByEdge = existingDeps.find((dep) => dep.kind === \"blocked_by\");\n const hadBlockedReason = document.metadata.blocked_reason !== undefined;\n if (previousBlockedBy.length > 0 || blockedByEdge !== undefined || hadBlockedReason) {\n if (previousBlockedBy.length > 0) {\n delete document.metadata.blocked_by;\n changedFields.push(\"blocked_by\");\n }\n if (hadBlockedReason) {\n delete document.metadata.blocked_reason;\n changedFields.push(\"blocked_reason\");\n }\n if (blockedByEdge !== undefined) {\n const remainingDeps = existingDeps.filter((dep) => dep.kind !== \"blocked_by\");\n if (remainingDeps.length > 0) {\n document.metadata.dependencies = remainingDeps;\n } else {\n delete document.metadata.dependencies;\n }\n changedFields.push(\"dependencies\");\n }\n const reportedBlocker = previousBlockedBy || blockedByEdge?.id || \"unknown\";\n mutationWarnings.push(`closed_cleared_blocked_by:${document.metadata.id}:${reportedBlocker}`);\n }\n\n return {\n changedFields,\n ...(mutationWarnings.length > 0 ? { warnings: mutationWarnings } : {}),\n };\n },\n });\n\n return {\n item: result.item as unknown as Record<string, unknown>,\n changed_fields: result.changedFields,\n warnings: result.warnings,\n };\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAA8B,MAAM,qCAAqC,CAAC;AAC/G,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAgB5D,SAAS,QAAQ,CAAC,SAA6B,EAAE,aAAqB;IACpE,MAAM,QAAQ,GAAG,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,aAAa,CAAC;IACrE,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAChC,OAAO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,SAAS,EAAE,CAAC;oBAChC,MAAM,aAAa,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;oBAC9E,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAC7B,QAAQ,CAAC,QAAQ,CAAC,YAAY,GAAG,aAAa,CAAC;oBACjD,CAAC;yBAAM,CAAC;wBACN,OAAO,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;oBACxC,CAAC;oBACD,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBACrC,CAAC;gBACD,MAAM,eAAe,GAAG,iBAAiB,IAAI,aAAa,EAAE,EAAE,IAAI,SAAS,CAAC;gBAC5E,gBAAgB,CAAC,IAAI,CAAC,6BAA6B,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,eAAe,EAAE,CAAC,CAAC;YAChG,CAAC;YAED,OAAO;gBACL,aAAa;gBACb,GAAG,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACvE,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAA0C;QACvD,cAAc,EAAE,MAAM,CAAC,aAAa;QACpC,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B,CAAC;AACJ,CAAC","debugId":"d8ef4de6-1572-562a-90e1-421793927d09"}
1
+ {"version":3,"file":"close.js","sources":["cli/commands/close.ts"],"sourceRoot":"/","sourcesContent":["import { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { toItemRecord } from \"../../core/item/item-record.js\";\nimport { isTerminalStatus } from \"../../core/item/status.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { resolveRuntimeStatusRegistry, type RuntimeStatusRegistry } from \"../../core/schema/runtime-schema.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { listAllFrontMatter, mutateItem } from \"../../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport type { ItemFrontMatter } from \"../../types/index.js\";\n\nexport interface CloseCommandOptions {\n author?: string;\n message?: string;\n validateClose?: string;\n force?: boolean;\n // pm-fl0c #11 (2026-05-28): allow setting the three closure validation\n // fields inline on `pm close` so agents do not have to issue a prior\n // `pm update` just to satisfy --validate-close warn|strict. These map 1:1\n // to ItemFrontMatter.{resolution,expected_result,actual_result}.\n resolution?: string;\n expectedResult?: string;\n actualResult?: string;\n}\n\nexport interface CloseResult {\n item: Record<string, unknown>;\n changed_fields: string[];\n warnings: string[];\n}\n\nfunction toAuthor(candidate: string | undefined, defaultAuthor: string): string {\n const resolved = candidate ?? process.env.PM_AUTHOR ?? defaultAuthor;\n const trimmed = resolved.trim();\n return trimmed || \"unknown\";\n}\n\nfunction ensureCloseReason(reasonText: string): string {\n const reason = reasonText.trim();\n if (reason.length === 0) {\n throw new PmCliError(\"Close reason text must not be empty\", EXIT_CODE.USAGE);\n }\n return reason;\n}\n\ntype ValidateCloseMode = \"off\" | \"warn\" | \"strict\";\n\nconst CLOSE_VALIDATION_FIELDS: Array<{ key: keyof Pick<ItemFrontMatter, \"resolution\" | \"expected_result\" | \"actual_result\">; label: string }> = [\n { key: \"resolution\", label: \"resolution\" },\n { key: \"expected_result\", label: \"expected_result\" },\n { key: \"actual_result\", label: \"actual_result\" },\n];\n\nfunction parseValidateCloseMode(raw: string | undefined): ValidateCloseMode | undefined {\n if (raw === undefined) {\n return undefined;\n }\n const normalized = raw.trim().toLowerCase();\n if (normalized.length === 0 || normalized === \"warn\") {\n return \"warn\";\n }\n if (normalized === \"off\" || normalized === \"none\" || normalized === \"disabled\") {\n return \"off\";\n }\n if (normalized === \"strict\") {\n return \"strict\";\n }\n throw new PmCliError(`Invalid --validate-close mode \"${raw}\" (expected \"off\", \"warn\", or \"strict\")`, EXIT_CODE.USAGE);\n}\n\nfunction findMissingCloseValidationFields(frontMatter: ItemFrontMatter): string[] {\n const missing: string[] = [];\n for (const field of CLOSE_VALIDATION_FIELDS) {\n const rawValue = frontMatter[field.key];\n if (typeof rawValue !== \"string\" || rawValue.trim().length === 0) {\n missing.push(field.label);\n }\n }\n return missing;\n}\n\nasync function findActiveChildIds(\n pmRoot: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n parentId: string,\n statusRegistry: RuntimeStatusRegistry,\n): Promise<string[]> {\n const typeRegistry = resolveItemTypeRegistry(settings);\n const items = await listAllFrontMatter(\n pmRoot,\n settings.item_format,\n typeRegistry.type_to_folder,\n undefined,\n settings.schema,\n );\n return items\n .filter((item) => item.parent === parentId && !isTerminalStatus(item.status, statusRegistry))\n .map((item) => item.id)\n .sort((left, right) => left.localeCompare(right));\n}\n\nexport async function runClose(\n id: string,\n closeReasonText: string,\n options: CloseCommandOptions,\n global: GlobalOptions,\n): Promise<CloseResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n const author = toAuthor(options.author, settings.author_default);\n const closeReason = ensureCloseReason(closeReasonText);\n const validateCloseMode = parseValidateCloseMode(options.validateClose) ?? settings.governance.close_validation_default;\n // C3 (pm-fu5d): scan for active children even under minimal governance so\n // closing a parent is never silently orphaning — off mode emits an\n // informational note instead of the warn/strict validation warning.\n const activeChildIds = await findActiveChildIds(pmRoot, settings, id, statusRegistry);\n\n const result = await mutateItem({\n pmRoot,\n settings,\n id,\n op: \"close\",\n author,\n message: options.message,\n force: options.force,\n mutate(document) {\n if (isTerminalStatus(document.metadata.status, statusRegistry) && !options.force) {\n throw new PmCliError(`Item ${document.metadata.id} is already terminal; use --force to close again.`, EXIT_CODE.CONFLICT);\n }\n const mutationWarnings: string[] = [];\n // pm-fl0c #11: apply inline closure fields BEFORE the validation pass so\n // a single `pm close <id> \"reason\" --resolution \"...\"` call satisfies\n // strict validation without a prior pm update. Only meaningful trimmed\n // text writes; an empty/whitespace value is a no-op rather than a clear.\n const inlineCloseFields: Array<{ option: string | undefined; key: \"resolution\" | \"expected_result\" | \"actual_result\" }> = [\n { option: options.resolution, key: \"resolution\" },\n { option: options.expectedResult, key: \"expected_result\" },\n { option: options.actualResult, key: \"actual_result\" },\n ];\n for (const { option, key } of inlineCloseFields) {\n if (typeof option !== \"string\") continue;\n const trimmed = option.trim();\n if (trimmed.length === 0) continue;\n document.metadata[key] = trimmed;\n }\n if (validateCloseMode !== \"off\") {\n const missingFields = findMissingCloseValidationFields(document.metadata);\n if (missingFields.length > 0) {\n if (validateCloseMode === \"strict\") {\n throw new PmCliError(\n `Cannot close item ${document.metadata.id}: missing ${missingFields.join(\", \")}. Populate fields or use --validate-close warn.`,\n EXIT_CODE.USAGE,\n );\n }\n mutationWarnings.push(`close_validation_missing_fields:${document.metadata.id}:${missingFields.join(\",\")}`);\n }\n if (activeChildIds.length > 0) {\n if (validateCloseMode === \"strict\") {\n throw new PmCliError(\n `Cannot close item ${document.metadata.id}: active child items remain open (${activeChildIds.join(\", \")}). Close, cancel, or re-parent them first, or use --validate-close warn.`,\n EXIT_CODE.USAGE,\n );\n }\n mutationWarnings.push(`close_validation_active_children:${document.metadata.id}:${activeChildIds.join(\",\")}`);\n }\n } else if (activeChildIds.length > 0) {\n // C3: minimal governance (validate-close off) should still tell the\n // agent it just closed a parent with open children, without blocking.\n mutationWarnings.push(`closed_with_active_children:${document.metadata.id}:${activeChildIds.join(\",\")}`);\n }\n\n document.metadata.status = statusRegistry.close_status;\n document.metadata.close_reason = closeReason;\n\n const changedFields = [\"status\", \"close_reason\"];\n for (const { option, key } of inlineCloseFields) {\n if (typeof option === \"string\" && option.trim().length > 0) {\n changedFields.push(key);\n }\n }\n if (document.metadata.assignee !== undefined) {\n delete document.metadata.assignee;\n changedFields.push(\"assignee\");\n }\n\n // C4 (pm-fu5d): a terminal item is no longer blocked. Clear every active\n // blocker signal independently — scalar blocked_by, blocked_reason, and the\n // blocked_by dependency edges (kept consistent with the kyd6 invariant) —\n // even if only some are present (e.g. an orphaned edge or a stale\n // blocked_reason left by manual edits), so closed work stops surfacing in\n // blockers views, and annotate the cleanup.\n const previousBlockedBy =\n typeof document.metadata.blocked_by === \"string\" ? document.metadata.blocked_by.trim() : \"\";\n const existingDeps = document.metadata.dependencies ?? [];\n const blockedByEdge = existingDeps.find((dep) => dep.kind === \"blocked_by\");\n const hadBlockedReason = document.metadata.blocked_reason !== undefined;\n if (previousBlockedBy.length > 0 || blockedByEdge !== undefined || hadBlockedReason) {\n if (previousBlockedBy.length > 0) {\n delete document.metadata.blocked_by;\n changedFields.push(\"blocked_by\");\n }\n if (hadBlockedReason) {\n delete document.metadata.blocked_reason;\n changedFields.push(\"blocked_reason\");\n }\n if (blockedByEdge !== undefined) {\n const remainingDeps = existingDeps.filter((dep) => dep.kind !== \"blocked_by\");\n if (remainingDeps.length > 0) {\n document.metadata.dependencies = remainingDeps;\n } else {\n delete document.metadata.dependencies;\n }\n changedFields.push(\"dependencies\");\n }\n const reportedBlocker = previousBlockedBy || blockedByEdge?.id || \"unknown\";\n mutationWarnings.push(`closed_cleared_blocked_by:${document.metadata.id}:${reportedBlocker}`);\n }\n\n return {\n changedFields,\n ...(mutationWarnings.length > 0 ? { warnings: mutationWarnings } : {}),\n };\n },\n });\n\n return {\n item: toItemRecord(result.item),\n changed_fields: result.changedFields,\n warnings: result.warnings,\n };\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OA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AAC,aAAa;QACpC,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B,CAAC;AACJ,CAAC","debugId":"610305d5-0069-57e6-aea6-0e9973eac456"}
@@ -10,7 +10,7 @@ export interface CompletionRuntimeConfig {
10
10
  command_flags?: Partial<Record<CompletionFlagCommand, string[]>>;
11
11
  }
12
12
  export declare function generateBashScript(itemTypes?: string[], tags?: string[], eagerTagExpansion?: boolean, runtime?: CompletionRuntimeConfig): string;
13
- export declare function generateZshScript(itemTypes?: string[], tags?: string[], eagerTagExpansion?: boolean): string;
14
- export declare function generateFishScript(itemTypes?: string[], tags?: string[], eagerTagExpansion?: boolean): string;
13
+ export declare function generateZshScript(itemTypes?: string[], tags?: string[], eagerTagExpansion?: boolean, runtime?: CompletionRuntimeConfig): string;
14
+ export declare function generateFishScript(itemTypes?: string[], tags?: string[], eagerTagExpansion?: boolean, runtime?: CompletionRuntimeConfig): string;
15
15
  export declare function runCompletion(shell: string, itemTypes?: string[], tags?: string[], eagerTagExpansion?: boolean, runtime?: CompletionRuntimeConfig): CompletionResult;
16
16
  export {};
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ab5654d4-0aa0-5942-9f7e-b0cf2c952ea8")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b3284398-1103-5eb4-9c3d-028c20dfa304")}catch(e){}}();
3
3
  import { EXIT_CODE } from "../../core/shared/constants.js";
4
4
  import { PmCliError } from "../../core/shared/errors.js";
5
5
  import { ACTIVITY_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CREATE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, NORMALIZE_FLAG_CONTRACTS, PLAN_FLAG_CONTRACTS, PM_CORE_COMMAND_NAMES, SEARCH_FLAG_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, toCompletionFlagString, } from "../../sdk/cli-contracts.js";
@@ -29,10 +29,10 @@ const PLAN_SUBCOMMANDS_LIST = "create show add-step update-step complete-step bl
29
29
  const COMPLETION_FLAGS = toCompletionFlagString(COMPLETION_FLAG_CONTRACTS);
30
30
  const COMPLETION_SHELL_CHOICES = `${COMPLETION_FLAGS} bash zsh fish`;
31
31
  const GUIDE_TOPIC_CHOICES = joinCompletionValues(listGuideTopicIds());
32
- const MUTATION_FLAGS = "--author --message --force --json --quiet --path --no-extensions --no-pager --profile --help";
33
- const DELETE_MUTATION_FLAGS = "--dry-run --author --message --force --json --quiet --path --no-extensions --no-pager --profile --help";
34
- const CLOSE_MUTATION_FLAGS = "--author --message --validate-close --force --json --quiet --path --no-extensions --no-pager --profile --help";
35
- const RELEASE_MUTATION_FLAGS = "--allow-audit-release --author --message --force --json --quiet --path --no-extensions --no-pager --profile --help";
32
+ const MUTATION_FLAGS = "--author --message --force --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help";
33
+ const DELETE_MUTATION_FLAGS = "--dry-run --author --message --force --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help";
34
+ const CLOSE_MUTATION_FLAGS = "--author --message --validate-close --force --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help";
35
+ const RELEASE_MUTATION_FLAGS = "--allow-audit-release --author --message --force --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help";
36
36
  const GLOBAL_FLAGS = GLOBAL_FLAG_CONTRACTS.flatMap((entry) => [entry.short, entry.flag])
37
37
  .filter((value) => Boolean(value))
38
38
  .join(" ");
@@ -45,6 +45,33 @@ function mergeFlagStrings(baseFlags, runtimeFlags) {
45
45
  const merged = [...baseFlags.split(/\s+/u).filter((value) => value.length > 0), ...(runtimeFlags ?? [])];
46
46
  return joinCompletionValues(merged);
47
47
  }
48
+ function normalizeRuntimeCompletionFlags(runtimeFlags) {
49
+ const normalized = (runtimeFlags ?? [])
50
+ .map((value) => value.trim())
51
+ .filter((value) => value.startsWith("--") && value.length > 2)
52
+ .map((value) => `--${value.slice(2).replaceAll("_", "-")}`);
53
+ return [...new Set(normalized)].sort((left, right) => left.localeCompare(right));
54
+ }
55
+ function renderZshRuntimeFieldFlagSpecs(runtimeFlags) {
56
+ const normalized = normalizeRuntimeCompletionFlags(runtimeFlags);
57
+ if (normalized.length === 0) {
58
+ return "";
59
+ }
60
+ return `${normalized.map((flag) => ` '${flag}[Runtime schema field flag]:value' \\`).join("\n")}\n`;
61
+ }
62
+ function renderFishRuntimeFieldFlagSpecs(commands, runtimeFlags) {
63
+ const normalizedFlags = normalizeRuntimeCompletionFlags(runtimeFlags).map((flag) => flag.slice(2));
64
+ if (commands.length === 0 || normalizedFlags.length === 0) {
65
+ return "";
66
+ }
67
+ const lines = [];
68
+ for (const command of commands) {
69
+ for (const flag of normalizedFlags) {
70
+ lines.push(`complete -c pm -n '__fish_seen_subcommand_from ${command}' -l ${flag} -d 'Runtime schema field flag' -r`);
71
+ }
72
+ }
73
+ return `${lines.join("\n")}\n`;
74
+ }
48
75
  export function generateBashScript(itemTypes = DEFAULT_ITEM_TYPES, tags = [], eagerTagExpansion = false, runtime = {}) {
49
76
  const cmds = ALL_COMMANDS.join(" ");
50
77
  const typeValues = itemTypes.join(" ");
@@ -120,10 +147,10 @@ export function generateBashScript(itemTypes = DEFAULT_ITEM_TYPES, tags = [], ea
120
147
  ` COMPREPLY=(${compgen(listFlags)})`,
121
148
  " ;;",
122
149
  " aggregate)",
123
- ` COMPREPLY=(${compgen("--group-by --count --include-unparented --status --type --tag --priority --deadline-before --deadline-after --assignee --assignee-filter --parent --sprint --release --json --quiet --path --no-extensions --no-pager --profile --help")})`,
150
+ ` COMPREPLY=(${compgen("--group-by --count --include-unparented --status --type --tag --priority --deadline-before --deadline-after --assignee --assignee-filter --parent --sprint --release --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
124
151
  " ;;",
125
152
  " dedupe-audit)",
126
- ` COMPREPLY=(${compgen("--mode --limit --threshold --status --type --tag --priority --deadline-before --deadline-after --assignee --assignee-filter --parent --sprint --release --json --quiet --path --no-extensions --no-pager --profile --help")})`,
153
+ ` COMPREPLY=(${compgen("--mode --limit --threshold --status --type --tag --priority --deadline-before --deadline-after --assignee --assignee-filter --parent --sprint --release --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
127
154
  " ;;",
128
155
  " create)",
129
156
  ` COMPREPLY=(${compgen(createFlags)})`,
@@ -150,34 +177,34 @@ export function generateBashScript(itemTypes = DEFAULT_ITEM_TYPES, tags = [], ea
150
177
  ` COMPREPLY=(${compgen(searchFlags)})`,
151
178
  " ;;",
152
179
  " reindex)",
153
- ` COMPREPLY=(${compgen("--mode --progress --json --quiet --path --no-extensions --no-pager --profile --help")})`,
180
+ ` COMPREPLY=(${compgen("--mode --progress --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
154
181
  " ;;",
155
182
  " init)",
156
- ` COMPREPLY=(${compgen(`${INIT_FLAGS} --json --quiet --path --no-extensions --no-pager --profile --help`)})`,
183
+ ` COMPREPLY=(${compgen(`${INIT_FLAGS} --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help`)})`,
157
184
  " ;;",
158
185
  " config)",
159
- ` COMPREPLY=(${compgen("--criterion --clear-criteria --format --policy --json --quiet --path --no-extensions --no-pager --profile --help")})`,
186
+ ` COMPREPLY=(${compgen("--criterion --clear-criteria --format --policy --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
160
187
  " ;;",
161
188
  " extension)",
162
- ` COMPREPLY=(${compgen("init scaffold install uninstall explore manage reload doctor adopt adopt-all activate deactivate --init --scaffold --install --uninstall --explore --manage --reload --watch --doctor --adopt --adopt-all --activate --deactivate --project --local --global --gh --github --ref --detail --trace --runtime-probe --fix-managed-state --strict-exit --fail-on-warn --json --quiet --path --no-extensions --no-pager --profile --help")})`,
189
+ ` COMPREPLY=(${compgen("init scaffold install uninstall explore manage reload doctor adopt adopt-all activate deactivate --init --scaffold --install --uninstall --explore --manage --reload --watch --doctor --adopt --adopt-all --activate --deactivate --project --local --global --gh --github --ref --detail --trace --runtime-probe --fix-managed-state --strict-exit --fail-on-warn --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
163
190
  " ;;",
164
191
  " comments)",
165
- ` COMPREPLY=(${compgen("--add --stdin --file --limit --author --message --allow-audit-comment --force --json --quiet --path --no-extensions --no-pager --profile --help")})`,
192
+ ` COMPREPLY=(${compgen("--add --stdin --file --limit --author --message --allow-audit-comment --force --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
166
193
  " ;;",
167
194
  " comments-audit)",
168
- ` COMPREPLY=(${compgen("--status --type --tag --priority --parent --sprint --release --assignee --assignee-filter --limit-items --limit --full-history --latest --json --quiet --path --no-extensions --no-pager --profile --help")})`,
195
+ ` COMPREPLY=(${compgen("--status --type --tag --priority --parent --sprint --release --assignee --assignee-filter --limit-items --limit --full-history --latest --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
169
196
  " ;;",
170
197
  " notes)",
171
- ` COMPREPLY=(${compgen("--add --limit --author --message --allow-audit-note --allow-audit-comment --force --json --quiet --path --no-extensions --no-pager --profile --help")})`,
198
+ ` COMPREPLY=(${compgen("--add --limit --author --message --allow-audit-note --allow-audit-comment --force --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
172
199
  " ;;",
173
200
  " learnings)",
174
- ` COMPREPLY=(${compgen("--add --limit --author --message --allow-audit-learning --allow-audit-comment --force --json --quiet --path --no-extensions --no-pager --profile --help")})`,
201
+ ` COMPREPLY=(${compgen("--add --limit --author --message --allow-audit-learning --allow-audit-comment --force --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
175
202
  " ;;",
176
203
  " files)",
177
- ` COMPREPLY=(${compgen("discover --add --add-glob --remove --migrate --list --apply --note --append-stable --validate-paths --audit --author --message --force --json --quiet --path --no-extensions --no-pager --profile --help")})`,
204
+ ` COMPREPLY=(${compgen("discover --add --add-glob --remove --migrate --list --apply --note --append-stable --validate-paths --audit --author --message --force --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
178
205
  " ;;",
179
206
  " docs)",
180
- ` COMPREPLY=(${compgen("--add --add-glob --remove --migrate --validate-paths --audit --author --message --force --json --quiet --path --no-extensions --no-pager --profile --help")})`,
207
+ ` COMPREPLY=(${compgen("--add --add-glob --remove --migrate --validate-paths --audit --author --message --force --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
181
208
  " ;;",
182
209
  " append)",
183
210
  ` COMPREPLY=(${compgen(APPEND_FLAGS)})`,
@@ -186,34 +213,34 @@ export function generateBashScript(itemTypes = DEFAULT_ITEM_TYPES, tags = [], ea
186
213
  ` COMPREPLY=(${compgen(DEPS_FLAGS)})`,
187
214
  " ;;",
188
215
  " test)",
189
- ` COMPREPLY=(${compgen("--add --remove --run --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --author --message --force --json --quiet --path --no-extensions --no-pager --profile --help")})`,
216
+ ` COMPREPLY=(${compgen("--add --remove --run --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --author --message --force --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
190
217
  " ;;",
191
218
  " test-all)",
192
- ` COMPREPLY=(${compgen("--status --limit --offset --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --json --quiet --path --no-extensions --no-pager --profile --help")})`,
219
+ ` COMPREPLY=(${compgen("--status --limit --offset --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
193
220
  " ;;",
194
221
  " test-runs)",
195
- ` COMPREPLY=(${compgen("list status logs stop resume --status --limit --stream --tail --force --author --json --quiet --path --no-extensions --no-pager --profile --help")})`,
222
+ ` COMPREPLY=(${compgen("list status logs stop resume --status --limit --stream --tail --force --author --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
196
223
  " ;;",
197
224
  " validate)",
198
- ` COMPREPLY=(${compgen("--check-metadata --metadata-profile --check-resolution --check-lifecycle --check-stale-blockers --dependency-cycle-severity --check-files --scan-mode --include-pm-internals --verbose-file-lists --strict-exit --fail-on-warn --check-history-drift --check-command-references --json --quiet --path --no-extensions --no-pager --profile --help")})`,
225
+ ` COMPREPLY=(${compgen("--check-metadata --metadata-profile --check-resolution --check-lifecycle --check-stale-blockers --dependency-cycle-severity --check-files --scan-mode --include-pm-internals --verbose-file-lists --strict-exit --fail-on-warn --check-history-drift --check-command-references --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
199
226
  " ;;",
200
227
  " health)",
201
228
  ` COMPREPLY=(${compgen(HEALTH_FLAGS)})`,
202
229
  " ;;",
203
230
  " history)",
204
- ` COMPREPLY=(${compgen("--limit --compact --full --diff --verify --json --quiet --path --no-extensions --no-pager --profile --help")})`,
231
+ ` COMPREPLY=(${compgen("--limit --compact --full --diff --verify --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
205
232
  " ;;",
206
233
  " get)",
207
- ` COMPREPLY=(${compgen("--depth --full --fields --json --quiet --path --no-extensions --no-pager --profile --help")})`,
234
+ ` COMPREPLY=(${compgen("--depth --full --fields --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
208
235
  " ;;",
209
236
  " history-redact)",
210
- ` COMPREPLY=(${compgen("--literal --regex --replacement --dry-run --author --message --force --json --quiet --path --no-extensions --no-pager --profile --help")})`,
237
+ ` COMPREPLY=(${compgen("--literal --regex --replacement --dry-run --author --message --force --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
211
238
  " ;;",
212
239
  " history-repair)",
213
- ` COMPREPLY=(${compgen("--dry-run --author --message --force --json --quiet --path --no-extensions --no-pager --profile --help")})`,
240
+ ` COMPREPLY=(${compgen("--dry-run --author --message --force --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
214
241
  " ;;",
215
242
  " schema)",
216
- ` COMPREPLY=(${compgen("add-type --description --default-status --folder --alias --author --force --json --quiet --path --no-extensions --no-pager --profile --help")})`,
243
+ ` COMPREPLY=(${compgen("add-type --description --default-status --folder --alias --author --force --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
217
244
  " ;;",
218
245
  " plan)",
219
246
  ` COMPREPLY=(${compgen(`${PLAN_SUBCOMMANDS_LIST} ${PLAN_FLAGS}`)})`,
@@ -225,7 +252,7 @@ export function generateBashScript(itemTypes = DEFAULT_ITEM_TYPES, tags = [], ea
225
252
  ` COMPREPLY=(${compgen(CONTRACTS_FLAGS)})`,
226
253
  " ;;",
227
254
  " gc)",
228
- ` COMPREPLY=(${compgen("--dry-run --scope --json --quiet --path --no-extensions --no-pager --profile --help")})`,
255
+ ` COMPREPLY=(${compgen("--dry-run --scope --json --quiet --no-changed-fields --path --no-extensions --no-pager --profile --help")})`,
229
256
  " ;;",
230
257
  " close|close-task)",
231
258
  ` COMPREPLY=(${compgen(CLOSE_MUTATION_FLAGS)})`,
@@ -255,13 +282,21 @@ export function generateBashScript(itemTypes = DEFAULT_ITEM_TYPES, tags = [], ea
255
282
  "complete -F _pm_completion pm",
256
283
  ].join("\n");
257
284
  }
258
- export function generateZshScript(itemTypes = DEFAULT_ITEM_TYPES, tags = [], eagerTagExpansion = false) {
285
+ export function generateZshScript(itemTypes = DEFAULT_ITEM_TYPES, tags = [], eagerTagExpansion = false, runtime = {}) {
259
286
  const cmds = ALL_COMMANDS.map((c) => `'${c}'`).join(" ");
260
287
  const typeChoices = itemTypes.join(" ");
288
+ const statusChoices = joinCompletionValues(runtime.statuses ?? DEFAULT_STATUS_VALUES);
261
289
  const guideTopicChoices = GUIDE_TOPIC_CHOICES;
262
290
  const tagChoices = joinCompletionValues(tags);
263
291
  const useEagerTagExpansion = eagerTagExpansion || tags.length > 0;
264
292
  const zshTagChoices = useEagerTagExpansion ? tagChoices : '${(f)"$(_pm_tag_choices)"}';
293
+ const zshListRuntimeFieldFlags = renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.list);
294
+ const zshCreateRuntimeFieldFlags = renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.create);
295
+ const zshUpdateRuntimeFieldFlags = renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.update);
296
+ const zshUpdateManyRuntimeFieldFlags = renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.["update-many"]);
297
+ const zshSearchRuntimeFieldFlags = renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.search);
298
+ const zshCalendarRuntimeFieldFlags = renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.calendar);
299
+ const zshContextRuntimeFieldFlags = renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.context);
265
300
  const dynamicTagResolver = useEagerTagExpansion
266
301
  ? ""
267
302
  : `
@@ -354,6 +389,7 @@ _pm() {
354
389
  _arguments -C \\
355
390
  '--json[Output JSON instead of TOON]' \\
356
391
  '--quiet[Suppress stdout output]' \\
392
+ '--no-changed-fields[Omit changed_fields array from mutation output]' \\
357
393
  '--path[Override PM path for this command]:path:_files -/' \\
358
394
  '--no-extensions[Disable extension loading]' \\
359
395
  '--no-pager[Disable pager integration for help and long output]' \\
@@ -385,7 +421,7 @@ _pm() {
385
421
  '--sort[Sort field]:(priority deadline updated_at created_at title parent)' \\
386
422
  '--order[Sort order (requires --sort)]:(asc desc)' \\
387
423
  '--stream[Emit line-delimited JSON rows (requires --json)]' \\
388
- '--json[Output JSON]' \\
424
+ ${zshListRuntimeFieldFlags} '--json[Output JSON]' \\
389
425
  '--quiet[Suppress stdout]' \\
390
426
  '--path[Override PM path]:path:_files -/'
391
427
  ;;
@@ -394,7 +430,7 @@ _pm() {
394
430
  '--group-by[Comma-separated group-by fields (supported: parent,type,priority,status,assignee,tags,sprint,release)]:fields' \\
395
431
  '--count[Return grouped counts]' \\
396
432
  '--include-unparented[Include unparented rows when grouping by parent]' \\
397
- '--status[Filter by status]:(draft open in_progress blocked closed canceled)' \\
433
+ '--status[Filter by status]:(${statusChoices})' \\
398
434
  '--type[Filter by item type]:(${typeChoices})' \\
399
435
  '--tag[Filter by tag]:(${zshTagChoices})' \\
400
436
  '--priority[Filter by priority]:(0 1 2 3 4)' \\
@@ -413,7 +449,7 @@ _pm() {
413
449
  '--mode[Dedupe mode]:(title_exact title_fuzzy parent_scope)' \\
414
450
  '--limit[Limit returned duplicate clusters]:number' \\
415
451
  '--threshold[Fuzzy mode token similarity threshold between 0 and 1]:number' \\
416
- '--status[Filter by status]:(draft open in_progress blocked closed canceled)' \\
452
+ '--status[Filter by status]:(${statusChoices})' \\
417
453
  '--type[Filter by item type]:(${typeChoices})' \\
418
454
  '--tag[Filter by tag]:(${zshTagChoices})' \\
419
455
  '--priority[Filter by priority]:(0 1 2 3 4)' \\
@@ -434,7 +470,7 @@ _pm() {
434
470
  '--type[Item type]:(${typeChoices})' \\
435
471
  '--create-mode[Create required-option policy mode]:(strict progressive)' \\
436
472
  '--schedule-preset[Scheduling preset for Reminder/Meeting/Event]:(lightweight)' \\
437
- '(-s --status)'{-s,--status}'[Item status]:(draft open in_progress blocked)' \\
473
+ '(-s --status)'{-s,--status}'[Item status]:(${statusChoices})' \\
438
474
  '(-p --priority)'{-p,--priority}'[Priority (0-4)]:(0 1 2 3 4)' \\
439
475
  '--tags[Comma-separated tags]:tags' \\
440
476
  '(-b --body)'{-b,--body}'[Item body]:body' \\
@@ -460,7 +496,7 @@ _pm() {
460
496
  '--author[Mutation author]:author' \\
461
497
  '--message[History message]:message' \\
462
498
  '--assignee[Assignee]:assignee' \\
463
- '--json[Output JSON]' \\
499
+ ${zshCreateRuntimeFieldFlags} '--json[Output JSON]' \\
464
500
  '--quiet[Suppress stdout]'
465
501
  ;;
466
502
  update)
@@ -468,7 +504,7 @@ _pm() {
468
504
  '(-t --title)'{-t,--title}'[Item title]:title' \\
469
505
  '(-d --description)'{-d,--description}'[Item description]:description' \\
470
506
  '(-b --body)'{-b,--body}'[Item body]:body' \\
471
- '(-s --status)'{-s,--status}'[Item status]:(draft open in_progress blocked canceled)' \\
507
+ '(-s --status)'{-s,--status}'[Item status]:(${statusChoices})' \\
472
508
  '--close-reason[Set close reason]:close_reason' \\
473
509
  '(-p --priority)'{-p,--priority}'[Priority (0-4)]:(0 1 2 3 4)' \\
474
510
  '--type[Item type]:(${typeChoices})' \\
@@ -493,7 +529,7 @@ _pm() {
493
529
  '--clear-reminders[Clear reminders]' \\
494
530
  '--clear-events[Clear events]' \\
495
531
  '--clear-type-options[Clear type options]' \\
496
- '--allow-audit-update[Allow non-owner metadata-only audit updates without requiring --force]' \\
532
+ ${zshUpdateRuntimeFieldFlags} '--allow-audit-update[Allow non-owner metadata-only audit updates without requiring --force]' \\
497
533
  '--author[Mutation author]:author' \\
498
534
  '--message[History message]:message' \\
499
535
  '--force[Force override]' \\
@@ -502,7 +538,7 @@ _pm() {
502
538
  ;;
503
539
  update-many)
504
540
  _arguments \\
505
- '--filter-status[Filter by status before applying updates]:(draft open in_progress blocked closed canceled)' \\
541
+ '--filter-status[Filter by status before applying updates]:(${statusChoices})' \\
506
542
  '--filter-type[Filter by type before applying updates]:(${typeChoices})' \\
507
543
  '--filter-tag[Filter by tag before applying updates]:(${zshTagChoices})' \\
508
544
  '--filter-priority[Filter by priority before applying updates]:(0 1 2 3 4)' \\
@@ -576,7 +612,7 @@ _pm() {
576
612
  '--clear-reminders[Clear reminders]' \\
577
613
  '--clear-events[Clear events]' \\
578
614
  '--clear-type-options[Clear type options]' \\
579
- '--allow-audit-update[Allow non-owner metadata-only audit updates without requiring --force]' \\
615
+ ${zshUpdateManyRuntimeFieldFlags} '--allow-audit-update[Allow non-owner metadata-only audit updates without requiring --force]' \\
580
616
  '--author[Mutation author]:author' \\
581
617
  '--message[History message]:message' \\
582
618
  '--force[Force override]' \\
@@ -585,7 +621,7 @@ _pm() {
585
621
  ;;
586
622
  normalize)
587
623
  _arguments \\
588
- '--filter-status[Filter by status before planning or apply]:(draft open in_progress blocked closed canceled)' \\
624
+ '--filter-status[Filter by status before planning or apply]:(${statusChoices})' \\
589
625
  '--filter-type[Filter by type before planning or apply]:(${typeChoices})' \\
590
626
  '--filter-tag[Filter by tag before planning or apply]:(${zshTagChoices})' \\
591
627
  '--filter-priority[Filter by priority before planning or apply]:(0 1 2 3 4)' \\
@@ -618,12 +654,12 @@ _pm() {
618
654
  '--type[Filter by type]:(${typeChoices})' \\
619
655
  '--tag[Filter by tag]:(${zshTagChoices})' \\
620
656
  '--priority[Filter by priority]:(0 1 2 3 4)' \\
621
- '--status[Filter by status]:(draft open in_progress blocked closed canceled)' \\
657
+ '--status[Filter by status]:(${statusChoices})' \\
622
658
  '--assignee[Filter by assignee]:assignee' \\
623
659
  '--assignee-filter[Filter assignee presence]:(assigned unassigned)' \\
624
660
  '--sprint[Filter by sprint]:sprint' \\
625
661
  '--release[Filter by release]:release' \\
626
- '--include[Include event sources]:(all deadlines reminders events scheduled)' \\
662
+ ${zshCalendarRuntimeFieldFlags} '--include[Include event sources]:(all deadlines reminders events scheduled)' \\
627
663
  '--recurrence-lookahead-days[Bound open-ended recurrence lookahead]:days' \\
628
664
  '--recurrence-lookback-days[Bound open-ended recurrence lookback]:days' \\
629
665
  '--occurrence-limit[Cap occurrences per recurring event]:number' \\
@@ -647,7 +683,7 @@ _pm() {
647
683
  '--release[Filter by release]:release' \\
648
684
  '--limit[Limit focus and agenda rows per section]:number' \\
649
685
  '--format[Output override]:(markdown toon json)' \\
650
- '--json[Output JSON]' \\
686
+ ${zshContextRuntimeFieldFlags} '--json[Output JSON]' \\
651
687
  '--quiet[Suppress stdout]'
652
688
  ;;
653
689
  guide)
@@ -667,7 +703,7 @@ _pm() {
667
703
  '--type[Filter by type]:(${typeChoices})' \\
668
704
  '--tag[Filter by tag]:(${zshTagChoices})' \\
669
705
  '--priority[Filter by priority]:(0 1 2 3 4)' \\
670
- '--json[Output JSON]' \\
706
+ ${zshSearchRuntimeFieldFlags} '--json[Output JSON]' \\
671
707
  '--quiet[Suppress stdout]'
672
708
  ;;
673
709
  reindex)
@@ -1013,7 +1049,7 @@ _pm() {
1013
1049
  ;;
1014
1050
  comments-audit)
1015
1051
  _arguments \\
1016
- '--status[Filter by item status]:status:(draft open in_progress blocked closed canceled)' \\
1052
+ '--status[Filter by item status]:status:(${statusChoices})' \\
1017
1053
  '--type[Filter by item type]:(${typeChoices})' \\
1018
1054
  '--tag[Filter by tag]:(${zshTagChoices})' \\
1019
1055
  '--priority[Filter by priority]:(0 1 2 3 4)' \\
@@ -1078,14 +1114,23 @@ _pm() {
1078
1114
 
1079
1115
  compdef _pm pm`;
1080
1116
  }
1081
- export function generateFishScript(itemTypes = DEFAULT_ITEM_TYPES, tags = [], eagerTagExpansion = false) {
1082
- const listCmds = ALL_COMMANDS.filter((command) => command === "list" || command.startsWith("list-")).join(" ");
1117
+ export function generateFishScript(itemTypes = DEFAULT_ITEM_TYPES, tags = [], eagerTagExpansion = false, runtime = {}) {
1118
+ const listCommandNames = ALL_COMMANDS.filter((command) => command === "list" || command.startsWith("list-"));
1119
+ const listCmds = listCommandNames.join(" ");
1083
1120
  const noSubcommandList = ALL_COMMANDS.join(" ");
1084
1121
  const typeChoices = itemTypes.join(" ");
1122
+ const statusChoices = joinCompletionValues(runtime.statuses ?? DEFAULT_STATUS_VALUES);
1085
1123
  const guideTopicChoices = GUIDE_TOPIC_CHOICES;
1086
1124
  const tagChoices = joinCompletionValues(tags);
1087
1125
  const useEagerTagExpansion = eagerTagExpansion || tags.length > 0;
1088
1126
  const fishTagChoices = useEagerTagExpansion ? `'${tagChoices}'` : "'(__pm_tag_choices)'";
1127
+ const fishListRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(listCommandNames, runtime.command_flags?.list);
1128
+ const fishCreateRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(["create"], runtime.command_flags?.create);
1129
+ const fishUpdateRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(["update"], runtime.command_flags?.update);
1130
+ const fishUpdateManyRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(["update-many"], runtime.command_flags?.["update-many"]);
1131
+ const fishSearchRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(["search"], runtime.command_flags?.search);
1132
+ const fishCalendarRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(["calendar", "cal"], runtime.command_flags?.calendar);
1133
+ const fishContextRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(["context", "ctx"], runtime.command_flags?.context);
1089
1134
  const dynamicTagResolver = useEagerTagExpansion
1090
1135
  ? ""
1091
1136
  : `
@@ -1121,6 +1166,7 @@ complete -c pm -f
1121
1166
  # Global flags (available for all subcommands)
1122
1167
  complete -c pm -l json -d 'Output JSON instead of TOON'
1123
1168
  complete -c pm -l quiet -d 'Suppress stdout output'
1169
+ complete -c pm -l no-changed-fields -d 'Omit changed_fields array from mutation output'
1124
1170
  complete -c pm -l path -d 'Override PM path for this command' -r
1125
1171
  complete -c pm -l no-extensions -d 'Disable extension loading'
1126
1172
  complete -c pm -l profile -d 'Print deterministic timing diagnostics'
@@ -1212,12 +1258,13 @@ for list_cmd in ${listCmds}
1212
1258
  complete -c pm -n "__fish_seen_subcommand_from $list_cmd" -l deadline-before -d 'Filter by deadline upper bound (ISO/date string or relative)' -r
1213
1259
  complete -c pm -n "__fish_seen_subcommand_from $list_cmd" -l deadline-after -d 'Filter by deadline lower bound (ISO/date string or relative)' -r
1214
1260
  end
1261
+ ${fishListRuntimeFieldFlags}
1215
1262
 
1216
1263
  # aggregate flags
1217
1264
  complete -c pm -n '__fish_seen_subcommand_from aggregate' -l group-by -d 'Comma-separated group-by fields (supported: parent,type,priority,status,assignee,tags,sprint,release)' -r
1218
1265
  complete -c pm -n '__fish_seen_subcommand_from aggregate' -l count -d 'Return grouped counts'
1219
1266
  complete -c pm -n '__fish_seen_subcommand_from aggregate' -l include-unparented -d 'Include unparented rows when grouping by parent'
1220
- complete -c pm -n '__fish_seen_subcommand_from aggregate' -l status -d 'Filter by status' -r -a 'draft open in_progress blocked closed canceled'
1267
+ complete -c pm -n '__fish_seen_subcommand_from aggregate' -l status -d 'Filter by status' -r -a '${statusChoices}'
1221
1268
  complete -c pm -n '__fish_seen_subcommand_from aggregate' -l type -d 'Filter by item type' -r -a '${typeChoices}'
1222
1269
  complete -c pm -n '__fish_seen_subcommand_from aggregate' -l tag -d 'Filter by tag' -r -a ${fishTagChoices}
1223
1270
  complete -c pm -n '__fish_seen_subcommand_from aggregate' -l priority -d 'Filter by priority' -r -a '0 1 2 3 4'
@@ -1233,7 +1280,7 @@ complete -c pm -n '__fish_seen_subcommand_from aggregate' -l release -d 'Filter
1233
1280
  complete -c pm -n '__fish_seen_subcommand_from dedupe-audit' -l mode -d 'Dedupe mode' -r -a 'title_exact title_fuzzy parent_scope'
1234
1281
  complete -c pm -n '__fish_seen_subcommand_from dedupe-audit' -l limit -d 'Limit returned duplicate clusters' -r
1235
1282
  complete -c pm -n '__fish_seen_subcommand_from dedupe-audit' -l threshold -d 'Fuzzy mode token similarity threshold between 0 and 1' -r
1236
- complete -c pm -n '__fish_seen_subcommand_from dedupe-audit' -l status -d 'Filter by status' -r -a 'draft open in_progress blocked closed canceled'
1283
+ complete -c pm -n '__fish_seen_subcommand_from dedupe-audit' -l status -d 'Filter by status' -r -a '${statusChoices}'
1237
1284
  complete -c pm -n '__fish_seen_subcommand_from dedupe-audit' -l type -d 'Filter by item type' -r -a '${typeChoices}'
1238
1285
  complete -c pm -n '__fish_seen_subcommand_from dedupe-audit' -l tag -d 'Filter by tag' -r -a ${fishTagChoices}
1239
1286
  complete -c pm -n '__fish_seen_subcommand_from dedupe-audit' -l priority -d 'Filter by priority' -r -a '0 1 2 3 4'
@@ -1251,7 +1298,7 @@ complete -c pm -n '__fish_seen_subcommand_from create' -s d -l description
1251
1298
  complete -c pm -n '__fish_seen_subcommand_from create' -l type -d 'Item type' -r -a '${typeChoices}'
1252
1299
  complete -c pm -n '__fish_seen_subcommand_from create' -l create-mode -d 'Create required-option policy mode' -r -a 'strict progressive'
1253
1300
  complete -c pm -n '__fish_seen_subcommand_from create' -l schedule-preset -d 'Scheduling preset for Reminder/Meeting/Event' -r -a 'lightweight'
1254
- complete -c pm -n '__fish_seen_subcommand_from create' -s s -l status -d 'Item status' -r -a 'draft open in_progress blocked'
1301
+ complete -c pm -n '__fish_seen_subcommand_from create' -s s -l status -d 'Item status' -r -a '${statusChoices}'
1255
1302
  complete -c pm -n '__fish_seen_subcommand_from create' -s p -l priority -d 'Priority (0-4)' -r -a '0 1 2 3 4'
1256
1303
  complete -c pm -n '__fish_seen_subcommand_from create' -l tags -d 'Comma-separated tags' -r
1257
1304
  complete -c pm -n '__fish_seen_subcommand_from create' -s b -l body -d 'Item body' -r
@@ -1275,12 +1322,13 @@ complete -c pm -n '__fish_seen_subcommand_from create' -l clear-docs
1275
1322
  complete -c pm -n '__fish_seen_subcommand_from create' -l clear-reminders -d 'Clear reminders'
1276
1323
  complete -c pm -n '__fish_seen_subcommand_from create' -l clear-events -d 'Clear events'
1277
1324
  complete -c pm -n '__fish_seen_subcommand_from create' -l clear-type-options -d 'Clear type options'
1325
+ ${fishCreateRuntimeFieldFlags}
1278
1326
 
1279
1327
  # update flags
1280
1328
  complete -c pm -n '__fish_seen_subcommand_from update' -s t -l title -d 'Item title' -r
1281
1329
  complete -c pm -n '__fish_seen_subcommand_from update' -s d -l description -d 'Item description' -r
1282
1330
  complete -c pm -n '__fish_seen_subcommand_from update' -s b -l body -d 'Item body' -r
1283
- complete -c pm -n '__fish_seen_subcommand_from update' -s s -l status -d 'Item status' -r -a 'draft open in_progress blocked canceled'
1331
+ complete -c pm -n '__fish_seen_subcommand_from update' -s s -l status -d 'Item status' -r -a '${statusChoices}'
1284
1332
  complete -c pm -n '__fish_seen_subcommand_from update' -l close-reason -d 'Set close reason' -r
1285
1333
  complete -c pm -n '__fish_seen_subcommand_from update' -s p -l priority -d 'Priority (0-4)' -r -a '0 1 2 3 4'
1286
1334
  complete -c pm -n '__fish_seen_subcommand_from update' -l type -d 'Item type' -r -a '${typeChoices}'
@@ -1310,9 +1358,10 @@ complete -c pm -n '__fish_seen_subcommand_from update' -l allow-audit-update
1310
1358
  complete -c pm -n '__fish_seen_subcommand_from update' -l author -d 'Mutation author' -r
1311
1359
  complete -c pm -n '__fish_seen_subcommand_from update' -l message -d 'History message' -r
1312
1360
  complete -c pm -n '__fish_seen_subcommand_from update' -l force -d 'Force override'
1361
+ ${fishUpdateRuntimeFieldFlags}
1313
1362
 
1314
1363
  # update-many flags
1315
- complete -c pm -n '__fish_seen_subcommand_from update-many' -l filter-status -d 'Filter by status before applying updates' -r -a 'draft open in_progress blocked closed canceled'
1364
+ complete -c pm -n '__fish_seen_subcommand_from update-many' -l filter-status -d 'Filter by status before applying updates' -r -a '${statusChoices}'
1316
1365
  complete -c pm -n '__fish_seen_subcommand_from update-many' -l filter-type -d 'Filter by type before applying updates' -r -a '${typeChoices}'
1317
1366
  complete -c pm -n '__fish_seen_subcommand_from update-many' -l filter-tag -d 'Filter by tag before applying updates' -r -a ${fishTagChoices}
1318
1367
  complete -c pm -n '__fish_seen_subcommand_from update-many' -l filter-priority -d 'Filter by priority before applying updates' -r -a '0 1 2 3 4'
@@ -1390,9 +1439,10 @@ complete -c pm -n '__fish_seen_subcommand_from update-many' -l allow-audit-updat
1390
1439
  complete -c pm -n '__fish_seen_subcommand_from update-many' -l author -d 'Mutation author' -r
1391
1440
  complete -c pm -n '__fish_seen_subcommand_from update-many' -l message -d 'History message' -r
1392
1441
  complete -c pm -n '__fish_seen_subcommand_from update-many' -l force -d 'Force override'
1442
+ ${fishUpdateManyRuntimeFieldFlags}
1393
1443
 
1394
1444
  # normalize flags
1395
- complete -c pm -n '__fish_seen_subcommand_from normalize' -l filter-status -d 'Filter by status before planning or apply' -r -a 'draft open in_progress blocked closed canceled'
1445
+ complete -c pm -n '__fish_seen_subcommand_from normalize' -l filter-status -d 'Filter by status before planning or apply' -r -a '${statusChoices}'
1396
1446
  complete -c pm -n '__fish_seen_subcommand_from normalize' -l filter-type -d 'Filter by type before planning or apply' -r -a '${typeChoices}'
1397
1447
  complete -c pm -n '__fish_seen_subcommand_from normalize' -l filter-tag -d 'Filter by tag before planning or apply' -r -a ${fishTagChoices}
1398
1448
  complete -c pm -n '__fish_seen_subcommand_from normalize' -l filter-priority -d 'Filter by priority before planning or apply' -r -a '0 1 2 3 4'
@@ -1419,6 +1469,7 @@ complete -c pm -n '__fish_seen_subcommand_from search' -l limit -d 'Max
1419
1469
  complete -c pm -n '__fish_seen_subcommand_from search' -l type -d 'Filter by type' -r -a '${typeChoices}'
1420
1470
  complete -c pm -n '__fish_seen_subcommand_from search' -l tag -d 'Filter by tag' -r -a ${fishTagChoices}
1421
1471
  complete -c pm -n '__fish_seen_subcommand_from search' -l priority -d 'Filter by priority' -r -a '0 1 2 3 4'
1472
+ ${fishSearchRuntimeFieldFlags}
1422
1473
 
1423
1474
  # calendar flags
1424
1475
  complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l view -d 'Calendar view' -r -a 'agenda day week month'
@@ -1430,7 +1481,7 @@ complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l full-period -d '
1430
1481
  complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l type -d 'Filter by type' -r -a '${typeChoices}'
1431
1482
  complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l tag -d 'Filter by tag' -r -a ${fishTagChoices}
1432
1483
  complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l priority -d 'Filter by priority' -r -a '0 1 2 3 4'
1433
- complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l status -d 'Filter by status' -r -a 'draft open in_progress blocked closed canceled'
1484
+ complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l status -d 'Filter by status' -r -a '${statusChoices}'
1434
1485
  complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l assignee -d 'Filter by assignee' -r
1435
1486
  complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l assignee-filter -d 'Filter assignee presence' -r -a 'assigned unassigned'
1436
1487
  complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l sprint -d 'Filter by sprint' -r
@@ -1441,6 +1492,7 @@ complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l recurrence-lookb
1441
1492
  complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l occurrence-limit -d 'Cap occurrences per recurring event' -r
1442
1493
  complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l limit -d 'Limit returned events' -r
1443
1494
  complete -c pm -n '__fish_seen_subcommand_from calendar cal' -l format -d 'Output override' -r -a 'markdown toon json'
1495
+ ${fishCalendarRuntimeFieldFlags}
1444
1496
 
1445
1497
  # context flags
1446
1498
  complete -c pm -n '__fish_seen_subcommand_from context ctx' -l date -d 'Anchor date/time (ISO/date string or relative)' -r
@@ -1456,6 +1508,7 @@ complete -c pm -n '__fish_seen_subcommand_from context ctx' -l sprint -d 'Fil
1456
1508
  complete -c pm -n '__fish_seen_subcommand_from context ctx' -l release -d 'Filter by release' -r
1457
1509
  complete -c pm -n '__fish_seen_subcommand_from context ctx' -l limit -d 'Limit focus and agenda rows per section' -r
1458
1510
  complete -c pm -n '__fish_seen_subcommand_from context ctx' -l format -d 'Output override' -r -a 'markdown toon json'
1511
+ ${fishContextRuntimeFieldFlags}
1459
1512
 
1460
1513
  # guide flags
1461
1514
  complete -c pm -n '__fish_seen_subcommand_from guide' -l list -d 'Show guide topic index'
@@ -1652,7 +1705,7 @@ complete -c pm -n '__fish_seen_subcommand_from health' -l brief -d 'Emit compact
1652
1705
  complete -c pm -n '__fish_seen_subcommand_from health' -l summary -d 'Emit one-line-style health status with check names and warning count'
1653
1706
  complete -c pm -n '__fish_seen_subcommand_from health' -l strict-exit -d 'Return non-zero exit when health warnings are present'
1654
1707
  complete -c pm -n '__fish_seen_subcommand_from health' -l fail-on-warn -d 'Alias for --strict-exit'
1655
- complete -c pm -n '__fish_seen_subcommand_from comments-audit' -l status -d 'Filter by item status' -r -a 'draft open in_progress blocked closed canceled'
1708
+ complete -c pm -n '__fish_seen_subcommand_from comments-audit' -l status -d 'Filter by item status' -r -a '${statusChoices}'
1656
1709
  complete -c pm -n '__fish_seen_subcommand_from comments-audit' -l type -d 'Filter by item type' -r -a '${typeChoices}'
1657
1710
  complete -c pm -n '__fish_seen_subcommand_from comments-audit' -l tag -d 'Filter by tag' -r -a ${fishTagChoices}
1658
1711
  complete -c pm -n '__fish_seen_subcommand_from comments-audit' -l priority -d 'Filter by priority' -r -a '0 1 2 3 4'
@@ -1717,10 +1770,10 @@ export function runCompletion(shell, itemTypes = DEFAULT_ITEM_TYPES, tags = [],
1717
1770
  script = generateBashScript(itemTypes, tags, eagerTagExpansion, runtime);
1718
1771
  }
1719
1772
  else if (validShell === "zsh") {
1720
- script = generateZshScript(itemTypes, tags, eagerTagExpansion);
1773
+ script = generateZshScript(itemTypes, tags, eagerTagExpansion, runtime);
1721
1774
  }
1722
1775
  else {
1723
- script = generateFishScript(itemTypes, tags, eagerTagExpansion);
1776
+ script = generateFishScript(itemTypes, tags, eagerTagExpansion, runtime);
1724
1777
  }
1725
1778
  return {
1726
1779
  shell: validShell,
@@ -1729,4 +1782,4 @@ export function runCompletion(shell, itemTypes = DEFAULT_ITEM_TYPES, tags = [],
1729
1782
  };
1730
1783
  }
1731
1784
  //# sourceMappingURL=completion.js.map
1732
- //# debugId=ab5654d4-0aa0-5942-9f7e-b0cf2c952ea8
1785
+ //# debugId=b3284398-1103-5eb4-9c3d-028c20dfa304