@proletariat/cli 0.3.16 → 0.3.18

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 (338) hide show
  1. package/dist/commands/action/create.d.ts +1 -0
  2. package/dist/commands/action/create.js +74 -38
  3. package/dist/commands/action/delete.d.ts +1 -0
  4. package/dist/commands/action/delete.js +23 -24
  5. package/dist/commands/action/index.d.ts +1 -0
  6. package/dist/commands/action/index.js +5 -10
  7. package/dist/commands/action/list.d.ts +1 -0
  8. package/dist/commands/action/list.js +3 -1
  9. package/dist/commands/action/run.d.ts +1 -0
  10. package/dist/commands/action/run.js +44 -32
  11. package/dist/commands/action/show.d.ts +2 -0
  12. package/dist/commands/action/update.d.ts +1 -0
  13. package/dist/commands/action/update.js +80 -39
  14. package/dist/commands/agent/auth.d.ts +2 -0
  15. package/dist/commands/agent/auth.js +44 -3
  16. package/dist/commands/agent/discover.d.ts +2 -0
  17. package/dist/commands/agent/discover.js +35 -3
  18. package/dist/commands/agent/index.d.ts +1 -0
  19. package/dist/commands/agent/index.js +25 -45
  20. package/dist/commands/agent/list.d.ts +8 -3
  21. package/dist/commands/agent/list.js +16 -29
  22. package/dist/commands/agent/login.d.ts +1 -0
  23. package/dist/commands/agent/login.js +14 -32
  24. package/dist/commands/agent/rebuild.d.ts +1 -0
  25. package/dist/commands/agent/rebuild.js +2 -2
  26. package/dist/commands/agent/remove.d.ts +17 -0
  27. package/dist/commands/agent/remove.js +144 -0
  28. package/dist/commands/agent/restart.d.ts +1 -0
  29. package/dist/commands/agent/restart.js +2 -2
  30. package/dist/commands/agent/shell.d.ts +1 -0
  31. package/dist/commands/agent/shell.js +63 -76
  32. package/dist/commands/agent/staff/add.d.ts +1 -0
  33. package/dist/commands/agent/staff/add.js +7 -1
  34. package/dist/commands/agent/staff/index.d.ts +1 -0
  35. package/dist/commands/agent/staff/index.js +5 -4
  36. package/dist/commands/agent/staff/remove.d.ts +1 -0
  37. package/dist/commands/agent/status.d.ts +1 -0
  38. package/dist/commands/agent/status.js +11 -23
  39. package/dist/commands/agent/temp/cleanup.d.ts +1 -0
  40. package/dist/commands/agent/temp/index.d.ts +1 -0
  41. package/dist/commands/agent/temp/index.js +4 -3
  42. package/dist/commands/agent/themes/index.d.ts +1 -0
  43. package/dist/commands/agent/themes/index.js +9 -3
  44. package/dist/commands/agent/themes/set.d.ts +1 -0
  45. package/dist/commands/agent/themes/set.js +7 -1
  46. package/dist/commands/agent/visit.d.ts +1 -0
  47. package/dist/commands/agent/visit.js +11 -23
  48. package/dist/commands/autocomplete/setup.d.ts +11 -0
  49. package/dist/commands/autocomplete/setup.js +113 -8
  50. package/dist/commands/board/index.d.ts +4 -0
  51. package/dist/commands/board/index.js +32 -30
  52. package/dist/commands/board/watch.d.ts +2 -0
  53. package/dist/commands/branch/create.d.ts +1 -0
  54. package/dist/commands/branch/create.js +33 -41
  55. package/dist/commands/branch/index.d.ts +1 -0
  56. package/dist/commands/branch/list.d.ts +2 -0
  57. package/dist/commands/branch/validate.d.ts +2 -0
  58. package/dist/commands/branch/where.d.ts +1 -0
  59. package/dist/commands/claude.d.ts +6 -0
  60. package/dist/commands/claude.js +166 -116
  61. package/dist/commands/commit.d.ts +6 -0
  62. package/dist/commands/commit.js +68 -73
  63. package/dist/commands/config/index.d.ts +13 -0
  64. package/dist/commands/config/index.js +142 -98
  65. package/dist/commands/docker/clean.d.ts +2 -1
  66. package/dist/commands/docker/clean.js +20 -29
  67. package/dist/commands/docker/index.d.ts +1 -0
  68. package/dist/commands/docker/index.js +37 -41
  69. package/dist/commands/docker/prune.d.ts +2 -1
  70. package/dist/commands/docker/prune.js +20 -27
  71. package/dist/commands/docker/restart.d.ts +2 -1
  72. package/dist/commands/docker/restart.js +20 -29
  73. package/dist/commands/docker/stop.d.ts +2 -1
  74. package/dist/commands/docker/stop.js +20 -29
  75. package/dist/commands/epic/activate.d.ts +1 -0
  76. package/dist/commands/epic/archive.d.ts +1 -0
  77. package/dist/commands/epic/create.d.ts +1 -0
  78. package/dist/commands/epic/index.d.ts +1 -0
  79. package/dist/commands/epic/link/block.d.ts +1 -0
  80. package/dist/commands/epic/link/duplicates.d.ts +1 -0
  81. package/dist/commands/epic/link/index.d.ts +1 -0
  82. package/dist/commands/epic/link/relates.d.ts +1 -0
  83. package/dist/commands/epic/link/remove.d.ts +1 -0
  84. package/dist/commands/epic/list.d.ts +2 -0
  85. package/dist/commands/epic/move.d.ts +1 -0
  86. package/dist/commands/epic/progress.d.ts +1 -0
  87. package/dist/commands/epic/project.d.ts +1 -0
  88. package/dist/commands/epic/reorder.d.ts +1 -0
  89. package/dist/commands/epic/spec.d.ts +1 -0
  90. package/dist/commands/epic/ticket.d.ts +1 -0
  91. package/dist/commands/epic/view.d.ts +1 -0
  92. package/dist/commands/execution/index.d.ts +1 -0
  93. package/dist/commands/execution/index.js +9 -25
  94. package/dist/commands/execution/list.d.ts +2 -0
  95. package/dist/commands/execution/logs.d.ts +1 -0
  96. package/dist/commands/execution/logs.js +6 -16
  97. package/dist/commands/execution/stop.d.ts +1 -0
  98. package/dist/commands/execution/stop.js +4 -15
  99. package/dist/commands/gh/index.d.ts +1 -0
  100. package/dist/commands/gh/index.js +27 -27
  101. package/dist/commands/gh/login.d.ts +4 -0
  102. package/dist/commands/gh/login.js +31 -0
  103. package/dist/commands/gh/status.d.ts +4 -0
  104. package/dist/commands/gh/status.js +27 -4
  105. package/dist/commands/gh/token.d.ts +4 -0
  106. package/dist/commands/gh/token.js +49 -5
  107. package/dist/commands/phase/create.d.ts +1 -1
  108. package/dist/commands/phase/create.js +116 -74
  109. package/dist/commands/phase/delete.d.ts +1 -0
  110. package/dist/commands/phase/delete.js +23 -22
  111. package/dist/commands/phase/list.d.ts +1 -0
  112. package/dist/commands/phase/list.js +3 -5
  113. package/dist/commands/phase/move.d.ts +1 -0
  114. package/dist/commands/phase/move.js +39 -39
  115. package/dist/commands/phase/template/apply.d.ts +1 -0
  116. package/dist/commands/phase/template/create.d.ts +2 -0
  117. package/dist/commands/phase/template/delete.d.ts +1 -0
  118. package/dist/commands/phase/template/index.d.ts +1 -0
  119. package/dist/commands/phase/template/list.d.ts +1 -0
  120. package/dist/commands/phase/template/update.d.ts +2 -0
  121. package/dist/commands/phase/update.d.ts +1 -1
  122. package/dist/commands/phase/update.js +89 -55
  123. package/dist/commands/pmo/init.d.ts +2 -0
  124. package/dist/commands/pmo/init.js +84 -22
  125. package/dist/commands/pr/create.d.ts +12 -3
  126. package/dist/commands/pr/create.js +130 -147
  127. package/dist/commands/pr/index.d.ts +6 -3
  128. package/dist/commands/pr/index.js +41 -39
  129. package/dist/commands/pr/link.d.ts +7 -3
  130. package/dist/commands/pr/link.js +126 -150
  131. package/dist/commands/pr/status.d.ts +6 -3
  132. package/dist/commands/pr/status.js +101 -126
  133. package/dist/commands/project/archive.d.ts +1 -0
  134. package/dist/commands/project/archive.js +15 -20
  135. package/dist/commands/project/create.d.ts +1 -0
  136. package/dist/commands/project/create.js +13 -5
  137. package/dist/commands/project/delete.d.ts +1 -0
  138. package/dist/commands/project/delete.js +14 -28
  139. package/dist/commands/project/index.d.ts +1 -0
  140. package/dist/commands/project/index.js +0 -5
  141. package/dist/commands/project/list.d.ts +2 -0
  142. package/dist/commands/project/list.js +21 -3
  143. package/dist/commands/project/spec.d.ts +1 -0
  144. package/dist/commands/project/spec.js +17 -23
  145. package/dist/commands/project/unarchive.d.ts +2 -0
  146. package/dist/commands/project/unarchive.js +21 -2
  147. package/dist/commands/project/view.d.ts +1 -0
  148. package/dist/commands/project/view.js +34 -22
  149. package/dist/commands/repo/add.d.ts +2 -0
  150. package/dist/commands/repo/add.js +44 -1
  151. package/dist/commands/repo/index.d.ts +1 -0
  152. package/dist/commands/repo/index.js +20 -38
  153. package/dist/commands/repo/list.d.ts +2 -0
  154. package/dist/commands/repo/remove.d.ts +1 -0
  155. package/dist/commands/repo/remove.js +45 -63
  156. package/dist/commands/repo/view.d.ts +2 -0
  157. package/dist/commands/repo/view.js +30 -5
  158. package/dist/commands/roadmap/add-project.d.ts +1 -0
  159. package/dist/commands/roadmap/create.d.ts +1 -0
  160. package/dist/commands/roadmap/delete.d.ts +1 -0
  161. package/dist/commands/roadmap/generate.d.ts +1 -0
  162. package/dist/commands/roadmap/index.d.ts +1 -0
  163. package/dist/commands/roadmap/list.d.ts +2 -0
  164. package/dist/commands/roadmap/remove-project.d.ts +1 -0
  165. package/dist/commands/roadmap/reorder.d.ts +1 -0
  166. package/dist/commands/roadmap/update.d.ts +1 -0
  167. package/dist/commands/roadmap/view.d.ts +1 -0
  168. package/dist/commands/session/attach.d.ts +1 -0
  169. package/dist/commands/session/index.d.ts +1 -0
  170. package/dist/commands/session/index.js +8 -25
  171. package/dist/commands/session/list.d.ts +2 -0
  172. package/dist/commands/spec/create.d.ts +1 -1
  173. package/dist/commands/spec/create.js +64 -65
  174. package/dist/commands/spec/index.d.ts +1 -0
  175. package/dist/commands/spec/index.js +36 -22
  176. package/dist/commands/spec/link/depends.d.ts +1 -0
  177. package/dist/commands/spec/link/depends.js +6 -6
  178. package/dist/commands/spec/link/duplicates.d.ts +1 -0
  179. package/dist/commands/spec/link/duplicates.js +6 -6
  180. package/dist/commands/spec/link/index.d.ts +2 -1
  181. package/dist/commands/spec/link/index.js +0 -4
  182. package/dist/commands/spec/link/relates.d.ts +1 -0
  183. package/dist/commands/spec/link/relates.js +6 -6
  184. package/dist/commands/spec/link/remove.d.ts +2 -1
  185. package/dist/commands/spec/link/remove.js +6 -6
  186. package/dist/commands/spec/list.d.ts +2 -0
  187. package/dist/commands/spec/list.js +25 -0
  188. package/dist/commands/spec/plan.d.ts +2 -1
  189. package/dist/commands/spec/plan.js +19 -26
  190. package/dist/commands/spec/ticket.d.ts +2 -1
  191. package/dist/commands/spec/ticket.js +48 -34
  192. package/dist/commands/spec/view.d.ts +2 -1
  193. package/dist/commands/spec/view.js +25 -16
  194. package/dist/commands/status/create.d.ts +1 -1
  195. package/dist/commands/status/create.js +80 -64
  196. package/dist/commands/status/delete.d.ts +2 -1
  197. package/dist/commands/status/delete.js +26 -22
  198. package/dist/commands/status/index.d.ts +1 -0
  199. package/dist/commands/status/index.js +26 -19
  200. package/dist/commands/status/list.d.ts +1 -0
  201. package/dist/commands/status/list.js +12 -7
  202. package/dist/commands/status/move.d.ts +2 -1
  203. package/dist/commands/status/move.js +62 -61
  204. package/dist/commands/status/update.d.ts +2 -2
  205. package/dist/commands/status/update.js +110 -77
  206. package/dist/commands/template/delete.d.ts +1 -0
  207. package/dist/commands/template/delete.js +47 -48
  208. package/dist/commands/template/index.d.ts +1 -0
  209. package/dist/commands/template/index.js +26 -33
  210. package/dist/commands/template/list.d.ts +1 -0
  211. package/dist/commands/template/phase/create.d.ts +1 -0
  212. package/dist/commands/template/phase/create.js +6 -0
  213. package/dist/commands/template/phase/index.d.ts +1 -0
  214. package/dist/commands/template/phase/index.js +27 -26
  215. package/dist/commands/template/phase/update.d.ts +1 -0
  216. package/dist/commands/template/phase/update.js +6 -0
  217. package/dist/commands/template/ticket/index.d.ts +1 -0
  218. package/dist/commands/template/ticket/index.js +27 -26
  219. package/dist/commands/template/ticket/save.d.ts +1 -0
  220. package/dist/commands/template/ticket/save.js +6 -0
  221. package/dist/commands/terminal/title.d.ts +26 -0
  222. package/dist/commands/terminal/title.js +37 -3
  223. package/dist/commands/ticket/bulk.d.ts +1 -0
  224. package/dist/commands/ticket/complete.d.ts +1 -0
  225. package/dist/commands/ticket/complete.js +18 -14
  226. package/dist/commands/ticket/create.d.ts +1 -0
  227. package/dist/commands/ticket/create.js +45 -41
  228. package/dist/commands/ticket/delete.d.ts +1 -0
  229. package/dist/commands/ticket/delete.js +1 -1
  230. package/dist/commands/ticket/edit.d.ts +1 -0
  231. package/dist/commands/ticket/edit.js +1 -1
  232. package/dist/commands/ticket/epic.d.ts +1 -0
  233. package/dist/commands/ticket/epic.js +2 -2
  234. package/dist/commands/ticket/index.d.ts +1 -0
  235. package/dist/commands/ticket/link/block.d.ts +1 -0
  236. package/dist/commands/ticket/link/block.js +1 -1
  237. package/dist/commands/ticket/link/duplicates.d.ts +1 -0
  238. package/dist/commands/ticket/link/duplicates.js +1 -1
  239. package/dist/commands/ticket/link/index.d.ts +1 -0
  240. package/dist/commands/ticket/link/index.js +9 -8
  241. package/dist/commands/ticket/link/relates.d.ts +1 -0
  242. package/dist/commands/ticket/link/relates.js +1 -1
  243. package/dist/commands/ticket/link/remove.d.ts +1 -0
  244. package/dist/commands/ticket/link/remove.js +1 -1
  245. package/dist/commands/ticket/list.d.ts +2 -0
  246. package/dist/commands/ticket/move.d.ts +1 -0
  247. package/dist/commands/ticket/move.js +27 -19
  248. package/dist/commands/ticket/project.d.ts +1 -0
  249. package/dist/commands/ticket/project.js +3 -3
  250. package/dist/commands/ticket/reassign.d.ts +1 -0
  251. package/dist/commands/ticket/reassign.js +1 -1
  252. package/dist/commands/ticket/spec.d.ts +1 -0
  253. package/dist/commands/ticket/spec.js +3 -3
  254. package/dist/commands/ticket/status.d.ts +1 -0
  255. package/dist/commands/ticket/status.js +1 -1
  256. package/dist/commands/ticket/template/apply.d.ts +1 -0
  257. package/dist/commands/ticket/template/create.d.ts +2 -0
  258. package/dist/commands/ticket/template/delete.d.ts +1 -0
  259. package/dist/commands/ticket/template/index.d.ts +1 -0
  260. package/dist/commands/ticket/template/list.d.ts +1 -0
  261. package/dist/commands/ticket/template/save.d.ts +2 -0
  262. package/dist/commands/ticket/update.d.ts +1 -0
  263. package/dist/commands/ticket/update.js +1 -1
  264. package/dist/commands/ticket/view.d.ts +1 -0
  265. package/dist/commands/ticket/view.js +1 -1
  266. package/dist/commands/work/complete.d.ts +1 -0
  267. package/dist/commands/work/index.d.ts +1 -0
  268. package/dist/commands/work/ready.d.ts +1 -0
  269. package/dist/commands/work/revise.d.ts +1 -0
  270. package/dist/commands/work/spawn-all.d.ts +2 -0
  271. package/dist/commands/work/spawn-all.js +11 -4
  272. package/dist/commands/work/spawn.d.ts +1 -0
  273. package/dist/commands/work/spawn.js +261 -166
  274. package/dist/commands/work/start.d.ts +1 -0
  275. package/dist/commands/work/start.js +270 -189
  276. package/dist/commands/work/watch.d.ts +1 -0
  277. package/dist/commands/work/watch.js +63 -58
  278. package/dist/commands/workflow/create.d.ts +1 -0
  279. package/dist/commands/workflow/create.js +2 -4
  280. package/dist/commands/workflow/delete.d.ts +1 -0
  281. package/dist/commands/workflow/delete.js +21 -33
  282. package/dist/commands/workflow/index.d.ts +1 -0
  283. package/dist/commands/workflow/list.d.ts +1 -0
  284. package/dist/commands/workflow/list.js +3 -6
  285. package/dist/commands/workflow/switch.d.ts +2 -0
  286. package/dist/commands/workflow/switch.js +46 -21
  287. package/dist/commands/workflow/view.d.ts +1 -0
  288. package/dist/commands/workflow/view.js +18 -27
  289. package/dist/commands/workspace/remove.d.ts +2 -2
  290. package/dist/commands/workspace/remove.js +16 -21
  291. package/dist/commands/workspace/use.d.ts +2 -2
  292. package/dist/commands/workspace/use.js +12 -18
  293. package/dist/lib/agents/commands.d.ts +1 -1
  294. package/dist/lib/agents/commands.js +4 -4
  295. package/dist/lib/database/drizzle-schema.d.ts +5009 -0
  296. package/dist/lib/database/drizzle-schema.js +699 -0
  297. package/dist/lib/database/drizzle.d.ts +29 -0
  298. package/dist/lib/database/drizzle.js +37 -0
  299. package/dist/lib/database/index.d.ts +1 -0
  300. package/dist/lib/database/index.js +1 -1
  301. package/dist/lib/execution/config.d.ts +6 -0
  302. package/dist/lib/execution/config.js +31 -13
  303. package/dist/lib/execution/devcontainer.js +13 -7
  304. package/dist/lib/execution/runners.js +24 -7
  305. package/dist/lib/execution/spawner.js +19 -0
  306. package/dist/lib/flags/index.d.ts +4 -0
  307. package/dist/lib/flags/index.js +4 -0
  308. package/dist/lib/flags/resolver.d.ts +224 -0
  309. package/dist/lib/flags/resolver.js +313 -0
  310. package/dist/lib/pmo/base-command.d.ts +53 -3
  311. package/dist/lib/pmo/base-command.js +92 -13
  312. package/dist/lib/pmo/find-pmo.d.ts +1 -1
  313. package/dist/lib/pmo/find-pmo.js +4 -4
  314. package/dist/lib/pmo/index.d.ts +1 -1
  315. package/dist/lib/pmo/index.js +1 -1
  316. package/dist/lib/pmo/storage/helpers.js +2 -1
  317. package/dist/lib/pmo/storage/index.d.ts +9 -0
  318. package/dist/lib/pmo/storage/index.js +14 -0
  319. package/dist/lib/pmo/storage/projects.d.ts +28 -13
  320. package/dist/lib/pmo/storage/projects.js +110 -34
  321. package/dist/lib/pmo/storage/roadmaps.d.ts +2 -0
  322. package/dist/lib/pmo/storage/roadmaps.js +182 -111
  323. package/dist/lib/pmo/storage/specs.js +13 -16
  324. package/dist/lib/pmo/storage/subtasks.js +17 -2
  325. package/dist/lib/pmo/storage/tickets.d.ts +12 -2
  326. package/dist/lib/pmo/storage/tickets.js +63 -5
  327. package/dist/lib/pmo/storage/types.d.ts +7 -3
  328. package/dist/lib/pmo/storage/views.d.ts +12 -1
  329. package/dist/lib/pmo/storage/views.js +61 -6
  330. package/dist/lib/prompt-command.d.ts +90 -0
  331. package/dist/lib/prompt-command.js +102 -0
  332. package/dist/lib/prompt-json.d.ts +34 -4
  333. package/dist/lib/prompt-json.js +35 -3
  334. package/dist/lib/repos/index.js +15 -15
  335. package/dist/lib/workspace.d.ts +4 -3
  336. package/dist/lib/workspace.js +3 -3
  337. package/oclif.manifest.json +4610 -2997
  338. package/package.json +13 -5
