@unbrained/pm-cli 2026.5.30 → 2026.5.31

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 (228) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/cli/commands/calendar.js +81 -9
  3. package/dist/cli/commands/calendar.js.map +1 -1
  4. package/dist/cli/commands/create.js +34 -4
  5. package/dist/cli/commands/create.js.map +1 -1
  6. package/dist/cli/commands/extension/install-sources.d.ts +2 -0
  7. package/dist/cli/commands/extension/install-sources.js +11 -4
  8. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  9. package/dist/cli/commands/reindex.js +3 -3
  10. package/dist/cli/commands/reindex.js.map +1 -1
  11. package/dist/cli/commands/search.d.ts +17 -0
  12. package/dist/cli/commands/search.js +40 -10
  13. package/dist/cli/commands/search.js.map +1 -1
  14. package/dist/cli/register-list-query.js +9 -11
  15. package/dist/cli/register-list-query.js.map +1 -1
  16. package/dist/cli/register-mutation.js +20 -22
  17. package/dist/cli/register-mutation.js.map +1 -1
  18. package/dist/cli/register-operations.js +32 -25
  19. package/dist/cli/register-operations.js.map +1 -1
  20. package/dist/cli/register-setup.js +6 -8
  21. package/dist/cli/register-setup.js.map +1 -1
  22. package/dist/cli/registration-helpers.js +6 -3
  23. package/dist/cli/registration-helpers.js.map +1 -1
  24. package/dist/cli/search-refresh.d.ts +2 -0
  25. package/dist/cli/search-refresh.js +13 -0
  26. package/dist/cli/search-refresh.js.map +1 -0
  27. package/dist/cli-bundle/chunks/activity-OWYSUZOY.js +17 -0
  28. package/dist/cli-bundle/chunks/activity-OWYSUZOY.js.map +7 -0
  29. package/dist/cli-bundle/chunks/aggregate-ADUOSFRO.js +209 -0
  30. package/dist/cli-bundle/chunks/aggregate-ADUOSFRO.js.map +7 -0
  31. package/dist/cli-bundle/chunks/append-JD2DETU7.js +73 -0
  32. package/dist/cli-bundle/chunks/append-JD2DETU7.js.map +7 -0
  33. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js +27 -0
  34. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js.map +7 -0
  35. package/dist/cli-bundle/chunks/chunk-3M73P3G6.js +1636 -0
  36. package/dist/cli-bundle/chunks/chunk-3M73P3G6.js.map +7 -0
  37. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js +189 -0
  38. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js.map +7 -0
  39. package/dist/cli-bundle/chunks/chunk-5HSEP75M.js +330 -0
  40. package/dist/cli-bundle/chunks/chunk-5HSEP75M.js.map +7 -0
  41. package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js +1770 -0
  42. package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js.map +7 -0
  43. package/dist/cli-bundle/chunks/chunk-6YCV7WSL.js +552 -0
  44. package/dist/cli-bundle/chunks/chunk-6YCV7WSL.js.map +7 -0
  45. package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js +202 -0
  46. package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js.map +7 -0
  47. package/dist/cli-bundle/chunks/chunk-A7E7PUVX.js +157 -0
  48. package/dist/cli-bundle/chunks/chunk-A7E7PUVX.js.map +7 -0
  49. package/dist/cli-bundle/chunks/chunk-AKOOMO3T.js +90 -0
  50. package/dist/cli-bundle/chunks/chunk-AKOOMO3T.js.map +7 -0
  51. package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js +950 -0
  52. package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js.map +7 -0
  53. package/dist/cli-bundle/chunks/chunk-CEFIVZPG.js +79 -0
  54. package/dist/cli-bundle/chunks/chunk-CEFIVZPG.js.map +7 -0
  55. package/dist/cli-bundle/chunks/chunk-D7AOMPRH.js +349 -0
  56. package/dist/cli-bundle/chunks/chunk-D7AOMPRH.js.map +7 -0
  57. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js +56 -0
  58. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js.map +7 -0
  59. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js +47 -0
  60. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js.map +7 -0
  61. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js +56 -0
  62. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js.map +7 -0
  63. package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js +435 -0
  64. package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js.map +7 -0
  65. package/dist/cli-bundle/chunks/chunk-G57E5D7T.js +185 -0
  66. package/dist/cli-bundle/chunks/chunk-G57E5D7T.js.map +7 -0
  67. package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js +3621 -0
  68. package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js.map +7 -0
  69. package/dist/cli-bundle/chunks/chunk-JFWUHHS2.js +233 -0
  70. package/dist/cli-bundle/chunks/chunk-JFWUHHS2.js.map +7 -0
  71. package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js +1861 -0
  72. package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js.map +7 -0
  73. package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js +648 -0
  74. package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js.map +7 -0
  75. package/dist/cli-bundle/chunks/{chunk-PB2YU2E3.js → chunk-KBQY3YG5.js} +28 -70
  76. package/dist/cli-bundle/chunks/chunk-KBQY3YG5.js.map +7 -0
  77. package/dist/cli-bundle/chunks/chunk-L2FXEKDB.js +185 -0
  78. package/dist/cli-bundle/chunks/chunk-L2FXEKDB.js.map +7 -0
  79. package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js +189 -0
  80. package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js.map +7 -0
  81. package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js +5153 -0
  82. package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js.map +7 -0
  83. package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js +1345 -0
  84. package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js.map +7 -0
  85. package/dist/cli-bundle/chunks/chunk-NGN7UV5K.js +341 -0
  86. package/dist/cli-bundle/chunks/chunk-NGN7UV5K.js.map +7 -0
  87. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js +18 -0
  88. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js.map +7 -0
  89. package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js +2929 -0
  90. package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js.map +7 -0
  91. package/dist/cli-bundle/chunks/{chunk-RJONRNXN.js → chunk-P53TN6IA.js} +22 -30
  92. package/dist/cli-bundle/chunks/chunk-P53TN6IA.js.map +7 -0
  93. package/dist/cli-bundle/chunks/chunk-PVNQLCIS.js +176 -0
  94. package/dist/cli-bundle/chunks/chunk-PVNQLCIS.js.map +7 -0
  95. package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js +1680 -0
  96. package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js.map +7 -0
  97. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js +20 -0
  98. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js.map +7 -0
  99. package/dist/cli-bundle/chunks/chunk-SEXQN4KL.js +60 -0
  100. package/dist/cli-bundle/chunks/chunk-SEXQN4KL.js.map +7 -0
  101. package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js +362 -0
  102. package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js.map +7 -0
  103. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js +141 -0
  104. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js.map +7 -0
  105. package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js +632 -0
  106. package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js.map +7 -0
  107. package/dist/cli-bundle/chunks/chunk-WJ2NAC37.js +252 -0
  108. package/dist/cli-bundle/chunks/chunk-WJ2NAC37.js.map +7 -0
  109. package/dist/cli-bundle/chunks/claim-EE4TKKCV.js +133 -0
  110. package/dist/cli-bundle/chunks/claim-EE4TKKCV.js.map +7 -0
  111. package/dist/cli-bundle/chunks/close-XY4CSAYF.js +14 -0
  112. package/dist/cli-bundle/chunks/close-XY4CSAYF.js.map +7 -0
  113. package/dist/cli-bundle/chunks/comments-AAKJQ6LW.js +104 -0
  114. package/dist/cli-bundle/chunks/comments-AAKJQ6LW.js.map +7 -0
  115. package/dist/cli-bundle/chunks/config-V3FZOKLI.js +1577 -0
  116. package/dist/cli-bundle/chunks/config-V3FZOKLI.js.map +7 -0
  117. package/dist/cli-bundle/chunks/context-RZ5QPNJB.js +1458 -0
  118. package/dist/cli-bundle/chunks/context-RZ5QPNJB.js.map +7 -0
  119. package/dist/cli-bundle/chunks/contracts-YLMH33VU.js +1245 -0
  120. package/dist/cli-bundle/chunks/contracts-YLMH33VU.js.map +7 -0
  121. package/dist/cli-bundle/chunks/create-PZVHRIZQ.js +28 -0
  122. package/dist/cli-bundle/chunks/create-PZVHRIZQ.js.map +7 -0
  123. package/dist/cli-bundle/chunks/delete-RHCTEORS.js +59 -0
  124. package/dist/cli-bundle/chunks/delete-RHCTEORS.js.map +7 -0
  125. package/dist/cli-bundle/chunks/deps-MZYCMLAO.js +229 -0
  126. package/dist/cli-bundle/chunks/deps-MZYCMLAO.js.map +7 -0
  127. package/dist/cli-bundle/chunks/docs-FXXUCZYU.js +35 -0
  128. package/dist/cli-bundle/chunks/docs-FXXUCZYU.js.map +7 -0
  129. package/dist/cli-bundle/chunks/extension-B4WL7BQU.js +25 -0
  130. package/dist/cli-bundle/chunks/extension-B4WL7BQU.js.map +7 -0
  131. package/dist/cli-bundle/chunks/files-WVOX67PE.js +286 -0
  132. package/dist/cli-bundle/chunks/files-WVOX67PE.js.map +7 -0
  133. package/dist/cli-bundle/chunks/gc-JWNF66EC.js +181 -0
  134. package/dist/cli-bundle/chunks/gc-JWNF66EC.js.map +7 -0
  135. package/dist/cli-bundle/chunks/get-LTK3HOCQ.js +198 -0
  136. package/dist/cli-bundle/chunks/get-LTK3HOCQ.js.map +7 -0
  137. package/dist/cli-bundle/chunks/health-TCWL55KM.js +1233 -0
  138. package/dist/cli-bundle/chunks/health-TCWL55KM.js.map +7 -0
  139. package/dist/cli-bundle/chunks/history-A2JUDXUE.js +21 -0
  140. package/dist/cli-bundle/chunks/history-A2JUDXUE.js.map +7 -0
  141. package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js +20 -0
  142. package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js.map +7 -0
  143. package/dist/cli-bundle/chunks/history-repair-ZWSTDRH2.js +198 -0
  144. package/dist/cli-bundle/chunks/history-repair-ZWSTDRH2.js.map +7 -0
  145. package/dist/cli-bundle/chunks/init-M2WUB4YH.js +16 -0
  146. package/dist/cli-bundle/chunks/init-M2WUB4YH.js.map +7 -0
  147. package/dist/cli-bundle/chunks/learnings-NXTWE3FR.js +48 -0
  148. package/dist/cli-bundle/chunks/learnings-NXTWE3FR.js.map +7 -0
  149. package/dist/cli-bundle/chunks/list-OGWQPC26.js +20 -0
  150. package/dist/cli-bundle/chunks/list-OGWQPC26.js.map +7 -0
  151. package/dist/cli-bundle/chunks/notes-DFS5ZGOO.js +48 -0
  152. package/dist/cli-bundle/chunks/notes-DFS5ZGOO.js.map +7 -0
  153. package/dist/cli-bundle/chunks/plan-67AB2PLM.js +1175 -0
  154. package/dist/cli-bundle/chunks/plan-67AB2PLM.js.map +7 -0
  155. package/dist/cli-bundle/chunks/{register-list-query-EIVQ5FMR.js → register-list-query-UP3VRUFS.js} +24 -15
  156. package/dist/cli-bundle/chunks/register-list-query-UP3VRUFS.js.map +7 -0
  157. package/dist/cli-bundle/chunks/{register-mutation-RSZNPSGI.js → register-mutation-YWSBF545.js} +38 -28
  158. package/dist/cli-bundle/chunks/register-mutation-YWSBF545.js.map +7 -0
  159. package/dist/cli-bundle/chunks/{register-operations-APUSYDMR.js → register-operations-3BDTGSDH.js} +49 -30
  160. package/dist/cli-bundle/chunks/register-operations-3BDTGSDH.js.map +7 -0
  161. package/dist/cli-bundle/chunks/{register-setup-OZOKSMPJ.js → register-setup-V56GDRUS.js} +21 -12
  162. package/dist/cli-bundle/chunks/register-setup-V56GDRUS.js.map +7 -0
  163. package/dist/cli-bundle/chunks/restore-MB2ISME7.js +18 -0
  164. package/dist/cli-bundle/chunks/restore-MB2ISME7.js.map +7 -0
  165. package/dist/cli-bundle/chunks/schema-Q622KC46.js +119 -0
  166. package/dist/cli-bundle/chunks/schema-Q622KC46.js.map +7 -0
  167. package/dist/cli-bundle/chunks/search-HENBL456.js +1135 -0
  168. package/dist/cli-bundle/chunks/search-HENBL456.js.map +7 -0
  169. package/dist/cli-bundle/chunks/stats-N6H3YP2F.js +124 -0
  170. package/dist/cli-bundle/chunks/stats-N6H3YP2F.js.map +7 -0
  171. package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js +32 -0
  172. package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js.map +7 -0
  173. package/dist/cli-bundle/chunks/test-all-G2AZOHXI.js +332 -0
  174. package/dist/cli-bundle/chunks/test-all-G2AZOHXI.js.map +7 -0
  175. package/dist/cli-bundle/chunks/test-runs-GX5HTPSF.js +939 -0
  176. package/dist/cli-bundle/chunks/test-runs-GX5HTPSF.js.map +7 -0
  177. package/dist/cli-bundle/chunks/update-H6SCWNMA.js +22 -0
  178. package/dist/cli-bundle/chunks/update-H6SCWNMA.js.map +7 -0
  179. package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js +676 -0
  180. package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js.map +7 -0
  181. package/dist/cli-bundle/chunks/upgrade-H5HHM5UV.js +271 -0
  182. package/dist/cli-bundle/chunks/upgrade-H5HHM5UV.js.map +7 -0
  183. package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js +1110 -0
  184. package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js.map +7 -0
  185. package/dist/cli-bundle/main.js +146 -90
  186. package/dist/cli-bundle/main.js.map +4 -4
  187. package/dist/core/item/item-type-definition.js +6 -2
  188. package/dist/core/item/item-type-definition.js.map +1 -1
  189. package/dist/core/item/type-registry.d.ts +4 -0
  190. package/dist/core/item/type-registry.js +10 -2
  191. package/dist/core/item/type-registry.js.map +1 -1
  192. package/dist/core/search/background-refresh.d.ts +53 -0
  193. package/dist/core/search/background-refresh.js +286 -0
  194. package/dist/core/search/background-refresh.js.map +1 -0
  195. package/dist/core/search/cache.d.ts +20 -1
  196. package/dist/core/search/cache.js +33 -4
  197. package/dist/core/search/cache.js.map +1 -1
  198. package/dist/core/search/vector-stores.js +7 -3
  199. package/dist/core/search/vector-stores.js.map +1 -1
  200. package/dist/core/shared/constants.d.ts +2 -2
  201. package/dist/core/shared/constants.js +2 -3
  202. package/dist/core/shared/constants.js.map +1 -1
  203. package/dist/core/store/item-format-migration.js +25 -15
  204. package/dist/core/store/item-format-migration.js.map +1 -1
  205. package/dist/core/store/settings-validator.js +6 -2
  206. package/dist/core/store/settings-validator.js.map +1 -1
  207. package/dist/core/telemetry/runtime.d.ts +10 -0
  208. package/dist/core/telemetry/runtime.js +86 -2
  209. package/dist/core/telemetry/runtime.js.map +1 -1
  210. package/dist/sdk/cli-contracts/tool-parameter-tables.js +4 -4
  211. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  212. package/dist/sdk/cli-contracts.js +26 -5
  213. package/dist/sdk/cli-contracts.js.map +1 -1
  214. package/dist/types.d.ts +7 -1
  215. package/dist/types.js +2 -2
  216. package/dist/types.js.map +1 -1
  217. package/docs/RELEASING.md +1 -1
  218. package/package.json +1 -2
  219. package/dist/cli-bundle/chunks/chunk-PB2YU2E3.js.map +0 -7
  220. package/dist/cli-bundle/chunks/chunk-RJONRNXN.js.map +0 -7
  221. package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js +0 -13864
  222. package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js.map +0 -7
  223. package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js +0 -24225
  224. package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js.map +0 -7
  225. package/dist/cli-bundle/chunks/register-list-query-EIVQ5FMR.js.map +0 -7
  226. package/dist/cli-bundle/chunks/register-mutation-RSZNPSGI.js.map +0 -7
  227. package/dist/cli-bundle/chunks/register-operations-APUSYDMR.js.map +0 -7
  228. package/dist/cli-bundle/chunks/register-setup-OZOKSMPJ.js.map +0 -7
