@unbrained/pm-cli 2026.3.12 → 2026.5.1

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 (285) hide show
  1. package/.agents/pm/extensions/.managed-extensions.json +42 -0
  2. package/.agents/pm/extensions/beads/index.js +109 -0
  3. package/.agents/pm/extensions/beads/manifest.json +7 -0
  4. package/{dist/cli/commands/beads.js → .agents/pm/extensions/beads/runtime.js} +31 -21
  5. package/.agents/pm/extensions/beads/runtime.ts +702 -0
  6. package/.agents/pm/extensions/todos/index.js +126 -0
  7. package/.agents/pm/extensions/todos/manifest.json +7 -0
  8. package/{dist/extensions/builtins/todos/import-export.js → .agents/pm/extensions/todos/runtime.js} +39 -29
  9. package/.agents/pm/extensions/todos/runtime.ts +568 -0
  10. package/AGENTS.md +196 -92
  11. package/CHANGELOG.md +399 -0
  12. package/CODE_OF_CONDUCT.md +42 -0
  13. package/CONTRIBUTING.md +144 -0
  14. package/PRD.md +512 -164
  15. package/README.md +1053 -2
  16. package/SECURITY.md +51 -0
  17. package/dist/cli/commands/activity.d.ts +5 -0
  18. package/dist/cli/commands/activity.js +66 -3
  19. package/dist/cli/commands/activity.js.map +1 -1
  20. package/dist/cli/commands/aggregate.d.ts +54 -0
  21. package/dist/cli/commands/aggregate.js +181 -0
  22. package/dist/cli/commands/aggregate.js.map +1 -0
  23. package/dist/cli/commands/append.js +4 -1
  24. package/dist/cli/commands/append.js.map +1 -1
  25. package/dist/cli/commands/calendar.d.ts +109 -0
  26. package/dist/cli/commands/calendar.js +797 -0
  27. package/dist/cli/commands/calendar.js.map +1 -0
  28. package/dist/cli/commands/claim.d.ts +5 -1
  29. package/dist/cli/commands/claim.js +42 -21
  30. package/dist/cli/commands/claim.js.map +1 -1
  31. package/dist/cli/commands/close.d.ts +1 -0
  32. package/dist/cli/commands/close.js +54 -5
  33. package/dist/cli/commands/close.js.map +1 -1
  34. package/dist/cli/commands/comments-audit.d.ts +91 -0
  35. package/dist/cli/commands/comments-audit.js +195 -0
  36. package/dist/cli/commands/comments-audit.js.map +1 -0
  37. package/dist/cli/commands/comments.d.ts +1 -0
  38. package/dist/cli/commands/comments.js +70 -21
  39. package/dist/cli/commands/comments.js.map +1 -1
  40. package/dist/cli/commands/completion.d.ts +10 -4
  41. package/dist/cli/commands/completion.js +1184 -137
  42. package/dist/cli/commands/completion.js.map +1 -1
  43. package/dist/cli/commands/config.d.ts +35 -3
  44. package/dist/cli/commands/config.js +968 -13
  45. package/dist/cli/commands/config.js.map +1 -1
  46. package/dist/cli/commands/context.d.ts +86 -0
  47. package/dist/cli/commands/context.js +299 -0
  48. package/dist/cli/commands/context.js.map +1 -0
  49. package/dist/cli/commands/contracts.d.ts +78 -0
  50. package/dist/cli/commands/contracts.js +920 -0
  51. package/dist/cli/commands/contracts.js.map +1 -0
  52. package/dist/cli/commands/create.d.ts +48 -14
  53. package/dist/cli/commands/create.js +1331 -160
  54. package/dist/cli/commands/create.js.map +1 -1
  55. package/dist/cli/commands/dedupe-audit.d.ts +81 -0
  56. package/dist/cli/commands/dedupe-audit.js +330 -0
  57. package/dist/cli/commands/dedupe-audit.js.map +1 -0
  58. package/dist/cli/commands/deps.d.ts +52 -0
  59. package/dist/cli/commands/deps.js +204 -0
  60. package/dist/cli/commands/deps.js.map +1 -0
  61. package/dist/cli/commands/docs.d.ts +19 -0
  62. package/dist/cli/commands/docs.js +212 -13
  63. package/dist/cli/commands/docs.js.map +1 -1
  64. package/dist/cli/commands/extension.d.ts +122 -0
  65. package/dist/cli/commands/extension.js +1850 -0
  66. package/dist/cli/commands/extension.js.map +1 -0
  67. package/dist/cli/commands/files.d.ts +52 -1
  68. package/dist/cli/commands/files.js +443 -13
  69. package/dist/cli/commands/files.js.map +1 -1
  70. package/dist/cli/commands/gc.d.ts +11 -1
  71. package/dist/cli/commands/gc.js +89 -11
  72. package/dist/cli/commands/gc.js.map +1 -1
  73. package/dist/cli/commands/get.d.ts +13 -0
  74. package/dist/cli/commands/get.js +35 -3
  75. package/dist/cli/commands/get.js.map +1 -1
  76. package/dist/cli/commands/health.d.ts +10 -2
  77. package/dist/cli/commands/health.js +774 -23
  78. package/dist/cli/commands/health.js.map +1 -1
  79. package/dist/cli/commands/history.d.ts +20 -0
  80. package/dist/cli/commands/history.js +152 -6
  81. package/dist/cli/commands/history.js.map +1 -1
  82. package/dist/cli/commands/index.d.ts +16 -3
  83. package/dist/cli/commands/index.js +16 -3
  84. package/dist/cli/commands/index.js.map +1 -1
  85. package/dist/cli/commands/init.d.ts +7 -2
  86. package/dist/cli/commands/init.js +137 -5
  87. package/dist/cli/commands/init.js.map +1 -1
  88. package/dist/cli/commands/learnings.d.ts +17 -0
  89. package/dist/cli/commands/learnings.js +129 -0
  90. package/dist/cli/commands/learnings.js.map +1 -0
  91. package/dist/cli/commands/list.d.ts +29 -1
  92. package/dist/cli/commands/list.js +289 -53
  93. package/dist/cli/commands/list.js.map +1 -1
  94. package/dist/cli/commands/normalize.d.ts +51 -0
  95. package/dist/cli/commands/normalize.js +298 -0
  96. package/dist/cli/commands/normalize.js.map +1 -0
  97. package/dist/cli/commands/notes.d.ts +17 -0
  98. package/dist/cli/commands/notes.js +129 -0
  99. package/dist/cli/commands/notes.js.map +1 -0
  100. package/dist/cli/commands/reindex.d.ts +1 -0
  101. package/dist/cli/commands/reindex.js +208 -32
  102. package/dist/cli/commands/reindex.js.map +1 -1
  103. package/dist/cli/commands/restore.js +164 -30
  104. package/dist/cli/commands/restore.js.map +1 -1
  105. package/dist/cli/commands/search.d.ts +14 -1
  106. package/dist/cli/commands/search.js +475 -81
  107. package/dist/cli/commands/search.js.map +1 -1
  108. package/dist/cli/commands/stats.js +26 -10
  109. package/dist/cli/commands/stats.js.map +1 -1
  110. package/dist/cli/commands/templates.d.ts +26 -0
  111. package/dist/cli/commands/templates.js +179 -0
  112. package/dist/cli/commands/templates.js.map +1 -0
  113. package/dist/cli/commands/test-all.d.ts +19 -1
  114. package/dist/cli/commands/test-all.js +161 -13
  115. package/dist/cli/commands/test-all.js.map +1 -1
  116. package/dist/cli/commands/test-runs.d.ts +63 -0
  117. package/dist/cli/commands/test-runs.js +179 -0
  118. package/dist/cli/commands/test-runs.js.map +1 -0
  119. package/dist/cli/commands/test.d.ts +75 -1
  120. package/dist/cli/commands/test.js +1360 -41
  121. package/dist/cli/commands/test.js.map +1 -1
  122. package/dist/cli/commands/update-many.d.ts +57 -0
  123. package/dist/cli/commands/update-many.js +631 -0
  124. package/dist/cli/commands/update-many.js.map +1 -0
  125. package/dist/cli/commands/update.d.ts +30 -0
  126. package/dist/cli/commands/update.js +1393 -84
  127. package/dist/cli/commands/update.js.map +1 -1
  128. package/dist/cli/commands/validate.d.ts +30 -0
  129. package/dist/cli/commands/validate.js +1140 -0
  130. package/dist/cli/commands/validate.js.map +1 -0
  131. package/dist/cli/error-guidance.d.ts +33 -0
  132. package/dist/cli/error-guidance.js +337 -0
  133. package/dist/cli/error-guidance.js.map +1 -0
  134. package/dist/cli/extension-command-options.d.ts +1 -0
  135. package/dist/cli/extension-command-options.js +92 -0
  136. package/dist/cli/extension-command-options.js.map +1 -1
  137. package/dist/cli/help-content.d.ts +20 -0
  138. package/dist/cli/help-content.js +543 -0
  139. package/dist/cli/help-content.js.map +1 -0
  140. package/dist/cli/main.js +3625 -445
  141. package/dist/cli/main.js.map +1 -1
  142. package/dist/core/extensions/index.d.ts +13 -1
  143. package/dist/core/extensions/index.js +108 -1
  144. package/dist/core/extensions/index.js.map +1 -1
  145. package/dist/core/extensions/item-fields.d.ts +2 -0
  146. package/dist/core/extensions/item-fields.js +79 -0
  147. package/dist/core/extensions/item-fields.js.map +1 -0
  148. package/dist/core/extensions/loader.d.ts +322 -9
  149. package/dist/core/extensions/loader.js +911 -20
  150. package/dist/core/extensions/loader.js.map +1 -1
  151. package/dist/core/extensions/runtime-registrations.d.ts +5 -0
  152. package/dist/core/extensions/runtime-registrations.js +51 -0
  153. package/dist/core/extensions/runtime-registrations.js.map +1 -0
  154. package/dist/core/history/history-stream-policy.d.ts +20 -0
  155. package/dist/core/history/history-stream-policy.js +53 -0
  156. package/dist/core/history/history-stream-policy.js.map +1 -0
  157. package/dist/core/history/history.js +90 -1
  158. package/dist/core/history/history.js.map +1 -1
  159. package/dist/core/item/id.js +4 -1
  160. package/dist/core/item/id.js.map +1 -1
  161. package/dist/core/item/index.d.ts +1 -0
  162. package/dist/core/item/index.js +1 -0
  163. package/dist/core/item/index.js.map +1 -1
  164. package/dist/core/item/item-format.d.ts +11 -5
  165. package/dist/core/item/item-format.js +507 -24
  166. package/dist/core/item/item-format.js.map +1 -1
  167. package/dist/core/item/parent-reference-policy.d.ts +6 -0
  168. package/dist/core/item/parent-reference-policy.js +32 -0
  169. package/dist/core/item/parent-reference-policy.js.map +1 -0
  170. package/dist/core/item/parse.d.ts +5 -0
  171. package/dist/core/item/parse.js +216 -19
  172. package/dist/core/item/parse.js.map +1 -1
  173. package/dist/core/item/sprint-release-format.d.ts +6 -0
  174. package/dist/core/item/sprint-release-format.js +33 -0
  175. package/dist/core/item/sprint-release-format.js.map +1 -0
  176. package/dist/core/item/status.d.ts +3 -0
  177. package/dist/core/item/status.js +24 -0
  178. package/dist/core/item/status.js.map +1 -0
  179. package/dist/core/item/type-registry.d.ts +37 -0
  180. package/dist/core/item/type-registry.js +706 -0
  181. package/dist/core/item/type-registry.js.map +1 -0
  182. package/dist/core/lock/lock.d.ts +1 -1
  183. package/dist/core/lock/lock.js +101 -12
  184. package/dist/core/lock/lock.js.map +1 -1
  185. package/dist/core/output/command-aware.d.ts +1 -0
  186. package/dist/core/output/command-aware.js +394 -0
  187. package/dist/core/output/command-aware.js.map +1 -0
  188. package/dist/core/output/output.d.ts +3 -0
  189. package/dist/core/output/output.js +124 -6
  190. package/dist/core/output/output.js.map +1 -1
  191. package/dist/core/schema/runtime-field-filters.d.ts +3 -0
  192. package/dist/core/schema/runtime-field-filters.js +39 -0
  193. package/dist/core/schema/runtime-field-filters.js.map +1 -0
  194. package/dist/core/schema/runtime-field-values.d.ts +8 -0
  195. package/dist/core/schema/runtime-field-values.js +154 -0
  196. package/dist/core/schema/runtime-field-values.js.map +1 -0
  197. package/dist/core/schema/runtime-schema.d.ts +68 -0
  198. package/dist/core/schema/runtime-schema.js +554 -0
  199. package/dist/core/schema/runtime-schema.js.map +1 -0
  200. package/dist/core/search/cache.d.ts +13 -1
  201. package/dist/core/search/cache.js +123 -14
  202. package/dist/core/search/cache.js.map +1 -1
  203. package/dist/core/search/semantic-defaults.d.ts +6 -0
  204. package/dist/core/search/semantic-defaults.js +120 -0
  205. package/dist/core/search/semantic-defaults.js.map +1 -0
  206. package/dist/core/search/vector-stores.js +3 -1
  207. package/dist/core/search/vector-stores.js.map +1 -1
  208. package/dist/core/shared/command-types.d.ts +2 -0
  209. package/dist/core/shared/conflict-markers.d.ts +7 -0
  210. package/dist/core/shared/conflict-markers.js +27 -0
  211. package/dist/core/shared/conflict-markers.js.map +1 -0
  212. package/dist/core/shared/constants.d.ts +15 -4
  213. package/dist/core/shared/constants.js +141 -1
  214. package/dist/core/shared/constants.js.map +1 -1
  215. package/dist/core/shared/errors.d.ts +10 -1
  216. package/dist/core/shared/errors.js +3 -1
  217. package/dist/core/shared/errors.js.map +1 -1
  218. package/dist/core/shared/text-normalization.d.ts +4 -0
  219. package/dist/core/shared/text-normalization.js +33 -0
  220. package/dist/core/shared/text-normalization.js.map +1 -0
  221. package/dist/core/shared/time.d.ts +1 -2
  222. package/dist/core/shared/time.js +98 -11
  223. package/dist/core/shared/time.js.map +1 -1
  224. package/dist/core/store/index.d.ts +1 -0
  225. package/dist/core/store/index.js +1 -0
  226. package/dist/core/store/index.js.map +1 -1
  227. package/dist/core/store/item-format-migration.d.ts +9 -0
  228. package/dist/core/store/item-format-migration.js +87 -0
  229. package/dist/core/store/item-format-migration.js.map +1 -0
  230. package/dist/core/store/item-store.d.ts +13 -4
  231. package/dist/core/store/item-store.js +238 -51
  232. package/dist/core/store/item-store.js.map +1 -1
  233. package/dist/core/store/paths.d.ts +21 -3
  234. package/dist/core/store/paths.js +59 -4
  235. package/dist/core/store/paths.js.map +1 -1
  236. package/dist/core/store/settings.d.ts +14 -1
  237. package/dist/core/store/settings.js +463 -7
  238. package/dist/core/store/settings.js.map +1 -1
  239. package/dist/core/telemetry/consent.d.ts +2 -0
  240. package/dist/core/telemetry/consent.js +79 -0
  241. package/dist/core/telemetry/consent.js.map +1 -0
  242. package/dist/core/telemetry/runtime.d.ts +38 -0
  243. package/dist/core/telemetry/runtime.js +733 -0
  244. package/dist/core/telemetry/runtime.js.map +1 -0
  245. package/dist/core/test/background-runs.d.ts +117 -0
  246. package/dist/core/test/background-runs.js +760 -0
  247. package/dist/core/test/background-runs.js.map +1 -0
  248. package/dist/core/test/item-test-run-tracking.d.ts +9 -0
  249. package/dist/core/test/item-test-run-tracking.js +50 -0
  250. package/dist/core/test/item-test-run-tracking.js.map +1 -0
  251. package/dist/sdk/cli-contracts.d.ts +92 -0
  252. package/dist/sdk/cli-contracts.js +2357 -0
  253. package/dist/sdk/cli-contracts.js.map +1 -0
  254. package/dist/sdk/index.d.ts +34 -0
  255. package/dist/sdk/index.js +23 -0
  256. package/dist/sdk/index.js.map +1 -0
  257. package/dist/types.d.ts +197 -3
  258. package/dist/types.js +48 -1
  259. package/dist/types.js.map +1 -1
  260. package/docs/ARCHITECTURE.md +368 -39
  261. package/docs/EXTENSIONS.md +454 -49
  262. package/docs/RELEASING.md +68 -19
  263. package/docs/SDK.md +123 -0
  264. package/docs/examples/starter-extension/README.md +48 -0
  265. package/docs/examples/starter-extension/index.js +191 -0
  266. package/docs/examples/starter-extension/manifest.json +17 -0
  267. package/docs/examples/starter-extension/package.json +10 -0
  268. package/package.json +33 -6
  269. package/.pi/extensions/pm-cli/index.ts +0 -778
  270. package/dist/cli/commands/beads.d.ts +0 -16
  271. package/dist/cli/commands/beads.js.map +0 -1
  272. package/dist/cli/commands/install.d.ts +0 -18
  273. package/dist/cli/commands/install.js +0 -87
  274. package/dist/cli/commands/install.js.map +0 -1
  275. package/dist/core/extensions/builtins.d.ts +0 -3
  276. package/dist/core/extensions/builtins.js +0 -47
  277. package/dist/core/extensions/builtins.js.map +0 -1
  278. package/dist/extensions/builtins/beads/index.d.ts +0 -8
  279. package/dist/extensions/builtins/beads/index.js +0 -33
  280. package/dist/extensions/builtins/beads/index.js.map +0 -1
  281. package/dist/extensions/builtins/todos/import-export.d.ts +0 -26
  282. package/dist/extensions/builtins/todos/import-export.js.map +0 -1
  283. package/dist/extensions/builtins/todos/index.d.ts +0 -8
  284. package/dist/extensions/builtins/todos/index.js +0 -38
  285. package/dist/extensions/builtins/todos/index.js.map +0 -1
