@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,7 +1,6 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import Database from 'better-sqlite3';
|
|
4
|
-
import inquirer from 'inquirer';
|
|
5
4
|
import { PMOCommand, pmoBaseFlags } from '../../lib/pmo/index.js';
|
|
6
5
|
import { styles } from '../../lib/styles.js';
|
|
7
6
|
import { getWorkspaceInfo } from '../../lib/agents/commands.js';
|
|
@@ -9,7 +8,8 @@ import { ExecutionStorage } from '../../lib/execution/storage.js';
|
|
|
9
8
|
import { hasDevcontainerConfig } from '../../lib/execution/devcontainer.js';
|
|
10
9
|
import { spawnForColumn, getAvailableAgents, isDockerRunning, isDevcontainerCliInstalled, } from '../../lib/execution/spawner.js';
|
|
11
10
|
import { promptExecutionSettings } from '../../lib/execution/config.js';
|
|
12
|
-
import { shouldOutputJson,
|
|
11
|
+
import { shouldOutputJson, outputErrorAsJson, createMetadata, } from '../../lib/prompt-json.js';
|
|
12
|
+
import { FlagResolver } from '../../lib/flags/index.js';
|
|
13
13
|
export default class WorkWatch extends PMOCommand {
|
|
14
14
|
static description = 'Watch a column and auto-spawn agents for new tickets';
|
|
15
15
|
static examples = [
|
|
@@ -128,35 +128,29 @@ export default class WorkWatch extends PMOCommand {
|
|
|
128
128
|
// Prompt for column if not provided
|
|
129
129
|
this.columnName = flags.column || '';
|
|
130
130
|
if (!this.columnName) {
|
|
131
|
-
//
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
value: col,
|
|
155
|
-
};
|
|
156
|
-
}),
|
|
157
|
-
},
|
|
158
|
-
]);
|
|
159
|
-
this.columnName = selectedColumn;
|
|
131
|
+
// Build column choices with ticket counts
|
|
132
|
+
const columnChoices = columns.map(col => {
|
|
133
|
+
const ticketCount = board.columns.find(c => c.name === col)?.tickets?.length || 0;
|
|
134
|
+
return {
|
|
135
|
+
name: `${col} (${ticketCount} tickets)`,
|
|
136
|
+
value: col,
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
// Use FlagResolver for column selection
|
|
140
|
+
const columnResolver = new FlagResolver({
|
|
141
|
+
commandName: 'work watch',
|
|
142
|
+
baseCommand: 'prlt work watch',
|
|
143
|
+
jsonMode,
|
|
144
|
+
flags: {},
|
|
145
|
+
});
|
|
146
|
+
columnResolver.addPrompt({
|
|
147
|
+
flagName: 'column',
|
|
148
|
+
type: 'list',
|
|
149
|
+
message: 'Select column to watch for new tickets:',
|
|
150
|
+
choices: () => columnChoices,
|
|
151
|
+
});
|
|
152
|
+
const columnResult = await columnResolver.resolve();
|
|
153
|
+
this.columnName = columnResult.column || '';
|
|
160
154
|
}
|
|
161
155
|
// Check if any agent has devcontainer
|
|
162
156
|
const hasDevcontainer = workspaceInfo.agents.some(agent => {
|
|
@@ -180,35 +174,45 @@ export default class WorkWatch extends PMOCommand {
|
|
|
180
174
|
this.displayMode = 'terminal';
|
|
181
175
|
if (!flags.mode) {
|
|
182
176
|
if (hasDevcontainer && dockerRunning && devcontainerCliInstalled) {
|
|
183
|
-
//
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
],
|
|
193
|
-
default: 'devcontainer',
|
|
194
|
-
},
|
|
195
|
-
]);
|
|
196
|
-
this.environment = selectedEnvironment;
|
|
197
|
-
}
|
|
198
|
-
// Prompt for display mode
|
|
199
|
-
const { selectedDisplay } = await inquirer.prompt([
|
|
200
|
-
{
|
|
177
|
+
// Use FlagResolver for environment selection
|
|
178
|
+
const envResolver = new FlagResolver({
|
|
179
|
+
commandName: 'work watch',
|
|
180
|
+
baseCommand: 'prlt work watch',
|
|
181
|
+
jsonMode,
|
|
182
|
+
flags: {},
|
|
183
|
+
});
|
|
184
|
+
envResolver.addPrompt({
|
|
185
|
+
flagName: 'selectedEnvironment',
|
|
201
186
|
type: 'list',
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
choices: [
|
|
205
|
-
{ name: '
|
|
206
|
-
{ name: '
|
|
187
|
+
message: 'Where should agents run?',
|
|
188
|
+
default: 'devcontainer',
|
|
189
|
+
choices: () => [
|
|
190
|
+
{ name: '🐳 devcontainer (sandboxed, recommended)', value: 'devcontainer' },
|
|
191
|
+
{ name: '💻 host (runs directly on your machine)', value: 'host' },
|
|
207
192
|
],
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
193
|
+
});
|
|
194
|
+
const envResult = await envResolver.resolve();
|
|
195
|
+
this.environment = envResult.selectedEnvironment;
|
|
196
|
+
}
|
|
197
|
+
// Use FlagResolver for display mode
|
|
198
|
+
const displayResolver = new FlagResolver({
|
|
199
|
+
commandName: 'work watch',
|
|
200
|
+
baseCommand: 'prlt work watch',
|
|
201
|
+
jsonMode,
|
|
202
|
+
flags: {},
|
|
203
|
+
});
|
|
204
|
+
displayResolver.addPrompt({
|
|
205
|
+
flagName: 'selectedDisplay',
|
|
206
|
+
type: 'list',
|
|
207
|
+
message: 'How should agent output be displayed?',
|
|
208
|
+
default: 'terminal',
|
|
209
|
+
choices: () => [
|
|
210
|
+
{ name: '🖥️ New tab - Opens in new terminal tab (recommended)', value: 'terminal' },
|
|
211
|
+
{ name: '📦 Background - Runs detached, reattach with: prlt session attach', value: 'background' },
|
|
212
|
+
],
|
|
213
|
+
});
|
|
214
|
+
const displayResult = await displayResolver.resolve();
|
|
215
|
+
this.displayMode = displayResult.selectedDisplay;
|
|
212
216
|
}
|
|
213
217
|
else {
|
|
214
218
|
this.displayMode = flags.mode;
|
|
@@ -221,6 +225,7 @@ export default class WorkWatch extends PMOCommand {
|
|
|
221
225
|
skipPermissions: flags['skip-permissions'] ? true : undefined,
|
|
222
226
|
createPR: flags['create-pr'] ? true : undefined,
|
|
223
227
|
log: (msg) => this.log(styles.header(msg)),
|
|
228
|
+
jsonMode: jsonMode ? { flags, commandName: 'work watch' } : undefined,
|
|
224
229
|
});
|
|
225
230
|
this.executionConfig = promptResult.executionConfig;
|
|
226
231
|
this.skipPermissions = promptResult.skipPermissions;
|
|
@@ -8,6 +8,7 @@ export default class WorkflowCreate extends PMOCommand {
|
|
|
8
8
|
static flags: {
|
|
9
9
|
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
statuses: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
12
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
13
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
14
|
};
|
|
@@ -9,6 +9,7 @@ export default class WorkflowCreate extends PMOCommand {
|
|
|
9
9
|
'<%= config.bin %> <%= command.id %> "My Workflow"',
|
|
10
10
|
'<%= config.bin %> <%= command.id %> "Sprint Board" --description "Agile sprint workflow"',
|
|
11
11
|
'<%= config.bin %> <%= command.id %> "Simple" --statuses "Todo,In Progress,Done"',
|
|
12
|
+
'<%= config.bin %> <%= command.id %> --machine # JSON output for AI agents',
|
|
12
13
|
];
|
|
13
14
|
static args = {
|
|
14
15
|
name: Args.string({
|
|
@@ -26,10 +27,6 @@ export default class WorkflowCreate extends PMOCommand {
|
|
|
26
27
|
char: 's',
|
|
27
28
|
description: 'Comma-separated list of status names (uses default categories)',
|
|
28
29
|
}),
|
|
29
|
-
json: Flags.boolean({
|
|
30
|
-
description: 'Output prompt configuration as JSON (for AI agents/scripts)',
|
|
31
|
-
default: false,
|
|
32
|
-
}),
|
|
33
30
|
};
|
|
34
31
|
getPMOOptions() {
|
|
35
32
|
return { promptIfMultiple: false };
|
|
@@ -45,6 +42,7 @@ export default class WorkflowCreate extends PMOCommand {
|
|
|
45
42
|
{ type: 'input', name: 'name', message: 'Workflow name:' },
|
|
46
43
|
{ type: 'input', name: 'description', message: 'Description (optional):', default: flags.description },
|
|
47
44
|
];
|
|
45
|
+
// In JSON mode, output form prompt and exit
|
|
48
46
|
if (jsonMode) {
|
|
49
47
|
outputPromptAsJson(buildFormPromptConfig(fields), createMetadata('workflow create', flags));
|
|
50
48
|
return;
|
|
@@ -7,6 +7,7 @@ export default class WorkflowDelete extends PMOCommand {
|
|
|
7
7
|
};
|
|
8
8
|
static flags: {
|
|
9
9
|
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
12
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
13
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Args, 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,
|
|
4
|
+
import { shouldOutputJson, outputErrorAsJson, createMetadata, } from '../../lib/prompt-json.js';
|
|
6
5
|
export default class WorkflowDelete extends PMOCommand {
|
|
7
6
|
static description = 'Delete a custom workflow';
|
|
8
7
|
static examples = [
|
|
9
8
|
'<%= config.bin %> <%= command.id %> my-workflow',
|
|
10
9
|
'<%= config.bin %> <%= command.id %> my-workflow --force # Skip confirmation',
|
|
11
10
|
'<%= config.bin %> <%= command.id %> # Interactive selection',
|
|
11
|
+
'<%= config.bin %> <%= command.id %> --machine # JSON output for AI agents',
|
|
12
12
|
];
|
|
13
13
|
static args = {
|
|
14
14
|
id: Args.string({
|
|
@@ -23,10 +23,6 @@ export default class WorkflowDelete extends PMOCommand {
|
|
|
23
23
|
description: 'Skip confirmation prompt',
|
|
24
24
|
default: false,
|
|
25
25
|
}),
|
|
26
|
-
json: Flags.boolean({
|
|
27
|
-
description: 'Output prompt configuration as JSON (for AI agents/scripts)',
|
|
28
|
-
default: false,
|
|
29
|
-
}),
|
|
30
26
|
};
|
|
31
27
|
getPMOOptions() {
|
|
32
28
|
return { promptIfMultiple: false };
|
|
@@ -43,6 +39,8 @@ export default class WorkflowDelete extends PMOCommand {
|
|
|
43
39
|
}
|
|
44
40
|
this.error(message);
|
|
45
41
|
};
|
|
42
|
+
// Agent mode config for prompts
|
|
43
|
+
const agentConfig = jsonMode ? { flags, commandName: 'workflow delete' } : null;
|
|
46
44
|
// Get workflow ID - prompt if not provided
|
|
47
45
|
let workflowId = args.id;
|
|
48
46
|
if (!workflowId) {
|
|
@@ -51,25 +49,19 @@ export default class WorkflowDelete extends PMOCommand {
|
|
|
51
49
|
if (workflows.length === 0) {
|
|
52
50
|
return handleError('NO_CUSTOM_WORKFLOWS', 'No custom workflows found to delete.');
|
|
53
51
|
}
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
// Use selectFromList for workflow selection (handles JSON mode automatically)
|
|
53
|
+
const selected = await this.selectFromList({
|
|
54
|
+
message: 'Select workflow to delete:',
|
|
55
|
+
items: workflows,
|
|
56
|
+
getName: (w) => w.name,
|
|
57
|
+
getValue: (w) => w.id,
|
|
58
|
+
getCommand: (w) => `prlt workflow delete ${w.id} --json`,
|
|
59
|
+
jsonMode: agentConfig,
|
|
60
|
+
});
|
|
61
|
+
if (!selected) {
|
|
62
|
+
return; // Cancelled or JSON mode (already exited)
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
-
type: 'list',
|
|
65
|
-
name: 'selectedId',
|
|
66
|
-
message: 'Select workflow to delete:',
|
|
67
|
-
choices: workflows.map(w => ({
|
|
68
|
-
name: w.name,
|
|
69
|
-
value: w.id,
|
|
70
|
-
})),
|
|
71
|
-
}]);
|
|
72
|
-
workflowId = selectedId;
|
|
64
|
+
workflowId = selected;
|
|
73
65
|
}
|
|
74
66
|
// Get workflow details
|
|
75
67
|
const workflow = await this.storage.getWorkflow(workflowId);
|
|
@@ -90,23 +82,19 @@ export default class WorkflowDelete extends PMOCommand {
|
|
|
90
82
|
// Confirm deletion unless --force
|
|
91
83
|
if (!flags.force) {
|
|
92
84
|
const statuses = await this.storage.listStatuses(workflowId);
|
|
93
|
-
// In JSON mode, output confirmation prompt
|
|
94
|
-
if (jsonMode) {
|
|
95
|
-
outputPromptAsJson(buildPromptConfig('confirm', 'confirm', `Delete workflow "${workflow.name}" with ${statuses.length} statuses?`), createMetadata('workflow delete', flags));
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
85
|
this.log(styles.warning(`\nWorkflow "${workflow.name}" has ${statuses.length} status(es).`));
|
|
99
86
|
this.log(styles.warning('This action cannot be undone.'));
|
|
100
87
|
this.log('');
|
|
101
|
-
|
|
88
|
+
// Use prompt for confirmation (handles JSON mode automatically)
|
|
89
|
+
const { confirm } = await this.prompt([{
|
|
102
90
|
type: 'list',
|
|
103
91
|
name: 'confirm',
|
|
104
92
|
message: `Delete workflow "${workflow.name}"?`,
|
|
105
93
|
choices: [
|
|
106
|
-
{ name: '
|
|
107
|
-
{ name: '
|
|
94
|
+
{ name: 'No', value: false, command: '' },
|
|
95
|
+
{ name: 'Yes, delete', value: true, command: `prlt workflow delete ${workflowId} --force --json` },
|
|
108
96
|
],
|
|
109
|
-
}]);
|
|
97
|
+
}], agentConfig);
|
|
110
98
|
if (!confirm) {
|
|
111
99
|
this.log(styles.muted('Cancelled'));
|
|
112
100
|
return;
|
|
@@ -6,6 +6,7 @@ export default class Workflow extends PMOCommand {
|
|
|
6
6
|
builtin: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
custom: 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(): {
|
|
@@ -5,6 +5,7 @@ export default class WorkflowList extends PMOCommand {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
builtin: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
custom: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
9
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
10
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import { PMOCommand, pmoBaseFlags } from '../../lib/pmo/index.js';
|
|
3
3
|
import { styles } from '../../lib/styles.js';
|
|
4
|
+
import { isMachineOutput } from '../../lib/prompt-json.js';
|
|
4
5
|
export default class WorkflowList extends PMOCommand {
|
|
5
6
|
static description = 'List all available workflows';
|
|
6
7
|
static examples = [
|
|
7
8
|
'<%= config.bin %> <%= command.id %>',
|
|
8
9
|
'<%= config.bin %> <%= command.id %> --builtin',
|
|
9
|
-
'<%= config.bin %> <%= command.id %> --
|
|
10
|
+
'<%= config.bin %> <%= command.id %> --machine',
|
|
10
11
|
];
|
|
11
12
|
static flags = {
|
|
12
13
|
...pmoBaseFlags,
|
|
@@ -18,10 +19,6 @@ export default class WorkflowList extends PMOCommand {
|
|
|
18
19
|
description: 'Show only custom workflows',
|
|
19
20
|
default: false,
|
|
20
21
|
}),
|
|
21
|
-
json: Flags.boolean({
|
|
22
|
-
description: 'Output as JSON',
|
|
23
|
-
default: false,
|
|
24
|
-
}),
|
|
25
22
|
};
|
|
26
23
|
getPMOOptions() {
|
|
27
24
|
return { promptIfMultiple: false };
|
|
@@ -35,7 +32,7 @@ export default class WorkflowList extends PMOCommand {
|
|
|
35
32
|
if (flags.custom)
|
|
36
33
|
filter.isBuiltin = false;
|
|
37
34
|
const workflows = await this.storage.listWorkflows(Object.keys(filter).length > 0 ? filter : undefined);
|
|
38
|
-
if (flags
|
|
35
|
+
if (isMachineOutput(flags)) {
|
|
39
36
|
this.log(JSON.stringify(workflows, null, 2));
|
|
40
37
|
return;
|
|
41
38
|
}
|
|
@@ -7,6 +7,8 @@ export default class WorkflowSwitch extends PMOCommand {
|
|
|
7
7
|
};
|
|
8
8
|
static flags: {
|
|
9
9
|
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
12
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
13
|
};
|
|
12
14
|
execute(): Promise<void>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import inquirer from 'inquirer';
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
3
2
|
import { PMOCommand, pmoBaseFlags } from '../../lib/pmo/index.js';
|
|
4
3
|
import { styles } from '../../lib/styles.js';
|
|
4
|
+
import { shouldOutputJson, outputErrorAsJson, createMetadata, } from '../../lib/prompt-json.js';
|
|
5
5
|
export default class WorkflowSwitch extends PMOCommand {
|
|
6
6
|
static description = 'Switch a project to use a different workflow';
|
|
7
7
|
static examples = [
|
|
8
8
|
'<%= config.bin %> <%= command.id %> kanban',
|
|
9
9
|
'<%= config.bin %> <%= command.id %> linear --project my-project',
|
|
10
10
|
'<%= config.bin %> <%= command.id %> --force # Skip confirmation',
|
|
11
|
+
'<%= config.bin %> <%= command.id %> --machine # JSON output for AI agents',
|
|
11
12
|
];
|
|
12
13
|
static args = {
|
|
13
14
|
workflow: Args.string({
|
|
@@ -25,29 +26,52 @@ export default class WorkflowSwitch extends PMOCommand {
|
|
|
25
26
|
};
|
|
26
27
|
async execute() {
|
|
27
28
|
const { args, flags } = await this.parse(WorkflowSwitch);
|
|
28
|
-
|
|
29
|
+
// Check if JSON output mode is active
|
|
30
|
+
const jsonMode = shouldOutputJson(flags);
|
|
31
|
+
// Helper to handle errors in JSON mode
|
|
32
|
+
const handleError = (code, message) => {
|
|
33
|
+
if (jsonMode) {
|
|
34
|
+
outputErrorAsJson(code, message, createMetadata('workflow switch', flags));
|
|
35
|
+
this.exit(1);
|
|
36
|
+
}
|
|
37
|
+
this.error(message);
|
|
38
|
+
};
|
|
39
|
+
// Agent mode config for prompts
|
|
40
|
+
const agentConfig = jsonMode ? { flags, commandName: 'workflow switch' } : null;
|
|
41
|
+
const projectId = await this.requireProject({
|
|
42
|
+
jsonMode: {
|
|
43
|
+
flags,
|
|
44
|
+
commandName: 'workflow switch',
|
|
45
|
+
baseCommand: 'prlt workflow switch',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
29
48
|
// Get workflow - prompt for selection if not provided
|
|
30
49
|
let workflowId = args.workflow;
|
|
31
50
|
if (!workflowId) {
|
|
32
51
|
const workflows = await this.storage.listWorkflows();
|
|
33
52
|
if (workflows.length === 0) {
|
|
34
|
-
|
|
53
|
+
return handleError('NO_WORKFLOWS', 'No workflows found. Create one with: prlt workflow create "Workflow Name"');
|
|
35
54
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
55
|
+
// Use selectFromList for workflow selection (handles JSON mode automatically)
|
|
56
|
+
// Include project flag if specified to maintain stateless navigation
|
|
57
|
+
const projectFlag = flags.project ? ` -P ${flags.project}` : '';
|
|
58
|
+
const selected = await this.selectFromList({
|
|
59
|
+
message: 'Select a workflow:',
|
|
60
|
+
items: workflows,
|
|
61
|
+
getName: (w) => `${w.name}${w.description ? ` - ${w.description}` : ''}`,
|
|
62
|
+
getValue: (w) => w.id,
|
|
63
|
+
getCommand: (w) => `prlt workflow switch ${w.id}${projectFlag} --json`,
|
|
64
|
+
jsonMode: agentConfig,
|
|
65
|
+
});
|
|
66
|
+
if (!selected) {
|
|
67
|
+
return; // Cancelled or JSON mode (already exited)
|
|
68
|
+
}
|
|
69
|
+
workflowId = selected;
|
|
46
70
|
}
|
|
47
71
|
// Verify workflow exists
|
|
48
72
|
const workflow = await this.storage.getWorkflow(workflowId);
|
|
49
73
|
if (!workflow) {
|
|
50
|
-
|
|
74
|
+
return handleError('WORKFLOW_NOT_FOUND', `Workflow not found: ${workflowId}. Run 'prlt workflow list' to see available workflows.`);
|
|
51
75
|
}
|
|
52
76
|
// Get current project info
|
|
53
77
|
const project = await this.storage.getProject(projectId);
|
|
@@ -64,17 +88,18 @@ export default class WorkflowSwitch extends PMOCommand {
|
|
|
64
88
|
this.log(styles.warning(`\nProject "${projectName}" has ${tickets.length} ticket(s).`));
|
|
65
89
|
this.log(styles.warning('Tickets will be mapped to matching status categories in the new workflow.'));
|
|
66
90
|
this.log('');
|
|
67
|
-
|
|
68
|
-
|
|
91
|
+
// Use prompt for confirmation (handles JSON mode automatically)
|
|
92
|
+
// Include project flag if specified to maintain stateless navigation
|
|
93
|
+
const confirmProjectFlag = flags.project ? ` -P ${flags.project}` : '';
|
|
94
|
+
const { confirm } = await this.prompt([{
|
|
69
95
|
type: 'list',
|
|
70
96
|
name: 'confirm',
|
|
71
97
|
message: `Switch to workflow "${workflow.name}"?`,
|
|
72
98
|
choices: [
|
|
73
|
-
{ name: 'No', value: false },
|
|
74
|
-
{ name: 'Yes, switch workflow', value: true },
|
|
99
|
+
{ name: 'No', value: false, command: '' },
|
|
100
|
+
{ name: 'Yes, switch workflow', value: true, command: `prlt workflow switch ${workflowId}${confirmProjectFlag} --force --json` },
|
|
75
101
|
],
|
|
76
|
-
},
|
|
77
|
-
]);
|
|
102
|
+
}], agentConfig);
|
|
78
103
|
if (!confirm) {
|
|
79
104
|
this.log(styles.muted('Cancelled'));
|
|
80
105
|
return;
|
|
@@ -6,6 +6,7 @@ export default class WorkflowView extends PMOCommand {
|
|
|
6
6
|
id: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
7
7
|
};
|
|
8
8
|
static flags: {
|
|
9
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
10
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Args
|
|
2
|
-
import inquirer from 'inquirer';
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
3
2
|
import { PMOCommand, pmoBaseFlags } from '../../lib/pmo/index.js';
|
|
4
3
|
import { styles } from '../../lib/styles.js';
|
|
5
|
-
import { shouldOutputJson,
|
|
4
|
+
import { shouldOutputJson, outputErrorAsJson, createMetadata, } from '../../lib/prompt-json.js';
|
|
6
5
|
export default class WorkflowView extends PMOCommand {
|
|
7
6
|
static description = 'View details of a workflow';
|
|
8
7
|
static examples = [
|
|
9
8
|
'<%= config.bin %> <%= command.id %> default',
|
|
10
9
|
'<%= config.bin %> <%= command.id %> # Interactive selection',
|
|
11
|
-
'<%= config.bin %> <%= command.id %> --
|
|
10
|
+
'<%= config.bin %> <%= command.id %> --machine # JSON output for AI agents',
|
|
12
11
|
];
|
|
13
12
|
static args = {
|
|
14
13
|
id: Args.string({
|
|
@@ -18,10 +17,6 @@ export default class WorkflowView extends PMOCommand {
|
|
|
18
17
|
};
|
|
19
18
|
static flags = {
|
|
20
19
|
...pmoBaseFlags,
|
|
21
|
-
json: Flags.boolean({
|
|
22
|
-
description: 'Output as JSON',
|
|
23
|
-
default: false,
|
|
24
|
-
}),
|
|
25
20
|
};
|
|
26
21
|
getPMOOptions() {
|
|
27
22
|
return { promptIfMultiple: false };
|
|
@@ -38,6 +33,8 @@ export default class WorkflowView extends PMOCommand {
|
|
|
38
33
|
}
|
|
39
34
|
this.error(message);
|
|
40
35
|
};
|
|
36
|
+
// Agent mode config for prompts
|
|
37
|
+
const agentConfig = jsonMode ? { flags, commandName: 'workflow view' } : null;
|
|
41
38
|
// Get workflow ID - prompt if not provided
|
|
42
39
|
let workflowId = args.id;
|
|
43
40
|
if (!workflowId) {
|
|
@@ -45,25 +42,19 @@ export default class WorkflowView extends PMOCommand {
|
|
|
45
42
|
if (workflows.length === 0) {
|
|
46
43
|
return handleError('NO_WORKFLOWS', 'No workflows found.');
|
|
47
44
|
}
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
// Use selectFromList for workflow selection (handles JSON mode automatically)
|
|
46
|
+
const selected = await this.selectFromList({
|
|
47
|
+
message: 'Select workflow to view:',
|
|
48
|
+
items: workflows,
|
|
49
|
+
getName: (w) => `${w.name}${w.isBuiltin ? ' (built-in)' : ''}`,
|
|
50
|
+
getValue: (w) => w.id,
|
|
51
|
+
getCommand: (w) => `prlt workflow view ${w.id} --json`,
|
|
52
|
+
jsonMode: agentConfig,
|
|
53
|
+
});
|
|
54
|
+
if (!selected) {
|
|
55
|
+
return; // Cancelled or JSON mode (already exited)
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
type: 'list',
|
|
59
|
-
name: 'selectedId',
|
|
60
|
-
message: 'Select workflow to view:',
|
|
61
|
-
choices: workflows.map(w => ({
|
|
62
|
-
name: `${w.name}${w.isBuiltin ? ' (built-in)' : ''}`,
|
|
63
|
-
value: w.id,
|
|
64
|
-
})),
|
|
65
|
-
}]);
|
|
66
|
-
workflowId = selectedId;
|
|
57
|
+
workflowId = selected;
|
|
67
58
|
}
|
|
68
59
|
// Get workflow details
|
|
69
60
|
const workflow = await this.storage.getWorkflow(workflowId);
|
|
@@ -72,7 +63,7 @@ export default class WorkflowView extends PMOCommand {
|
|
|
72
63
|
}
|
|
73
64
|
// Get workflow statuses
|
|
74
65
|
const statuses = await this.storage.listStatuses(workflowId);
|
|
75
|
-
if (
|
|
66
|
+
if (jsonMode) {
|
|
76
67
|
this.log(JSON.stringify({ workflow, statuses }, null, 2));
|
|
77
68
|
return;
|
|
78
69
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class WorkspaceRemove extends
|
|
1
|
+
import { PromptCommand } from '../../lib/prompt-command.js';
|
|
2
|
+
export default class WorkspaceRemove extends PromptCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static args: {
|