@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.
- package/dist/commands/action/create.d.ts +1 -0
- package/dist/commands/action/create.js +74 -38
- package/dist/commands/action/delete.d.ts +1 -0
- package/dist/commands/action/delete.js +23 -24
- package/dist/commands/action/index.d.ts +1 -0
- package/dist/commands/action/index.js +5 -10
- package/dist/commands/action/list.d.ts +1 -0
- package/dist/commands/action/list.js +3 -1
- package/dist/commands/action/run.d.ts +1 -0
- package/dist/commands/action/run.js +44 -32
- package/dist/commands/action/show.d.ts +2 -0
- package/dist/commands/action/update.d.ts +1 -0
- package/dist/commands/action/update.js +80 -39
- package/dist/commands/agent/auth.d.ts +2 -0
- package/dist/commands/agent/auth.js +44 -3
- package/dist/commands/agent/discover.d.ts +2 -0
- package/dist/commands/agent/discover.js +35 -3
- package/dist/commands/agent/index.d.ts +1 -0
- package/dist/commands/agent/index.js +25 -45
- package/dist/commands/agent/list.d.ts +8 -3
- package/dist/commands/agent/list.js +16 -29
- package/dist/commands/agent/login.d.ts +1 -0
- package/dist/commands/agent/login.js +14 -32
- package/dist/commands/agent/rebuild.d.ts +1 -0
- package/dist/commands/agent/rebuild.js +2 -2
- package/dist/commands/agent/remove.d.ts +17 -0
- package/dist/commands/agent/remove.js +144 -0
- package/dist/commands/agent/restart.d.ts +1 -0
- package/dist/commands/agent/restart.js +2 -2
- package/dist/commands/agent/shell.d.ts +1 -0
- package/dist/commands/agent/shell.js +63 -76
- package/dist/commands/agent/staff/add.d.ts +1 -0
- package/dist/commands/agent/staff/add.js +7 -1
- package/dist/commands/agent/staff/index.d.ts +1 -0
- package/dist/commands/agent/staff/index.js +5 -4
- package/dist/commands/agent/staff/remove.d.ts +1 -0
- package/dist/commands/agent/status.d.ts +1 -0
- package/dist/commands/agent/status.js +11 -23
- package/dist/commands/agent/temp/cleanup.d.ts +1 -0
- package/dist/commands/agent/temp/index.d.ts +1 -0
- package/dist/commands/agent/temp/index.js +4 -3
- package/dist/commands/agent/themes/index.d.ts +1 -0
- package/dist/commands/agent/themes/index.js +9 -3
- package/dist/commands/agent/themes/set.d.ts +1 -0
- package/dist/commands/agent/themes/set.js +7 -1
- package/dist/commands/agent/visit.d.ts +1 -0
- package/dist/commands/agent/visit.js +11 -23
- package/dist/commands/autocomplete/setup.d.ts +11 -0
- package/dist/commands/autocomplete/setup.js +113 -8
- package/dist/commands/board/index.d.ts +4 -0
- package/dist/commands/board/index.js +32 -30
- package/dist/commands/board/watch.d.ts +2 -0
- package/dist/commands/branch/create.d.ts +1 -0
- package/dist/commands/branch/create.js +33 -41
- package/dist/commands/branch/index.d.ts +1 -0
- package/dist/commands/branch/list.d.ts +2 -0
- package/dist/commands/branch/validate.d.ts +2 -0
- package/dist/commands/branch/where.d.ts +1 -0
- package/dist/commands/claude.d.ts +6 -0
- package/dist/commands/claude.js +166 -116
- package/dist/commands/commit.d.ts +6 -0
- package/dist/commands/commit.js +68 -73
- package/dist/commands/config/index.d.ts +13 -0
- package/dist/commands/config/index.js +142 -98
- package/dist/commands/docker/clean.d.ts +2 -1
- package/dist/commands/docker/clean.js +20 -29
- package/dist/commands/docker/index.d.ts +1 -0
- package/dist/commands/docker/index.js +37 -41
- package/dist/commands/docker/prune.d.ts +2 -1
- package/dist/commands/docker/prune.js +20 -27
- package/dist/commands/docker/restart.d.ts +2 -1
- package/dist/commands/docker/restart.js +20 -29
- package/dist/commands/docker/stop.d.ts +2 -1
- package/dist/commands/docker/stop.js +20 -29
- package/dist/commands/epic/activate.d.ts +1 -0
- package/dist/commands/epic/archive.d.ts +1 -0
- package/dist/commands/epic/create.d.ts +1 -0
- package/dist/commands/epic/index.d.ts +1 -0
- package/dist/commands/epic/link/block.d.ts +1 -0
- package/dist/commands/epic/link/duplicates.d.ts +1 -0
- package/dist/commands/epic/link/index.d.ts +1 -0
- package/dist/commands/epic/link/relates.d.ts +1 -0
- package/dist/commands/epic/link/remove.d.ts +1 -0
- package/dist/commands/epic/list.d.ts +2 -0
- package/dist/commands/epic/move.d.ts +1 -0
- package/dist/commands/epic/progress.d.ts +1 -0
- package/dist/commands/epic/project.d.ts +1 -0
- package/dist/commands/epic/reorder.d.ts +1 -0
- package/dist/commands/epic/spec.d.ts +1 -0
- package/dist/commands/epic/ticket.d.ts +1 -0
- package/dist/commands/epic/view.d.ts +1 -0
- package/dist/commands/execution/index.d.ts +1 -0
- package/dist/commands/execution/index.js +9 -25
- package/dist/commands/execution/list.d.ts +2 -0
- package/dist/commands/execution/logs.d.ts +1 -0
- package/dist/commands/execution/logs.js +6 -16
- package/dist/commands/execution/stop.d.ts +1 -0
- package/dist/commands/execution/stop.js +4 -15
- package/dist/commands/gh/index.d.ts +1 -0
- package/dist/commands/gh/index.js +27 -27
- package/dist/commands/gh/login.d.ts +4 -0
- package/dist/commands/gh/login.js +31 -0
- package/dist/commands/gh/status.d.ts +4 -0
- package/dist/commands/gh/status.js +27 -4
- package/dist/commands/gh/token.d.ts +4 -0
- package/dist/commands/gh/token.js +49 -5
- package/dist/commands/phase/create.d.ts +1 -1
- package/dist/commands/phase/create.js +116 -74
- package/dist/commands/phase/delete.d.ts +1 -0
- package/dist/commands/phase/delete.js +23 -22
- package/dist/commands/phase/list.d.ts +1 -0
- package/dist/commands/phase/list.js +3 -5
- package/dist/commands/phase/move.d.ts +1 -0
- package/dist/commands/phase/move.js +39 -39
- package/dist/commands/phase/template/apply.d.ts +1 -0
- package/dist/commands/phase/template/create.d.ts +2 -0
- package/dist/commands/phase/template/delete.d.ts +1 -0
- package/dist/commands/phase/template/index.d.ts +1 -0
- package/dist/commands/phase/template/list.d.ts +1 -0
- package/dist/commands/phase/template/update.d.ts +2 -0
- package/dist/commands/phase/update.d.ts +1 -1
- package/dist/commands/phase/update.js +89 -55
- package/dist/commands/pmo/init.d.ts +2 -0
- package/dist/commands/pmo/init.js +84 -22
- package/dist/commands/pr/create.d.ts +12 -3
- package/dist/commands/pr/create.js +130 -147
- package/dist/commands/pr/index.d.ts +6 -3
- package/dist/commands/pr/index.js +41 -39
- package/dist/commands/pr/link.d.ts +7 -3
- package/dist/commands/pr/link.js +126 -150
- package/dist/commands/pr/status.d.ts +6 -3
- package/dist/commands/pr/status.js +101 -126
- package/dist/commands/project/archive.d.ts +1 -0
- package/dist/commands/project/archive.js +15 -20
- package/dist/commands/project/create.d.ts +1 -0
- package/dist/commands/project/create.js +13 -5
- package/dist/commands/project/delete.d.ts +1 -0
- package/dist/commands/project/delete.js +14 -28
- package/dist/commands/project/index.d.ts +1 -0
- package/dist/commands/project/index.js +0 -5
- package/dist/commands/project/list.d.ts +2 -0
- package/dist/commands/project/list.js +21 -3
- package/dist/commands/project/spec.d.ts +1 -0
- package/dist/commands/project/spec.js +17 -23
- package/dist/commands/project/unarchive.d.ts +2 -0
- package/dist/commands/project/unarchive.js +21 -2
- package/dist/commands/project/view.d.ts +1 -0
- package/dist/commands/project/view.js +34 -22
- package/dist/commands/repo/add.d.ts +2 -0
- package/dist/commands/repo/add.js +44 -1
- package/dist/commands/repo/index.d.ts +1 -0
- package/dist/commands/repo/index.js +20 -38
- package/dist/commands/repo/list.d.ts +2 -0
- package/dist/commands/repo/remove.d.ts +1 -0
- package/dist/commands/repo/remove.js +45 -63
- package/dist/commands/repo/view.d.ts +2 -0
- package/dist/commands/repo/view.js +30 -5
- package/dist/commands/roadmap/add-project.d.ts +1 -0
- package/dist/commands/roadmap/create.d.ts +1 -0
- package/dist/commands/roadmap/delete.d.ts +1 -0
- package/dist/commands/roadmap/generate.d.ts +1 -0
- package/dist/commands/roadmap/index.d.ts +1 -0
- package/dist/commands/roadmap/list.d.ts +2 -0
- package/dist/commands/roadmap/remove-project.d.ts +1 -0
- package/dist/commands/roadmap/reorder.d.ts +1 -0
- package/dist/commands/roadmap/update.d.ts +1 -0
- package/dist/commands/roadmap/view.d.ts +1 -0
- package/dist/commands/session/attach.d.ts +1 -0
- package/dist/commands/session/index.d.ts +1 -0
- package/dist/commands/session/index.js +8 -25
- package/dist/commands/session/list.d.ts +2 -0
- package/dist/commands/spec/create.d.ts +1 -1
- package/dist/commands/spec/create.js +64 -65
- package/dist/commands/spec/index.d.ts +1 -0
- package/dist/commands/spec/index.js +36 -22
- package/dist/commands/spec/link/depends.d.ts +1 -0
- package/dist/commands/spec/link/depends.js +6 -6
- package/dist/commands/spec/link/duplicates.d.ts +1 -0
- package/dist/commands/spec/link/duplicates.js +6 -6
- package/dist/commands/spec/link/index.d.ts +2 -1
- package/dist/commands/spec/link/index.js +0 -4
- package/dist/commands/spec/link/relates.d.ts +1 -0
- package/dist/commands/spec/link/relates.js +6 -6
- package/dist/commands/spec/link/remove.d.ts +2 -1
- package/dist/commands/spec/link/remove.js +6 -6
- package/dist/commands/spec/list.d.ts +2 -0
- package/dist/commands/spec/list.js +25 -0
- package/dist/commands/spec/plan.d.ts +2 -1
- package/dist/commands/spec/plan.js +19 -26
- package/dist/commands/spec/ticket.d.ts +2 -1
- package/dist/commands/spec/ticket.js +48 -34
- package/dist/commands/spec/view.d.ts +2 -1
- package/dist/commands/spec/view.js +25 -16
- package/dist/commands/status/create.d.ts +1 -1
- package/dist/commands/status/create.js +80 -64
- package/dist/commands/status/delete.d.ts +2 -1
- package/dist/commands/status/delete.js +26 -22
- package/dist/commands/status/index.d.ts +1 -0
- package/dist/commands/status/index.js +26 -19
- package/dist/commands/status/list.d.ts +1 -0
- package/dist/commands/status/list.js +12 -7
- package/dist/commands/status/move.d.ts +2 -1
- package/dist/commands/status/move.js +62 -61
- package/dist/commands/status/update.d.ts +2 -2
- package/dist/commands/status/update.js +110 -77
- package/dist/commands/template/delete.d.ts +1 -0
- package/dist/commands/template/delete.js +47 -48
- package/dist/commands/template/index.d.ts +1 -0
- package/dist/commands/template/index.js +26 -33
- package/dist/commands/template/list.d.ts +1 -0
- package/dist/commands/template/phase/create.d.ts +1 -0
- package/dist/commands/template/phase/create.js +6 -0
- package/dist/commands/template/phase/index.d.ts +1 -0
- package/dist/commands/template/phase/index.js +27 -26
- package/dist/commands/template/phase/update.d.ts +1 -0
- package/dist/commands/template/phase/update.js +6 -0
- package/dist/commands/template/ticket/index.d.ts +1 -0
- package/dist/commands/template/ticket/index.js +27 -26
- package/dist/commands/template/ticket/save.d.ts +1 -0
- package/dist/commands/template/ticket/save.js +6 -0
- package/dist/commands/terminal/title.d.ts +26 -0
- package/dist/commands/terminal/title.js +37 -3
- package/dist/commands/ticket/bulk.d.ts +1 -0
- package/dist/commands/ticket/complete.d.ts +1 -0
- package/dist/commands/ticket/complete.js +18 -14
- package/dist/commands/ticket/create.d.ts +1 -0
- package/dist/commands/ticket/create.js +45 -41
- package/dist/commands/ticket/delete.d.ts +1 -0
- package/dist/commands/ticket/delete.js +1 -1
- package/dist/commands/ticket/edit.d.ts +1 -0
- package/dist/commands/ticket/edit.js +1 -1
- package/dist/commands/ticket/epic.d.ts +1 -0
- package/dist/commands/ticket/epic.js +2 -2
- package/dist/commands/ticket/index.d.ts +1 -0
- package/dist/commands/ticket/link/block.d.ts +1 -0
- package/dist/commands/ticket/link/block.js +1 -1
- package/dist/commands/ticket/link/duplicates.d.ts +1 -0
- package/dist/commands/ticket/link/duplicates.js +1 -1
- package/dist/commands/ticket/link/index.d.ts +1 -0
- package/dist/commands/ticket/link/index.js +9 -8
- package/dist/commands/ticket/link/relates.d.ts +1 -0
- package/dist/commands/ticket/link/relates.js +1 -1
- package/dist/commands/ticket/link/remove.d.ts +1 -0
- package/dist/commands/ticket/link/remove.js +1 -1
- package/dist/commands/ticket/list.d.ts +2 -0
- package/dist/commands/ticket/move.d.ts +1 -0
- package/dist/commands/ticket/move.js +27 -19
- package/dist/commands/ticket/project.d.ts +1 -0
- package/dist/commands/ticket/project.js +3 -3
- package/dist/commands/ticket/reassign.d.ts +1 -0
- package/dist/commands/ticket/reassign.js +1 -1
- package/dist/commands/ticket/spec.d.ts +1 -0
- package/dist/commands/ticket/spec.js +3 -3
- package/dist/commands/ticket/status.d.ts +1 -0
- package/dist/commands/ticket/status.js +1 -1
- package/dist/commands/ticket/template/apply.d.ts +1 -0
- package/dist/commands/ticket/template/create.d.ts +2 -0
- package/dist/commands/ticket/template/delete.d.ts +1 -0
- package/dist/commands/ticket/template/index.d.ts +1 -0
- package/dist/commands/ticket/template/list.d.ts +1 -0
- package/dist/commands/ticket/template/save.d.ts +2 -0
- package/dist/commands/ticket/update.d.ts +1 -0
- package/dist/commands/ticket/update.js +1 -1
- package/dist/commands/ticket/view.d.ts +1 -0
- package/dist/commands/ticket/view.js +1 -1
- package/dist/commands/work/complete.d.ts +1 -0
- package/dist/commands/work/index.d.ts +1 -0
- package/dist/commands/work/ready.d.ts +1 -0
- package/dist/commands/work/revise.d.ts +1 -0
- package/dist/commands/work/spawn-all.d.ts +2 -0
- package/dist/commands/work/spawn-all.js +11 -4
- package/dist/commands/work/spawn.d.ts +1 -0
- package/dist/commands/work/spawn.js +261 -166
- package/dist/commands/work/start.d.ts +1 -0
- package/dist/commands/work/start.js +270 -189
- package/dist/commands/work/watch.d.ts +1 -0
- package/dist/commands/work/watch.js +63 -58
- package/dist/commands/workflow/create.d.ts +1 -0
- package/dist/commands/workflow/create.js +2 -4
- package/dist/commands/workflow/delete.d.ts +1 -0
- package/dist/commands/workflow/delete.js +21 -33
- package/dist/commands/workflow/index.d.ts +1 -0
- package/dist/commands/workflow/list.d.ts +1 -0
- package/dist/commands/workflow/list.js +3 -6
- package/dist/commands/workflow/switch.d.ts +2 -0
- package/dist/commands/workflow/switch.js +46 -21
- package/dist/commands/workflow/view.d.ts +1 -0
- package/dist/commands/workflow/view.js +18 -27
- package/dist/commands/workspace/remove.d.ts +2 -2
- package/dist/commands/workspace/remove.js +16 -21
- package/dist/commands/workspace/use.d.ts +2 -2
- package/dist/commands/workspace/use.js +12 -18
- package/dist/lib/agents/commands.d.ts +1 -1
- package/dist/lib/agents/commands.js +4 -4
- package/dist/lib/database/drizzle-schema.d.ts +5009 -0
- package/dist/lib/database/drizzle-schema.js +699 -0
- package/dist/lib/database/drizzle.d.ts +29 -0
- package/dist/lib/database/drizzle.js +37 -0
- package/dist/lib/database/index.d.ts +1 -0
- package/dist/lib/database/index.js +1 -1
- package/dist/lib/execution/config.d.ts +6 -0
- package/dist/lib/execution/config.js +31 -13
- package/dist/lib/execution/devcontainer.js +13 -7
- package/dist/lib/execution/runners.js +24 -7
- package/dist/lib/execution/spawner.js +19 -0
- package/dist/lib/flags/index.d.ts +4 -0
- package/dist/lib/flags/index.js +4 -0
- package/dist/lib/flags/resolver.d.ts +224 -0
- package/dist/lib/flags/resolver.js +313 -0
- package/dist/lib/pmo/base-command.d.ts +53 -3
- package/dist/lib/pmo/base-command.js +92 -13
- package/dist/lib/pmo/find-pmo.d.ts +1 -1
- package/dist/lib/pmo/find-pmo.js +4 -4
- package/dist/lib/pmo/index.d.ts +1 -1
- package/dist/lib/pmo/index.js +1 -1
- package/dist/lib/pmo/storage/helpers.js +2 -1
- package/dist/lib/pmo/storage/index.d.ts +9 -0
- package/dist/lib/pmo/storage/index.js +14 -0
- package/dist/lib/pmo/storage/projects.d.ts +28 -13
- package/dist/lib/pmo/storage/projects.js +110 -34
- package/dist/lib/pmo/storage/roadmaps.d.ts +2 -0
- package/dist/lib/pmo/storage/roadmaps.js +182 -111
- package/dist/lib/pmo/storage/specs.js +13 -16
- package/dist/lib/pmo/storage/subtasks.js +17 -2
- package/dist/lib/pmo/storage/tickets.d.ts +12 -2
- package/dist/lib/pmo/storage/tickets.js +63 -5
- package/dist/lib/pmo/storage/types.d.ts +7 -3
- package/dist/lib/pmo/storage/views.d.ts +12 -1
- package/dist/lib/pmo/storage/views.js +61 -6
- package/dist/lib/prompt-command.d.ts +90 -0
- package/dist/lib/prompt-command.js +102 -0
- package/dist/lib/prompt-json.d.ts +34 -4
- package/dist/lib/prompt-json.js +35 -3
- package/dist/lib/repos/index.js +15 -15
- package/dist/lib/workspace.d.ts +4 -3
- package/dist/lib/workspace.js +3 -3
- package/oclif.manifest.json +4610 -2997
- 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 {
|
|
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
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
|
|
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
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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 {
|
|
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
|
|
73
|
-
|
|
74
|
-
if (
|
|
75
|
-
|
|
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
|
-
//
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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 {
|
|
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
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
//
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
2
|
-
import inquirer from 'inquirer';
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
3
2
|
import { styles } from '../../lib/styles.js';
|
|
4
|
-
import {
|
|
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
|
-
|
|
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
|
-
//
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
{ name: '
|
|
38
|
-
{ name: '
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
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;
|