@proletariat/cli 0.3.65 → 0.3.66
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/agents/index.d.ts +11 -0
- package/dist/commands/agents/index.js +105 -0
- package/dist/commands/agents/index.js.map +1 -0
- package/dist/commands/pr/checks.d.ts +20 -0
- package/dist/commands/pr/checks.js +154 -0
- package/dist/commands/pr/checks.js.map +1 -0
- package/dist/commands/pr/index.js +10 -2
- package/dist/commands/pr/index.js.map +1 -1
- package/dist/commands/pr/merge.d.ts +22 -0
- package/dist/commands/pr/merge.js +145 -0
- package/dist/commands/pr/merge.js.map +1 -0
- package/dist/commands/version/bump.d.ts +13 -0
- package/dist/commands/version/bump.js +125 -0
- package/dist/commands/version/bump.js.map +1 -0
- package/dist/commands/work/start.js +25 -0
- package/dist/commands/work/start.js.map +1 -1
- package/dist/lib/execution/runners.js +14 -6
- package/dist/lib/execution/runners.js.map +1 -1
- package/dist/lib/pr/index.d.ts +28 -0
- package/dist/lib/pr/index.js +53 -1
- package/dist/lib/pr/index.js.map +1 -1
- package/dist/lib/registry/index.d.ts +52 -0
- package/dist/lib/registry/index.js +169 -0
- package/dist/lib/registry/index.js.map +1 -0
- package/oclif.manifest.json +3391 -3150
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Agents extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
status: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { getMachineAgents } from '../../lib/registry/index.js';
|
|
4
|
+
export default class Agents extends Command {
|
|
5
|
+
static description = 'List all agents across all projects (machine-wide registry)';
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> <%= command.id %>',
|
|
8
|
+
'<%= config.bin %> <%= command.id %> --status running',
|
|
9
|
+
'<%= config.bin %> <%= command.id %> --project /path/to/project',
|
|
10
|
+
'<%= config.bin %> <%= command.id %> --json',
|
|
11
|
+
];
|
|
12
|
+
static flags = {
|
|
13
|
+
status: Flags.string({
|
|
14
|
+
char: 's',
|
|
15
|
+
description: 'Filter by agent status',
|
|
16
|
+
options: ['running', 'idle', 'completed'],
|
|
17
|
+
}),
|
|
18
|
+
project: Flags.string({
|
|
19
|
+
char: 'p',
|
|
20
|
+
description: 'Filter by project path',
|
|
21
|
+
}),
|
|
22
|
+
json: Flags.boolean({
|
|
23
|
+
description: 'Output as JSON',
|
|
24
|
+
default: false,
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
async run() {
|
|
28
|
+
const { flags } = await this.parse(Agents);
|
|
29
|
+
const agents = getMachineAgents({
|
|
30
|
+
status: flags.status,
|
|
31
|
+
projectPath: flags.project,
|
|
32
|
+
});
|
|
33
|
+
// JSON output mode
|
|
34
|
+
if (flags.json) {
|
|
35
|
+
this.log(JSON.stringify({ agents }, null, 2));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (agents.length === 0) {
|
|
39
|
+
const filterDesc = flags.status ? ` with status "${flags.status}"` : '';
|
|
40
|
+
this.log(chalk.yellow(`No agents found${filterDesc}.`));
|
|
41
|
+
this.log(chalk.dim('Agents are registered when you run "prlt work start".'));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// Group by project
|
|
45
|
+
const byProject = new Map();
|
|
46
|
+
for (const agent of agents) {
|
|
47
|
+
const list = byProject.get(agent.projectPath) || [];
|
|
48
|
+
list.push(agent);
|
|
49
|
+
byProject.set(agent.projectPath, list);
|
|
50
|
+
}
|
|
51
|
+
this.log(chalk.bold.cyan('\n Machine-Wide Agent Registry\n'));
|
|
52
|
+
for (const [projectPath, projectAgents] of byProject) {
|
|
53
|
+
this.log(chalk.bold(` ${projectPath}`));
|
|
54
|
+
for (const agent of projectAgents) {
|
|
55
|
+
const statusIcon = agent.status === 'running' ? '🟢'
|
|
56
|
+
: agent.status === 'idle' ? '🟡'
|
|
57
|
+
: '⚪';
|
|
58
|
+
const statusColor = agent.status === 'running' ? chalk.green
|
|
59
|
+
: agent.status === 'idle' ? chalk.yellow
|
|
60
|
+
: chalk.dim;
|
|
61
|
+
const parts = [
|
|
62
|
+
`${statusIcon} ${chalk.bold(agent.agentName)}`,
|
|
63
|
+
statusColor(agent.status),
|
|
64
|
+
];
|
|
65
|
+
if (agent.ticketId) {
|
|
66
|
+
parts.push(chalk.blue(agent.ticketId));
|
|
67
|
+
}
|
|
68
|
+
this.log(` ${parts.join(' ')}`);
|
|
69
|
+
const spawnedAt = formatRelativeTime(agent.spawnedAt);
|
|
70
|
+
const lastSeen = formatRelativeTime(agent.lastSeenAt);
|
|
71
|
+
this.log(chalk.dim(` spawned ${spawnedAt} | last seen ${lastSeen}`));
|
|
72
|
+
if (agent.sessionId) {
|
|
73
|
+
this.log(chalk.dim(` session: ${agent.sessionId}`));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
this.log('');
|
|
77
|
+
}
|
|
78
|
+
// Summary
|
|
79
|
+
const running = agents.filter(a => a.status === 'running').length;
|
|
80
|
+
const idle = agents.filter(a => a.status === 'idle').length;
|
|
81
|
+
const completed = agents.filter(a => a.status === 'completed').length;
|
|
82
|
+
this.log(chalk.bold(' Summary:'));
|
|
83
|
+
this.log(` ${chalk.green(`${running} running`)} ${chalk.yellow(`${idle} idle`)} ${chalk.dim(`${completed} completed`)}`);
|
|
84
|
+
this.log(` ${byProject.size} project(s)\n`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function formatRelativeTime(isoString) {
|
|
88
|
+
const now = Date.now();
|
|
89
|
+
const then = new Date(isoString).getTime();
|
|
90
|
+
const diffMs = now - then;
|
|
91
|
+
if (diffMs < 0)
|
|
92
|
+
return 'just now';
|
|
93
|
+
const seconds = Math.floor(diffMs / 1000);
|
|
94
|
+
if (seconds < 60)
|
|
95
|
+
return `${seconds}s ago`;
|
|
96
|
+
const minutes = Math.floor(seconds / 60);
|
|
97
|
+
if (minutes < 60)
|
|
98
|
+
return `${minutes}m ago`;
|
|
99
|
+
const hours = Math.floor(minutes / 60);
|
|
100
|
+
if (hours < 24)
|
|
101
|
+
return `${hours}h ago`;
|
|
102
|
+
const days = Math.floor(hours / 24);
|
|
103
|
+
return `${days}d ago`;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAA2B,MAAM,6BAA6B,CAAA;AAEvF,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,OAAO;IACzC,MAAM,CAAC,WAAW,GAAG,6DAA6D,CAAA;IAElF,MAAM,CAAC,QAAQ,GAAG;QAChB,qCAAqC;QACrC,sDAAsD;QACtD,gEAAgE;QAChE,4CAA4C;KAC7C,CAAA;IAED,MAAM,CAAC,KAAK,GAAG;QACb,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;YACnB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,wBAAwB;YACrC,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC;SAC1C,CAAC;QACF,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC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B,CAAC,SAAiB;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IACtB,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAA;IAC1C,MAAM,MAAM,GAAG,GAAG,GAAG,IAAI,CAAA;IAEzB,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,UAAU,CAAA;IAEjC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IACzC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,OAAO,OAAO,CAAA;IAE1C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAA;IACxC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,OAAO,OAAO,CAAA;IAE1C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAA;IACtC,IAAI,KAAK,GAAG,EAAE;QAAE,OAAO,GAAG,KAAK,OAAO,CAAA;IAEtC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAA;IACnC,OAAO,GAAG,IAAI,OAAO,CAAA;AACvB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PMOCommand } from '../../lib/pmo/index.js';
|
|
2
|
+
export default class PRChecks extends PMOCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
prNumber: import("@oclif/core/interfaces").Arg<number | undefined, {
|
|
7
|
+
max?: number;
|
|
8
|
+
min?: number;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
static flags: {
|
|
12
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
};
|
|
16
|
+
private hasPMO;
|
|
17
|
+
init(): Promise<void>;
|
|
18
|
+
execute(): Promise<void>;
|
|
19
|
+
private getCheckIcon;
|
|
20
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { PMOCommand, pmoBaseFlags, } from '../../lib/pmo/index.js';
|
|
3
|
+
import { styles, divider } from '../../lib/styles.js';
|
|
4
|
+
import { isGHInstalled, isGHAuthenticated, getPRByNumber, getPRForBranch, getCurrentBranch, listOpenPRs, getPRChecks, } from '../../lib/pr/index.js';
|
|
5
|
+
import { shouldOutputJson, outputErrorAsJson, outputSuccessAsJson, createMetadata, } from '../../lib/prompt-json.js';
|
|
6
|
+
import { FlagResolver } from '../../lib/flags/index.js';
|
|
7
|
+
export default class PRChecks extends PMOCommand {
|
|
8
|
+
static description = 'Show CI check status for a pull request';
|
|
9
|
+
static examples = [
|
|
10
|
+
'<%= config.bin %> <%= command.id %>',
|
|
11
|
+
'<%= config.bin %> <%= command.id %> 123',
|
|
12
|
+
'<%= config.bin %> <%= command.id %> --json',
|
|
13
|
+
];
|
|
14
|
+
static args = {
|
|
15
|
+
prNumber: Args.integer({
|
|
16
|
+
description: 'PR number (defaults to PR for current branch)',
|
|
17
|
+
required: false,
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
20
|
+
static flags = {
|
|
21
|
+
...pmoBaseFlags,
|
|
22
|
+
};
|
|
23
|
+
// Flag to track if PMO is available
|
|
24
|
+
hasPMO = true;
|
|
25
|
+
async init() {
|
|
26
|
+
try {
|
|
27
|
+
await super.init();
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
this.hasPMO = false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async execute() {
|
|
34
|
+
const { args, flags } = await this.parse(PRChecks);
|
|
35
|
+
const jsonMode = shouldOutputJson(flags);
|
|
36
|
+
const handleError = (code, message) => {
|
|
37
|
+
if (jsonMode) {
|
|
38
|
+
outputErrorAsJson(code, message, createMetadata('pr checks', flags));
|
|
39
|
+
this.exit(1);
|
|
40
|
+
}
|
|
41
|
+
this.error(message);
|
|
42
|
+
};
|
|
43
|
+
// Check gh CLI
|
|
44
|
+
if (!isGHInstalled()) {
|
|
45
|
+
return handleError('GH_NOT_INSTALLED', 'GitHub CLI (gh) is not installed. Install it from https://cli.github.com/');
|
|
46
|
+
}
|
|
47
|
+
if (!isGHAuthenticated()) {
|
|
48
|
+
return handleError('GH_NOT_AUTHENTICATED', 'GitHub CLI is not authenticated. Run "gh auth login" first.');
|
|
49
|
+
}
|
|
50
|
+
let prNumber = args.prNumber;
|
|
51
|
+
// If no PR number, try to detect from current branch
|
|
52
|
+
if (!prNumber) {
|
|
53
|
+
const currentBranch = getCurrentBranch();
|
|
54
|
+
if (currentBranch) {
|
|
55
|
+
const branchPR = getPRForBranch(currentBranch);
|
|
56
|
+
if (branchPR) {
|
|
57
|
+
prNumber = branchPR.number;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Still no PR number - prompt for selection
|
|
62
|
+
if (!prNumber) {
|
|
63
|
+
const openPRs = listOpenPRs();
|
|
64
|
+
if (openPRs.length === 0) {
|
|
65
|
+
return handleError('NO_OPEN_PRS', 'No open pull requests found.');
|
|
66
|
+
}
|
|
67
|
+
const resolver = new FlagResolver({
|
|
68
|
+
commandName: 'pr checks',
|
|
69
|
+
baseCommand: 'prlt pr checks',
|
|
70
|
+
jsonMode,
|
|
71
|
+
flags: {},
|
|
72
|
+
});
|
|
73
|
+
resolver.addPrompt({
|
|
74
|
+
flagName: 'pr',
|
|
75
|
+
type: 'list',
|
|
76
|
+
message: 'Select PR to view checks:',
|
|
77
|
+
choices: () => openPRs.map(pr => ({
|
|
78
|
+
name: `#${pr.number} - ${pr.title} (${pr.headBranch})`,
|
|
79
|
+
value: String(pr.number),
|
|
80
|
+
})),
|
|
81
|
+
});
|
|
82
|
+
const resolved = await resolver.resolve();
|
|
83
|
+
prNumber = parseInt(resolved.pr, 10);
|
|
84
|
+
}
|
|
85
|
+
// Verify PR exists
|
|
86
|
+
const prInfo = getPRByNumber(prNumber);
|
|
87
|
+
if (!prInfo) {
|
|
88
|
+
return handleError('PR_NOT_FOUND', `PR #${prNumber} not found.`);
|
|
89
|
+
}
|
|
90
|
+
// Get checks
|
|
91
|
+
const checks = getPRChecks(prNumber);
|
|
92
|
+
if (jsonMode) {
|
|
93
|
+
outputSuccessAsJson({
|
|
94
|
+
prNumber,
|
|
95
|
+
title: prInfo.title,
|
|
96
|
+
url: prInfo.url,
|
|
97
|
+
checks: checks.map(c => ({
|
|
98
|
+
name: c.name,
|
|
99
|
+
status: c.status,
|
|
100
|
+
conclusion: c.conclusion,
|
|
101
|
+
url: c.url,
|
|
102
|
+
})),
|
|
103
|
+
summary: {
|
|
104
|
+
total: checks.length,
|
|
105
|
+
passing: checks.filter(c => c.conclusion === 'SUCCESS').length,
|
|
106
|
+
failing: checks.filter(c => c.conclusion === 'FAILURE').length,
|
|
107
|
+
pending: checks.filter(c => c.status === 'IN_PROGRESS' || c.status === 'QUEUED').length,
|
|
108
|
+
},
|
|
109
|
+
}, createMetadata('pr checks', flags));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
// Interactive output
|
|
113
|
+
this.log('');
|
|
114
|
+
this.log(styles.header(`CI Checks: PR #${prNumber}`));
|
|
115
|
+
this.log(styles.muted(` ${prInfo.title}`));
|
|
116
|
+
this.log(styles.muted(` ${prInfo.url}`));
|
|
117
|
+
this.log(divider(60));
|
|
118
|
+
if (checks.length === 0) {
|
|
119
|
+
this.log(styles.muted(' No CI checks found for this PR.'));
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
for (const check of checks) {
|
|
123
|
+
const icon = this.getCheckIcon(check.status, check.conclusion);
|
|
124
|
+
const statusText = check.conclusion || check.status;
|
|
125
|
+
this.log(`${icon} ${check.name} ${styles.muted(`(${statusText})`)}`);
|
|
126
|
+
}
|
|
127
|
+
this.log('');
|
|
128
|
+
this.log(divider(60));
|
|
129
|
+
const passing = checks.filter(c => c.conclusion === 'SUCCESS').length;
|
|
130
|
+
const failing = checks.filter(c => c.conclusion === 'FAILURE').length;
|
|
131
|
+
const pending = checks.filter(c => c.status === 'IN_PROGRESS' || c.status === 'QUEUED').length;
|
|
132
|
+
const parts = [];
|
|
133
|
+
parts.push(`Total: ${checks.length}`);
|
|
134
|
+
if (passing > 0)
|
|
135
|
+
parts.push(styles.success(`Passing: ${passing}`));
|
|
136
|
+
if (failing > 0)
|
|
137
|
+
parts.push(styles.error(`Failing: ${failing}`));
|
|
138
|
+
if (pending > 0)
|
|
139
|
+
parts.push(styles.warning(`Pending: ${pending}`));
|
|
140
|
+
this.log(parts.join(' | '));
|
|
141
|
+
}
|
|
142
|
+
getCheckIcon(status, conclusion) {
|
|
143
|
+
if (conclusion === 'SUCCESS')
|
|
144
|
+
return styles.success('✓');
|
|
145
|
+
if (conclusion === 'FAILURE')
|
|
146
|
+
return styles.error('✗');
|
|
147
|
+
if (conclusion === 'CANCELLED' || conclusion === 'SKIPPED')
|
|
148
|
+
return styles.muted('○');
|
|
149
|
+
if (status === 'IN_PROGRESS' || status === 'QUEUED')
|
|
150
|
+
return styles.warning('●');
|
|
151
|
+
return styles.muted('?');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=checks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../../src/commands/pr/checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EACL,UAAU,EACV,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,aAA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AAG,CAAC,CAAC;QACzD,IAAI,UAAU,KAAK,SAAS;YAAE,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvD,IAAI,UAAU,KAAK,WAAW,IAAI,UAAU,KAAK,SAAS;YAAE,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrF,IAAI,MAAM,KAAK,aAAa,IAAI,MAAM,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChF,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC"}
|
|
@@ -11,8 +11,8 @@ export default class PR extends PMOCommand {
|
|
|
11
11
|
...pmoBaseFlags,
|
|
12
12
|
action: Flags.string({
|
|
13
13
|
char: 'a',
|
|
14
|
-
description: 'Action to perform (list, create, link, status)',
|
|
15
|
-
options: ['list', 'create', 'link', 'status'],
|
|
14
|
+
description: 'Action to perform (list, create, merge, checks, link, status)',
|
|
15
|
+
options: ['list', 'create', 'merge', 'checks', 'link', 'status'],
|
|
16
16
|
}),
|
|
17
17
|
};
|
|
18
18
|
async execute() {
|
|
@@ -45,6 +45,8 @@ export default class PR extends PMOCommand {
|
|
|
45
45
|
choices: () => [
|
|
46
46
|
{ name: 'List all open PRs', value: 'list' },
|
|
47
47
|
{ name: 'Create PR from current branch', value: 'create' },
|
|
48
|
+
{ name: 'Merge a PR', value: 'merge' },
|
|
49
|
+
{ name: 'View CI check status', value: 'checks' },
|
|
48
50
|
{ name: 'Link existing PR to ticket', value: 'link' },
|
|
49
51
|
{ name: 'View PR status for ticket', value: 'status' },
|
|
50
52
|
{ name: 'Cancel', value: 'cancel' },
|
|
@@ -66,6 +68,12 @@ export default class PR extends PMOCommand {
|
|
|
66
68
|
case 'link':
|
|
67
69
|
await this.config.runCommand('pr:link', []);
|
|
68
70
|
break;
|
|
71
|
+
case 'merge':
|
|
72
|
+
await this.config.runCommand('pr:merge', []);
|
|
73
|
+
break;
|
|
74
|
+
case 'checks':
|
|
75
|
+
await this.config.runCommand('pr:checks', []);
|
|
76
|
+
break;
|
|
69
77
|
case 'status':
|
|
70
78
|
await this.config.runCommand('pr:status', []);
|
|
71
79
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/pr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,UAAU,EACV,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,CAAC,OAAO,OAAO,EAAG,SAAQ,UAAU;IACxC,MAAM,CAAC,WAAW,GAAG,8CAA8C,CAAC;IAEpE,MAAM,CAAC,QAAQ,GAAG;QAChB,qCAAqC;KACtC,CAAC;IAEF,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,YAAY;QACf,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;YACnB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/pr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,UAAU,EACV,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,CAAC,OAAO,OAAO,EAAG,SAAQ,UAAU;IACxC,MAAM,CAAC,WAAW,GAAG,8CAA8C,CAAC;IAEpE,MAAM,CAAC,QAAQ,GAAG;QAChB,qCAAqC;KACtC,CAAC;IAEF,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;YACR,KAAK,QAAQ;gBACX,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;gBAC9C,MAAM;YACR,KAAK,QAAQ;gBACX,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;gBAC9C,MAAM;QACV,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PMOCommand } from '../../lib/pmo/index.js';
|
|
2
|
+
export default class PRMerge extends PMOCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
prNumber: import("@oclif/core/interfaces").Arg<number | undefined, {
|
|
7
|
+
max?: number;
|
|
8
|
+
min?: number;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
static flags: {
|
|
12
|
+
method: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'delete-branch': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
admin: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
};
|
|
19
|
+
private hasPMO;
|
|
20
|
+
init(): Promise<void>;
|
|
21
|
+
execute(): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { PMOCommand, pmoBaseFlags, } from '../../lib/pmo/index.js';
|
|
3
|
+
import { styles } from '../../lib/styles.js';
|
|
4
|
+
import { isGHInstalled, isGHAuthenticated, getPRByNumber, listOpenPRs, mergePR, } from '../../lib/pr/index.js';
|
|
5
|
+
import { shouldOutputJson, outputErrorAsJson, outputSuccessAsJson, createMetadata, } from '../../lib/prompt-json.js';
|
|
6
|
+
import { FlagResolver } from '../../lib/flags/index.js';
|
|
7
|
+
export default class PRMerge extends PMOCommand {
|
|
8
|
+
static description = 'Merge a GitHub pull request by number';
|
|
9
|
+
static examples = [
|
|
10
|
+
'<%= config.bin %> <%= command.id %> 123',
|
|
11
|
+
'<%= config.bin %> <%= command.id %> 123 --method squash',
|
|
12
|
+
'<%= config.bin %> <%= command.id %> 123 --no-delete-branch',
|
|
13
|
+
'<%= config.bin %> <%= command.id %> --json',
|
|
14
|
+
];
|
|
15
|
+
static args = {
|
|
16
|
+
prNumber: Args.integer({
|
|
17
|
+
description: 'PR number to merge',
|
|
18
|
+
required: false,
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
static flags = {
|
|
22
|
+
...pmoBaseFlags,
|
|
23
|
+
method: Flags.string({
|
|
24
|
+
description: 'Merge method',
|
|
25
|
+
options: ['merge', 'squash', 'rebase'],
|
|
26
|
+
default: 'merge',
|
|
27
|
+
}),
|
|
28
|
+
'delete-branch': Flags.boolean({
|
|
29
|
+
description: 'Delete branch after merging',
|
|
30
|
+
default: true,
|
|
31
|
+
allowNo: true,
|
|
32
|
+
}),
|
|
33
|
+
admin: Flags.boolean({
|
|
34
|
+
description: 'Use admin privileges to bypass branch protections',
|
|
35
|
+
default: false,
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
// Flag to track if PMO is available
|
|
39
|
+
hasPMO = true;
|
|
40
|
+
async init() {
|
|
41
|
+
try {
|
|
42
|
+
await super.init();
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
this.hasPMO = false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async execute() {
|
|
49
|
+
const { args, flags } = await this.parse(PRMerge);
|
|
50
|
+
const jsonMode = shouldOutputJson(flags);
|
|
51
|
+
const handleError = (code, message) => {
|
|
52
|
+
if (jsonMode) {
|
|
53
|
+
outputErrorAsJson(code, message, createMetadata('pr merge', flags));
|
|
54
|
+
this.exit(1);
|
|
55
|
+
}
|
|
56
|
+
this.error(message);
|
|
57
|
+
};
|
|
58
|
+
// Check gh CLI
|
|
59
|
+
if (!isGHInstalled()) {
|
|
60
|
+
return handleError('GH_NOT_INSTALLED', 'GitHub CLI (gh) is not installed. Install it from https://cli.github.com/');
|
|
61
|
+
}
|
|
62
|
+
if (!isGHAuthenticated()) {
|
|
63
|
+
return handleError('GH_NOT_AUTHENTICATED', 'GitHub CLI is not authenticated. Run "gh auth login" first.');
|
|
64
|
+
}
|
|
65
|
+
let prNumber = args.prNumber;
|
|
66
|
+
// If no PR number provided, prompt for selection
|
|
67
|
+
if (!prNumber) {
|
|
68
|
+
const openPRs = listOpenPRs();
|
|
69
|
+
if (openPRs.length === 0) {
|
|
70
|
+
return handleError('NO_OPEN_PRS', 'No open pull requests found.');
|
|
71
|
+
}
|
|
72
|
+
const resolver = new FlagResolver({
|
|
73
|
+
commandName: 'pr merge',
|
|
74
|
+
baseCommand: 'prlt pr merge',
|
|
75
|
+
jsonMode,
|
|
76
|
+
flags: {},
|
|
77
|
+
});
|
|
78
|
+
resolver.addPrompt({
|
|
79
|
+
flagName: 'pr',
|
|
80
|
+
type: 'list',
|
|
81
|
+
message: 'Select PR to merge:',
|
|
82
|
+
choices: () => openPRs.map(pr => ({
|
|
83
|
+
name: `#${pr.number} - ${pr.title} (${pr.headBranch})`,
|
|
84
|
+
value: String(pr.number),
|
|
85
|
+
})),
|
|
86
|
+
});
|
|
87
|
+
const resolved = await resolver.resolve();
|
|
88
|
+
prNumber = parseInt(resolved.pr, 10);
|
|
89
|
+
}
|
|
90
|
+
// Verify PR exists and is open
|
|
91
|
+
const prInfo = getPRByNumber(prNumber);
|
|
92
|
+
if (!prInfo) {
|
|
93
|
+
return handleError('PR_NOT_FOUND', `PR #${prNumber} not found.`);
|
|
94
|
+
}
|
|
95
|
+
if (prInfo.state !== 'OPEN') {
|
|
96
|
+
return handleError('PR_NOT_OPEN', `PR #${prNumber} is ${prInfo.state.toLowerCase()}, not open.`);
|
|
97
|
+
}
|
|
98
|
+
// Merge the PR
|
|
99
|
+
const method = flags.method;
|
|
100
|
+
const result = mergePR(prNumber, {
|
|
101
|
+
method,
|
|
102
|
+
deleteBranch: flags['delete-branch'],
|
|
103
|
+
admin: flags.admin,
|
|
104
|
+
});
|
|
105
|
+
if (!result.success) {
|
|
106
|
+
return handleError('MERGE_FAILED', `Failed to merge PR #${prNumber}: ${result.error}`);
|
|
107
|
+
}
|
|
108
|
+
// Update ticket metadata if PR was linked
|
|
109
|
+
if (this.hasPMO) {
|
|
110
|
+
try {
|
|
111
|
+
const allTickets = await this.storage.listTickets(flags.project);
|
|
112
|
+
const linkedTicket = allTickets.find(t => t.metadata?.pr_number === String(prNumber));
|
|
113
|
+
if (linkedTicket) {
|
|
114
|
+
await this.storage.updateTicket(linkedTicket.id, {
|
|
115
|
+
metadata: {
|
|
116
|
+
...linkedTicket.metadata,
|
|
117
|
+
pr_state: 'MERGED',
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
// Non-critical - don't fail the merge if PMO update fails
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (jsonMode) {
|
|
127
|
+
outputSuccessAsJson({
|
|
128
|
+
merged: true,
|
|
129
|
+
prNumber,
|
|
130
|
+
title: prInfo.title,
|
|
131
|
+
method,
|
|
132
|
+
branchDeleted: flags['delete-branch'],
|
|
133
|
+
}, createMetadata('pr merge', flags));
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
this.log('');
|
|
137
|
+
this.log(styles.success(`PR #${prNumber} merged successfully!`));
|
|
138
|
+
this.log(styles.muted(` Title: ${prInfo.title}`));
|
|
139
|
+
this.log(styles.muted(` Method: ${method}`));
|
|
140
|
+
if (flags['delete-branch']) {
|
|
141
|
+
this.log(styles.muted(` Branch ${prInfo.headBranch} deleted`));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../../src/commands/pr/merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,OAAO,GACR,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,UAAU;IAC7C,MAAM,CAAC,WAAW,GAAG,uCAAuC,CAAC;IAE7D,MAAM,CAAC,QAAQ,GAAG;QAChB,yCAAyC;QACzC,yDAAyD;QACzD,4DAA4D;QAC5D,4CAA4C;KAC7C,CAAC;IAEF,MAAM,CAAC,IAAI,GAAG;QACZ,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC;YACrB,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH,CAAC;IAEF,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,YAAY;QACf,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;YACnB,WAAW,EAAE,cAAc;YAC3B,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;YACtC,OAAO,EAAE,OAAO;SACjB,CAAC;QACF,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC;YAC7B,WAAW,EAAE,6B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IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACb,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,QAAQ,uBAAuB,CAAC,CAAC,CAAC;QACjE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,MAAM,EAAE,CAAC,CAAC,CAAC;QAC/C,IAAI,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,UAAU,UAAU,CAAC,CAAC,CAAC;QACnE,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class VersionBump extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
type: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|