@unbrained/pm-cli 2026.9.7 → 2026.9.8

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 (718) hide show
  1. package/.agents/skills/pm-developer/SKILL.md +12 -4
  2. package/.agents/skills/pm-developer/references/MULTI_AGENT_MERGE.md +19 -10
  3. package/.agents/skills/pm-extensions/SKILL.md +6 -0
  4. package/.agents/skills/pm-sdk/SKILL.md +11 -2
  5. package/.agents/skills/pm-user/SKILL.md +5 -0
  6. package/.agents/skills/pm-user/references/ECOSYSTEM_PLANNING.md +95 -0
  7. package/.claude-plugin/marketplace.json +2 -2
  8. package/CHANGELOG.md +211 -181
  9. package/dist/cli/after-command-context-usage.js +1 -48
  10. package/dist/cli/argv-utils.js +1 -40
  11. package/dist/cli/bootstrap-args.js +1 -9
  12. package/dist/cli/bundle-integrity.js +2 -110
  13. package/dist/cli/commander-usage.js +11 -771
  14. package/dist/cli/commands/activity.js +1 -9
  15. package/dist/cli/commands/aggregate.js +1 -5
  16. package/dist/cli/commands/append.js +1 -5
  17. package/dist/cli/commands/claim.js +1 -5
  18. package/dist/cli/commands/close-many.js +1 -5
  19. package/dist/cli/commands/close.js +1 -9
  20. package/dist/cli/commands/comments.js +1 -5
  21. package/dist/cli/commands/config.js +1 -9
  22. package/dist/cli/commands/context.js +1 -9
  23. package/dist/cli/commands/contracts.js +1 -5
  24. package/dist/cli/commands/copy.js +1 -9
  25. package/dist/cli/commands/create.js +1 -9
  26. package/dist/cli/commands/delete.js +1 -9
  27. package/dist/cli/commands/deps.js +1 -9
  28. package/dist/cli/commands/docs.js +1 -9
  29. package/dist/cli/commands/duplicates.js +1 -9
  30. package/dist/cli/commands/eval.js +1 -9
  31. package/dist/cli/commands/extension/describe.js +1 -5
  32. package/dist/cli/commands/extension/scaffold.js +1 -5
  33. package/dist/cli/commands/extension/shared.js +1 -5
  34. package/dist/cli/commands/extension.js +1 -9
  35. package/dist/cli/commands/files.js +1 -9
  36. package/dist/cli/commands/focus.js +1 -9
  37. package/dist/cli/commands/gc.js +1 -9
  38. package/dist/cli/commands/get.js +1 -9
  39. package/dist/cli/commands/graph.js +1 -10
  40. package/dist/cli/commands/health.js +1 -9
  41. package/dist/cli/commands/history-compact.js +1 -10
  42. package/dist/cli/commands/history-redact.js +1 -11
  43. package/dist/cli/commands/history-repair.js +1 -10
  44. package/dist/cli/commands/history.js +1 -5
  45. package/dist/cli/commands/index.js +1 -58
  46. package/dist/cli/commands/init-agent-guidance.js +1 -9
  47. package/dist/cli/commands/init.js +1 -9
  48. package/dist/cli/commands/learnings.js +1 -5
  49. package/dist/cli/commands/lifecycle-transitions.js +1 -5
  50. package/dist/cli/commands/list.js +1 -9
  51. package/dist/cli/commands/merge.js +1 -11
  52. package/dist/cli/commands/next.js +1 -9
  53. package/dist/cli/commands/notes.js +1 -5
  54. package/dist/cli/commands/plan.js +1 -9
  55. package/dist/cli/commands/profile.js +1 -9
  56. package/dist/cli/commands/restore.js +1 -9
  57. package/dist/cli/commands/scheduling-shortcuts.js +1 -9
  58. package/dist/cli/commands/schema.js +1 -10
  59. package/dist/cli/commands/search.js +1 -9
  60. package/dist/cli/commands/stats.js +1 -9
  61. package/dist/cli/commands/telemetry.js +1 -9
  62. package/dist/cli/commands/test-all.js +1 -9
  63. package/dist/cli/commands/test-runs.js +1 -9
  64. package/dist/cli/commands/test.js +1 -9
  65. package/dist/cli/commands/update-many.js +1 -5
  66. package/dist/cli/commands/update.js +1 -9
  67. package/dist/cli/commands/upgrade.js +1 -5
  68. package/dist/cli/commands/validate.js +1 -15
  69. package/dist/cli/context-intent-invocation.js +1 -20
  70. package/dist/cli/description-stdin.js +1 -17
  71. package/dist/cli/error-guidance.js +1 -1353
  72. package/dist/cli/extension-command-help.js +5 -636
  73. package/dist/cli/extension-command-options.js +1 -427
  74. package/dist/cli/extension-recovery.js +1 -126
  75. package/dist/cli/help-content.js +2 -1001
  76. package/dist/cli/help-json-payload.js +4 -570
  77. package/dist/cli/main.d.ts +4 -0
  78. package/dist/cli/main.js +5 -2573
  79. package/dist/cli/migration-gates.js +1 -289
  80. package/dist/cli/public.js +1 -20
  81. package/dist/cli/register-annotations.js +1 -270
  82. package/dist/cli/register-assurance.js +1 -62
  83. package/dist/cli/register-files-lookup.js +1 -56
  84. package/dist/cli/register-history-activity.d.ts +8 -0
  85. package/dist/cli/register-history-activity.js +2 -0
  86. package/dist/cli/register-history-author.js +1 -38
  87. package/dist/cli/register-history-maintenance.d.ts +9 -0
  88. package/dist/cli/register-history-maintenance.js +2 -0
  89. package/dist/cli/register-list-query.js +10 -943
  90. package/dist/cli/register-mutation-options.js +1 -9
  91. package/dist/cli/register-mutation.js +19 -1893
  92. package/dist/cli/register-operations.js +1 -920
  93. package/dist/cli/register-setup.js +1 -716
  94. package/dist/cli/register-structured-mutation.js +1 -196
  95. package/dist/cli/registration-helpers.js +1 -5
  96. package/dist/cli/runtime-compatibility-boundary.js +4 -42
  97. package/dist/cli/schema-registration-helpers.js +1 -73
  98. package/dist/cli/search-refresh.js +1 -13
  99. package/dist/cli/stats-analytics-json.js +1 -68
  100. package/dist/cli/telemetry-flush.js +1 -10
  101. package/dist/cli-bundle/bundle-manifest.json +164 -156
  102. package/dist/cli-bundle/chunks/chunk-3BZZA6A3.js +5 -0
  103. package/dist/cli-bundle/chunks/chunk-AMRDVX36.js +235 -0
  104. package/dist/cli-bundle/chunks/chunk-DAM4CBBR.js +2202 -0
  105. package/dist/cli-bundle/chunks/{chunk-WYRZZ5ZE.js → chunk-DEZPZOQ7.js} +2 -2
  106. package/dist/cli-bundle/chunks/chunk-FLDWYEND.js +77 -0
  107. package/dist/cli-bundle/chunks/{chunk-NPN5I67J.js → chunk-G5ADGQ2D.js} +3 -3
  108. package/dist/cli-bundle/chunks/chunk-JAAEYHUA.js +2 -0
  109. package/dist/cli-bundle/chunks/{chunk-JX4DH4WC.js → chunk-KR3RP4FH.js} +3 -3
  110. package/dist/cli-bundle/chunks/chunk-LEZOUXG6.js +2 -0
  111. package/dist/cli-bundle/chunks/chunk-NSAPNEYH.js +2 -0
  112. package/dist/cli-bundle/chunks/chunk-QOEKOECV.js +29 -0
  113. package/dist/cli-bundle/chunks/chunk-RHSFOMHU.js +2 -0
  114. package/dist/cli-bundle/chunks/chunk-XOD2PCB6.js +20 -0
  115. package/dist/cli-bundle/chunks/{chunk-JT6XF6GE.js → chunk-YVEQ2AMO.js} +4 -4
  116. package/dist/cli-bundle/chunks/register-list-query-KSK3R63M.js +11 -0
  117. package/dist/cli-bundle/chunks/register-mutation-IQ5C7U6O.js +20 -0
  118. package/dist/cli-bundle/chunks/{register-operations-I5W3KMGB.js → register-operations-DWVHR2NC.js} +2 -2
  119. package/dist/cli-bundle/chunks/register-setup-BQ5SVD4B.js +2 -0
  120. package/dist/cli-bundle/focused-chunks/chunk-3WRPWLA7.js +3 -0
  121. package/dist/cli-bundle/focused-chunks/chunk-7MBUII7U.js +2 -0
  122. package/dist/cli-bundle/focused-chunks/chunk-COPBO5HW.js +8 -0
  123. package/dist/cli-bundle/focused-chunks/chunk-DUN4IXYN.js +20 -0
  124. package/dist/cli-bundle/focused-chunks/{chunk-LIJIA4TY.js → chunk-EE5QSM4Z.js} +3 -3
  125. package/dist/cli-bundle/focused-chunks/chunk-HJVARYM3.js +6 -0
  126. package/dist/cli-bundle/focused-chunks/chunk-IAUOUGVR.js +177 -0
  127. package/dist/cli-bundle/focused-chunks/chunk-KOOMJ54F.js +2 -0
  128. package/dist/cli-bundle/focused-chunks/chunk-MZDXX7JY.js +56 -0
  129. package/dist/cli-bundle/focused-chunks/{chunk-M6PBRFSH.js → chunk-OPFHFGDD.js} +2 -2
  130. package/dist/cli-bundle/focused-chunks/chunk-QHNETP77.js +9 -0
  131. package/dist/cli-bundle/focused-chunks/{chunk-3BZEOXLT.js → chunk-RMWES4M6.js} +2 -2
  132. package/dist/cli-bundle/focused-chunks/chunk-RXT4P5QH.js +10 -0
  133. package/dist/cli-bundle/focused-chunks/chunk-SDOL6FM2.js +12 -0
  134. package/dist/cli-bundle/focused-chunks/chunk-SQV4AAUC.js +2 -0
  135. package/dist/cli-bundle/focused-chunks/{chunk-PEFABF7E.js → chunk-WE3IUNIW.js} +3 -3
  136. package/dist/cli-bundle/focused-chunks/chunk-YALOUBWJ.js +2 -0
  137. package/dist/cli-bundle/main.js +20 -20
  138. package/dist/cli-bundle/sdk-authoring.js +1 -1
  139. package/dist/cli-bundle/sdk-contracts.js +2 -2
  140. package/dist/cli-bundle/sdk-core.js +29 -29
  141. package/dist/cli-bundle/sdk-governance.js +1 -1
  142. package/dist/cli-bundle/sdk-graph.js +1 -1
  143. package/dist/cli-bundle/sdk-merge.js +42 -42
  144. package/dist/cli-bundle/sdk-query.js +1 -1
  145. package/dist/cli-bundle/sdk-runtime.js +1 -1
  146. package/dist/cli-bundle/sdk-testing.js +1 -1
  147. package/dist/cli-bundle/sdk.js +11 -11
  148. package/dist/cli.js +1 -104
  149. package/dist/core/checkpoint/checkpoint-gc.js +1 -169
  150. package/dist/core/checkpoint/mutation-checkpoint.js +2 -133
  151. package/dist/core/config/nested-settings.js +1 -534
  152. package/dist/core/config/positional-value.js +1 -109
  153. package/dist/core/diagnostics/remediation.js +1 -506
  154. package/dist/core/extensions/activation-summary-markdown.js +2 -145
  155. package/dist/core/extensions/activation-summary.js +1 -92
  156. package/dist/core/extensions/activation-transaction.js +1 -46
  157. package/dist/core/extensions/capability-usage.js +1 -173
  158. package/dist/core/extensions/command-hook-context.js +1 -13
  159. package/dist/core/extensions/command-metadata-contract.js +1 -22
  160. package/dist/core/extensions/command-visibility-tier.js +1 -29
  161. package/dist/core/extensions/contribution-inventory.js +1 -173
  162. package/dist/core/extensions/exporter-output-contract.js +1 -66
  163. package/dist/core/extensions/extension-candidate.js +1 -18
  164. package/dist/core/extensions/extension-capability-aliases.js +1 -158
  165. package/dist/core/extensions/extension-hook-runtime.js +1 -699
  166. package/dist/core/extensions/extension-policy.js +1 -599
  167. package/dist/core/extensions/extension-registries.js +1 -62
  168. package/dist/core/extensions/extension-runtime-helpers.js +1 -33
  169. package/dist/core/extensions/extension-types.js +1 -102
  170. package/dist/core/extensions/flag-definition-validation.js +1 -52
  171. package/dist/core/extensions/flag-value-types.js +1 -64
  172. package/dist/core/extensions/index.js +1 -526
  173. package/dist/core/extensions/item-field-types.js +1 -39
  174. package/dist/core/extensions/item-fields.js +1 -261
  175. package/dist/core/extensions/loader.js +1 -2223
  176. package/dist/core/extensions/manifest-schema.js +1 -69
  177. package/dist/core/extensions/module-graph-snapshot.js +1 -33
  178. package/dist/core/extensions/preflight-ownership.js +1 -41
  179. package/dist/core/extensions/registration-validation.js +1 -82
  180. package/dist/core/extensions/registration-values.js +1 -209
  181. package/dist/core/extensions/reserved-host-flags.js +1 -36
  182. package/dist/core/extensions/runtime-registrations.js +1 -67
  183. package/dist/core/extensions/service-ownership.js +1 -19
  184. package/dist/core/extensions/version-compat.js +1 -216
  185. package/dist/core/fs/fs-utils.js +2 -158
  186. package/dist/core/fs/host-environment-errors.js +1 -141
  187. package/dist/core/fs/index.js +1 -9
  188. package/dist/core/fs/path-utils.js +1 -17
  189. package/dist/core/governance/content-fields.js +1 -160
  190. package/dist/core/governance/issue-codes.js +1 -151
  191. package/dist/core/governance/metadata-coverage.js +1 -358
  192. package/dist/core/history/drift-cache.js +3 -72
  193. package/dist/core/history/drift-scan.js +1 -342
  194. package/dist/core/history/event-classification.js +1 -109
  195. package/dist/core/history/event-index.js +8 -784
  196. package/dist/core/history/history-compact-bulk.js +1 -104
  197. package/dist/core/history/history-diff.js +1 -158
  198. package/dist/core/history/history-rewrite.d.ts +6 -1
  199. package/dist/core/history/history-rewrite.js +1 -107
  200. package/dist/core/history/history-storage-stats.js +1 -102
  201. package/dist/core/history/history-stream-policy.js +1 -62
  202. package/dist/core/history/history.js +2 -617
  203. package/dist/core/history/identity.js +1 -30
  204. package/dist/core/history/index.js +1 -9
  205. package/dist/core/history/projection.js +1 -196
  206. package/dist/core/history/read.d.ts +9 -0
  207. package/dist/core/history/read.js +1 -57
  208. package/dist/core/history/replay.js +2 -439
  209. package/dist/core/history/version-address.js +1 -32
  210. package/dist/core/history/workspace-history.js +2 -433
  211. package/dist/core/io/body-file.js +1 -62
  212. package/dist/core/io/bulk-ids-input.js +1 -112
  213. package/dist/core/item/actionability.js +1 -327
  214. package/dist/core/item/dependency-reference.js +1 -20
  215. package/dist/core/item/id.js +1 -112
  216. package/dist/core/item/index.js +1 -12
  217. package/dist/core/item/item-format-version.js +1 -78
  218. package/dist/core/item/item-format.js +5 -1473
  219. package/dist/core/item/item-record.js +1 -23
  220. package/dist/core/item/item-type-definition.js +1 -133
  221. package/dist/core/item/parent-reference-policy.js +1 -57
  222. package/dist/core/item/parse.js +2 -603
  223. package/dist/core/item/plan-lifecycle.js +1 -19
  224. package/dist/core/item/priority.js +1 -61
  225. package/dist/core/item/sprint-release-format.js +1 -38
  226. package/dist/core/item/status-filter.js +1 -115
  227. package/dist/core/item/status.js +1 -43
  228. package/dist/core/item/toon-decode.js +1 -29
  229. package/dist/core/item/type-registry.js +1 -715
  230. package/dist/core/item/type-synonyms.js +1 -38
  231. package/dist/core/lock/index.js +1 -9
  232. package/dist/core/lock/lock-gc.js +1 -240
  233. package/dist/core/lock/lock.js +3 -590
  234. package/dist/core/output/mutation-projection.js +1 -217
  235. package/dist/core/output/output-control.js +1 -25
  236. package/dist/core/output/output.js +11 -494
  237. package/dist/core/output/query-summary.js +1 -58
  238. package/dist/core/output/tabular.js +1 -77
  239. package/dist/core/packages/manifest.js +1 -244
  240. package/dist/core/packages/root.js +1 -84
  241. package/dist/core/profile/profile-describe.js +1 -83
  242. package/dist/core/profile/profile-lint.js +1 -415
  243. package/dist/core/profile/profile-plan.js +0 -0
  244. package/dist/core/profile/profile-presets.js +1 -370
  245. package/dist/core/reproducibility/context.js +1 -82
  246. package/dist/core/schema/fields-file.js +2 -288
  247. package/dist/core/schema/item-types-file.js +2 -296
  248. package/dist/core/schema/runtime-field-filters.js +1 -49
  249. package/dist/core/schema/runtime-field-values.js +1 -313
  250. package/dist/core/schema/runtime-schema.js +2 -826
  251. package/dist/core/schema/status-defs-file.js +2 -227
  252. package/dist/core/schema/status-token.js +1 -31
  253. package/dist/core/schema/type-inference.js +1 -95
  254. package/dist/core/schema/type-presets.js +1 -87
  255. package/dist/core/schema/type-workflows.js +1 -104
  256. package/dist/core/search/background-refresh.js +2 -286
  257. package/dist/core/search/bm25.js +1 -146
  258. package/dist/core/search/cache.js +2 -534
  259. package/dist/core/search/corpus.js +1 -311
  260. package/dist/core/search/embedding-batches.js +1 -163
  261. package/dist/core/search/eval.js +1 -225
  262. package/dist/core/search/http-client.js +1 -75
  263. package/dist/core/search/providers.js +1 -242
  264. package/dist/core/search/relevance.js +1 -244
  265. package/dist/core/search/semantic-defaults.js +1 -199
  266. package/dist/core/search/staleness.js +1 -30
  267. package/dist/core/search/vector-stores.js +2 -664
  268. package/dist/core/search/vectorization-metadata.js +1 -81
  269. package/dist/core/sentry/helpers.js +1 -272
  270. package/dist/core/sentry/instrument.js +1 -387
  271. package/dist/core/session/session-state.js +1 -260
  272. package/dist/core/shared/agent-session-context.js +1 -133
  273. package/dist/core/shared/author.js +1 -1172
  274. package/dist/core/shared/command-types.js +1 -4
  275. package/dist/core/shared/conflict-markers.js +1 -31
  276. package/dist/core/shared/constants.js +1 -405
  277. package/dist/core/shared/errors.js +1 -20
  278. package/dist/core/shared/html-entity-decode.js +1 -131
  279. package/dist/core/shared/index.js +1 -12
  280. package/dist/core/shared/item-metadata-contract.js +1 -89
  281. package/dist/core/shared/lazy-module.js +1 -16
  282. package/dist/core/shared/levenshtein.js +1 -61
  283. package/dist/core/shared/memo.js +1 -19
  284. package/dist/core/shared/numeric-parsers.js +1 -20
  285. package/dist/core/shared/option-alias-visibility.js +1 -67
  286. package/dist/core/shared/primitives.js +1 -127
  287. package/dist/core/shared/serial-queue.js +1 -79
  288. package/dist/core/shared/serialization.js +1 -210
  289. package/dist/core/shared/split-comma-list.js +1 -30
  290. package/dist/core/shared/text-normalization.js +1 -38
  291. package/dist/core/shared/time.js +1 -306
  292. package/dist/core/store/index.js +1 -12
  293. package/dist/core/store/item-format-migration.js +1 -125
  294. package/dist/core/store/item-metadata-cache.js +1 -1116
  295. package/dist/core/store/item-metadata-query-index.js +9 -394
  296. package/dist/core/store/item-metadata-read-work.js +1 -43
  297. package/dist/core/store/item-store.js +1 -693
  298. package/dist/core/store/paths.d.ts +1 -1
  299. package/dist/core/store/paths.js +1 -214
  300. package/dist/core/store/settings-read-cache.js +1 -85
  301. package/dist/core/store/settings-validator.js +1 -421
  302. package/dist/core/store/settings.js +3 -1309
  303. package/dist/core/store/tracker-preflight.js +1 -141
  304. package/dist/core/telemetry/consent.js +5 -108
  305. package/dist/core/telemetry/observability.js +1 -246
  306. package/dist/core/telemetry/runtime.js +4 -1988
  307. package/dist/core/test/background-runs.js +4 -945
  308. package/dist/core/test/item-test-run-tracking.js +1 -63
  309. package/dist/core/test/run-selectors.js +1 -120
  310. package/dist/core/validate/estimate-defaults.js +1 -89
  311. package/dist/core/validate/fix-planning.js +1 -189
  312. package/dist/core/validate/linked-artifact-reference.js +1 -36
  313. package/dist/core/validate/missing-by-type.js +1 -34
  314. package/dist/core/validate/missing-link-owners.js +1 -95
  315. package/dist/core/validate/stale-file-classification.js +1 -82
  316. package/dist/mcp/http-server.js +5 -448
  317. package/dist/mcp/legacy-adapter.js +1 -77
  318. package/dist/mcp/runtime-capabilities.js +1 -200
  319. package/dist/mcp/server.js +4 -1233
  320. package/dist/mcp/tool-definitions.js +1 -804
  321. package/dist/sdk/actionability.js +1 -13
  322. package/dist/sdk/agent/closed-domain-contracts.js +1 -161
  323. package/dist/sdk/agent/command-recovery.js +1 -59
  324. package/dist/sdk/agent/command-suggestions.js +1 -66
  325. package/dist/sdk/agent/create-option-policy.js +1 -31
  326. package/dist/sdk/agent/identity-config.js +1 -106
  327. package/dist/sdk/agent/item-addressing.js +1 -207
  328. package/dist/sdk/agent/refusal-closure-census.js +1 -151
  329. package/dist/sdk/agent/refusal-closure.js +1 -133
  330. package/dist/sdk/agent/refusal-corpus-contracts.js +1 -193
  331. package/dist/sdk/agent/refusal-reachability.js +1 -593
  332. package/dist/sdk/agent/subcommand-recovery.js +1 -83
  333. package/dist/sdk/agent/task-transcript-contracts.js +1 -197
  334. package/dist/sdk/agent/tracker-preflight-contracts.js +1 -126
  335. package/dist/sdk/agent-capability-contracts.js +1 -428
  336. package/dist/sdk/agent-session-context.js +1 -9
  337. package/dist/sdk/annotations.js +1 -448
  338. package/dist/sdk/author-attribution.js +1 -468
  339. package/dist/sdk/authoring.js +1 -20
  340. package/dist/sdk/cli-bootstrap.js +1 -838
  341. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +1 -1
  342. package/dist/sdk/cli-contracts/agent-output-contracts.js +4 -476
  343. package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -79
  344. package/dist/sdk/cli-contracts/command-aliases.d.ts +4 -0
  345. package/dist/sdk/cli-contracts/command-aliases.js +1 -107
  346. package/dist/sdk/cli-contracts/command-exit-contracts.js +1 -151
  347. package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1081
  348. package/dist/sdk/cli-contracts/commander-types.js +1 -159
  349. package/dist/sdk/cli-contracts/completeness.js +1 -393
  350. package/dist/sdk/cli-contracts/enum-contracts.js +1 -222
  351. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1947
  352. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -347
  353. package/dist/sdk/cli-contracts/grammar-contracts.js +1 -986
  354. package/dist/sdk/cli-contracts/registration-helpers.js +7 -990
  355. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +5 -0
  356. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -2090
  357. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +1 -324
  358. package/dist/sdk/cli-contracts/string-lists.js +1 -16
  359. package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -461
  360. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -2167
  361. package/dist/sdk/cli-contracts/tool-schema.d.ts +3 -1
  362. package/dist/sdk/cli-contracts/tool-schema.js +1 -1664
  363. package/dist/sdk/cli-contracts/typed-action-inputs.js +1 -4
  364. package/dist/sdk/cli-contracts.d.ts +1 -1
  365. package/dist/sdk/cli-contracts.js +1 -17
  366. package/dist/sdk/cli-program.js +1 -49
  367. package/dist/sdk/command-line.d.ts +2 -5
  368. package/dist/sdk/command-line.js +1 -78
  369. package/dist/sdk/comments.js +1 -133
  370. package/dist/sdk/compile-cache.js +1 -73
  371. package/dist/sdk/completion.js +157 -837
  372. package/dist/sdk/compose.js +1 -1090
  373. package/dist/sdk/config.js +1 -1204
  374. package/dist/sdk/context/recency.js +1 -33
  375. package/dist/sdk/context/semantic-session-attribution.js +1 -82
  376. package/dist/sdk/context/usage-egress.js +1 -29
  377. package/dist/sdk/context/usage-ledger.js +3 -185
  378. package/dist/sdk/context-intent-contracts.js +1 -709
  379. package/dist/sdk/context-intent-runtime.js +1 -115
  380. package/dist/sdk/context-packing.js +1 -218
  381. package/dist/sdk/context-relevance.js +1 -503
  382. package/dist/sdk/context-signal-store.js +2 -426
  383. package/dist/sdk/context-usage.js +1 -367
  384. package/dist/sdk/contracts.js +1 -23
  385. package/dist/sdk/core-governance.js +1 -14
  386. package/dist/sdk/core.js +1 -14
  387. package/dist/sdk/corpus-shape.js +1 -401
  388. package/dist/sdk/define.js +1 -220
  389. package/dist/sdk/dependencies.js +1 -718
  390. package/dist/sdk/dependency-flag-validation.js +1 -156
  391. package/dist/sdk/dependency-provenance.js +1 -135
  392. package/dist/sdk/docs.js +1 -14
  393. package/dist/sdk/duplicates.js +1 -40
  394. package/dist/sdk/environment/agent-environment.js +1 -466
  395. package/dist/sdk/environment/host-environment-errors.js +1 -8
  396. package/dist/sdk/environment/project-runtime-compatibility.js +1 -481
  397. package/dist/sdk/environment/source-context.js +1 -28
  398. package/dist/sdk/environment/tracker-preflight.js +1 -9
  399. package/dist/sdk/error-code-catalog.js +1 -153
  400. package/dist/sdk/error-runtime.js +1 -58
  401. package/dist/sdk/errors.js +1 -58
  402. package/dist/sdk/eval.js +1 -190
  403. package/dist/sdk/extension/author-manifest.js +1 -92
  404. package/dist/sdk/extension/bundled-catalog.js +1 -332
  405. package/dist/sdk/extension/concurrency.js +1 -25
  406. package/dist/sdk/extension/copy-scope.d.ts +2 -0
  407. package/dist/sdk/extension/copy-scope.js +2 -0
  408. package/dist/sdk/extension/custom-field-collisions.js +1 -30
  409. package/dist/sdk/extension/describe.js +3 -189
  410. package/dist/sdk/extension/doctor.js +1 -606
  411. package/dist/sdk/extension/install-plan.d.ts +69 -0
  412. package/dist/sdk/extension/install-plan.js +2 -0
  413. package/dist/sdk/extension/install-receipts.d.ts +7 -0
  414. package/dist/sdk/extension/install-receipts.js +2 -0
  415. package/dist/sdk/extension/install-runtime.js +3 -313
  416. package/dist/sdk/extension/install-snapshot.js +1 -66
  417. package/dist/sdk/extension/install-sources.js +5 -1057
  418. package/dist/sdk/extension/managed-state.js +2 -252
  419. package/dist/sdk/extension/migrations.js +2 -174
  420. package/dist/sdk/extension/output-ownership.js +1 -25
  421. package/dist/sdk/extension/runtime-summary.js +1 -18
  422. package/dist/sdk/extension/scaffold.js +4 -2308
  423. package/dist/sdk/extension/shared.js +1 -147
  424. package/dist/sdk/extension/source-resolution.js +1 -65
  425. package/dist/sdk/extension/update-check.js +1 -67
  426. package/dist/sdk/extension-command-context.js +1 -44
  427. package/dist/sdk/extension-contracts.js +1 -73
  428. package/dist/sdk/extension.d.ts +7 -2
  429. package/dist/sdk/extension.js +1 -2196
  430. package/dist/sdk/files.js +1 -535
  431. package/dist/sdk/flag-invocation-contracts.d.ts +0 -5
  432. package/dist/sdk/flag-invocation-contracts.js +1 -344
  433. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -2224
  434. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -2236
  435. package/dist/sdk/generated-error-code-catalog.js +1 -16
  436. package/dist/sdk/governance/assurance-action-contracts.js +1 -4
  437. package/dist/sdk/governance/assurance-action.js +1 -411
  438. package/dist/sdk/governance/assurance-limits.js +1 -10
  439. package/dist/sdk/governance/assurance-mutation-error.js +1 -81
  440. package/dist/sdk/governance/assurance-presets.js +1 -135
  441. package/dist/sdk/governance/assurance-runtime.js +1 -238
  442. package/dist/sdk/governance/assurance.js +4 -1182
  443. package/dist/sdk/governance/boundary-fixtures.js +1 -200
  444. package/dist/sdk/governance/coverage-assurance.js +1 -60
  445. package/dist/sdk/governance/defect-recurrence-coverage.js +1 -188
  446. package/dist/sdk/governance/defect-recurrence-graph.js +1 -120
  447. package/dist/sdk/governance/defect-recurrence-signals.js +1 -24
  448. package/dist/sdk/governance/defect-recurrence.js +1 -623
  449. package/dist/sdk/governance/extension-host-version.js +1 -115
  450. package/dist/sdk/governance/gc.js +1 -368
  451. package/dist/sdk/governance/health.js +1 -2367
  452. package/dist/sdk/governance/hierarchy-validation.js +1 -108
  453. package/dist/sdk/governance/linked-file-report.js +1 -71
  454. package/dist/sdk/governance/merge-receipt-history.js +1 -206
  455. package/dist/sdk/governance/provenance-health.js +1 -282
  456. package/dist/sdk/governance/reindex.js +4 -761
  457. package/dist/sdk/governance/stale-work.js +1 -82
  458. package/dist/sdk/governance/status-role-diagnostics.js +1 -35
  459. package/dist/sdk/governance/storage-integrity.js +1 -280
  460. package/dist/sdk/governance/tracked-runtime-cache.js +1 -106
  461. package/dist/sdk/governance/upgrade.js +2 -327
  462. package/dist/sdk/governance/validate-history-drift.js +1 -81
  463. package/dist/sdk/governance/validate-item-reader.js +1 -17
  464. package/dist/sdk/governance/validate-normalization.js +1 -36
  465. package/dist/sdk/governance/validate.js +1 -2261
  466. package/dist/sdk/governance/workspace-position.js +1 -163
  467. package/dist/sdk/governance.d.ts +1 -0
  468. package/dist/sdk/governance.js +1 -31
  469. package/dist/sdk/graph/adapter.js +1 -181
  470. package/dist/sdk/graph/analytics.js +1 -474
  471. package/dist/sdk/graph/assembly.js +1 -377
  472. package/dist/sdk/graph/cache.js +1 -160
  473. package/dist/sdk/graph/centrality.js +1 -258
  474. package/dist/sdk/graph/conformance.js +1 -130
  475. package/dist/sdk/graph/deadline-scheduling.d.ts +90 -0
  476. package/dist/sdk/graph/deadline-scheduling.js +2 -0
  477. package/dist/sdk/graph/durable-cache.d.ts +1 -1
  478. package/dist/sdk/graph/durable-cache.js +1 -361
  479. package/dist/sdk/graph/governance-contracts.js +1 -34
  480. package/dist/sdk/graph/governance.d.ts +13 -1
  481. package/dist/sdk/graph/governance.js +1 -735
  482. package/dist/sdk/graph/hierarchy-integrity.js +1 -310
  483. package/dist/sdk/graph/index.d.ts +3 -2
  484. package/dist/sdk/graph/index.js +1 -26
  485. package/dist/sdk/graph/lifecycle-coverage.d.ts +32 -0
  486. package/dist/sdk/graph/lifecycle-coverage.js +2 -0
  487. package/dist/sdk/graph/mutation-advisory.js +1 -176
  488. package/dist/sdk/graph/remediation.js +1 -197
  489. package/dist/sdk/graph/run.d.ts +15 -1
  490. package/dist/sdk/graph/run.js +1 -768
  491. package/dist/sdk/graph/scheduling.js +1 -124
  492. package/dist/sdk/graph/traversal.js +1 -284
  493. package/dist/sdk/graph/workspace-relationship-kind-registry.js +1 -27
  494. package/dist/sdk/graph.js +1 -15
  495. package/dist/sdk/guide-topics.js +1 -707
  496. package/dist/sdk/guide.js +1 -279
  497. package/dist/sdk/history/maintenance.d.ts +71 -0
  498. package/dist/sdk/history/maintenance.js +2 -0
  499. package/dist/sdk/history/salvage.js +2 -247
  500. package/dist/sdk/history/subject.d.ts +19 -0
  501. package/dist/sdk/history/subject.js +2 -0
  502. package/dist/sdk/history-analytics.js +1 -282
  503. package/dist/sdk/history-compact.js +1 -527
  504. package/dist/sdk/history-mcp.js +1 -68
  505. package/dist/sdk/history-provenance.js +1 -182
  506. package/dist/sdk/history-read.js +1 -96
  507. package/dist/sdk/history-redact.d.ts +1 -14
  508. package/dist/sdk/history-redact.js +1 -643
  509. package/dist/sdk/history-repair.d.ts +5 -0
  510. package/dist/sdk/history-repair.js +1 -657
  511. package/dist/sdk/improvement-ledger-validation.js +1 -62
  512. package/dist/sdk/improvement-ledger.js +2 -257
  513. package/dist/sdk/index.d.ts +4 -0
  514. package/dist/sdk/index.js +1 -183
  515. package/dist/sdk/init-agent-guidance.js +2 -496
  516. package/dist/sdk/init.js +2 -820
  517. package/dist/sdk/invocation-author.js +1 -39
  518. package/dist/sdk/item-children.js +1 -90
  519. package/dist/sdk/item-metadata-index.js +1 -15
  520. package/dist/sdk/item-schedule.js +1 -27
  521. package/dist/sdk/item-transaction.js +1 -396
  522. package/dist/sdk/learnings.js +1 -29
  523. package/dist/sdk/lifecycle/append.js +2 -53
  524. package/dist/sdk/lifecycle/claim.d.ts +2 -0
  525. package/dist/sdk/lifecycle/claim.js +1 -242
  526. package/dist/sdk/lifecycle/close-many.js +1 -438
  527. package/dist/sdk/lifecycle/close.js +1 -468
  528. package/dist/sdk/lifecycle/copy.js +1 -212
  529. package/dist/sdk/lifecycle/create.js +1 -1949
  530. package/dist/sdk/lifecycle/delete.js +1 -45
  531. package/dist/sdk/lifecycle/event-validation-messages.js +1 -91
  532. package/dist/sdk/lifecycle/focus.js +1 -91
  533. package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +1 -24
  534. package/dist/sdk/lifecycle/legacy-none-tokens.js +1 -149
  535. package/dist/sdk/lifecycle/lifecycle-transitions.js +1 -40
  536. package/dist/sdk/lifecycle/mcp-actions.d.ts +2 -0
  537. package/dist/sdk/lifecycle/mcp-actions.js +1 -51
  538. package/dist/sdk/lifecycle/metadata-normalizers.js +1 -46
  539. package/dist/sdk/lifecycle/mutation-command-options.js +1 -9
  540. package/dist/sdk/lifecycle/plan.js +1 -1606
  541. package/dist/sdk/lifecycle/recurrence-parsers.js +1 -147
  542. package/dist/sdk/lifecycle/reopen.js +1 -68
  543. package/dist/sdk/lifecycle/repeatable-metadata-parsers.js +1 -143
  544. package/dist/sdk/lifecycle/restore.d.ts +1 -0
  545. package/dist/sdk/lifecycle/restore.js +1 -330
  546. package/dist/sdk/lifecycle/shared-unset-fields.js +1 -295
  547. package/dist/sdk/lifecycle/update-many.js +1 -861
  548. package/dist/sdk/lifecycle/update.js +1 -2136
  549. package/dist/sdk/lifecycle-completion.js +1 -92
  550. package/dist/sdk/lifecycle-policy.js +1 -120
  551. package/dist/sdk/linked-artifacts.js +1 -530
  552. package/dist/sdk/mcp/apps.js +4 -133
  553. package/dist/sdk/mcp/authorization.js +1 -404
  554. package/dist/sdk/mcp/discovery.js +1 -494
  555. package/dist/sdk/mcp/interactions.js +1 -336
  556. package/dist/sdk/mcp/protocol.d.ts +7 -0
  557. package/dist/sdk/mcp/protocol.js +1 -184
  558. package/dist/sdk/mcp/skills.js +1 -389
  559. package/dist/sdk/mcp/subscriptions.js +1 -211
  560. package/dist/sdk/mcp/tasks.js +2 -430
  561. package/dist/sdk/mcp/transport.js +1 -260
  562. package/dist/sdk/merge/abandoned-receipts.js +1 -46
  563. package/dist/sdk/merge/driver.js +1 -212
  564. package/dist/sdk/merge/index.js +1 -16
  565. package/dist/sdk/merge/install.js +3 -561
  566. package/dist/sdk/merge/receipt-file-boundary.js +1 -46
  567. package/dist/sdk/merge/receipt-operation.js +1 -96
  568. package/dist/sdk/merge/receipt-schema.js +1 -397
  569. package/dist/sdk/merge/receipts.js +4 -525
  570. package/dist/sdk/merge/reconcile.js +1 -352
  571. package/dist/sdk/merge/three-way.js +3 -775
  572. package/dist/sdk/merge.js +1 -10
  573. package/dist/sdk/mutation-events.js +1 -292
  574. package/dist/sdk/mutation-guard.js +1 -216
  575. package/dist/sdk/notes.js +1 -139
  576. package/dist/sdk/output-contracts.js +1 -172
  577. package/dist/sdk/output-projection.js +1 -430
  578. package/dist/sdk/output-token-accounting.js +1 -140
  579. package/dist/sdk/output.js +1 -64
  580. package/dist/sdk/ownership-source.js +1 -21
  581. package/dist/sdk/package-import-adapters.js +1 -442
  582. package/dist/sdk/package-migrations.js +1 -20
  583. package/dist/sdk/package-runtime-options.js +1 -80
  584. package/dist/sdk/pagination.js +1 -162
  585. package/dist/sdk/profile.js +1 -454
  586. package/dist/sdk/provenance.js +1 -258
  587. package/dist/sdk/public-surface.json +1 -1
  588. package/dist/sdk/query/activity.js +1 -401
  589. package/dist/sdk/query/aggregate.d.ts +16 -0
  590. package/dist/sdk/query/aggregate.js +1 -390
  591. package/dist/sdk/query/calendar.js +1 -964
  592. package/dist/sdk/query/complete-list.js +1 -215
  593. package/dist/sdk/query/context.js +1 -1702
  594. package/dist/sdk/query/duplicate-candidates.js +1 -70
  595. package/dist/sdk/query/get.js +1 -450
  596. package/dist/sdk/query/history.js +1 -186
  597. package/dist/sdk/query/item-filter-options.js +1 -9
  598. package/dist/sdk/query/light-metadata.js +1 -18
  599. package/dist/sdk/query/list-filter-shared.js +1 -81
  600. package/dist/sdk/query/list.js +1 -1304
  601. package/dist/sdk/query/multi-value-filters.js +1 -78
  602. package/dist/sdk/query/next.js +1 -513
  603. package/dist/sdk/query/parsers.js +1 -44
  604. package/dist/sdk/query/projection-contracts.js +1 -184
  605. package/dist/sdk/query/search-contracts.js +1 -230
  606. package/dist/sdk/query/search-pagination.js +1 -35
  607. package/dist/sdk/query/search-rendering.js +1 -105
  608. package/dist/sdk/query/search.js +2 -1987
  609. package/dist/sdk/query.js +1 -35
  610. package/dist/sdk/read-output/continuation.js +1 -194
  611. package/dist/sdk/read-output-budget.js +1 -135
  612. package/dist/sdk/read-output-contracts.js +1 -1225
  613. package/dist/sdk/read-output-rows.js +1 -186
  614. package/dist/sdk/read-output-session.js +1 -208
  615. package/dist/sdk/relationship-analytics.js +1 -410
  616. package/dist/sdk/relationship-context.js +1 -284
  617. package/dist/sdk/relationship-history.js +4 -519
  618. package/dist/sdk/relationship-kinds/contract.js +1 -22
  619. package/dist/sdk/relationship-migration.js +1 -77
  620. package/dist/sdk/relationships.js +1 -579
  621. package/dist/sdk/reproducibility/process.js +1 -87
  622. package/dist/sdk/runtime-action-aliases.js +1 -59
  623. package/dist/sdk/runtime-extended-actions.js +1 -177
  624. package/dist/sdk/runtime-input.js +1 -614
  625. package/dist/sdk/runtime-primitives.js +1 -84
  626. package/dist/sdk/runtime-public-contracts.js +1 -4
  627. package/dist/sdk/runtime-stats-options.js +1 -38
  628. package/dist/sdk/runtime.js +1 -1928
  629. package/dist/sdk/scheduling-shortcuts.js +1 -63
  630. package/dist/sdk/schema-migration.js +3 -856
  631. package/dist/sdk/schema.js +1 -1376
  632. package/dist/sdk/search-refresh-worker.js +1 -18
  633. package/dist/sdk/similarity-scoring.js +1 -53
  634. package/dist/sdk/similarity.js +1 -326
  635. package/dist/sdk/start-task-status.js +1 -14
  636. package/dist/sdk/stats.js +1 -270
  637. package/dist/sdk/structured-mutations.js +1 -580
  638. package/dist/sdk/telemetry-flush.js +1 -13
  639. package/dist/sdk/telemetry.js +1 -405
  640. package/dist/sdk/templates.js +2 -292
  641. package/dist/sdk/test/batch.js +2 -509
  642. package/dist/sdk/test/entry.js +1 -70
  643. package/dist/sdk/test/execution.js +6 -2211
  644. package/dist/sdk/test/linked-command-detection.js +1 -546
  645. package/dist/sdk/test/measurements.js +1 -91
  646. package/dist/sdk/test/parsers.js +1 -545
  647. package/dist/sdk/test/runs.js +1 -193
  648. package/dist/sdk/test/trust.js +2 -206
  649. package/dist/sdk/testing.js +4 -1391
  650. package/dist/sdk/traceability/runtime-files-lookup.js +1 -32
  651. package/dist/sdk/traceability/source-traceability.js +1 -292
  652. package/dist/sdk/tracker-root-discovery.js +1 -9
  653. package/dist/sdk/workspace-contracts-cache.js +1 -28
  654. package/dist/sdk/workspace-contracts.js +1 -33
  655. package/dist/sdk/workspace-memory.js +2 -318
  656. package/dist/sdk/workspace-recipe.js +1 -71
  657. package/dist/sdk/workspace-snapshot.js +4 -613
  658. package/dist/sdk/workspace-transaction-gc.js +1 -149
  659. package/dist/sdk/workspace-transaction.js +2 -363
  660. package/dist/sdk/workspace.js +3 -127
  661. package/dist/types/index.js +1 -9
  662. package/dist/types.js +1 -245
  663. package/docs/AGENT_GUIDE.md +1 -1
  664. package/docs/CONTEXT_ALGORITHM_PORTFOLIO.md +167 -0
  665. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +9 -3
  666. package/docs/EXTENSIONS.md +1 -0
  667. package/docs/HISTORY_MAINTENANCE.md +125 -0
  668. package/docs/MCP_2026_07_28_CONFORMANCE.md +20 -10
  669. package/docs/PACKAGE_EVIDENCE.md +92 -0
  670. package/docs/PLANNING_MEASUREMENTS.md +183 -0
  671. package/docs/README.md +3 -0
  672. package/docs/SCRIPTING.md +21 -0
  673. package/docs/TESTING.md +23 -0
  674. package/docs/generated/FLAG_LEXICON_BUDGETS.md +5 -5
  675. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +2 -2
  676. package/marketplace.json +2 -2
  677. package/package.json +1 -1
  678. package/packages/pm-beads/package.json +1 -1
  679. package/packages/pm-calendar/package.json +1 -1
  680. package/packages/pm-command-kit/package.json +1 -1
  681. package/packages/pm-digital-twin/package.json +1 -1
  682. package/packages/pm-governance-audit/package.json +1 -1
  683. package/packages/pm-guide-shell/package.json +1 -1
  684. package/packages/pm-kanban/package.json +1 -1
  685. package/packages/pm-lifecycle-hooks/package.json +1 -1
  686. package/packages/pm-linked-test-adapters/package.json +1 -1
  687. package/packages/pm-search-advanced/package.json +1 -1
  688. package/packages/pm-templates/package.json +1 -1
  689. package/packages/pm-todos/package.json +1 -1
  690. package/packages/pm-vcs/package.json +1 -1
  691. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  692. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  693. package/scripts/finalize-build.mjs +45 -3
  694. package/dist/cli-bundle/chunks/chunk-AZDFJGH6.js +0 -9
  695. package/dist/cli-bundle/chunks/chunk-BAX2BYUW.js +0 -2111
  696. package/dist/cli-bundle/chunks/chunk-CKOL5U7J.js +0 -77
  697. package/dist/cli-bundle/chunks/chunk-OF76PSDQ.js +0 -5
  698. package/dist/cli-bundle/chunks/chunk-QUWFABDM.js +0 -232
  699. package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +0 -2
  700. package/dist/cli-bundle/chunks/chunk-RWWBOWJ5.js +0 -2
  701. package/dist/cli-bundle/chunks/chunk-WGAOYSYH.js +0 -40
  702. package/dist/cli-bundle/chunks/chunk-WI2AYPA7.js +0 -2
  703. package/dist/cli-bundle/chunks/register-list-query-5JL52D33.js +0 -11
  704. package/dist/cli-bundle/chunks/register-mutation-ZPG7KMVP.js +0 -20
  705. package/dist/cli-bundle/chunks/register-setup-H4SVAVX7.js +0 -2
  706. package/dist/cli-bundle/focused-chunks/chunk-AL5ON6K6.js +0 -2
  707. package/dist/cli-bundle/focused-chunks/chunk-CHC2IDXA.js +0 -6
  708. package/dist/cli-bundle/focused-chunks/chunk-CK6QFAPZ.js +0 -20
  709. package/dist/cli-bundle/focused-chunks/chunk-EZR3GHFE.js +0 -2
  710. package/dist/cli-bundle/focused-chunks/chunk-H2WJWK7L.js +0 -56
  711. package/dist/cli-bundle/focused-chunks/chunk-NTPY5GSO.js +0 -3
  712. package/dist/cli-bundle/focused-chunks/chunk-P5O7MP5Y.js +0 -2
  713. package/dist/cli-bundle/focused-chunks/chunk-PDMW2E36.js +0 -177
  714. package/dist/cli-bundle/focused-chunks/chunk-QTVCLMSZ.js +0 -6
  715. package/dist/cli-bundle/focused-chunks/chunk-QTZRBUYA.js +0 -8
  716. package/dist/cli-bundle/focused-chunks/chunk-SGQST3PQ.js +0 -12
  717. package/dist/cli-bundle/focused-chunks/chunk-UKHASMMP.js +0 -10
  718. package/dist/cli-bundle/focused-chunks/chunk-ZPEKQHOC.js +0 -2
