jira-ai 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/cli.js +37 -4
- package/dist/commands/about.js +3 -89
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -20,6 +20,7 @@ import { authCommand } from './commands/auth.js';
|
|
|
20
20
|
import { listOrganizations, useOrganizationCommand, removeOrganizationCommand } from './commands/organization.js';
|
|
21
21
|
import { isCommandAllowed, getAllowedCommands } from './lib/settings.js';
|
|
22
22
|
import { setOrganizationOverride } from './lib/jira-client.js';
|
|
23
|
+
import { hasCredentials } from './lib/auth-storage.js';
|
|
23
24
|
import { CliError } from './types/errors.js';
|
|
24
25
|
import { CommandError } from './lib/errors.js';
|
|
25
26
|
import { ui } from './lib/ui.js';
|
|
@@ -31,7 +32,7 @@ const program = new Command();
|
|
|
31
32
|
program
|
|
32
33
|
.name('jira-ai')
|
|
33
34
|
.description('CLI tool for interacting with Atlassian Jira')
|
|
34
|
-
.version('0.3.
|
|
35
|
+
.version('0.3.18')
|
|
35
36
|
.option('-o, --organization <alias>', 'Override the active Jira organization');
|
|
36
37
|
// Hook to handle the global option before any command runs
|
|
37
38
|
program.on('option:organization', (alias) => {
|
|
@@ -199,11 +200,40 @@ program
|
|
|
199
200
|
// About command (always allowed)
|
|
200
201
|
program
|
|
201
202
|
.command('about')
|
|
202
|
-
.description('Show information about
|
|
203
|
+
.description('Show information about the tool')
|
|
203
204
|
.action(aboutCommand);
|
|
205
|
+
/**
|
|
206
|
+
* Configure command visibility based on auth status and settings
|
|
207
|
+
*/
|
|
208
|
+
export function configureCommandVisibility(program) {
|
|
209
|
+
const hasCreds = hasCredentials();
|
|
210
|
+
const envVarsSet = !!(process.env.JIRA_HOST &&
|
|
211
|
+
process.env.JIRA_USER_EMAIL &&
|
|
212
|
+
process.env.JIRA_API_TOKEN);
|
|
213
|
+
const isAuthorized = hasCreds || envVarsSet;
|
|
214
|
+
if (!isAuthorized) {
|
|
215
|
+
program.commands.forEach(cmd => {
|
|
216
|
+
if (cmd.name() !== 'auth' && cmd.name() !== 'about') {
|
|
217
|
+
cmd._hidden = true;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
program.addHelpText('after', `\n${chalk.yellow('You are not authorized. Please use `jira-ai auth` to authorize. Then you can run other commands.')}`);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
program.commands.forEach(cmd => {
|
|
224
|
+
// auth and about are always visible
|
|
225
|
+
if (cmd.name() !== 'auth' && cmd.name() !== 'about') {
|
|
226
|
+
if (!isCommandAllowed(cmd.name())) {
|
|
227
|
+
cmd._hidden = true;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
204
233
|
// Parse command line arguments
|
|
205
|
-
async function main() {
|
|
234
|
+
export async function main() {
|
|
206
235
|
try {
|
|
236
|
+
configureCommandVisibility(program);
|
|
207
237
|
await program.parseAsync(process.argv);
|
|
208
238
|
}
|
|
209
239
|
catch (error) {
|
|
@@ -236,4 +266,7 @@ async function main() {
|
|
|
236
266
|
}
|
|
237
267
|
}
|
|
238
268
|
}
|
|
239
|
-
|
|
269
|
+
if (process.argv[1]?.endsWith('cli.ts') || process.argv[1]?.endsWith('cli.js')) {
|
|
270
|
+
main();
|
|
271
|
+
}
|
|
272
|
+
export { program };
|
package/dist/commands/about.js
CHANGED
|
@@ -1,92 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { getAllowedCommands, getAllowedProjects, isCommandAllowed, getSettingsPath } from '../lib/settings.js';
|
|
3
|
-
const ALL_COMMANDS = [
|
|
4
|
-
{
|
|
5
|
-
name: 'auth',
|
|
6
|
-
description: 'Set up Jira authentication credentials',
|
|
7
|
-
usage: 'jira-ai auth'
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
name: 'me',
|
|
11
|
-
description: 'Show details of current user',
|
|
12
|
-
usage: 'jira-ai me'
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: 'projects',
|
|
16
|
-
description: 'List available projects',
|
|
17
|
-
usage: 'jira-ai projects'
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: 'task-with-details',
|
|
21
|
-
description: 'Show task title, body, and comments',
|
|
22
|
-
usage: 'jira-ai task-with-details <task-id>'
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: 'project-statuses',
|
|
26
|
-
description: 'Show all possible statuses for a project',
|
|
27
|
-
usage: 'jira-ai project-statuses <project-id>'
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'list-issue-types',
|
|
31
|
-
description: 'Show all issue types for a project (e.g., Epic, Task, Subtask)',
|
|
32
|
-
usage: 'jira-ai list-issue-types <project-key>'
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: 'run-jql',
|
|
36
|
-
description: 'Execute JQL query and display results',
|
|
37
|
-
usage: 'jira-ai run-jql "<jql-query>" [-l <limit>]'
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: 'update-description',
|
|
41
|
-
description: 'Update task description from a Markdown file',
|
|
42
|
-
usage: 'jira-ai update-description <task-id> --from-file <path>'
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: 'add-comment',
|
|
46
|
-
description: 'Add a comment to a Jira issue from a Markdown file',
|
|
47
|
-
usage: 'jira-ai add-comment --file-path <path> --issue-key <key>'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: 'create-task',
|
|
51
|
-
description: 'Create a new Jira issue',
|
|
52
|
-
usage: 'jira-ai create-task --title <title> --project <project> --issue-type <type> [--parent <key>]'
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: 'about',
|
|
56
|
-
description: 'Show information about available commands and current configuration',
|
|
57
|
-
usage: 'jira-ai about'
|
|
58
|
-
}
|
|
59
|
-
];
|
|
60
2
|
export async function aboutCommand() {
|
|
61
|
-
console.log(chalk.bold.cyan('\nš Jira AI
|
|
62
|
-
console.log(chalk.bold('
|
|
63
|
-
console.log(' jira-ai
|
|
64
|
-
const allowedCommandsList = getAllowedCommands();
|
|
65
|
-
const isAllAllowed = allowedCommandsList.includes('all');
|
|
66
|
-
// Filter commands based on settings (about is always shown)
|
|
67
|
-
const commandsToShow = ALL_COMMANDS.filter(cmd => cmd.name === 'about' || isAllAllowed || isCommandAllowed(cmd.name));
|
|
68
|
-
console.log(chalk.bold('Available Commands:\n'));
|
|
69
|
-
for (const cmd of commandsToShow) {
|
|
70
|
-
console.log(chalk.yellow(` ${cmd.name}`));
|
|
71
|
-
console.log(` ${cmd.description}`);
|
|
72
|
-
console.log(` Usage: ${cmd.usage}\n`);
|
|
73
|
-
}
|
|
74
|
-
// Show disabled commands if not all are allowed
|
|
75
|
-
if (!isAllAllowed) {
|
|
76
|
-
const disabledCommands = ALL_COMMANDS.filter(cmd => cmd.name !== 'about' && !isCommandAllowed(cmd.name));
|
|
77
|
-
if (disabledCommands.length > 0) {
|
|
78
|
-
console.log(chalk.bold('Disabled Commands:\n'));
|
|
79
|
-
for (const cmd of disabledCommands) {
|
|
80
|
-
console.log(chalk.gray(` ${cmd.name} - ${cmd.description}`));
|
|
81
|
-
}
|
|
82
|
-
console.log();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
console.log(chalk.bold('For detailed help on any command, run:'));
|
|
86
|
-
console.log(chalk.green(' jira-ai <command> --help\n'));
|
|
87
|
-
console.log(chalk.bold('Configuration:'));
|
|
88
|
-
console.log(` Settings file: ${chalk.cyan(getSettingsPath())}`);
|
|
89
|
-
const allowedProjects = getAllowedProjects();
|
|
90
|
-
console.log(` - Projects: ${allowedProjects.includes('all') ? 'All allowed' : allowedProjects.join(', ')}`);
|
|
91
|
-
console.log(` - Commands: ${isAllAllowed ? 'All allowed' : allowedCommandsList.join(', ')}\n`);
|
|
3
|
+
console.log(chalk.bold.cyan('\nš Jira AI\n'));
|
|
4
|
+
console.log(`${chalk.bold('Version:')} 0.3.17`);
|
|
5
|
+
console.log(`${chalk.bold('GitHub:')} https://github.com/festoinc/jira-ai\n`);
|
|
92
6
|
}
|