jira-pilot 2.0.4 → 2.1.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/README.md +216 -173
- package/bin/{jira.js → jira.ts} +10 -1
- package/dist/bin/jira.js +64 -0
- package/package.json +21 -15
- package/src/commands/ai-actions/{plan.js → plan.ts} +9 -9
- package/src/commands/ai-actions/{review.js → review.ts} +2 -2
- package/src/commands/ai-actions/{standup.js → standup.ts} +4 -4
- package/src/commands/{ai.js → ai.ts} +11 -11
- package/src/commands/{board.js → board.ts} +11 -11
- package/src/commands/bulk.ts +230 -0
- package/src/commands/{config.js → config.ts} +57 -8
- package/src/commands/dashboard.ts +222 -0
- package/src/commands/filter.ts +84 -0
- package/src/commands/{git.js → git.ts} +4 -4
- package/src/commands/issue-attach.ts +44 -0
- package/src/commands/issue-pr.ts +87 -0
- package/src/commands/issue-worklog.ts +90 -0
- package/src/commands/{issue.js → issue.ts} +359 -68
- package/src/commands/{mcp.js → mcp.ts} +2 -2
- package/src/commands/{project.js → project.ts} +11 -11
- package/src/commands/sprint.ts +269 -0
- package/src/server/{mcp-server.js → mcp-server.ts} +235 -8
- package/src/services/{ai-service.js → ai-service.ts} +16 -16
- package/src/services/{api-service.js → api-service.ts} +33 -9
- package/src/services/config-service.ts +21 -0
- package/src/types.ts +68 -0
- package/src/utils/{adf-parser.js → adf-parser.ts} +12 -12
- package/src/utils/config-store.ts +109 -0
- package/src/utils/{config.js → config.ts} +14 -41
- package/src/utils/{error-handler.js → error-handler.ts} +2 -1
- package/src/utils/{text-to-adf.js → text-to-adf.ts} +1 -1
- package/src/utils/{validators.js → validators.ts} +4 -4
- package/src/commands/bulk.js +0 -108
- package/src/commands/dashboard.js +0 -89
- package/src/commands/sprint.js +0 -153
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import Table from 'cli-table3';
|
|
4
|
+
import { api } from '../services/api-service.js';
|
|
5
|
+
import ora from 'ora';
|
|
6
|
+
import enquirer from 'enquirer';
|
|
7
|
+
import { textToADF } from '../utils/text-to-adf.js';
|
|
8
|
+
import { validateIssueKey } from '../utils/validators.js';
|
|
9
|
+
import { handleCommandError } from '../utils/error-handler.js';
|
|
10
|
+
import { parseADF } from '../utils/adf-parser.js';
|
|
11
|
+
|
|
12
|
+
export function registerWorklogCommand(issueCmd: Command) {
|
|
13
|
+
const worklogCmd = new Command('worklog')
|
|
14
|
+
.description('Manage worklogs (time tracking)')
|
|
15
|
+
.addHelpText('after', `
|
|
16
|
+
Examples:
|
|
17
|
+
$ jira issue worklog add PROJ-123 2h "Researching API"
|
|
18
|
+
$ jira issue worklog list PROJ-123
|
|
19
|
+
`);
|
|
20
|
+
|
|
21
|
+
worklogCmd
|
|
22
|
+
.command('add')
|
|
23
|
+
.description('Add a worklog entry')
|
|
24
|
+
.argument('<issueKey>', 'Issue Key')
|
|
25
|
+
.argument('<timeSpent>', 'Time spent (e.g., 2h, 30m, 1d)')
|
|
26
|
+
.argument('[comment]', 'Worklog comment')
|
|
27
|
+
.action(async (issueKey, timeSpent, comment) => {
|
|
28
|
+
const check = validateIssueKey(issueKey);
|
|
29
|
+
if (!check.valid) { console.error(chalk.red(check.message)); return; }
|
|
30
|
+
|
|
31
|
+
const spinner = ora(`Adding worklog to ${issueKey}...`).start();
|
|
32
|
+
try {
|
|
33
|
+
const body: any = {
|
|
34
|
+
timeSpent: timeSpent
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
if (comment) {
|
|
38
|
+
body.comment = textToADF(comment);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
await api.post(`/issue/${issueKey}/worklog`, body);
|
|
42
|
+
spinner.succeed(chalk.green(`Logged ${chalk.bold(timeSpent)} to ${chalk.bold(issueKey)}`));
|
|
43
|
+
|
|
44
|
+
} catch (e: any) {
|
|
45
|
+
handleCommandError(spinner, e, 'Failed to add worklog');
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
worklogCmd
|
|
50
|
+
.command('list')
|
|
51
|
+
.description('List worklogs for an issue')
|
|
52
|
+
.argument('<issueKey>', 'Issue Key')
|
|
53
|
+
.action(async (issueKey) => {
|
|
54
|
+
const check = validateIssueKey(issueKey);
|
|
55
|
+
if (!check.valid) { console.error(chalk.red(check.message)); return; }
|
|
56
|
+
|
|
57
|
+
const spinner = ora(`Fetching worklogs for ${issueKey}...`).start();
|
|
58
|
+
try {
|
|
59
|
+
const data = await api.get(`/issue/${issueKey}/worklog`);
|
|
60
|
+
spinner.stop();
|
|
61
|
+
|
|
62
|
+
if (!data.worklogs || data.worklogs.length === 0) {
|
|
63
|
+
console.log(chalk.yellow(`No worklogs found for ${issueKey}.`));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
console.log(chalk.bold(`\nWorklogs for ${chalk.cyan(issueKey)}:`));
|
|
68
|
+
|
|
69
|
+
const table = new Table({
|
|
70
|
+
head: [chalk.bold('Author'), chalk.bold('Time Spent'), chalk.bold('Date'), chalk.bold('Comment')]
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
data.worklogs.forEach((w: any) => {
|
|
74
|
+
table.push([
|
|
75
|
+
w.author?.displayName || 'Unknown',
|
|
76
|
+
w.timeSpent,
|
|
77
|
+
w.started.split('T')[0],
|
|
78
|
+
w.comment ? (parseADF(w.comment)?.substring(0, 50) + '...') : ''
|
|
79
|
+
]);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
console.log(table.toString());
|
|
83
|
+
|
|
84
|
+
} catch (e: any) {
|
|
85
|
+
handleCommandError(spinner, e, 'Failed to list worklogs');
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
issueCmd.addCommand(worklogCmd);
|
|
90
|
+
}
|