jira-pilot 2.0.0 → 2.0.2
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/LICENSE +5 -5
- package/README.md +465 -404
- package/bin/jira.js +62 -55
- package/package.json +90 -84
- package/src/commands/ai-actions/plan.js +119 -0
- package/src/commands/ai-actions/review.js +109 -0
- package/src/commands/ai-actions/standup.js +42 -0
- package/src/commands/ai.js +232 -204
- package/src/commands/board.js +75 -66
- package/src/commands/bulk.js +108 -0
- package/src/commands/config.js +224 -154
- package/src/commands/dashboard.js +89 -0
- package/src/commands/git.js +63 -60
- package/src/commands/issue.js +985 -698
- package/src/commands/mcp.js +20 -20
- package/src/commands/project.js +59 -50
- package/src/commands/sprint.js +153 -78
- package/src/server/mcp-server.js +332 -332
- package/src/services/ai-service.js +165 -107
- package/src/services/api-service.js +115 -115
- package/src/utils/adf-parser.js +49 -49
- package/src/utils/config.js +97 -60
- package/src/utils/error-handler.js +41 -41
- package/src/utils/text-to-adf.js +34 -34
- package/src/utils/validators.js +88 -0
package/src/commands/git.js
CHANGED
|
@@ -1,60 +1,63 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { execSync } from 'child_process';
|
|
4
|
-
import { api } from '../services/api-service.js';
|
|
5
|
-
import ora from 'ora';
|
|
6
|
-
import enquirer from 'enquirer';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
.
|
|
15
|
-
.
|
|
16
|
-
.
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { execSync } from 'child_process';
|
|
4
|
+
import { api } from '../services/api-service.js';
|
|
5
|
+
import ora from 'ora';
|
|
6
|
+
import enquirer from 'enquirer';
|
|
7
|
+
import { validateIssueKey } from '../utils/validators.js';
|
|
8
|
+
|
|
9
|
+
export function registerGitCommand(program) {
|
|
10
|
+
const gitCmd = new Command('git')
|
|
11
|
+
.description('Git integration for Jira');
|
|
12
|
+
|
|
13
|
+
gitCmd
|
|
14
|
+
.command('branch')
|
|
15
|
+
.description('Create a git branch from a Jira issue')
|
|
16
|
+
.argument('<issueKey>', 'Jira Issue Key (e.g., PROJ-123)')
|
|
17
|
+
.option('-t, --type <type>', 'Branch type (feature, bugfix, hotfix)', 'feature')
|
|
18
|
+
.action(async (issueKey, options) => {
|
|
19
|
+
const check = validateIssueKey(issueKey);
|
|
20
|
+
if (!check.valid) { console.error(chalk.red(check.message)); return; }
|
|
21
|
+
const spinner = ora(`Fetching issue ${issueKey}...`).start();
|
|
22
|
+
try {
|
|
23
|
+
const issue = await api.get(`/issue/${issueKey}`);
|
|
24
|
+
spinner.stop();
|
|
25
|
+
|
|
26
|
+
const summary = issue.fields.summary;
|
|
27
|
+
const sanitizedSummary = summary
|
|
28
|
+
.toLowerCase()
|
|
29
|
+
.replace(/[^a-z0-9]+/g, '-') // Replace non-alphanumeric with hyphen
|
|
30
|
+
.replace(/^-+|-+$/g, ''); // Trim leading/trailing hyphens
|
|
31
|
+
|
|
32
|
+
const branchName = `${options.type}/${issueKey}-${sanitizedSummary}`;
|
|
33
|
+
|
|
34
|
+
console.log(chalk.blue(`Proposed Branch Name: ${chalk.bold(branchName)}`));
|
|
35
|
+
|
|
36
|
+
const { confirm } = await enquirer.prompt({
|
|
37
|
+
type: 'confirm',
|
|
38
|
+
name: 'confirm',
|
|
39
|
+
message: 'Create and switch to this branch?',
|
|
40
|
+
initial: true
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (confirm) {
|
|
44
|
+
try {
|
|
45
|
+
execSync(`git checkout -b ${branchName}`, { stdio: 'inherit' });
|
|
46
|
+
console.log(chalk.green('\nBranch created and checked out!'));
|
|
47
|
+
} catch (gitError) {
|
|
48
|
+
console.error(chalk.red('\nFailed to create branch. Are you in a git repository?'));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
} catch (e) {
|
|
53
|
+
spinner.fail('Failed to fetch issue');
|
|
54
|
+
if (e.response) {
|
|
55
|
+
console.error(chalk.red(`Error ${e.response.status}: `), e.response.data);
|
|
56
|
+
} else {
|
|
57
|
+
console.error(chalk.red(e.message));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
program.addCommand(gitCmd);
|
|
63
|
+
}
|