@@ -1,2 +1,2 @@
1
- import"./chunk-QWRRFYK3.js";import{$c as X,$d as ne,Bb as N,Hb as U,Id as te,Oc as x,Rc as q,Sa as V,Sc as G,Tc as W,Uc as J,Vb as T,Wb as $,Wc as E,Xb as D,Xc as z,Yc as j,Zc as Y,_c as K,ae as oe,bd as Q,cc as H,cd as Z,ce as ae,fd as ee,je as ie,ke as re,le as O,re as se}from"./chunk-WGAOYSYH.js";import"./chunk-CKOL5U7J.js";import"./chunk-AZDFJGH6.js";import"./chunk-WYRZZ5ZE.js";import{$n as p,An as L,C as u,E as w,En as c,Fe as P,Hn as b,Ic as B,Id as R,In as s,Jn as k,Ln as M,Mi as S,Mn as F,Ya as I,ea as C,fh as l,gh as m}from"./chunk-QUWFABDM.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="13159f49-7756-58b8-ac32-7ddd571e7d09")}catch{}})();var le=new Map([["measurements","boolean"],["metric","string"],["measurementLimit","number"],["observe","string_array"],["direction","direction"],["measurementSource","string"],["measurementItem","string"],["measurementRevision","string"],["author","string"],["message","string"],["provenanceCoverage","boolean"],["fleetAttribution","boolean"],["since","string"],["eventLimit","number"],["minimumSample","number"]]),we=new Set(["higher","lower","target"]),be=[...le.keys()].sort((e,t)=>e.localeCompare(t)).join(", ");function ke(e,t){return e==="boolean"?typeof t=="boolean":e==="string"?typeof t=="string":e==="number"?typeof t=="number":e==="string_array"?Array.isArray(t)&&t.every(n=>typeof n=="string"):e==="direction"&&we.has(t)}function ce(e){if(e===void 0)return{};let t;try{t=JSON.parse(e)}catch(n){throw new w(`--analytics must be valid JSON: ${String(n)}`,u.USAGE)}if(t===null||typeof t!="object"||Array.isArray(t))throw new w("--analytics must be a JSON object.",u.USAGE);for(let[n,o]of Object.entries(t)){let a=le.get(n);if(!ke(a,o))throw new w(a===void 0?`Unknown --analytics field "${n}". Accepted fields: ${be}.`:`--analytics field "${n}" must be ${a.replace("_"," ")}.`,u.USAGE)}return t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="eee25545-a7e9-54be-abc0-dbccc9b41e74")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b0095f00-00bd-5b28-933c-b63a1711a73d")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="99355d20-090b-503e-8079-b858291938e3")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="35276f20-abc5-54e2-8251-35971f1fcb4f")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8fa4af33-ba9f-5a19-a359-c64143287b5d")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="52c4154e-2761-5230-942c-6ac5e83a830c")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c3fceb32-e0b9-5690-8653-4c699f865c0f")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1e42a508-5568-522f-843d-61febc0bad27")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="43769e60-ed80-521d-9375-c28ee5b0ac06")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3f1deb3b-e341-533a-a349-eca48f347600")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="91a42861-f8cb-575b-8596-53870f6275c6")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c85956ff-383f-5482-96a9-0ef38949859c")}catch{}})();var de=(e,t)=>N(e,t,{runUpdate:(n,o,a)=>x(n,o,a)});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="41d01430-1e95-5f09-9a2f-7e7f8fad8184")}catch{}})();async function ve(e,t,n,o,a){let i=c(a),r=e==="run",d=e==="verdicts",g=e==="presets"||e==="apply",f=e==="promote",h=await U({action:e,...r||d||g||f?{}:{kind:t},id:r||d||f?n??t:n,preset:g?n??t:void 0,definition:s(o,"definition"),trigger:s(o,"trigger"),tree:s(o,"tree"),gate:s(o,"gate"),limit:s(o,"limit"),dry_run:o.dryRun===!0,fullChangedFields:i.fullChangedFields,idOnly:i.idOnly,author:s(o,"author"),message:s(o,"message"),owner:s(o,"owner"),apply:o.apply===!0,enforcement:s(o,"enforcement")},i);l(h,i),typeof h=="object"&&h!==null&&"exit_code"in h&&h.exit_code===1&&(process.exitCode=1)}function ue(e){e.command("assurance").argument("<action>","Action; inspect `pm contracts --command assurance`").argument("[kind]","Declaration kind or run gate id").argument("[id]","Declaration/gate id").description("Manage SDK-owned assurance contracts.").option("--definition <json>","Put declaration JSON").option("--trigger <value>","Gate trigger").option("--tree <value>","Revision identity").option("--gate <id>","Verdict gate filter").option("--limit <number>","Verdict limit").option("--dry-run","Evaluate without recording").option("--author <value>","Mutation author").option("--message <value>","Mutation rationale").option("--owner <item-id>","Preset/derivation owner").option("--apply","Persist derived proposals").option("--enforcement <level>","Promote to warn or block").action(ve)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="deed05b2-dba2-5022-804d-dccd2f7beb1b")}catch{}})();function xe(e,t){let n=e?.trim().toLowerCase(),o=t?.trim().toLowerCase();if(n===void 0||n.length===0)return o;if(n==="local-analytics")return o&&o.length>0?o:"status";if(o!==void 0&&o.length>0)throw C({command_path:"telemetry",token:`${e} ${t}`,allowed:["status","flush","stats","clear","local-analytics"],token_kind:"path",examples:["pm telemetry stats --limit 10","pm telemetry local-analytics status --json"]});return n}function Ae(e){return{addValues:Array.isArray(e.add)?e.add:[],addJsonValues:Array.isArray(e.addJson)?e.addJson:[],removeValues:Array.isArray(e.remove)?e.remove:[],removeIndexValues:Array.isArray(e.removeIndex)?e.removeIndex:[]}}function pe(e,t){if(e.background===!0){if(e.run!==!0)throw new w("--background requires --run",u.USAGE);if(e.acknowledgeLinkedTests===!0)throw new w("--background cannot be combined with --acknowledge-linked-tests; acknowledgement is a non-executing foreground operation",u.USAGE);if(t.addValues.length>0||t.addJsonValues.length>0||t.removeValues.length>0||t.removeIndexValues.length>0)throw new w("--background does not support --add/--add-json/--remove/--remove-index; update linked tests first, then run in background",u.USAGE)}}async function _e(e,t,n,o){let a=await O({kind:"test",commandArgs:M(e,{...t,add:o.addValues,addJson:o.addJsonValues,remove:o.removeValues,removeIndex:o.removeIndexValues}),targetId:e,author:typeof t.author=="string"?t.author:void 0,noExtensions:n.noExtensions===!0},n);l(a,n)}function ye(e,t){return{add:t.addValues,addJson:t.addJsonValues,remove:t.removeValues,removeIndex:t.removeIndexValues,list:!!e.list,run:!!e.run,match:typeof e.match=="string"?e.match:void 0,onlyIndex:typeof e.onlyIndex=="string"||typeof e.onlyIndex=="number"?e.onlyIndex:void 0,onlyLast:!!e.onlyLast,timeout:typeof e.timeout=="string"?e.timeout:void 0,progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:typeof e.pmContext=="string"?e.pmContext:void 0,overrideLinkedPmContext:!!e.overrideLinkedPmContext,workspaceContext:typeof e.workspaceContext=="string"?e.workspaceContext:void 0,overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,acknowledgeLinkedTests:!!e.acknowledgeLinkedTests,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext,author:typeof e.author=="string"?e.author:void 0,message:typeof e.message=="string"?e.message:void 0,force:!!e.force,measure:Array.isArray(e.measure)?e.measure:[],metricBelow:typeof e.metricBelow=="string"?e.metricBelow:void 0,metricDiff:typeof e.metricDiff=="string"?e.metricDiff:void 0}}var Ht={buildRunTestOptions:ye,buildRunTestAllOptions:ge,runWorkspacePositionAction:he,validateBackgroundTestOptions:pe};async function Ie(e,t,n,o){let a=await ie(e,ye(t,o),n);(o.addValues.length>0||o.addJsonValues.length>0||o.removeValues.length>0||t.run===!0||o.removeIndexValues.length>0)&&await p(n,a),l(a,n),(a.run_results.some(i=>i.status==="failed")||a.fail_on_skipped_triggered===!0)&&(process.exitCode=u.DEPENDENCY_FAILED)}async function Se(e,t,n){let o=c(n),a=Date.now(),i=Ae(t);pe(t,i),t.background===!0?await _e(e,t,o,i):await Ie(e,t,o,i),o.profile&&m(`profile:command=test took_ms=${Date.now()-a}`)}function A(e){let t=s(e,"author"),n=s(e,"assignee");if(t!==void 0&&n!==void 0&&t!==n)throw new w("Lifecycle ownership received conflicting --author and --assignee values; use one actor value for both aliases.",u.USAGE,{code:"conflicting_lifecycle_owner",examples:["pm claim pm-123","pm start-task pm-123","pm release pm-123"]});return{author:t??n,message:s(e,"message")}}async function De(e,t){let n=c(t),o=Date.now();if(e.background===!0){let r=await O({kind:"test-all",commandArgs:F(e),statusFilter:s(e,"status"),noExtensions:n.noExtensions===!0},n);l(r,n),n.profile&&m(`profile:command=test-all took_ms=${Date.now()-o}`);return}let i=await re(ge(e),n);await p(n,{ids:i.results.map(r=>r.id)}),l(i,n),(i.failed>0||i.fail_on_skipped_triggered===!0)&&(process.exitCode=u.DEPENDENCY_FAILED),n.profile&&m(`profile:command=test-all took_ms=${Date.now()-o}`)}function ge(e){return{status:s(e,"status"),limit:s(e,"limit"),offset:s(e,"offset"),timeout:s(e,"timeout"),progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:s(e,"pmContext"),overrideLinkedPmContext:!!e.overrideLinkedPmContext,workspaceContext:s(e,"workspaceContext"),overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext}}async function Ce(e,t,n,o){let a=c(o),i=Date.now(),r=await ae({subcommand:xe(e,t),limit:s(n,"limit")},a);l(r,a),a.profile&&m(`profile:command=telemetry took_ms=${Date.now()-i}`)}async function Be(e,t){let n=c(t),o=Date.now(),a=ce(s(e,"analytics")),i=await ne(n,{includeEmpty:e.includeEmpty===!0,storage:e.storage===!0,metadataCoverage:e.metadataCoverage===!0,byAssignee:e.byAssignee===!0,byTag:e.byTag===!0,byPriority:e.byPriority===!0,tagPrefix:s(e,"tagPrefix"),fieldUtilization:e.fieldUtilization===!0,...a});i.recorded_observations?.some(r=>r.changed)===!0&&await p(n,{ids:i.recorded_observations?.flatMap(r=>r.observation.item_id?[r.observation.item_id]:[])}),l(i,n),n.profile&&m(`profile:command=stats took_ms=${Date.now()-o}`)}async function Re(e,t){let n=c(t),o=Date.now(),a=s(e,"threshold"),i=s(e,"limit"),r=await oe(n,{...e.exhaustive===!0?{exhaustive:!0}:{},status:Array.isArray(e.status)&&e.status.length>0?e.status:void 0,since:s(e,"since"),...a===void 0?{}:{threshold:Number(a)},...i===void 0?{}:{limit:Number(i)}});l(r,n),n.profile&&m(`profile:command=duplicates took_ms=${Date.now()-o}`)}async function Te(e,t){let n=c(t),o=Date.now(),a=!!e.strictExit||!!e.failOnWarn,i=await V(n,{strictExit:a,strictDirectories:!!e.strictDirectories,requireMergeDrivers:!!e.requireMergeDrivers,checkOnly:!!e.checkOnly,checkTelemetry:!!e.checkTelemetry,noRefresh:!!e.noRefresh,refreshVectors:!!e.refreshVectors,verboseStaleItems:!!e.verboseStaleItems,verboseAuthorEvents:!!e.verboseAuthorEvents,brief:!!e.brief,summary:!!e.summary||a,skipVectors:!!e.skipVectors,skipIntegrity:!!e.skipIntegrity,skipDrift:!!e.skipDrift,full:!!e.full});l(i,n),a&&!i.ok&&(B({...i,exit_code:u.GENERIC_FAILURE,error_code:"health_findings",error_category:"validation",command_resolution:"health_findings",resolution_stage:"execute"}),process.exitCode=u.GENERIC_FAILURE),n.profile&&m(`profile:command=health took_ms=${Date.now()-o}`)}async function Ee(e,t){let n=c(t),o=Date.now(),a=await de({checkMetadata:!!e.checkMetadata,metadataProfile:s(e,"metadataProfile"),checkResolution:!!e.checkResolution,checkLifecycle:!!e.checkLifecycle,checkStaleBlockers:!!e.checkStaleBlockers,dependencyCycleSeverity:s(e,"dependencyCycleSeverity"),parentCycleSeverity:s(e,"parentCycleSeverity"),checkFiles:!!e.checkFiles,checkCommandReferences:!!e.checkCommandReferences,scanMode:s(e,"scanMode"),includePmInternals:!!e.includePmInternals,verboseFileLists:!!e.verboseFileLists,verboseDiagnostics:!!e.verboseDiagnostics,allAffectedIds:!!e.allAffectedIds,checkHistoryDrift:!!e.checkHistoryDrift,checkStorageIntegrity:!!e.checkStorageIntegrity,fixHints:!!e.fixHints,autoFix:!!e.autoFix,dryRun:!!e.dryRun,fixScope:Array.isArray(e.fixScope)?e.fixScope:void 0,pruneMissing:!!e.pruneMissing,counts:!!e.counts,full:!!e.full},n);l(a,n),(e.strictExit||e.failOnWarn)&&(a.has_warnings||!a.ok)&&(B({...a,exit_code:u.GENERIC_FAILURE,error_code:"validation_findings",error_category:"validation",command_resolution:"validation_findings",resolution_stage:"execute"}),process.exitCode=u.GENERIC_FAILURE),n.profile&&m(`profile:command=validate took_ms=${Date.now()-o}`)}async function Oe(e,t){let n=c(t),o=Date.now(),a=await q(n,{dryRun:e.dryRun===!0,scope:Array.isArray(e.scope)?e.scope:[]});l(a,n),n.profile&&m(`profile:command=gc took_ms=${Date.now()-o}`)}async function Pe(e,t,n,o){let a=c(o),i=I(process.cwd(),a.path),r=e.trim().toLowerCase();if(!E.some(d=>d===r))throw C({command_path:"workspace snapshot",token:e,allowed:E,display_name:"workspace snapshot",token_kind:"action",examples:["pm workspace snapshot create before-migration","pm workspace snapshot restore before-migration"]});if(r==="list"){l(await Y(i),a);return}if(r==="create"){l(await z(i,t===void 0?{}:{name:t}),a);return}if(t===void 0)throw new w(`pm workspace snapshot ${r} requires a snapshot name or fingerprint`,u.USAGE);if(r==="inspect"){l(await j(i,t),a);return}if(r==="restore"){if(n.dryRun===!0){l(await K(i,t),a);return}let d=await S(i);l(await X(i,t,{force:n.force===!0,author:P(s(n,"author"),d.author_default),message:s(n,"message"),lockTtlSeconds:d.locks.ttl_seconds,lockWaitMs:d.locks.wait_ms}),a);return}l(await Q(i,t),a)}async function he(e,t){let n=c(t);l(await Z(n),n)}async function Le(e,t){let n=c(t),o=Date.now(),a=await te({action:s(e,"action"),command:s(e,"command"),summary:!!e.summary,schemaOnly:!!e.schemaOnly,flagsOnly:!!e.flagsOnly,availabilityOnly:!!e.availabilityOnly,runtimeOnly:!!e.runtimeOnly||!!e.activeOnly,full:!!e.full},n);l(a,n),n.profile&&m(`profile:command=contracts took_ms=${Date.now()-o}`)}async function Me(e,t,n){let o=c(n),a=Date.now(),i={...A(t),ifAvailable:t.ifAvailable===!0,maxAttempts:t.maxAttempts};Fe(e,t.next===!0);let r=t.next===!0?await $(!!t.force,o,i,{type:typeof t.type=="string"?t.type:void 0,tag:typeof t.tag=="string"?t.tag:void 0,priority:t.priority,assigneeFilter:typeof t.assigneeFilter=="string"?t.assigneeFilter:void 0,parent:typeof t.parent=="string"?t.parent:void 0,sprint:typeof t.sprint=="string"?t.sprint:void 0,release:typeof t.release=="string"?t.release:void 0,includeDecisions:t.includeDecisions===!0,includeGates:t.includeGates===!0,includeContainers:t.includeContainers===!0,tokenBudget:t.tokenBudget??t.token_budget,explainRanking:t.explainRanking===!0||t.explain_ranking===!0}):await T(e,!!t.force,o,i);await p(o,r),l(r,o),o.profile&&m(`profile:command=claim took_ms=${Date.now()-a}`)}function Fe(e,t){if(!t&&!e)throw new w("Specify an item id or pass --next",u.USAGE);if(t&&e)throw new w("Specify either an item id or --next, not both",u.USAGE)}async function Ve(e,t,n){let o=c(n),a=Date.now(),i=await D(e,!!t.force,o,{...A(t),ownershipReleaseBypass:t.ownershipReleaseBypass===!0});await p(o,i),l(await L("release",[e],t,o,i),o),o.profile&&m(`profile:command=release took_ms=${Date.now()-a}`)}async function Ne(e,t,n){let o=c(n),a=Date.now(),i=I(process.cwd(),o.path),r=await S(i),d=R(r.schema),g=ee(d),f=!!t.force,h=A(t),v=await T(e,f,o,h);await p(o,v);let _=await x(e,{...h,status:g,force:f},o);await p(o,_),l({id:e,action:"start_task",claim:v,update:_},o),o.profile&&m(`profile:command=start-task took_ms=${Date.now()-a}`)}async function Ue(e,t,n){let o=c(n),a=Date.now(),i=I(process.cwd(),o.path),r=await S(i),d=R(r.schema),g=!!t.force,f=A(t),h=await x(e,{...f,status:d.open_status,force:g},o);await p(o,h);let v=await D(e,g,o,f);await p(o,v),l({id:e,action:"pause_task",update:h,release:v},o),o.profile&&m(`profile:command=pause-task took_ms=${Date.now()-a}`)}async function $e(e,t,n,o){let a=c(o),i=Date.now(),r=!!n.force,d=A(n),g=await H(e,t,{...d,validateClose:s(n,"validateClose"),force:r},a);await p(a,g);let f=await D(e,r,a,d);await p(a,f),l({id:e,action:"close_task",close:g,release:f},a),a.profile&&m(`profile:command=close-task took_ms=${Date.now()-i}`)}function me(e){return e.option("--background","Run linked tests in managed background mode").option("--timeout <seconds>","Default run timeout in seconds").option("--progress","Emit linked-test progress to stderr (always shown in TTY, opt-in for non-TTY)").option("--env-set <value>","Set environment variable(s) for linked-test runs (KEY=VALUE, repeatable)",b).option("--env-clear <value>","Clear environment variable(s) for linked-test runs (NAME, repeatable)",b).option("--shared-host-safe","Apply additive shared-host-safe runtime defaults for linked-test runs").option("--pm-context <mode>","PM linked-test context mode: schema|tracker|auto (default: schema)").option("--override-linked-pm-context","Force run-level --pm-context to override per-linked-test pm_context_mode metadata").option("--workspace-context <mode>","Source-workspace mode: source|isolated|snapshot (default: source)").option("--override-linked-workspace-context","Force run-level --workspace-context over per-linked-test metadata").option("--allow-untrusted-linked-tests","Execute untrusted linked commands when project policy also permits it").option("--fail-on-context-mismatch","Fail linked PM commands when context item counts differ").option("--fail-on-skipped","Treat skipped linked tests as dependency failures").option("--fail-on-empty-test-run","Treat successful linked-test commands that report zero executed tests as failures").option("--require-assertions-for-pm","Require assertion metadata for linked PM command tests").option("--check-context","Preflight linked PM command context diagnostics before executing commands").option("--auto-pm-context","Auto-remediate PM tracker-read context mismatches by routing those linked commands through tracker context")}function qt(e){ue(e);let t=e.command("test").argument("<id>","Item id").option("--add <value>","Add verified isolated test (CSV/markdown or stdin)",b).option("--add-json <value>","Add verified isolated test (JSON object/array or stdin)",b).option("--remove <value>","Remove linked test entry by exact command/path (command=<value> and path=<value> preserve commas and equals signs; or - for stdin)",b).option("--remove-index <n>","Remove the 1-based linked-test index from --list order (repeatable)",b).option("--list","List linked tests without mutating").option("--run","Run linked test commands").option("--match <value>","Run only linked tests whose command/path contains this substring").option("--only-index <n>","Run only the 1-based linked-test index from --list order").option("--only-last","Run only the most recently added linked test");t.option("--acknowledge-linked-tests","Trust the item's current linked commands in this clone without executing them"),me(t).option("--measure <value>","Record name=value[,unit=...][,threshold=...] evidence; repeatable",b).option("--metric-below <value>","Return evidence below name=value").option("--metric-diff <name>","Diff the latest two values").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage tests linked to an item and optionally run them.").action(Se);let n=e.command("test-all").description("Run linked tests across matching items.").option("--status <value>","Filter items by status before running tests").option("--limit <n>","Limit matching items before running linked tests").option("--offset <n>","Skip matching items before running linked tests");me(n).action(De),e.command("test-runs-worker",{hidden:!0}).argument("<runId>","Background run id").description("Internal background worker command.").action(async(f,h,v)=>{let _=c(v);await se(f,_)}),e.command("telemetry").argument("[namespace-or-subcommand]","Telemetry subcommand: status, flush, stats, clear (default: status)").argument("[subcommand]","Compatibility alias target for local-analytics: status, flush, stats, clear").option("--limit <n>","Maximum command groups returned by telemetry stats").description("Inspect and manage local telemetry queue/runtime state.").action(Ce),e.command("duplicates").description("Find duplicate clusters across all statuses.").option("--status <value>","Statuses (repeatable or comma-separated)",b,[]).option("--since <value>","Created at or after this time").option("--threshold <value>","Minimum similarity (0-1)").option("--limit <n>","Maximum clusters").option("--exhaustive","Score all pairs within the safety bound").action(Re),e.command("stats").description("Show project tracker statistics.").option("--include-empty","Restore zero-count registered item-type and lifecycle-status buckets").option("--storage","Include aggregate history-stream storage metrics (total streams/lines/bytes, largest + deepest streams, oldest/newest entries)").option("--metadata-coverage","Include metadata coverage % (acceptance_criteria, estimated_minutes, resolution, tags, parent) overall and by type").option("--by-assignee","Include a lifecycle-bucketed item breakdown grouped by assignee").option("--by-tag","Include a lifecycle-bucketed item breakdown grouped by tag").option("--by-priority","Include a lifecycle-bucketed item breakdown grouped by priority").option("--tag-prefix <value>","With --by-tag: only count tags starting with this prefix (e.g. domain:)").option("--field-utilization","Report content-field utilization rates (notes/learnings/files/docs/tests/comments/deps/body) for governance analysis").option("--analytics <json>","Improvement ledger/history analytics JSON").action(Be),e.command("health").description("Show project tracker health checks.").option("--strict-directories","Treat optional item-type directories as required failures").option("--require-merge-drivers","Treat absent clone-local merge drivers as a required health failure").option("--check-only","Run read-only health diagnostics without refreshing vectors").option("--check-telemetry","Probe telemetry endpoint health and include network diagnostics").option("--no-refresh","Disable automatic vector refresh attempts during health checks").option("--refresh-vectors","Explicitly enable vector refresh attempts during health checks").option("--verbose-stale-items","Include full stale vectorization ID lists in health output").option("--verbose-author-events","Include every actionable unknown-author event coordinate for review or disposition").option("--brief","Emit compact health details for low-token agent checks").option("--summary","Emit one-line-style health status with check names and warning count").option("--skip-vectors","Skip vectorization check for a faster run").option("--skip-integrity","Skip item/history file integrity check for a faster run").option("--skip-drift","Skip history drift hash check for a faster run").option("--full","Run all checks including slow integrity, drift, and vectorization checks").option("--strict-exit","Return non-zero exit when health is not ok and default to actionable summary output; use --full for complete details").option("--fail-on-warn","Alias for --strict-exit").action(Te),e.command("validate").description("Run standalone metadata, resolution, lifecycle, files, linked-command reference, and history drift validation checks.").option("--check-metadata","Run metadata completeness checks").option("--metadata-profile <value>","Select metadata validation profile for --check-metadata (core|strict|custom)").option("--check-resolution","Run closed-item resolution metadata checks").option("--check-lifecycle","Run active-item lifecycle governance drift checks").option("--check-stale-blockers","Include stale blocker-pattern diagnostics in lifecycle checks").option("--dependency-cycle-severity <value>","Set dependency-cycle warning policy for lifecycle checks (off|warn|error)").option("--parent-cycle-severity <value>","Set parent-hierarchy cycle warning policy for lifecycle checks (off|warn|error)").option("--check-files","Run linked-file and orphaned-file checks").option("--check-command-references","Run linked-command PM-ID reference checks").option("--scan-mode <value>","Select file candidate scan mode for --check-files (default|tracked-all|tracked-all-strict)").option("--include-pm-internals","Include PM storage internals in tracked-all candidate scans").option("--verbose-file-lists","Include full file-path lists for validate --check-files details").option("--verbose-diagnostics","Include full validate diagnostic ID lists instead of compact summaries").option("--all-affected-ids","Emit complete missing_* affected-ID lists with no truncation (implied by --json)").option("--strict-exit","Return non-zero exit when validation warnings are present").option("--fail-on-warn","Alias for --strict-exit").option("--fix-hints","Add a machine-executable fix_hints[] of pm commands to each failing check's details").option("--auto-fix","Apply the safe, deterministic subset of fix-hint remediations (field backfills) automatically").option("--dry-run","Preview planned --auto-fix/--prune-missing fixes without applying them").option("--fix-scope <scope>","Grant --auto-fix scopes (metadata, resolution, lifecycle; comma-separated or repeatable). Default: metadata, resolution; lifecycle must be named explicitly",b).option("--prune-missing","Remove stale linked-file/doc LINKS whose paths classified as deleted (never touches real files)").option("--check-history-drift","Run item/history hash drift checks").option("--check-storage-integrity","Run the post-merge storage-integrity check (unreadable items, history conflict markers, resurrected deletes, unparseable config/schema)").option("--counts","Keep validation counts and totals while omitting per-item diagnostic arrays").option("--full","Return the complete validation diagnostic projection").action(Ee),e.command("gc").option("--dry-run","Preview cleanup targets without deleting files; without this flag, pm gc deletes matched artifacts").option("--scope <value>","Limit cleanup to one or more scopes (comma-separated or repeatable): index, embeddings, runtime, locks, checkpoints, transactions",b).description("Delete optional cache artifacts by default (including expired lock debris) and show a summary.").action(Oe);let o=e.command("workspace").description("Inspect workspace state and snapshots.");o.command("position").description("Show merge and history readiness.").action(he),o.command("snapshot").argument("<action>","Action: create, list, inspect, restore, delete").argument("[target]","Optional name for create; name or fingerprint otherwise").description("Manage content-addressed tracker snapshots.").option("--dry-run","Preview restore file, item, stream, and history-entry impact without mutating state").option("--force","Explicitly confirm a whole-workspace snapshot restore").option("--author <value>","Actor recorded on the restore audit event").option("--message <value>","Human-readable restore rationale").action(Pe),e.command("contracts").description("Show machine-readable command and schema contracts for agents.").option("--action <value>","Filter tool schema branches to a specific action").option("--command <value>","Scope contracts output to one CLI command (narrow-by-default)").option("--summary","Return one command+intent row per top-level command for cheap agent bootstrap").option("--schema-only","Return schema-focused output only").option("--flags-only","Return command flag contracts only").option("--availability-only","Return action availability surface only").option("--runtime-only","Include only actions invocable in the current runtime").option("--active-only","Alias for --runtime-only").option("--full","Include full schema and command-flag surfaces (large; default brief output omits heavy sections for unfiltered queries)").action(Le);let a=e.command("claim").argument("[id]","Item id (omit with --next)").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force claim override").option("--if-available","Skip silently when the item is already claimed by another author (returns skipped=true)").option("--next","Atomically claim the next caller-available actionable item").option("--type <value>","Filter --next candidates by type").option("--tag <value>","Filter --next candidates by tag").option("--priority <value>","Filter --next candidates by priority").option("--assignee-filter <value>","Filter --next candidates: assigned|unassigned").option("--parent <id>","Scope --next candidates to a subtree").option("--sprint <value>","Filter --next candidates by sprint").option("--release <value>","Filter --next candidates by release").option("--max-attempts <n>","Bound the --next candidate walk (default 10; maximum 100)").option("--include-decisions","Allow --next to claim human-gated Decision items").option("--include-gates","Allow --next to claim outcome gates").option("--include-containers","Allow --next to claim containers with unfinished descendants").option("--token-budget <n>","Bound the estimated tokens used to rank --next candidates").option("--explain-ranking","Include ranking provenance for --next selection").description("Claim an item for active work.").action(Me);k(a,"--assignee <value>","Alias for --author on lifecycle ownership commands"),k(a,"--token_budget <n>","Alias for --token-budget"),k(a,"--explain_ranking","Alias for --explain-ranking");let i=e.command("release").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force release override").description("Release an item's active claim.").action(Ve);k(i,"--assignee <value>","Alias for --author on lifecycle ownership commands");let r=e.command("start-task").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: claim an item and move it to in_progress.").action(Ne);k(r,"--assignee <value>","Alias for --author on lifecycle ownership commands");let d=e.command("pause-task").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override when required").description("Lifecycle alias: move an item to open and release its claim.").action(Ue);k(d,"--assignee <value>","Alias for --author on lifecycle ownership commands");let g=e.command("close-task").argument("<id>","Item id").argument("[reason]","Close reason text").option("--author <value>","Mutation author").option("--message <value>","History message").option("--validate-close <value>","Close-time validation mode: off|warn|strict").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: close an item and release assignment metadata.").action($e);k(g,"--assignee <value>","Alias for --author on lifecycle ownership commands"),He(e)}function y(e){return typeof e=="string"?e:void 0}function fe(e){return{parent:y(e.parent),allowMissingParent:e.allowMissingParent===!0?!0:void 0,tags:y(e.tags),priority:y(e.priority),body:y(e.body),description:y(e.description),author:y(e.author),message:y(e.message)}}function He(e){for(let{name:t,describe:n}of[{name:"meet",describe:"Shortcut: create a Meeting with a start time and duration."},{name:"event",describe:"Shortcut: create an Event with a start time and duration."}])e.command(t).argument("<title>","Item title").option("--start <when>","Start time (ISO, 'now', or relative like +1h/+2d); defaults to now").option("--duration <span>","Duration from start (relative like 1h/2d); defaults to 1h when --end is omitted").option("--end <when>","End time (ISO or relative); overrides --duration").option("--location <value>","Location").option("--timezone <value>","IANA timezone (for example America/New_York)").option("--all-day","Mark as an all-day event").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description(n).action(async(o,a,i)=>{let r=c(i),d=Date.now(),f=await(t==="meet"?G:W)(o,{...fe(a),start:y(a.start),duration:y(a.duration),end:y(a.end),location:y(a.location),timezone:y(a.timezone),allDay:a.allDay===!0?!0:void 0},r);await p(r,f),l(f,r),r.profile&&m(`profile:command=${t} took_ms=${Date.now()-d}`)});e.command("remind").argument("<title>","Item title").option("--at <when>","Reminder time (ISO, 'now', or relative like +2d); defaults to +1d").option("--text <value>","Reminder text; defaults to the title").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description("Shortcut: create a Reminder from a single point in time.").action(async(t,n,o)=>{let a=c(o),i=Date.now(),r=await J(t,{...fe(n),at:y(n.at),text:y(n.text)},a);await p(a,r),l(r,a),a.profile&&m(`profile:command=remind took_ms=${Date.now()-i}`)})}export{Ht as _testOnlyRegisterOperations,qt as registerOperationCommands,Fe as requireClaimTarget};
2
- //# sourceMappingURL=register-operations-I5W3KMGB.js.map
1
+ import"./chunk-NSAPNEYH.js";import{Ac as K,Bc as X,Bd as ne,Cd as oe,Dc as Q,Eb as H,Ec as Z,Ed as ae,Hc as ee,Ld as ie,Md as re,Nd as O,Td as se,bb as N,hb as U,id as te,oc as x,rc as q,sa as V,sc as G,tc as W,uc as J,vb as T,wb as $,wc as E,xb as D,xc as z,yc as j,zc as Y}from"./chunk-QOEKOECV.js";import"./chunk-FLDWYEND.js";import"./chunk-XOD2PCB6.js";import"./chunk-DEZPZOQ7.js";import{I as u,Jn as L,K as w,Le as P,Nn as c,Oc as B,Od as R,Qn as k,Rn as s,Sn as b,Un as M,Vi as S,Vn as F,cb as I,io as p,ka as C,oh as l,ph as m}from"./chunk-AMRDVX36.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5197f5ed-ed11-536e-b0da-00fe90a1a1a1")}catch{}})();var le=new Map([["measurements","boolean"],["metric","string"],["measurementLimit","number"],["observe","string_array"],["direction","direction"],["measurementSource","string"],["measurementItem","string"],["measurementRevision","string"],["author","string"],["message","string"],["provenanceCoverage","boolean"],["fleetAttribution","boolean"],["since","string"],["eventLimit","number"],["minimumSample","number"]]),we=new Set(["higher","lower","target"]),ke=[...le.keys()].sort((e,t)=>e.localeCompare(t)).join(", ");function be(e,t){return e==="boolean"?typeof t=="boolean":e==="string"?typeof t=="string":e==="number"?typeof t=="number":e==="string_array"?Array.isArray(t)&&t.every(n=>typeof n=="string"):e==="direction"&&we.has(t)}function ce(e){if(e===void 0)return{};let t;try{t=JSON.parse(e)}catch(n){throw new w(`--analytics must be valid JSON: ${String(n)}`,u.USAGE)}if(t===null||typeof t!="object"||Array.isArray(t))throw new w("--analytics must be a JSON object.",u.USAGE);for(let[n,o]of Object.entries(t)){let a=le.get(n);if(!be(a,o))throw new w(a===void 0?`Unknown --analytics field "${n}". Accepted fields: ${ke}.`:`--analytics field "${n}" must be ${a.replace("_"," ")}.`,u.USAGE)}return t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a9de2504-ed7f-5a51-9da9-628e2f4a7159")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ae73a8aa-9ba6-58cc-9bcd-912682cadfdc")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0954af2d-98d8-5425-9264-cd44252bb7ef")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6b76c88f-912f-59a0-ac2c-6cd6e221737b")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d413f650-10c4-55c1-8403-90a7783ef5e9")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1cc6f14f-3fc2-59ff-a854-41c568e79252")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c9656d1f-25d1-5e20-b5e1-0b96390e0b62")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="42a381ad-a47b-5990-a2c7-0fdade7c25b3")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ac5c3cc6-b0a4-5dad-b6ed-f1e627f6bb1d")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5f81d2b7-3693-553e-bfe8-17344cd3a6c3")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="41d39122-3247-54ea-9eaf-43f002910880")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="fdb6bf22-0e41-530c-9d50-c56ab36effa4")}catch{}})();var de=(e,t)=>N(e,t,{runUpdate:(n,o,a)=>x(n,o,a)});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="70a8a9b3-0fe4-5903-8e9c-85db1f0ca522")}catch{}})();async function ve(e,t,n,o,a){let i=c(a),r=e==="run",d=e==="verdicts",g=e==="presets"||e==="apply",f=e==="promote",h=await U({action:e,...r||d||g||f?{}:{kind:t},id:r||d||f?n??t:n,preset:g?n??t:void 0,definition:s(o,"definition"),trigger:s(o,"trigger"),tree:s(o,"tree"),gate:s(o,"gate"),limit:s(o,"limit"),dry_run:o.dryRun===!0,fullChangedFields:i.fullChangedFields,idOnly:i.idOnly,author:s(o,"author"),message:s(o,"message"),owner:s(o,"owner"),apply:o.apply===!0,enforcement:s(o,"enforcement")},i);l(h,i),typeof h=="object"&&h!==null&&"exit_code"in h&&h.exit_code===1&&(process.exitCode=1)}function ue(e){e.command("assurance").argument("<action>","Action; inspect `pm contracts --command assurance`").argument("[kind]","Declaration kind or run gate id").argument("[id]","Declaration/gate id").description("Manage SDK-owned assurance contracts.").option("--definition <json>","Put declaration JSON").option("--trigger <value>","Gate trigger").option("--tree <value>","Revision identity").option("--gate <id>","Verdict gate filter").option("--limit <number>","Verdict limit").option("--dry-run","Evaluate without recording").option("--author <value>","Mutation author").option("--message <value>","Mutation rationale").option("--owner <item-id>","Preset/derivation owner").option("--apply","Persist derived proposals").option("--enforcement <level>","Promote to warn or block").action(ve)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7559e5b6-bd38-5969-98aa-9e8c27a4a4b7")}catch{}})();function xe(e,t){let n=e?.trim().toLowerCase(),o=t?.trim().toLowerCase();if(n===void 0||n.length===0)return o;if(n==="local-analytics")return o&&o.length>0?o:"status";if(o!==void 0&&o.length>0)throw C({command_path:"telemetry",token:`${e} ${t}`,allowed:["status","flush","stats","clear","local-analytics"],token_kind:"path",examples:["pm telemetry stats --limit 10","pm telemetry local-analytics status --json"]});return n}function Ae(e){return{addValues:Array.isArray(e.add)?e.add:[],addJsonValues:Array.isArray(e.addJson)?e.addJson:[],removeValues:Array.isArray(e.remove)?e.remove:[],removeIndexValues:Array.isArray(e.removeIndex)?e.removeIndex:[]}}function pe(e,t){if(e.background===!0){if(e.run!==!0)throw new w("--background requires --run",u.USAGE);if(e.acknowledgeLinkedTests===!0)throw new w("--background cannot be combined with --acknowledge-linked-tests; acknowledgement is a non-executing foreground operation",u.USAGE);if(t.addValues.length>0||t.addJsonValues.length>0||t.removeValues.length>0||t.removeIndexValues.length>0)throw new w("--background does not support --add/--add-json/--remove/--remove-index; update linked tests first, then run in background",u.USAGE)}}async function _e(e,t,n,o){let a=await O({kind:"test",commandArgs:M(e,{...t,add:o.addValues,addJson:o.addJsonValues,remove:o.removeValues,removeIndex:o.removeIndexValues}),targetId:e,author:typeof t.author=="string"?t.author:void 0,noExtensions:n.noExtensions===!0},n);l(a,n)}function ye(e,t){return{add:t.addValues,addJson:t.addJsonValues,remove:t.removeValues,removeIndex:t.removeIndexValues,list:!!e.list,run:!!e.run,match:typeof e.match=="string"?e.match:void 0,onlyIndex:typeof e.onlyIndex=="string"||typeof e.onlyIndex=="number"?e.onlyIndex:void 0,onlyLast:!!e.onlyLast,timeout:typeof e.timeout=="string"?e.timeout:void 0,progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:typeof e.pmContext=="string"?e.pmContext:void 0,overrideLinkedPmContext:!!e.overrideLinkedPmContext,workspaceContext:typeof e.workspaceContext=="string"?e.workspaceContext:void 0,overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,acknowledgeLinkedTests:!!e.acknowledgeLinkedTests,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext,author:typeof e.author=="string"?e.author:void 0,message:typeof e.message=="string"?e.message:void 0,force:!!e.force,measure:Array.isArray(e.measure)?e.measure:[],metricBelow:typeof e.metricBelow=="string"?e.metricBelow:void 0,metricDiff:typeof e.metricDiff=="string"?e.metricDiff:void 0}}var Ht={buildRunTestOptions:ye,buildRunTestAllOptions:ge,runWorkspacePositionAction:he,validateBackgroundTestOptions:pe};async function Ie(e,t,n,o){let a=await ie(e,ye(t,o),n);(o.addValues.length>0||o.addJsonValues.length>0||o.removeValues.length>0||t.run===!0||o.removeIndexValues.length>0)&&await p(n,a),l(a,n),(a.run_results.some(i=>i.status==="failed")||a.fail_on_skipped_triggered===!0)&&(process.exitCode=u.DEPENDENCY_FAILED)}async function Se(e,t,n){let o=c(n),a=Date.now(),i=Ae(t);pe(t,i),t.background===!0?await _e(e,t,o,i):await Ie(e,t,o,i),o.profile&&m(`profile:command=test took_ms=${Date.now()-a}`)}function A(e){let t=s(e,"author"),n=s(e,"assignee");if(t!==void 0&&n!==void 0&&t!==n)throw new w("Lifecycle ownership received conflicting --author and --assignee values; use one actor value for both aliases.",u.USAGE,{code:"conflicting_lifecycle_owner",examples:["pm claim pm-123","pm start-task pm-123","pm release pm-123"]});return{author:t??n,message:s(e,"message")}}async function De(e,t){let n=c(t),o=Date.now();if(e.background===!0){let r=await O({kind:"test-all",commandArgs:F(e),statusFilter:s(e,"status"),noExtensions:n.noExtensions===!0},n);l(r,n),n.profile&&m(`profile:command=test-all took_ms=${Date.now()-o}`);return}let i=await re(ge(e),n);await p(n,{ids:i.results.map(r=>r.id)}),l(i,n),(i.failed>0||i.fail_on_skipped_triggered===!0)&&(process.exitCode=u.DEPENDENCY_FAILED),n.profile&&m(`profile:command=test-all took_ms=${Date.now()-o}`)}function ge(e){return{status:s(e,"status"),limit:s(e,"limit"),offset:s(e,"offset"),timeout:s(e,"timeout"),progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:s(e,"pmContext"),overrideLinkedPmContext:!!e.overrideLinkedPmContext,workspaceContext:s(e,"workspaceContext"),overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext}}async function Ce(e,t,n,o){let a=c(o),i=Date.now(),r=await ae({subcommand:xe(e,t),limit:s(n,"limit")},a);l(r,a),a.profile&&m(`profile:command=telemetry took_ms=${Date.now()-i}`)}async function Be(e,t){let n=c(t),o=Date.now(),a=ce(s(e,"analytics")),i=await ne(n,{includeEmpty:e.includeEmpty===!0,storage:e.storage===!0,metadataCoverage:e.metadataCoverage===!0,byAssignee:e.byAssignee===!0,byTag:e.byTag===!0,byPriority:e.byPriority===!0,tagPrefix:s(e,"tagPrefix"),fieldUtilization:e.fieldUtilization===!0,...a});i.recorded_observations?.some(r=>r.changed)===!0&&await p(n,{ids:i.recorded_observations?.flatMap(r=>r.observation.item_id?[r.observation.item_id]:[])}),l(i,n),n.profile&&m(`profile:command=stats took_ms=${Date.now()-o}`)}async function Re(e,t){let n=c(t),o=Date.now(),a=s(e,"threshold"),i=s(e,"limit"),r=await oe(n,{...e.exhaustive===!0?{exhaustive:!0}:{},status:Array.isArray(e.status)&&e.status.length>0?e.status:void 0,since:s(e,"since"),...a===void 0?{}:{threshold:Number(a)},...i===void 0?{}:{limit:Number(i)}});l(r,n),n.profile&&m(`profile:command=duplicates took_ms=${Date.now()-o}`)}async function Te(e,t){let n=c(t),o=Date.now(),a=!!e.strictExit||!!e.failOnWarn,i=await V(n,{strictExit:a,strictDirectories:!!e.strictDirectories,requireMergeDrivers:!!e.requireMergeDrivers,checkOnly:!!e.checkOnly,checkTelemetry:!!e.checkTelemetry,noRefresh:!!e.noRefresh,refreshVectors:!!e.refreshVectors,verboseStaleItems:!!e.verboseStaleItems,verboseAuthorEvents:!!e.verboseAuthorEvents,brief:!!e.brief,summary:!!e.summary||a,skipVectors:!!e.skipVectors,skipIntegrity:!!e.skipIntegrity,skipDrift:!!e.skipDrift,full:!!e.full});l(i,n),a&&!i.ok&&(B({...i,exit_code:u.GENERIC_FAILURE,error_code:"health_findings",error_category:"validation",command_resolution:"health_findings",resolution_stage:"execute"}),process.exitCode=u.GENERIC_FAILURE),n.profile&&m(`profile:command=health took_ms=${Date.now()-o}`)}async function Ee(e,t){let n=c(t),o=Date.now(),a=await de({checkMetadata:!!e.checkMetadata,metadataProfile:s(e,"metadataProfile"),checkResolution:!!e.checkResolution,checkLifecycle:!!e.checkLifecycle,checkStaleBlockers:!!e.checkStaleBlockers,dependencyCycleSeverity:s(e,"dependencyCycleSeverity"),parentCycleSeverity:s(e,"parentCycleSeverity"),checkFiles:!!e.checkFiles,checkCommandReferences:!!e.checkCommandReferences,scanMode:s(e,"scanMode"),includePmInternals:!!e.includePmInternals,verboseFileLists:!!e.verboseFileLists,verboseDiagnostics:!!e.verboseDiagnostics,allAffectedIds:!!e.allAffectedIds,checkHistoryDrift:!!e.checkHistoryDrift,checkStorageIntegrity:!!e.checkStorageIntegrity,fixHints:!!e.fixHints,autoFix:!!e.autoFix,dryRun:!!e.dryRun,fixScope:Array.isArray(e.fixScope)?e.fixScope:void 0,pruneMissing:!!e.pruneMissing,counts:!!e.counts,full:!!e.full},n);l(a,n),(e.strictExit||e.failOnWarn)&&(a.has_warnings||!a.ok)&&(B({...a,exit_code:u.GENERIC_FAILURE,error_code:"validation_findings",error_category:"validation",command_resolution:"validation_findings",resolution_stage:"execute"}),process.exitCode=u.GENERIC_FAILURE),n.profile&&m(`profile:command=validate took_ms=${Date.now()-o}`)}async function Oe(e,t){let n=c(t),o=Date.now(),a=await q(n,{dryRun:e.dryRun===!0,scope:Array.isArray(e.scope)?e.scope:[]});l(a,n),n.profile&&m(`profile:command=gc took_ms=${Date.now()-o}`)}async function Pe(e,t,n,o){let a=c(o),i=I(process.cwd(),a.path),r=e.trim().toLowerCase();if(!E.some(d=>d===r))throw C({command_path:"workspace snapshot",token:e,allowed:E,display_name:"workspace snapshot",token_kind:"action",examples:["pm workspace snapshot create before-migration","pm workspace snapshot restore before-migration"]});if(r==="list"){l(await Y(i),a);return}if(r==="create"){l(await z(i,t===void 0?{}:{name:t}),a);return}if(t===void 0)throw new w(`pm workspace snapshot ${r} requires a snapshot name or fingerprint`,u.USAGE);if(r==="inspect"){l(await j(i,t),a);return}if(r==="restore"){if(n.dryRun===!0){l(await K(i,t),a);return}let d=await S(i);l(await X(i,t,{force:n.force===!0,author:P(s(n,"author"),d.author_default),message:s(n,"message"),lockTtlSeconds:d.locks.ttl_seconds,lockWaitMs:d.locks.wait_ms}),a);return}l(await Q(i,t),a)}async function he(e,t){let n=c(t);l(await Z(n),n)}async function Le(e,t){let n=c(t),o=Date.now(),a=await te({action:s(e,"action"),command:s(e,"command"),summary:!!e.summary,schemaOnly:!!e.schemaOnly,flagsOnly:!!e.flagsOnly,availabilityOnly:!!e.availabilityOnly,runtimeOnly:!!e.runtimeOnly||!!e.activeOnly,full:!!e.full},n);l(a,n),n.profile&&m(`profile:command=contracts took_ms=${Date.now()-o}`)}async function Me(e,t,n){let o=c(n),a=Date.now(),i={...A(t),ifAvailable:t.ifAvailable===!0,maxAttempts:t.maxAttempts};Fe(e,t.next===!0);let r=t.next===!0?await $(!!t.force,o,i,{type:typeof t.type=="string"?t.type:void 0,tag:typeof t.tag=="string"?t.tag:void 0,priority:t.priority,assigneeFilter:typeof t.assigneeFilter=="string"?t.assigneeFilter:void 0,parent:typeof t.parent=="string"?t.parent:void 0,sprint:typeof t.sprint=="string"?t.sprint:void 0,release:typeof t.release=="string"?t.release:void 0,includeDecisions:t.includeDecisions===!0,includeGates:t.includeGates===!0,includeContainers:t.includeContainers===!0,tokenBudget:t.tokenBudget??t.token_budget,explainRanking:t.explainRanking===!0||t.explain_ranking===!0}):await T(e,!!t.force,o,i);await p(o,r),l(r,o),o.profile&&m(`profile:command=claim took_ms=${Date.now()-a}`)}function Fe(e,t){if(!t&&!e)throw new w("Specify an item id or pass --next",u.USAGE);if(t&&e)throw new w("Specify either an item id or --next, not both",u.USAGE)}async function Ve(e,t,n){let o=c(n),a=Date.now(),i=await D(e,!!t.force,o,{...A(t),ownershipReleaseBypass:t.ownershipReleaseBypass===!0});await p(o,i),l(await L("release",[e],t,o,i),o),o.profile&&m(`profile:command=release took_ms=${Date.now()-a}`)}async function Ne(e,t,n){let o=c(n),a=Date.now(),i=I(process.cwd(),o.path),r=await S(i),d=R(r.schema),g=ee(d),f=!!t.force,h=A(t),v=await T(e,f,o,h);await p(o,v);let _=await x(e,{...h,status:g,force:f},o);await p(o,_),l({id:e,action:"start_task",claim:v,update:_},o),o.profile&&m(`profile:command=start-task took_ms=${Date.now()-a}`)}async function Ue(e,t,n){let o=c(n),a=Date.now(),i=I(process.cwd(),o.path),r=await S(i),d=R(r.schema),g=!!t.force,f=A(t),h=await x(e,{...f,status:d.open_status,force:g},o);await p(o,h);let v=await D(e,g,o,f);await p(o,v),l({id:e,action:"pause_task",update:h,release:v},o),o.profile&&m(`profile:command=pause-task took_ms=${Date.now()-a}`)}async function $e(e,t,n,o){let a=c(o),i=Date.now(),r=!!n.force,d=A(n),g=await H(e,t,{...d,validateClose:s(n,"validateClose"),force:r},a);await p(a,g);let f=await D(e,r,a,d);await p(a,f),l({id:e,action:"close_task",close:g,release:f},a),a.profile&&m(`profile:command=close-task took_ms=${Date.now()-i}`)}function me(e){return e.option("--background","Run linked tests in managed background mode").option("--timeout <seconds>","Default run timeout in seconds").option("--progress","Emit linked-test progress to stderr (always shown in TTY, opt-in for non-TTY)").option("--env-set <value>","Set environment variable(s) for linked-test runs (KEY=VALUE, repeatable)",k).option("--env-clear <value>","Clear environment variable(s) for linked-test runs (NAME, repeatable)",k).option("--shared-host-safe","Apply additive shared-host-safe runtime defaults for linked-test runs").option("--pm-context <mode>","PM linked-test context mode: schema|tracker|auto (default: schema)").option("--override-linked-pm-context","Force run-level --pm-context to override per-linked-test pm_context_mode metadata").option("--workspace-context <mode>","Source-workspace mode: source|isolated|snapshot (default: source)").option("--override-linked-workspace-context","Force run-level --workspace-context over per-linked-test metadata").option("--allow-untrusted-linked-tests","Execute untrusted linked commands when project policy also permits it").option("--fail-on-context-mismatch","Fail linked PM commands when context item counts differ").option("--fail-on-skipped","Treat skipped linked tests as dependency failures").option("--fail-on-empty-test-run","Treat successful linked-test commands that report zero executed tests as failures").option("--require-assertions-for-pm","Require assertion metadata for linked PM command tests").option("--check-context","Preflight linked PM command context diagnostics before executing commands").option("--auto-pm-context","Auto-remediate PM tracker-read context mismatches by routing those linked commands through tracker context")}function qt(e){ue(e);let t=e.command("test").argument("<id>","Item id").option("--add <value>","Add verified isolated test (CSV/markdown or stdin)",k).option("--add-json <value>","Add verified isolated test (JSON object/array or stdin)",k).option("--remove <value>","Remove linked test entry by exact command/path (command=<value> and path=<value> preserve commas and equals signs; or - for stdin)",k).option("--remove-index <n>","Remove the 1-based linked-test index from --list order (repeatable)",k).option("--list","List linked tests without mutating").option("--run","Run linked test commands").option("--match <value>","Run only linked tests whose command/path contains this substring").option("--only-index <n>","Run only the 1-based linked-test index from --list order").option("--only-last","Run only the most recently added linked test");t.option("--acknowledge-linked-tests","Trust the item's current linked commands in this clone without executing them"),me(t).option("--measure <value>","Record name=value[,unit=...][,threshold=...] evidence; repeatable",k).option("--metric-below <value>","Return evidence below name=value").option("--metric-diff <name>","Diff the latest two values").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage tests linked to an item and optionally run them.").action(Se);let n=e.command("test-all").description("Run linked tests across matching items.").option("--status <value>","Filter items by status before running tests").option("--limit <n>","Limit matching items before running linked tests").option("--offset <n>","Skip matching items before running linked tests");me(n).action(De),e.command("test-runs-worker",{hidden:!0}).argument("<runId>","Background run id").description("Internal background worker command.").action(async(f,h,v)=>{let _=c(v);await se(f,_)}),e.command("telemetry").argument("[namespace-or-subcommand]","Telemetry subcommand: status, flush, stats, clear (default: status)").argument("[subcommand]","Compatibility alias target for local-analytics: status, flush, stats, clear").option("--limit <n>","Maximum command groups returned by telemetry stats").description("Inspect and manage local telemetry queue/runtime state.").action(Ce),e.command("duplicates").description("Find duplicate clusters across all statuses.").option("--status <value>","Statuses (repeatable or comma-separated)",k,[]).option("--since <value>","Created at or after this time").option("--threshold <value>","Minimum similarity (0-1)").option("--limit <n>","Maximum clusters").option("--exhaustive","Score all pairs within the safety bound").action(Re),e.command("stats").description("Show project tracker statistics.").option("--include-empty","Restore zero-count registered item-type and lifecycle-status buckets").option("--storage","Include aggregate history-stream storage metrics (total streams/lines/bytes, largest + deepest streams, oldest/newest entries)").option("--metadata-coverage","Include metadata coverage % (acceptance_criteria, estimated_minutes, resolution, tags, parent) overall and by type").option("--by-assignee","Include a lifecycle-bucketed item breakdown grouped by assignee").option("--by-tag","Include a lifecycle-bucketed item breakdown grouped by tag").option("--by-priority","Include a lifecycle-bucketed item breakdown grouped by priority").option("--tag-prefix <value>","With --by-tag: only count tags starting with this prefix (e.g. domain:)").option("--field-utilization","Report content-field utilization rates (notes/learnings/files/docs/tests/comments/deps/body) for governance analysis").option("--analytics <json>","Improvement ledger/history analytics JSON").action(Be),e.command("health").description("Show project tracker health checks.").option("--strict-directories","Treat optional item-type directories as required failures").option("--require-merge-drivers","Treat absent clone-local merge drivers as a required health failure").option("--check-only","Run read-only health diagnostics without refreshing vectors").option("--check-telemetry","Probe telemetry endpoint health and include network diagnostics").option("--no-refresh","Disable automatic vector refresh attempts during health checks").option("--refresh-vectors","Explicitly enable vector refresh attempts during health checks").option("--verbose-stale-items","Include full stale vectorization ID lists in health output").option("--verbose-author-events","Include every actionable unknown-author event coordinate for review or disposition").option("--brief","Emit compact health details for low-token agent checks").option("--summary","Emit one-line-style health status with check names and warning count").option("--skip-vectors","Skip vectorization check for a faster run").option("--skip-integrity","Skip item/history file integrity check for a faster run").option("--skip-drift","Skip history drift hash check for a faster run").option("--full","Run all checks including slow integrity, drift, and vectorization checks").option("--strict-exit","Return non-zero exit when health is not ok and default to actionable summary output; use --full for complete details").option("--fail-on-warn","Alias for --strict-exit").action(Te),e.command("validate").description("Run standalone metadata, resolution, lifecycle, files, linked-command reference, and history drift validation checks.").option("--check-metadata","Run metadata completeness checks").option("--metadata-profile <value>","Select metadata validation profile for --check-metadata (core|strict|custom)").option("--check-resolution","Run closed-item resolution metadata checks").option("--check-lifecycle","Run active-item lifecycle governance drift checks").option("--check-stale-blockers","Include stale blocker-pattern diagnostics in lifecycle checks").option("--dependency-cycle-severity <value>","Set dependency-cycle warning policy for lifecycle checks (off|warn|error)").option("--parent-cycle-severity <value>","Set parent-hierarchy cycle warning policy for lifecycle checks (off|warn|error)").option("--check-files","Run linked-file and orphaned-file checks").option("--check-command-references","Run linked-command PM-ID reference checks").option("--scan-mode <value>","Select file candidate scan mode for --check-files (default|tracked-all|tracked-all-strict)").option("--include-pm-internals","Include PM storage internals in tracked-all candidate scans").option("--verbose-file-lists","Include full file-path lists for validate --check-files details").option("--verbose-diagnostics","Include full validate diagnostic ID lists instead of compact summaries").option("--all-affected-ids","Emit complete missing_* affected-ID lists with no truncation (implied by --json)").option("--strict-exit","Return non-zero exit when validation warnings are present").option("--fail-on-warn","Alias for --strict-exit").option("--fix-hints","Add a machine-executable fix_hints[] of pm commands to each failing check's details").option("--auto-fix","Apply the safe, deterministic subset of fix-hint remediations (field backfills) automatically").option("--dry-run","Preview planned --auto-fix/--prune-missing fixes without applying them").option("--fix-scope <scope>","Grant --auto-fix scopes (metadata, resolution, lifecycle; comma-separated or repeatable). Default: metadata, resolution; lifecycle must be named explicitly",k).option("--prune-missing","Remove stale linked-file/doc LINKS whose paths classified as deleted (never touches real files)").option("--check-history-drift","Run item/history hash drift checks").option("--check-storage-integrity","Run the post-merge storage-integrity check (unreadable items, history conflict markers, resurrected deletes, unparseable config/schema)").option("--counts","Keep validation counts and totals while omitting per-item diagnostic arrays").option("--full","Return the complete validation diagnostic projection").action(Ee),e.command("gc").option("--dry-run","Preview cleanup targets without deleting files; without this flag, pm gc deletes matched artifacts").option("--scope <value>","Limit cleanup to one or more scopes (comma-separated or repeatable): index, embeddings, runtime, locks, checkpoints, transactions",k).description("Delete optional cache artifacts by default (including expired lock debris) and show a summary.").action(Oe);let o=e.command("workspace").description("Inspect workspace state and snapshots.");o.command("position").description("Show merge and history readiness.").action(he),o.command("snapshot").argument("<action>","Action: create, list, inspect, restore, delete").argument("[target]","Optional name for create; name or fingerprint otherwise").description("Manage content-addressed tracker snapshots.").option("--dry-run","Preview restore file, item, stream, and history-entry impact without mutating state").option("--force","Explicitly confirm a whole-workspace snapshot restore").option("--author <value>","Actor recorded on the restore audit event").option("--message <value>","Human-readable restore rationale").action(Pe),e.command("contracts").description("Show machine-readable command and schema contracts for agents.").option("--action <value>","Filter tool schema branches to a specific action").option("--command <value>","Scope contracts output to one CLI command (narrow-by-default)").option("--summary","Return one command+intent row per top-level command for cheap agent bootstrap").option("--schema-only","Return schema-focused output only").option("--flags-only","Return command flag contracts only").option("--availability-only","Return action availability surface only").option("--runtime-only","Include only actions invocable in the current runtime").option("--active-only","Alias for --runtime-only").option("--full","Include full schema and command-flag surfaces (large; default brief output omits heavy sections for unfiltered queries)").action(Le);let a=e.command("claim").argument("[id]","Item id (omit with --next)").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force claim override").option("--if-available","Skip silently when the item is already claimed by another author (returns skipped=true)").option("--next","Atomically claim the next caller-available actionable item").option("--type <value>","Filter --next candidates by type").option("--tag <value>","Filter --next candidates by tag").option("--priority <value>","Filter --next candidates by priority").option("--assignee-filter <value>","Filter --next candidates: assigned|unassigned").option("--parent <id>","Scope --next candidates to a subtree").option("--sprint <value>","Filter --next candidates by sprint").option("--release <value>","Filter --next candidates by release").option("--max-attempts <n>","Bound the --next candidate walk (default 10; maximum 100)").option("--include-decisions","Allow --next to claim human-gated Decision items").option("--include-gates","Allow --next to claim outcome gates").option("--include-containers","Allow --next to claim containers with unfinished descendants").option("--token-budget <n>","Bound the estimated tokens used to rank --next candidates").option("--explain-ranking","Include ranking provenance for --next selection").description("Claim an item for active work.").action(Me);b(a,"--assignee <value>","Alias for --author on lifecycle ownership commands"),b(a,"--token_budget <n>","Alias for --token-budget"),b(a,"--explain_ranking","Alias for --explain-ranking");let i=e.command("release").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force release override").description("Release an item's active claim.").action(Ve);b(i,"--assignee <value>","Alias for --author on lifecycle ownership commands");let r=e.command("start-task").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: claim an item and move it to in_progress.").action(Ne);b(r,"--assignee <value>","Alias for --author on lifecycle ownership commands");let d=e.command("pause-task").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override when required").description("Lifecycle alias: move an item to open and release its claim.").action(Ue);b(d,"--assignee <value>","Alias for --author on lifecycle ownership commands");let g=e.command("close-task").argument("<id>","Item id").argument("[reason]","Close reason text").option("--author <value>","Mutation author").option("--message <value>","History message").option("--validate-close <value>","Close-time validation mode: off|warn|strict").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: close an item and release assignment metadata.").action($e);b(g,"--assignee <value>","Alias for --author on lifecycle ownership commands"),He(e)}function y(e){return typeof e=="string"?e:void 0}function fe(e){return{parent:y(e.parent),allowMissingParent:e.allowMissingParent===!0?!0:void 0,tags:y(e.tags),priority:y(e.priority),body:y(e.body),description:y(e.description),author:y(e.author),message:y(e.message)}}function He(e){for(let{name:t,describe:n}of[{name:"meet",describe:"Shortcut: create a Meeting with a start time and duration."},{name:"event",describe:"Shortcut: create an Event with a start time and duration."}])e.command(t).argument("<title>","Item title").option("--start <when>","Start time (ISO, 'now', or relative like +1h/+2d); defaults to now").option("--duration <span>","Duration from start (relative like 1h/2d); defaults to 1h when --end is omitted").option("--end <when>","End time (ISO or relative); overrides --duration").option("--location <value>","Location").option("--timezone <value>","IANA timezone (for example America/New_York)").option("--all-day","Mark as an all-day event").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description(n).action(async(o,a,i)=>{let r=c(i),d=Date.now(),f=await(t==="meet"?G:W)(o,{...fe(a),start:y(a.start),duration:y(a.duration),end:y(a.end),location:y(a.location),timezone:y(a.timezone),allDay:a.allDay===!0?!0:void 0},r);await p(r,f),l(f,r),r.profile&&m(`profile:command=${t} took_ms=${Date.now()-d}`)});e.command("remind").argument("<title>","Item title").option("--at <when>","Reminder time (ISO, 'now', or relative like +2d); defaults to +1d").option("--text <value>","Reminder text; defaults to the title").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description("Shortcut: create a Reminder from a single point in time.").action(async(t,n,o)=>{let a=c(o),i=Date.now(),r=await J(t,{...fe(n),at:y(n.at),text:y(n.text)},a);await p(a,r),l(r,a),a.profile&&m(`profile:command=remind took_ms=${Date.now()-i}`)})}export{Ht as _testOnlyRegisterOperations,qt as registerOperationCommands,Fe as requireClaimTarget};
2
+ //# sourceMappingURL=register-operations-DWVHR2NC.js.map
@@ -0,0 +1,2 @@
1
+ import{a as L,h as T}from"./chunk-KR3RP4FH.js";import{Ka as I,Pa as j,Ra as P,ta as U,wa as O}from"./chunk-FLDWYEND.js";import"./chunk-DEZPZOQ7.js";import{I as d,K as m,Nn as y,Qn as k,Vi as R,cb as D,f as G,g as $,lh as S,oh as w,ph as h}from"./chunk-AMRDVX36.js";import C from"node:fs/promises";import W from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="66c6b511-901e-596f-bf5b-6af9652519bb")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0b0e08e0-f6e7-59c4-ac96-9f47b172727a")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d975120a-964e-5b19-ae10-8ba011ba9bf8")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="74e48eb2-5a8d-51da-9abb-43d6451e5f11")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a22921b3-d233-5bf8-aa95-ab98ae854502")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3c84ab8c-970a-5d71-a5a3-9166a8da9e64")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4720a00c-4389-5dd4-a9f9-63aeff8c8762")}catch{}})();var H={extension:"extension",package:void 0};async function _(e,t){if(!e)return;let o=G(e),a=y(t);await R(D(process.cwd(),a.path)).then(r=>r.ux.deprecation_hints)&&h($(o))}var V={init:"init",install:"install",uninstall:"uninstall",explore:"explore",manage:"manage",describe:"describe",reload:"reload",doctor:"doctor",catalog:"catalog",adopt:"adopt","adopt-all":"adoptAll",activate:"activate",deactivate:"deactivate",migrate:"migrate"};function X(e){let t=e.capability,o=typeof t=="string"?[t]:Array.isArray(t)?t.filter(i=>typeof i=="string"):[],a=[...new Set(o.map(i=>i.trim().toLowerCase()).filter(i=>i.length>0))];if(a.length>1)throw new m(`Multiple scaffold capabilities cannot be combined yet: ${a.join(", ")}. Choose one capability per scaffold.`,d.USAGE);return a[0]}function A(e,t,o="extension"){let a={...e};t!==void 0&&(a[V[t]]=!0);let i=(...c)=>c.some(s=>a[s]===!0),r=(...c)=>{for(let s of c)if(typeof a[s]=="string")return a[s]};return{init:i("init"),scaffold:i("scaffold"),install:i("install"),uninstall:i("uninstall"),explore:i("explore","list"),manage:i("manage"),describe:i("describe"),markdown:i("markdown"),reload:i("reload"),doctor:i("doctor"),catalog:i("catalog"),adopt:i("adopt"),adoptAll:i("adoptAll","adopt_all","adopt-all"),activate:i("activate"),deactivate:i("deactivate"),migrate:i("migrate"),project:i("project"),local:i("local"),global:i("global"),gh:r("gh"),github:r("github"),ref:r("ref"),capability:X(e),declarative:i("declarative"),fields:r("fields"),detail:r("detail"),output:r("output"),trace:i("trace"),watch:i("watch"),runtimeProbe:i("runtimeProbe","runtime_probe","runtime-probe"),fixManagedState:i("fixManagedState","fix_managed_state","fix-managed-state"),isolated:i("isolated"),ignoreGlobal:i("ignoreGlobal","ignore_global","ignore-global"),strictExit:i("strictExit","strict_exit","strict-exit"),failOnWarn:i("failOnWarn","fail_on_warn","fail-on-warn"),dryRun:i("dryRun","dry_run","dry-run"),vocabulary:o}}async function Y(e){let t=(await C.readdir(process.cwd())).filter(a=>!a.startsWith(".")).sort((a,i)=>a.localeCompare(i)),o=[...e].sort((a,i)=>a.localeCompare(i));return t.length===o.length&&t.every((a,i)=>a===o[i])}async function J(e){let t=(e??[]).map(o=>o.trim()).filter(o=>o.length>0);return t.length<=1?t.length===0?void 0:t:await Y(t)?["*"]:t}function M(e,t,o){let a=e.markdown===!0;if(o!==void 0&&o==="")throw new m("--output requires a non-empty file path.",d.USAGE);if(o!==void 0&&!a)throw new m("--output is only supported with --markdown describe output.",d.USAGE);if(a){if(t.json)throw new m("Cannot combine --json with --markdown.",d.USAGE);if(e.describe!==!0)throw new m("--markdown is only supported by the describe action.",d.USAGE)}}async function Q(e){let t=O(e.result.details,e.vocabulary);if(e.outputPath!==void 0){let o=W.resolve(e.outputPath);await C.mkdir(W.dirname(o),{recursive:!0}),await C.writeFile(o,t,"utf8")}if(!e.globalOptions.quiet){for(let o of e.result.warnings)h(`warning: ${o}`);e.outputPath===void 0&&S(t)}}function Z(e,t){let o=!!t.strictExit||!!t.failOnWarn;if(e.action!=="doctor"||!o)return;let a=e.details!==null&&typeof e.details=="object"?e.details:{},i=a.summary!==null&&typeof a.summary=="object"?a.summary:null,r=i&&typeof i.status=="string"?i.status:void 0;(e.warnings.length>0||r!==void 0&&r!=="ok")&&(process.exitCode=d.GENERIC_FAILURE)}async function p(e,t,o,a,i="extension"){let r=y(o),c=Date.now(),s=i==="extension"?"package":i;await _(H[i],o);let n=A(t,a,s),f=(typeof n.output=="string"?n.output:void 0)?.trim();M(n,r,f);let g=await I(e,n,r);n.markdown===!0?await Q({result:g,vocabulary:s,outputPath:f,globalOptions:r}):w(g,r),Z(g,n),g.ok===!1&&(process.exitCode=d.GENERIC_FAILURE),r.profile&&h(`profile:command=extension took_ms=${Date.now()-c}`)}function ee(e){return e.details!==null&&typeof e.details=="object"?e.details:{}}function te(e){return e instanceof m?{message:e.message,exit_code:e.exitCode,...e.context}:{message:e instanceof Error?e.message:String(e),exit_code:d.GENERIC_FAILURE}}async function oe(e,t,o){let a=[],i=[],r=d.GENERIC_FAILURE;for(let c of e)try{let s=await I(c,t,o),n=ee(s),l=Array.isArray(s.warnings)?s.warnings:[];i.push(...l);let f=s.ok===!0;a.push({target:c,ok:f,extension:n.extension,source:n.source,install_plan:n.install_plan,dry_run:n.dry_run,destination_path:n.destination_path,activated:n.activated,settings_changed:n.settings_changed,command_paths:n.command_paths,action_paths:n.action_paths,runtime_activation_status:n.runtime_activation_status,activation_diagnostics:n.activation_diagnostics,command_discovery:n.command_discovery,verification:n.verification,warnings:l,...f?{}:{error:{message:"Extension install returned ok=false without throwing an error.",exit_code:d.GENERIC_FAILURE,code:"extension_install_soft_failed"}}})}catch(s){let n=te(s),l=n.exit_code;typeof l=="number"&&r===d.GENERIC_FAILURE&&l!==d.GENERIC_FAILURE&&(r=l),a.push({target:c,ok:!1,error:n})}return{rows:a,warnings:i,failureExitCode:r}}async function z(e,t,o,a){let i=a==="extension"?"package":a;await _(H[a],o);let r=await J(e);if(r===void 0||r.length<=1){await p(r?.[0],t,o,"install",i);return}let c=y(o),s=Date.now(),n=A(t,"install",i);if(M(n,c,void 0),[n.gh,n.github].some(b=>typeof b=="string"&&b.trim().length>0))throw new m("Multiple install targets cannot be combined with --gh/--github. Install one GitHub source per command, or pass multiple explicit local, bundled, or npm: targets.",d.USAGE,{code:"multi_target_github_install_ambiguous",required:"Use exactly one positional target with --gh/--github, or omit --gh/--github when installing multiple targets.",examples:["pm install --gh owner/repo","pm install npm:pm-guide-shell pm-todos"]});let{rows:f,warnings:g,failureExitCode:E}=await oe(r,n,c),v=f.filter(b=>b.ok!==!0).length,K={ok:v===0,action:"install",scope:n.global===!0?"global":"project",installed_count:n.dryRun===!0?0:f.length-v,...n.dryRun===!0?{dry_run:!0,planned_count:f.length-v}:{},failed_count:v,targets:f,warnings:[...new Set(g)].sort((b,B)=>b.localeCompare(B))};w(K,c),v>0&&(process.exitCode=E),c.profile&&h(`profile:command=extension took_ms=${Date.now()-s}`)}function ae(e){return e.option("--project","Use project extension scope (default)").option("--local","Alias for --project").option("--global","Use global extension scope")}function x(e){return e.option("--project","Use project package scope (default)").option("--local","Alias for --project").option("--global","Use global package scope")}function u(e,t){return t==="package"?x(e):ae(e)}function N(e){return e.option("--dry-run","Plan CLI/package upgrades without running npm or reinstalling packages").option("--cli-only","Upgrade only the pm CLI/SDK npm package").option("--packages-only","Upgrade only managed pm packages").option("--repair","Force npm global reinstall when upgrading the pm CLI/SDK").option("--tag <value>","npm dist-tag/version for CLI and registry package upgrades").option("--package-name <value>","Override the CLI package name for self-upgrade testing")}async function q(e,t,o){let a=y(t),i=Date.now();o&&await _("upgrade",t);let r=await L(e,t.optsWithGlobals(),a);w(r,a),r.ok||(process.exitCode=d.GENERIC_FAILURE),a.profile&&h(`profile:command=package-upgrade took_ms=${Date.now()-i}`)}function F(e,t){let o=t==="package"?"package":"extension",a=t==="package"?"packages":"extensions",i=t,r=e.command(i,{hidden:t==="extension"}).argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} source, name, or scaffold path`).option("--init",`Generate a starter ${o} scaffold at target path`).option("--scaffold","Alias for --init").option("--capability <kind>","Starter capability for --init (default: commands)",k).option("--install",`Install a ${o} source`).option("--dry-run","Resolve install sources and estimate copying without destination writes or activation").option("--uninstall",`Uninstall an installed ${o}`).option("--explore",`List discovered ${a} in selected scope`).option("--list","Alias for --explore").option("--manage",`List managed ${a} with update-check metadata`).option("--describe",`Map every surface a loaded ${o} registers (optionally one by name)`).option("--markdown","Render describe output as a Markdown reference document (describe only)").option("--output <path>","Write describe Markdown to a file (requires --markdown)").option("--reload",`Reload ${a} with cache-busted module imports`).option("--watch","Use watch mode with --reload").option("--doctor",`Run consolidated ${o} diagnostics (summary/deep modes)`).option("--catalog",`List bundled first-party ${o} catalog metadata`).option("--adopt",`Adopt an existing unmanaged ${o} into managed metadata`).option("--adopt-all",`Adopt all unmanaged ${a} into managed metadata`).option("--activate",`Activate a ${o} in selected scope settings`).option("--deactivate",`Deactivate a ${o} in selected scope settings`).option("--project",`Use project ${o} scope (default)`).option("--local","Alias for --project").option("--global",`Use global ${o} scope`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").option("--detail <mode>",`${o[0].toUpperCase()}${o.slice(1)} diagnostics detail mode (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${a} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${a} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(t==="package"?"Manage package lifecycle in project or global scope.":"Manage extension lifecycle in project or global scope.").action(async(s,n,l)=>{await p(s,l.optsWithGlobals(),l,void 0,t)});t==="package"&&(r.alias("packages"),r.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"));let c=r.command("init").alias("scaffold").argument("<target>","Scaffold target directory path").option("--capability <kind>",`Capability the starter targets (${U.join("|")}; default commands)`,k).description(t==="package"?"Generate a starter package scaffold with package metadata, manifest, and entrypoint.":"Generate a starter extension scaffold with manifest and entrypoint.");t==="package"&&c.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"),u(c,t).action(async(s,n,l)=>{await p(s,l.optsWithGlobals(),l,"init",t)}),u(r.command("install").option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]",`${o[0].toUpperCase()}${o.slice(1)} source (local path, bundled alias, npm: source, wildcard, or GitHub source)`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description(`Install ${o} from local path, bundled alias, npm: source, wildcard, or GitHub source.`),t).action(async(s,n,l)=>{await z(s,l.optsWithGlobals(),l,t)}),u(r.command("uninstall").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Uninstall an installed ${o}.`),t).action(async(s,n,l)=>{await p(s,l.optsWithGlobals(),l,"uninstall",t)}),u(r.command("explore").description(`List discovered ${a} in selected scope.`),t).action(async(s,n)=>{await p(void 0,n.optsWithGlobals(),n,"explore",t)}),u(r.command("manage").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${a} before diagnostics/update checks`).description(`List managed ${a} with update-check metadata.`),t).action(async(s,n)=>{await p(void 0,n.optsWithGlobals(),n,"manage",t)}),u(r.command("describe").argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} name to describe (omit for every loaded ${o})`).option("--markdown","Render the surface map as a Markdown reference document instead of toon/json").option("--output <path>","Write Markdown output to a file (requires --markdown)").description(`Map every surface a loaded ${o} registers (commands, hooks, item types, providers, overrides, ...).`),t).action(async(s,n,l)=>{await p(s,l.optsWithGlobals(),l,"describe",t)}),u(r.command("reload").option("--watch","Use watch mode for repeated reload checks").description(`Reload ${a} with cache-busted module imports.`),t).action(async(s,n)=>{await p(void 0,n.optsWithGlobals(),n,"reload",t)}),u(r.command("doctor").option("--detail <mode>",`Detail mode for ${o} diagnostics (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--fix-managed-state",`Adopt unmanaged ${a} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${a} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(`Run consolidated ${o} diagnostics (summary/deep modes).`),t).action(async(s,n)=>{await p(void 0,n.optsWithGlobals(),n,"doctor",t)}),u(r.command("catalog").alias("list").option("--fields <value>","Render compact comma-separated catalog fields, for example: alias,installed,install_command").description(`List bundled first-party ${o} catalog metadata.`),t).action(async(s,n)=>{await p(void 0,n.optsWithGlobals(),n,"catalog",t)}),u(r.command("adopt").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).option("--gh <owner/repo[/path]>",`GitHub provenance shorthand for adopted ${o}`).option("--github <owner/repo[/path]>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub shorthand source").description(`Adopt an existing unmanaged ${o} into managed metadata.`),t).action(async(s,n,l)=>{await p(s,l.optsWithGlobals(),l,"adopt",t)}),u(r.command("adopt-all").description(`Adopt all unmanaged ${a} into managed metadata.`),t).action(async(s,n)=>{await p(void 0,n.optsWithGlobals(),n,"adopt-all",t)}),u(r.command("migrate").option("--dry-run","Plan active migrations without invoking extension code").description(`Plan or apply active ${o} migrations with durable receipts.`),t).action(async(s,n)=>{await p(void 0,n.optsWithGlobals(),n,"migrate",t)}),u(r.command("activate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Activate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await p(s,l.optsWithGlobals(),l,"activate",t)}),u(r.command("deactivate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Deactivate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await p(s,l.optsWithGlobals(),l,"deactivate",t)}),t==="package"&&N(x(r.command("upgrade").argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(s,n,l)=>{await q(s,l,!1)})}async function ie(e,t,o){let a=y(o),i=Date.now(),r=await P(e,a,{idPrefix:typeof t.idPrefix=="string"?t.idPrefix:void 0,preset:typeof t.preset=="string"?t.preset:void 0,defaults:t.defaults===!0||t.yes===!0,author:typeof t.author=="string"?t.author:void 0,agentGuidance:typeof t.agentGuidance=="string"?t.agentGuidance:void 0,typePreset:typeof t.typePreset=="string"?t.typePreset:void 0,withPackages:t.withPackages===!0,mergeFence:t.mergeFence!==!1,force:t.force===!0,workspace:typeof t.workspace=="string"?t.workspace:void 0}),s=t.verbose===!0||a.json===!0;w(s?r:j(r),a),a.profile&&h(`profile:command=init took_ms=${Date.now()-i}`)}function ne(e,t,o,a){let r=e!==void 0&&new Set(["get","set","list","export"]).has(e);return{resolvedScope:r?"project":e??"project",resolvedAction:r?e:t??"list",resolvedKey:r?t:o,resolvedValue:r?o:a}}function re(e){return{criterion:Array.isArray(e.criterion)?e.criterion:[],format:typeof e.format=="string"?e.format:void 0,policy:typeof e.policy=="string"?e.policy:void 0,value:typeof e.value=="string"?e.value:void 0,clearCriteria:e.clearCriteria===!0,defaultDepth:typeof e.defaultDepth=="string"?e.defaultDepth:void 0,activityLimit:typeof e.activityLimit=="string"?e.activityLimit:void 0,staleThresholdDays:typeof e.staleThresholdDays=="string"?e.staleThresholdDays:void 0,sectionHierarchy:typeof e.sectionHierarchy=="string"?e.sectionHierarchy:void 0,sectionActivity:typeof e.sectionActivity=="string"?e.sectionActivity:void 0,sectionProgress:typeof e.sectionProgress=="string"?e.sectionProgress:void 0,sectionBlockers:typeof e.sectionBlockers=="string"?e.sectionBlockers:void 0,sectionFiles:typeof e.sectionFiles=="string"?e.sectionFiles:void 0,sectionWorkload:typeof e.sectionWorkload=="string"?e.sectionWorkload:void 0,sectionStaleness:typeof e.sectionStaleness=="string"?e.sectionStaleness:void 0,sectionTests:typeof e.sectionTests=="string"?e.sectionTests:void 0}}async function se(e,t,o,a,i,r){let c=y(r),s=Date.now(),{resolvedScope:n,resolvedAction:l,resolvedKey:f,resolvedValue:g}=ne(e,t,o,a),E=await T(n,l,f,re(i),c,typeof g=="string"?g:void 0);w(E,c),c.profile&&h(`profile:command=config took_ms=${Date.now()-s}`)}var Se={normalizeExtensionOptions:A};function Re(e){e.command("init").argument("[prefix-or-path]","Optional id prefix, or path-like tracker target such as ./pm-sandbox").option("--prefix, --id-prefix <value>","Set the item ID prefix (alias for the positional prefix)").option("--preset <value>","Governance preset for new setups: minimal|default|strict").option("--defaults","Use non-interactive setup defaults without opening the wizard").option("-y, --yes","Alias for --defaults (non-interactive setup)").option("--author <value>","Set the default mutation author for this project").option("--agent-guidance <mode>","Agent guidance mode: ask|add|skip|status").option("--type-preset <name>","Register domain item types during init: agile|ops|research").option("--with-packages","Install all bundled first-party packages during initialization").option("--no-merge-fence","Skip automatic merge-driver installation for a fresh Git-backed tracker").option("--workspace <dir>","Initialize repository-local tracker storage at <dir>/.agents/pm").option("--force","Allow initializing tracker files directly in a directory that looks like a workspace root").option("--verbose","Include the full resolved settings tree in the output (default output is a concise summary)").description("Initialize pm storage and defaults for the current workspace or a path-like tracker target.").action(async(t,o,a)=>{await ie(t,o,a)}),e.command("config").argument("[scope]","Config scope: project|global, or action shorthand list|export|get|set for project scope").argument("[action]","Config action: get|set|list|export").argument("[key]","Config key for get|set; use `pm config project list` for the complete typed inventory, including mutation-guard-* policies").argument("[value]",'Optional value for set: routed to the right typed flag by key (e.g. config set telemetry-tracking off, config set item-format toon, config set definition-of-done "Tests pass"). Equivalent to --policy/--format/--criterion. context keys still require --default-depth/--section-* flags.').option("--criterion <text>","Criteria value for definition-of-done, metadata-required-fields, or lifecycle pattern keys (repeatable for set)",k).option("--clear-criteria","Clear criteria-list keys for config set operations").option("--format <value>","Item format for item-format key: toon").option("--policy <value>","Policy key values: history-missing-stream-policy=auto_create|strict_error; sprint-release-format-policy=warn|strict_error; parent-reference-policy=warn|strict_error; governance-preset=minimal|default|strict|custom; governance-ownership-enforcement=none|warn|strict; governance-create-mode-default=progressive|strict; governance-close-validation-default=off|warn|strict; governance-require-close-reason=enabled|disabled; governance-parent-reference-policy=warn|strict_error; governance-metadata-validation-profile=core|strict|custom; governance-force-required-for-stale-lock=enabled|disabled; governance-duplicate-detection-mode=off|advisory|strict; test-result-tracking=enabled|disabled; untrusted-linked-test-execution=enabled|disabled; telemetry-tracking=enabled|disabled").option("--value <value>","Typed nested setting value. Mutation guards: require-attributed-author=true|false, secret-guard=off|advise|block, stale-in-progress-hours=integer>=1. Kebab-case is preferred; underscore aliases remain accepted.").option("--default-depth <value>","Context default depth: brief|standard|deep").option("--activity-limit <n>","Context default activity limit").option("--stale-threshold-days <n>","Context staleness cutoff in days").option("--section-hierarchy <value>","Enable/disable context hierarchy section (true|false)").option("--section-activity <value>","Enable/disable context activity section (true|false)").option("--section-progress <value>","Enable/disable context progress section (true|false)").option("--section-blockers <value>","Enable/disable context blockers section (true|false)").option("--section-files <value>","Enable/disable context files section (true|false)").option("--section-workload <value>","Enable/disable context workload section (true|false)").option("--section-staleness <value>","Enable/disable context staleness section (true|false)").option("--section-tests <value>","Enable/disable context tests section (true|false)").description("Read or update pm settings for the current workspace or global profile.").action(async(t,o,a,i,r,c)=>{await se(t,o,a,i,r,c)}),F(e,"extension"),F(e,"package"),x(e.command("install",{hidden:!0}).option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]","Package source (local path, bundled alias, npm: source, wildcard, or GitHub source)").option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description("Install a pm package into the project package scope by default.")).action(async(t,o,a)=>{await _("install",a),await z(t,a.optsWithGlobals(),a,"package")}),N(x(e.command("upgrade",{hidden:!0}).argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(t,o,a)=>{await q(t,a,!0)})}export{Se as _testOnlyRegisterSetup,Re as registerSetupCommands};
2
+ //# sourceMappingURL=register-setup-BQ5SVD4B.js.map
@@ -0,0 +1,3 @@
1
+ import{$ as _,O as V,Ob as B,P as W,Q as K,R as G,aa as y,ja as J,ma as H,na as Y,q as C,r as x,s as $,t as P,u as q}from"./chunk-QHNETP77.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="84305ac5-3641-52f5-80f2-22c0f0ae70ae")}catch{}})();var k=new Set(W),z=Object.freeze({get size(){return k.size},has(e){return k.has(e)},entries(){return k.entries()},keys(){return k.keys()},values(){return k.values()},forEach(e,t){k.forEach(r=>e.call(t,r,r,z))},[Symbol.iterator](){return k.values()}});function X(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Z(e){return typeof e!="string"?null:V(e)}function ce(e){try{return structuredClone(e)}catch{return e}}function de(e){let t=e.trim(),r=t.indexOf("=");if(r<=0)throw new y(`--field entries must use name=value syntax, received: ${e}`,_.USAGE);let n=t.slice(0,r).trim(),s=t.slice(r+1);return{key:n,value:s}}function ue(e){return`--${e.replaceAll("_","-")}`}function fe(e,t,r){try{let n=JSON.parse(e);if(r==="array"&&Array.isArray(n)||r==="object"&&typeof n=="object"&&n!==null&&!Array.isArray(n))return n}catch{}throw new y(`--field ${t}=... must be valid JSON ${r}`,_.USAGE)}function me(e,t,r){if(t==="string")return r;if(t==="number"){let n=r.trim();if(n.length===0)throw new y(`--field ${e}=... must be a number`,_.USAGE);let s=Number(n);if(!Number.isFinite(s))throw new y(`--field ${e}=... must be a number`,_.USAGE);return s}if(t==="boolean"){let n=r.trim().toLowerCase();if(n==="true"||n==="1"||n==="yes")return!0;if(n==="false"||n==="0"||n==="no")return!1;throw new y(`--field ${e}=... must be one of true|false|1|0|yes|no`,_.USAGE)}return t==="string_array"?r.split(/[\n,|]/u).map(n=>n.trim()).filter(n=>n.length>0):fe(r,e,t)}function U(e){let t=new Map;if(!e)return t;for(let r of e.item_fields)for(let n of r.fields){let s=X(n.name),i=Z(n.type);if(!s||!i)continue;let l=t.get(s);if(l&&l.type!==i)throw new y(`Extension item field "${s}" is declared with conflicting types: ${l.type}, ${i}`,_.USAGE,{code:"extension_item_field_type_conflict",nextSteps:["Make every active extension declaration for this field use the same type."]});t.set(s,{name:s,type:i})}return t}function Q(e){if(z.has(e))throw new y(`Extension item field "${e}" collides with built-in item metadata "${e}"; rename the extension field with an extension-specific prefix. Reserved fields: ${[...z].sort((t,r)=>t.localeCompare(r)).join(", ")}.`,_.USAGE,{code:"extension_item_field_reserved",nextSteps:["Rename the extension item field, preferably with an extension-specific prefix."]})}function Ze(e){return[...U(e).keys()].sort((t,r)=>t.localeCompare(r))}function Qe(e,t){if(!e||e.length===0)return{};let r=U(t),n={};for(let s of e){let{key:i,value:l}=de(s),a=r.get(i);if(!a){if(z.has(i)){let c=ue(i);throw new y(`--field ${i} is a core item field, not an extension field`,_.USAGE,{code:"core_item_field_requires_dedicated_flag",field:i,recovery:{provided_fields:[i],suggested_flags:[c]},nextSteps:[`Set the core field with its dedicated flag: pm update <id> ${c} <value>`,`When closing an item, pm close <id> also accepts ${c} <value>.`]})}let o=[...r.keys()].sort((c,u)=>c.localeCompare(u));throw new y(`--field ${i} is not declared by an active extension item-field registration`,_.USAGE,{code:"extension_item_field_unknown",recovery:{provided_fields:o},nextSteps:o.length>0?[`Use one of the declared fields: ${o.join(", ")}`]:["Activate an extension that calls registerItemFields before setting extension fields."]})}Q(a.name),n[a.name]=me(a.name,a.type,l)}return n}function _e(e,t){return t==="string"?typeof e=="string":t==="number"?typeof e=="number"&&Number.isFinite(e):t==="boolean"?typeof e=="boolean":t==="array"?Array.isArray(e):t==="string_array"?Array.isArray(e)&&e.every(r=>typeof r=="string"):typeof e=="object"&&e!==null&&!Array.isArray(e)}function ye(e,t){return!t||t.length===0?!0:t.some(r=>Object.is(r,e))}function et(e,t,r={}){if(t){U(t);for(let n of t.item_fields)for(let s of n.fields){let i=X(s.name);if(!i)continue;Q(i),!(i in e)&&!r.skipDefaultFields?.has(i)&&Object.prototype.hasOwnProperty.call(s,"default")&&(e[i]=ce(s.default));let l=e[i];if(l===void 0)continue;let a=Z(s.type);if(a&&!_e(l,a))throw new TypeError(`Item field "${i}" must be of type ${a}`);let o=Array.isArray(s.values)?s.values:void 0;if(!ye(l,o))throw new TypeError(`Item field "${i}" must match one of the configured allowed values`)}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d66d32f8-a5f2-5068-bcd0-b93094d7c6a4")}catch{}})();var pe=2e3,D=new Map;function A(e){if(typeof e!="string")return"";let t=D.get(e);if(t!==void 0)return t;let r=e.trim().toLowerCase().replaceAll(/[\s-]+/g,"_");return D.size>=pe&&B(D),D.set(e,r),r}import ee from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="87798e93-c34c-5355-aa60-695fb9e3eef1")}catch{}})();var p=Object.freeze({types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"}),ne=G,L=K,we=["create","update"],he=new Set(x),Se=new Set($),ge=new Set(P),Ae=new Set(q),be=new Set(["string","number","boolean","array","object"]),Ee=16;function se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var ve=[e=>e.type===void 0||typeof e.type=="string"&&be.has(e.type),e=>!Object.hasOwn(e,"const")||N(e.const),e=>e.enum===void 0||Array.isArray(e.enum)&&e.enum.every(t=>N(t)),e=>e.min_length===void 0||Number.isInteger(e.min_length)&&e.min_length>=0,e=>e.min_items===void 0||Number.isInteger(e.min_items)&&e.min_items>=0,e=>e.format===void 0||e.format==="date-time",e=>e.required===void 0||Array.isArray(e.required)&&e.required.every(t=>typeof t=="string"&&t.length>0),e=>e.additional_properties===void 0||typeof e.additional_properties=="boolean",e=>e.properties===void 0||se(e.properties),e=>e.one_of===void 0||Array.isArray(e.one_of)&&e.one_of.length>0];function N(e,t=new Set){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||t.has(e))return!1;t.add(e);let r=Array.isArray(e)?e.every(n=>N(n,t)):Object.values(e).every(n=>N(n,t));return t.delete(e),r}function R(e,t=0,r=new Set){if(!se(e)||t>Ee||r.has(e))return;r.add(e);let n=e,s=n.type,i=n.enum,l=n.one_of,a=n.properties,o=n.items,c=n.required,u=n.min_length,d=n.min_items,w=n.format,S=n.additional_properties;if(!ve.every(m=>m(n))){r.delete(e);return}let b=a===void 0?void 0:Object.fromEntries(Object.entries(a).map(([m,O])=>[m,R(O,t+1,r)])),E=o===void 0?void 0:R(o,t+1,r),v=l===void 0?void 0:l.map(m=>R(m,t+1,r));if([...Object.values(b??{}),...o===void 0?[]:[E],...v??[]].some(m=>m===void 0)){r.delete(e);return}return r.delete(e),Object.fromEntries(Object.entries({type:s,const:Object.hasOwn(n,"const")?n.const:void 0,enum:i,min_length:u,min_items:d,format:w,properties:b,required:c===void 0?void 0:[...new Set(c)],additional_properties:S,items:E,one_of:v}).filter(([,m])=>m!==void 0))}function T(e){let t=Array.isArray(e)?e:[];return[...new Set(t.map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0))].sort((r,n)=>r.localeCompare(n))}function f(e){if(typeof e!="string"||e.length===0)return;let t=A(e);return t.length>0?t:void 0}function ke(e){return e.startsWith("--")?e.slice(2):e}function te(e){return typeof e=="string"?ke(e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-")):""}function ie(e){return e.replaceAll("_","-")}function Fe(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g," ").trim().split(/\s+/).filter(s=>s.length>0).map(s=>s.toLowerCase());if(t.length===0)return e;let[r,...n]=t;return`${r}${n.map(s=>`${s.slice(0,1).toUpperCase()}${s.slice(1)}`).join("")}`}function M(e,t){let r=f(e.id);if(!r)return null;let n=[...new Set(T(e.aliases).map(A).filter(a=>a.length>0))].sort((a,o)=>a.localeCompare(o)),s=T(e.roles).filter(a=>he.has(a)),i=e.description?.trim(),l=typeof e.order=="number"&&Number.isFinite(e.order)?e.order:t;return{id:r,aliases:n,roles:s,description:i&&i.length>0?i:void 0,order:l}}function Te(e){return{draft_status:f(e?.draft_status),open_status:f(e?.open_status),in_progress_status:f(e?.in_progress_status),blocked_status:f(e?.blocked_status),close_status:f(e?.close_status),canceled_status:f(e?.canceled_status)}}function oe(e,t){if(!Array.isArray(t)||t.length!==2)return;let r=A(t[0]),n=A(t[1]);r.length===0||n.length===0||e.pairs.some(s=>s[0]===r&&s[1]===n)||e.pairs.push([r,n])}function Ie(e){let t=typeof e?.type=="string"?e.type.trim():"";if(t.length===0||!Array.isArray(e?.allowed_transitions))return null;let r={type:t,pairs:[],denyAll:e.allowed_transitions.length===0};for(let n of e.allowed_transitions)oe(r,n);return{typeKey:t.toLowerCase(),record:r}}function ze(e){if(!Array.isArray(e)||e.length===0)return;let t=new Map;for(let n of e){let s=Ie(n);if(s===null)continue;let i=t.get(s.typeKey)??s.record;i.denyAll||=s.record.denyAll;for(let l of s.record.pairs)oe(i,l);t.set(s.typeKey,i)}let r=[];for(let n of t.values())(n.pairs.length>0||n.denyAll)&&r.push({type:n.type,allowed_transitions:n.pairs});return r.sort((n,s)=>n.type.localeCompare(s.type)),r.length>0?r:void 0}function ae(e){let t=A(e.key??"");if(!t)return null;let r=A(e.metadata_key??e.front_matter_key??t),n=te(e.cli_flag??ie(t));if(!n)return null;let s=T(e.cli_aliases).map(d=>te(d)).filter(d=>d.length>0&&d!==n),i=typeof e.type=="string"?e.type.trim().toLowerCase():"string",l=Se.has(i)?i:"string",a=(()=>{let d=T(e.commands).filter(w=>ge.has(w));return d.length>0?d:[...we]})(),o=e.description?.trim(),c=T(e.required_types),u=e.value_schema===void 0?void 0:R(e.value_schema);return e.value_schema!==void 0&&u===void 0?null:{key:t,metadata_key:r,cli_flag:n,cli_aliases:s,description:o&&o.length>0?o:void 0,type:l,commands:a,repeatable:[e.repeatable===!0,l==="string_array"].includes(!0),required:e.required===!0,required_on_create:e.required_on_create===!0,required_types:c,allow_unset:e.allow_unset!==!1,value_schema:u}}function De(e){let t=new Map;for(let[n,s]of e.entries()){let i=M(s,n);i&&t.set(i.id,i)}let r=re([...t.values()]);return r.length>0?r:re(L.map((n,s)=>M(n,s)).filter(n=>n!==null))}function re(e){return e.sort((t,r)=>t.order===r.order?t.id.localeCompare(r.id):t.order-r.order)}function Re(e){let t=new Map;for(let r of e??[]){let n=ae(r);n&&t.set(n.key,n)}return[...t.values()].sort((r,n)=>r.key.localeCompare(n.key))}function Ne(e){return{id:e.id,aliases:e.aliases.length>0?[...e.aliases]:void 0,roles:e.roles.length>0?[...e.roles]:void 0,description:e.description,order:e.order}}function Oe(e){return{key:e.key,metadata_key:e.metadata_key!==e.key?e.metadata_key:void 0,cli_flag:e.cli_flag!==ie(e.key)?e.cli_flag:void 0,cli_aliases:e.cli_aliases.length>0?[...e.cli_aliases]:void 0,description:e.description,type:e.type,commands:[...e.commands],repeatable:e.repeatable===!0?!0:void 0,required:e.required===!0?!0:void 0,required_on_create:e.required_on_create===!0?!0:void 0,required_types:e.required_types.length>0?[...e.required_types]:void 0,allow_unset:e.allow_unset===!1?!1:void 0,value_schema:e.value_schema}}function Ue(e){let t=typeof e=="string"?e.trim().toLowerCase():"allow";return Ae.has(t)?t:"allow"}function I(e){let t={...p,...e?.files},r=e?.statuses&&e.statuses.length>0?e.statuses:L,n=De(r),s=Re(e?.fields);return{version:typeof e?.version=="number"&&Number.isFinite(e.version)?Math.floor(e.version):1,files:t,statuses:n.map(Ne),fields:s.map(Oe),workflow:{...ne,...Te(e?.workflow)},type_workflows:ze(e?.type_workflows),unknown_field_policy:Ue(e?.unknown_field_policy)}}function Me(e){return`${JSON.stringify(e,null,2)}
2
+ `}function Le(){return{definitions:[]}}function je(){return{statuses:L}}function Ce(){return{fields:[]}}function xe(){return{workflow:ne}}function $e(e,t,r){try{return JSON.parse(e)}catch{r.push(t);return}}function Pe(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let r=t.item_types;if(Array.isArray(r.definitions))return r.definitions}}function qe(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function Ve(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function We(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;return typeof t.workflow=="object"&&t.workflow!==null&&!Array.isArray(t.workflow)?t.workflow:typeof t.workflows=="object"&&t.workflows!==null&&!Array.isArray(t.workflows)?t.workflows:t}function Ke(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;if(Array.isArray(t.type_workflows))return t.type_workflows}function h(e,t,r){let n=t?.trim()||r;return ee.isAbsolute(n)?n:ee.join(e,n)}function ct(e,t){return h(e,t.files.types,p.types)}async function dt(e,t){let r=I(t),n=[{path:h(e,r.files.types,p.types),seed:Le()},{path:h(e,r.files.statuses,p.statuses),seed:je()},{path:h(e,r.files.fields,p.fields),seed:Ce()},{path:h(e,r.files.workflows,p.workflows),seed:xe()}],s=[];for(let i of n)await J(i.path)||(await Y(i.path,Me(i.seed)),s.push(i.path));return{created_paths:s}}async function ut(e,t){let r=I(t),n=[],s=h(e,r.files.types,p.types),i=h(e,r.files.statuses,p.statuses),l=h(e,r.files.fields,p.fields),a=h(e,r.files.workflows,p.workflows),o,c,u,d,w,S=async(O,le)=>{let j=await H(O);if(j!==null)return $e(j,le,n)},b=await S(s,"runtime_schema_types_invalid_json");b!==void 0&&(o=Pe(b),o===void 0&&n.push("runtime_schema_types_invalid_shape"));let E=await S(i,"runtime_schema_statuses_invalid_json");E!==void 0&&(c=qe(E),c===void 0&&n.push("runtime_schema_statuses_invalid_shape"));let v=await S(l,"runtime_schema_fields_invalid_json");v!==void 0&&(u=Ve(v),u===void 0&&n.push("runtime_schema_fields_invalid_shape"));let g=await S(a,"runtime_schema_workflows_invalid_json");return g!==void 0&&(d=We(g),d===void 0&&n.push("runtime_schema_workflows_invalid_shape"),w=Ke(g)),{schema:I({...r,statuses:[...r.statuses,...c??[]],fields:[...r.fields,...u??[]],workflow:{...r.workflow,...d},type_workflows:[...r.type_workflows??[],...w??[]]}),type_definitions_from_file:o,warnings:n,created_paths:[]}}function F(e,t,r,n=!1){let i=r.map(a=>f(a)).filter(a=>typeof a=="string").find(a=>e.some(o=>o.id===a));if(n&&i!==void 0)return i;let l=e.find(a=>a.roles.includes(t));return l!==void 0?l.id:i??e[0]?.id}function Ge(e){let t=new Map,r=new Map;for(let n of e){r.set(n.id,n),t.set(n.id,n.id),t.set(n.id.replaceAll("_","-"),n.id),t.set(n.id.replaceAll("_"," "),n.id);for(let s of n.aliases)t.set(s,n.id),t.set(s.replaceAll("_","-"),n.id),t.set(s.replaceAll("_"," "),n.id)}return{aliasToId:t,byId:r}}function Je(e){let t={activeStatuses:new Set,blockedStatuses:new Set,draftStatuses:new Set,terminalCanceledStatuses:new Set,terminalDoneStatuses:new Set,terminalStatuses:new Set};for(let r of e){let n=new Set(r.roles);(n.has("terminal")||n.has("terminal_done")||n.has("terminal_canceled"))&&t.terminalStatuses.add(r.id),n.has("terminal_done")&&t.terminalDoneStatuses.add(r.id),n.has("terminal_canceled")&&t.terminalCanceledStatuses.add(r.id),n.has("active")&&t.activeStatuses.add(r.id),n.has("blocked")&&t.blockedStatuses.add(r.id),n.has("draft")&&t.draftStatuses.add(r.id)}return t}function ft(e){let t=I(e),r=t.statuses.map((g,m)=>M(g,m)).filter(g=>g!==null),{aliasToId:n,byId:s}=Ge(r),{activeStatuses:i,blockedStatuses:l,draftStatuses:a,terminalCanceledStatuses:o,terminalDoneStatuses:c,terminalStatuses:u}=Je(r),d=t.workflow,w=f(d.open_status)??F(r,"default_open",["open","in_progress",C[0]]),S=f(d.in_progress_status)??F(r,"active",["in_progress","in-progress",w],!0),b=f(d.blocked_status)??F(r,"blocked",["blocked"]),E=f(d.close_status)??F(r,"default_close",["closed","done","complete"]),v=f(d.canceled_status)??F(r,"default_cancel",["canceled","cancelled"]);return{definitions:r,by_id:s,alias_to_id:n,terminal_statuses:u,terminal_done_statuses:c,terminal_canceled_statuses:o,active_statuses:i,blocked_statuses:l,draft_statuses:a,open_status:w,in_progress_status:S,blocked_status:b,close_status:E,canceled_status:v}}function He(e,t){let r=A(e);if(r)return t.alias_to_id.get(r)}function mt(e){let t=I(e),r=new Map,n=t.fields.map(o=>ae(o)).filter(o=>o!==null);for(let o of n)r.set(o.key,o);let s=[...r.values()].sort((o,c)=>o.key.localeCompare(c.key)),i=new Map,l=new Map,a=new Map;for(let o of s){i.set(o.key,o),l.set(o.cli_flag,o);for(let c of o.cli_aliases)l.set(c,o);for(let c of o.commands){let u=a.get(c)??[];u.push(o),a.set(c,u)}}for(let[o,c]of a.entries())c.sort((u,d)=>u.key.localeCompare(d.key)),a.set(o,c);return{definitions:s,by_key:i,by_cli_token:l,command_to_fields:a}}function _t(e){return Fe(e.key)}function yt(e,t){let r=He(e,t);return r?t.terminal_statuses.has(r):!1}export{z as a,Ze as b,Qe as c,et as d,A as e,p as f,L as g,I as h,h as i,ct as j,dt as k,ut as l,ft as m,He as n,mt as o,_t as p,yt as q};
3
+ //# sourceMappingURL=chunk-3WRPWLA7.js.map
@@ -0,0 +1,2 @@
1
+ import{Gb as G,Hb as Ge,Ib as $e,Kb as qe,Nb as $,Oa as je,Ob as Ue,Pb as Be,Q as Oe,Qb as ze,fb as Me,kb as Pe,rb as Le,vb as Fe}from"./chunk-IAUOUGVR.js";import{m as Ce}from"./chunk-3WRPWLA7.js";import{G as Ae,P as Re,g as Te,u as Ne}from"./chunk-RXT4P5QH.js";import{$ as w,$a as xe,Aa as ke,Ga as Ie,Kc as Se,Lc as oe,Oc as De,Wb as ie,aa as k,eb as Ee,ma as j,na as re,pa as we}from"./chunk-QHNETP77.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b3394526-5a20-5881-9a03-411ada32bd49")}catch{}})();function Ut(e,t,n,r,i,o){if(e.seen.has(t))return"skip";if(e.cursorFound&&e.affected.length>=o)return"truncate";e.seen.add(t),e.parents.set(t,n.id);let s=n.depth+1;return e.queue.push({id:t,depth:s}),e.cursorFound?(e.affected.push({id:t,distance:s,path:Yt(r,t,e.parents)}),"continue"):(e.cursorFound=t===i,"skip")}function Ke(e,t,n,r){let i=Se("graph impact",{root:e,direction:n,kinds:[...t.kinds??[]].sort(),max_depth:Number.isFinite(r)?r:"unbounded"});return{fingerprint:i,after:t.after===void 0?void 0:De(t.after,i)}}function S(e,t,n){e.get(t).add(n)}function M(e){return new Map(e.map(t=>[t,new Set]))}function Ve(e){for(let t of e)t.sort();return e.sort((t,n)=>n.length-t.length||t[0].localeCompare(n[0]))}function q(e){if(Array.isArray(e))return e.map(n=>q(n));if(e===null||typeof e!="object")return e;let t=e.toJSON;return typeof t=="function"?q(t.call(e)):Object.fromEntries(Object.entries(e).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>[n,q(r)]))}function He(e){return JSON.stringify(q(e))}function Bt(e,t,n,r){let i=[{id:e,expanded:!1}];for(;i.length>0;){let o=i.pop();if(o.expanded){r.push(o.id);continue}if(n.has(o.id))continue;n.add(o.id),i.push({id:o.id,expanded:!0});let s=[...t.get(o.id)].sort().reverse();for(let c of s)n.has(c)||i.push({id:c,expanded:!1})}}function zt(e,t){let n=new Set,r=[];for(let i of e)n.has(i)||Bt(i,t,n,r);return r}function Ht(e,t){let n=new Set,r=[];for(let i of[...e].reverse()){if(n.has(i))continue;let o=[],s=[i];for(n.add(i);s.length>0;){let c=s.pop();o.push(c);for(let a of t.get(c))n.has(a)||(n.add(a),s.push(a))}r.push(o)}return Ve(r)}function We(e,t){let n=M(e);for(let[r,i]of t)for(let o of i)S(n,o,r);return Ht(zt(e,t),n)}function Kt(e,t){let n=M(e.nodes());for(let r of e.edges()){let i=t.require(r.kind);if(!i.ordering)continue;let o=(i.precedence??"source_before_target")==="source_before_target";S(n,o?r.source:r.target,o?r.target:r.source)}return n}function Vt(e,t){let n=new Map(e.map(o=>[o,0]));for(let o of t.values())for(let s of o)n.set(s,n.get(s)+1);let r=e.filter(o=>n.get(o)===0).sort(),i=[];for(;r.length>0;){i.push(r);let o=[];for(let s of r)for(let c of t.get(s)){let a=n.get(c)-1;n.set(c,a),a===0&&o.push(c)}r=o.sort()}return i}function Wt(e,t){let n=new Map(e.map(s=>[s,0])),r=new Map;for(let s of e)for(let c of t.get(s)){if(!n.has(c))continue;let a=n.get(s)+1,d=r.get(c);(a>n.get(c)||a===n.get(c)&&(d===void 0||s.localeCompare(d)<0))&&(n.set(c,a),r.set(c,s))}let i=[...e].sort((s,c)=>n.get(c)-n.get(s)||s.localeCompare(c))[0],o=i===void 0?[]:[i];for(;o[0]!==void 0&&r.has(o[0]);)o.unshift(r.get(o[0]));return{depth:Object.fromEntries(n),path:o}}function Yt(e,t,n){let r=[t],i=t;for(;i!==e;)i=n.get(i),r.push(i);return r.reverse()}function B(e,t={}){let n=t.registry??xe(),r=[...e.nodes()],i=Kt(e,n),o=Vt(r,i),s=o.flat(),c=s.length===r.length,a=c?[]:We(r,i).filter(l=>l.length>1||i.get(l[0]).has(l[0])),d=Wt(s,i);return{exact:!0,acyclic:c,order:s,layers:o,frontier:o[0]??[],depth:d.depth,criticalPath:d.path,criticalPathLength:Math.max(0,d.path.length-1),cycles:a,provenance:{algorithm:"kahn-longest-path",edgeFamily:"ordering"}}}function Xt(e,t,n){let r=M(e.nodes()),i=n===void 0?void 0:new Set(n.map(s=>e.registry().require(s).kind)),o=e.edges();for(let s of o){let c=e.registry().require(s.kind);i!==void 0&&!i.has(s.kind)&&(c.inverse===void 0||!i.has(c.inverse))||S(r,t==="incoming"?s.target:s.source,t==="incoming"?s.source:s.target)}return{adjacency:r,inspectedEdges:o.length}}function Jt(e,t,n,r,i,o){let s=U(e,t,{...n,after:void 0,direction:"incoming",limit:void 0}),c=U(e,t,{...n,after:void 0,direction:"outgoing",limit:void 0}),a=new Map,d=[...s.affected,...c.affected].sort((h,m)=>h.distance-m.distance||h.id.localeCompare(m.id)||h.path.join("\0").localeCompare(m.path.join("\0")));for(let h of d)a.has(h.id)||a.set(h.id,h);let l=[...a.values()].sort((h,m)=>h.distance-m.distance||h.id.localeCompare(m.id)),f=r===void 0||r===t?-1:l.findIndex(h=>h.id===r);if(r!==void 0&&r!==t&&f<0)throw new TypeError(`Unknown impact cursor item: ${r}`);let u=l.slice(f+1,f+1+i),g=f+1+u.length<l.length;return{root:t,affected:u,exact:!0,truncated:s.truncated||c.truncated||g,...g?{nextCursor:oe(o,u.at(-1)?.id??t)}:{},cost:{visitedNodes:s.cost.visitedNodes+c.cost.visitedNodes,inspectedEdges:s.cost.inspectedEdges+c.cost.inspectedEdges}}}function Qt(e,t,n){let r=n.direction,i=n.maxDepth??Number.POSITIVE_INFINITY,o=n.limit??Number.POSITIVE_INFINITY,{fingerprint:s,after:c}=Ke(t,n,r,i),{adjacency:a,inspectedEdges:d}=Xt(e,r,n.kinds),l={queue:[{id:t,depth:0}],seen:new Set([t]),parents:new Map,affected:[],cursorFound:c===void 0||c===t},f=0,u=!1,g=!1;e:for(let h=0;h<l.queue.length;h+=1){n.signal?.throwIfAborted();let m=l.queue[h];f+=1;let b=[...a.get(m.id)].sort();if(m.depth>=i){b.some(v=>!l.seen.has(v))&&(u=!0);continue}for(let v of b)if(Ut(l,v,m,t,c,o)==="truncate"){u=!0,g=!0;break e}}if(!l.cursorFound)throw new TypeError(`Unknown impact cursor item: ${c}`);return{root:t,affected:l.affected,exact:!0,truncated:u,...g?{nextCursor:oe(s,l.affected.at(-1)?.id??t)}:{},cost:{visitedNodes:f,inspectedEdges:d}}}function U(e,t,n={}){let r=n.direction??"outgoing";if(r!=="both")return Qt(e,t,{...n,direction:r});let i=n.maxDepth??Number.POSITIVE_INFINITY,o=n.limit??Number.POSITIVE_INFINITY,{fingerprint:s,after:c}=Ke(t,n,r,i);return Jt(e,t,n,c,o,s)}function Ye(e){let t=[...e.nodes()],n=M(t),r=M(t);for(let a of e.edges())S(n,a.source,a.target),S(n,a.target,a.source),S(r,a.source,a.target);let i=[],o=new Set;for(let a of t){if(o.has(a))continue;let d=[],l=[a];for(o.add(a);l.length>0;){let f=l.pop();d.push(f);for(let u of n.get(f))o.has(u)||(o.add(u),l.push(u))}i.push(d)}let s=t.map(a=>({id:a,degree:n.get(a).size})),c=Math.max(0,...s.map(({degree:a})=>a));return{components:Ve(i),stronglyConnected:We(t,r),orphans:s.filter(({degree:a})=>a===0).map(({id:a})=>a),hubs:s.filter(({degree:a})=>a>0&&a===c),exact:!0,provenance:{algorithm:"component-degree",edgeFamily:"all"}}}function Yr(e,t){let n=new Map(e.edges.map(i=>[He(i),i])),r=new Map(t.edges.map(i=>[He(i),i]));return{fromVersion:e.version,toVersion:t.version,added:[...r].filter(([i])=>!n.has(i)).map(([,i])=>i),removed:[...n].filter(([i])=>!r.has(i)).map(([,i])=>i),unchangedCount:[...n.keys()].filter(i=>r.has(i)).length,exact:!0}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f01a7c5d-0cb1-5dfa-90e8-14bb66bedd94")}catch{}})();var Zt=5,en=1e4,tn=8;function se(e,t){if(!Number.isFinite(t)||!Number.isInteger(t)||t<0)throw new TypeError(`Invalid path ${e} bound: ${String(t)}`)}function z(e,t){return t.hierarchyDirection==="target_parent"?e.target:e.source}function P(e,t){return(t.precedence??"source_before_target")==="target_before_source"?e.target:e.source}function D(e,t){let n=P(e,t);return{predecessor:n,successor:n===e.source?e.target:e.source}}function nn(e,t,n){if(t===void 0)return;let r=e.registry(),i=new Set;for(let o of t){let s=r.require(o),c=s.traversal;if(c==="association")throw new TypeError(`Relationship kind ${s.kind} uses association traversal; use graph impact --direction both`);if(c!==n&&c!=="semantic"){let a=c==="hierarchy"?"graph ancestors or graph descendants":"graph predecessors or graph successors";throw new TypeError(`Relationship kind ${s.kind} uses ${c} traversal; use ${a}`)}i.add(s.kind)}return i}function rn(e,t,n,r,i){let o=e.registry(),s=e.neighborEdges(t,{direction:"both",...n===void 0?{}:{kinds:[...n]}}),c=[],a=new Set;for(let d of s.value){let l=o.require(d.edge.kind);n===void 0&&!l[r]||i(d,l,t)&&(a.has(d.id)||(a.add(d.id),c.push(d.id)))}return{neighbors:c,inspectedEdges:s.meta.inspectedEdges}}function on(e,t,n,r,i,o){if(t>=n)return e.neighbors.some(s=>!o.seen.has(s))&&(o.truncated=!0),!1;for(let s of e.neighbors)if(!o.seen.has(s)){if(o.seen.add(s),o.queue.push({id:s,depth:t+1}),!o.resumed){s===i&&(o.resumed=!0);continue}if(o.value.length>=r)return o.truncated=!0,!0;o.value.push(s)}return!1}function H(e,t,n,r,i){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);let o=nn(e,n.kinds,r),s=n.limit??Number.POSITIVE_INFINITY,c=n.maxDepth??Number.POSITIVE_INFINITY,a=n.after,d={seen:new Set([t]),value:[],queue:[{id:t,depth:0}],resumed:a===void 0,truncated:!1},l=0,f=0;for(let u=0;u<d.queue.length;u+=1){n.signal?.throwIfAborted();let g=d.queue[u];l+=1;let h=rn(e,g.id,o,r,i);if(f+=h.inspectedEdges,on(h,g.depth,c,s,a,d))break}if(!d.resumed)throw new TypeError(`Traversal cursor not found in sequence: ${a}`);return{value:d.value,meta:{visitedNodes:l,inspectedEdges:f,truncated:d.truncated,nextCursor:d.value.at(-1)}}}function Xe(e,t){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`)}function Je(e,t,n,r,i){let o=e.neighborEdges(t.nodes.at(-1),{direction:r,...n.kinds===void 0?{}:{kinds:n.kinds}});return i.inspectedEdges+=o.meta.inspectedEdges,o.value.filter(s=>!t.nodeSet.has(s.id))}function sn(e,t,n,r,i,o,s){for(let c of Je(e,t,r,i,s)){let a=[...t.nodes,c.id],d=new Set(t.nodeSet).add(c.id),l=[...t.edges,c.edge];if(c.id===n){if(s.value.push({nodes:a,edges:l,length:l.length}),s.value.length>=o)return!0}else s.queue.push({nodes:a,nodeSet:d,edges:l})}return!1}function Qe(e,t,n={}){return H(e,t,n,"hierarchy",(r,i)=>z(r.edge,i)===r.id)}function Ze(e,t,n={}){return H(e,t,n,"hierarchy",(r,i,o)=>z(r.edge,i)===o)}function et(e,t,n={}){return H(e,t,n,"ordering",(r,i)=>P(r.edge,i)===r.id)}function tt(e,t,n={}){return H(e,t,n,"ordering",(r,i,o)=>P(r.edge,i)===o)}function cn(e,t,n,r,i,o,s,c){let a={value:[],queue:[{nodes:[t],nodeSet:new Set([t]),edges:[]}],inspectedEdges:0},d=0,l=!1,f=i+1;for(let u=0;u<a.queue.length;u+=1){if(r.signal?.throwIfAborted(),a.value.length>=f||d>=o){l=!0;break}let g=a.queue[u];if(d+=1,g.edges.length>=s){Je(e,g,r,c,a).length>0&&(l=!0);continue}if(sn(e,g,n,r,c,f,a)){l=!0;break}}return{value:a.value.slice(0,i),meta:{visitedNodes:d,inspectedEdges:a.inspectedEdges,truncated:l}}}function nt(e,t,n,r={}){Xe(e,t),Xe(e,n);let i=r.maxPaths??Zt,o=r.maxVisitedPaths??en,s=r.maxDepth??tn;se("maxPaths",i),se("maxVisitedPaths",o),se("maxDepth",s);let c=r.direction??"outgoing";r.signal?.throwIfAborted();for(let a of r.kinds??[])e.registry().require(a);return t===n?i===0?{value:[],meta:{visitedNodes:1,inspectedEdges:0,truncated:!0}}:{value:[{nodes:[t],edges:[],length:0}],meta:{visitedNodes:1,inspectedEdges:0,truncated:!1}}:cn(e,t,n,r,i,o,s,c)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2ea07760-bca8-579d-9b3a-78051461485a")}catch{}})();var an=16,dn=2,ln=8;function K(e,t){if(!Number.isInteger(t)||t<1)throw new TypeError(`Invalid ${e} bound: ${String(t)}`)}function V(e,t,n){let r=e.registry(),i=t===void 0?void 0:new Set(t.map(o=>r.require(o).kind));for(let o of e.edges()){if(o.source===o.target)continue;let s=r.require(o.kind);i!==void 0&&!(i.has(s.kind)||s.inverse!==void 0&&i.has(s.inverse))||n(o,s)}}function un(e,t){let n=new Map;V(e,t,r=>{rt(n,r.source,r.target),rt(n,r.target,r.source)});for(let r of n.values())r.sort();return n}function rt(e,t,n){let r=e.get(t);r===void 0?e.set(t,[n]):r.push(n)}function fn(e,t){let n=new Map;for(let o of e){let s=t.get(o);n.set(s,(n.get(s)??0)+1)}let r,i=0;for(let[o,s]of n)(s>i||s===i&&o<r)&&(r=o,i=s);return r}function gn(e,t){let n=new Map;for(let[i,o]of e){let s=n.get(o);s===void 0?n.set(o,[i]):s.push(i)}let r=[];for(let i of n.values())i.length<t||(i.sort(),r.push({representative:i[0],size:i.length,members:i}));return r.sort((i,o)=>o.size-i.size||i.representative.localeCompare(o.representative))}function it(e,t={}){let n=t.maxIterations??an,r=t.minSize??dn;K("maxIterations",n),K("minSize",r);let i=un(e,t.kinds),o=e.nodes(),s=new Map(o.map(f=>[f,f])),c=0,a=!1,d=0,l=0;for(;c<n&&!a;){t.signal?.throwIfAborted(),c+=1,a=!0;for(let f of o){d+=1;let u=i.get(f);if(u===void 0)continue;l+=u.length;let g=fn(u,s);g!==s.get(f)&&(s.set(f,g),a=!1)}}return{value:{communities:gn(s,r),iterations:c,converged:a},meta:{visitedNodes:d,inspectedEdges:l,truncated:!a}}}function W(e){return e.direction==="directed"&&(e.ordering||e.hierarchy)}function Y(e){return e.inverse!==void 0&&e.inverse<e.kind?e.inverse:e.kind}function ce(e,t){return(t.hierarchy?z(e,t):e.source===P(e,t)?e.target:e.source)===e.target?{from:e.source,to:e.target}:{from:e.target,to:e.source}}function hn(e,t){if(t===void 0)return;let n=e.registry(),r=new Set;for(let i of t){let o=n.require(i);if(!W(o))throw new TypeError(`Relationship kind ${o.kind} is not a directed ordering or hierarchy kind`);r.add(Y(o))}return r}function pn(e,t){let n=e.registry(),r=new Map;for(let i of e.edges()){let o=n.require(i.kind);if(!W(o))continue;let s=Y(o);if(t!==void 0&&!t.has(s))continue;let c=ce(i,o);if(c.from===c.to)continue;let a=r.get(s);a===void 0&&(a={adjacency:new Map,records:[]},r.set(s,a));let d=a.adjacency.get(c.from);d===void 0?a.adjacency.set(c.from,new Set([c.to])):d.add(c.to),a.records.push({...c,edge:i})}return r}function mn(e){let t=new Map;for(let[n,r]of e.adjacency)t.set(n,[...r].sort());return t}function _n(e,t,n,r){let i=[r];for(let o=n;o!==t;o=e.get(o))i.push(o);return i.push(t),i.reverse()}function yn(e,t,n,r,i,o){for(let s of e.get(n.id)??[])if(o.inspectedEdges+=1,!(n.depth===0&&s===t.to)&&!r.has(s)){if(r.set(s,n.id),s===t.to)return _n(r,t.from,n.id,s);i.push({id:s,depth:n.depth+1})}}function bn(e,t,n,r){let i=new Map([[t.from,t.from]]),o=[{id:t.from,depth:0}];for(let s=0;s<o.length;s+=1){let c=o[s];if(r.visitedNodes+=1,c.depth>=n)continue;let a=yn(e,t,c,i,o,r);if(a!==void 0)return a}}function T(e,t={}){let n=t.maxDepth??ln;K("maxDepth",n),t.limit!==void 0&&K("limit",t.limit);let r=t.limit??Number.POSITIVE_INFINITY,i=hn(e,t.kinds),o=pn(e,i),s=[],c={visitedNodes:0,inspectedEdges:0},a=!1;e:for(let d of[...o.keys()].sort()){let l=o.get(d),f=mn(l);for(let u of l.records){t.signal?.throwIfAborted();let g=bn(f,u,n,c);if(g!==void 0){if(s.length>=r){a=!0;break e}s.push({edge:u.edge,witness:g})}}}return{value:s,meta:{visitedNodes:c.visitedNodes,inspectedEdges:c.inspectedEdges,truncated:a}}}function vn(e,t,n,r,i){let o=new Set,s=[];for(let c of n){if(c.id===e||o.has(c.id))continue;if(!i.seen.has(c.id)){if(t>=r){i.truncated=!0;continue}i.seen.add(c.id),i.queue.push({id:c.id,depth:t+1})}o.add(c.id),s.push(c.id);let a=i.predecessors.get(c.id);a===void 0&&(a=new Set,i.predecessors.set(c.id,a)),a.add(e)}return s}function wn(e,t,n){let r=n.direction??"outgoing",i=n.maxDepth??Number.POSITIVE_INFINITY,o=[],s=new Map,c={seen:new Set([t]),queue:[{id:t,depth:0}],predecessors:new Map,truncated:!1},a=0;for(let d=0;d<c.queue.length;d+=1){n.signal?.throwIfAborted();let{id:l,depth:f}=c.queue[d];o.push(l);let u=e.neighborEdges(l,{direction:r,...n.kinds===void 0?{}:{kinds:n.kinds}});a+=u.meta.inspectedEdges,s.set(l,vn(l,f,u.value,i,c))}return{order:o,successors:s,predecessors:c.predecessors,inspectedEdges:a,truncated:c.truncated}}function kn(e,t){let n=[],r=new Set([t]),i=[{id:t,index:0}];for(;i.length>0;){let o=i.at(-1),s=e.successors.get(o.id);if(o.index<s.length){let c=s[o.index];o.index+=1,r.has(c)||(r.add(c),i.push({id:c,index:0}))}else n.push(o.id),i.pop()}return n.reverse()}function In(e,t,n,r){let i=e,o=t;for(;i!==o;){for(;r.get(i)>r.get(o);)i=n.get(i);for(;r.get(o)>r.get(i);)o=n.get(o)}return i}function xn(e,t,n){let r;for(let i of[...e].sort())t.has(i)&&(r=r===void 0?i:In(r,i,t,n));return r}function En(e,t,n,r,i){let o=new Map([[t,t]]),s=!0;for(;s;){s=!1;for(let c of n){if(i?.throwIfAborted(),c===t)continue;let a=xn(e.predecessors.get(c),o,r);a!==void 0&&o.get(c)!==a&&(o.set(c,a),s=!0)}}return o}function ot(e,t,n={}){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);if(n.maxDepth!==void 0&&(!Number.isInteger(n.maxDepth)||n.maxDepth<0))throw new TypeError(`Invalid maxDepth bound: ${String(n.maxDepth)}`);let r=wn(e,t,n),i=kn(r,t),o=new Map(i.map((d,l)=>[d,l])),s=En(r,t,i,o,n.signal),c=new Map(i.map(d=>[d,1]));for(let d=i.length-1;d>=0;d-=1){let l=i[d];if(l===t)continue;let f=s.get(l);c.set(f,c.get(f)+c.get(l))}let a=i.filter(d=>d!==t).map(d=>({id:d,idom:s.get(d),dominatedCount:c.get(d)-1})).sort((d,l)=>l.dominatedCount-d.dominatedCount||d.id.localeCompare(l.id));return{value:{root:t,reachableCount:r.order.length,rows:a},meta:{visitedNodes:r.order.length,inspectedEdges:r.inspectedEdges,truncated:r.truncated}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aa8e4dc3-250e-50eb-b770-a11cbab6ebc3")}catch{}})();function st(e){return Math.round(e*1e6)/1e6}function ct(e,t,n){let r=e.get(t);r===void 0?e.set(t,new Set([n])):r.add(n)}function at(e,t){let n=new Map(e.nodes().map(i=>[i,new Set]));V(e,t,i=>{n.get(i.source).add(i.target),n.get(i.target).add(i.source)});let r=new Map;for(let[i,o]of n)r.set(i,[...o].sort());return r}function Cn(e,t){let n=new Map,r=new Map;return V(e,t,(i,o)=>{if(!o.ordering)return;let{predecessor:s,successor:c}=D(i,o);ct(r,s,c),ct(n,c,s)}),{incoming:n,outgoing:r}}function Sn(e,t,n){let r=new Map([[e,0]]),i=new Map([[e,1]]),o=new Map,s=[],c=[e],a=0,d=0;for(let l=0;l<c.length;l+=1){let f=c[l];n.visitedNodes+=1,s.push(f);let u=r.get(f);f!==e&&(a+=1,d+=u);for(let g of t.get(f))if(n.inspectedEdges+=1,r.has(g)||(r.set(g,u+1),c.push(g)),r.get(g)===u+1){i.set(g,(i.get(g)??0)+i.get(f));let h=o.get(g);h===void 0?o.set(g,[f]):h.push(f)}}return{stack:s,sigma:i,predecessors:o,reachableCount:a,distanceSum:d}}function Dn(e,t,n){let r=new Map;for(let i=e.stack.length-1;i>=0;i-=1){let o=e.stack[i],s=(1+(r.get(o)??0))/e.sigma.get(o);for(let c of e.predecessors.get(o)??[])r.set(c,(r.get(c)??0)+e.sigma.get(c)*s);o!==t&&n.set(o,(n.get(o)??0)+(r.get(o)??0))}}function Tn(e,t){return t<=1||e.reachableCount===0?0:e.reachableCount/(t-1)*(e.reachableCount/e.distanceSum)}function Nn(e,t,n,r,i){return{id:e,degree:t.get(e).length,inDegree:n.incoming.get(e)?.size??0,outDegree:n.outgoing.get(e)?.size??0,betweenness:st((r.get(e)??0)/2),closeness:st(i.get(e))}}function dt(e,t={}){let n=at(e,t.kinds),r=Cn(e,t.kinds),i=e.nodes(),o=new Map,s=new Map,c={visitedNodes:0,inspectedEdges:0};for(let l of i){t.signal?.throwIfAborted();let f=Sn(l,n,c);s.set(l,Tn(f,i.length)),Dn(f,l,o)}let a=0;for(let l of n.values())a+=l.length;let d=i.map(l=>Nn(l,n,r,o,s)).sort((l,f)=>f.betweenness-l.betweenness||f.degree-l.degree||l.id.localeCompare(f.id));return{value:{nodeCount:i.length,edgeCount:a/2,rows:d},meta:{visitedNodes:c.visitedNodes,inspectedEdges:c.inspectedEdges,truncated:!1}}}function An(e,t){return e<=t?{source:e,target:t}:{source:t,target:e}}function Rn(e,t,n){let i=t.get(e.node)[e.neighborIndex];if(e.neighborIndex+=1,n.inspectedEdges+=1,i!==e.parent){if(n.discovery.has(i)){n.low.set(e.node,Math.min(n.low.get(e.node),n.discovery.get(i)));return}return e.children+=1,n.discovery.set(i,n.timer),n.low.set(i,n.timer),n.timer+=1,{node:i,parent:e.node,neighborIndex:0,children:0}}}function On(e,t,n){if(e.parent===null){e.children>1&&n.articulation.add(e.node);return}let r=e.parent,i=n.low.get(e.node);n.low.set(r,Math.min(n.low.get(r),i)),r!==t&&i>=n.discovery.get(r)&&n.articulation.add(r),i>n.discovery.get(r)&&n.bridges.push(An(r,e.node))}function jn(e,t,n,r){n.discovery.set(e,n.timer),n.low.set(e,n.timer),n.timer+=1;let i=[{node:e,parent:null,neighborIndex:0,children:0}];for(;i.length>0;){r?.throwIfAborted();let o=i.at(-1);if(o.neighborIndex<t.get(o.node).length){let s=Rn(o,t,n);s!==void 0&&i.push(s)}else On(o,e,n),i.pop()}}function X(e,t={}){let n=at(e,t.kinds),r={discovery:new Map,low:new Map,timer:0,articulation:new Set,bridges:[],inspectedEdges:0};for(let i of e.nodes())r.discovery.has(i)||jn(i,n,r,t.signal);return{value:{articulationPoints:[...r.articulation].sort(),bridges:r.bridges.sort((i,o)=>i.source.localeCompare(o.source)||i.target.localeCompare(o.target))},meta:{visitedNodes:r.discovery.size,inspectedEdges:r.inspectedEdges,truncated:!1}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1c9d9d0c-e989-568c-a49a-202f77e94806")}catch{}})();function Mn(e){let t=e.registry(),n=new Map,r=new Set;for(let i of e.edges()){let o=t.require(i.kind);if(!o.ordering)continue;let{predecessor:s,successor:c}=D(i,o);if(r.add(s),r.add(c),s===c)continue;let a=n.get(s);a===void 0?n.set(s,new Set([c])):a.add(c)}return{forward:n,participants:r}}function Pn(e,t,n,r){if(e===void 0)return r;let i=r;for(let o of e)t.has(o)&&(i=Math.min(i,n.get(o)));return i}function Ln(e,t,n){let r=n-t;return{id:e,earliestStart:t,earliestFinish:t+1,latestStart:n,latestFinish:n+1,slack:r,critical:r===0}}function Fn(e,t,n,r,i){let o=new Map;for(let s=e.length-1;s>=0;s-=1){let c=e[s],a=Pn(t.forward.get(c),r,o,i);o.set(c,a-1)}return e.map(s=>Ln(s,n[s],o.get(s))).sort((s,c)=>s.slack-c.slack||s.earliestStart-c.earliestStart||s.id.localeCompare(c.id))}function lt(e,t={}){t.signal?.throwIfAborted();let n=B(e,{registry:e.registry()}),r=Mn(e),i=new Set(n.order),o=n.order.filter(d=>r.participants.has(d)),s=o.reduce((d,l)=>Math.max(d,n.depth[l]+1),0),c=Fn(o,r,n.depth,i,s),a=c.length>0;return{exact:!0,acyclic:n.acyclic,makespan:s,scheduledCount:c.length,criticalPath:a?n.criticalPath:[],criticalPathLength:a?n.criticalPathLength:0,cycles:n.cycles,rows:c,provenance:{algorithm:"critical-path-method",edgeFamily:"ordering",weighting:"unit"}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6b2a7206-d480-51c1-9d46-4271bde24fa3")}catch{}})();function Gn(e,t,n){for(let r=e.length-1;r>=0;r-=1){n?.throwIfAborted();let i=t.get(e[r]);for(let o of i.successors){n?.throwIfAborted();let s=t.get(o);if(s.latest===void 0||s.duration===void 0)continue;let c=s.latest-s.duration;(i.latest===void 0||c<i.latest)&&(i.latest=c,i.anchor=s.anchor)}}}function $n(e,t,n,r){let i=[],o=e;for(;o!==void 0&&i.length<n;)r?.throwIfAborted(),i.push(o),o=t.get(o).predecessor;return i.reverse(),{path:i,path_truncated:o!==void 0}}function qn(e,t,n,r,i){let o=new Map(t.map(c=>[c.id,c])),s=new Map;for(let c of e){i?.throwIfAborted();let a=o.get(c),d=a?.estimated_minutes,l=typeof d=="number"&&Number.isFinite(d)&&d>=0?d:void 0,f={item:a,duration:l,pending:0,successors:new Set,earliest:0};if(a?.deadline!==void 0){let u=Date.parse(a.deadline);Number.isFinite(u)?(f.deadline=(u-n)/6e4,f.latest=f.deadline,f.anchor=c):r(c,"invalid_deadline")}s.set(c,f)}return s}function Un(e,t,n){for(let r of e.edges()){n?.throwIfAborted();let i=e.registry().require(r.kind);if(!i.ordering)continue;let{predecessor:o,successor:s}=D(r,i),c=t.get(o);c.successors.has(s)||(c.successors.add(s),t.get(s).pending+=1)}}function Bn(e,t,n){let r=e.filter(i=>t.get(i).pending===0);for(let i=0;i<r.length;i+=1){n?.throwIfAborted();let o=r[i],s=t.get(o),c=s.earliest===null||s.duration===void 0?null:s.earliest+s.duration;for(let a of s.successors){n?.throwIfAborted();let d=t.get(a);c===null?d.earliest=null:d.earliest!==null&&(c>d.earliest||c===d.earliest&&(d.predecessor===void 0||o<d.predecessor))&&(d.earliest=c,d.predecessor=o),d.pending-=1,d.pending===0&&r.push(a)}}return r}function zn(e,t,n,r,i,o,s,c){let a=t.duration;if(t.latest!==void 0){r.scheduled_count+=1;let d=t.latest-a;r.rows.length<o?r.rows.push({id:e,deadline_id:t.anchor,latest_start:new Date(i+d*6e4).toISOString(),slack_minutes:t.earliest===null?null:d-t.earliest}):r.truncated=!0}if(t.deadline!==void 0&&t.earliest!==null&&t.earliest+a>t.deadline)if(r.overcommitted_count+=1,r.overcommitted.length<o){let d=$n(e,n,Math.min(o,s.remaining),c);s.remaining-=d.path.length,d.path_truncated&&(r.truncated=!0),r.overcommitted.push({deadline_id:e,deadline:t.item.deadline,shortfall_minutes:t.earliest+a-t.deadline,...d})}else r.truncated=!0}function Hn(e,t,n,r,i,o,s,c){let a={remaining:o};for(let d of e){c?.throwIfAborted();let l=t.get(d);if(l.pending>0){s(d,"cycle_or_gated_by_cycle");continue}if(l.duration===void 0){s(d,"unknown_estimate");continue}if(l.latest!==void 0&&!Number.isFinite(new Date(r+(l.latest-l.duration)*6e4).getTime())){s(d,"date_range_exceeded");continue}l.earliest===null&&s(d,"unknown_predecessor_estimate"),zn(d,l,t,n,r,i,a,c)}}function ut(e,t,n={}){n.signal?.throwIfAborted();let r=Date.parse(n.now??new Date().toISOString());if(!Number.isFinite(r))throw new TypeError("Invalid scheduling clock");let i=n.maxWork??1e5,o=n.limit??10;for(let[u,g]of[["maxWork",i],["limit",o]])if(!Number.isSafeInteger(g)||g<1)throw new TypeError(`Invalid scheduling ${u}`);let s={as_of:new Date(r).toISOString(),basis:"derived_elapsed_minutes",complete:!0,truncated:!1,work_limit_exceeded:!1,scheduled_count:0,residual_count:0,overcommitted_count:0,rows:[],residuals:[],overcommitted:[]},c=e.nodes(),a=e.edges();if(c.length+a.length+t.length>i)return{...s,complete:!1,work_limit_exceeded:!0};let d=(u,g)=>{s.complete=!1,s.residual_count+=1,s.residuals.length<o?s.residuals.push({id:u,reason:g}):s.truncated=!0},l=qn(c,t,r,d,n.signal);Un(e,l,n.signal);let f=Bn(c,l,n.signal);return Gn(f,l,n.signal),Hn(c,l,s,r,o,i,d,n.signal),s}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2bfc4e78-a376-5099-be50-38e339eac660")}catch{}})();function N(){return{nodes:0,isolated:0,degree_leq_one:0,semantic_nodes:0,without_semantic_edges:0,degree_histogram:{}}}function ht(e,t,n,r){let i={all:N(),active:N(),terminal:N()},o=new Map;for(let s of e.details){if(r?.throwIfAborted(),e.missingIdSet.has(s.id.toLowerCase())||s.status==="external")continue;let c=o.get(s.status)??N();o.set(s.status,c);let a=e.graph.incidentEdges(s.id),d=a.some(l=>n(l.kind));for(let l of[i.all,i[t(s.status)?"terminal":"active"],c]){l.nodes+=1,l.isolated+=+(a.length===0),a.length<=1&&(l.degree_leq_one+=1),d?l.semantic_nodes+=1:l.without_semantic_edges+=1;let f=String(a.length);l.degree_histogram[f]=(l.degree_histogram[f]??0)+1}}return{coverage_by_lifecycle:i,coverage_by_status:Object.fromEntries([...o].sort(([s],[c])=>s.localeCompare(c)))}}function ft(e){if(!J(e))return!1;let t=e;if(!["nodes","isolated","degree_leq_one","semantic_nodes","without_semantic_edges"].every(i=>Number.isSafeInteger(t[i])&&Number(t[i])>=0)||!J(t.degree_histogram))return!1;let r=Object.entries(t.degree_histogram);return r.every(([i,o])=>/^(0|[1-9]\d*)$/.test(i)&&Number.isSafeInteger(o)&&Number(o)>=0)&&r.reduce((i,[,o])=>i+Number(o),0)===t.nodes&&Number(t.isolated)<=Number(t.degree_leq_one)&&Number(t.degree_leq_one)<=Number(t.nodes)&&Number(t.semantic_nodes)+Number(t.without_semantic_edges)===t.nodes}function J(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pt(e){for(let r of["ordering_acyclic","active_ordering_acyclic"])if(e[r]!==void 0&&typeof e[r]!="boolean")return!1;let t=e.coverage_by_lifecycle,n=e.coverage_by_status;return t===void 0&&n===void 0?!0:!J(t)||!J(n)?!1:["all","active","terminal"].every(r=>ft(t[r]))&&Object.values(n).every(ft)}function gt(e,t){return Object.fromEntries([...new Set([...Object.keys(e),...Object.keys(t)])].sort().map(n=>{let r=Object.hasOwn(e,n)?e[n]:N(),i=Object.hasOwn(t,n)?t[n]:N(),o=Object.fromEntries([...new Set([...Object.keys(r.degree_histogram),...Object.keys(i.degree_histogram)])].sort().map(s=>[s,(i.degree_histogram[s]??0)-(r.degree_histogram[s]??0)]));return[n,{nodes:i.nodes-r.nodes,isolated:i.isolated-r.isolated,degree_leq_one:i.degree_leq_one-r.degree_leq_one,semantic_nodes:i.semantic_nodes-r.semantic_nodes,without_semantic_edges:i.without_semantic_edges-r.without_semantic_edges,degree_histogram:o}]}))}function mt(e,t){return!e.coverage_by_lifecycle||!t.coverage_by_lifecycle||!e.coverage_by_status||!t.coverage_by_status?{lifecycle_comparable:!1}:{lifecycle_comparable:!0,coverage_by_lifecycle:gt(e.coverage_by_lifecycle,t.coverage_by_lifecycle),coverage_by_status:gt(e.coverage_by_status,t.coverage_by_status)}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="896e1553-b127-532f-ac39-e0d47f29eebc")}catch{}})();var A=["missing_reference_active","missing_reference_terminal","legacy_no_blocker_sentinel","ordering_cycle","legacy_ordering_cycle","ordering_storage_contradiction","legacy_ordering_storage_contradiction","hierarchy_cycle","legacy_hierarchy_cycle","hierarchy_cardinality_violation","legacy_hierarchy_cardinality_violation","hierarchy_direction_violation","legacy_hierarchy_direction_violation","duplicate_edge","legacy_duplicate_edge","duplicate_dependency_row","legacy_duplicate_dependency_row","stale_lifecycle_block","isolated_active_node","sparse_active_node"];(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1335acb2-0730-5934-89a4-14fe4a160288")}catch{}})();var Kn=25,Vn="milestone",Wn="outcome milestone:",Yn=new Set(["discovered_from","incident_from","recurs_from","supersedes","verifies"]);function Q(e){return Yn.has(e)}var _t={error:0,warning:1,info:2};function yt(e){return new Set((e??[]).filter(t=>typeof t=="string").map(t=>t.trim().toLowerCase()))}function R(e,t,n,r,i,o,s,c){let a=[...i].sort((d,l)=>d.localeCompare(l));return{code:e,severity:t,policy:n,message:r(a.length),count:a.length,sample:a.slice(0,o),sample_truncated:a.length>o,remediation:s,...c===void 0?{}:{evidence:[...c].sort((d,l)=>d.localeCompare(l)).slice(0,o)}}}function Xn(e,t){return e.cycles.map(n=>R(n.legacy_terminal?"legacy_hierarchy_cycle":"hierarchy_cycle",n.legacy_terminal?"info":"error","Structural hierarchy must be acyclic across scalar and registered dependency relationships.",r=>`${r} items participate in one hierarchy cycle.`,n.item_ids,t,n.legacy_terminal?"Preserve historical rows unless an explicit legacy repair is approved.":"Remove or retype one exact hierarchy relation before continuing mutation."))}function bt(e,t,n){let r=e.cardinality_violations.filter(i=>i.legacy_terminal===n);return r.length===0?[]:[R(n?"legacy_hierarchy_cardinality_violation":"hierarchy_cardinality_violation",n?"info":"error","Every structural child must resolve to at most one logical parent across all hierarchy spellings.",i=>`${i} child item${i===1?"":"s"} resolve to multiple hierarchy parents.`,r.map(i=>i.child_id),t,n?"Preserve historical rows unless an explicit legacy repair is approved.":"Remove the exact surplus hierarchy rows so each child has one parent.",r.map(i=>`${i.child_id} <- ${i.parent_ids.join(", ")}`))]}function vt(e,t,n){let r=e.divergences.filter(i=>i.legacy_terminal===n);return r.length===0?[]:[R(n?"legacy_hierarchy_direction_violation":"hierarchy_direction_violation",n?"info":"error","Scalar parent metadata and dependency-backed hierarchy rows must resolve to the same logical parent.",i=>`${i} child item${i===1?"":"s"} have divergent hierarchy storage surfaces.`,r.map(i=>i.child_id),t,n?"Preserve historical rows unless an explicit legacy repair is approved.":"Align the scalar parent and exact dependency rows to one canonical parent.",r.map(i=>`${i.child_id}: scalar=${i.scalar_parent_id} dependencies=${i.dependency_parent_ids.join(",")}`))]}function Jn(e,t){let n=G(e);return n?[...Xn(n,t),...bt(n,t,!1),...bt(n,t,!0),...vt(n,t,!1),...vt(n,t,!0)]:[]}function Qn(e){let t=e.graph.registry(),n=new Map;for(let r of e.graph.edges()){let i=t.require(r.kind);if(!i.ordering)continue;let[o,s]=(i.precedence??"source_before_target")==="target_before_source"?[r.target,r.source]:[r.source,r.target],c=n.get(o);c?c.push(s):n.set(o,[s])}for(let r of n.values())r.sort((i,o)=>i.localeCompare(o));return n}function kt(e,t){t.indexes.set(e,t.nextIndex),t.lowLinks.set(e,t.nextIndex),t.nextIndex+=1,t.stack.push(e),t.onStack.add(e)}function Zn(e,t,n,r){let i=n.get(e.node)??[];if(e.neighborIndex>=i.length)return!1;let o=i[e.neighborIndex];return e.neighborIndex+=1,r.indexes.has(o)?r.onStack.has(o)&&r.lowLinks.set(e.node,Math.min(r.lowLinks.get(e.node),r.indexes.get(o))):(kt(o,r),t.push({node:o,neighborIndex:0})),!0}function er(e,t,n,r){t.pop();let i=t.at(-1);if(i&&r.lowLinks.set(i.node,Math.min(r.lowLinks.get(i.node),r.lowLinks.get(e.node))),r.lowLinks.get(e.node)!==r.indexes.get(e.node))return;let o=[];for(;;){let s=r.stack.pop();if(r.onStack.delete(s),o.push(s),s===e.node)break}(o.length>1||o.length===1&&n.get(o[0])?.includes(o[0]))&&r.components.push(o.sort((s,c)=>s.localeCompare(c)))}function tr(e){let t={indexes:new Map,lowLinks:new Map,onStack:new Set,stack:[],components:[],nextIndex:0},n=[...e.keys()].sort((r,i)=>r.localeCompare(i));for(let r of n){if(t.indexes.has(r))continue;let i=[{node:r,neighborIndex:0}];for(kt(r,t);i.length>0;){let o=i.at(-1);Zn(o,i,e,t)||er(o,i,e,t)}}return t.components.sort((r,i)=>r[0].localeCompare(i[0]))}function ae(e){return`${e.holder_id} -> ${e.target_id} (${e.kind})`}function y(e,t,n,r,i,o,s,c){t.length!==0&&e.push(R(r,i,o,s,t,n,c))}function nr(e,t,n){let r=[],i=[...e.dangling.active,...e.dangling.legacy_terminal].filter(o=>!o.no_active_blocker_sentinel);return y(r,i.filter(o=>!t(o.holder_status)).map(ae),n,"missing_reference_active","error","Active items must not reference absent targets; missing prerequisites distort scheduling.",o=>`${o} active dangling reference(s) to absent items`,"Restore or re-create the referenced item, or remove/retype the reference on the holder."),y(r,i.filter(o=>t(o.holder_status)).map(ae),n,"missing_reference_terminal","info","Terminal items may retain historical references, but absent targets remain unexplainable context.",o=>`${o} terminal dangling reference(s) to absent items`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),y(r,e.dangling.no_active_blocker_sentinels.map(ae),n,"legacy_no_blocker_sentinel","info","The pre-structured-dependency no-active-blocker sentinel is retired; real edges carry blocker state.",o=>`${o} legacy no-active-blocker sentinel reference(s)`,"Delete the sentinel reference; blocker state is derived from blocked_by edges."),r}function le(e,t){let n=t.get(e);return n?!n.terminal:!0}function It(e){return`${e.holder_id} -> ${e.target_id} (blocked_by scalar + ${e.dependency_kind} dependency)`}function rr(e,t){let n=[],r=[];for(let o of e.orderingContradictions??[])(o.legacy_terminal?r:n).push(It(o));let i=[];return y(i,n,t,"ordering_storage_contradiction","error","A scalar blocker and same-target structured ordering row must not assert opposite precedence.",o=>`${o} active scalar-versus-structured ordering contradiction(s)`,"Remove the structured dependency row that points the holder before its scalar blocker, or replace both representations with one unambiguous ordering edge."),y(i,r,t,"legacy_ordering_storage_contradiction","info","Terminal scalar-versus-structured ordering contradictions are exact historical storage defects with no live scheduling effect.",o=>`${o} terminal scalar-versus-structured ordering contradiction(s)`,"Remove the contradictory blocks dependency row in a dedicated changelog-safe closed-item batch; preserve the scalar blocker as the historical precedence record."),i}function ir(e,t,n,r){let i=[],o=Qn(e);for(let a of tr(o)){let d=a.some(u=>le(u,t)),l=new Set(a.map(u=>u.toLowerCase())),f=(e.orderingContradictions??[]).filter(u=>l.has(u.holder_id.toLowerCase())&&l.has(u.target_id.toLowerCase())).map(It);i.push(d?R("ordering_cycle","error","Order-bearing relationship kinds must stay acyclic; a cycle makes every member unschedulable.",u=>`execution-order cycle across ${u} item(s)`,a,r,"Remove or retype one ordering edge inside the cycle, or split the work so precedence is linear.",f.length===0?void 0:f):R("legacy_ordering_cycle","info","Ordering cycles between exclusively terminal items are historical contradictions with no scheduling effect.",u=>`terminal-only execution-order cycle across ${u} item(s)`,a,r,"Leave as history debt, or clean up in a dedicated changelog-safe closed-item batch; never repair closed items ad hoc.",f.length===0?void 0:f))}let s=new Map;for(let[a,d]of o)for(let l of d){let f=s.get(l);f?f.push(a):s.set(l,[a])}let c=[...t.values()].filter(a=>!a.missing&&!a.terminal&&n(a.status)&&!(s.get(a.id)??[]).some(d=>{let l=t.get(d);return l===void 0||!l.terminal})).map(a=>a.id);return y(i,c,r,"stale_lifecycle_block","warning","A blocked lifecycle status must be backed by at least one open ordering predecessor.",a=>`${a} status-blocked item(s) with no open blocker edge`,'Add a local blocker edge, declare an external blocker with --dep "id=<external-ref>,kind=blocked_by,source_kind=external", or move the item back to an active status.'),i}function Z(e){let t=e.edges.map(n=>n.kind).sort((n,r)=>n.localeCompare(r));return`${e.from} -> ${e.to} (${t.join(" + ")})`}function ue(e){let t=e.graph.registry(),n=new Map;for(let i of e.graph.edges()){let o=t.require(i.kind);if(!W(o))continue;let s=ce(i,o);if(s.from===s.to)continue;let c=`${Y(o)}::${s.from}::${s.to}`,a=n.get(c);a?a.edges.push(i):n.set(c,{...s,edges:[i]})}let r=[...n.values()].filter(i=>i.edges.length>=2);for(let i of r)i.edges.sort((o,s)=>o.kind.localeCompare(s.kind));return r.sort((i,o)=>i.from.localeCompare(o.from)||i.to.localeCompare(o.to))}function or(e,t,n){let r=[],i=[];for(let s of ue(e))(le(s.from,t)||le(s.to,t)?r:i).push(Z(s));let o=[];return y(o,r,n,"duplicate_edge","info","One semantic relationship should be stored once; parallel same-family spellings (reciprocal inverse pairs included) add no information and skew degree metrics.",s=>`${s} duplicated relationship(s) between active endpoints`,"Remove all but one stored spelling of the relationship; keep the canonical direction the holder declared first."),y(o,i,n,"legacy_duplicate_edge","info","Duplicated spellings between exclusively terminal items are historical noise with no scheduling effect.",s=>`${s} duplicated relationship(s) between terminal endpoints`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),o}function sr(e,t){let n=[],r=[];for(let o of e.duplicateRows??[])(o.legacy_terminal?r:n).push(`${o.holder_id} -> ${o.target_id} (${o.kind} x${o.occurrences})`);let i=[];return y(i,n,t,"duplicate_dependency_row","warning","One dependency row must be stored once per holder; identical repeated rows are a storage-layer defect invisible to the assembled graph.",o=>`${o} exactly duplicated stored dependency row(s) on active holder(s)`,"Remove the repeated rows so the dependency is stored exactly once; graph semantics are unchanged."),y(i,r,t,"legacy_duplicate_dependency_row","info","Identical repeated dependency rows on terminal holders are historical storage noise with no scheduling effect.",o=>`${o} exactly duplicated stored dependency row(s) on terminal holder(s)`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),i}function cr(e,t){let n=new Map,r={source_to_target:[],target_to_source:[],both:[]};for(let s of e.graph.registry().list())s.outcomeTraversal!==void 0&&r[s.outcomeTraversal].push(s.kind);let i={source_to_target:r.source_to_target.join(","),target_to_source:r.target_to_source.join(","),both:r.both.join(",")},o=(s,c)=>{let a=n.get(c)??new Set;a.add(s),n.set(c,a)};for(let s of e.graph.edges()){t?.throwIfAborted();let c=e.graph.registry().require(s.kind);(c.outcomeTraversal==="source_to_target"||c.outcomeTraversal==="both")&&o(s.source,s.target),(c.outcomeTraversal==="target_to_source"||c.outcomeTraversal==="both")&&o(s.target,s.source)}return{basis:i,reverse:n}}function ar(e,t,n){let r=new Set(e),i=[...e].sort();for(let o=0;o<i.length;o+=1){n?.throwIfAborted();for(let s of[...t.get(i[o])??[]].sort())r.has(s)||(r.add(s),i.push(s))}return r}function dr(e,t,n,r){let i=0,o=0,s=0,c=0;for(let g of e.values())if(r?.throwIfAborted(),!t.has(g.id)&&!(g.missing||g.status==="external")){if(g.terminal){s+=1,n.has(g.id)&&(c+=1);continue}n.has(g.id)?i+=1:o+=1}let a=i+o,d=s-c,l=i+c,f=o+d,u=l+f;return{active_outcome_reachable_nodes:i,active_outcome_unreachable_nodes:o,active_outcome_reachability_basis_points:a===0?0:Math.floor(i*1e4/a),terminal_nodes:s,terminal_outcome_reachable_nodes:c,terminal_outcome_unreachable_nodes:d,terminal_outcome_reachability_basis_points:s===0?0:Math.floor(c*1e4/s),outcome_reachable_nodes:l,outcome_unreachable_nodes:f,outcome_reachability_basis_points:u===0?0:Math.floor(l*1e4/u)}}function lr(e,t,n){let r=new Set(e.details.filter(c=>c.type?.toLowerCase()===Vn&&c.title.trim().toLowerCase().startsWith(Wn)).map(c=>c.id)),{basis:i,reverse:o}=cr(e,n),s=ar(r,o,n);return{outcome_nodes:r.size,outcome_reachability_basis:i,...dr(t,r,s,n)}}function ur(e,t,n,r,i){e.active+=1;let o=t.type??"(untyped)",s=e.byType.get(o);s||(s={active:0,isolated:0,degree_leq_one:0},e.byType.set(o,s)),s.active+=1,!(n>1)&&(e.degreeLeqOne+=1,s.degree_leq_one+=1,n===0&&(e.isolated+=1,s.isolated+=1),!(r.has(t.id.toLowerCase())||i.has(o.toLowerCase()))&&(n===0?e.isolates.push(t.id):e.sparse.push(t.id)))}function fr(e,t,n,r,i,o,s){let c={active:0,missing:0,isolated:0,degreeLeqOne:0,isolates:[],sparse:[],byType:new Map};for(let p of e.graph.nodes()){s?.throwIfAborted();let _=t.get(p);if(_){if(_.missing){c.missing+=1;continue}_.terminal||ur(c,_,e.graph.incidentEdges(p).length,n,r)}}let{isolates:a,sparse:d}=c,l=[];y(l,a,i,"isolated_active_node","warning","Active work should be reachable from the graph unless explicitly declared a valid isolate.",p=>`${p} active item(s) with no relationships`,"Link the item to its parent, prerequisite, or origin \u2014 or register it as an exempt isolate."),y(l,d,i,"sparse_active_node","info","Active items with a single edge often miss an honest semantic partner; sparse is not automatically defective.",p=>`${p} active item(s) with exactly one relationship`,"Investigate for an honest second edge (story->task, defect family, cross-epic complement); do not fabricate one.");let f=e.graph.edges().length,u=T(e.graph,{signal:s}).value,g=new Set(u.map(({edge:p})=>`${p.source.toLowerCase()}\0${p.target.toLowerCase()}\0${p.kind}`));for(let p of e.orderingContradictions??[])g.add(`${p.holder_id.toLowerCase()}\0${p.target_id.toLowerCase()}\0${p.dependency_kind}`);let h=Object.fromEntries(Object.entries(o).sort(([p],[_])=>p.localeCompare(_))),m=Object.entries(h).reduce((p,[_,E])=>p+(Q(_)?E:0),0),b=X(e.graph,{signal:s}).value,v=lr(e,t,s);return{findings:l,profile:{nodes:e.graph.nodes().length,recorded_nodes:e.details.filter(p=>p.status!=="missing"&&p.status!=="external").length,edges:f,informative_edges:f-g.size,redundant_edges:u.length,ordering_contradiction_edges:e.orderingContradictions?.length??0,edge_basis:"deduplicated_directed",edges_by_kind:h,edge_share_by_kind:Object.fromEntries(Object.entries(h).map(([p,_])=>[p,_/f])),semantic_edges:m,semantic_edge_share:f===0?0:m/f,active_nodes:c.active,missing_nodes:c.missing,isolated_active_nodes:c.isolated,degree_leq_one_active_nodes:c.degreeLeqOne,coverage_by_type:Object.fromEntries([...c.byType.entries()].sort(([p],[_])=>p<_?-1:1)),articulation_points:b.articulationPoints.length,bridge_edges:b.bridges.length,...v,finding_subjects_by_code:Object.fromEntries(A.map(p=>[p,0]))}}}function ee(e,t={}){let n=t.isTerminal??(u=>u==="closed"||u==="canceled"),r=t.isBlocked??(u=>u==="blocked"),i=t.maxSampleSize??Kn;if(!Number.isInteger(i)||i<1)throw new TypeError(`Invalid audit sample bound: ${String(t.maxSampleSize)}`);let o=yt(t.exemptIsolates),s=yt(t.isolateExemptTypes),c=new Map(e.details.map(u=>[u.id,{id:u.id,status:u.status,missing:e.missingIdSet.has(u.id.toLowerCase()),terminal:n(u.status),...u.type===void 0?{}:{type:u.type}}]));t.signal?.throwIfAborted();let a={};for(let u of e.graph.edges())a[u.kind]=(a[u.kind]??0)+1;let d=nr(e,n,i);d.push(...Jn(e,i)),t.signal?.throwIfAborted(),d.push(...rr(e,i)),t.signal?.throwIfAborted(),d.push(...ir(e,c,r,i)),t.signal?.throwIfAborted(),d.push(...or(e,c,i),...sr(e,i)),t.signal?.throwIfAborted();let l=fr(e,c,o,s,i,a,t.signal);d.push(...l.findings),d.sort((u,g)=>_t[u.severity]-_t[g.severity]||u.code.localeCompare(g.code)||u.sample[0].localeCompare(g.sample[0]));let f=l.profile.finding_subjects_by_code;for(let u of d)f[u.code]+=u.count;return{findings:d,profile:{...l.profile,...ht(e,n,Q,t.signal),ordering_acyclic:!d.some(u=>u.code==="ordering_cycle"||u.code==="legacy_ordering_cycle"),active_ordering_acyclic:!d.some(u=>u.code==="ordering_cycle"),finding_subjects_by_code:f}}}function de(e,t){let n=[...new Set([...Object.keys(e),...Object.keys(t)])].sort(),r={};for(let i of n){let o=(t[i]??0)-(e[i]??0);o!==0&&(r[i]=o)}return r}function wt(e){return e.profile.coverage_by_type??{}}function gr(e,t){let n={},r=wt(e),i=wt(t),o=[...new Set([...Object.keys(r),...Object.keys(i)])].sort();for(let s of o){let c=Object.assign({active:0,isolated:0,degree_leq_one:0},r[s]),a=Object.assign({active:0,isolated:0,degree_leq_one:0},i[s]),d={active:a.active-c.active,isolated:a.isolated-c.isolated,degree_leq_one:a.degree_leq_one-c.degree_leq_one};Object.values(d).some(l=>l!==0)&&(n[s]=d)}return n}function xt(e,t){let n=gr(e,t),{edge_share_by_kind:r={},semantic_edges:i=0,semantic_edge_share:o=0}=e.profile,{edge_share_by_kind:s={},semantic_edges:c=0,semantic_edge_share:a=0}=t.profile,d=e.profile.recorded_nodes??e.profile.nodes,l=t.profile.recorded_nodes??t.profile.nodes,f=e.profile.informative_edges??e.profile.edges,u=t.profile.informative_edges??t.profile.edges,g=e.profile.redundant_edges??0,h=t.profile.redundant_edges??0,m=e.profile.ordering_contradiction_edges??0,b=t.profile.ordering_contradiction_edges??0;return{baseline_saved_at:e.saved_at,same_snapshot:e.fingerprint===t.fingerprint,affected_subjects_by_code:de(e.affected_subjects_by_code,t.affected_subjects_by_code),profile:{nodes:t.profile.nodes-e.profile.nodes,recorded_nodes:l-d,edges:t.profile.edges-e.profile.edges,informative_edges:u-f,redundant_edges:h-g,ordering_contradiction_edges:b-m,active_nodes:t.profile.active_nodes-e.profile.active_nodes,missing_nodes:t.profile.missing_nodes-e.profile.missing_nodes,isolated_active_nodes:t.profile.isolated_active_nodes-e.profile.isolated_active_nodes,degree_leq_one_active_nodes:t.profile.degree_leq_one_active_nodes-e.profile.degree_leq_one_active_nodes,edges_by_kind:de(e.profile.edges_by_kind,t.profile.edges_by_kind),edge_share_by_kind:de(r,s),semantic_edges:c-i,semantic_edge_share:a-o,coverage_by_type:n,...mt(e.profile,t.profile)}}}import Et from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="19264e42-25fa-5c93-9b0d-3b18a1ab9783")}catch{}})();var Ct=2,fe=500,hr=64,pr="graph-durable-cache";function St(e){return Re(e,pr,30,`graph-cache:${process.pid}`,!1,!1,3e3)}function F(e){return Et.join(e,"runtime","graph-cache.json")}function Dt(e){return Et.join(e,"runtime","graph-audit-baseline.json")}function ge(e){if(e!==null)try{let t=JSON.parse(e);return typeof t!="object"||t===null||t.version!==Ct||typeof t.fingerprint!="string"||typeof t.saved_at!="string"||typeof t.results!="object"||t.results===null||Array.isArray(t.results)?void 0:t}catch{return}}async function he(e,t){let n=await j(F(e)),r=ge(n),i=r?.fingerprint===t;return{exists:n!==null,fresh:i,results:i?r.results:{}}}async function pe(e,t,n,r,i){let o=await St(e);try{let s=ge(await j(F(e))),c=s?.fingerprint===t?s.results:{};delete c[r],c[r]=i;let a=Object.keys(c);for(let d of a.slice(0,Math.max(0,a.length-hr)))delete c[d];await re(F(e),JSON.stringify({version:Ct,fingerprint:t,saved_at:new Date().toISOString(),results:c})),n.results=c}finally{await o()}}async function me(e){let t=await St(e);try{await we(F(e))}finally{await t()}}async function Tt(e,t){let n=F(e),r=await j(n),i=ge(r);return i===void 0?{exists:r!==null,fresh:!1,entry_count:0}:{exists:!0,fresh:i.fingerprint===t,entry_count:Object.keys(i.results).length,fingerprint:i.fingerprint.slice(0,12),saved_at:i.saved_at,bytes:Buffer.byteLength(r,"utf8")}}function _e(e,t){return t||e>=fe}function te(e){return O(e)&&Object.values(e).every(x)}function O(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function x(e){return Number.isInteger(e)&&Number(e)>=0}function Nt(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function L(e,t){return e===void 0||t(e)}function mr(e){return O(e)&&Object.values(e).every(Nt)}function _r(e){return O(e)?Object.values(e).every(t=>O(t)&&[t.active,t.isolated,t.degree_leq_one].every(x)):!1}function yr(e,t,n){let r=["recorded_nodes","informative_edges","redundant_edges","ordering_contradiction_edges"],i=r.filter(s=>e[s]!==void 0).length;if(i!==0&&i!==r.length||!r.every(s=>L(e[s],x)))return;let o={recorded_nodes:e.recorded_nodes??t,informative_edges:e.informative_edges??n,redundant_edges:e.redundant_edges??0,ordering_contradiction_edges:e.ordering_contradiction_edges??0};return o.recorded_nodes<=t&&o.informative_edges<=n&&o.redundant_edges<=n&&o.ordering_contradiction_edges<=n?o:void 0}function br(e,t,n){let r=[...t,...n,"finding_subjects_by_code"],i=r.filter(o=>e[o]!==void 0).length;return i!==0&&i!==r.length?!1:t.every(o=>L(e[o],x))&&n.every(o=>L(e[o],x)&&(e[o]===void 0||Number(e[o])<=1e4))&&L(e.finding_subjects_by_code,te)}function vr(e,t,n,r){let i=yr(e,n,r);if(i===void 0)return;let o=["articulation_points","bridge_edges","outcome_nodes","active_outcome_reachable_nodes","active_outcome_unreachable_nodes","terminal_nodes","terminal_outcome_reachable_nodes","terminal_outcome_unreachable_nodes","outcome_reachable_nodes","outcome_unreachable_nodes"],s=["active_outcome_reachability_basis_points","terminal_outcome_reachability_basis_points","outcome_reachability_basis_points"];if(!br(e,o,s)||e.edge_basis!==void 0&&e.edge_basis!=="deduplicated_directed")return;let c=te(e.finding_subjects_by_code)?e.finding_subjects_by_code:{};return{edge_basis:"deduplicated_directed",...i,...Object.fromEntries(o.map(a=>[a,e[a]??0])),...Object.fromEntries(s.map(a=>[a,e[a]??0])),finding_subjects_by_code:Object.fromEntries(A.map(a=>[a,c[a]??t[a]??0]))}}function wr(e,t,n,r,i){let o=[n,r,i],s=o.filter(d=>d!==void 0).length;if(s===0)return{edge_share_by_kind:{},semantic_edges:0,semantic_edge_share:0};if(s!==o.length||!mr(n)||!x(r)||!Nt(i))return;let c=Object.entries(t);if(c.reduce((d,[,l])=>d+l,0)!==e||Object.keys(n).length!==c.length||c.some(([d,l])=>n[d]!==(e===0?0:l/e)))return;let a=c.reduce((d,[l,f])=>d+(Q(l)?f:0),0);if(!(r!==a||i!==(e===0?0:a/e)))return{edge_share_by_kind:n,semantic_edges:r,semantic_edge_share:i}}function kr(e){if(e!==null)try{let t=JSON.parse(e);if(!O(t))return;let n=t,r=n.profile;if(typeof n.saved_at!="string"||typeof n.fingerprint!="string")return;let i=n.affected_subjects_by_code;if(!te(i)||!O(r)||!pt(r)||![r.nodes,r.edges,r.active_nodes,r.missing_nodes,r.isolated_active_nodes,r.degree_leq_one_active_nodes].every(x)||!te(r.edges_by_kind)||!L(r.coverage_by_type,_r))return;let o=wr(r.edges,r.edges_by_kind,r.edge_share_by_kind,r.semantic_edges,r.semantic_edge_share);if(o===void 0)return;let s=vr(r,i,r.nodes,r.edges);if(s===void 0)return;let{coverage_by_type:c={}}=r;return{...n,profile:{...r,...o,...s,coverage_by_type:c}}}catch{return}}async function At(e){return kr(await j(Dt(e)))}async function Rt(e,t){await re(Dt(e),JSON.stringify(t))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="236ccc7d-6efd-57b1-8cce-6758d537f779")}catch{}})();var Ir={missing_reference_active:{op:"investigate",confidence:"medium",rationale:"Restore or re-create the referenced item, or remove/retype the reference on the active holder; the correct fix depends on why the target is absent."},missing_reference_terminal:{op:"waive",confidence:"high",rationale:"Terminal-holder reference to an absent item is historical debt; waive it or clean it up only in a dedicated changelog-safe closed-item batch."},legacy_no_blocker_sentinel:{op:"remove",confidence:"high",rationale:"The pre-structured-dependency no-active-blocker sentinel is retired and carries no information; blocker state derives from blocked_by edges."},ordering_cycle:{op:"investigate",confidence:"low",rationale:"Every cycle member is unschedulable until one ordering edge is removed or retyped; the planner never chooses which edge to cut."},legacy_ordering_cycle:{op:"waive",confidence:"high",rationale:"Terminal-only ordering cycles have no scheduling effect; repairing them would mutate closed history (changelog drag)."},ordering_storage_contradiction:{op:"remove",confidence:"high",rationale:"The structured ordering row asserts the opposite precedence from the same-target scalar blocker; remove that exact dependency row or replace both representations with one unambiguous edge."},legacy_ordering_storage_contradiction:{op:"remove",confidence:"high",rationale:"The terminal holder contains a proven contradictory structured ordering row; remove it in a dedicated changelog-safe batch while preserving the scalar blocker as history."},hierarchy_cycle:{op:"investigate",confidence:"low",rationale:"Cut or retype one exact structural relation in the cycle; the planner preserves every evidence row because intent determines the correct parent."},legacy_hierarchy_cycle:{op:"waive",confidence:"high",rationale:"Terminal-only hierarchy cycles are historical debt; waive them unless an explicit closed-history repair is approved."},hierarchy_cardinality_violation:{op:"investigate",confidence:"medium",rationale:"Choose the canonical parent and remove or retype the exact surplus hierarchy rows; the planner cannot infer ownership intent."},legacy_hierarchy_cardinality_violation:{op:"waive",confidence:"high",rationale:"Multiple parents confined to terminal items are historical debt; waive them unless a dedicated history repair is approved."},hierarchy_direction_violation:{op:"investigate",confidence:"medium",rationale:"Align the scalar parent and dependency-backed hierarchy rows to the intended canonical parent."},legacy_hierarchy_direction_violation:{op:"waive",confidence:"high",rationale:"Divergent hierarchy storage confined to terminal items is historical debt; waive it unless a dedicated history repair is approved."},duplicate_edge:{op:"remove",confidence:"high",rationale:"Parallel same-family spellings state one relationship twice; remove all but one stored spelling, keeping the holder's canonical direction."},legacy_duplicate_edge:{op:"waive",confidence:"high",rationale:"Duplicated spellings between terminal items are historical noise; waive or batch changelog-safe cleanup."},duplicate_dependency_row:{op:"remove",confidence:"high",rationale:"The identical dependency row is stored more than once on the holder; drop the repeats so the row exists exactly once \u2014 graph semantics are unchanged."},legacy_duplicate_dependency_row:{op:"waive",confidence:"high",rationale:"Repeated identical rows on terminal holders are storage noise; waive or clean up only in a changelog-safe closed-item batch."},stale_lifecycle_block:{op:"investigate",confidence:"medium",rationale:`Add a local ordering edge, declare an external blocker with --dep "id=<external-ref>,kind=blocked_by,source_kind=external", or move the item back to an active status; only the holder's owner knows which is true.`},isolated_active_node:{op:"investigate",confidence:"medium",rationale:"Link the item to its parent, prerequisite, or origin \u2014 or register it as an explicitly exempt isolate; the audit never fabricates an edge."},sparse_active_node:{op:"investigate",confidence:"low",rationale:"Investigate for an honest second edge (story-to-task, defect family, cross-epic complement); sparse is not automatically defective."}};function Ot(e){return`${e.source} -${e.kind}-> ${e.target}`}function xr(e){let[t,...n]=e.edges;return n.map(r=>({op:"remove",code:"duplicate_edge",subject:Ot(r),rationale:"This stored spelling restates the kept canonical edge of the same semantic family; removing it leaves the relationship stated exactly once.",evidence:[`keep: ${Ot(t)}`,`group: ${Z(e)}`],confidence:"high"}))}function Er(e,t){if(e.code==="duplicate_edge")return e.sample.flatMap(r=>xr(t.get(r)));let n=Ir[e.code];return e.sample.map(r=>({op:n.op,code:e.code,subject:r,rationale:n.rationale,evidence:[e.policy],confidence:n.confidence}))}function jt(e,t={}){let{redundancyLimit:n,...r}=t,i=ee(e,r),o=new Map(ue(e).map(d=>[Z(d),d])),s=i.findings.flatMap(d=>Er(d,o)),c=i.findings.some(d=>d.sample_truncated);t.signal?.throwIfAborted();let a=T(e.graph,{limit:n??t.maxSampleSize??25,...t.signal===void 0?{}:{signal:t.signal}});for(let d of a.value)s.push({op:"remove",code:"redundant_edge",subject:`${d.edge.source} -> ${d.edge.target} (${d.edge.kind})`,rationale:"The stored edge is implied by a longer same-family witness path; shortcut edges are sometimes deliberate emphasis, so confirm intent before removing.",evidence:[`witness: ${d.witness.join(" -> ")}`],confidence:"medium"});return c=c||a.meta.truncated,{steps:s,report:i,truncated:c,cost:{visitedNodes:a.meta.visitedNodes,inspectedEdges:a.meta.inspectedEdges}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3a536c76-bbd6-5235-b06a-f18c5cf95a88")}catch{}})();var Ft=new Set(["ancestors","descendants","predecessors","successors","paths","impact","dominators"]),I=10;function Mt(e,t,n){let r=e;if(t&&e.subcommand==="audit"){let{nodes:i,recorded_nodes:o,edges:s,active_nodes:c,terminal_nodes:a,missing_nodes:d,ordering_acyclic:l,active_ordering_acyclic:f,coverage_by_lifecycle:u}=e.profile,g=Object.fromEntries(Object.entries(u).map(([h,m])=>{let{degree_histogram:b,...v}=m;return[h,v]}));r={...e,profile:{nodes:i,recorded_nodes:o,edges:s,active_nodes:c,terminal_nodes:a,missing_nodes:d,ordering_acyclic:l,active_ordering_acyclic:f,coverage_by_lifecycle:g}}}return{...r,projection:{mode:t?"summary":"full",declared_field_groups:n===void 0?[]:[{name:n,restore_with:"--full"}],included_field_groups:n===void 0||t?[]:[n]}}}function Pt(e){return e===void 0?[]:(Array.isArray(e)?e:[e]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(t=>t.length>0)}function Cr(e,t,n){let r=e.trim().toLowerCase();if(!ie.includes(r))throw Le({command_path:"graph",token:r||"<empty>",allowed:ie});let i=r;if(Ft.has(i)&&!t?.trim())throw new k(`graph ${i} requires an item id.`,w.USAGE);if(i==="paths"&&!n?.trim())throw new k("graph paths requires a source and a target item id.",w.USAGE);return i}function ye(e){throw e instanceof TypeError?new k(e.message,w.USAGE):e}function be(e){return{truncated:e.truncated,cost:{visited_nodes:e.visitedNodes,inspected_edges:e.inspectedEdges}}}function Lt(e,t){let n=t.trim().toLowerCase();for(let r of e.details)if(r.id.trim().toLowerCase()===n&&!e.missingIdSet.has(r.id.toLowerCase()))return r.id;throw new k(`Item ${t} not found`,w.NOT_FOUND)}function Sr(e,t,n){let r={ancestors:Qe,descendants:Ze,predecessors:et,successors:tt}[e],i;try{i=r(n.assembly.graph,t,{...n.kinds===void 0?{}:{kinds:n.kinds},...n.maxDepth===void 0?{}:{maxDepth:n.maxDepth},...n.limit===void 0?{}:{limit:n.limit},...n.after===void 0?{}:{after:n.after}})}catch(s){ye(s)}let o=be(i.meta);return{subcommand:e,root:t,count:i.value.length,...o,...i.meta.nextCursor===void 0?{}:{next_cursor:i.meta.nextCursor},...n.summary?{}:{ids:i.value}}}function Dr(e,t,n){let r=nt(n.assembly.graph,e,t,{direction:n.direction,...n.kinds===void 0?{}:{kinds:n.kinds},...n.maxDepth===void 0?{}:{maxDepth:n.maxDepth},...n.maxPaths===void 0?{}:{maxPaths:n.maxPaths}});return{subcommand:"paths",root:e,target:t,direction:n.direction,count:r.value.length,...be(r.meta),...n.summary?{}:{paths:r.value.map(i=>({nodes:i.nodes,kinds:i.edges.map(o=>o.kind),length:i.length}))}}}function Tr(e,t){let n;try{n=U(t.assembly.graph,e,{direction:t.direction,...t.kinds===void 0?{}:{kinds:t.kinds},...t.maxDepth===void 0?{}:{maxDepth:t.maxDepth},...t.unbounded?{}:{limit:t.limit??I},...t.after===void 0?{}:{after:t.after}})}catch(r){ye(r)}return{subcommand:"impact",root:e,direction:t.direction,count:n.affected.length,truncated:n.truncated,...n.nextCursor===void 0?{}:{next_cursor:n.nextCursor},cost:{visited_nodes:n.cost.visitedNodes,inspected_edges:n.cost.inspectedEdges},...t.summary?{}:{affected:n.affected}}}function Nr(e,t,n){return{acyclic:e.acyclic,ordered_node_count:e.order.length,layer_count:e.layers.length,frontier_count:e.frontier.length,critical_path_length:e.criticalPathLength,cycle_count:e.cycles.length,...t?{}:{frontier:e.frontier.slice(0,n),critical_path:e.criticalPath.slice(0,n),cycles:e.cycles.slice(0,n)}}}function Ar(e,t,n){return{component_count:e.components.length,largest_component_size:e.components[0]?.length??0,orphan_count:e.orphans.length,...t?{}:{orphans:e.orphans.slice(0,n),hubs:e.hubs.slice(0,n)}}}function Rr(e,t,n){let r=0,i=0,o=0;for(let s of e.cycles)r+=Number(s.legacy_terminal);for(let s of e.cardinality_violations)i+=Number(s.legacy_terminal);for(let s of e.divergences)o+=Number(s.legacy_terminal);return{acyclic:e.cycles.length===0,relation_count:e.relations.length,cycle_count:e.cycles.length,active_cycle_count:e.cycles.length-r,legacy_cycle_count:r,cardinality_violation_count:e.cardinality_violations.length,active_cardinality_violation_count:e.cardinality_violations.length-i,legacy_cardinality_violation_count:i,parent_divergence_count:e.divergences.length,active_parent_divergence_count:e.divergences.length-o,legacy_parent_divergence_count:o,...t?{}:{cycles:e.cycles.slice(0,n).map(s=>s.item_ids)}}}function Or(e){let t=e.assembly.graph,n=e.limit??I,r=B(t,{registry:t.registry()}),i=Ye(t);return{subcommand:"analyze",node_count:t.nodes().length,edge_count:t.edges().length,edge_basis:"deduplicated_directed",sample_limit:n,execution:Nr(r,e.summary,n),knowledge:Ar(i,e.summary,n),hierarchy:Rr(G(e.assembly),e.summary,n)}}function jr(e,t){let n=ee(e.assembly,{isTerminal:t,...e.sample===void 0?{}:{maxSampleSize:e.sample},...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),r={},i={},o={},s={};for(let d of n.findings)r[d.severity]=(r[d.severity]??0)+1,i[d.code]=(i[d.code]??0)+1,o[d.severity]=(o[d.severity]??0)+d.count,s[d.code]=(s[d.code]??0)+d.count;let{finding_subjects_by_code:c,...a}=n.profile;return{subcommand:"audit",finding_count:n.findings.length,findings_by_severity:r,findings_by_code:i,affected_subjects_by_severity:o,affected_subjects_by_code:s,profile:e.summary?a:n.profile,legacy_alias_counts:e.assembly.legacyAliasCounts,...e.summary?{}:{findings:n.findings}}}function Mr(e){let t=e.limit??I,n={};e.kinds!==void 0&&(n.kinds=e.kinds);let r=it(e.assembly.graph,n),i=r.value;return{subcommand:"communities",community_count:i.communities.length,largest_community_size:i.communities[0]?.size??0,iterations:i.iterations,converged:i.converged,truncated:!i.converged||i.communities.length>t,cost:{visited_nodes:r.meta.visitedNodes,inspected_edges:r.meta.inspectedEdges},...e.summary?{}:{communities:i.communities.slice(0,t).map(o=>({representative:o.representative,size:o.size,members:o.members.slice(0,t)}))}}}function Pr(e){let t;try{t=T(e.assembly.graph,{...e.kinds===void 0?{}:{kinds:e.kinds},...e.maxDepth===void 0?{}:{maxDepth:e.maxDepth},...e.limit===void 0?{}:{limit:e.limit}})}catch(n){ye(n)}return{subcommand:"redundancy",redundant_count:t.value.length,...be(t.meta),...e.summary?{}:{redundant:t.value.map(n=>({source:n.edge.source,target:n.edge.target,kind:n.edge.kind,witness:n.witness}))}}}function Lr(e,t){let n=t.limit??I,r=ot(t.assembly.graph,e,{direction:t.direction,...t.kinds===void 0?{}:{kinds:t.kinds},...t.maxDepth===void 0?{}:{maxDepth:t.maxDepth}}),i=r.value.rows.filter(o=>o.dominatedCount>0);return{subcommand:"dominators",root:e,direction:t.direction,reachable_count:r.value.reachableCount,bottleneck_count:i.length,truncated:r.meta.truncated||i.length>n,cost:{visited_nodes:r.meta.visitedNodes,inspected_edges:r.meta.inspectedEdges},...t.summary?{}:{bottlenecks:i.slice(0,n).map(o=>({id:o.id,idom:o.idom,dominated_count:o.dominatedCount}))}}}function Fr(e){let t=e.limit??I,n=lt(e.assembly.graph),r=n.rows.filter(i=>i.critical).length;return{subcommand:"slack",acyclic:n.acyclic,makespan:n.makespan,scheduled_count:n.scheduledCount,critical_count:r,critical_path_length:n.criticalPathLength,cycle_count:n.cycles.length,truncated:n.rows.length>t,...e.summary?{}:{critical_path:n.criticalPath,rows:n.rows.slice(0,t).map(i=>({id:i.id,earliest_start:i.earliestStart,latest_start:i.latestStart,slack:i.slack,critical:i.critical}))}}}function Gr(e){let t=e.limit??I,n=dt(e.assembly.graph,e.kinds===void 0?{}:{kinds:e.kinds}),r=n.value;return{subcommand:"centrality",node_count:r.nodeCount,edge_count:r.edgeCount,edge_basis:"simple_undirected",truncated:r.rows.length>t,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...e.summary?{}:{rows:r.rows.slice(0,t).map(i=>({id:i.id,degree:i.degree,in_degree:i.inDegree,out_degree:i.outDegree,betweenness:i.betweenness,closeness:i.closeness}))}}}function $r(e){let t=e.limit??I,n=X(e.assembly.graph,e.kinds===void 0?{}:{kinds:e.kinds}),{articulationPoints:r,bridges:i}=n.value;return{subcommand:"articulation",articulation_count:r.length,bridge_count:i.length,truncated:r.length>t||i.length>t,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...e.summary?{}:{articulation_points:r.slice(0,t),bridges:i.slice(0,t)}}}function qr(e,t){let n=e.limit??I,r=jt(e.assembly,{isTerminal:t,redundancyLimit:n,...e.sample===void 0?{}:{maxSampleSize:e.sample},...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),i={},o={};for(let s of r.steps)i[s.op]=(i[s.op]??0)+1,o[s.code]=(o[s.code]??0)+1;return{subcommand:"plan",step_count:r.steps.length,steps_by_op:i,steps_by_code:o,finding_count:r.report.findings.length,truncated:r.truncated||r.steps.length>n,cost:{visited_nodes:r.cost.visitedNodes,inspected_edges:r.cost.inspectedEdges},...e.summary?{}:{steps:r.steps.slice(0,n)}}}function Gt(e,t,n,r){return JSON.stringify({subcommand:e,root:t??null,target:n??null,kinds:r.kinds??null,maxDepth:r.maxDepth??null,limit:r.limit??null,after:r.after??null,direction:r.direction,maxPaths:r.maxPaths??null,sample:r.sample??null,exemptIsolates:[...new Set(r.exemptIsolates.map(i=>i.toLowerCase()))].sort(),exemptIsolateTypes:[...new Set(r.exemptIsolateTypes.map(i=>i.toLowerCase()))].sort(),summary:r.summary,unbounded:r.unbounded})}function $t(e,t,n,r,i){return e==="analyze"?Or(r):e==="audit"?jr(r,i):e==="plan"?qr(r,i):e==="communities"?Mr(r):e==="redundancy"?Pr(r):e==="dominators"?Lr(t,r):e==="slack"?Fr(r):e==="centrality"?Gr(r):e==="articulation"?$r(r):e==="paths"?Dr(t,n,r):e==="impact"?Tr(t,r):Sr(e,t,r)}function Ur(e,t){if(e!=="index"&&(t.rebuild===!0||t.clear===!0))throw new k("--rebuild and --clear apply only to graph index.",w.USAGE);if(e!=="audit"&&t.saveBaseline===!0)throw new k("--save-baseline applies only to graph audit.",w.USAGE);if(e==="slack"&&t.kind!==void 0)throw new k("graph slack analyzes every ordering kind; --kind is not supported.",w.USAGE);if(t.rebuild===!0&&t.clear===!0)throw new k("graph index accepts either --rebuild or --clear, not both.",w.USAGE);if(e==="impact"&&t.full===!0&&t.limit!==void 0)throw new k("graph impact accepts either --full or --limit, not both.",w.USAGE)}async function Br(e,t,n,r,i,o){let s="status";if(o.clear===!0&&(await me(e),s="cleared"),o.rebuild===!0){await me(e);let a=await he(e,t),d={assembly:n.assembly,direction:"both",exemptIsolates:[],exemptIsolateTypes:[],saveBaseline:!1,summary:!0,unbounded:!1};for(let l of["analyze","audit"])await pe(e,t,a,Gt(l,void 0,void 0,d),$t(l,void 0,void 0,d,i));s="rebuilt"}let c=await Tt(e,t);return{subcommand:"index",action:s,state:c.exists?c.fresh?"fresh":"stale":"absent",entry_count:c.entry_count,item_count:r,min_items_threshold:fe,persist_enabled:_e(r,c.exists),current_fingerprint:t.slice(0,12),...c.saved_at===void 0?{}:{saved_at:c.saved_at},...c.bytes===void 0?{}:{bytes:c.bytes}}}async function zr(e,t,n,r){let i={saved_at:new Date().toISOString(),fingerprint:t,affected_subjects_by_code:n.affected_subjects_by_code,profile:{...n.profile,finding_subjects_by_code:Object.fromEntries(A.map(s=>[s,n.affected_subjects_by_code[s]??0]))}},o=await At(e);return r&&await Rt(e,i),o===void 0?n:{...n,baseline:xt(o,i)}}async function Hr(e,t,n,r,i){try{await pe(e,t,n,r,i)}catch{}}function Kr(e,t,n,r){if(e.subcommand!=="slack")return;let i=new Set(t.assembly.details.filter(u=>r(u.status)).map(u=>u.id)),o=t.assembly.graph,s=new Ee(o.nodes().filter(u=>!i.has(u)),o.edges().filter(u=>!i.has(u.source)&&!i.has(u.target)),o.registry()),c=ut(s,n.filter(u=>!i.has(u.id)),{now:Ae(),limit:t.limit??I}),{rows:a,residuals:d,overcommitted:l,...f}=c;e.deadline_schedule={population:"active",...f,...t.summary?{}:{rows:a,residuals:d,overcommitted:l}}}async function eo(e,t,n,r,i){let o=Cr(e,t,n);Te(r.summary===!0,r.full===!0,"--summary");let s=Ie(process.cwd(),i.path);await Me(s);let c=await je(s),a=ke(c,Ne()),d=await Pe(s,c.item_format,a.type_to_folder,void 0,c.schema),l=Ce(c.schema),f=qt=>Oe(qt,l);Ur(o,r);let u=Fe(),g=ze(r.kind,u),h=qe().lookup(s,$e(d,f,u),()=>Ge(d,f,u)),m={assembly:h.assembly,...g===void 0?{}:{kinds:g},maxDepth:Ue(r.maxDepth),limit:$(r.limit,"limit"),after:r.after?.trim()||void 0,direction:Be(r.direction),maxPaths:$(r.maxPaths,"max-paths"),sample:$(r.sample,"sample"),exemptIsolates:Pt(r.exemptIsolate),exemptIsolateTypes:Pt(r.exemptIsolateType),saveBaseline:r.saveBaseline===!0,summary:r.summary===!0,unbounded:r.full===!0};if(o==="index")return Mt(await Br(s,h.fingerprint,m,d.length,f,r),!1);let b=Ft.has(o)?Lt(m.assembly,t):void 0,v=o==="paths"?Lt(m.assembly,n):void 0,p=Gt(o,b,v,m),_=await he(s,h.fingerprint),E=_.results[p],C=h.memoize(p,()=>E!==void 0?structuredClone(E):$t(o,b,v,m,f)),ve=_e(d.length,_.exists);!C.reused&&E===void 0&&ve&&await Hr(s,h.fingerprint,_,p,C.value);let ne=C.value.subcommand==="audit"?await zr(s,h.fingerprint,C.value,m.saveBaseline):C.value;return ne.cache={fingerprint:h.fingerprint.slice(0,12),assembly:h.assemblyReused?"hit":"miss",result:C.reused?"hit":"miss",durable:E!==void 0?"hit":ve?"miss":"off"},Kr(ne,m,d,f),Mt(ne,m.summary,"result_rows")}export{B as a,U as b,Ye as c,Yr as d,Qe as e,Ze as f,et as g,tt as h,nt as i,V as j,it as k,T as l,ot as m,dt as n,X as o,lt as p,ut as q,tr as r,It as s,Z as t,ue as u,ee as v,xt as w,Ct as x,fe as y,F as z,Dt as A,he as B,pe as C,me as D,Tt as E,_e as F,At as G,Rt as H,jt as I,Cr as J,eo as K};
2
+ //# sourceMappingURL=chunk-7MBUII7U.js.map
@@ -0,0 +1,8 @@
1
+ import{r as D,s as q}from"./chunk-7MBUII7U.js";import{Bb as z,Db as _,vb as N}from"./chunk-IAUOUGVR.js";import{P as x}from"./chunk-RXT4P5QH.js";import{$a as S,Kc as C,Nc as L,Qc as j,eb as m,la as b,na as k,pb as O}from"./chunk-QHNETP77.js";import{constants as p}from"node:fs";import{lstat as M,mkdir as $,open as F}from"node:fs/promises";import h from"node:path";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="e57a9bca-1190-5ffd-bb7d-d76a22fc9e57")}catch{}})();function E(n,e){if(typeof n!="string"||n.trim().length===0)throw new TypeError(`Relationship event ${e} must be non-empty`);return n.trim()}function I(n,e){let t=e.require(n.kind),i=t.direction==="undirected"?[n.source,n.target].sort().join("\0"):`${n.source}\0${n.target}`;return`${t.kind}\0${i}`}function H(n){return Object.freeze({...n,...n.payload===void 0?{}:{payload:Object.freeze(structuredClone(n.payload))}})}function J(n,e,t,i){let r=t.require(n.kind),o=i.outgoingOne.get(`${r.kind}\0${n.source}`);if(o!==void 0&&o!==e)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let s=i.incomingOne.get(`${r.kind}\0${n.target}`);if(s!==void 0&&s!==e)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let c=I(n,t),d=i.identities.get(c);if(d!==void 0&&d!==e)throw new TypeError(`Relationship edge already active: ${c}`)}function K(n){let e=new Map;for(let t of n)t.action==="remove"?e.delete(t.relationshipId):e.set(t.relationshipId,t.edge);return e}function G(n,e,t){if(n.expectedVersion!==void 0&&n.expectedVersion!==e)throw new TypeError(`Relationship event version conflict: expected ${n.expectedVersion}, current ${e}`);let i=E(n.eventId,"eventId");if(t.has(i))throw new TypeError(`Relationship event already exists: ${i}`);if(n.action!=="add"&&n.action!=="remove"&&n.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${n.action}`);if(!Number.isFinite(Date.parse(n.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:i,relationshipId:E(n.relationshipId,"relationshipId"),author:E(n.author,"author"),timestamp:new Date(n.timestamp).toISOString()}}function Q(n,e,t,i,r,o){let s=t.has(e);if(n.action==="add"&&s)throw new TypeError(`Relationship is already active: ${e}`);if(n.action!=="add"&&!s)throw new TypeError(`Relationship is not active: ${e}`);if(n.action==="remove")return;if(!n.edge)throw new TypeError(`Relationship ${n.action} event requires an edge`);let c=typeof n.edge.source=="string"?n.edge.source.trim():"",d=typeof n.edge.target=="string"?n.edge.target.trim():"";if(!i.has(c)||!i.has(d))throw new TypeError(`Relationship endpoint not found: ${c} -> ${d}`);let a=new m([c,d],[n.edge],r).edges()[0];return J(a,e,r,o),H(a)}var T=class{#t;#i;#n=[];#o=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(e,t={}){this.#t=new Set([...e].filter(i=>typeof i=="string").map(i=>i.trim()).filter(Boolean)),this.#i=t.registry??S()}get version(){return this.#n.length}events(){return Object.freeze([...this.#n])}*stream(e={}){let t=e.fromVersion??1,i=e.toVersion??this.version,r=e.batchSize??100;if(!Number.isInteger(t)||t<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${i}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(t>i+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let o=t-1;o<i;o+=r)yield Object.freeze(this.#n.slice(o,Math.min(o+r,i)))}project(e,t,i={}){if(typeof t!="function")throw new TypeError("Relationship event projection requires a reducer");let r=e,o=0,s;for(let c of this.stream({...i,batchSize:256}))for(let d of c)r=t(r,d),o+=1,s=d;return Object.freeze({state:r,version:s?.sequence??Math.max(0,(i.fromVersion??1)-1),processed:o,...s===void 0?{}:{asOf:s.timestamp}})}#s(e,t){let i=this.#i.require(t.kind);this.#r.identities.set(I(t,this.#i),e),i.outgoing==="one"&&this.#r.outgoingOne.set(`${i.kind}\0${t.source}`,e),i.incoming==="one"&&this.#r.incomingOne.set(`${i.kind}\0${t.target}`,e)}#a(e){let t=this.#i.require(e.kind);this.#r.identities.delete(I(e,this.#i)),t.outgoing==="one"&&this.#r.outgoingOne.delete(`${t.kind}\0${e.source}`),t.incoming==="one"&&this.#r.incomingOne.delete(`${t.kind}\0${e.target}`)}append(e){let t=G(e,this.version,this.#o),i=this.#e.get(t.relationshipId),r=Q(e,t.relationshipId,this.#e,this.#t,this.#i,this.#r),o=Object.freeze({eventId:t.eventId,relationshipId:t.relationshipId,action:e.action,...r===void 0?{}:{edge:r},author:t.author,timestamp:t.timestamp,...e.reason?.trim()?{reason:e.reason.trim()}:{},sequence:this.version+1});return this.#n.push(o),this.#o.add(t.eventId),i&&this.#a(i),e.action==="remove"?this.#e.delete(t.relationshipId):(this.#e.set(t.relationshipId,r),this.#s(t.relationshipId,r)),o}snapshot(e={}){if(e.atVersion!==void 0&&e.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let t;if(e.atTimestamp!==void 0){let o=Date.parse(e.atTimestamp);if(!Number.isFinite(o))throw new TypeError("Relationship snapshot timestamp must be valid");t=this.#n.filter(s=>Date.parse(s.timestamp)<=o)}else{let o=e.atVersion??this.version;if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship snapshot version out of range: ${o}`);t=this.#n.slice(0,o)}let i=K(t),r=new m(this.#t,i.values(),this.#i);return Object.freeze({version:t.at(-1)?.sequence??0,...t.at(-1)?{asOf:t.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(e){if(!Number.isInteger(e.limit)||e.limit<1)throw new TypeError("Relationship event page limit must be positive");let t=C("relationship-events",{order:"append-sequence"}),i=e.cursor===void 0?this.version:Number(L(e.cursor,t).snapshot);if(!Number.isSafeInteger(i)||i<0||i>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=j(this.#n.slice(0,i),{cursor:e.cursor,fingerprint:t,limit:e.limit,readId:o=>o.eventId,snapshot:String(i)});return{version:i,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},Y="relationship-event-store",A=p.O_NOFOLLOW;function g(n){return x(n,Y,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function f(n,e="relationships/events.jsonl"){let t=h.resolve(n),i=h.resolve(t,e),r=h.relative(t,i);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${h.sep}`)||h.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await $(t,{recursive:!0}),(await M(t)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let s=t;for(let c of r.split(h.sep)){s=h.join(s,c);try{if((await M(s)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(d){if(b(d))break;throw d}}return i}async function w(n,e,t){let i=new T(e,{registry:t}),r,o;try{o=await F(n,p.O_RDONLY|A),r=await o.readFile("utf8")}catch(c){if(b(c))return{log:i,raw:""};throw c}finally{await o?.close()}let s=r.split(`
2
+ `);for(let c=0;c<s.length;c+=1){let d=s[c].trim();if(!d)continue;let a;try{a=JSON.parse(d)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${c+1}`)}if(a.sequence!==i.version+1)throw new TypeError(`Invalid relationship event sequence at line ${c+1}`);i.append({eventId:a.eventId,relationshipId:a.relationshipId,action:a.action,...a.edge===void 0?{}:{edge:a.edge},author:a.author,timestamp:a.timestamp,...a.reason===void 0?{}:{reason:a.reason},expectedVersion:i.version})}return{log:i,raw:r}}function U(n,e,t,i){let r=Date.parse(e.timestamp),o;return e.action!=="remove"&&e.edge!==void 0&&(o=new m(t,[e.edge],i).edges()[0]),n.eventId===e.eventId.trim()&&n.relationshipId===e.relationshipId.trim()&&n.action===e.action&&n.author===e.author.trim()&&Number.isFinite(r)&&n.timestamp===new Date(r).toISOString()&&n.reason===(e.reason?.trim()||void 0)&&O(n.edge)===O(o)}var V=class n{#t;#i;#n;#o;#e;constructor(e,t,i,r){this.#t=e.pmRoot,this.#i=t,this.#n=e.registry,this.#o=i,this.#e=r}static async open(e){let t=Object.freeze([...e.nodes]),i=await f(e.pmRoot,e.relativePath),r=await g(e.pmRoot);try{await f(e.pmRoot,i);let{log:o}=await w(i,t,e.registry);return new n(e,t,i,o)}finally{await r()}}get path(){return this.#o}async currentVersion(){return this.#e=await this.#r(),this.#e.version}async append(e){let t=await g(this.#t);try{let i=await f(this.#t,this.#o),{log:r}=await w(i,this.#i,this.#n),o=r.append(e);await $(h.dirname(i),{recursive:!0}),await f(this.#t,i);let s=await F(i,p.O_APPEND|p.O_CREAT|p.O_WRONLY|A);try{await s.appendFile(`${JSON.stringify(o)}
3
+ `,"utf8")}finally{await s.close()}return this.#e=r,o}finally{await t()}}async appendBatch(e,t={}){let i=await g(this.#t);try{let r=await f(this.#t,this.#o),{log:o,raw:s}=await w(r,this.#i,this.#n),c=o.version,d=new Map(o.events().map(l=>[l.eventId,l])),a=[],R=[];for(let l of e){let u=l.eventId.trim(),v=d.get(u);if(v!==void 0){if(t.existingEventPolicy==="skip_identical"&&U(v,l,this.#i,this.#n)){R.push(v.eventId);continue}if(t.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${u}`)}let y=o.append(l);d.set(y.eventId,y),a.push(y)}if(a.length>0){let l=s.length===0||s.endsWith(`
4
+ `)?s:`${s}
5
+ `;await $(h.dirname(r),{recursive:!0}),await f(this.#t,r),await k(r,`${l}${a.map(u=>JSON.stringify(u)).join(`
6
+ `)}
7
+ `)}return this.#e=o,Object.freeze({version_before:c,version_after:o.version,appended:Object.freeze(a),skipped_event_ids:Object.freeze(R)})}finally{await i()}}async snapshot(e={}){return this.#e=await this.#r(),this.#e.snapshot(e)}async page(e){return this.#e=await this.#r(),this.#e.page(e)}async*stream(e={}){this.#e=await this.#r(),yield*this.#e.stream(e)}async project(e,t,i={}){return this.#e=await this.#r(),this.#e.project(e,t,i)}async#r(){let e=await g(this.#t);try{let t=await f(this.#t,this.#o);return(await w(t,this.#i,this.#n)).log}finally{await e()}}};(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="874a21db-ed3b-5b4f-a913-bf87103172e7")}catch{}})();function P(n){return[...n].sort().join("\0")}function X(n,e,t){let i=n.successors.get(e);i?i.push(t):n.successors.set(e,[t]);let r=n.predecessors.get(t);r?r.push(e):n.predecessors.set(t,[e])}function W(n,e,t,i,r){let o=e.resolve(r);if(o?.ordering!==!0)return;let s=z(i),c=s===void 0?void 0:n.canonicalIds.get(s.toLowerCase());if(c===void 0)return;let d=(o.precedence??"source_before_target")==="source_before_target";X(n,d?t:c,d?c:t)}function Z(n,e){let t={successors:new Map,predecessors:new Map,canonicalIds:new Map},i=n.filter(r=>typeof r?.id=="string"&&r.id.trim().length>0);for(let r of i){let o=r.id.trim();t.canonicalIds.set(o.toLowerCase(),o)}for(let r of i){let o=r.id.trim();W(t,e,o,r.blocked_by,"blocked_by");for(let s of r.dependencies??[])typeof s!="object"||s===null||W(t,e,o,s.id,typeof s.kind=="string"?s.kind:"related")}for(let r of[t.successors,t.predecessors])for(let o of r.values())o.sort();return t}function ee(n,e){let t=new Set([e]),i=[e];for(;i.length>0;){let r=i.pop();for(let o of[n.successors,n.predecessors])for(let s of o.get(r)??[])t.has(s)||(t.add(s),i.push(s))}return t}function te(n,e){let t=new Map;for(let i of e){let r=(n.successors.get(i)??[]).filter(o=>e.has(o));r.length>0&&t.set(i,r)}return t}function B(n,e,t){let i=Z(n,e),r=i.canonicalIds.get(t.trim().toLowerCase());if(r===void 0)return{cycles:[],successors:new Map,canonical:t};let o=te(i,ee(i,r));return{cycles:D(o).filter(s=>s.includes(r)),successors:o,canonical:r}}function ie(n,e,t){let i=new Set(e),r=i.has(t)?t:e[0];if(n.get(r)?.includes(r))return[r,r];for(let o of n.get(r)??[]){if(!i.has(o))continue;let s=ne(n,i,r,o);if(s)return s}return[...e,e[0]]}function ne(n,e,t,i){let r=[[i]],o=new Set([t,i]);for(;r.length>0;){let s=r.shift(),c=s.at(-1);for(let d of n.get(c)??[]){if(d===t)return[t,...s,t];!e.has(d)||o.has(d)||(o.add(d),r.push([...s,d]))}}}function me(n,e,t){let i=N(),r=B(n,i,t),o=B(e,i,t),s=new Set(r.cycles.map(P)),c=new Set(_(n,void 0,i).map(a=>`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`));return[..._(e,void 0,i).filter(a=>a.holder_id.toLowerCase()===t.trim().toLowerCase()&&!c.has(`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`)).map(a=>`ordering_storage_contradiction_created:${q(a)}:remove_contradicting_dependency_row:run_pm_graph_audit`),...o.cycles.filter(a=>!s.has(P(a))).map(a=>`ordering_cycle_created:${ie(o.successors,a,o.canonical).join(" -> ")}:items_will_not_be_ready:run_pm_graph_audit`)]}export{T as a,V as b,me as c};
8
+ //# sourceMappingURL=chunk-COPBO5HW.js.map