@@ -0,0 +1,706 @@
1
+ import { TYPE_TO_FOLDER } from "../shared/constants.js";
2
+ import { ITEM_TYPE_VALUES } from "../../types/index.js";
3
+ export const DEFAULT_REQUIRED_CREATE_FIELDS = [
4
+ "title",
5
+ "description",
6
+ "status",
7
+ "priority",
8
+ "tags",
9
+ "body",
10
+ "deadline",
11
+ "estimatedMinutes",
12
+ "acceptanceCriteria",
13
+ "author",
14
+ "message",
15
+ "assignee",
16
+ ];
17
+ export const DEFAULT_REQUIRED_CREATE_REPEATABLES = ["dep", "comment", "note", "learning", "file", "test", "doc"];
18
+ const CREATE_COMMAND_OPTION_KEYS = [
19
+ "title",
20
+ "description",
21
+ "type",
22
+ "status",
23
+ "priority",
24
+ "tags",
25
+ "body",
26
+ "deadline",
27
+ "estimatedMinutes",
28
+ "acceptanceCriteria",
29
+ "definitionOfReady",
30
+ "order",
31
+ "goal",
32
+ "objective",
33
+ "value",
34
+ "impact",
35
+ "outcome",
36
+ "whyNow",
37
+ "author",
38
+ "message",
39
+ "assignee",
40
+ "parent",
41
+ "reviewer",
42
+ "risk",
43
+ "confidence",
44
+ "sprint",
45
+ "release",
46
+ "blockedBy",
47
+ "blockedReason",
48
+ "unblockNote",
49
+ "reporter",
50
+ "severity",
51
+ "environment",
52
+ "reproSteps",
53
+ "resolution",
54
+ "expectedResult",
55
+ "actualResult",
56
+ "affectedVersion",
57
+ "fixedVersion",
58
+ "component",
59
+ "regression",
60
+ "customerImpact",
61
+ "dep",
62
+ "comment",
63
+ "note",
64
+ "learning",
65
+ "file",
66
+ "test",
67
+ "doc",
68
+ "reminder",
69
+ "event",
70
+ "typeOption",
71
+ ];
72
+ const UPDATE_COMMAND_OPTION_KEYS = [
73
+ "title",
74
+ "description",
75
+ "body",
76
+ "status",
77
+ "closeReason",
78
+ "priority",
79
+ "type",
80
+ "tags",
81
+ "deadline",
82
+ "estimatedMinutes",
83
+ "acceptanceCriteria",
84
+ "definitionOfReady",
85
+ "order",
86
+ "goal",
87
+ "objective",
88
+ "value",
89
+ "impact",
90
+ "outcome",
91
+ "whyNow",
92
+ "author",
93
+ "message",
94
+ "assignee",
95
+ "parent",
96
+ "reviewer",
97
+ "risk",
98
+ "confidence",
99
+ "sprint",
100
+ "release",
101
+ "blockedBy",
102
+ "blockedReason",
103
+ "unblockNote",
104
+ "reporter",
105
+ "severity",
106
+ "environment",
107
+ "reproSteps",
108
+ "resolution",
109
+ "expectedResult",
110
+ "actualResult",
111
+ "affectedVersion",
112
+ "fixedVersion",
113
+ "component",
114
+ "regression",
115
+ "customerImpact",
116
+ "comment",
117
+ "note",
118
+ "learning",
119
+ "file",
120
+ "test",
121
+ "doc",
122
+ "reminder",
123
+ "event",
124
+ "typeOption",
125
+ "allowAuditUpdate",
126
+ "force",
127
+ ];
128
+ const SHARED_COMMAND_OPTION_ALIASES = {
129
+ "close-reason": "closeReason",
130
+ close_reason: "closeReason",
131
+ "estimated-minutes": "estimatedMinutes",
132
+ estimated_minutes: "estimatedMinutes",
133
+ estimate: "estimatedMinutes",
134
+ "acceptance-criteria": "acceptanceCriteria",
135
+ acceptance_criteria: "acceptanceCriteria",
136
+ ac: "acceptanceCriteria",
137
+ "definition-of-ready": "definitionOfReady",
138
+ definition_of_ready: "definitionOfReady",
139
+ rank: "order",
140
+ "why-now": "whyNow",
141
+ why_now: "whyNow",
142
+ "blocked-by": "blockedBy",
143
+ blocked_by: "blockedBy",
144
+ "blocked-reason": "blockedReason",
145
+ blocked_reason: "blockedReason",
146
+ "unblock-note": "unblockNote",
147
+ unblock_note: "unblockNote",
148
+ "repro-steps": "reproSteps",
149
+ repro_steps: "reproSteps",
150
+ "expected-result": "expectedResult",
151
+ expected_result: "expectedResult",
152
+ "actual-result": "actualResult",
153
+ actual_result: "actualResult",
154
+ "affected-version": "affectedVersion",
155
+ affected_version: "affectedVersion",
156
+ "fixed-version": "fixedVersion",
157
+ fixed_version: "fixedVersion",
158
+ "customer-impact": "customerImpact",
159
+ customer_impact: "customerImpact",
160
+ "type-option": "typeOption",
161
+ type_option: "typeOption",
162
+ type_options: "typeOption",
163
+ };
164
+ const CREATE_COMMAND_OPTION_ALIASES = {
165
+ ...SHARED_COMMAND_OPTION_ALIASES,
166
+ };
167
+ const UPDATE_COMMAND_OPTION_ALIASES = {
168
+ ...SHARED_COMMAND_OPTION_ALIASES,
169
+ "allow-audit-update": "allowAuditUpdate",
170
+ allow_audit_update: "allowAuditUpdate",
171
+ };
172
+ const CREATE_COMMAND_OPTION_FLAG_LABELS = {
173
+ title: "--title",
174
+ description: "--description",
175
+ type: "--type",
176
+ status: "--status",
177
+ priority: "--priority",
178
+ tags: "--tags",
179
+ body: "--body",
180
+ deadline: "--deadline",
181
+ estimatedMinutes: "--estimate/--estimated-minutes",
182
+ acceptanceCriteria: "--acceptance-criteria/--ac",
183
+ definitionOfReady: "--definition-of-ready",
184
+ order: "--order/--rank",
185
+ goal: "--goal",
186
+ objective: "--objective",
187
+ value: "--value",
188
+ impact: "--impact",
189
+ outcome: "--outcome",
190
+ whyNow: "--why-now",
191
+ author: "--author",
192
+ message: "--message",
193
+ assignee: "--assignee",
194
+ parent: "--parent",
195
+ reviewer: "--reviewer",
196
+ risk: "--risk",
197
+ confidence: "--confidence",
198
+ sprint: "--sprint",
199
+ release: "--release",
200
+ blockedBy: "--blocked-by",
201
+ blockedReason: "--blocked-reason",
202
+ unblockNote: "--unblock-note",
203
+ reporter: "--reporter",
204
+ severity: "--severity",
205
+ environment: "--environment",
206
+ reproSteps: "--repro-steps",
207
+ resolution: "--resolution",
208
+ expectedResult: "--expected-result",
209
+ actualResult: "--actual-result",
210
+ affectedVersion: "--affected-version",
211
+ fixedVersion: "--fixed-version",
212
+ component: "--component",
213
+ regression: "--regression",
214
+ customerImpact: "--customer-impact",
215
+ dep: "--dep",
216
+ comment: "--comment",
217
+ note: "--note",
218
+ learning: "--learning",
219
+ file: "--file",
220
+ test: "--test",
221
+ doc: "--doc",
222
+ reminder: "--reminder",
223
+ event: "--event",
224
+ typeOption: "--type-option",
225
+ };
226
+ const UPDATE_COMMAND_OPTION_FLAG_LABELS = {
227
+ title: "--title",
228
+ description: "--description",
229
+ body: "--body",
230
+ status: "--status",
231
+ closeReason: "--close-reason",
232
+ priority: "--priority",
233
+ type: "--type",
234
+ tags: "--tags",
235
+ deadline: "--deadline",
236
+ estimatedMinutes: "--estimate/--estimated-minutes",
237
+ acceptanceCriteria: "--acceptance-criteria/--ac",
238
+ definitionOfReady: "--definition-of-ready",
239
+ order: "--order/--rank",
240
+ goal: "--goal",
241
+ objective: "--objective",
242
+ value: "--value",
243
+ impact: "--impact",
244
+ outcome: "--outcome",
245
+ whyNow: "--why-now",
246
+ assignee: "--assignee",
247
+ parent: "--parent",
248
+ reviewer: "--reviewer",
249
+ risk: "--risk",
250
+ confidence: "--confidence",
251
+ sprint: "--sprint",
252
+ release: "--release",
253
+ blockedBy: "--blocked-by",
254
+ blockedReason: "--blocked-reason",
255
+ unblockNote: "--unblock-note",
256
+ reporter: "--reporter",
257
+ severity: "--severity",
258
+ environment: "--environment",
259
+ reproSteps: "--repro-steps",
260
+ resolution: "--resolution",
261
+ expectedResult: "--expected-result",
262
+ actualResult: "--actual-result",
263
+ affectedVersion: "--affected-version",
264
+ fixedVersion: "--fixed-version",
265
+ component: "--component",
266
+ regression: "--regression",
267
+ customerImpact: "--customer-impact",
268
+ comment: "--comment",
269
+ note: "--note",
270
+ learning: "--learning",
271
+ file: "--file",
272
+ test: "--test",
273
+ doc: "--doc",
274
+ reminder: "--reminder",
275
+ event: "--event",
276
+ typeOption: "--type-option",
277
+ allowAuditUpdate: "--allow-audit-update",
278
+ author: "--author",
279
+ message: "--message",
280
+ force: "--force",
281
+ };
282
+ function normalizeList(values) {
283
+ return [...new Set((values ?? []).map((value) => value.trim()).filter((value) => value.length > 0))].sort((left, right) => left.localeCompare(right));
284
+ }
285
+ function normalizeCommandOptionToken(value) {
286
+ return value.trim().replace(/^--+/, "").toLowerCase();
287
+ }
288
+ function commandOptionKeys(command) {
289
+ return command === "create" ? CREATE_COMMAND_OPTION_KEYS : UPDATE_COMMAND_OPTION_KEYS;
290
+ }
291
+ function commandOptionAliases(command) {
292
+ return command === "create" ? CREATE_COMMAND_OPTION_ALIASES : UPDATE_COMMAND_OPTION_ALIASES;
293
+ }
294
+ export function canonicalizeCommandOptionKey(command, rawOption) {
295
+ const normalizedToken = normalizeCommandOptionToken(rawOption);
296
+ if (normalizedToken.length === 0) {
297
+ return undefined;
298
+ }
299
+ const aliased = commandOptionAliases(command)[normalizedToken];
300
+ if (aliased) {
301
+ return aliased;
302
+ }
303
+ return commandOptionKeys(command).find((candidate) => candidate.toLowerCase() === normalizedToken);
304
+ }
305
+ export function commandOptionFlagLabel(command, optionKey) {
306
+ const labels = command === "create" ? CREATE_COMMAND_OPTION_FLAG_LABELS : UPDATE_COMMAND_OPTION_FLAG_LABELS;
307
+ return labels[optionKey] ?? `--${optionKey.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
308
+ }
309
+ function toDefaultFolder(name) {
310
+ const normalized = name
311
+ .trim()
312
+ .toLowerCase()
313
+ .replace(/[^a-z0-9]+/g, "-")
314
+ .replace(/^-+|-+$/g, "");
315
+ if (normalized.length === 0) {
316
+ return "items";
317
+ }
318
+ return normalized.endsWith("s") ? normalized : `${normalized}s`;
319
+ }
320
+ function normalizeOptionDefinition(option) {
321
+ const key = option.key.trim();
322
+ if (key.length === 0) {
323
+ return null;
324
+ }
325
+ return {
326
+ key,
327
+ values: normalizeList(option.values),
328
+ required: option.required === true ? true : undefined,
329
+ aliases: (() => {
330
+ const aliases = normalizeList(option.aliases);
331
+ return aliases.length > 0 ? aliases : undefined;
332
+ })(),
333
+ description: (() => {
334
+ const description = option.description?.trim();
335
+ return description && description.length > 0 ? description : undefined;
336
+ })(),
337
+ };
338
+ }
339
+ function normalizeCommandOptionPolicyDefinition(policy) {
340
+ const normalizedCommand = policy.command.trim().toLowerCase();
341
+ if (normalizedCommand !== "create" && normalizedCommand !== "update") {
342
+ return null;
343
+ }
344
+ const option = policy.option.trim();
345
+ if (option.length === 0) {
346
+ return null;
347
+ }
348
+ return {
349
+ command: normalizedCommand,
350
+ option,
351
+ required: policy.required,
352
+ visible: policy.visible,
353
+ enabled: policy.enabled,
354
+ };
355
+ }
356
+ function normalizeTypeDefinition(definition) {
357
+ const name = definition.name.trim();
358
+ if (name.length === 0) {
359
+ return null;
360
+ }
361
+ const hasRequiredCreateFields = definition.required_create_fields !== undefined;
362
+ const hasRequiredCreateRepeatables = definition.required_create_repeatables !== undefined;
363
+ const hasOptions = definition.options !== undefined;
364
+ const hasCommandOptionPolicies = definition.command_option_policies !== undefined;
365
+ const folder = definition.folder?.trim();
366
+ const options = (definition.options ?? [])
367
+ .map((option) => normalizeOptionDefinition(option))
368
+ .filter((option) => option !== null)
369
+ .sort((left, right) => left.key.localeCompare(right.key));
370
+ const commandOptionPolicies = (() => {
371
+ const dedupedByKey = new Map();
372
+ for (const policy of definition.command_option_policies ?? []) {
373
+ const normalized = normalizeCommandOptionPolicyDefinition(policy);
374
+ if (!normalized) {
375
+ continue;
376
+ }
377
+ dedupedByKey.set(`${normalized.command}:${normalized.option.toLowerCase()}`, normalized);
378
+ }
379
+ return [...dedupedByKey.values()].sort((left, right) => left.command === right.command
380
+ ? left.option.localeCompare(right.option)
381
+ : left.command.localeCompare(right.command));
382
+ })();
383
+ return {
384
+ name,
385
+ folder: folder && folder.length > 0 ? folder : undefined,
386
+ aliases: (() => {
387
+ const aliases = normalizeList(definition.aliases);
388
+ return aliases.length > 0 ? aliases : undefined;
389
+ })(),
390
+ required_create_fields: hasRequiredCreateFields ? normalizeList(definition.required_create_fields) : undefined,
391
+ required_create_repeatables: hasRequiredCreateRepeatables
392
+ ? normalizeList(definition.required_create_repeatables)
393
+ : undefined,
394
+ options: hasOptions ? options : undefined,
395
+ command_option_policies: hasCommandOptionPolicies ? commandOptionPolicies : undefined,
396
+ };
397
+ }
398
+ function coerceTypeDefinitionFromUnknown(raw) {
399
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
400
+ return null;
401
+ }
402
+ const record = raw;
403
+ const name = typeof record.name === "string" ? record.name : "";
404
+ if (name.trim().length === 0) {
405
+ return null;
406
+ }
407
+ const folder = typeof record.folder === "string" ? record.folder : undefined;
408
+ const aliases = Array.isArray(record.aliases) ? record.aliases.filter((value) => typeof value === "string") : undefined;
409
+ const requiredCreateFields = Array.isArray(record.required_create_fields)
410
+ ? record.required_create_fields.filter((value) => typeof value === "string")
411
+ : undefined;
412
+ const requiredCreateRepeatables = Array.isArray(record.required_create_repeatables)
413
+ ? record.required_create_repeatables.filter((value) => typeof value === "string")
414
+ : undefined;
415
+ let options;
416
+ if (Array.isArray(record.options)) {
417
+ options = [];
418
+ for (const entry of record.options) {
419
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
420
+ continue;
421
+ }
422
+ const optionRecord = entry;
423
+ if (typeof optionRecord.key !== "string") {
424
+ continue;
425
+ }
426
+ options.push({
427
+ key: optionRecord.key,
428
+ values: Array.isArray(optionRecord.values)
429
+ ? optionRecord.values.filter((value) => typeof value === "string")
430
+ : [],
431
+ required: optionRecord.required === undefined ? undefined : Boolean(optionRecord.required),
432
+ aliases: Array.isArray(optionRecord.aliases)
433
+ ? optionRecord.aliases.filter((value) => typeof value === "string")
434
+ : undefined,
435
+ description: typeof optionRecord.description === "string" ? optionRecord.description : undefined,
436
+ });
437
+ }
438
+ }
439
+ let commandOptionPolicies;
440
+ if (Array.isArray(record.command_option_policies)) {
441
+ commandOptionPolicies = [];
442
+ for (const entry of record.command_option_policies) {
443
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
444
+ continue;
445
+ }
446
+ const policyRecord = entry;
447
+ if (typeof policyRecord.command !== "string" || typeof policyRecord.option !== "string") {
448
+ continue;
449
+ }
450
+ const normalizedCommand = policyRecord.command.trim().toLowerCase();
451
+ if (normalizedCommand !== "create" && normalizedCommand !== "update") {
452
+ continue;
453
+ }
454
+ commandOptionPolicies.push({
455
+ command: normalizedCommand,
456
+ option: policyRecord.option,
457
+ required: policyRecord.required === undefined ? undefined : Boolean(policyRecord.required),
458
+ visible: policyRecord.visible === undefined ? undefined : Boolean(policyRecord.visible),
459
+ enabled: policyRecord.enabled === undefined ? undefined : Boolean(policyRecord.enabled),
460
+ });
461
+ }
462
+ }
463
+ return {
464
+ name,
465
+ folder,
466
+ aliases,
467
+ required_create_fields: requiredCreateFields,
468
+ required_create_repeatables: requiredCreateRepeatables,
469
+ options,
470
+ command_option_policies: commandOptionPolicies,
471
+ };
472
+ }
473
+ function applyTypeDefinitions(source, target, preserveBuiltinDefaults) {
474
+ for (const rawDefinition of source) {
475
+ const normalizedDefinition = normalizeTypeDefinition(rawDefinition);
476
+ if (!normalizedDefinition) {
477
+ continue;
478
+ }
479
+ const lowerName = normalizedDefinition.name.toLowerCase();
480
+ const existing = target.get(lowerName);
481
+ const keepName = existing?.name ?? normalizedDefinition.name;
482
+ const folder = normalizedDefinition.folder ?? existing?.folder ?? toDefaultFolder(keepName);
483
+ const aliases = normalizeList([...(existing?.aliases ?? []), ...(normalizedDefinition.aliases ?? [])]);
484
+ const requiredCreateFields = normalizedDefinition.required_create_fields
485
+ ? normalizeList(normalizedDefinition.required_create_fields)
486
+ : existing?.required_create_fields ??
487
+ (preserveBuiltinDefaults ? [...DEFAULT_REQUIRED_CREATE_FIELDS] : []);
488
+ const requiredCreateRepeatables = normalizedDefinition.required_create_repeatables
489
+ ? normalizeList(normalizedDefinition.required_create_repeatables)
490
+ : existing?.required_create_repeatables ??
491
+ (preserveBuiltinDefaults ? [...DEFAULT_REQUIRED_CREATE_REPEATABLES] : []);
492
+ const options = normalizedDefinition.options
493
+ ? normalizedDefinition.options
494
+ : existing?.options
495
+ ? [...existing.options]
496
+ : [];
497
+ const commandOptionPolicies = normalizedDefinition.command_option_policies
498
+ ? normalizedDefinition.command_option_policies
499
+ : existing?.command_option_policies
500
+ ? [...existing.command_option_policies]
501
+ : [];
502
+ target.set(lowerName, {
503
+ name: keepName,
504
+ folder,
505
+ aliases,
506
+ required_create_fields: requiredCreateFields,
507
+ required_create_repeatables: requiredCreateRepeatables,
508
+ options,
509
+ command_option_policies: commandOptionPolicies,
510
+ });
511
+ }
512
+ }
513
+ function collectExtensionTypeDefinitions(registrations) {
514
+ if (!registrations) {
515
+ return [];
516
+ }
517
+ const definitions = [];
518
+ for (const registration of registrations.item_types ?? []) {
519
+ const typeDefinitionsRaw = registration.types;
520
+ if (!Array.isArray(typeDefinitionsRaw)) {
521
+ continue;
522
+ }
523
+ for (const rawDefinition of typeDefinitionsRaw) {
524
+ const normalized = coerceTypeDefinitionFromUnknown(rawDefinition);
525
+ if (normalized) {
526
+ definitions.push(normalized);
527
+ }
528
+ }
529
+ }
530
+ return definitions;
531
+ }
532
+ export function resolveItemTypeRegistry(settings, extensionRegistrations = null) {
533
+ const byLowerName = new Map();
534
+ for (const builtin of ITEM_TYPE_VALUES) {
535
+ byLowerName.set(builtin.toLowerCase(), {
536
+ name: builtin,
537
+ folder: TYPE_TO_FOLDER[builtin],
538
+ aliases: [],
539
+ required_create_fields: [...DEFAULT_REQUIRED_CREATE_FIELDS],
540
+ required_create_repeatables: [...DEFAULT_REQUIRED_CREATE_REPEATABLES],
541
+ options: [],
542
+ command_option_policies: [],
543
+ });
544
+ }
545
+ applyTypeDefinitions(settings.item_types?.definitions ?? [], byLowerName, false);
546
+ applyTypeDefinitions(collectExtensionTypeDefinitions(extensionRegistrations), byLowerName, false);
547
+ const definitions = [...byLowerName.values()].sort((left, right) => left.name.localeCompare(right.name));
548
+ const byType = {};
549
+ const aliasToType = {};
550
+ const typeToFolder = {};
551
+ for (const definition of definitions) {
552
+ byType[definition.name] = definition;
553
+ typeToFolder[definition.name] = definition.folder;
554
+ aliasToType[definition.name.toLowerCase()] = definition.name;
555
+ for (const alias of definition.aliases) {
556
+ aliasToType[alias.toLowerCase()] = definition.name;
557
+ }
558
+ }
559
+ const folders = [...new Set(definitions.map((definition) => definition.folder))].sort((left, right) => left.localeCompare(right));
560
+ return {
561
+ types: definitions.map((definition) => definition.name),
562
+ folders,
563
+ type_to_folder: typeToFolder,
564
+ by_type: byType,
565
+ alias_to_type: aliasToType,
566
+ };
567
+ }
568
+ export function resolveTypeName(rawType, registry) {
569
+ if (rawType === undefined) {
570
+ return undefined;
571
+ }
572
+ return registry.alias_to_type[rawType.trim().toLowerCase()];
573
+ }
574
+ export function resolveTypeDefinition(typeName, registry) {
575
+ const resolvedName = resolveTypeName(typeName, registry);
576
+ if (!resolvedName) {
577
+ return undefined;
578
+ }
579
+ return registry.by_type[resolvedName];
580
+ }
581
+ export function resolveCommandOptionPolicyState(typeDefinition, command, baseRequiredOptions) {
582
+ const errors = [];
583
+ const required = new Set();
584
+ const hidden = new Set();
585
+ const disabled = new Set();
586
+ for (const rawBase of baseRequiredOptions) {
587
+ const canonical = canonicalizeCommandOptionKey(command, rawBase);
588
+ if (!canonical) {
589
+ errors.push(`Unsupported base required option "${rawBase}" for command "${command}" on type "${typeDefinition.name}"`);
590
+ continue;
591
+ }
592
+ required.add(canonical);
593
+ }
594
+ for (const policy of typeDefinition.command_option_policies) {
595
+ if (policy.command !== command) {
596
+ continue;
597
+ }
598
+ const canonical = canonicalizeCommandOptionKey(command, policy.option);
599
+ if (!canonical) {
600
+ errors.push(`Unsupported command_option_policies option "${policy.option}" for command "${command}" on type "${typeDefinition.name}"`);
601
+ continue;
602
+ }
603
+ if (policy.required !== undefined) {
604
+ if (policy.required) {
605
+ required.add(canonical);
606
+ }
607
+ else {
608
+ required.delete(canonical);
609
+ }
610
+ }
611
+ if (policy.visible !== undefined) {
612
+ if (policy.visible) {
613
+ hidden.delete(canonical);
614
+ }
615
+ else {
616
+ hidden.add(canonical);
617
+ }
618
+ }
619
+ if (policy.enabled !== undefined) {
620
+ if (policy.enabled) {
621
+ disabled.delete(canonical);
622
+ }
623
+ else {
624
+ disabled.add(canonical);
625
+ }
626
+ }
627
+ }
628
+ for (const option of required) {
629
+ if (disabled.has(option)) {
630
+ errors.push(`Option "${option}" cannot be both required and disabled for command "${command}" on type "${typeDefinition.name}"`);
631
+ }
632
+ }
633
+ return {
634
+ required: [...required],
635
+ hidden: [...hidden].sort((left, right) => left.localeCompare(right)),
636
+ disabled: [...disabled].sort((left, right) => left.localeCompare(right)),
637
+ errors,
638
+ };
639
+ }
640
+ export function validateTypeOptions(typeName, rawTypeOptions, registry) {
641
+ const typeDefinition = resolveTypeDefinition(typeName, registry);
642
+ if (!typeDefinition) {
643
+ return {
644
+ normalized: undefined,
645
+ errors: [`Unknown type "${typeName}"`],
646
+ };
647
+ }
648
+ const errors = [];
649
+ const optionByAlias = new Map();
650
+ for (const option of typeDefinition.options) {
651
+ optionByAlias.set(option.key.toLowerCase(), option);
652
+ for (const alias of option.aliases ?? []) {
653
+ optionByAlias.set(alias.toLowerCase(), option);
654
+ }
655
+ }
656
+ const normalized = {};
657
+ for (const [rawKey, rawValue] of Object.entries(rawTypeOptions ?? {})) {
658
+ const trimmedKey = rawKey.trim();
659
+ const trimmedValue = rawValue.trim();
660
+ if (trimmedKey.length === 0) {
661
+ errors.push("type option keys must not be empty");
662
+ continue;
663
+ }
664
+ if (trimmedValue.length === 0) {
665
+ errors.push(`type option "${trimmedKey}" must not be empty`);
666
+ continue;
667
+ }
668
+ const optionDefinition = optionByAlias.get(trimmedKey.toLowerCase());
669
+ if (!optionDefinition) {
670
+ const allowed = typeDefinition.options.map((option) => option.key).join(", ");
671
+ errors.push(typeDefinition.options.length > 0
672
+ ? `Unknown type option "${trimmedKey}" for type "${typeDefinition.name}". Allowed: ${allowed}`
673
+ : `Type "${typeDefinition.name}" does not define any configurable type options`);
674
+ continue;
675
+ }
676
+ const allowedValues = optionDefinition.values;
677
+ let resolvedValue = trimmedValue;
678
+ if (allowedValues.length > 0) {
679
+ const valueLookup = new Map(allowedValues.map((value) => [value.toLowerCase(), value]));
680
+ const canonical = valueLookup.get(trimmedValue.toLowerCase());
681
+ if (!canonical) {
682
+ errors.push(`Invalid value "${trimmedValue}" for type option "${optionDefinition.key}". Allowed: ${allowedValues.join(", ")}`);
683
+ continue;
684
+ }
685
+ resolvedValue = canonical;
686
+ }
687
+ normalized[optionDefinition.key] = resolvedValue;
688
+ }
689
+ for (const option of typeDefinition.options) {
690
+ if (option.required && !(option.key in normalized)) {
691
+ errors.push(`Missing required type option "${option.key}" for type "${typeDefinition.name}"`);
692
+ }
693
+ }
694
+ const sortedKeys = Object.keys(normalized).sort((left, right) => left.localeCompare(right));
695
+ if (sortedKeys.length === 0) {
696
+ return {
697
+ normalized: undefined,
698
+ errors,
699
+ };
700
+ }
701
+ return {
702
+ normalized: Object.fromEntries(sortedKeys.map((key) => [key, normalized[key]])),
703
+ errors,
704
+ };
705
+ }
706
+ //# sourceMappingURL=type-registry.js.map