@@ -1,8 +1,8 @@
1
1
  import { Flags, Args } from '@oclif/core';
2
- import inquirer from 'inquirer';
3
2
  import { PMOCommand, pmoBaseFlags } from '../../lib/pmo/index.js';
4
3
  import { styles } from '../../lib/styles.js';
5
- import { shouldOutputJson, outputPromptAsJson, outputErrorAsJson, createMetadata, buildPromptConfig, } from '../../lib/prompt-json.js';
4
+ import { FlagResolver, shouldOutputJson } from '../../lib/flags/index.js';
5
+ import { outputErrorAsJson, createMetadata, } from '../../lib/prompt-json.js';
6
6
  export default class StatusMove extends PMOCommand {
7
7
  static description = 'Reorder a status within its category';
8
8
  static examples = [
@@ -18,10 +18,6 @@ export default class StatusMove extends PMOCommand {
18
18
  };
19
19
  static flags = {
20
20
  ...pmoBaseFlags,
21
- json: Flags.boolean({
22
- description: 'Output prompt configuration as JSON (for AI agents/scripts)',
23
- default: false,
24
- }),
25
21
  position: Flags.integer({
26
22
  char: 'p',
27
23
  description: 'New position (0-indexed) within the category',
@@ -30,10 +26,16 @@ export default class StatusMove extends PMOCommand {
30
26
  };
31
27
  async execute() {
32
28
  const { args, flags } = await this.parse(StatusMove);
33
- // This command requires project context
34
- const projectId = await this.requireProject();
35
29
  // Check if JSON output mode is active
36
30
  const jsonMode = shouldOutputJson(flags);
31
+ // This command requires project context - get projectId (with JSON mode support)
32
+ const projectId = await this.requireProject({
33
+ jsonMode: jsonMode ? {
34
+ flags,
35
+ commandName: 'status move',
36
+ baseCommand: 'prlt status move',
37
+ } : undefined,
38
+ });
37
39
  // Helper to handle errors in JSON mode
38
40
  const handleError = (code, message) => {
39
41
  if (jsonMode) {
@@ -47,65 +49,64 @@ export default class StatusMove extends PMOCommand {
47
49
  if (!project?.workflowId) {
48
50
  return handleError('NO_WORKFLOW', `Project "${projectId}" has no workflow assigned.`);
49
51
  }
50
- // Get status ID - prompt if not provided
51
- let statusId = args.id;
52
- if (!statusId) {
53
- const statuses = await this.storage.listStatuses(project.workflowId);
54
- if (statuses.length === 0) {
55
- return handleError('NO_STATUSES', 'No statuses found. Create a status first with "prlt status create".');
56
- }
57
- // In JSON mode, output status selection prompt
58
- if (jsonMode) {
59
- const statusChoices = statuses.map(s => ({
60
- name: `${s.name} (${s.category}, position ${s.position})`,
61
- value: s.id,
62
- }));
63
- outputPromptAsJson(buildPromptConfig('list', 'id', 'Select status to move:', statusChoices), createMetadata('status move', flags));
64
- return;
65
- }
66
- const { selectedId } = await inquirer.prompt([{
67
- type: 'list',
68
- name: 'selectedId',
69
- message: 'Select status to move:',
70
- choices: statuses.map(s => ({
71
- name: `${s.name} (${s.category}, position ${s.position})`,
72
- value: s.id,
73
- })),
74
- }]);
75
- statusId = selectedId;
52
+ // Get all statuses for this workflow
53
+ const statuses = await this.storage.listStatuses(project.workflowId);
54
+ if (statuses.length === 0) {
55
+ return handleError('NO_STATUSES', 'No statuses found. Create a status first with "prlt status create".');
76
56
  }
57
+ // Create FlagResolver for prompts
58
+ const resolver = new FlagResolver({
59
+ commandName: 'status move',
60
+ baseCommand: 'prlt status move',
61
+ jsonMode,
62
+ flags: { ...flags, id: args.id },
63
+ context: { projectId },
64
+ });
65
+ // Add status selection prompt
66
+ resolver.addPrompt({
67
+ flagName: 'id',
68
+ type: 'list',
69
+ message: 'Select status to move:',
70
+ choices: () => statuses.map(s => ({
71
+ name: `${s.name} (${s.category}, position ${s.position})`,
72
+ value: s.id,
73
+ command: `prlt status move ${s.id} --machine`,
74
+ })),
75
+ when: (ctx) => !ctx.flags.id,
76
+ });
77
+ // Resolve status ID
78
+ const resolved = await resolver.resolve();
79
+ const statusId = resolved.id;
77
80
  // Get existing status
78
81
  const existing = await this.storage.getStatus(statusId);
79
82
  if (!existing) {
80
83
  return handleError('STATUS_NOT_FOUND', `Status not found: ${statusId}`);
81
84
  }
82
- // Get position - prompt if not provided
83
- let newPosition = flags.position;
84
- if (newPosition === undefined) {
85
- // Get statuses in the same category to show valid positions
86
- const statuses = await this.storage.listStatuses(project.workflowId);
87
- const categoryStatuses = statuses.filter(s => s.category === existing.category);
88
- // In JSON mode, output position selection prompt
89
- if (jsonMode) {
90
- const positionChoices = categoryStatuses.map((_, idx) => ({
91
- name: `Position ${idx}${idx === existing.position ? ' (current)' : ''}`,
92
- value: String(idx),
93
- }));
94
- outputPromptAsJson(buildPromptConfig('list', 'position', `New position within ${existing.category} (currently ${existing.position}):`, positionChoices), createMetadata('status move', flags));
95
- return;
96
- }
97
- const { position } = await inquirer.prompt([{
98
- type: 'list',
99
- name: 'position',
100
- message: `New position within ${existing.category} (currently ${existing.position}):`,
101
- choices: categoryStatuses.map((_, idx) => ({
102
- name: `Position ${idx}${idx === existing.position ? ' (current)' : ''}`,
103
- value: idx,
104
- })),
105
- default: existing.position,
106
- }]);
107
- newPosition = position;
108
- }
85
+ // Get statuses in the same category for position selection
86
+ const categoryStatuses = statuses.filter(s => s.category === existing.category);
87
+ // Create second resolver for position (needs status context)
88
+ const positionResolver = new FlagResolver({
89
+ commandName: 'status move',
90
+ baseCommand: 'prlt status move',
91
+ jsonMode,
92
+ flags: { ...flags, id: statusId },
93
+ context: { projectId, statusId, existing },
94
+ });
95
+ // Add position selection prompt
96
+ positionResolver.addPrompt({
97
+ flagName: 'position',
98
+ type: 'list',
99
+ message: `New position within ${existing.category} (currently ${existing.position}):`,
100
+ choices: () => categoryStatuses.map((_, idx) => ({
101
+ name: `Position ${idx}${idx === existing.position ? ' (current)' : ''}`,
102
+ value: idx,
103
+ command: `prlt status move ${statusId} --position ${idx} --machine`,
104
+ })),
105
+ when: (ctx) => ctx.flags.position === undefined,
106
+ });
107
+ // Resolve position
108
+ const positionResolved = await positionResolver.resolve();
109
+ const newPosition = positionResolved.position;
109
110
  if (newPosition < 0) {
110
111
  this.error('Position must be >= 0');
111
112
  }
@@ -6,15 +6,15 @@ export default class StatusUpdate extends PMOCommand {
6
6
  id: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
7
7
  };
8
8
  static flags: {
9
- json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
9
  name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
10
  category: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
11
  color: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
12
  description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
13
  default: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
14
  interactive: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
+ machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
17
  project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
18
  };
18
19
  execute(): Promise<void>;
19
- private promptChanges;
20
20
  }
@@ -1,9 +1,9 @@
1
1
  import { Flags, Args } from '@oclif/core';
2
- import inquirer from 'inquirer';
3
2
  import { PMOCommand, pmoBaseFlags } from '../../lib/pmo/index.js';
4
3
  import { styles } from '../../lib/styles.js';
5
4
  import { STATE_CATEGORY_ORDER } from '../../lib/pmo/types.js';
6
- import { shouldOutputJson, outputPromptAsJson, outputErrorAsJson, createMetadata, buildPromptConfig, buildFormPromptConfig, } from '../../lib/prompt-json.js';
5
+ import { FlagResolver, shouldOutputJson } from '../../lib/flags/index.js';
6
+ import { outputErrorAsJson, createMetadata, } from '../../lib/prompt-json.js';
7
7
  export default class StatusUpdate extends PMOCommand {
8
8
  static description = 'Update a workflow status';
9
9
  static examples = [
@@ -20,10 +20,6 @@ export default class StatusUpdate extends PMOCommand {
20
20
  };
21
21
  static flags = {
22
22
  ...pmoBaseFlags,
23
- json: Flags.boolean({
24
- description: 'Output prompt configuration as JSON (for AI agents/scripts)',
25
- default: false,
26
- }),
27
23
  name: Flags.string({
28
24
  char: 'n',
29
25
  description: 'New status name',
@@ -52,10 +48,16 @@ export default class StatusUpdate extends PMOCommand {
52
48
  };
53
49
  async execute() {
54
50
  const { args, flags } = await this.parse(StatusUpdate);
55
- // This command requires project context
56
- const projectId = await this.requireProject();
57
51
  // Check if JSON output mode is active
58
52
  const jsonMode = shouldOutputJson(flags);
53
+ // This command requires project context - get projectId (with JSON mode support)
54
+ const projectId = await this.requireProject({
55
+ jsonMode: jsonMode ? {
56
+ flags,
57
+ commandName: 'status update',
58
+ baseCommand: 'prlt status update',
59
+ } : undefined,
60
+ });
59
61
  // Helper to handle errors in JSON mode
60
62
  const handleError = (code, message) => {
61
63
  if (jsonMode) {
@@ -69,62 +71,120 @@ export default class StatusUpdate extends PMOCommand {
69
71
  if (!project?.workflowId) {
70
72
  return handleError('NO_WORKFLOW', `Project "${projectId}" has no workflow assigned.`);
71
73
  }
72
- // Get status ID - prompt if not provided
73
- let statusId = args.id;
74
- if (!statusId) {
75
- const statuses = await this.storage.listStatuses(project.workflowId);
76
- if (statuses.length === 0) {
77
- return handleError('NO_STATUSES', 'No statuses found. Create a status first with "prlt status create".');
78
- }
79
- // In JSON mode, output status selection prompt
80
- if (jsonMode) {
81
- const statusChoices = statuses.map(s => ({
82
- name: `${s.name} (${s.category})`,
83
- value: s.id,
84
- }));
85
- outputPromptAsJson(buildPromptConfig('list', 'id', 'Select status to update:', statusChoices), createMetadata('status update', flags));
86
- return;
87
- }
88
- const { selectedId } = await inquirer.prompt([{
89
- type: 'list',
90
- name: 'selectedId',
91
- message: 'Select status to update:',
92
- choices: statuses.map(s => ({
93
- name: `${s.name} (${s.category})`,
94
- value: s.id,
95
- })),
96
- }]);
97
- statusId = selectedId;
74
+ // Get all statuses for this workflow
75
+ const statuses = await this.storage.listStatuses(project.workflowId);
76
+ if (statuses.length === 0) {
77
+ return handleError('NO_STATUSES', 'No statuses found. Create a status first with "prlt status create".');
98
78
  }
79
+ // Create FlagResolver for status selection
80
+ const resolver = new FlagResolver({
81
+ commandName: 'status update',
82
+ baseCommand: 'prlt status update',
83
+ jsonMode,
84
+ flags: { ...flags, id: args.id, category: flags.category },
85
+ context: { projectId },
86
+ });
87
+ // Add status selection prompt
88
+ resolver.addPrompt({
89
+ flagName: 'id',
90
+ type: 'list',
91
+ message: 'Select status to update:',
92
+ choices: () => statuses.map(s => ({
93
+ name: `${s.name} (${s.category})`,
94
+ value: s.id,
95
+ command: `prlt status update ${s.id} --machine`,
96
+ })),
97
+ when: (ctx) => !ctx.flags.id,
98
+ });
99
+ // Resolve status ID
100
+ const resolved = await resolver.resolve();
101
+ const statusId = resolved.id;
99
102
  // Get existing status
100
103
  const existing = await this.storage.getStatus(statusId);
101
104
  if (!existing) {
102
105
  return handleError('STATUS_NOT_FOUND', `Status not found: ${statusId}`);
103
106
  }
104
- let changes;
105
107
  // Check if any change flags were provided
106
108
  const hasChangeFlags = flags.name !== undefined ||
107
109
  flags.category !== undefined ||
108
110
  flags.color !== undefined ||
109
111
  flags.description !== undefined ||
110
112
  flags.default !== undefined;
113
+ let changes;
111
114
  // Auto-enter interactive mode if no change flags provided
112
115
  if (flags.interactive || !hasChangeFlags) {
113
- // Build choices once - single source of truth
114
- const categoryChoices = STATE_CATEGORY_ORDER.map(cat => ({ name: cat, value: cat }));
115
- // Define fields once - single source of truth for both JSON and interactive modes
116
- const fields = [
117
- { type: 'input', name: 'name', message: 'Status name:', default: existing.name },
118
- { type: 'list', name: 'category', message: 'Category:', choices: categoryChoices, default: existing.category },
119
- { type: 'input', name: 'color', message: 'Color (hex, optional):', default: existing.color || '' },
120
- { type: 'input', name: 'description', message: 'Description (optional):', default: existing.description || '' },
121
- { type: 'confirm', name: 'isDefault', message: 'Set as default status for new tickets?', default: existing.isDefault || false },
122
- ];
123
- // In JSON mode, output form prompts
124
- if (jsonMode) {
125
- outputPromptAsJson(buildFormPromptConfig(fields), createMetadata('status update', flags));
126
- }
127
- changes = await this.promptChanges(fields, existing);
116
+ // Create FlagResolver for field updates
117
+ const updateResolver = new FlagResolver({
118
+ commandName: 'status update',
119
+ baseCommand: `prlt status update ${statusId}`,
120
+ jsonMode,
121
+ flags: { ...flags, id: statusId, category: flags.category },
122
+ context: { projectId, statusId, existing },
123
+ });
124
+ // Add prompts for each field
125
+ updateResolver.addPrompt({
126
+ flagName: 'name',
127
+ type: 'input',
128
+ message: 'Status name:',
129
+ default: existing.name,
130
+ validate: (value) => value.length > 0 || 'Name is required',
131
+ when: (ctx) => ctx.flags.name === undefined,
132
+ });
133
+ updateResolver.addPrompt({
134
+ flagName: 'category',
135
+ type: 'list',
136
+ message: 'Category:',
137
+ choices: () => STATE_CATEGORY_ORDER.map(cat => ({
138
+ name: cat,
139
+ value: cat,
140
+ command: `prlt status update ${statusId} --category ${cat} --machine`,
141
+ })),
142
+ default: existing.category,
143
+ when: (ctx) => ctx.flags.category === undefined,
144
+ });
145
+ updateResolver.addPrompt({
146
+ flagName: 'color',
147
+ type: 'input',
148
+ message: 'Color (hex, optional):',
149
+ default: existing.color || '',
150
+ validate: (value) => {
151
+ const v = value;
152
+ if (!v)
153
+ return true;
154
+ return /^#[0-9A-Fa-f]{6}$/.test(v) || 'Invalid hex color (e.g., #FF0000)';
155
+ },
156
+ when: (ctx) => ctx.flags.color === undefined,
157
+ });
158
+ updateResolver.addPrompt({
159
+ flagName: 'description',
160
+ type: 'input',
161
+ message: 'Description (optional):',
162
+ default: existing.description || '',
163
+ when: (ctx) => ctx.flags.description === undefined,
164
+ });
165
+ updateResolver.addPrompt({
166
+ flagName: 'default',
167
+ type: 'list',
168
+ message: 'Set as default status for new tickets?',
169
+ choices: () => [
170
+ { name: 'Yes', value: true, command: `prlt status update ${statusId} --default --json` },
171
+ { name: 'No', value: false, command: `prlt status update ${statusId} --no-default --json` },
172
+ ],
173
+ default: existing.isDefault || false,
174
+ when: (ctx) => ctx.flags.default === undefined,
175
+ });
176
+ const updateResolved = await updateResolver.resolve();
177
+ changes = {};
178
+ if (updateResolved.name !== existing.name)
179
+ changes.name = updateResolved.name;
180
+ if (updateResolved.category !== existing.category)
181
+ changes.category = updateResolved.category;
182
+ if (updateResolved.color !== (existing.color || ''))
183
+ changes.color = updateResolved.color || undefined;
184
+ if (updateResolved.description !== (existing.description || ''))
185
+ changes.description = updateResolved.description || undefined;
186
+ if (updateResolved.default !== (existing.isDefault || false))
187
+ changes.isDefault = updateResolved.default;
128
188
  }
129
189
  else {
130
190
  changes = {};
@@ -150,31 +210,4 @@ export default class StatusUpdate extends PMOCommand {
150
210
  this.log(styles.muted(` Default: yes`));
151
211
  }
152
212
  }
153
- async promptChanges(fields, existing) {
154
- // Build inquirer prompts from fields, adding validators
155
- const answers = await inquirer.prompt(fields.map(field => ({
156
- ...field,
157
- validate: field.name === 'name'
158
- ? ((input) => input.length > 0 || 'Name is required')
159
- : field.name === 'color'
160
- ? ((input) => {
161
- if (!input)
162
- return true;
163
- return /^#[0-9A-Fa-f]{6}$/.test(input) || 'Invalid hex color (e.g., #FF0000)';
164
- })
165
- : undefined,
166
- })));
167
- const changes = {};
168
- if (answers.name !== existing.name)
169
- changes.name = answers.name;
170
- if (answers.category !== existing.category)
171
- changes.category = answers.category;
172
- if (answers.color !== (existing.color || ''))
173
- changes.color = answers.color || undefined;
174
- if (answers.description !== (existing.description || ''))
175
- changes.description = answers.description || undefined;
176
- if (answers.isDefault !== (existing.isDefault || false))
177
- changes.isDefault = answers.isDefault;
178
- return changes;
179
- }
180
213
  }
@@ -6,6 +6,7 @@ export default class TemplateDelete extends PMOCommand {
6
6
  type: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
7
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
8
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
10
  project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
11
  };
11
12
  protected getPMOOptions(): {
@@ -1,8 +1,8 @@
1
1
  import { Flags } from '@oclif/core';
2
- import inquirer from 'inquirer';
3
2
  import { PMOCommand, pmoBaseFlags } from '../../lib/pmo/index.js';
4
3
  import { styles } from '../../lib/styles.js';
5
- import { shouldOutputJson, outputPromptAsJson, outputErrorAsJson, createMetadata, buildPromptConfig, } from '../../lib/prompt-json.js';
4
+ import { FlagResolver, shouldOutputJson } from '../../lib/flags/index.js';
5
+ import { outputErrorAsJson, createMetadata } from '../../lib/prompt-json.js';
6
6
  export default class TemplateDelete extends PMOCommand {
7
7
  static description = 'Delete templates (ticket or phase)';
8
8
  static examples = [
@@ -33,28 +33,28 @@ export default class TemplateDelete extends PMOCommand {
33
33
  }
34
34
  async execute() {
35
35
  const { flags } = await this.parse(TemplateDelete);
36
- // Check if JSON output mode is active
37
36
  const jsonMode = shouldOutputJson(flags);
38
- // If no type specified, prompt for type first
39
- let templateType = flags.type;
40
- if (!templateType) {
41
- const typeChoices = [
42
- { name: 'Ticket templates', value: 'ticket' },
43
- { name: 'Phase templates', value: 'phase' },
44
- ];
45
- const typeMessage = 'Which template type would you like to delete?';
46
- if (jsonMode) {
47
- outputPromptAsJson(buildPromptConfig('list', 'type', typeMessage, typeChoices), createMetadata('template delete', flags));
48
- return;
49
- }
50
- const { selectedType } = await inquirer.prompt([{
51
- type: 'list',
52
- name: 'selectedType',
53
- message: typeMessage,
54
- choices: typeChoices,
55
- }]);
56
- templateType = selectedType;
57
- }
37
+ // Create resolver for type and template selection
38
+ const resolver = new FlagResolver({
39
+ commandName: 'template delete',
40
+ baseCommand: 'prlt template delete',
41
+ jsonMode,
42
+ flags,
43
+ });
44
+ // Prompt for template type if not provided
45
+ resolver.addPrompt({
46
+ flagName: 'type',
47
+ type: 'list',
48
+ message: 'Which template type would you like to delete?',
49
+ choices: () => [
50
+ { name: 'Ticket templates', value: 'ticket', command: 'prlt template delete --type ticket --json' },
51
+ { name: 'Phase templates', value: 'phase', command: 'prlt template delete --type phase --json' },
52
+ ],
53
+ when: (ctx) => !ctx.flags.type,
54
+ });
55
+ // First resolve type
56
+ const resolvedType = await resolver.resolve();
57
+ const templateType = resolvedType.type;
58
58
  // Get custom templates of the selected type
59
59
  let templates = [];
60
60
  let typeName = '';
@@ -75,45 +75,44 @@ export default class TemplateDelete extends PMOCommand {
75
75
  if (templates.length === 0) {
76
76
  if (jsonMode) {
77
77
  outputErrorAsJson('NO_TEMPLATES', `No custom ${typeName} templates to delete.`, createMetadata('template delete', flags));
78
- this.exit(1);
79
78
  }
80
79
  this.log(styles.muted(`\nNo custom ${typeName} templates to delete.`));
81
80
  return;
82
81
  }
83
- // Build choices for template selection
84
- const templateChoices = templates.map(t => ({
85
- name: t.name,
86
- value: t.id,
87
- }));
88
- const message = `Select ${typeName} templates to delete:`;
89
- // In JSON mode, output template selection prompt
90
- if (jsonMode) {
91
- outputPromptAsJson(buildPromptConfig('checkbox', 'templateIds', message, templateChoices), createMetadata('template delete', flags));
92
- return;
93
- }
94
- // Select templates to delete
95
- const { selected } = await inquirer.prompt([{
96
- type: 'checkbox',
97
- name: 'selected',
98
- message,
99
- choices: templateChoices,
100
- }]);
82
+ // Create new resolver for template selection (needs templates data)
83
+ const templateResolver = new FlagResolver({
84
+ commandName: 'template delete',
85
+ baseCommand: 'prlt template delete',
86
+ jsonMode,
87
+ flags: {},
88
+ });
89
+ templateResolver.addPrompt({
90
+ flagName: 'templateIds',
91
+ type: 'checkbox',
92
+ message: `Select ${typeName} templates to delete:`,
93
+ choices: () => templates.map(t => ({
94
+ name: t.name,
95
+ value: t.id,
96
+ command: `prlt template delete --type ${templateType} --templateIds "${t.id}" --json`,
97
+ })),
98
+ });
99
+ const resolvedTemplates = await templateResolver.resolve();
100
+ const selected = resolvedTemplates.templateIds || [];
101
101
  if (selected.length === 0) {
102
102
  this.log(styles.muted('\nNo templates selected.'));
103
103
  return;
104
104
  }
105
- // Confirm deletion
105
+ // Confirm deletion (using agentPrompt for confirmation)
106
106
  if (!flags.force) {
107
- const { confirm } = await inquirer.prompt([{
107
+ const { confirm } = await this.prompt([{
108
108
  type: 'list',
109
109
  name: 'confirm',
110
110
  message: `Delete ${selected.length} ${typeName} template(s)?`,
111
111
  choices: [
112
- { name: 'No', value: false },
113
- { name: 'Yes', value: true },
112
+ { name: 'No', value: false, command: '' },
113
+ { name: 'Yes', value: true, command: `prlt template delete --type ${templateType} --templateIds "${selected.join(',')}" --force --json` },
114
114
  ],
115
- default: 0,
116
- }]);
115
+ }], jsonMode ? { flags, commandName: 'template delete' } : null);
117
116
  if (!confirm) {
118
117
  this.log(styles.muted('Cancelled.'));
119
118
  return;
@@ -4,6 +4,7 @@ export default class Template extends Command {
4
4
  static aliases: string[];
5
5
  static examples: string[];
6
6
  static flags: {
7
+ machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
8
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
9
  };
9
10
  run(): Promise<void>;
@@ -1,7 +1,7 @@
1
- import { Command, Flags } from '@oclif/core';
2
- import inquirer from 'inquirer';
1
+ import { Command } from '@oclif/core';
3
2
  import { styles } from '../../lib/styles.js';
4
- import { shouldOutputJson, outputPromptAsJson, createMetadata, buildPromptConfig, } from '../../lib/prompt-json.js';
3
+ import { FlagResolver, shouldOutputJson } from '../../lib/flags/index.js';
4
+ import { machineOutputFlags } from '../../lib/pmo/index.js';
5
5
  export default class Template extends Command {
6
6
  static description = 'Manage templates (ticket and phase)';
7
7
  static aliases = ['templates'];
@@ -13,43 +13,36 @@ export default class Template extends Command {
13
13
  '<%= config.bin %> <%= command.id %> phase',
14
14
  ];
15
15
  static flags = {
16
- json: Flags.boolean({
17
- description: 'Output prompt configuration as JSON (for AI agents/scripts)',
18
- default: false,
19
- }),
16
+ ...machineOutputFlags,
20
17
  };
21
18
  async run() {
22
19
  const { flags } = await this.parse(Template);
23
- // Check if JSON output mode is active
24
20
  const jsonMode = shouldOutputJson(flags);
25
- // Define choices once, use for both JSON and interactive modes
26
- const menuChoices = [
27
- { name: 'List all templates', value: 'list' },
28
- new inquirer.Separator(),
29
- { name: 'Ticket templates (ticket presets)', value: 'ticket' },
30
- { name: 'Phase templates (project phases)', value: 'phase' },
31
- ];
32
- const message = 'What would you like to do?';
33
- // In JSON mode, output menu prompt (without separators)
34
- if (jsonMode) {
35
- const jsonChoices = [
36
- { name: 'List all templates', value: 'list' },
37
- { name: 'Ticket templates (ticket presets)', value: 'ticket' },
38
- { name: 'Phase templates (project phases)', value: 'phase' },
39
- ];
40
- outputPromptAsJson(buildPromptConfig('list', 'action', message, jsonChoices), createMetadata('template', flags));
41
- return;
42
- }
21
+ // Create resolver for action selection
22
+ const resolver = new FlagResolver({
23
+ commandName: 'template',
24
+ baseCommand: 'prlt template',
25
+ jsonMode,
26
+ flags: {},
27
+ });
28
+ resolver.addPrompt({
29
+ flagName: 'action',
30
+ type: 'list',
31
+ message: 'What would you like to do?',
32
+ choices: () => [
33
+ { name: 'List all templates', value: 'list', command: 'prlt template list --json' },
34
+ { name: 'Ticket templates (ticket presets)', value: 'ticket', command: 'prlt template ticket --json' },
35
+ { name: 'Phase templates (project phases)', value: 'phase', command: 'prlt template phase --json' },
36
+ ],
37
+ });
38
+ // In JSON mode, this outputs the prompt and exits
39
+ // In interactive mode, this prompts and returns the value
40
+ const resolved = await resolver.resolve();
41
+ // Only reached in interactive mode
43
42
  this.log('');
44
43
  this.log(styles.header('Templates'));
45
44
  this.log('');
46
- const { action } = await inquirer.prompt([{
47
- type: 'list',
48
- name: 'action',
49
- message,
50
- choices: menuChoices,
51
- }]);
52
- switch (action) {
45
+ switch (resolved.action) {
53
46
  case 'list':
54
47
  await this.config.runCommand('template:list', []);
55
48
  break;