@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,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import Database from 'better-sqlite3';
|
|
4
|
-
import inquirer from 'inquirer';
|
|
5
|
-
import { getPMOContext } from '../../lib/pmo/index.js';
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { PMOCommand, pmoBaseFlags, } from '../../lib/pmo/index.js';
|
|
6
3
|
import { styles } from '../../lib/styles.js';
|
|
7
|
-
import { getWorkspaceInfo } from '../../lib/agents/commands.js';
|
|
8
4
|
import { isGHInstalled, isGHAuthenticated, getCurrentBranch, getDefaultBaseBranch, hasBranchBeenPushed, pushBranch, hasUnpushedCommits, getCommitLog, createPR, getPRForBranch, generatePRTitle, generatePRBody, } from '../../lib/pr/index.js';
|
|
9
|
-
import { shouldOutputJson,
|
|
10
|
-
|
|
5
|
+
import { shouldOutputJson, outputErrorAsJson, createMetadata, } from '../../lib/prompt-json.js';
|
|
6
|
+
import { FlagResolver } from '../../lib/flags/index.js';
|
|
7
|
+
export default class PRCreate extends PMOCommand {
|
|
11
8
|
static description = 'Create a GitHub pull request from the current branch';
|
|
12
9
|
static examples = [
|
|
13
10
|
'<%= config.bin %> <%= command.id %>',
|
|
@@ -22,6 +19,7 @@ export default class PRCreate extends Command {
|
|
|
22
19
|
}),
|
|
23
20
|
};
|
|
24
21
|
static flags = {
|
|
22
|
+
...pmoBaseFlags,
|
|
25
23
|
base: Flags.string({
|
|
26
24
|
char: 'b',
|
|
27
25
|
description: 'Base branch for the PR (defaults to main/master)',
|
|
@@ -42,12 +40,26 @@ export default class PRCreate extends Command {
|
|
|
42
40
|
body: Flags.string({
|
|
43
41
|
description: 'PR body/description',
|
|
44
42
|
}),
|
|
45
|
-
|
|
46
|
-
description: '
|
|
47
|
-
default: false,
|
|
43
|
+
ticket: Flags.string({
|
|
44
|
+
description: 'Ticket ID to link (alternative to positional arg)',
|
|
48
45
|
}),
|
|
49
46
|
};
|
|
50
|
-
|
|
47
|
+
// Flag to track if PMO is available (for graceful degradation)
|
|
48
|
+
hasPMO = true;
|
|
49
|
+
/**
|
|
50
|
+
* Override init to gracefully handle missing PMO
|
|
51
|
+
* PR creation should work even without PMO (just without ticket linking)
|
|
52
|
+
*/
|
|
53
|
+
async init() {
|
|
54
|
+
try {
|
|
55
|
+
await super.init();
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// PMO not available - that's fine, we can still create PRs
|
|
59
|
+
this.hasPMO = false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async execute() {
|
|
51
63
|
const { args, flags } = await this.parse(PRCreate);
|
|
52
64
|
// Check if JSON output mode is active
|
|
53
65
|
const jsonMode = shouldOutputJson(flags);
|
|
@@ -84,159 +96,130 @@ export default class PRCreate extends Command {
|
|
|
84
96
|
this.log(styles.muted(` URL: ${existingPR.url}`));
|
|
85
97
|
return;
|
|
86
98
|
}
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
let storage = null;
|
|
90
|
-
let db = null;
|
|
91
|
-
try {
|
|
92
|
-
workspaceInfo = getWorkspaceInfo();
|
|
93
|
-
const pmoContext = await getPMOContext({
|
|
94
|
-
logger: (msg) => this.log(styles.muted(msg)),
|
|
95
|
-
});
|
|
96
|
-
storage = pmoContext.storage;
|
|
97
|
-
db = new Database(path.join(workspaceInfo.path, '.proletariat', 'workspace.db'));
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
// No workspace - that's fine, we can still create PRs
|
|
99
|
+
// Log if PMO is not available
|
|
100
|
+
if (!this.hasPMO) {
|
|
101
101
|
this.log(styles.muted(' No workspace found - creating PR without ticket linking'));
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
this.log(styles.muted(` Auto-detected ticket: ${ticketId}`));
|
|
112
|
-
}
|
|
103
|
+
// Determine ticket ID from args or flags
|
|
104
|
+
let ticketId = args.ticketId || flags.ticket;
|
|
105
|
+
if (!ticketId && !flags['no-link'] && this.hasPMO) {
|
|
106
|
+
// Try to extract ticket ID from branch name (e.g., feat/agent/TKT-001-description)
|
|
107
|
+
const ticketMatch = currentBranch.match(/(TKT-\d+)/i);
|
|
108
|
+
if (ticketMatch) {
|
|
109
|
+
ticketId = ticketMatch[1].toUpperCase();
|
|
110
|
+
this.log(styles.muted(` Auto-detected ticket: ${ticketId}`));
|
|
113
111
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
112
|
+
}
|
|
113
|
+
// Get ticket info if available
|
|
114
|
+
let ticket = null;
|
|
115
|
+
if (ticketId && this.hasPMO) {
|
|
116
|
+
ticket = await this.storage.getTicket(ticketId);
|
|
117
|
+
if (!ticket) {
|
|
118
|
+
this.warn(`Ticket "${ticketId}" not found. Continuing without ticket link.`);
|
|
119
|
+
ticketId = undefined;
|
|
122
120
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
}
|
|
122
|
+
// If no ticket, prompt for selection (only if we have PMO)
|
|
123
|
+
if (!ticketId && !flags['no-link'] && this.hasPMO) {
|
|
124
|
+
const projectId = flags.project;
|
|
125
|
+
const allTickets = await this.storage.listTickets(projectId);
|
|
126
|
+
const inProgressTickets = allTickets.filter(t => t.statusName && t.statusName.toLowerCase().includes('progress'));
|
|
127
|
+
if (inProgressTickets.length > 0) {
|
|
128
|
+
// Use FlagResolver for ticket selection
|
|
129
|
+
const resolver = new FlagResolver({
|
|
130
|
+
commandName: 'pr create',
|
|
131
|
+
baseCommand: 'prlt pr create',
|
|
132
|
+
jsonMode,
|
|
133
|
+
flags: { ticket: ticketId },
|
|
134
|
+
});
|
|
135
|
+
resolver.addPrompt({
|
|
136
|
+
flagName: 'ticket',
|
|
137
|
+
type: 'list',
|
|
138
|
+
message: 'Link PR to a ticket?',
|
|
139
|
+
choices: () => [
|
|
131
140
|
...inProgressTickets.map(t => ({
|
|
132
141
|
name: `${t.id} - ${t.title}`,
|
|
133
142
|
value: t.id,
|
|
134
143
|
})),
|
|
135
144
|
{ name: 'Skip - create PR without linking', value: '__skip__' },
|
|
136
|
-
]
|
|
137
|
-
|
|
138
|
-
// In JSON mode, output ticket selection prompt and exit
|
|
139
|
-
if (jsonMode) {
|
|
140
|
-
outputPromptAsJson(buildPromptConfig('list', 'ticketId', message, ticketChoices), createMetadata('pr create', flags));
|
|
141
|
-
}
|
|
142
|
-
const { selectedTicketId } = await inquirer.prompt([
|
|
143
|
-
{
|
|
144
|
-
type: 'list',
|
|
145
|
-
name: 'selectedTicketId',
|
|
146
|
-
message,
|
|
147
|
-
choices: [
|
|
148
|
-
...ticketChoices.slice(0, -1),
|
|
149
|
-
new inquirer.Separator(),
|
|
150
|
-
ticketChoices[ticketChoices.length - 1],
|
|
151
|
-
],
|
|
152
|
-
},
|
|
153
|
-
]);
|
|
154
|
-
if (selectedTicketId !== '__skip__') {
|
|
155
|
-
ticketId = selectedTicketId;
|
|
156
|
-
ticket = await storage.getTicket(ticketId);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
// Generate PR title and body
|
|
161
|
-
let prTitle = flags.title;
|
|
162
|
-
let prBody = flags.body;
|
|
163
|
-
if (!prTitle) {
|
|
164
|
-
if (ticket) {
|
|
165
|
-
prTitle = generatePRTitle(ticket.id, ticket.title);
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
// Use branch name as title
|
|
169
|
-
const branchParts = currentBranch.split('/');
|
|
170
|
-
prTitle = branchParts[branchParts.length - 1].replace(/-/g, ' ');
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
if (!prBody && ticket) {
|
|
174
|
-
const commits = getCommitLog(baseBranch);
|
|
175
|
-
prBody = generatePRBody({
|
|
176
|
-
ticketId: ticket.id,
|
|
177
|
-
ticketTitle: ticket.title,
|
|
178
|
-
ticketDescription: ticket.description,
|
|
179
|
-
commits: commits.slice(0, 10), // Limit to 10 commits
|
|
145
|
+
],
|
|
146
|
+
when: (ctx) => !ctx.flags.ticket,
|
|
180
147
|
});
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (!pushBranch(currentBranch)) {
|
|
186
|
-
this.error('Failed to push branch to origin.');
|
|
148
|
+
const resolved = await resolver.resolve();
|
|
149
|
+
if (resolved.ticket && resolved.ticket !== '__skip__') {
|
|
150
|
+
ticketId = resolved.ticket;
|
|
151
|
+
ticket = await this.storage.getTicket(ticketId);
|
|
187
152
|
}
|
|
188
153
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
154
|
+
}
|
|
155
|
+
// Generate PR title and body
|
|
156
|
+
let prTitle = flags.title;
|
|
157
|
+
let prBody = flags.body;
|
|
158
|
+
if (!prTitle) {
|
|
159
|
+
if (ticket) {
|
|
160
|
+
prTitle = generatePRTitle(ticket.id, ticket.title);
|
|
194
161
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
this.log(styles.muted(` Base: ${baseBranch}`));
|
|
200
|
-
this.log(styles.muted(` Title: ${prTitle}`));
|
|
201
|
-
if (flags.draft) {
|
|
202
|
-
this.log(styles.muted(` Draft: yes`));
|
|
162
|
+
else {
|
|
163
|
+
// Use branch name as title
|
|
164
|
+
const branchParts = currentBranch.split('/');
|
|
165
|
+
prTitle = branchParts[branchParts.length - 1].replace(/-/g, ' ');
|
|
203
166
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
167
|
+
}
|
|
168
|
+
if (!prBody && ticket) {
|
|
169
|
+
const commits = getCommitLog(baseBranch);
|
|
170
|
+
prBody = generatePRBody({
|
|
171
|
+
ticketId: ticket.id,
|
|
172
|
+
ticketTitle: ticket.title,
|
|
173
|
+
ticketDescription: ticket.description,
|
|
174
|
+
commits: commits.slice(0, 10), // Limit to 10 commits
|
|
209
175
|
});
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (
|
|
215
|
-
|
|
216
|
-
metadata: {
|
|
217
|
-
pr_url: result.url,
|
|
218
|
-
pr_number: String(result.number),
|
|
219
|
-
},
|
|
220
|
-
});
|
|
176
|
+
}
|
|
177
|
+
// Push branch if not pushed
|
|
178
|
+
if (!hasBranchBeenPushed(currentBranch)) {
|
|
179
|
+
this.log(styles.muted(` Pushing branch to origin...`));
|
|
180
|
+
if (!pushBranch(currentBranch)) {
|
|
181
|
+
this.error('Failed to push branch to origin.');
|
|
221
182
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
this.log(styles.success(`Pull request created!`));
|
|
228
|
-
this.log(styles.muted(` PR #${result.number}`));
|
|
229
|
-
this.log(styles.muted(` URL: ${result.url}`));
|
|
230
|
-
if (ticket) {
|
|
231
|
-
this.log(styles.muted(` Linked to: ${ticket.id}`));
|
|
183
|
+
}
|
|
184
|
+
else if (hasUnpushedCommits(currentBranch)) {
|
|
185
|
+
this.log(styles.muted(` Pushing unpushed commits...`));
|
|
186
|
+
if (!pushBranch(currentBranch)) {
|
|
187
|
+
this.error('Failed to push commits to origin.');
|
|
232
188
|
}
|
|
233
189
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
190
|
+
// Create PR
|
|
191
|
+
this.log('');
|
|
192
|
+
this.log(styles.header('Creating Pull Request'));
|
|
193
|
+
this.log(styles.muted(` Branch: ${currentBranch}`));
|
|
194
|
+
this.log(styles.muted(` Base: ${baseBranch}`));
|
|
195
|
+
this.log(styles.muted(` Title: ${prTitle}`));
|
|
196
|
+
if (flags.draft) {
|
|
197
|
+
this.log(styles.muted(` Draft: yes`));
|
|
198
|
+
}
|
|
199
|
+
const result = createPR({
|
|
200
|
+
title: prTitle,
|
|
201
|
+
body: prBody,
|
|
202
|
+
base: baseBranch,
|
|
203
|
+
draft: flags.draft,
|
|
204
|
+
});
|
|
205
|
+
if (!result.success) {
|
|
206
|
+
this.error(`Failed to create PR: ${result.error}`);
|
|
207
|
+
}
|
|
208
|
+
// Store PR URL in ticket metadata
|
|
209
|
+
if (ticket && result.url && this.hasPMO) {
|
|
210
|
+
await this.storage.updateTicket(ticket.id, {
|
|
211
|
+
metadata: {
|
|
212
|
+
pr_url: result.url,
|
|
213
|
+
pr_number: String(result.number),
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
this.log('');
|
|
218
|
+
this.log(styles.success(`Pull request created!`));
|
|
219
|
+
this.log(styles.muted(` PR #${result.number}`));
|
|
220
|
+
this.log(styles.muted(` URL: ${result.url}`));
|
|
221
|
+
if (ticket) {
|
|
222
|
+
this.log(styles.muted(` Linked to: ${ticket.id}`));
|
|
240
223
|
}
|
|
241
224
|
}
|
|
242
225
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class PR extends
|
|
1
|
+
import { PMOCommand } from '../../lib/pmo/index.js';
|
|
2
|
+
export default class PR extends PMOCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
+
action: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
6
8
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
10
|
};
|
|
8
|
-
|
|
11
|
+
execute(): Promise<void>;
|
|
9
12
|
}
|
|
@@ -1,59 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
export default class PR extends
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { PMOCommand, pmoBaseFlags, } from '../../lib/pmo/index.js';
|
|
3
|
+
import { shouldOutputJson, outputErrorAsJson, createMetadata, } from '../../lib/prompt-json.js';
|
|
4
|
+
import { FlagResolver } from '../../lib/flags/index.js';
|
|
5
|
+
export default class PR extends PMOCommand {
|
|
6
6
|
static description = 'Interactive menu for pull request operations';
|
|
7
7
|
static examples = [
|
|
8
8
|
'<%= config.bin %> <%= command.id %>',
|
|
9
9
|
];
|
|
10
10
|
static flags = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
...pmoBaseFlags,
|
|
12
|
+
action: Flags.string({
|
|
13
|
+
char: 'a',
|
|
14
|
+
description: 'Action to perform (create, link, status)',
|
|
15
|
+
options: ['create', 'link', 'status'],
|
|
14
16
|
}),
|
|
15
17
|
};
|
|
16
|
-
async
|
|
18
|
+
async execute() {
|
|
17
19
|
const { flags } = await this.parse(PR);
|
|
18
20
|
// Check if JSON output mode is active
|
|
19
21
|
const jsonMode = shouldOutputJson(flags);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
// Helper to handle errors in JSON mode
|
|
23
|
+
const handleError = (code, message) => {
|
|
22
24
|
if (jsonMode) {
|
|
23
|
-
outputErrorAsJson(
|
|
25
|
+
outputErrorAsJson(code, message, createMetadata('pr', flags));
|
|
24
26
|
this.exit(1);
|
|
25
27
|
}
|
|
26
|
-
this.error(
|
|
28
|
+
this.error(message);
|
|
29
|
+
};
|
|
30
|
+
// PMOCommand base class ensures PMO context is available
|
|
31
|
+
if (!this.storage) {
|
|
32
|
+
return handleError('PMO_NOT_FOUND', 'PMO not found. Run "prlt pmo init" first.');
|
|
27
33
|
}
|
|
28
|
-
//
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
menuChoices[menuChoices.length - 1],
|
|
50
|
-
],
|
|
51
|
-
}]);
|
|
52
|
-
if (action === 'cancel') {
|
|
34
|
+
// Use FlagResolver for action selection
|
|
35
|
+
const resolver = new FlagResolver({
|
|
36
|
+
commandName: 'pr',
|
|
37
|
+
baseCommand: 'prlt pr',
|
|
38
|
+
jsonMode,
|
|
39
|
+
flags: { action: flags.action },
|
|
40
|
+
});
|
|
41
|
+
resolver.addPrompt({
|
|
42
|
+
flagName: 'action',
|
|
43
|
+
type: 'list',
|
|
44
|
+
message: 'Pull Request Operations - What would you like to do?',
|
|
45
|
+
choices: () => [
|
|
46
|
+
{ name: 'Create PR from current branch', value: 'create' },
|
|
47
|
+
{ name: 'Link existing PR to ticket', value: 'link' },
|
|
48
|
+
{ name: 'View PR status for ticket', value: 'status' },
|
|
49
|
+
{ name: 'Cancel', value: 'cancel' },
|
|
50
|
+
],
|
|
51
|
+
when: (ctx) => !ctx.flags.action,
|
|
52
|
+
});
|
|
53
|
+
const resolved = await resolver.resolve();
|
|
54
|
+
if (!resolved.action || resolved.action === 'cancel') {
|
|
53
55
|
return;
|
|
54
56
|
}
|
|
55
57
|
// Run the selected subcommand
|
|
56
|
-
switch (action) {
|
|
58
|
+
switch (resolved.action) {
|
|
57
59
|
case 'create':
|
|
58
60
|
await this.config.runCommand('pr:create', []);
|
|
59
61
|
break;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class PRLink extends
|
|
1
|
+
import { PMOCommand } from '../../lib/pmo/index.js';
|
|
2
|
+
export default class PRLink extends PMOCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static args: {
|
|
@@ -8,7 +8,11 @@ export default class PRLink extends Command {
|
|
|
8
8
|
static flags: {
|
|
9
9
|
pr: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
ticket: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
confirm: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
14
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
16
|
};
|
|
13
|
-
|
|
17
|
+
execute(): Promise<void>;
|
|
14
18
|
}
|