@@ -0,0 +1,1577 @@
1
+ import {
2
+ normalizeParentReferencePolicy,
3
+ normalizeSprintReleaseFormatPolicy
4
+ } from "./chunk-AKOOMO3T.js";
5
+ import {
6
+ migrateItemFilesToFormat
7
+ } from "./chunk-KBQY3YG5.js";
8
+ import "./chunk-MD7K4JYF.js";
9
+ import {
10
+ resolveItemTypeRegistry
11
+ } from "./chunk-WDPXDQFG.js";
12
+ import "./chunk-PVNQLCIS.js";
13
+ import {
14
+ CONTEXT_DEPTH_VALUES,
15
+ EXIT_CODE,
16
+ PmCliError,
17
+ getActiveExtensionRegistrations,
18
+ getSettingsPath,
19
+ pathExists,
20
+ readSettingsWithMetadata,
21
+ resolveGlobalPmRoot,
22
+ resolvePmRoot,
23
+ writeSettings
24
+ } from "./chunk-LSXGH6NE.js";
25
+
26
+ // dist/core/config/positional-value.js
27
+ !(function() {
28
+ try {
29
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
30
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "2395fa10-67f6-5cde-969a-336588fccb3e");
31
+ } catch (e2) {
32
+ }
33
+ })();
34
+ var FORMAT_KEYS = /* @__PURE__ */ new Set(["item_format"]);
35
+ var CRITERIA_KEYS = /* @__PURE__ */ new Set([
36
+ "definition_of_done",
37
+ "metadata_required_fields",
38
+ "lifecycle_stale_blocker_reason_patterns",
39
+ "lifecycle_closure_like_blocked_reason_patterns",
40
+ "lifecycle_closure_like_resolution_patterns",
41
+ "lifecycle_closure_like_actual_result_patterns"
42
+ ]);
43
+ var POLICY_KEYS = /* @__PURE__ */ new Set([
44
+ "history_missing_stream_policy",
45
+ "sprint_release_format_policy",
46
+ "parent_reference_policy",
47
+ "metadata_validation_profile",
48
+ "governance_preset",
49
+ "governance_ownership_enforcement",
50
+ "governance_create_mode_default",
51
+ "governance_close_validation_default",
52
+ "governance_parent_reference_policy",
53
+ "governance_metadata_validation_profile",
54
+ "governance_force_required_for_stale_lock",
55
+ "test_result_tracking",
56
+ "telemetry_tracking"
57
+ ]);
58
+ var ENABLED_DISABLED_POLICY_KEYS = /* @__PURE__ */ new Set([
59
+ "governance_force_required_for_stale_lock",
60
+ "test_result_tracking",
61
+ "telemetry_tracking"
62
+ ]);
63
+ var ENABLED_DISABLED_SYNONYMS = {
64
+ off: "disabled",
65
+ on: "enabled",
66
+ true: "enabled",
67
+ false: "disabled",
68
+ enabled: "enabled",
69
+ disabled: "disabled"
70
+ };
71
+ function toCanonicalKey(keyOrAlias) {
72
+ const normalized = keyOrAlias.trim().toLowerCase().replaceAll("-", "_");
73
+ if (FORMAT_KEYS.has(normalized) || CRITERIA_KEYS.has(normalized) || POLICY_KEYS.has(normalized) || normalized === "context") {
74
+ return normalized;
75
+ }
76
+ return void 0;
77
+ }
78
+ function normalizeEnabledDisabled(value) {
79
+ const normalized = value.trim().toLowerCase();
80
+ return ENABLED_DISABLED_SYNONYMS[normalized] ?? value;
81
+ }
82
+ function resolveConfigPositionalValue(canonicalKeyOrAlias, value) {
83
+ const key = toCanonicalKey(canonicalKeyOrAlias);
84
+ if (key === void 0) {
85
+ return {
86
+ routable: false,
87
+ reason: `Unknown config key "${canonicalKeyOrAlias}" cannot route a positional value.`
88
+ };
89
+ }
90
+ if (key === "context") {
91
+ return {
92
+ routable: false,
93
+ reason: "Config set context does not accept a positional value. Use --default-depth, --activity-limit, --stale-threshold-days, or --section-<name> flags."
94
+ };
95
+ }
96
+ if (FORMAT_KEYS.has(key)) {
97
+ return { routable: true, flag: "format", value };
98
+ }
99
+ if (CRITERIA_KEYS.has(key)) {
100
+ return { routable: true, flag: "criterion", values: [value] };
101
+ }
102
+ const policyValue = ENABLED_DISABLED_POLICY_KEYS.has(key) ? normalizeEnabledDisabled(value) : value;
103
+ return { routable: true, flag: "policy", value: policyValue };
104
+ }
105
+
106
+ // dist/core/config/nested-settings.js
107
+ !(function() {
108
+ try {
109
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
110
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "a5fc9ece-8275-58dd-88d2-a4e0ae48f952");
111
+ } catch (e2) {
112
+ }
113
+ })();
114
+ var NESTED_SETTING_DESCRIPTORS = [
115
+ {
116
+ key: "search_provider",
117
+ path: "search.provider",
118
+ kind: "string",
119
+ summary: "Search embedding provider name (e.g. openai, ollama, or an extension provider)."
120
+ },
121
+ {
122
+ key: "search_mutation_refresh_policy",
123
+ path: "search.mutation_refresh_policy",
124
+ kind: "string",
125
+ choices: ["cache_only", "semantic_configured", "semantic_auto"],
126
+ summary: "Mutation-time search refresh policy: cache_only, semantic_configured, or semantic_auto."
127
+ },
128
+ {
129
+ key: "search_embedding_model",
130
+ path: "search.embedding_model",
131
+ kind: "string",
132
+ summary: "Default embedding model name (overrides provider-specific model when set)."
133
+ },
134
+ {
135
+ key: "search_embedding_batch_size",
136
+ path: "search.embedding_batch_size",
137
+ kind: "integer",
138
+ min: 1,
139
+ summary: "Number of items embedded per request batch."
140
+ },
141
+ {
142
+ key: "search_embedding_timeout_ms",
143
+ path: "search.embedding_timeout_ms",
144
+ kind: "integer",
145
+ min: 1,
146
+ summary: "Per-request embedding timeout in milliseconds."
147
+ },
148
+ {
149
+ key: "search_score_threshold",
150
+ path: "search.score_threshold",
151
+ kind: "number",
152
+ summary: "Minimum score for a hit to be returned (0 keeps all matches)."
153
+ },
154
+ {
155
+ key: "search_hybrid_semantic_weight",
156
+ path: "search.hybrid_semantic_weight",
157
+ kind: "ratio",
158
+ summary: "Hybrid mode semantic weight in [0, 1] (1-weight goes to keyword)."
159
+ },
160
+ {
161
+ key: "search_max_results",
162
+ path: "search.max_results",
163
+ kind: "integer",
164
+ min: 1,
165
+ summary: "Default upper bound on search hits when --limit is not supplied."
166
+ },
167
+ {
168
+ key: "openai_base_url",
169
+ path: "providers.openai.base_url",
170
+ kind: "string",
171
+ summary: "OpenAI-compatible API base URL (LM Studio/vLLM also use this)."
172
+ },
173
+ {
174
+ key: "openai_api_key",
175
+ path: "providers.openai.api_key",
176
+ kind: "string",
177
+ summary: "OpenAI-compatible API key."
178
+ },
179
+ {
180
+ key: "openai_model",
181
+ path: "providers.openai.model",
182
+ kind: "string",
183
+ summary: "OpenAI-compatible embedding model name."
184
+ },
185
+ {
186
+ key: "ollama_base_url",
187
+ path: "providers.ollama.base_url",
188
+ kind: "string",
189
+ summary: "Ollama API base URL (typically http://localhost:11434)."
190
+ },
191
+ {
192
+ key: "ollama_model",
193
+ path: "providers.ollama.model",
194
+ kind: "string",
195
+ summary: "Ollama embedding model name (e.g. nomic-embed-text)."
196
+ },
197
+ {
198
+ key: "vector_store_adapter",
199
+ path: "vector_store.adapter",
200
+ kind: "string",
201
+ summary: "Vector store adapter name (lancedb, qdrant, or an extension adapter)."
202
+ },
203
+ {
204
+ key: "qdrant_url",
205
+ path: "vector_store.qdrant.url",
206
+ kind: "string",
207
+ summary: "Qdrant HTTP API URL."
208
+ },
209
+ {
210
+ key: "qdrant_api_key",
211
+ path: "vector_store.qdrant.api_key",
212
+ kind: "string",
213
+ summary: "Qdrant API key (empty if running unauthenticated)."
214
+ },
215
+ {
216
+ key: "lancedb_path",
217
+ path: "vector_store.lancedb.path",
218
+ kind: "string",
219
+ summary: "LanceDB storage path (relative to pm root or absolute)."
220
+ }
221
+ ];
222
+ var DESCRIPTOR_BY_KEY = new Map(NESTED_SETTING_DESCRIPTORS.map((descriptor) => [descriptor.key, descriptor]));
223
+ var NESTED_SETTING_KEYS = NESTED_SETTING_DESCRIPTORS.map((descriptor) => descriptor.key);
224
+ function resolveNestedSettingDescriptor(raw) {
225
+ if (typeof raw !== "string") {
226
+ return void 0;
227
+ }
228
+ const normalized = raw.trim().toLowerCase().replaceAll("-", "_");
229
+ if (normalized.length === 0) {
230
+ return void 0;
231
+ }
232
+ return DESCRIPTOR_BY_KEY.get(normalized);
233
+ }
234
+ function parseNestedSettingValue(descriptor, rawValue) {
235
+ if (typeof rawValue !== "string") {
236
+ return { ok: false, error: { message: `Config set ${descriptor.key} requires a string value` } };
237
+ }
238
+ const trimmed = rawValue.trim();
239
+ if (descriptor.kind === "string") {
240
+ if (descriptor.choices && !descriptor.choices.includes(trimmed)) {
241
+ return {
242
+ ok: false,
243
+ error: {
244
+ message: `Config set ${descriptor.key} must be one of ${descriptor.choices.join("|")}, got "${rawValue}"`
245
+ }
246
+ };
247
+ }
248
+ return { ok: true, parsed: { descriptor, value: trimmed } };
249
+ }
250
+ if (trimmed.length === 0) {
251
+ return {
252
+ ok: false,
253
+ error: { message: `Config set ${descriptor.key} requires a non-empty value` }
254
+ };
255
+ }
256
+ const parsed = Number(trimmed);
257
+ if (!Number.isFinite(parsed)) {
258
+ return {
259
+ ok: false,
260
+ error: { message: `Config set ${descriptor.key} requires a finite number, got "${rawValue}"` }
261
+ };
262
+ }
263
+ if (descriptor.kind === "integer") {
264
+ if (!Number.isInteger(parsed) || parsed < 0) {
265
+ return {
266
+ ok: false,
267
+ error: { message: `Config set ${descriptor.key} requires a non-negative integer, got "${rawValue}"` }
268
+ };
269
+ }
270
+ if (descriptor.min !== void 0 && parsed < descriptor.min) {
271
+ return {
272
+ ok: false,
273
+ error: {
274
+ message: `Config set ${descriptor.key} requires an integer >= ${descriptor.min}, got "${rawValue}" (the runtime silently ignores 0 here and falls back to the default)`
275
+ }
276
+ };
277
+ }
278
+ return { ok: true, parsed: { descriptor, value: parsed } };
279
+ }
280
+ if (descriptor.kind === "ratio") {
281
+ if (parsed < 0 || parsed > 1) {
282
+ return {
283
+ ok: false,
284
+ error: { message: `Config set ${descriptor.key} requires a number in [0, 1], got "${rawValue}"` }
285
+ };
286
+ }
287
+ return { ok: true, parsed: { descriptor, value: parsed } };
288
+ }
289
+ if (descriptor.min !== void 0 && parsed < descriptor.min) {
290
+ return {
291
+ ok: false,
292
+ error: { message: `Config set ${descriptor.key} requires a number >= ${descriptor.min}, got "${rawValue}"` }
293
+ };
294
+ }
295
+ return { ok: true, parsed: { descriptor, value: parsed } };
296
+ }
297
+ function readNestedSettingValue(settings, descriptor) {
298
+ const segments = descriptor.path.split(".");
299
+ let cursor = settings;
300
+ for (const segment of segments) {
301
+ if (typeof cursor !== "object" || cursor === null) {
302
+ return null;
303
+ }
304
+ cursor = cursor[segment];
305
+ }
306
+ if (typeof cursor === "string" || typeof cursor === "number") {
307
+ return cursor;
308
+ }
309
+ return null;
310
+ }
311
+ function writeNestedSettingValue(settings, descriptor, value) {
312
+ const segments = descriptor.path.split(".");
313
+ let cursor = settings;
314
+ for (let index = 0; index < segments.length - 1; index += 1) {
315
+ const segment = segments[index];
316
+ const existing = cursor[segment];
317
+ if (typeof existing !== "object" || existing === null || Array.isArray(existing)) {
318
+ const next = {};
319
+ cursor[segment] = next;
320
+ cursor = next;
321
+ } else {
322
+ cursor = existing;
323
+ }
324
+ }
325
+ const leafKey = segments[segments.length - 1];
326
+ const previous = cursor[leafKey];
327
+ if (previous === value) {
328
+ return false;
329
+ }
330
+ cursor[leafKey] = value;
331
+ return true;
332
+ }
333
+
334
+ // dist/cli/commands/config.js
335
+ !(function() {
336
+ try {
337
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
338
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "d29673f1-c80f-54ca-a854-6e9abd634001");
339
+ } catch (e2) {
340
+ }
341
+ })();
342
+ var CONFIG_SCOPE_VALUES = ["project", "global"];
343
+ var CONFIG_KEY_VALUES = [
344
+ "definition-of-done",
345
+ "definition_of_done",
346
+ "item-format",
347
+ "item_format",
348
+ "history-missing-stream-policy",
349
+ "history_missing_stream_policy",
350
+ "sprint-release-format-policy",
351
+ "sprint_release_format_policy",
352
+ "parent-reference-policy",
353
+ "parent_reference_policy",
354
+ "metadata-validation-profile",
355
+ "metadata_validation_profile",
356
+ "metadata-required-fields",
357
+ "metadata_required_fields",
358
+ "lifecycle-stale-blocker-reason-patterns",
359
+ "lifecycle_stale_blocker_reason_patterns",
360
+ "lifecycle-closure-like-blocked-reason-patterns",
361
+ "lifecycle_closure_like_blocked_reason_patterns",
362
+ "lifecycle-closure-like-resolution-patterns",
363
+ "lifecycle_closure_like_resolution_patterns",
364
+ "lifecycle-closure-like-actual-result-patterns",
365
+ "lifecycle_closure_like_actual_result_patterns",
366
+ "governance-preset",
367
+ "governance_preset",
368
+ "governance-ownership-enforcement",
369
+ "governance_ownership_enforcement",
370
+ "governance-create-mode-default",
371
+ "governance_create_mode_default",
372
+ "governance-close-validation-default",
373
+ "governance_close_validation_default",
374
+ "governance-parent-reference-policy",
375
+ "governance_parent_reference_policy",
376
+ "governance-metadata-validation-profile",
377
+ "governance_metadata_validation_profile",
378
+ "governance-force-required-for-stale-lock",
379
+ "governance_force_required_for_stale_lock",
380
+ "test-result-tracking",
381
+ "test_result_tracking",
382
+ "telemetry-tracking",
383
+ "telemetry_tracking",
384
+ "context"
385
+ ];
386
+ var CONFIG_KEY_ALIASES = {
387
+ definition_of_done: ["definition-of-done", "definition_of_done"],
388
+ item_format: ["item-format", "item_format"],
389
+ history_missing_stream_policy: ["history-missing-stream-policy", "history_missing_stream_policy"],
390
+ sprint_release_format_policy: ["sprint-release-format-policy", "sprint_release_format_policy"],
391
+ parent_reference_policy: ["parent-reference-policy", "parent_reference_policy"],
392
+ metadata_validation_profile: ["metadata-validation-profile", "metadata_validation_profile"],
393
+ metadata_required_fields: ["metadata-required-fields", "metadata_required_fields"],
394
+ lifecycle_stale_blocker_reason_patterns: [
395
+ "lifecycle-stale-blocker-reason-patterns",
396
+ "lifecycle_stale_blocker_reason_patterns"
397
+ ],
398
+ lifecycle_closure_like_blocked_reason_patterns: [
399
+ "lifecycle-closure-like-blocked-reason-patterns",
400
+ "lifecycle_closure_like_blocked_reason_patterns"
401
+ ],
402
+ lifecycle_closure_like_resolution_patterns: [
403
+ "lifecycle-closure-like-resolution-patterns",
404
+ "lifecycle_closure_like_resolution_patterns"
405
+ ],
406
+ lifecycle_closure_like_actual_result_patterns: [
407
+ "lifecycle-closure-like-actual-result-patterns",
408
+ "lifecycle_closure_like_actual_result_patterns"
409
+ ],
410
+ governance_preset: ["governance-preset", "governance_preset"],
411
+ governance_ownership_enforcement: ["governance-ownership-enforcement", "governance_ownership_enforcement"],
412
+ governance_create_mode_default: ["governance-create-mode-default", "governance_create_mode_default"],
413
+ governance_close_validation_default: [
414
+ "governance-close-validation-default",
415
+ "governance_close_validation_default"
416
+ ],
417
+ governance_parent_reference_policy: ["governance-parent-reference-policy", "governance_parent_reference_policy"],
418
+ governance_metadata_validation_profile: [
419
+ "governance-metadata-validation-profile",
420
+ "governance_metadata_validation_profile"
421
+ ],
422
+ governance_force_required_for_stale_lock: [
423
+ "governance-force-required-for-stale-lock",
424
+ "governance_force_required_for_stale_lock"
425
+ ],
426
+ test_result_tracking: ["test-result-tracking", "test_result_tracking"],
427
+ telemetry_tracking: ["telemetry-tracking", "telemetry_tracking"],
428
+ context: ["context"]
429
+ };
430
+ var CANONICAL_CONFIG_KEYS = Object.keys(CONFIG_KEY_ALIASES).map((candidate) => CONFIG_KEY_ALIASES[candidate][0]);
431
+ var CONFIG_KEY_SUMMARIES = {
432
+ definition_of_done: "Definition of Done criteria list.",
433
+ item_format: "Default item file format.",
434
+ history_missing_stream_policy: "Missing history stream handling policy.",
435
+ sprint_release_format_policy: "Sprint/release format validation policy.",
436
+ parent_reference_policy: "Parent reference validation policy.",
437
+ metadata_validation_profile: "Validate metadata profile policy (core|strict|custom).",
438
+ metadata_required_fields: "Validate custom metadata required-fields list.",
439
+ lifecycle_stale_blocker_reason_patterns: "Validate lifecycle stale-blocker reason substring patterns (criteria list).",
440
+ lifecycle_closure_like_blocked_reason_patterns: "Validate lifecycle closure-like blocked_reason substring patterns (criteria list).",
441
+ lifecycle_closure_like_resolution_patterns: "Validate lifecycle closure-like resolution substring patterns (criteria list).",
442
+ lifecycle_closure_like_actual_result_patterns: "Validate lifecycle closure-like actual_result substring patterns (criteria list).",
443
+ governance_preset: "Governance preset policy (minimal|default|strict|custom).",
444
+ governance_ownership_enforcement: "Governance ownership enforcement policy (none|warn|strict).",
445
+ governance_create_mode_default: "Governance default create mode (progressive|strict).",
446
+ governance_close_validation_default: "Governance default close validation mode (off|warn|strict).",
447
+ governance_parent_reference_policy: "Governance parent reference policy (warn|strict_error).",
448
+ governance_metadata_validation_profile: "Governance metadata validation profile (core|strict|custom).",
449
+ governance_force_required_for_stale_lock: "Governance stale-lock force policy (enabled|disabled).",
450
+ test_result_tracking: "Item-level linked test result persistence policy.",
451
+ telemetry_tracking: "Telemetry usage reporting policy.",
452
+ context: "Context command settings (depth, section toggles, limits)."
453
+ };
454
+ var LIFECYCLE_PATTERN_CONFIG_KEYS = [
455
+ "lifecycle_stale_blocker_reason_patterns",
456
+ "lifecycle_closure_like_blocked_reason_patterns",
457
+ "lifecycle_closure_like_resolution_patterns",
458
+ "lifecycle_closure_like_actual_result_patterns"
459
+ ];
460
+ function isCriteriaConfigKey(key) {
461
+ return key === "definition_of_done" || key === "metadata_required_fields" || LIFECYCLE_PATTERN_CONFIG_KEYS.includes(key);
462
+ }
463
+ function normalizeScope(value) {
464
+ if (CONFIG_SCOPE_VALUES.includes(value)) {
465
+ return value;
466
+ }
467
+ throw new PmCliError(`Invalid config scope "${value}". Allowed: ${CONFIG_SCOPE_VALUES.join(", ")}`, EXIT_CODE.USAGE);
468
+ }
469
+ function normalizeAction(value) {
470
+ if (value === "get" || value === "set" || value === "list" || value === "export") {
471
+ return value;
472
+ }
473
+ throw new PmCliError(`Invalid config action "${value}". Allowed: get, set, list, export`, EXIT_CODE.USAGE);
474
+ }
475
+ function normalizeKey(value) {
476
+ if (CONFIG_KEY_VALUES.includes(value)) {
477
+ if (value === "item-format" || value === "item_format") {
478
+ return "item_format";
479
+ }
480
+ if (value === "history-missing-stream-policy" || value === "history_missing_stream_policy") {
481
+ return "history_missing_stream_policy";
482
+ }
483
+ if (value === "sprint-release-format-policy" || value === "sprint_release_format_policy") {
484
+ return "sprint_release_format_policy";
485
+ }
486
+ if (value === "parent-reference-policy" || value === "parent_reference_policy") {
487
+ return "parent_reference_policy";
488
+ }
489
+ if (value === "metadata-validation-profile" || value === "metadata_validation_profile") {
490
+ return "metadata_validation_profile";
491
+ }
492
+ if (value === "metadata-required-fields" || value === "metadata_required_fields") {
493
+ return "metadata_required_fields";
494
+ }
495
+ if (value === "lifecycle-stale-blocker-reason-patterns" || value === "lifecycle_stale_blocker_reason_patterns") {
496
+ return "lifecycle_stale_blocker_reason_patterns";
497
+ }
498
+ if (value === "lifecycle-closure-like-blocked-reason-patterns" || value === "lifecycle_closure_like_blocked_reason_patterns") {
499
+ return "lifecycle_closure_like_blocked_reason_patterns";
500
+ }
501
+ if (value === "lifecycle-closure-like-resolution-patterns" || value === "lifecycle_closure_like_resolution_patterns") {
502
+ return "lifecycle_closure_like_resolution_patterns";
503
+ }
504
+ if (value === "lifecycle-closure-like-actual-result-patterns" || value === "lifecycle_closure_like_actual_result_patterns") {
505
+ return "lifecycle_closure_like_actual_result_patterns";
506
+ }
507
+ if (value === "governance-preset" || value === "governance_preset") {
508
+ return "governance_preset";
509
+ }
510
+ if (value === "governance-ownership-enforcement" || value === "governance_ownership_enforcement") {
511
+ return "governance_ownership_enforcement";
512
+ }
513
+ if (value === "governance-create-mode-default" || value === "governance_create_mode_default") {
514
+ return "governance_create_mode_default";
515
+ }
516
+ if (value === "governance-close-validation-default" || value === "governance_close_validation_default") {
517
+ return "governance_close_validation_default";
518
+ }
519
+ if (value === "governance-parent-reference-policy" || value === "governance_parent_reference_policy") {
520
+ return "governance_parent_reference_policy";
521
+ }
522
+ if (value === "governance-metadata-validation-profile" || value === "governance_metadata_validation_profile") {
523
+ return "governance_metadata_validation_profile";
524
+ }
525
+ if (value === "governance-force-required-for-stale-lock" || value === "governance_force_required_for_stale_lock") {
526
+ return "governance_force_required_for_stale_lock";
527
+ }
528
+ if (value === "test-result-tracking" || value === "test_result_tracking") {
529
+ return "test_result_tracking";
530
+ }
531
+ if (value === "telemetry-tracking" || value === "telemetry_tracking") {
532
+ return "telemetry_tracking";
533
+ }
534
+ if (value === "context") {
535
+ return "context";
536
+ }
537
+ return "definition_of_done";
538
+ }
539
+ const nestedKeys = NESTED_SETTING_DESCRIPTORS.map((descriptor) => descriptor.key).join(", ");
540
+ throw new PmCliError(`Invalid config key "${value}". Supported: ${CANONICAL_CONFIG_KEYS.join(", ")} (underscore variants also accepted). Nested leaf settings: ${nestedKeys}.`, EXIT_CODE.USAGE);
541
+ }
542
+ function normalizeCriteria(values, clearCriteria) {
543
+ const normalized = [...new Set((values ?? []).map((value) => value.trim()).filter((value) => value.length > 0))].sort((left, right) => left.localeCompare(right));
544
+ if (clearCriteria) {
545
+ if (normalized.length > 0) {
546
+ throw new PmCliError("Config set definition-of-done cannot combine --clear-criteria with --criterion values", EXIT_CODE.USAGE);
547
+ }
548
+ return [];
549
+ }
550
+ if (normalized.length === 0) {
551
+ throw new PmCliError("Config set definition-of-done requires at least one non-empty --criterion value (or --clear-criteria to clear)", EXIT_CODE.USAGE);
552
+ }
553
+ return normalized;
554
+ }
555
+ function normalizeItemFormat(value) {
556
+ const normalized = value?.trim().toLowerCase();
557
+ if (normalized === "toon") {
558
+ return "toon";
559
+ }
560
+ if (normalized === "json_markdown") {
561
+ throw new PmCliError("Config set item-format no longer accepts json_markdown. Markdown item files are legacy read/migration input only.", EXIT_CODE.USAGE);
562
+ }
563
+ throw new PmCliError("Config set item-format requires --format toon", EXIT_CODE.USAGE);
564
+ }
565
+ function normalizeHistoryMissingStreamPolicy(value) {
566
+ const normalized = value?.trim().toLowerCase().replaceAll("-", "_");
567
+ if (normalized === "auto_create" || normalized === "strict_error") {
568
+ return normalized;
569
+ }
570
+ throw new PmCliError("Config set history-missing-stream-policy requires --policy with one of: auto_create, strict_error", EXIT_CODE.USAGE);
571
+ }
572
+ function normalizeTestResultTrackingPolicy(value) {
573
+ const normalized = value?.trim().toLowerCase().replaceAll("-", "_");
574
+ if (normalized === "enabled" || normalized === "disabled") {
575
+ return normalized;
576
+ }
577
+ throw new PmCliError("Config set test-result-tracking requires --policy with one of: enabled, disabled", EXIT_CODE.USAGE);
578
+ }
579
+ function normalizeTelemetryTrackingPolicy(value) {
580
+ const normalized = value?.trim().toLowerCase().replaceAll("-", "_");
581
+ if (normalized === "enabled" || normalized === "disabled") {
582
+ return normalized;
583
+ }
584
+ throw new PmCliError("Config set telemetry-tracking requires --policy with one of: enabled, disabled", EXIT_CODE.USAGE);
585
+ }
586
+ function normalizeValidateMetadataProfile(value) {
587
+ const normalized = value?.trim().toLowerCase().replaceAll("-", "_");
588
+ if (normalized === "core" || normalized === "strict" || normalized === "custom") {
589
+ return normalized;
590
+ }
591
+ throw new PmCliError("Config set metadata-validation-profile requires --policy with one of: core, strict, custom", EXIT_CODE.USAGE);
592
+ }
593
+ function normalizeGovernancePreset(value) {
594
+ const normalized = value?.trim().toLowerCase().replaceAll("-", "_");
595
+ if (normalized === "minimal" || normalized === "default" || normalized === "strict" || normalized === "custom") {
596
+ return normalized;
597
+ }
598
+ throw new PmCliError("Config set governance-preset requires --policy with one of: minimal, default, strict, custom", EXIT_CODE.USAGE);
599
+ }
600
+ function normalizeGovernanceOwnershipEnforcement(value) {
601
+ const normalized = value?.trim().toLowerCase().replaceAll("-", "_");
602
+ if (normalized === "none" || normalized === "warn" || normalized === "strict") {
603
+ return normalized;
604
+ }
605
+ throw new PmCliError("Config set governance-ownership-enforcement requires --policy with one of: none, warn, strict", EXIT_CODE.USAGE);
606
+ }
607
+ function normalizeGovernanceCreateModeDefault(value) {
608
+ const normalized = value?.trim().toLowerCase().replaceAll("-", "_");
609
+ if (normalized === "progressive" || normalized === "strict") {
610
+ return normalized;
611
+ }
612
+ throw new PmCliError("Config set governance-create-mode-default requires --policy with one of: progressive, strict", EXIT_CODE.USAGE);
613
+ }
614
+ function normalizeGovernanceCloseValidationDefault(value) {
615
+ const normalized = value?.trim().toLowerCase().replaceAll("-", "_");
616
+ if (normalized === "off" || normalized === "warn" || normalized === "strict") {
617
+ return normalized;
618
+ }
619
+ if (normalized === "none" || normalized === "disabled") {
620
+ return "off";
621
+ }
622
+ throw new PmCliError("Config set governance-close-validation-default requires --policy with one of: off, warn, strict", EXIT_CODE.USAGE);
623
+ }
624
+ function normalizeGovernanceForceRequiredForStaleLockPolicy(value) {
625
+ const normalized = value?.trim().toLowerCase().replaceAll("-", "_");
626
+ if (normalized === "enabled" || normalized === "disabled") {
627
+ return normalized;
628
+ }
629
+ throw new PmCliError("Config set governance-force-required-for-stale-lock requires --policy with one of: enabled, disabled", EXIT_CODE.USAGE);
630
+ }
631
+ function normalizePolicyForConflict(key, value) {
632
+ switch (key) {
633
+ case "history_missing_stream_policy":
634
+ return normalizeHistoryMissingStreamPolicy(value);
635
+ case "sprint_release_format_policy":
636
+ return normalizeSprintReleaseFormatPolicy(value);
637
+ case "parent_reference_policy":
638
+ case "governance_parent_reference_policy":
639
+ return normalizeParentReferencePolicy(value);
640
+ case "metadata_validation_profile":
641
+ case "governance_metadata_validation_profile":
642
+ return normalizeValidateMetadataProfile(value);
643
+ case "governance_preset":
644
+ return normalizeGovernancePreset(value);
645
+ case "governance_ownership_enforcement":
646
+ return normalizeGovernanceOwnershipEnforcement(value);
647
+ case "governance_create_mode_default":
648
+ return normalizeGovernanceCreateModeDefault(value);
649
+ case "governance_close_validation_default":
650
+ return normalizeGovernanceCloseValidationDefault(value);
651
+ case "governance_force_required_for_stale_lock":
652
+ return normalizeGovernanceForceRequiredForStaleLockPolicy(value);
653
+ case "test_result_tracking":
654
+ return normalizeTestResultTrackingPolicy(value);
655
+ case "telemetry_tracking":
656
+ return normalizeTelemetryTrackingPolicy(value);
657
+ default:
658
+ return value.trim().toLowerCase().replaceAll("-", "_");
659
+ }
660
+ }
661
+ var METADATA_REQUIRED_FIELD_ALIAS_MAP = {
662
+ author: "author",
663
+ acceptance_criteria: "acceptance_criteria",
664
+ "acceptance-criteria": "acceptance_criteria",
665
+ estimated_minutes: "estimated_minutes",
666
+ "estimated-minutes": "estimated_minutes",
667
+ estimate: "estimated_minutes",
668
+ close_reason: "close_reason",
669
+ "close-reason": "close_reason",
670
+ reviewer: "reviewer",
671
+ risk: "risk",
672
+ confidence: "confidence",
673
+ sprint: "sprint",
674
+ release: "release"
675
+ };
676
+ var METADATA_REQUIRED_FIELD_OPTIONS = [
677
+ "author",
678
+ "acceptance_criteria",
679
+ "estimated_minutes",
680
+ "close_reason",
681
+ "reviewer",
682
+ "risk",
683
+ "confidence",
684
+ "sprint",
685
+ "release"
686
+ ];
687
+ function normalizeMetadataRequiredFields(values, clearCriteria) {
688
+ const normalized = [...new Set((values ?? []).map((value) => value.trim()).filter((value) => value.length > 0))];
689
+ if (clearCriteria) {
690
+ if (normalized.length > 0) {
691
+ throw new PmCliError("Config set metadata-required-fields cannot combine --clear-criteria with --criterion values", EXIT_CODE.USAGE);
692
+ }
693
+ return [];
694
+ }
695
+ if (normalized.length === 0) {
696
+ throw new PmCliError("Config set metadata-required-fields requires at least one --criterion value (or --clear-criteria to clear)", EXIT_CODE.USAGE);
697
+ }
698
+ const lowered = normalized.map((value) => value.toLowerCase().replaceAll("-", "_"));
699
+ const unsupported = lowered.filter((value) => METADATA_REQUIRED_FIELD_ALIAS_MAP[value] === void 0);
700
+ if (unsupported.length > 0) {
701
+ throw new PmCliError(`Config set metadata-required-fields received unsupported values: ${unsupported.join(", ")}. Supported values: ${METADATA_REQUIRED_FIELD_OPTIONS.join(", ")}`, EXIT_CODE.USAGE);
702
+ }
703
+ return [...new Set(lowered.map((value) => METADATA_REQUIRED_FIELD_ALIAS_MAP[value]))].sort((left, right) => left.localeCompare(right));
704
+ }
705
+ function normalizeLifecyclePatternCriteria(key, values, clearCriteria) {
706
+ const normalized = [...new Set((values ?? []).map((value) => value.trim().toLowerCase()).filter((value) => value.length > 0))].sort((left, right) => left.localeCompare(right));
707
+ if (clearCriteria) {
708
+ if (normalized.length > 0) {
709
+ throw new PmCliError(`Config set ${CONFIG_KEY_ALIASES[key][0]} cannot combine --clear-criteria with --criterion values`, EXIT_CODE.USAGE);
710
+ }
711
+ return [];
712
+ }
713
+ if (normalized.length === 0) {
714
+ throw new PmCliError(`Config set ${CONFIG_KEY_ALIASES[key][0]} requires at least one --criterion value (or --clear-criteria to clear)`, EXIT_CODE.USAGE);
715
+ }
716
+ return normalized;
717
+ }
718
+ function normalizeWarnings(values) {
719
+ return [...new Set(values)].sort((left, right) => left.localeCompare(right));
720
+ }
721
+ function normalizeKeyForAction(action, value) {
722
+ if (action === "list" || action === "export") {
723
+ if (typeof value === "string" && value.trim().length > 0) {
724
+ throw new PmCliError(`Config action "${action}" does not accept <key>`, EXIT_CODE.USAGE);
725
+ }
726
+ return void 0;
727
+ }
728
+ if (typeof value !== "string" || value.trim().length === 0) {
729
+ throw new PmCliError(`Config action "${action}" requires <key>`, EXIT_CODE.USAGE);
730
+ }
731
+ return normalizeKey(value);
732
+ }
733
+ function readConfigValue(settings, key) {
734
+ if (key === "item_format") {
735
+ return settings.item_format;
736
+ }
737
+ if (key === "history_missing_stream_policy") {
738
+ return settings.history.missing_stream;
739
+ }
740
+ if (key === "sprint_release_format_policy") {
741
+ return settings.validation.sprint_release_format;
742
+ }
743
+ if (key === "parent_reference_policy") {
744
+ return settings.validation.parent_reference;
745
+ }
746
+ if (key === "metadata_validation_profile") {
747
+ return settings.validation.metadata_profile;
748
+ }
749
+ if (key === "metadata_required_fields") {
750
+ return [...settings.validation.metadata_required_fields];
751
+ }
752
+ if (key === "lifecycle_stale_blocker_reason_patterns") {
753
+ return [...settings.validation.lifecycle_stale_blocker_reason_patterns];
754
+ }
755
+ if (key === "lifecycle_closure_like_blocked_reason_patterns") {
756
+ return [...settings.validation.lifecycle_closure_like_blocked_reason_patterns];
757
+ }
758
+ if (key === "lifecycle_closure_like_resolution_patterns") {
759
+ return [...settings.validation.lifecycle_closure_like_resolution_patterns];
760
+ }
761
+ if (key === "lifecycle_closure_like_actual_result_patterns") {
762
+ return [...settings.validation.lifecycle_closure_like_actual_result_patterns];
763
+ }
764
+ if (key === "governance_preset") {
765
+ return settings.governance.preset;
766
+ }
767
+ if (key === "governance_ownership_enforcement") {
768
+ return settings.governance.ownership_enforcement;
769
+ }
770
+ if (key === "governance_create_mode_default") {
771
+ return settings.governance.create_mode_default;
772
+ }
773
+ if (key === "governance_close_validation_default") {
774
+ return settings.governance.close_validation_default;
775
+ }
776
+ if (key === "governance_parent_reference_policy") {
777
+ return settings.governance.parent_reference;
778
+ }
779
+ if (key === "governance_metadata_validation_profile") {
780
+ return settings.governance.metadata_profile;
781
+ }
782
+ if (key === "governance_force_required_for_stale_lock") {
783
+ return settings.governance.force_required_for_stale_lock ? "enabled" : "disabled";
784
+ }
785
+ if (key === "test_result_tracking") {
786
+ return settings.testing.record_results_to_items ? "enabled" : "disabled";
787
+ }
788
+ if (key === "telemetry_tracking") {
789
+ return settings.telemetry.enabled ? "enabled" : "disabled";
790
+ }
791
+ if (key === "context") {
792
+ return {
793
+ default_depth: settings.context.default_depth,
794
+ activity_limit: settings.context.activity_limit,
795
+ stale_threshold_days: settings.context.stale_threshold_days,
796
+ sections: { ...settings.context.sections }
797
+ };
798
+ }
799
+ return [...settings.workflow.definition_of_done];
800
+ }
801
+ function withWarnings(result, warnings) {
802
+ if (warnings.length === 0) {
803
+ return result;
804
+ }
805
+ return {
806
+ ...result,
807
+ warnings
808
+ };
809
+ }
810
+ async function resolveSettingsTarget(scope, global2) {
811
+ const cwd = process.cwd();
812
+ const pmRoot = scope === "project" ? resolvePmRoot(cwd, global2.path) : resolveGlobalPmRoot(cwd);
813
+ const settingsPath = getSettingsPath(pmRoot);
814
+ if (scope === "project" && !await pathExists(settingsPath)) {
815
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
816
+ }
817
+ return { pmRoot, settingsPath };
818
+ }
819
+ function parseSectionToggle(raw) {
820
+ if (raw === void 0)
821
+ return void 0;
822
+ const normalized = raw.trim().toLowerCase();
823
+ if (normalized === "true" || normalized === "enabled" || normalized === "on" || normalized === "1")
824
+ return true;
825
+ if (normalized === "false" || normalized === "disabled" || normalized === "off" || normalized === "0")
826
+ return false;
827
+ throw new PmCliError(`Context section toggle must be true|false|enabled|disabled, got "${raw}"`, EXIT_CODE.USAGE);
828
+ }
829
+ async function applyContextConfig(settings, options, target, scope, warnings) {
830
+ let changed = false;
831
+ const ctx = settings.context;
832
+ if (options.defaultDepth !== void 0) {
833
+ const normalized = options.defaultDepth.trim().toLowerCase();
834
+ if (!CONTEXT_DEPTH_VALUES.includes(normalized)) {
835
+ throw new PmCliError(`Context --default-depth must be one of ${CONTEXT_DEPTH_VALUES.join("|")}`, EXIT_CODE.USAGE);
836
+ }
837
+ if (ctx.default_depth !== normalized) {
838
+ ctx.default_depth = normalized;
839
+ changed = true;
840
+ }
841
+ }
842
+ if (options.activityLimit !== void 0) {
843
+ const parsed = parseInt(options.activityLimit.trim(), 10);
844
+ if (isNaN(parsed) || parsed <= 0) {
845
+ throw new PmCliError("Context --activity-limit must be a positive integer", EXIT_CODE.USAGE);
846
+ }
847
+ if (ctx.activity_limit !== parsed) {
848
+ ctx.activity_limit = parsed;
849
+ changed = true;
850
+ }
851
+ }
852
+ if (options.staleThresholdDays !== void 0) {
853
+ const parsed = parseInt(options.staleThresholdDays.trim(), 10);
854
+ if (isNaN(parsed) || parsed <= 0) {
855
+ throw new PmCliError("Context --stale-threshold-days must be a positive integer", EXIT_CODE.USAGE);
856
+ }
857
+ if (ctx.stale_threshold_days !== parsed) {
858
+ ctx.stale_threshold_days = parsed;
859
+ changed = true;
860
+ }
861
+ }
862
+ const sectionToggles = [
863
+ ["hierarchy", options.sectionHierarchy],
864
+ ["activity", options.sectionActivity],
865
+ ["progress", options.sectionProgress],
866
+ ["blockers", options.sectionBlockers],
867
+ ["files", options.sectionFiles],
868
+ ["workload", options.sectionWorkload],
869
+ ["staleness", options.sectionStaleness],
870
+ ["tests", options.sectionTests]
871
+ ];
872
+ for (const [sectionName, rawValue] of sectionToggles) {
873
+ const toggle = parseSectionToggle(rawValue);
874
+ if (toggle !== void 0) {
875
+ const key = sectionName;
876
+ if (ctx.sections[key] !== toggle) {
877
+ ctx.sections[key] = toggle;
878
+ changed = true;
879
+ }
880
+ }
881
+ }
882
+ if (changed) {
883
+ await writeSettings(target.pmRoot, settings, "config:set:context");
884
+ }
885
+ return withWarnings({
886
+ scope,
887
+ key: "context",
888
+ context_settings: {
889
+ default_depth: ctx.default_depth,
890
+ activity_limit: ctx.activity_limit,
891
+ stale_threshold_days: ctx.stale_threshold_days,
892
+ sections: { ...ctx.sections }
893
+ },
894
+ settings_path: target.settingsPath,
895
+ changed
896
+ }, warnings);
897
+ }
898
+ function applyPositionalValue(action, keyValue, normalizedKey, nestedSetting, valueValue, options) {
899
+ if (valueValue === void 0) {
900
+ return options;
901
+ }
902
+ if (action !== "set") {
903
+ throw new PmCliError(`Config action "${action}" does not accept a positional value. Only "set" takes <value>.`, EXIT_CODE.USAGE);
904
+ }
905
+ if (typeof keyValue !== "string" || keyValue.trim().length === 0) {
906
+ throw new PmCliError('Config action "set" requires <key> before a positional <value>.', EXIT_CODE.USAGE);
907
+ }
908
+ if (nestedSetting) {
909
+ if (options.value !== void 0 && valueValue !== void 0 && options.value !== valueValue) {
910
+ throw new PmCliError(`Config set ${keyValue} received both positional value "${valueValue}" and --value "${options.value}". Pass only one.`, EXIT_CODE.USAGE);
911
+ }
912
+ return { ...options, value: valueValue ?? options.value };
913
+ }
914
+ const routed = resolveConfigPositionalValue(normalizedKey ?? keyValue, valueValue);
915
+ if (!routed.routable) {
916
+ throw new PmCliError(routed.reason, EXIT_CODE.USAGE);
917
+ }
918
+ if (routed.flag === "criterion") {
919
+ if (options.criterion !== void 0 && options.criterion.length > 0) {
920
+ throw new PmCliError(`Config set ${keyValue} received both positional value "${valueValue}" and --criterion. Pass criteria via --criterion only when supplying more than one value.`, EXIT_CODE.USAGE);
921
+ }
922
+ return { ...options, criterion: routed.values };
923
+ }
924
+ if (routed.flag === "format") {
925
+ if (options.format !== void 0 && normalizeItemFormat(options.format) !== normalizeItemFormat(routed.value)) {
926
+ throw new PmCliError(`Config set ${keyValue} received both positional value "${valueValue}" and --format "${options.format}". Pass only one.`, EXIT_CODE.USAGE);
927
+ }
928
+ return { ...options, format: routed.value };
929
+ }
930
+ if (options.policy !== void 0 && normalizePolicyForConflict(normalizedKey, options.policy) !== normalizePolicyForConflict(normalizedKey, routed.value)) {
931
+ throw new PmCliError(`Config set ${keyValue} received both positional value "${valueValue}" and --policy "${options.policy}". Pass only one.`, EXIT_CODE.USAGE);
932
+ }
933
+ return { ...options, policy: routed.value };
934
+ }
935
+ async function runConfig(scopeValue, actionValue, keyValue, options, global2, valueValue) {
936
+ const scope = normalizeScope(scopeValue);
937
+ const action = normalizeAction(actionValue);
938
+ const nestedSetting = action === "get" || action === "set" ? resolveNestedSettingDescriptor(keyValue) : void 0;
939
+ const key = nestedSetting ? void 0 : normalizeKeyForAction(action, keyValue);
940
+ options = applyPositionalValue(action, keyValue, key, nestedSetting, valueValue, options);
941
+ const target = await resolveSettingsTarget(scope, global2);
942
+ const { settings, metadata, warnings: settingsReadWarnings } = await readSettingsWithMetadata(target.pmRoot);
943
+ const warnings = normalizeWarnings(settingsReadWarnings);
944
+ if (nestedSetting) {
945
+ if (action === "get") {
946
+ const currentValue = readNestedSettingValue(settings, nestedSetting);
947
+ return withWarnings({
948
+ scope,
949
+ key: nestedSetting.key,
950
+ nested_setting: {
951
+ key: nestedSetting.key,
952
+ path: nestedSetting.path,
953
+ kind: nestedSetting.kind,
954
+ value: currentValue
955
+ },
956
+ settings_path: target.settingsPath,
957
+ changed: false
958
+ }, warnings);
959
+ }
960
+ const rawValue = options.value;
961
+ if (typeof rawValue !== "string") {
962
+ throw new PmCliError(`Config set ${nestedSetting.key} requires a value. Pass it positionally (\`pm config ${scope} set ${nestedSetting.key} <value>\`) or via --value.`, EXIT_CODE.USAGE);
963
+ }
964
+ const parsed = parseNestedSettingValue(nestedSetting, rawValue);
965
+ if (!parsed.ok) {
966
+ throw new PmCliError(parsed.error.message, EXIT_CODE.USAGE);
967
+ }
968
+ const changed2 = writeNestedSettingValue(settings, nestedSetting, parsed.parsed.value);
969
+ if (changed2) {
970
+ await writeSettings(target.pmRoot, settings, `config:set:${nestedSetting.path}`);
971
+ }
972
+ return withWarnings({
973
+ scope,
974
+ key: nestedSetting.key,
975
+ nested_setting: {
976
+ key: nestedSetting.key,
977
+ path: nestedSetting.path,
978
+ kind: nestedSetting.kind,
979
+ value: parsed.parsed.value
980
+ },
981
+ settings_path: target.settingsPath,
982
+ changed: changed2
983
+ }, warnings);
984
+ }
985
+ if (action === "list") {
986
+ const keys = Object.keys(CONFIG_KEY_ALIASES).map((candidate) => ({
987
+ key: candidate,
988
+ aliases: CONFIG_KEY_ALIASES[candidate],
989
+ value_kind: candidate === "context" ? "object" : isCriteriaConfigKey(candidate) ? "string_array" : "enum",
990
+ set_flags: candidate === "context" ? ["--default-depth", "--activity-limit", "--stale-threshold-days", "--section-<name>"] : isCriteriaConfigKey(candidate) ? ["--criterion", "--clear-criteria"] : candidate === "item_format" ? ["--format"] : ["--policy"],
991
+ summary: CONFIG_KEY_SUMMARIES[candidate],
992
+ value: readConfigValue(settings, candidate)
993
+ }));
994
+ const nestedSettings = NESTED_SETTING_DESCRIPTORS.map((descriptor) => ({
995
+ key: descriptor.key,
996
+ path: descriptor.path,
997
+ kind: descriptor.kind,
998
+ value: readNestedSettingValue(settings, descriptor)
999
+ }));
1000
+ return withWarnings({
1001
+ scope,
1002
+ keys,
1003
+ nested_settings: nestedSettings,
1004
+ count: keys.length,
1005
+ settings_path: target.settingsPath,
1006
+ changed: false
1007
+ }, warnings);
1008
+ }
1009
+ if (action === "export") {
1010
+ const values = {
1011
+ definition_of_done: readConfigValue(settings, "definition_of_done"),
1012
+ item_format: readConfigValue(settings, "item_format"),
1013
+ history_missing_stream_policy: readConfigValue(settings, "history_missing_stream_policy"),
1014
+ sprint_release_format_policy: readConfigValue(settings, "sprint_release_format_policy"),
1015
+ parent_reference_policy: readConfigValue(settings, "parent_reference_policy"),
1016
+ metadata_validation_profile: readConfigValue(settings, "metadata_validation_profile"),
1017
+ metadata_required_fields: readConfigValue(settings, "metadata_required_fields"),
1018
+ lifecycle_stale_blocker_reason_patterns: readConfigValue(settings, "lifecycle_stale_blocker_reason_patterns"),
1019
+ lifecycle_closure_like_blocked_reason_patterns: readConfigValue(settings, "lifecycle_closure_like_blocked_reason_patterns"),
1020
+ lifecycle_closure_like_resolution_patterns: readConfigValue(settings, "lifecycle_closure_like_resolution_patterns"),
1021
+ lifecycle_closure_like_actual_result_patterns: readConfigValue(settings, "lifecycle_closure_like_actual_result_patterns"),
1022
+ governance_preset: readConfigValue(settings, "governance_preset"),
1023
+ governance_ownership_enforcement: readConfigValue(settings, "governance_ownership_enforcement"),
1024
+ governance_create_mode_default: readConfigValue(settings, "governance_create_mode_default"),
1025
+ governance_close_validation_default: readConfigValue(settings, "governance_close_validation_default"),
1026
+ governance_parent_reference_policy: readConfigValue(settings, "governance_parent_reference_policy"),
1027
+ governance_metadata_validation_profile: readConfigValue(settings, "governance_metadata_validation_profile"),
1028
+ governance_force_required_for_stale_lock: readConfigValue(settings, "governance_force_required_for_stale_lock"),
1029
+ test_result_tracking: readConfigValue(settings, "test_result_tracking"),
1030
+ telemetry_tracking: readConfigValue(settings, "telemetry_tracking"),
1031
+ context: readConfigValue(settings, "context")
1032
+ };
1033
+ return withWarnings({
1034
+ scope,
1035
+ values,
1036
+ settings_path: target.settingsPath,
1037
+ changed: false
1038
+ }, warnings);
1039
+ }
1040
+ if (action === "get") {
1041
+ if (!key) {
1042
+ throw new PmCliError('Config action "get" requires <key>', EXIT_CODE.USAGE);
1043
+ }
1044
+ if (key === "item_format") {
1045
+ return withWarnings({
1046
+ scope,
1047
+ key,
1048
+ format: settings.item_format,
1049
+ has_explicit_item_format: metadata.has_explicit_item_format,
1050
+ settings_path: target.settingsPath,
1051
+ changed: false
1052
+ }, warnings);
1053
+ }
1054
+ if (key === "history_missing_stream_policy") {
1055
+ return withWarnings({
1056
+ scope,
1057
+ key,
1058
+ policy: settings.history.missing_stream,
1059
+ settings_path: target.settingsPath,
1060
+ changed: false
1061
+ }, warnings);
1062
+ }
1063
+ if (key === "sprint_release_format_policy") {
1064
+ return withWarnings({
1065
+ scope,
1066
+ key,
1067
+ policy: settings.validation.sprint_release_format,
1068
+ settings_path: target.settingsPath,
1069
+ changed: false
1070
+ }, warnings);
1071
+ }
1072
+ if (key === "parent_reference_policy") {
1073
+ return withWarnings({
1074
+ scope,
1075
+ key,
1076
+ policy: settings.validation.parent_reference,
1077
+ settings_path: target.settingsPath,
1078
+ changed: false
1079
+ }, warnings);
1080
+ }
1081
+ if (key === "metadata_validation_profile") {
1082
+ return withWarnings({
1083
+ scope,
1084
+ key,
1085
+ policy: settings.validation.metadata_profile,
1086
+ settings_path: target.settingsPath,
1087
+ changed: false
1088
+ }, warnings);
1089
+ }
1090
+ if (key === "metadata_required_fields") {
1091
+ return withWarnings({
1092
+ scope,
1093
+ key,
1094
+ criteria: [...settings.validation.metadata_required_fields],
1095
+ settings_path: target.settingsPath,
1096
+ changed: false
1097
+ }, warnings);
1098
+ }
1099
+ if (key === "lifecycle_stale_blocker_reason_patterns") {
1100
+ return withWarnings({
1101
+ scope,
1102
+ key,
1103
+ criteria: [...settings.validation.lifecycle_stale_blocker_reason_patterns],
1104
+ settings_path: target.settingsPath,
1105
+ changed: false
1106
+ }, warnings);
1107
+ }
1108
+ if (key === "lifecycle_closure_like_blocked_reason_patterns") {
1109
+ return withWarnings({
1110
+ scope,
1111
+ key,
1112
+ criteria: [...settings.validation.lifecycle_closure_like_blocked_reason_patterns],
1113
+ settings_path: target.settingsPath,
1114
+ changed: false
1115
+ }, warnings);
1116
+ }
1117
+ if (key === "lifecycle_closure_like_resolution_patterns") {
1118
+ return withWarnings({
1119
+ scope,
1120
+ key,
1121
+ criteria: [...settings.validation.lifecycle_closure_like_resolution_patterns],
1122
+ settings_path: target.settingsPath,
1123
+ changed: false
1124
+ }, warnings);
1125
+ }
1126
+ if (key === "lifecycle_closure_like_actual_result_patterns") {
1127
+ return withWarnings({
1128
+ scope,
1129
+ key,
1130
+ criteria: [...settings.validation.lifecycle_closure_like_actual_result_patterns],
1131
+ settings_path: target.settingsPath,
1132
+ changed: false
1133
+ }, warnings);
1134
+ }
1135
+ if (key === "governance_preset") {
1136
+ return withWarnings({
1137
+ scope,
1138
+ key,
1139
+ policy: settings.governance.preset,
1140
+ settings_path: target.settingsPath,
1141
+ changed: false
1142
+ }, warnings);
1143
+ }
1144
+ if (key === "governance_ownership_enforcement") {
1145
+ return withWarnings({
1146
+ scope,
1147
+ key,
1148
+ policy: settings.governance.ownership_enforcement,
1149
+ settings_path: target.settingsPath,
1150
+ changed: false
1151
+ }, warnings);
1152
+ }
1153
+ if (key === "governance_create_mode_default") {
1154
+ return withWarnings({
1155
+ scope,
1156
+ key,
1157
+ policy: settings.governance.create_mode_default,
1158
+ settings_path: target.settingsPath,
1159
+ changed: false
1160
+ }, warnings);
1161
+ }
1162
+ if (key === "governance_close_validation_default") {
1163
+ return withWarnings({
1164
+ scope,
1165
+ key,
1166
+ policy: settings.governance.close_validation_default,
1167
+ settings_path: target.settingsPath,
1168
+ changed: false
1169
+ }, warnings);
1170
+ }
1171
+ if (key === "governance_parent_reference_policy") {
1172
+ return withWarnings({
1173
+ scope,
1174
+ key,
1175
+ policy: settings.governance.parent_reference,
1176
+ settings_path: target.settingsPath,
1177
+ changed: false
1178
+ }, warnings);
1179
+ }
1180
+ if (key === "governance_metadata_validation_profile") {
1181
+ return withWarnings({
1182
+ scope,
1183
+ key,
1184
+ policy: settings.governance.metadata_profile,
1185
+ settings_path: target.settingsPath,
1186
+ changed: false
1187
+ }, warnings);
1188
+ }
1189
+ if (key === "governance_force_required_for_stale_lock") {
1190
+ return withWarnings({
1191
+ scope,
1192
+ key,
1193
+ policy: settings.governance.force_required_for_stale_lock ? "enabled" : "disabled",
1194
+ settings_path: target.settingsPath,
1195
+ changed: false
1196
+ }, warnings);
1197
+ }
1198
+ if (key === "test_result_tracking") {
1199
+ return withWarnings({
1200
+ scope,
1201
+ key,
1202
+ policy: settings.testing.record_results_to_items ? "enabled" : "disabled",
1203
+ settings_path: target.settingsPath,
1204
+ changed: false
1205
+ }, warnings);
1206
+ }
1207
+ if (key === "telemetry_tracking") {
1208
+ return withWarnings({
1209
+ scope,
1210
+ key,
1211
+ policy: settings.telemetry.enabled ? "enabled" : "disabled",
1212
+ settings_path: target.settingsPath,
1213
+ changed: false
1214
+ }, warnings);
1215
+ }
1216
+ if (key === "context") {
1217
+ return withWarnings({
1218
+ scope,
1219
+ key,
1220
+ context_settings: {
1221
+ default_depth: settings.context.default_depth,
1222
+ activity_limit: settings.context.activity_limit,
1223
+ stale_threshold_days: settings.context.stale_threshold_days,
1224
+ sections: { ...settings.context.sections }
1225
+ },
1226
+ settings_path: target.settingsPath,
1227
+ changed: false
1228
+ }, warnings);
1229
+ }
1230
+ return withWarnings({
1231
+ scope,
1232
+ key,
1233
+ criteria: [...settings.workflow.definition_of_done],
1234
+ settings_path: target.settingsPath,
1235
+ changed: false
1236
+ }, warnings);
1237
+ }
1238
+ if (!key) {
1239
+ throw new PmCliError('Config action "set" requires <key>', EXIT_CODE.USAGE);
1240
+ }
1241
+ if (options.clearCriteria === true && !isCriteriaConfigKey(key)) {
1242
+ throw new PmCliError("--clear-criteria is only supported with config set criteria-list keys", EXIT_CODE.USAGE);
1243
+ }
1244
+ if (key === "item_format") {
1245
+ const nextFormat = normalizeItemFormat(options.format);
1246
+ const changed2 = settings.item_format !== nextFormat || !metadata.has_explicit_item_format;
1247
+ let migration = void 0;
1248
+ if (changed2) {
1249
+ const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
1250
+ const migrated = await migrateItemFilesToFormat(target.pmRoot, nextFormat, "config:set:item_format:migrate", typeRegistry.type_to_folder, settings.schema);
1251
+ migration = {
1252
+ target_format: migrated.target_format,
1253
+ scanned: migrated.scanned,
1254
+ migrated: migrated.migrated,
1255
+ removed: migrated.removed,
1256
+ warnings: migrated.warnings
1257
+ };
1258
+ settings.item_format = nextFormat;
1259
+ await writeSettings(target.pmRoot, settings, "config:set:item_format");
1260
+ }
1261
+ return withWarnings({
1262
+ scope,
1263
+ key,
1264
+ format: settings.item_format,
1265
+ has_explicit_item_format: true,
1266
+ migration,
1267
+ settings_path: target.settingsPath,
1268
+ changed: changed2
1269
+ }, warnings);
1270
+ }
1271
+ if (key === "history_missing_stream_policy") {
1272
+ const nextPolicy = normalizeHistoryMissingStreamPolicy(options.policy);
1273
+ const changed2 = settings.history.missing_stream !== nextPolicy;
1274
+ settings.history.missing_stream = nextPolicy;
1275
+ if (changed2) {
1276
+ await writeSettings(target.pmRoot, settings, "config:set:history_missing_stream_policy");
1277
+ }
1278
+ return withWarnings({
1279
+ scope,
1280
+ key,
1281
+ policy: settings.history.missing_stream,
1282
+ settings_path: target.settingsPath,
1283
+ changed: changed2
1284
+ }, warnings);
1285
+ }
1286
+ if (key === "sprint_release_format_policy") {
1287
+ const nextPolicy = normalizeSprintReleaseFormatPolicy(options.policy);
1288
+ const changed2 = settings.validation.sprint_release_format !== nextPolicy;
1289
+ settings.validation.sprint_release_format = nextPolicy;
1290
+ if (changed2) {
1291
+ await writeSettings(target.pmRoot, settings, "config:set:sprint_release_format_policy");
1292
+ }
1293
+ return withWarnings({
1294
+ scope,
1295
+ key,
1296
+ policy: settings.validation.sprint_release_format,
1297
+ settings_path: target.settingsPath,
1298
+ changed: changed2
1299
+ }, warnings);
1300
+ }
1301
+ if (key === "parent_reference_policy") {
1302
+ const nextPolicy = normalizeParentReferencePolicy(options.policy);
1303
+ const changed2 = settings.validation.parent_reference !== nextPolicy || settings.governance.preset !== "custom" || settings.governance.parent_reference !== nextPolicy;
1304
+ settings.validation.parent_reference = nextPolicy;
1305
+ settings.governance.preset = "custom";
1306
+ settings.governance.parent_reference = nextPolicy;
1307
+ if (changed2) {
1308
+ await writeSettings(target.pmRoot, settings, "config:set:parent_reference_policy");
1309
+ }
1310
+ return withWarnings({
1311
+ scope,
1312
+ key,
1313
+ policy: settings.validation.parent_reference,
1314
+ settings_path: target.settingsPath,
1315
+ changed: changed2
1316
+ }, warnings);
1317
+ }
1318
+ if (key === "metadata_validation_profile") {
1319
+ const nextPolicy = normalizeValidateMetadataProfile(options.policy);
1320
+ const changed2 = settings.validation.metadata_profile !== nextPolicy || settings.governance.preset !== "custom" || settings.governance.metadata_profile !== nextPolicy;
1321
+ settings.validation.metadata_profile = nextPolicy;
1322
+ settings.governance.preset = "custom";
1323
+ settings.governance.metadata_profile = nextPolicy;
1324
+ if (changed2) {
1325
+ await writeSettings(target.pmRoot, settings, "config:set:metadata_validation_profile");
1326
+ }
1327
+ return withWarnings({
1328
+ scope,
1329
+ key,
1330
+ policy: settings.validation.metadata_profile,
1331
+ settings_path: target.settingsPath,
1332
+ changed: changed2
1333
+ }, warnings);
1334
+ }
1335
+ if (key === "metadata_required_fields") {
1336
+ const nextCriteria2 = normalizeMetadataRequiredFields(options.criterion, options.clearCriteria);
1337
+ const changed2 = nextCriteria2.length !== settings.validation.metadata_required_fields.length || nextCriteria2.some((value, index) => value !== settings.validation.metadata_required_fields[index]);
1338
+ settings.validation.metadata_required_fields = nextCriteria2;
1339
+ if (changed2) {
1340
+ await writeSettings(target.pmRoot, settings, "config:set:metadata_required_fields");
1341
+ }
1342
+ return withWarnings({
1343
+ scope,
1344
+ key,
1345
+ criteria: [...settings.validation.metadata_required_fields],
1346
+ settings_path: target.settingsPath,
1347
+ changed: changed2
1348
+ }, warnings);
1349
+ }
1350
+ if (key === "lifecycle_stale_blocker_reason_patterns") {
1351
+ const nextCriteria2 = normalizeLifecyclePatternCriteria(key, options.criterion, options.clearCriteria);
1352
+ const changed2 = nextCriteria2.length !== settings.validation.lifecycle_stale_blocker_reason_patterns.length || nextCriteria2.some((value, index) => value !== settings.validation.lifecycle_stale_blocker_reason_patterns[index]);
1353
+ settings.validation.lifecycle_stale_blocker_reason_patterns = nextCriteria2;
1354
+ if (changed2) {
1355
+ await writeSettings(target.pmRoot, settings, "config:set:lifecycle_stale_blocker_reason_patterns");
1356
+ }
1357
+ return withWarnings({
1358
+ scope,
1359
+ key,
1360
+ criteria: [...settings.validation.lifecycle_stale_blocker_reason_patterns],
1361
+ settings_path: target.settingsPath,
1362
+ changed: changed2
1363
+ }, warnings);
1364
+ }
1365
+ if (key === "lifecycle_closure_like_blocked_reason_patterns") {
1366
+ const nextCriteria2 = normalizeLifecyclePatternCriteria(key, options.criterion, options.clearCriteria);
1367
+ const changed2 = nextCriteria2.length !== settings.validation.lifecycle_closure_like_blocked_reason_patterns.length || nextCriteria2.some((value, index) => value !== settings.validation.lifecycle_closure_like_blocked_reason_patterns[index]);
1368
+ settings.validation.lifecycle_closure_like_blocked_reason_patterns = nextCriteria2;
1369
+ if (changed2) {
1370
+ await writeSettings(target.pmRoot, settings, "config:set:lifecycle_closure_like_blocked_reason_patterns");
1371
+ }
1372
+ return withWarnings({
1373
+ scope,
1374
+ key,
1375
+ criteria: [...settings.validation.lifecycle_closure_like_blocked_reason_patterns],
1376
+ settings_path: target.settingsPath,
1377
+ changed: changed2
1378
+ }, warnings);
1379
+ }
1380
+ if (key === "lifecycle_closure_like_resolution_patterns") {
1381
+ const nextCriteria2 = normalizeLifecyclePatternCriteria(key, options.criterion, options.clearCriteria);
1382
+ const changed2 = nextCriteria2.length !== settings.validation.lifecycle_closure_like_resolution_patterns.length || nextCriteria2.some((value, index) => value !== settings.validation.lifecycle_closure_like_resolution_patterns[index]);
1383
+ settings.validation.lifecycle_closure_like_resolution_patterns = nextCriteria2;
1384
+ if (changed2) {
1385
+ await writeSettings(target.pmRoot, settings, "config:set:lifecycle_closure_like_resolution_patterns");
1386
+ }
1387
+ return withWarnings({
1388
+ scope,
1389
+ key,
1390
+ criteria: [...settings.validation.lifecycle_closure_like_resolution_patterns],
1391
+ settings_path: target.settingsPath,
1392
+ changed: changed2
1393
+ }, warnings);
1394
+ }
1395
+ if (key === "lifecycle_closure_like_actual_result_patterns") {
1396
+ const nextCriteria2 = normalizeLifecyclePatternCriteria(key, options.criterion, options.clearCriteria);
1397
+ const changed2 = nextCriteria2.length !== settings.validation.lifecycle_closure_like_actual_result_patterns.length || nextCriteria2.some((value, index) => value !== settings.validation.lifecycle_closure_like_actual_result_patterns[index]);
1398
+ settings.validation.lifecycle_closure_like_actual_result_patterns = nextCriteria2;
1399
+ if (changed2) {
1400
+ await writeSettings(target.pmRoot, settings, "config:set:lifecycle_closure_like_actual_result_patterns");
1401
+ }
1402
+ return withWarnings({
1403
+ scope,
1404
+ key,
1405
+ criteria: [...settings.validation.lifecycle_closure_like_actual_result_patterns],
1406
+ settings_path: target.settingsPath,
1407
+ changed: changed2
1408
+ }, warnings);
1409
+ }
1410
+ if (key === "governance_preset") {
1411
+ const nextPolicy = normalizeGovernancePreset(options.policy);
1412
+ const changed2 = settings.governance.preset !== nextPolicy;
1413
+ settings.governance.preset = nextPolicy;
1414
+ if (changed2) {
1415
+ await writeSettings(target.pmRoot, settings, "config:set:governance_preset");
1416
+ }
1417
+ return withWarnings({
1418
+ scope,
1419
+ key,
1420
+ policy: settings.governance.preset,
1421
+ settings_path: target.settingsPath,
1422
+ changed: changed2
1423
+ }, warnings);
1424
+ }
1425
+ if (key === "governance_ownership_enforcement") {
1426
+ const nextPolicy = normalizeGovernanceOwnershipEnforcement(options.policy);
1427
+ const changed2 = settings.governance.preset !== "custom" || settings.governance.ownership_enforcement !== nextPolicy;
1428
+ settings.governance.preset = "custom";
1429
+ settings.governance.ownership_enforcement = nextPolicy;
1430
+ if (changed2) {
1431
+ await writeSettings(target.pmRoot, settings, "config:set:governance_ownership_enforcement");
1432
+ }
1433
+ return withWarnings({
1434
+ scope,
1435
+ key,
1436
+ policy: settings.governance.ownership_enforcement,
1437
+ settings_path: target.settingsPath,
1438
+ changed: changed2
1439
+ }, warnings);
1440
+ }
1441
+ if (key === "governance_create_mode_default") {
1442
+ const nextPolicy = normalizeGovernanceCreateModeDefault(options.policy);
1443
+ const changed2 = settings.governance.preset !== "custom" || settings.governance.create_mode_default !== nextPolicy;
1444
+ settings.governance.preset = "custom";
1445
+ settings.governance.create_mode_default = nextPolicy;
1446
+ if (changed2) {
1447
+ await writeSettings(target.pmRoot, settings, "config:set:governance_create_mode_default");
1448
+ }
1449
+ return withWarnings({
1450
+ scope,
1451
+ key,
1452
+ policy: settings.governance.create_mode_default,
1453
+ settings_path: target.settingsPath,
1454
+ changed: changed2
1455
+ }, warnings);
1456
+ }
1457
+ if (key === "governance_close_validation_default") {
1458
+ const nextPolicy = normalizeGovernanceCloseValidationDefault(options.policy);
1459
+ const changed2 = settings.governance.preset !== "custom" || settings.governance.close_validation_default !== nextPolicy;
1460
+ settings.governance.preset = "custom";
1461
+ settings.governance.close_validation_default = nextPolicy;
1462
+ if (changed2) {
1463
+ await writeSettings(target.pmRoot, settings, "config:set:governance_close_validation_default");
1464
+ }
1465
+ return withWarnings({
1466
+ scope,
1467
+ key,
1468
+ policy: settings.governance.close_validation_default,
1469
+ settings_path: target.settingsPath,
1470
+ changed: changed2
1471
+ }, warnings);
1472
+ }
1473
+ if (key === "governance_parent_reference_policy") {
1474
+ const nextPolicy = normalizeParentReferencePolicy(options.policy);
1475
+ const changed2 = settings.governance.preset !== "custom" || settings.governance.parent_reference !== nextPolicy;
1476
+ settings.governance.preset = "custom";
1477
+ settings.governance.parent_reference = nextPolicy;
1478
+ settings.validation.parent_reference = nextPolicy;
1479
+ if (changed2) {
1480
+ await writeSettings(target.pmRoot, settings, "config:set:governance_parent_reference_policy");
1481
+ }
1482
+ return withWarnings({
1483
+ scope,
1484
+ key,
1485
+ policy: settings.governance.parent_reference,
1486
+ settings_path: target.settingsPath,
1487
+ changed: changed2
1488
+ }, warnings);
1489
+ }
1490
+ if (key === "governance_metadata_validation_profile") {
1491
+ const nextPolicy = normalizeValidateMetadataProfile(options.policy);
1492
+ const changed2 = settings.governance.preset !== "custom" || settings.governance.metadata_profile !== nextPolicy;
1493
+ settings.governance.preset = "custom";
1494
+ settings.governance.metadata_profile = nextPolicy;
1495
+ settings.validation.metadata_profile = nextPolicy;
1496
+ if (changed2) {
1497
+ await writeSettings(target.pmRoot, settings, "config:set:governance_metadata_validation_profile");
1498
+ }
1499
+ return withWarnings({
1500
+ scope,
1501
+ key,
1502
+ policy: settings.governance.metadata_profile,
1503
+ settings_path: target.settingsPath,
1504
+ changed: changed2
1505
+ }, warnings);
1506
+ }
1507
+ if (key === "governance_force_required_for_stale_lock") {
1508
+ const nextPolicy = normalizeGovernanceForceRequiredForStaleLockPolicy(options.policy);
1509
+ const nextEnabled = nextPolicy === "enabled";
1510
+ const changed2 = settings.governance.preset !== "custom" || settings.governance.force_required_for_stale_lock !== nextEnabled;
1511
+ settings.governance.preset = "custom";
1512
+ settings.governance.force_required_for_stale_lock = nextEnabled;
1513
+ if (changed2) {
1514
+ await writeSettings(target.pmRoot, settings, "config:set:governance_force_required_for_stale_lock");
1515
+ }
1516
+ return withWarnings({
1517
+ scope,
1518
+ key,
1519
+ policy: settings.governance.force_required_for_stale_lock ? "enabled" : "disabled",
1520
+ settings_path: target.settingsPath,
1521
+ changed: changed2
1522
+ }, warnings);
1523
+ }
1524
+ if (key === "test_result_tracking") {
1525
+ const nextPolicy = normalizeTestResultTrackingPolicy(options.policy);
1526
+ const nextEnabled = nextPolicy === "enabled";
1527
+ const changed2 = settings.testing.record_results_to_items !== nextEnabled;
1528
+ settings.testing.record_results_to_items = nextEnabled;
1529
+ if (changed2) {
1530
+ await writeSettings(target.pmRoot, settings, "config:set:test_result_tracking");
1531
+ }
1532
+ return withWarnings({
1533
+ scope,
1534
+ key,
1535
+ policy: settings.testing.record_results_to_items ? "enabled" : "disabled",
1536
+ settings_path: target.settingsPath,
1537
+ changed: changed2
1538
+ }, warnings);
1539
+ }
1540
+ if (key === "telemetry_tracking") {
1541
+ const nextPolicy = normalizeTelemetryTrackingPolicy(options.policy);
1542
+ const nextEnabled = nextPolicy === "enabled";
1543
+ const changed2 = settings.telemetry.enabled !== nextEnabled || !settings.telemetry.first_run_prompt_completed;
1544
+ settings.telemetry.enabled = nextEnabled;
1545
+ settings.telemetry.first_run_prompt_completed = true;
1546
+ if (changed2) {
1547
+ await writeSettings(target.pmRoot, settings, "config:set:telemetry_tracking");
1548
+ }
1549
+ return withWarnings({
1550
+ scope,
1551
+ key,
1552
+ policy: settings.telemetry.enabled ? "enabled" : "disabled",
1553
+ settings_path: target.settingsPath,
1554
+ changed: changed2
1555
+ }, warnings);
1556
+ }
1557
+ if (key === "context") {
1558
+ return applyContextConfig(settings, options, target, scope, warnings);
1559
+ }
1560
+ const nextCriteria = normalizeCriteria(options.criterion, options.clearCriteria);
1561
+ const changed = nextCriteria.length !== settings.workflow.definition_of_done.length || nextCriteria.some((value, index) => value !== settings.workflow.definition_of_done[index]);
1562
+ settings.workflow.definition_of_done = nextCriteria;
1563
+ if (changed) {
1564
+ await writeSettings(target.pmRoot, settings, "config:set:definition_of_done");
1565
+ }
1566
+ return withWarnings({
1567
+ scope,
1568
+ key,
1569
+ criteria: [...settings.workflow.definition_of_done],
1570
+ settings_path: target.settingsPath,
1571
+ changed
1572
+ }, warnings);
1573
+ }
1574
+ export {
1575
+ runConfig
1576
+ };
1577
+ //# sourceMappingURL=config-V3FZOKLI.js.map