claude-autopm 2.4.0 → 2.6.0
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/bin/autopm.js +4 -0
- package/lib/cli/commands/issue.js +520 -0
- package/lib/cli/commands/pm.js +528 -0
- package/lib/services/IssueService.js +591 -0
- package/lib/services/WorkflowService.js +677 -0
- package/package.json +1 -1
package/bin/autopm.js
CHANGED
|
@@ -182,6 +182,10 @@ function main() {
|
|
|
182
182
|
.command(require('./commands/mcp'))
|
|
183
183
|
// Epic management command (STANDALONE)
|
|
184
184
|
.command(require('../lib/cli/commands/epic'))
|
|
185
|
+
// Issue management command (STANDALONE)
|
|
186
|
+
.command(require('../lib/cli/commands/issue'))
|
|
187
|
+
// PM workflow commands (STANDALONE)
|
|
188
|
+
.command(require('../lib/cli/commands/pm'))
|
|
185
189
|
// PRD management command (STANDALONE)
|
|
186
190
|
.command(require('../lib/cli/commands/prd'))
|
|
187
191
|
// Task management command (STANDALONE)
|
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Issue Commands
|
|
3
|
+
*
|
|
4
|
+
* Provides Issue management commands for ClaudeAutoPM.
|
|
5
|
+
* Implements subcommands for issue lifecycle management.
|
|
6
|
+
*
|
|
7
|
+
* Commands:
|
|
8
|
+
* - show <number>: Display issue details
|
|
9
|
+
* - start <number>: Start working on issue
|
|
10
|
+
* - close <number>: Close and complete issue
|
|
11
|
+
* - status <number>: Check issue status
|
|
12
|
+
* - edit <number>: Edit issue in editor
|
|
13
|
+
* - sync <number>: Sync issue with GitHub/Azure
|
|
14
|
+
*
|
|
15
|
+
* @module cli/commands/issue
|
|
16
|
+
* @requires ../../services/IssueService
|
|
17
|
+
* @requires fs-extra
|
|
18
|
+
* @requires ora
|
|
19
|
+
* @requires chalk
|
|
20
|
+
* @requires path
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const IssueService = require('../../services/IssueService');
|
|
24
|
+
const fs = require('fs-extra');
|
|
25
|
+
const ora = require('ora');
|
|
26
|
+
const chalk = require('chalk');
|
|
27
|
+
const path = require('path');
|
|
28
|
+
const { spawn } = require('child_process');
|
|
29
|
+
const readline = require('readline');
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get issue file path
|
|
33
|
+
* @param {number|string} issueNumber - Issue number
|
|
34
|
+
* @returns {string} Full path to issue file
|
|
35
|
+
*/
|
|
36
|
+
function getIssuePath(issueNumber) {
|
|
37
|
+
return path.join(process.cwd(), '.claude', 'issues', `${issueNumber}.md`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Read issue file
|
|
42
|
+
* @param {number|string} issueNumber - Issue number
|
|
43
|
+
* @returns {Promise<string>} Issue content
|
|
44
|
+
* @throws {Error} If file doesn't exist or can't be read
|
|
45
|
+
*/
|
|
46
|
+
async function readIssueFile(issueNumber) {
|
|
47
|
+
const issuePath = getIssuePath(issueNumber);
|
|
48
|
+
|
|
49
|
+
const exists = await fs.pathExists(issuePath);
|
|
50
|
+
if (!exists) {
|
|
51
|
+
throw new Error(`Issue file not found: ${issuePath}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return await fs.readFile(issuePath, 'utf8');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Show issue details
|
|
59
|
+
* @param {Object} argv - Command arguments
|
|
60
|
+
*/
|
|
61
|
+
async function issueShow(argv) {
|
|
62
|
+
const spinner = ora(`Loading issue: #${argv.number}`).start();
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const issueService = new IssueService();
|
|
66
|
+
const issue = await issueService.getLocalIssue(argv.number);
|
|
67
|
+
|
|
68
|
+
spinner.succeed(chalk.green('Issue loaded'));
|
|
69
|
+
|
|
70
|
+
// Display metadata table
|
|
71
|
+
console.log('\n' + chalk.bold('📋 Issue Details') + '\n');
|
|
72
|
+
console.log(chalk.gray('─'.repeat(50)) + '\n');
|
|
73
|
+
|
|
74
|
+
console.log(chalk.bold('ID: ') + (issue.id || argv.number));
|
|
75
|
+
console.log(chalk.bold('Title: ') + (issue.title || 'N/A'));
|
|
76
|
+
console.log(chalk.bold('Status: ') + chalk.yellow(issue.status || 'open'));
|
|
77
|
+
|
|
78
|
+
if (issue.assignee) {
|
|
79
|
+
console.log(chalk.bold('Assignee: ') + issue.assignee);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (issue.labels) {
|
|
83
|
+
console.log(chalk.bold('Labels: ') + issue.labels);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (issue.created) {
|
|
87
|
+
console.log(chalk.bold('Created: ') + new Date(issue.created).toLocaleDateString());
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (issue.started) {
|
|
91
|
+
console.log(chalk.bold('Started: ') + new Date(issue.started).toLocaleDateString());
|
|
92
|
+
const duration = issueService.formatIssueDuration(issue.started);
|
|
93
|
+
console.log(chalk.bold('Duration: ') + duration);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (issue.completed) {
|
|
97
|
+
console.log(chalk.bold('Completed:') + new Date(issue.completed).toLocaleDateString());
|
|
98
|
+
const duration = issueService.formatIssueDuration(issue.started, issue.completed);
|
|
99
|
+
console.log(chalk.bold('Duration: ') + duration);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (issue.url) {
|
|
103
|
+
console.log(chalk.bold('URL: ') + chalk.cyan(issue.url));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Show issue content
|
|
107
|
+
console.log('\n' + chalk.gray('─'.repeat(80)) + '\n');
|
|
108
|
+
|
|
109
|
+
// Extract and display description (skip frontmatter)
|
|
110
|
+
const contentWithoutFrontmatter = issue.content.replace(/^---[\s\S]*?---\n\n/, '');
|
|
111
|
+
console.log(contentWithoutFrontmatter);
|
|
112
|
+
|
|
113
|
+
console.log('\n' + chalk.gray('─'.repeat(80)) + '\n');
|
|
114
|
+
|
|
115
|
+
console.log(chalk.dim(`File: ${issue.path}\n`));
|
|
116
|
+
|
|
117
|
+
} catch (error) {
|
|
118
|
+
spinner.fail(chalk.red('Failed to show issue'));
|
|
119
|
+
|
|
120
|
+
if (error.message.includes('not found')) {
|
|
121
|
+
console.error(chalk.red(`\nError: ${error.message}`));
|
|
122
|
+
console.error(chalk.yellow('Use: autopm issue list to see available issues'));
|
|
123
|
+
} else {
|
|
124
|
+
console.error(chalk.red(`\nError: ${error.message}`));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Start working on issue
|
|
131
|
+
* @param {Object} argv - Command arguments
|
|
132
|
+
*/
|
|
133
|
+
async function issueStart(argv) {
|
|
134
|
+
const spinner = ora(`Starting issue: #${argv.number}`).start();
|
|
135
|
+
|
|
136
|
+
try {
|
|
137
|
+
const issueService = new IssueService();
|
|
138
|
+
|
|
139
|
+
// Check if issue exists
|
|
140
|
+
await issueService.getLocalIssue(argv.number);
|
|
141
|
+
|
|
142
|
+
// Update status to in-progress
|
|
143
|
+
await issueService.updateIssueStatus(argv.number, 'in-progress');
|
|
144
|
+
|
|
145
|
+
spinner.succeed(chalk.green('Issue started'));
|
|
146
|
+
|
|
147
|
+
console.log(chalk.green(`\n✅ Issue #${argv.number} is now in progress!`));
|
|
148
|
+
|
|
149
|
+
const issuePath = getIssuePath(argv.number);
|
|
150
|
+
console.log(chalk.cyan(`📄 File: ${issuePath}\n`));
|
|
151
|
+
|
|
152
|
+
console.log(chalk.bold('📋 What You Can Do Next:\n'));
|
|
153
|
+
console.log(` ${chalk.cyan('1.')} Check status: ${chalk.yellow('autopm issue status ' + argv.number)}`);
|
|
154
|
+
console.log(` ${chalk.cyan('2.')} Edit issue: ${chalk.yellow('autopm issue edit ' + argv.number)}`);
|
|
155
|
+
console.log(` ${chalk.cyan('3.')} Close when done: ${chalk.yellow('autopm issue close ' + argv.number)}\n`);
|
|
156
|
+
|
|
157
|
+
} catch (error) {
|
|
158
|
+
spinner.fail(chalk.red('Failed to start issue'));
|
|
159
|
+
|
|
160
|
+
if (error.message.includes('not found')) {
|
|
161
|
+
console.error(chalk.red(`\nError: ${error.message}`));
|
|
162
|
+
console.error(chalk.yellow('Use: autopm issue list to see available issues'));
|
|
163
|
+
} else {
|
|
164
|
+
console.error(chalk.red(`\nError: ${error.message}`));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Close issue
|
|
171
|
+
* @param {Object} argv - Command arguments
|
|
172
|
+
*/
|
|
173
|
+
async function issueClose(argv) {
|
|
174
|
+
const spinner = ora(`Closing issue: #${argv.number}`).start();
|
|
175
|
+
|
|
176
|
+
try {
|
|
177
|
+
const issueService = new IssueService();
|
|
178
|
+
|
|
179
|
+
// Check if issue exists
|
|
180
|
+
await issueService.getLocalIssue(argv.number);
|
|
181
|
+
|
|
182
|
+
// Update status to closed
|
|
183
|
+
await issueService.updateIssueStatus(argv.number, 'closed');
|
|
184
|
+
|
|
185
|
+
spinner.succeed(chalk.green('Issue closed'));
|
|
186
|
+
|
|
187
|
+
console.log(chalk.green(`\n✅ Issue #${argv.number} completed!`));
|
|
188
|
+
|
|
189
|
+
const issuePath = getIssuePath(argv.number);
|
|
190
|
+
console.log(chalk.cyan(`📄 File: ${issuePath}\n`));
|
|
191
|
+
|
|
192
|
+
console.log(chalk.bold('📋 What You Can Do Next:\n'));
|
|
193
|
+
console.log(` ${chalk.cyan('1.')} View issue: ${chalk.yellow('autopm issue show ' + argv.number)}`);
|
|
194
|
+
console.log(` ${chalk.cyan('2.')} Check status: ${chalk.yellow('autopm issue status ' + argv.number)}\n`);
|
|
195
|
+
|
|
196
|
+
} catch (error) {
|
|
197
|
+
spinner.fail(chalk.red('Failed to close issue'));
|
|
198
|
+
|
|
199
|
+
if (error.message.includes('not found')) {
|
|
200
|
+
console.error(chalk.red(`\nError: ${error.message}`));
|
|
201
|
+
console.error(chalk.yellow('Use: autopm issue list to see available issues'));
|
|
202
|
+
} else {
|
|
203
|
+
console.error(chalk.red(`\nError: ${error.message}`));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Show issue status
|
|
210
|
+
* @param {Object} argv - Command arguments
|
|
211
|
+
*/
|
|
212
|
+
async function issueStatus(argv) {
|
|
213
|
+
const spinner = ora(`Analyzing issue: #${argv.number}`).start();
|
|
214
|
+
|
|
215
|
+
try {
|
|
216
|
+
const issueService = new IssueService();
|
|
217
|
+
const issue = await issueService.getLocalIssue(argv.number);
|
|
218
|
+
|
|
219
|
+
spinner.succeed(chalk.green('Status analyzed'));
|
|
220
|
+
|
|
221
|
+
// Display status
|
|
222
|
+
console.log('\n' + chalk.bold('📊 Issue Status Report') + '\n');
|
|
223
|
+
console.log(chalk.gray('─'.repeat(50)) + '\n');
|
|
224
|
+
|
|
225
|
+
console.log(chalk.bold('Metadata:'));
|
|
226
|
+
console.log(` ID: #${issue.id || argv.number}`);
|
|
227
|
+
console.log(` Title: ${issue.title || 'N/A'}`);
|
|
228
|
+
console.log(` Status: ${chalk.yellow(issue.status || 'open')}`);
|
|
229
|
+
|
|
230
|
+
if (issue.assignee) {
|
|
231
|
+
console.log(` Assignee: ${issue.assignee}`);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (issue.labels) {
|
|
235
|
+
console.log(` Labels: ${issue.labels}`);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
console.log('\n' + chalk.bold('Timeline:'));
|
|
239
|
+
|
|
240
|
+
if (issue.created) {
|
|
241
|
+
console.log(` Created: ${new Date(issue.created).toLocaleString()}`);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (issue.started) {
|
|
245
|
+
console.log(` Started: ${new Date(issue.started).toLocaleString()}`);
|
|
246
|
+
|
|
247
|
+
if (issue.completed) {
|
|
248
|
+
const duration = issueService.formatIssueDuration(issue.started, issue.completed);
|
|
249
|
+
console.log(` Completed: ${new Date(issue.completed).toLocaleString()}`);
|
|
250
|
+
console.log(` Duration: ${duration}`);
|
|
251
|
+
} else {
|
|
252
|
+
const duration = issueService.formatIssueDuration(issue.started);
|
|
253
|
+
console.log(` Duration: ${duration} (ongoing)`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Show related files
|
|
258
|
+
const relatedFiles = await issueService.getIssueFiles(argv.number);
|
|
259
|
+
if (relatedFiles.length > 0) {
|
|
260
|
+
console.log('\n' + chalk.bold('Related Files:'));
|
|
261
|
+
relatedFiles.forEach(file => {
|
|
262
|
+
console.log(` • ${file}`);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Show dependencies
|
|
267
|
+
const dependencies = await issueService.getDependencies(argv.number);
|
|
268
|
+
if (dependencies.length > 0) {
|
|
269
|
+
console.log('\n' + chalk.bold('Dependencies:'));
|
|
270
|
+
dependencies.forEach(dep => {
|
|
271
|
+
console.log(` • Issue #${dep}`);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Show sub-issues
|
|
276
|
+
const subIssues = await issueService.getSubIssues(argv.number);
|
|
277
|
+
if (subIssues.length > 0) {
|
|
278
|
+
console.log('\n' + chalk.bold('Sub-Issues:'));
|
|
279
|
+
subIssues.forEach(sub => {
|
|
280
|
+
console.log(` • Issue #${sub}`);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
console.log('\n' + chalk.gray('─'.repeat(50)) + '\n');
|
|
285
|
+
|
|
286
|
+
const issuePath = getIssuePath(argv.number);
|
|
287
|
+
console.log(chalk.dim(`File: ${issuePath}\n`));
|
|
288
|
+
|
|
289
|
+
} catch (error) {
|
|
290
|
+
spinner.fail(chalk.red('Failed to analyze status'));
|
|
291
|
+
|
|
292
|
+
if (error.message.includes('not found')) {
|
|
293
|
+
console.error(chalk.red(`\nError: ${error.message}`));
|
|
294
|
+
} else {
|
|
295
|
+
console.error(chalk.red(`\nError: ${error.message}`));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Edit issue in editor
|
|
302
|
+
* @param {Object} argv - Command arguments
|
|
303
|
+
*/
|
|
304
|
+
async function issueEdit(argv) {
|
|
305
|
+
const spinner = ora(`Opening issue: #${argv.number}`).start();
|
|
306
|
+
|
|
307
|
+
try {
|
|
308
|
+
const issuePath = getIssuePath(argv.number);
|
|
309
|
+
|
|
310
|
+
// Check if file exists
|
|
311
|
+
const exists = await fs.pathExists(issuePath);
|
|
312
|
+
if (!exists) {
|
|
313
|
+
spinner.fail(chalk.red('Issue not found'));
|
|
314
|
+
console.error(chalk.red(`\nError: Issue file not found: ${issuePath}`));
|
|
315
|
+
console.error(chalk.yellow('Use: autopm issue list to see available issues'));
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
spinner.succeed(chalk.green('Opening editor...'));
|
|
320
|
+
|
|
321
|
+
// Determine editor
|
|
322
|
+
const editor = process.env.EDITOR || process.env.VISUAL || 'nano';
|
|
323
|
+
|
|
324
|
+
// Spawn editor
|
|
325
|
+
const child = spawn(editor, [issuePath], {
|
|
326
|
+
stdio: 'inherit',
|
|
327
|
+
cwd: process.cwd()
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
// Wait for editor to close
|
|
331
|
+
await new Promise((resolve, reject) => {
|
|
332
|
+
child.on('close', (code) => {
|
|
333
|
+
if (code === 0) {
|
|
334
|
+
console.log(chalk.green('\n✓ Issue saved'));
|
|
335
|
+
resolve();
|
|
336
|
+
} else {
|
|
337
|
+
reject(new Error(`Editor exited with code ${code}`));
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
child.on('error', reject);
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
} catch (error) {
|
|
344
|
+
spinner.fail(chalk.red('Failed to edit issue'));
|
|
345
|
+
console.error(chalk.red(`\nError: ${error.message}`));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Sync issue with GitHub/Azure
|
|
351
|
+
* @param {Object} argv - Command arguments
|
|
352
|
+
*/
|
|
353
|
+
async function issueSync(argv) {
|
|
354
|
+
const spinner = ora(`Syncing issue: #${argv.number}`).start();
|
|
355
|
+
|
|
356
|
+
try {
|
|
357
|
+
const issueService = new IssueService();
|
|
358
|
+
|
|
359
|
+
// Check if issue exists
|
|
360
|
+
const issue = await issueService.getLocalIssue(argv.number);
|
|
361
|
+
|
|
362
|
+
// TODO: Implement provider integration
|
|
363
|
+
// For now, just show a message
|
|
364
|
+
spinner.info(chalk.yellow('Provider sync not yet implemented'));
|
|
365
|
+
|
|
366
|
+
console.log(chalk.yellow(`\n⚠️ GitHub/Azure sync feature coming soon!\n`));
|
|
367
|
+
|
|
368
|
+
console.log(chalk.dim('This feature will:'));
|
|
369
|
+
console.log(chalk.dim(' - Create GitHub/Azure issue if not exists'));
|
|
370
|
+
console.log(chalk.dim(' - Update existing issue'));
|
|
371
|
+
console.log(chalk.dim(' - Sync issue status and comments\n'));
|
|
372
|
+
|
|
373
|
+
console.log(chalk.bold('For now, you can:'));
|
|
374
|
+
console.log(` ${chalk.cyan('1.')} View issue: ${chalk.yellow('autopm issue show ' + argv.number)}`);
|
|
375
|
+
console.log(` ${chalk.cyan('2.')} Check status: ${chalk.yellow('autopm issue status ' + argv.number)}\n`);
|
|
376
|
+
|
|
377
|
+
} catch (error) {
|
|
378
|
+
spinner.fail(chalk.red('Failed to sync issue'));
|
|
379
|
+
|
|
380
|
+
if (error.message.includes('not found')) {
|
|
381
|
+
console.error(chalk.red(`\nError: ${error.message}`));
|
|
382
|
+
} else {
|
|
383
|
+
console.error(chalk.red(`\nError: ${error.message}`));
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Command builder - registers all subcommands
|
|
390
|
+
* @param {Object} yargs - Yargs instance
|
|
391
|
+
* @returns {Object} Configured yargs instance
|
|
392
|
+
*/
|
|
393
|
+
function builder(yargs) {
|
|
394
|
+
return yargs
|
|
395
|
+
.command(
|
|
396
|
+
'show <number>',
|
|
397
|
+
'Display issue details',
|
|
398
|
+
(yargs) => {
|
|
399
|
+
return yargs
|
|
400
|
+
.positional('number', {
|
|
401
|
+
describe: 'Issue number',
|
|
402
|
+
type: 'number'
|
|
403
|
+
})
|
|
404
|
+
.example('autopm issue show 123', 'Display issue #123');
|
|
405
|
+
},
|
|
406
|
+
issueShow
|
|
407
|
+
)
|
|
408
|
+
.command(
|
|
409
|
+
'start <number>',
|
|
410
|
+
'Start working on issue',
|
|
411
|
+
(yargs) => {
|
|
412
|
+
return yargs
|
|
413
|
+
.positional('number', {
|
|
414
|
+
describe: 'Issue number',
|
|
415
|
+
type: 'number'
|
|
416
|
+
})
|
|
417
|
+
.example('autopm issue start 123', 'Mark issue #123 as in-progress');
|
|
418
|
+
},
|
|
419
|
+
issueStart
|
|
420
|
+
)
|
|
421
|
+
.command(
|
|
422
|
+
'close <number>',
|
|
423
|
+
'Close and complete issue',
|
|
424
|
+
(yargs) => {
|
|
425
|
+
return yargs
|
|
426
|
+
.positional('number', {
|
|
427
|
+
describe: 'Issue number',
|
|
428
|
+
type: 'number'
|
|
429
|
+
})
|
|
430
|
+
.example('autopm issue close 123', 'Mark issue #123 as completed');
|
|
431
|
+
},
|
|
432
|
+
issueClose
|
|
433
|
+
)
|
|
434
|
+
.command(
|
|
435
|
+
'status <number>',
|
|
436
|
+
'Check issue status',
|
|
437
|
+
(yargs) => {
|
|
438
|
+
return yargs
|
|
439
|
+
.positional('number', {
|
|
440
|
+
describe: 'Issue number',
|
|
441
|
+
type: 'number'
|
|
442
|
+
})
|
|
443
|
+
.example('autopm issue status 123', 'Show status of issue #123');
|
|
444
|
+
},
|
|
445
|
+
issueStatus
|
|
446
|
+
)
|
|
447
|
+
.command(
|
|
448
|
+
'edit <number>',
|
|
449
|
+
'Edit issue in your editor',
|
|
450
|
+
(yargs) => {
|
|
451
|
+
return yargs
|
|
452
|
+
.positional('number', {
|
|
453
|
+
describe: 'Issue number',
|
|
454
|
+
type: 'number'
|
|
455
|
+
})
|
|
456
|
+
.example('autopm issue edit 123', 'Open issue #123 in editor')
|
|
457
|
+
.example('EDITOR=code autopm issue edit 123', 'Open in VS Code');
|
|
458
|
+
},
|
|
459
|
+
issueEdit
|
|
460
|
+
)
|
|
461
|
+
.command(
|
|
462
|
+
'sync <number>',
|
|
463
|
+
'Sync issue with GitHub/Azure',
|
|
464
|
+
(yargs) => {
|
|
465
|
+
return yargs
|
|
466
|
+
.positional('number', {
|
|
467
|
+
describe: 'Issue number',
|
|
468
|
+
type: 'number'
|
|
469
|
+
})
|
|
470
|
+
.option('push', {
|
|
471
|
+
describe: 'Push local changes to provider',
|
|
472
|
+
type: 'boolean',
|
|
473
|
+
default: false
|
|
474
|
+
})
|
|
475
|
+
.option('pull', {
|
|
476
|
+
describe: 'Pull updates from provider',
|
|
477
|
+
type: 'boolean',
|
|
478
|
+
default: false
|
|
479
|
+
})
|
|
480
|
+
.example('autopm issue sync 123', 'Sync issue #123 with provider')
|
|
481
|
+
.example('autopm issue sync 123 --push', 'Push local changes')
|
|
482
|
+
.example('autopm issue sync 123 --pull', 'Pull remote updates');
|
|
483
|
+
},
|
|
484
|
+
issueSync
|
|
485
|
+
)
|
|
486
|
+
.demandCommand(1, 'You must specify an issue command')
|
|
487
|
+
.strictCommands()
|
|
488
|
+
.help();
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Command export
|
|
493
|
+
*/
|
|
494
|
+
module.exports = {
|
|
495
|
+
command: 'issue',
|
|
496
|
+
describe: 'Manage issues and task lifecycle',
|
|
497
|
+
builder,
|
|
498
|
+
handler: (argv) => {
|
|
499
|
+
if (!argv._.includes('issue') || argv._.length === 1) {
|
|
500
|
+
console.log(chalk.yellow('\nPlease specify an issue command\n'));
|
|
501
|
+
console.log('Usage: autopm issue <command>\n');
|
|
502
|
+
console.log('Available commands:');
|
|
503
|
+
console.log(' show <number> Display issue details');
|
|
504
|
+
console.log(' start <number> Start working on issue');
|
|
505
|
+
console.log(' close <number> Close issue');
|
|
506
|
+
console.log(' status <number> Check issue status');
|
|
507
|
+
console.log(' edit <number> Edit issue in editor');
|
|
508
|
+
console.log(' sync <number> Sync with GitHub/Azure');
|
|
509
|
+
console.log('\nUse: autopm issue <command> --help for more info\n');
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
handlers: {
|
|
513
|
+
show: issueShow,
|
|
514
|
+
start: issueStart,
|
|
515
|
+
close: issueClose,
|
|
516
|
+
status: issueStatus,
|
|
517
|
+
edit: issueEdit,
|
|
518
|
+
sync: issueSync
|
|
519
|
+
}
|
|
520
|
+
};
|