@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
|
@@ -2,13 +2,12 @@ import { Args, Flags } from '@oclif/core';
|
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import { spawn } from 'node:child_process';
|
|
5
|
-
import inquirer from 'inquirer';
|
|
6
5
|
import Database from 'better-sqlite3';
|
|
7
6
|
import { styles } from '../../lib/styles.js';
|
|
8
7
|
import { getWorkspaceInfo } from '../../lib/agents/commands.js';
|
|
9
8
|
import { ExecutionStorage } from '../../lib/execution/storage.js';
|
|
10
9
|
import { PMOCommand, pmoBaseFlags } from '../../lib/pmo/index.js';
|
|
11
|
-
import {
|
|
10
|
+
import { outputErrorAsJson, createMetadata, shouldOutputJson, } from '../../lib/prompt-json.js';
|
|
12
11
|
export default class ExecutionLogs extends PMOCommand {
|
|
13
12
|
static description = 'View execution logs';
|
|
14
13
|
static examples = [
|
|
@@ -61,9 +60,8 @@ export default class ExecutionLogs extends PMOCommand {
|
|
|
61
60
|
let execId = args.id;
|
|
62
61
|
if (!execId) {
|
|
63
62
|
const executions = executionStorage.listExecutions({ limit: 20 });
|
|
64
|
-
// Check if JSON output mode is active
|
|
65
|
-
const jsonMode = shouldOutputJson(flags);
|
|
66
63
|
if (executions.length === 0) {
|
|
64
|
+
const jsonMode = shouldOutputJson(flags);
|
|
67
65
|
if (jsonMode) {
|
|
68
66
|
outputErrorAsJson('NO_EXECUTIONS', 'No executions found.', createMetadata('execution logs', flags));
|
|
69
67
|
db.close();
|
|
@@ -71,17 +69,8 @@ export default class ExecutionLogs extends PMOCommand {
|
|
|
71
69
|
}
|
|
72
70
|
this.error('No executions found.');
|
|
73
71
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const execChoices = executions.map((e) => ({
|
|
77
|
-
name: `${e.id} - ${e.ticketId} (${e.agentName}, ${e.status})`,
|
|
78
|
-
value: e.id,
|
|
79
|
-
}));
|
|
80
|
-
outputPromptAsJson(buildPromptConfig('list', 'executionId', 'Select execution to view logs:', execChoices), createMetadata('execution logs', flags));
|
|
81
|
-
db.close();
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const { selectedId } = await inquirer.prompt([
|
|
72
|
+
const jsonModeConfig = (flags.json || flags.machine) ? { flags, commandName: 'execution logs' } : null;
|
|
73
|
+
const { selectedId } = await this.prompt([
|
|
85
74
|
{
|
|
86
75
|
type: 'list',
|
|
87
76
|
name: 'selectedId',
|
|
@@ -89,9 +78,10 @@ export default class ExecutionLogs extends PMOCommand {
|
|
|
89
78
|
choices: executions.map((e) => ({
|
|
90
79
|
name: `${e.id} - ${e.ticketId} (${e.agentName}, ${e.status})`,
|
|
91
80
|
value: e.id,
|
|
81
|
+
command: `prlt execution logs ${e.id} --json`,
|
|
92
82
|
})),
|
|
93
83
|
},
|
|
94
|
-
]);
|
|
84
|
+
], jsonModeConfig);
|
|
95
85
|
execId = selectedId;
|
|
96
86
|
}
|
|
97
87
|
// Get execution
|
|
@@ -10,6 +10,7 @@ export default class ExecutionStop extends PMOCommand {
|
|
|
10
10
|
all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
14
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
15
|
};
|
|
15
16
|
protected getPMOOptions(): {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import { execSync } from 'node:child_process';
|
|
4
|
-
import inquirer from 'inquirer';
|
|
5
4
|
import Database from 'better-sqlite3';
|
|
6
5
|
import { styles } from '../../lib/styles.js';
|
|
7
6
|
import { getWorkspaceInfo } from '../../lib/agents/commands.js';
|
|
8
7
|
import { ExecutionStorage } from '../../lib/execution/storage.js';
|
|
9
8
|
import { isDockerRunning } from '../../lib/execution/runners.js';
|
|
10
9
|
import { PMOCommand, pmoBaseFlags } from '../../lib/pmo/index.js';
|
|
11
|
-
import { shouldOutputJson, outputPromptAsJson, createMetadata, buildPromptConfig, } from '../../lib/prompt-json.js';
|
|
12
10
|
export default class ExecutionStop extends PMOCommand {
|
|
13
11
|
static description = 'Stop running execution(s)';
|
|
14
12
|
static examples = [
|
|
@@ -139,18 +137,8 @@ export default class ExecutionStop extends PMOCommand {
|
|
|
139
137
|
this.log(styles.muted('\nNo running executions found.\n'));
|
|
140
138
|
return;
|
|
141
139
|
}
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
// In JSON mode, output execution selection prompt
|
|
145
|
-
if (jsonMode) {
|
|
146
|
-
const execChoices = activeExecutions.map((e) => ({
|
|
147
|
-
name: `${e.id} - ${e.ticketId} (${e.agentName}, ${e.environment})`,
|
|
148
|
-
value: e.id,
|
|
149
|
-
}));
|
|
150
|
-
outputPromptAsJson(buildPromptConfig('list', 'executionId', 'Select execution to stop:', execChoices), createMetadata('execution stop', flags));
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
const { selectedId } = await inquirer.prompt([
|
|
140
|
+
const jsonModeConfig = (flags.json || flags.machine) ? { flags: flags, commandName: 'execution stop' } : null;
|
|
141
|
+
const { selectedId } = await this.prompt([
|
|
154
142
|
{
|
|
155
143
|
type: 'list',
|
|
156
144
|
name: 'selectedId',
|
|
@@ -158,9 +146,10 @@ export default class ExecutionStop extends PMOCommand {
|
|
|
158
146
|
choices: activeExecutions.map((e) => ({
|
|
159
147
|
name: `${e.id} - ${e.ticketId} (${e.agentName}, ${e.environment})`,
|
|
160
148
|
value: e.id,
|
|
149
|
+
command: `prlt execution stop ${e.id} --json`,
|
|
161
150
|
})),
|
|
162
151
|
},
|
|
163
|
-
]);
|
|
152
|
+
], jsonModeConfig);
|
|
164
153
|
id = selectedId;
|
|
165
154
|
}
|
|
166
155
|
// Get execution
|
|
@@ -3,6 +3,7 @@ export default class GH extends Command {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
6
7
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
8
|
};
|
|
8
9
|
run(): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Command
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { FlagResolver, shouldOutputJson } from '../../lib/flags/index.js';
|
|
3
|
+
import { machineOutputFlags } from '../../lib/pmo/index.js';
|
|
4
4
|
export default class GH extends Command {
|
|
5
5
|
static description = 'GitHub CLI setup and status for PR workflow';
|
|
6
6
|
static examples = [
|
|
@@ -10,35 +10,35 @@ export default class GH extends Command {
|
|
|
10
10
|
'<%= config.bin %> <%= command.id %> token',
|
|
11
11
|
];
|
|
12
12
|
static flags = {
|
|
13
|
-
|
|
14
|
-
description: 'Output prompt configuration as JSON (for AI agents/scripts)',
|
|
15
|
-
default: false,
|
|
16
|
-
}),
|
|
13
|
+
...machineOutputFlags,
|
|
17
14
|
};
|
|
18
15
|
async run() {
|
|
19
16
|
const { flags } = await this.parse(GH);
|
|
20
17
|
// Check if JSON output mode is active
|
|
21
18
|
const jsonMode = shouldOutputJson(flags);
|
|
22
|
-
//
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
name: '
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
19
|
+
// Use FlagResolver for the menu selection
|
|
20
|
+
const resolver = new FlagResolver({
|
|
21
|
+
commandName: 'gh',
|
|
22
|
+
baseCommand: 'prlt gh',
|
|
23
|
+
jsonMode,
|
|
24
|
+
flags: {}, // No flags to resolve from CLI args for this menu command
|
|
25
|
+
});
|
|
26
|
+
// Add prompt for action selection
|
|
27
|
+
resolver.addPrompt({
|
|
28
|
+
flagName: 'action',
|
|
29
|
+
type: 'list',
|
|
30
|
+
message: 'GitHub CLI Setup',
|
|
31
|
+
choices: () => [
|
|
32
|
+
{ name: 'Check status', value: 'status', command: 'prlt gh status --json' },
|
|
33
|
+
{ name: 'Login to GitHub', value: 'login', command: 'prlt gh login --json' },
|
|
34
|
+
{ name: 'Show GH_TOKEN setup', value: 'token', command: 'prlt gh token --json' },
|
|
35
|
+
],
|
|
36
|
+
skipAutoCommand: true, // Use our custom commands above
|
|
37
|
+
});
|
|
38
|
+
// Resolve - in JSON mode this outputs the prompt and exits
|
|
39
|
+
const resolved = await resolver.resolve();
|
|
40
|
+
// Execute the selected action
|
|
41
|
+
switch (resolved.action) {
|
|
42
42
|
case 'status':
|
|
43
43
|
await this.config.runCommand('gh status');
|
|
44
44
|
break;
|
|
@@ -2,5 +2,9 @@ import { Command } from '@oclif/core';
|
|
|
2
2
|
export default class GHLogin extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
5
9
|
run(): Promise<void>;
|
|
6
10
|
}
|
|
@@ -3,14 +3,33 @@ import { spawn } from 'node:child_process';
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { styles } from '../../lib/styles.js';
|
|
5
5
|
import { isGHInstalled, isGHAuthenticated, getGHUsername } from '../../lib/pr/index.js';
|
|
6
|
+
import { isMachineOutput, outputErrorAsJson, outputSuccessAsJson, createMetadata, } from '../../lib/prompt-json.js';
|
|
7
|
+
import { machineOutputFlags } from '../../lib/pmo/index.js';
|
|
6
8
|
export default class GHLogin extends Command {
|
|
7
9
|
static description = 'Login to GitHub CLI for PR workflow';
|
|
8
10
|
static examples = [
|
|
9
11
|
'<%= config.bin %> <%= command.id %>',
|
|
10
12
|
];
|
|
13
|
+
static flags = {
|
|
14
|
+
...machineOutputFlags,
|
|
15
|
+
};
|
|
11
16
|
async run() {
|
|
17
|
+
const { flags } = await this.parse(GHLogin);
|
|
18
|
+
// Check if machine output mode is active
|
|
19
|
+
const jsonMode = isMachineOutput(flags);
|
|
20
|
+
// Helper to handle errors in JSON mode
|
|
21
|
+
const handleError = (code, message) => {
|
|
22
|
+
if (jsonMode) {
|
|
23
|
+
outputErrorAsJson(code, message, createMetadata('gh login', flags));
|
|
24
|
+
this.exit(1);
|
|
25
|
+
}
|
|
26
|
+
this.error(message);
|
|
27
|
+
};
|
|
12
28
|
// Check if gh is installed
|
|
13
29
|
if (!isGHInstalled()) {
|
|
30
|
+
if (jsonMode) {
|
|
31
|
+
return handleError('GH_NOT_INSTALLED', 'gh CLI not installed. Install with: brew install gh');
|
|
32
|
+
}
|
|
14
33
|
this.log(chalk.red(' ✗ gh CLI not installed'));
|
|
15
34
|
this.log(styles.muted(''));
|
|
16
35
|
this.log(styles.muted(' Install with Homebrew:'));
|
|
@@ -22,12 +41,24 @@ export default class GHLogin extends Command {
|
|
|
22
41
|
// Check if already authenticated
|
|
23
42
|
if (isGHAuthenticated()) {
|
|
24
43
|
const username = getGHUsername();
|
|
44
|
+
if (jsonMode) {
|
|
45
|
+
outputSuccessAsJson({
|
|
46
|
+
authenticated: true,
|
|
47
|
+
username: username || null,
|
|
48
|
+
message: 'Already authenticated',
|
|
49
|
+
}, createMetadata('gh login', flags));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
25
52
|
this.log(chalk.green(`Already authenticated${username ? ` as ${chalk.bold(username)}` : ''}`));
|
|
26
53
|
this.log(styles.muted(''));
|
|
27
54
|
this.log(styles.muted('To re-authenticate or switch accounts, run directly:'));
|
|
28
55
|
this.log(chalk.cyan(' gh auth login'));
|
|
29
56
|
return;
|
|
30
57
|
}
|
|
58
|
+
// In JSON mode, we can't run interactive login - return error
|
|
59
|
+
if (jsonMode) {
|
|
60
|
+
return handleError('REQUIRES_INTERACTIVE', 'gh login requires interactive authentication. Run: gh auth login');
|
|
61
|
+
}
|
|
31
62
|
this.log(styles.muted('Starting GitHub authentication...\n'));
|
|
32
63
|
// Run gh auth login interactively
|
|
33
64
|
const child = spawn('gh', ['auth', 'login'], {
|
|
@@ -2,5 +2,9 @@ import { Command } from '@oclif/core';
|
|
|
2
2
|
export default class GHStatus extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
5
9
|
run(): Promise<void>;
|
|
6
10
|
}
|
|
@@ -2,15 +2,39 @@ import { Command } from '@oclif/core';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { styles } from '../../lib/styles.js';
|
|
4
4
|
import { isGHInstalled, isGHAuthenticated, getGHUsername, isGHTokenInEnv } from '../../lib/pr/index.js';
|
|
5
|
+
import { isMachineOutput, outputSuccessAsJson, createMetadata, } from '../../lib/prompt-json.js';
|
|
6
|
+
import { machineOutputFlags } from '../../lib/pmo/index.js';
|
|
5
7
|
export default class GHStatus extends Command {
|
|
6
8
|
static description = 'Check GitHub CLI status for PR workflow';
|
|
7
9
|
static examples = [
|
|
8
10
|
'<%= config.bin %> <%= command.id %>',
|
|
9
11
|
];
|
|
12
|
+
static flags = {
|
|
13
|
+
...machineOutputFlags,
|
|
14
|
+
};
|
|
10
15
|
async run() {
|
|
16
|
+
const { flags } = await this.parse(GHStatus);
|
|
17
|
+
// Check if machine output mode is active
|
|
18
|
+
const jsonMode = isMachineOutput(flags);
|
|
19
|
+
// Gather status information
|
|
20
|
+
const ghInstalled = isGHInstalled();
|
|
21
|
+
const ghAuthenticated = ghInstalled && isGHAuthenticated();
|
|
22
|
+
const username = ghAuthenticated ? getGHUsername() : null;
|
|
23
|
+
const ghTokenSet = isGHTokenInEnv();
|
|
24
|
+
// In JSON mode, output status as JSON
|
|
25
|
+
if (jsonMode) {
|
|
26
|
+
outputSuccessAsJson({
|
|
27
|
+
ghInstalled,
|
|
28
|
+
ghAuthenticated,
|
|
29
|
+
username,
|
|
30
|
+
ghTokenSet,
|
|
31
|
+
ready: ghInstalled && ghAuthenticated && ghTokenSet,
|
|
32
|
+
}, createMetadata('gh status', flags));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
11
35
|
this.log(styles.muted('Checking GitHub CLI status...\n'));
|
|
12
36
|
// Check if gh is installed
|
|
13
|
-
if (!
|
|
37
|
+
if (!ghInstalled) {
|
|
14
38
|
this.log(chalk.red(' ✗ gh CLI not installed'));
|
|
15
39
|
this.log(styles.muted(''));
|
|
16
40
|
this.log(styles.muted(' Install with Homebrew:'));
|
|
@@ -21,7 +45,7 @@ export default class GHStatus extends Command {
|
|
|
21
45
|
}
|
|
22
46
|
this.log(chalk.green(' ✓ gh CLI installed'));
|
|
23
47
|
// Check if gh is authenticated
|
|
24
|
-
if (!
|
|
48
|
+
if (!ghAuthenticated) {
|
|
25
49
|
this.log(chalk.yellow(' ⚠ gh CLI not authenticated'));
|
|
26
50
|
this.log(styles.muted(''));
|
|
27
51
|
this.log(styles.muted(' Run to authenticate:'));
|
|
@@ -29,10 +53,9 @@ export default class GHStatus extends Command {
|
|
|
29
53
|
this.log(styles.muted(''));
|
|
30
54
|
return;
|
|
31
55
|
}
|
|
32
|
-
const username = getGHUsername();
|
|
33
56
|
this.log(chalk.green(` ✓ Authenticated${username ? ` as ${chalk.bold(username)}` : ''}`));
|
|
34
57
|
// Check if GH_TOKEN is available for devcontainers
|
|
35
|
-
if (
|
|
58
|
+
if (ghTokenSet) {
|
|
36
59
|
this.log(chalk.green(' ✓ GH_TOKEN available for devcontainers'));
|
|
37
60
|
this.log(styles.muted(''));
|
|
38
61
|
this.log(chalk.green('All set! PR creation will work in both host and devcontainers.'));
|
|
@@ -2,5 +2,9 @@ import { Command } from '@oclif/core';
|
|
|
2
2
|
export default class GHToken extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
5
9
|
run(): Promise<void>;
|
|
6
10
|
}
|
|
@@ -3,14 +3,33 @@ import { execSync } from 'node:child_process';
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { styles } from '../../lib/styles.js';
|
|
5
5
|
import { isGHInstalled, isGHAuthenticated, isGHTokenInEnv } from '../../lib/pr/index.js';
|
|
6
|
+
import { isMachineOutput, outputErrorAsJson, outputSuccessAsJson, createMetadata, } from '../../lib/prompt-json.js';
|
|
7
|
+
import { machineOutputFlags } from '../../lib/pmo/index.js';
|
|
6
8
|
export default class GHToken extends Command {
|
|
7
9
|
static description = 'Show GH_TOKEN setup for devcontainer PR creation';
|
|
8
10
|
static examples = [
|
|
9
11
|
'<%= config.bin %> <%= command.id %>',
|
|
10
12
|
];
|
|
13
|
+
static flags = {
|
|
14
|
+
...machineOutputFlags,
|
|
15
|
+
};
|
|
11
16
|
async run() {
|
|
17
|
+
const { flags } = await this.parse(GHToken);
|
|
18
|
+
// Check if machine output mode is active
|
|
19
|
+
const jsonMode = isMachineOutput(flags);
|
|
20
|
+
// Helper to handle errors in JSON mode
|
|
21
|
+
const handleError = (code, message) => {
|
|
22
|
+
if (jsonMode) {
|
|
23
|
+
outputErrorAsJson(code, message, createMetadata('gh token', flags));
|
|
24
|
+
this.exit(1);
|
|
25
|
+
}
|
|
26
|
+
this.error(message);
|
|
27
|
+
};
|
|
12
28
|
// Check if gh is installed
|
|
13
29
|
if (!isGHInstalled()) {
|
|
30
|
+
if (jsonMode) {
|
|
31
|
+
return handleError('GH_NOT_INSTALLED', 'gh CLI not installed. Install with: brew install gh');
|
|
32
|
+
}
|
|
14
33
|
this.log(chalk.red(' ✗ gh CLI not installed'));
|
|
15
34
|
this.log(styles.muted(''));
|
|
16
35
|
this.log(styles.muted(' Install first:'));
|
|
@@ -19,30 +38,55 @@ export default class GHToken extends Command {
|
|
|
19
38
|
}
|
|
20
39
|
// Check if gh is authenticated
|
|
21
40
|
if (!isGHAuthenticated()) {
|
|
41
|
+
if (jsonMode) {
|
|
42
|
+
return handleError('GH_NOT_AUTHENTICATED', 'gh CLI not authenticated. Run: prlt gh login');
|
|
43
|
+
}
|
|
22
44
|
this.log(chalk.yellow(' ⚠ gh CLI not authenticated'));
|
|
23
45
|
this.log(styles.muted(''));
|
|
24
46
|
this.log(styles.muted(' Authenticate first:'));
|
|
25
47
|
this.log(chalk.cyan(' prlt gh login'));
|
|
26
48
|
return;
|
|
27
49
|
}
|
|
50
|
+
// Detect shell
|
|
51
|
+
const shell = process.env.SHELL || '/bin/zsh';
|
|
52
|
+
const rcFile = shell.includes('zsh') ? '~/.zshrc' : shell.includes('bash') ? '~/.bashrc' : '~/.profile';
|
|
28
53
|
// Check if already set
|
|
29
54
|
if (isGHTokenInEnv()) {
|
|
55
|
+
if (jsonMode) {
|
|
56
|
+
outputSuccessAsJson({
|
|
57
|
+
ghTokenSet: true,
|
|
58
|
+
message: 'GH_TOKEN is already set in your environment',
|
|
59
|
+
}, createMetadata('gh token', flags));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
30
62
|
this.log(chalk.green(' ✓ GH_TOKEN is already set in your environment'));
|
|
31
63
|
this.log(styles.muted(''));
|
|
32
64
|
this.log(styles.muted(' PR creation will work in devcontainers.'));
|
|
33
65
|
return;
|
|
34
66
|
}
|
|
35
|
-
//
|
|
36
|
-
const
|
|
37
|
-
const
|
|
67
|
+
// Get setup command
|
|
68
|
+
const setupCommand = `echo 'export GH_TOKEN=$(gh auth token 2>/dev/null)' >> ${rcFile}`;
|
|
69
|
+
const sourceCommand = `source ${rcFile}`;
|
|
70
|
+
// In JSON mode, output setup instructions
|
|
71
|
+
if (jsonMode) {
|
|
72
|
+
outputSuccessAsJson({
|
|
73
|
+
ghTokenSet: false,
|
|
74
|
+
shell,
|
|
75
|
+
rcFile,
|
|
76
|
+
setupCommand,
|
|
77
|
+
sourceCommand,
|
|
78
|
+
message: 'GH_TOKEN not set. Follow setup instructions to enable PR creation from devcontainers.',
|
|
79
|
+
}, createMetadata('gh token', flags));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
38
82
|
this.log(chalk.yellow(' ⚠ GH_TOKEN not set'));
|
|
39
83
|
this.log(styles.muted(''));
|
|
40
84
|
this.log(styles.muted(' To enable PR creation from devcontainers, add this to your shell profile:'));
|
|
41
85
|
this.log(styles.muted(''));
|
|
42
|
-
this.log(chalk.cyan(`
|
|
86
|
+
this.log(chalk.cyan(` ${setupCommand}`));
|
|
43
87
|
this.log(styles.muted(''));
|
|
44
88
|
this.log(styles.muted(' Then restart your terminal or run:'));
|
|
45
|
-
this.log(chalk.cyan(`
|
|
89
|
+
this.log(chalk.cyan(` ${sourceCommand}`));
|
|
46
90
|
this.log(styles.muted(''));
|
|
47
91
|
// Show current token (masked) for verification
|
|
48
92
|
try {
|
|
@@ -11,6 +11,7 @@ export default class PhaseCreate extends PMOCommand {
|
|
|
11
11
|
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
default: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
13
|
interactive: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
15
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
16
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
17
|
};
|
|
@@ -18,5 +19,4 @@ export default class PhaseCreate extends PMOCommand {
|
|
|
18
19
|
promptIfMultiple: boolean;
|
|
19
20
|
};
|
|
20
21
|
execute(): Promise<void>;
|
|
21
|
-
private promptPhaseData;
|
|
22
22
|
}
|