jira-ai 0.2.5 → 0.2.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jira-ai",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "CLI tool for interacting with Atlassian Jira",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {
package/src/cli.ts CHANGED
@@ -8,6 +8,7 @@ import { meCommand } from './commands/me';
8
8
  import { projectsCommand } from './commands/projects';
9
9
  import { taskWithDetailsCommand } from './commands/task-with-details';
10
10
  import { projectStatusesCommand } from './commands/project-statuses';
11
+ import { listIssueTypesCommand } from './commands/list-issue-types';
11
12
  import { runJqlCommand } from './commands/run-jql';
12
13
  import { updateDescriptionCommand } from './commands/update-description';
13
14
  import { addCommentCommand } from './commands/add-comment';
@@ -78,6 +79,12 @@ program
78
79
  .description('Show all possible statuses for a project')
79
80
  .action(withPermission('project-statuses', projectStatusesCommand));
80
81
 
82
+ // List issue types command
83
+ program
84
+ .command('list-issue-types <project-key>')
85
+ .description('Show all issue types for a project')
86
+ .action(withPermission('list-issue-types', listIssueTypesCommand));
87
+
81
88
  // Run JQL command
82
89
  program
83
90
  .command('run-jql <jql-query>')
@@ -28,6 +28,11 @@ const ALL_COMMANDS: CommandInfo[] = [
28
28
  description: 'Show all possible statuses for a project',
29
29
  usage: 'jira-ai project-statuses --help'
30
30
  },
31
+ {
32
+ name: 'list-issue-types',
33
+ description: 'Show all issue types for a project (e.g., Epic, Task, Subtask)',
34
+ usage: 'jira-ai list-issue-types <project-key>'
35
+ },
31
36
  {
32
37
  name: 'run-jql',
33
38
  description: 'Execute JQL query and display results',
@@ -0,0 +1,18 @@
1
+ import chalk from 'chalk';
2
+ import ora from 'ora';
3
+ import { getProjectIssueTypes } from '../lib/jira-client';
4
+ import { formatProjectIssueTypes } from '../lib/formatters';
5
+
6
+ export async function listIssueTypesCommand(projectKey: string): Promise<void> {
7
+ const spinner = ora(`Fetching issue types for project ${projectKey}...`).start();
8
+
9
+ try {
10
+ const issueTypes = await getProjectIssueTypes(projectKey);
11
+ spinner.succeed(chalk.green('Issue types retrieved'));
12
+ console.log(formatProjectIssueTypes(projectKey, issueTypes));
13
+ } catch (error) {
14
+ spinner.fail(chalk.red('Failed to fetch issue types'));
15
+ console.error(chalk.red('\nError: ' + (error instanceof Error ? error.message : 'Unknown error')));
16
+ process.exit(1);
17
+ }
18
+ }
@@ -1,6 +1,6 @@
1
1
  import chalk from 'chalk';
2
2
  import Table from 'cli-table3';
3
- import { UserInfo, Project, TaskDetails, Status, JqlIssue } from './jira-client';
3
+ import { UserInfo, Project, TaskDetails, Status, JqlIssue, IssueType } from './jira-client';
4
4
  import { formatTimestamp, truncate } from './utils';
5
5
 
6
6
  /**
@@ -222,3 +222,52 @@ export function formatJqlResults(issues: JqlIssue[]): string {
222
222
 
223
223
  return output;
224
224
  }
225
+
226
+ /**
227
+ * Format project issue types list
228
+ */
229
+ export function formatProjectIssueTypes(projectKey: string, issueTypes: IssueType[]): string {
230
+ if (issueTypes.length === 0) {
231
+ return chalk.yellow('No issue types found for this project.');
232
+ }
233
+
234
+ // Separate standard issue types and subtasks
235
+ const standardTypes = issueTypes.filter(type => !type.subtask);
236
+ const subtaskTypes = issueTypes.filter(type => type.subtask);
237
+
238
+ let output = '\n' + chalk.bold(`Project ${projectKey} - Issue Types (${issueTypes.length} total)`) + '\n\n';
239
+
240
+ // Display standard issue types
241
+ if (standardTypes.length > 0) {
242
+ output += chalk.bold('Standard Issue Types:') + '\n';
243
+ const table = createTable(['Name', 'Type', 'Description'], [20, 15, 55]);
244
+
245
+ standardTypes.forEach((issueType) => {
246
+ table.push([
247
+ chalk.cyan(issueType.name),
248
+ issueType.subtask ? chalk.yellow('Subtask') : chalk.green('Standard'),
249
+ truncate(issueType.description || chalk.gray('No description'), 55),
250
+ ]);
251
+ });
252
+
253
+ output += table.toString() + '\n';
254
+ }
255
+
256
+ // Display subtask types separately if they exist
257
+ if (subtaskTypes.length > 0) {
258
+ output += '\n' + chalk.bold('Subtask Types:') + '\n';
259
+ const subtaskTable = createTable(['Name', 'Type', 'Description'], [20, 15, 55]);
260
+
261
+ subtaskTypes.forEach((issueType) => {
262
+ subtaskTable.push([
263
+ chalk.cyan(issueType.name),
264
+ chalk.yellow('Subtask'),
265
+ truncate(issueType.description || chalk.gray('No description'), 55),
266
+ ]);
267
+ });
268
+
269
+ output += subtaskTable.toString() + '\n';
270
+ }
271
+
272
+ return output;
273
+ }
@@ -87,6 +87,14 @@ export interface JqlIssue {
87
87
  } | null;
88
88
  }
89
89
 
90
+ export interface IssueType {
91
+ id: string;
92
+ name: string;
93
+ description?: string;
94
+ subtask: boolean;
95
+ hierarchyLevel: number;
96
+ }
97
+
90
98
  let jiraClient: Version3Client | null = null;
91
99
 
92
100
  /**
@@ -355,3 +363,23 @@ export async function addIssueComment(
355
363
  comment: adfContent,
356
364
  });
357
365
  }
366
+
367
+ /**
368
+ * Get all issue types for a project
369
+ */
370
+ export async function getProjectIssueTypes(projectIdOrKey: string): Promise<IssueType[]> {
371
+ const client = getJiraClient();
372
+
373
+ const project = await client.projects.getProject({
374
+ projectIdOrKey,
375
+ expand: 'issueTypes',
376
+ });
377
+
378
+ return project.issueTypes?.map((issueType: any) => ({
379
+ id: issueType.id || '',
380
+ name: issueType.name || '',
381
+ description: issueType.description,
382
+ subtask: issueType.subtask || false,
383
+ hierarchyLevel: issueType.hierarchyLevel || 0,
384
+ })) || [];
385
+ }