@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
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import { colors, format } from '../../lib/colors.js';
|
|
4
|
+
import { getWorkspaceInfo, removeAgentsFromWorkspace } from '../../lib/agents/commands.js';
|
|
5
|
+
import { PMOCommand, pmoBaseFlags } from '../../lib/pmo/index.js';
|
|
6
|
+
import { shouldOutputJson, outputPromptAsJson, outputErrorAsJson, createMetadata, buildPromptConfig, } from '../../lib/prompt-json.js';
|
|
7
|
+
export default class Remove extends PMOCommand {
|
|
8
|
+
static description = 'Remove an agent from the workspace';
|
|
9
|
+
static examples = [
|
|
10
|
+
'<%= config.bin %> <%= command.id %> camry',
|
|
11
|
+
'<%= config.bin %> <%= command.id %>',
|
|
12
|
+
];
|
|
13
|
+
static args = {
|
|
14
|
+
name: Args.string({
|
|
15
|
+
description: 'Agent name to remove',
|
|
16
|
+
required: false,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
static flags = {
|
|
20
|
+
...pmoBaseFlags,
|
|
21
|
+
json: Flags.boolean({
|
|
22
|
+
description: 'Output prompt configuration as JSON (for AI agents/scripts)',
|
|
23
|
+
default: false,
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
getPMOOptions() {
|
|
27
|
+
return { promptIfMultiple: false };
|
|
28
|
+
}
|
|
29
|
+
async execute() {
|
|
30
|
+
const { args, flags } = await this.parse(Remove);
|
|
31
|
+
// Check if JSON output mode is active
|
|
32
|
+
const jsonMode = shouldOutputJson(flags);
|
|
33
|
+
// Helper to handle errors in JSON mode
|
|
34
|
+
const handleError = (code, message) => {
|
|
35
|
+
if (jsonMode) {
|
|
36
|
+
outputErrorAsJson(code, message, createMetadata('agent remove', flags));
|
|
37
|
+
this.exit(1);
|
|
38
|
+
}
|
|
39
|
+
this.error(message);
|
|
40
|
+
};
|
|
41
|
+
// Get workspace information
|
|
42
|
+
const workspaceInfo = getWorkspaceInfo();
|
|
43
|
+
if (workspaceInfo.agents.length === 0) {
|
|
44
|
+
if (jsonMode) {
|
|
45
|
+
outputErrorAsJson('NO_AGENTS', 'No agents to remove.', createMetadata('agent remove', flags));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.log(colors.warning('No agents to remove.'));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
let agentName = args.name;
|
|
52
|
+
// Interactive mode if no agent specified
|
|
53
|
+
if (!agentName) {
|
|
54
|
+
// Group agents by type
|
|
55
|
+
const staffAgents = workspaceInfo.agents.filter(a => a.type === 'persistent');
|
|
56
|
+
const tempAgents = workspaceInfo.agents.filter(a => a.type === 'ephemeral');
|
|
57
|
+
// Build choices with command field for JSON mode
|
|
58
|
+
const agentChoices = [];
|
|
59
|
+
for (const agent of staffAgents) {
|
|
60
|
+
agentChoices.push({ name: `👔 ${agent.name}`, value: agent.name, command: `prlt agent remove ${agent.name} --machine` });
|
|
61
|
+
}
|
|
62
|
+
for (const agent of tempAgents) {
|
|
63
|
+
agentChoices.push({ name: `⏱️ ${agent.name}`, value: agent.name, command: `prlt agent remove ${agent.name} --machine` });
|
|
64
|
+
}
|
|
65
|
+
agentChoices.push({ name: 'Cancel', value: 'cancel' });
|
|
66
|
+
const selectMessage = 'Select agent to remove:';
|
|
67
|
+
// In JSON mode, output agent selection prompt
|
|
68
|
+
if (jsonMode) {
|
|
69
|
+
outputPromptAsJson(buildPromptConfig('list', 'name', selectMessage, agentChoices), createMetadata('agent remove', flags));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const { selected } = await inquirer.prompt([
|
|
73
|
+
{
|
|
74
|
+
type: 'list',
|
|
75
|
+
name: 'selected',
|
|
76
|
+
message: selectMessage,
|
|
77
|
+
choices: [
|
|
78
|
+
...agentChoices.slice(0, -1),
|
|
79
|
+
new inquirer.Separator(),
|
|
80
|
+
{ name: '❌ ' + agentChoices[agentChoices.length - 1].name, value: agentChoices[agentChoices.length - 1].value }
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
]);
|
|
84
|
+
if (selected === 'cancel') {
|
|
85
|
+
this.log(colors.textMuted('Operation cancelled.'));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
agentName = selected;
|
|
89
|
+
}
|
|
90
|
+
// Validate agent exists
|
|
91
|
+
const agent = workspaceInfo.agents.find((a) => a.name === agentName);
|
|
92
|
+
if (!agent) {
|
|
93
|
+
return handleError('AGENT_NOT_FOUND', `Agent "${agentName}" not found. Available agents: ${workspaceInfo.agents.map((a) => a.name).join(', ')}`);
|
|
94
|
+
}
|
|
95
|
+
const agentsToRemove = [agentName];
|
|
96
|
+
// Build choices once, use for both JSON and interactive modes
|
|
97
|
+
const confirmChoices = [
|
|
98
|
+
{ name: 'No, cancel', value: 'false' },
|
|
99
|
+
{ name: 'Yes, remove agent', value: 'true' },
|
|
100
|
+
];
|
|
101
|
+
const confirmMessage = `Are you sure you want to remove agent "${agentName}"? This will delete its worktree.`;
|
|
102
|
+
// Confirm removal
|
|
103
|
+
// In JSON mode, output confirmation prompt
|
|
104
|
+
if (jsonMode) {
|
|
105
|
+
outputPromptAsJson(buildPromptConfig('list', 'confirmed', confirmMessage, confirmChoices), createMetadata('agent remove', flags));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const { confirm } = await inquirer.prompt([
|
|
109
|
+
{
|
|
110
|
+
type: 'list',
|
|
111
|
+
name: 'confirm',
|
|
112
|
+
message: confirmMessage,
|
|
113
|
+
choices: [
|
|
114
|
+
{ name: '❌ ' + confirmChoices[0].name, value: false },
|
|
115
|
+
{ name: '⚠️ ' + confirmChoices[1].name, value: true }
|
|
116
|
+
],
|
|
117
|
+
default: 0 // Default to "No, cancel"
|
|
118
|
+
}
|
|
119
|
+
]);
|
|
120
|
+
if (!confirm) {
|
|
121
|
+
this.log(colors.textMuted('Removal cancelled.'));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
// Remove agents
|
|
125
|
+
this.log(colors.primary(`Removing agent "${agentName}"...`));
|
|
126
|
+
const { removed, failed } = await removeAgentsFromWorkspace(workspaceInfo, agentsToRemove);
|
|
127
|
+
// Show results for each agent
|
|
128
|
+
for (const name of agentsToRemove) {
|
|
129
|
+
if (removed.includes(name)) {
|
|
130
|
+
this.log(format.success(`Agent ${name} removed`));
|
|
131
|
+
}
|
|
132
|
+
else if (failed.includes(name)) {
|
|
133
|
+
this.log(format.error(`Failed to remove agent ${name}`));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Summary
|
|
137
|
+
if (removed.length > 0) {
|
|
138
|
+
this.log(format.success(`\nSuccessfully removed ${removed.length} agent(s): ${removed.join(', ')}`));
|
|
139
|
+
}
|
|
140
|
+
if (failed.length > 0) {
|
|
141
|
+
this.log(format.error(`\nFailed to remove ${failed.length} agent(s): ${failed.join(', ')}`));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -7,6 +7,7 @@ export default class AgentRestart extends PMOCommand {
|
|
|
7
7
|
};
|
|
8
8
|
static flags: {
|
|
9
9
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
};
|
|
12
13
|
protected getPMOOptions(): {
|
|
@@ -14,7 +14,7 @@ export default class AgentRestart extends PMOCommand {
|
|
|
14
14
|
static examples = [
|
|
15
15
|
'<%= config.bin %> <%= command.id %> altman',
|
|
16
16
|
'<%= config.bin %> <%= command.id %> # Interactive selection',
|
|
17
|
-
'<%= config.bin %> <%= command.id %> --
|
|
17
|
+
'<%= config.bin %> <%= command.id %> --machine # JSON mode for AI agents',
|
|
18
18
|
];
|
|
19
19
|
static args = {
|
|
20
20
|
name: Args.string({
|
|
@@ -61,7 +61,7 @@ export default class AgentRestart extends PMOCommand {
|
|
|
61
61
|
items: agents,
|
|
62
62
|
getName: (a) => a.name,
|
|
63
63
|
getValue: (a) => a.name,
|
|
64
|
-
getCommand: (a) => `prlt agent restart ${a.name} --
|
|
64
|
+
getCommand: (a) => `prlt agent restart ${a.name} --machine`,
|
|
65
65
|
jsonMode: jsonMode ? { flags, commandName: 'agent restart' } : null,
|
|
66
66
|
});
|
|
67
67
|
if (!selected) {
|
|
@@ -7,6 +7,7 @@ export default class Shell extends PMOCommand {
|
|
|
7
7
|
};
|
|
8
8
|
static flags: {
|
|
9
9
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
};
|
|
12
13
|
protected getPMOOptions(): {
|
|
@@ -2,7 +2,6 @@ import { Args, Flags } from '@oclif/core';
|
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import { execSync, spawn } from 'node:child_process';
|
|
5
|
-
import inquirer from 'inquirer';
|
|
6
5
|
import Database from 'better-sqlite3';
|
|
7
6
|
import { colors } from '../../lib/colors.js';
|
|
8
7
|
import { getWorkspaceInfo, getAgentTmuxSessions } from '../../lib/agents/commands.js';
|
|
@@ -10,7 +9,7 @@ import { hasDevcontainerConfig } from '../../lib/execution/devcontainer.js';
|
|
|
10
9
|
import { getTerminalApp } from '../../lib/execution/config.js';
|
|
11
10
|
import { isDockerRunning, getAgentContainerName, isContainerRunning, getContainerId, } from '../../lib/execution/runners.js';
|
|
12
11
|
import { PMOCommand, pmoBaseFlags } from '../../lib/pmo/index.js';
|
|
13
|
-
import { shouldOutputJson,
|
|
12
|
+
import { shouldOutputJson, } from '../../lib/prompt-json.js';
|
|
14
13
|
export default class Shell extends PMOCommand {
|
|
15
14
|
static description = 'Open an interactive shell in an agent workspace';
|
|
16
15
|
static examples = [
|
|
@@ -37,65 +36,47 @@ export default class Shell extends PMOCommand {
|
|
|
37
36
|
const { args, flags } = await this.parse(Shell);
|
|
38
37
|
// Check if JSON output mode is active
|
|
39
38
|
const jsonMode = shouldOutputJson(flags);
|
|
40
|
-
//
|
|
41
|
-
const
|
|
42
|
-
if (jsonMode) {
|
|
43
|
-
outputErrorAsJson(code, message, createMetadata('agent shell', flags));
|
|
44
|
-
this.exit(1);
|
|
45
|
-
}
|
|
46
|
-
this.error(message);
|
|
47
|
-
};
|
|
39
|
+
// Error handling config
|
|
40
|
+
const errorConfig = { jsonMode, commandName: 'agent shell', flags };
|
|
48
41
|
// Get workspace information
|
|
49
42
|
const workspaceInfo = getWorkspaceInfo();
|
|
50
43
|
if (workspaceInfo.agents.length === 0) {
|
|
51
44
|
if (jsonMode) {
|
|
52
|
-
|
|
53
|
-
return;
|
|
45
|
+
this.handleError('NO_AGENTS', 'No agents found. Add agents with "prlt agent add"', errorConfig);
|
|
54
46
|
}
|
|
55
47
|
this.log(colors.warning('No agents found. Add agents with "prlt agent add"'));
|
|
56
48
|
return;
|
|
57
49
|
}
|
|
58
50
|
let agentName = args.name;
|
|
51
|
+
// Agent mode config for prompts
|
|
52
|
+
const agentConfig = jsonMode ? { flags, commandName: 'agent shell' } : null;
|
|
59
53
|
// Interactive mode if no agent specified
|
|
60
54
|
if (!agentName) {
|
|
61
|
-
|
|
62
|
-
// In JSON mode, output agent selection prompt and exit
|
|
63
|
-
if (jsonMode) {
|
|
64
|
-
const agentChoices = workspaceInfo.agents.map((agent) => ({ name: agent.name, value: agent.name }));
|
|
65
|
-
outputPromptAsJson(buildPromptConfig('list', 'name', selectMessage, agentChoices), createMetadata('agent shell', flags));
|
|
66
|
-
}
|
|
67
|
-
// Group agents by type for interactive mode
|
|
55
|
+
// Group agents by type
|
|
68
56
|
const staffAgents = workspaceInfo.agents.filter(a => a.type === 'persistent');
|
|
69
57
|
const tempAgents = workspaceInfo.agents.filter(a => a.type === 'ephemeral');
|
|
58
|
+
// Build choices with command field for JSON mode
|
|
70
59
|
const choices = [];
|
|
71
|
-
|
|
72
|
-
choices.push(
|
|
73
|
-
for (const agent of staffAgents) {
|
|
74
|
-
choices.push({ name: `👔 ${agent.name}`, value: agent.name });
|
|
75
|
-
}
|
|
60
|
+
for (const agent of staffAgents) {
|
|
61
|
+
choices.push({ name: `👔 ${agent.name}`, value: agent.name, command: `prlt agent shell ${agent.name} --machine` });
|
|
76
62
|
}
|
|
77
|
-
|
|
78
|
-
choices.push(
|
|
79
|
-
for (const agent of tempAgents) {
|
|
80
|
-
choices.push({ name: `⏱️ ${agent.name}`, value: agent.name });
|
|
81
|
-
}
|
|
63
|
+
for (const agent of tempAgents) {
|
|
64
|
+
choices.push({ name: `⏱️ ${agent.name}`, value: agent.name, command: `prlt agent shell ${agent.name} --machine` });
|
|
82
65
|
}
|
|
83
|
-
const { selected } = await
|
|
84
|
-
{
|
|
66
|
+
const { selected } = await this.prompt([{
|
|
85
67
|
type: 'list',
|
|
86
68
|
name: 'selected',
|
|
87
|
-
message:
|
|
88
|
-
choices
|
|
89
|
-
}
|
|
90
|
-
]);
|
|
69
|
+
message: 'Select agent to open shell in:',
|
|
70
|
+
choices,
|
|
71
|
+
}], agentConfig);
|
|
91
72
|
agentName = selected;
|
|
92
73
|
}
|
|
93
74
|
// Validate agent exists
|
|
94
75
|
const agent = workspaceInfo.agents.find(a => a.name === agentName);
|
|
95
76
|
if (!agent) {
|
|
96
|
-
|
|
77
|
+
this.handleError('AGENT_NOT_FOUND', `Agent "${agentName}" not found. Available agents: ${workspaceInfo.agents.map(a => a.name).join(', ')}`, errorConfig);
|
|
97
78
|
}
|
|
98
|
-
// Check for existing tmux sessions
|
|
79
|
+
// Check for existing tmux sessions (skip in JSON mode - can't handle interactive tmux)
|
|
99
80
|
const existingSessions = getAgentTmuxSessions(agentName);
|
|
100
81
|
if (existingSessions.length > 0 && !jsonMode) {
|
|
101
82
|
this.log(colors.warning(`\n⚠️ Agent "${agentName}" has ${existingSessions.length} active tmux session(s):`));
|
|
@@ -103,16 +84,16 @@ export default class Shell extends PMOCommand {
|
|
|
103
84
|
this.log(colors.textMuted(` • ${session}`));
|
|
104
85
|
}
|
|
105
86
|
this.log('');
|
|
106
|
-
const { sessionAction } = await
|
|
87
|
+
const { sessionAction } = await this.prompt([{
|
|
107
88
|
type: 'list',
|
|
108
89
|
name: 'sessionAction',
|
|
109
90
|
message: 'What would you like to do?',
|
|
110
91
|
choices: [
|
|
111
|
-
{ name: '🔗 Attach to existing session', value: 'attach' },
|
|
112
|
-
{ name: '⚠️ Open new shell anyway (may cause conflicts)', value: 'continue' },
|
|
113
|
-
{ name: '❌ Cancel', value: 'cancel' },
|
|
92
|
+
{ name: '🔗 Attach to existing session', value: 'attach', command: '' },
|
|
93
|
+
{ name: '⚠️ Open new shell anyway (may cause conflicts)', value: 'continue', command: `prlt agent shell ${agentName} --machine` },
|
|
94
|
+
{ name: '❌ Cancel', value: 'cancel', command: '' },
|
|
114
95
|
],
|
|
115
|
-
}]);
|
|
96
|
+
}], agentConfig);
|
|
116
97
|
if (sessionAction === 'cancel') {
|
|
117
98
|
this.log(colors.textMuted('Operation cancelled.'));
|
|
118
99
|
return;
|
|
@@ -136,63 +117,69 @@ export default class Shell extends PMOCommand {
|
|
|
136
117
|
const agentDir = path.join(workspaceInfo.agentsPath, agentName);
|
|
137
118
|
// Check if agent has devcontainer
|
|
138
119
|
const hasDevcontainer = hasDevcontainerConfig(agentDir);
|
|
139
|
-
// In JSON mode with agent name provided, output config
|
|
120
|
+
// In JSON mode with agent name provided, output combined config prompt
|
|
140
121
|
if (jsonMode) {
|
|
141
122
|
const configChoices = [
|
|
142
|
-
{ name: 'terminal - safe - devcontainer', value: 'terminal-safe-devcontainer' },
|
|
143
|
-
{ name: 'terminal - safe - host', value: 'terminal-safe-host' },
|
|
144
|
-
{ name: 'terminal - danger - devcontainer', value: 'terminal-danger-devcontainer' },
|
|
145
|
-
{ name: 'terminal - danger - host', value: 'terminal-danger-host' },
|
|
146
|
-
{ name: 'foreground - safe - devcontainer', value: 'foreground-safe-devcontainer' },
|
|
147
|
-
{ name: 'foreground - safe - host', value: 'foreground-safe-host' },
|
|
148
|
-
{ name: 'foreground - danger - devcontainer', value: 'foreground-danger-devcontainer' },
|
|
149
|
-
{ name: 'foreground - danger - host', value: 'foreground-danger-host' },
|
|
123
|
+
{ name: 'terminal - safe - devcontainer', value: 'terminal-safe-devcontainer', command: '' },
|
|
124
|
+
{ name: 'terminal - safe - host', value: 'terminal-safe-host', command: '' },
|
|
125
|
+
{ name: 'terminal - danger - devcontainer', value: 'terminal-danger-devcontainer', command: '' },
|
|
126
|
+
{ name: 'terminal - danger - host', value: 'terminal-danger-host', command: '' },
|
|
127
|
+
{ name: 'foreground - safe - devcontainer', value: 'foreground-safe-devcontainer', command: '' },
|
|
128
|
+
{ name: 'foreground - safe - host', value: 'foreground-safe-host', command: '' },
|
|
129
|
+
{ name: 'foreground - danger - devcontainer', value: 'foreground-danger-devcontainer', command: '' },
|
|
130
|
+
{ name: 'foreground - danger - host', value: 'foreground-danger-host', command: '' },
|
|
150
131
|
];
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
132
|
+
const { config } = await this.prompt([{
|
|
133
|
+
type: 'list',
|
|
134
|
+
name: 'config',
|
|
135
|
+
message: 'Select shell configuration (displayMode-permissionMode-environment):',
|
|
136
|
+
choices: hasDevcontainer ? configChoices : configChoices.filter(c => c.value.endsWith('-host')),
|
|
137
|
+
}], agentConfig);
|
|
138
|
+
// Parse the config selection (this won't be reached in JSON mode as agentPrompt exits)
|
|
139
|
+
const [displayMode, permissionMode, environment] = config.split('-');
|
|
140
|
+
const dangerMode = permissionMode === 'danger';
|
|
141
|
+
if (environment === 'devcontainer') {
|
|
142
|
+
await this.openDevcontainerShell(workspaceInfo.path, agentDir, agentName, displayMode, dangerMode);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
await this.openHostShell(workspaceInfo.path, agentDir, agentName, displayMode, dangerMode);
|
|
146
|
+
}
|
|
147
|
+
return;
|
|
155
148
|
}
|
|
156
|
-
// Prompt for environment
|
|
149
|
+
// Interactive mode: Prompt for environment
|
|
157
150
|
let environment = 'host';
|
|
158
151
|
if (hasDevcontainer) {
|
|
159
|
-
const { selectedEnvironment } = await
|
|
160
|
-
{
|
|
152
|
+
const { selectedEnvironment } = await this.prompt([{
|
|
161
153
|
type: 'list',
|
|
162
154
|
name: 'selectedEnvironment',
|
|
163
155
|
message: 'Where should the shell run?',
|
|
164
156
|
choices: [
|
|
165
|
-
{ name: '🐳 devcontainer (recommended)', value: 'devcontainer' },
|
|
166
|
-
{ name: '💻 host (agent worktree on your machine)', value: 'host' },
|
|
157
|
+
{ name: '🐳 devcontainer (recommended)', value: 'devcontainer', command: '' },
|
|
158
|
+
{ name: '💻 host (agent worktree on your machine)', value: 'host', command: '' },
|
|
167
159
|
],
|
|
168
|
-
|
|
169
|
-
},
|
|
170
|
-
]);
|
|
160
|
+
}], null);
|
|
171
161
|
environment = selectedEnvironment;
|
|
172
162
|
}
|
|
173
|
-
// Prompt for display mode
|
|
174
|
-
const { displayMode
|
|
175
|
-
{
|
|
163
|
+
// Interactive mode: Prompt for display mode
|
|
164
|
+
const { displayMode } = await this.prompt([{
|
|
176
165
|
type: 'list',
|
|
177
166
|
name: 'displayMode',
|
|
178
167
|
message: 'How should the shell be opened?',
|
|
179
168
|
choices: [
|
|
180
|
-
{ name: 'terminal - New terminal window', value: 'terminal' },
|
|
181
|
-
{ name: 'foreground - Run in current terminal', value: 'foreground' },
|
|
169
|
+
{ name: 'terminal - New terminal window', value: 'terminal', command: '' },
|
|
170
|
+
{ name: 'foreground - Run in current terminal', value: 'foreground', command: '' },
|
|
182
171
|
],
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
172
|
+
}], null);
|
|
173
|
+
// Interactive mode: Prompt for permission mode
|
|
174
|
+
const { permissionMode } = await this.prompt([{
|
|
186
175
|
type: 'list',
|
|
187
176
|
name: 'permissionMode',
|
|
188
177
|
message: 'Permission mode for Claude Code:',
|
|
189
178
|
choices: [
|
|
190
|
-
{ name: '🔒 safe - Requires approval for dangerous operations', value: 'safe' },
|
|
191
|
-
{ name: '⚠️ danger - Skip permission checks', value: 'danger' },
|
|
179
|
+
{ name: '🔒 safe - Requires approval for dangerous operations', value: 'safe', command: '' },
|
|
180
|
+
{ name: '⚠️ danger - Skip permission checks', value: 'danger', command: '' },
|
|
192
181
|
],
|
|
193
|
-
|
|
194
|
-
},
|
|
195
|
-
]);
|
|
182
|
+
}], null);
|
|
196
183
|
this.log('');
|
|
197
184
|
this.log(colors.primary(`🐚 Opening shell for agent: ${agentName}`));
|
|
198
185
|
this.log('');
|
|
@@ -8,6 +8,7 @@ export default class Add extends Command {
|
|
|
8
8
|
static flags: {
|
|
9
9
|
'no-container': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
10
|
theme: 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
|
clone: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
14
|
};
|
|
@@ -28,9 +28,15 @@ export default class Add extends Command {
|
|
|
28
28
|
char: 't',
|
|
29
29
|
description: 'Pick agent name(s) from a theme (billionaires, toyotas, companies, or custom)',
|
|
30
30
|
}),
|
|
31
|
+
machine: Flags.boolean({
|
|
32
|
+
char: 'm',
|
|
33
|
+
description: 'Output as JSON for AI agents/scripts (machine-readable mode)',
|
|
34
|
+
default: false,
|
|
35
|
+
}),
|
|
31
36
|
json: Flags.boolean({
|
|
32
|
-
description: 'Output
|
|
37
|
+
description: 'Output as JSON (deprecated, use --machine)',
|
|
33
38
|
default: false,
|
|
39
|
+
hidden: true,
|
|
34
40
|
}),
|
|
35
41
|
clone: Flags.boolean({
|
|
36
42
|
description: 'Use independent git clone instead of worktree (more isolation, no real-time sync)',
|
|
@@ -5,6 +5,7 @@ export default class Staff extends PMOCommand {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
'no-interactive': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
9
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
};
|
|
10
11
|
protected getPMOOptions(): {
|
|
@@ -29,11 +29,12 @@ export default class Staff extends PMOCommand {
|
|
|
29
29
|
// Check if JSON output mode is active
|
|
30
30
|
const jsonMode = shouldOutputJson(flags);
|
|
31
31
|
// Define choices once, use for both JSON and interactive modes
|
|
32
|
+
// Include command field for AI agent navigation
|
|
32
33
|
const menuChoices = [
|
|
33
|
-
{ name: 'List staff agents', value: 'list' },
|
|
34
|
-
{ name: 'Add staff agent', value: 'add' },
|
|
35
|
-
{ name: 'Remove staff agent', value: 'remove' },
|
|
36
|
-
{ name: 'Cancel', value: 'cancel' },
|
|
34
|
+
{ name: 'List staff agents', value: 'list', command: 'prlt agent staff list --machine' },
|
|
35
|
+
{ name: 'Add staff agent', value: 'add', command: 'prlt agent staff add --machine' },
|
|
36
|
+
{ name: 'Remove staff agent', value: 'remove', command: 'prlt agent staff remove --machine' },
|
|
37
|
+
{ name: 'Cancel', value: 'cancel', command: '' },
|
|
37
38
|
];
|
|
38
39
|
const message = 'What would you like to do?';
|
|
39
40
|
// In JSON mode, output menu prompt
|
|
@@ -7,6 +7,7 @@ export default class Remove extends PMOCommand {
|
|
|
7
7
|
};
|
|
8
8
|
static flags: {
|
|
9
9
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
};
|
|
12
13
|
protected getPMOOptions(): {
|
|
@@ -7,6 +7,7 @@ export default class Status extends PMOCommand {
|
|
|
7
7
|
};
|
|
8
8
|
static flags: {
|
|
9
9
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
};
|
|
12
13
|
protected getPMOOptions(): {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import inquirer from 'inquirer';
|
|
3
2
|
import { colors, format } from '../../lib/colors.js';
|
|
4
3
|
import { getWorkspaceInfo, getAgentStatus } from '../../lib/agents/commands.js';
|
|
5
4
|
import { PMOCommand, pmoBaseFlags } from '../../lib/pmo/index.js';
|
|
6
|
-
import { shouldOutputJson,
|
|
5
|
+
import { shouldOutputJson, outputErrorAsJson, createMetadata, } from '../../lib/prompt-json.js';
|
|
7
6
|
export default class Status extends PMOCommand {
|
|
8
7
|
static description = 'Show detailed status for a specific agent';
|
|
9
8
|
static examples = [
|
|
@@ -41,38 +40,27 @@ export default class Status extends PMOCommand {
|
|
|
41
40
|
return;
|
|
42
41
|
}
|
|
43
42
|
let agentName = args.name;
|
|
43
|
+
// Agent mode config for prompts
|
|
44
|
+
const agentConfig = jsonMode ? { flags, commandName: 'agent status' } : null;
|
|
44
45
|
// Interactive mode if no agent specified
|
|
45
46
|
if (!agentName) {
|
|
46
|
-
// In JSON mode, output agent selection prompt
|
|
47
|
-
if (jsonMode) {
|
|
48
|
-
const agentChoices = workspaceInfo.agents.map((agent) => ({ name: agent.name, value: agent.name }));
|
|
49
|
-
outputPromptAsJson(buildPromptConfig('list', 'name', 'Select agent to view status:', agentChoices), createMetadata('agent status', flags));
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
47
|
// Group agents by type
|
|
53
48
|
const staffAgents = workspaceInfo.agents.filter(a => a.type === 'persistent');
|
|
54
49
|
const tempAgents = workspaceInfo.agents.filter(a => a.type === 'ephemeral');
|
|
50
|
+
// Build choices with command field for JSON mode
|
|
55
51
|
const choices = [];
|
|
56
|
-
|
|
57
|
-
choices.push(
|
|
58
|
-
for (const agent of staffAgents) {
|
|
59
|
-
choices.push({ name: `👔 ${agent.name}`, value: agent.name });
|
|
60
|
-
}
|
|
52
|
+
for (const agent of staffAgents) {
|
|
53
|
+
choices.push({ name: `👔 ${agent.name}`, value: agent.name, command: `prlt agent status ${agent.name} --machine` });
|
|
61
54
|
}
|
|
62
|
-
|
|
63
|
-
choices.push(
|
|
64
|
-
for (const agent of tempAgents) {
|
|
65
|
-
choices.push({ name: `⏱️ ${agent.name}`, value: agent.name });
|
|
66
|
-
}
|
|
55
|
+
for (const agent of tempAgents) {
|
|
56
|
+
choices.push({ name: `⏱️ ${agent.name}`, value: agent.name, command: `prlt agent status ${agent.name} --machine` });
|
|
67
57
|
}
|
|
68
|
-
const { selected } = await
|
|
69
|
-
{
|
|
58
|
+
const { selected } = await this.prompt([{
|
|
70
59
|
type: 'list',
|
|
71
60
|
name: 'selected',
|
|
72
61
|
message: 'Select agent to view status:',
|
|
73
|
-
choices
|
|
74
|
-
}
|
|
75
|
-
]);
|
|
62
|
+
choices,
|
|
63
|
+
}], agentConfig);
|
|
76
64
|
agentName = selected;
|
|
77
65
|
}
|
|
78
66
|
await this.showDetailedStatus(workspaceInfo, agentName);
|
|
@@ -14,6 +14,7 @@ export default class Cleanup extends PMOCommand {
|
|
|
14
14
|
push: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
15
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
16
|
'no-interactive': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
18
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
19
|
};
|
|
19
20
|
protected getPMOOptions(): {
|
|
@@ -5,6 +5,7 @@ export default class Temp extends PMOCommand {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
'no-interactive': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
9
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
};
|
|
10
11
|
protected getPMOOptions(): {
|
|
@@ -29,10 +29,11 @@ export default class Temp extends PMOCommand {
|
|
|
29
29
|
// Check if JSON output mode is active
|
|
30
30
|
const jsonMode = shouldOutputJson(flags);
|
|
31
31
|
// Define choices once, use for both JSON and interactive modes
|
|
32
|
+
// Include command field for AI agent navigation
|
|
32
33
|
const menuChoices = [
|
|
33
|
-
{ name: 'List temp agents', value: 'list' },
|
|
34
|
-
{ name: 'Clean up temp agents', value: 'cleanup' },
|
|
35
|
-
{ name: 'Cancel', value: 'cancel' },
|
|
34
|
+
{ name: 'List temp agents', value: 'list', command: 'prlt agent temp list --machine' },
|
|
35
|
+
{ name: 'Clean up temp agents', value: 'cleanup', command: 'prlt agent temp cleanup --machine' },
|
|
36
|
+
{ name: 'Cancel', value: 'cancel', command: '' },
|
|
36
37
|
];
|
|
37
38
|
const message = 'What would you like to do?';
|
|
38
39
|
// In JSON mode, output menu prompt
|
|
@@ -3,6 +3,7 @@ export default class Themes 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>;
|
|
@@ -13,9 +13,15 @@ export default class Themes extends Command {
|
|
|
13
13
|
'<%= config.bin %> <%= command.id %> add-names greek-gods zeus athena',
|
|
14
14
|
];
|
|
15
15
|
static flags = {
|
|
16
|
+
machine: Flags.boolean({
|
|
17
|
+
char: 'm',
|
|
18
|
+
description: 'Output as JSON for AI agents/scripts (machine-readable mode)',
|
|
19
|
+
default: false,
|
|
20
|
+
}),
|
|
16
21
|
json: Flags.boolean({
|
|
17
|
-
description: 'Output
|
|
22
|
+
description: 'Output as JSON (deprecated, use --machine)',
|
|
18
23
|
default: false,
|
|
24
|
+
hidden: true,
|
|
19
25
|
}),
|
|
20
26
|
};
|
|
21
27
|
async run() {
|
|
@@ -26,8 +32,8 @@ export default class Themes extends Command {
|
|
|
26
32
|
// Each choice includes the full command for AI agents to execute
|
|
27
33
|
const menuChoices = [
|
|
28
34
|
{ id: 'list', name: 'List themes', command: 'prlt agent themes list --format json' },
|
|
29
|
-
{ id: 'create', name: 'Create a new theme', command: 'prlt agent themes create --
|
|
30
|
-
{ id: 'add-names', name: 'Add names to a theme', command: 'prlt agent themes add-names --
|
|
35
|
+
{ id: 'create', name: 'Create a new theme', command: 'prlt agent themes create --machine' },
|
|
36
|
+
{ id: 'add-names', name: 'Add names to a theme', command: 'prlt agent themes add-names --machine' },
|
|
31
37
|
{ id: 'cancel', name: 'Cancel', command: '' },
|
|
32
38
|
];
|
|
33
39
|
const message = 'What would you like to do?';
|
|
@@ -6,6 +6,7 @@ export default class ThemesSet extends Command {
|
|
|
6
6
|
theme: 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
|
};
|
|
11
12
|
run(): Promise<void>;
|