jira-ai 0.2.7 → 0.2.8

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 CHANGED
@@ -12,6 +12,7 @@ const me_1 = require("./commands/me");
12
12
  const projects_1 = require("./commands/projects");
13
13
  const task_with_details_1 = require("./commands/task-with-details");
14
14
  const project_statuses_1 = require("./commands/project-statuses");
15
+ const list_issue_types_1 = require("./commands/list-issue-types");
15
16
  const run_jql_1 = require("./commands/run-jql");
16
17
  const update_description_1 = require("./commands/update-description");
17
18
  const add_comment_1 = require("./commands/add-comment");
@@ -70,6 +71,11 @@ program
70
71
  .command('project-statuses <project-id>')
71
72
  .description('Show all possible statuses for a project')
72
73
  .action(withPermission('project-statuses', project_statuses_1.projectStatusesCommand));
74
+ // List issue types command
75
+ program
76
+ .command('list-issue-types <project-key>')
77
+ .description('Show all issue types for a project')
78
+ .action(withPermission('list-issue-types', list_issue_types_1.listIssueTypesCommand));
73
79
  // Run JQL command
74
80
  program
75
81
  .command('run-jql <jql-query>')
@@ -27,6 +27,11 @@ const ALL_COMMANDS = [
27
27
  description: 'Show all possible statuses for a project',
28
28
  usage: 'jira-ai project-statuses --help'
29
29
  },
30
+ {
31
+ name: 'list-issue-types',
32
+ description: 'Show all issue types for a project (e.g., Epic, Task, Subtask)',
33
+ usage: 'jira-ai list-issue-types <project-key>'
34
+ },
30
35
  {
31
36
  name: 'run-jql',
32
37
  description: 'Execute JQL query and display results',
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.listIssueTypesCommand = listIssueTypesCommand;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const ora_1 = __importDefault(require("ora"));
9
+ const jira_client_1 = require("../lib/jira-client");
10
+ const formatters_1 = require("../lib/formatters");
11
+ async function listIssueTypesCommand(projectKey) {
12
+ const spinner = (0, ora_1.default)(`Fetching issue types for project ${projectKey}...`).start();
13
+ try {
14
+ const issueTypes = await (0, jira_client_1.getProjectIssueTypes)(projectKey);
15
+ spinner.succeed(chalk_1.default.green('Issue types retrieved'));
16
+ console.log((0, formatters_1.formatProjectIssueTypes)(projectKey, issueTypes));
17
+ }
18
+ catch (error) {
19
+ spinner.fail(chalk_1.default.red('Failed to fetch issue types'));
20
+ console.error(chalk_1.default.red('\nError: ' + (error instanceof Error ? error.message : 'Unknown error')));
21
+ process.exit(1);
22
+ }
23
+ }
@@ -8,6 +8,7 @@ exports.formatProjects = formatProjects;
8
8
  exports.formatTaskDetails = formatTaskDetails;
9
9
  exports.formatProjectStatuses = formatProjectStatuses;
10
10
  exports.formatJqlResults = formatJqlResults;
11
+ exports.formatProjectIssueTypes = formatProjectIssueTypes;
11
12
  const chalk_1 = __importDefault(require("chalk"));
12
13
  const cli_table3_1 = __importDefault(require("cli-table3"));
13
14
  const utils_1 = require("./utils");
@@ -191,3 +192,42 @@ function formatJqlResults(issues) {
191
192
  output += table.toString() + '\n';
192
193
  return output;
193
194
  }
195
+ /**
196
+ * Format project issue types list
197
+ */
198
+ function formatProjectIssueTypes(projectKey, issueTypes) {
199
+ if (issueTypes.length === 0) {
200
+ return chalk_1.default.yellow('No issue types found for this project.');
201
+ }
202
+ // Separate standard issue types and subtasks
203
+ const standardTypes = issueTypes.filter(type => !type.subtask);
204
+ const subtaskTypes = issueTypes.filter(type => type.subtask);
205
+ let output = '\n' + chalk_1.default.bold(`Project ${projectKey} - Issue Types (${issueTypes.length} total)`) + '\n\n';
206
+ // Display standard issue types
207
+ if (standardTypes.length > 0) {
208
+ output += chalk_1.default.bold('Standard Issue Types:') + '\n';
209
+ const table = createTable(['Name', 'Type', 'Description'], [20, 15, 55]);
210
+ standardTypes.forEach((issueType) => {
211
+ table.push([
212
+ chalk_1.default.cyan(issueType.name),
213
+ issueType.subtask ? chalk_1.default.yellow('Subtask') : chalk_1.default.green('Standard'),
214
+ (0, utils_1.truncate)(issueType.description || chalk_1.default.gray('No description'), 55),
215
+ ]);
216
+ });
217
+ output += table.toString() + '\n';
218
+ }
219
+ // Display subtask types separately if they exist
220
+ if (subtaskTypes.length > 0) {
221
+ output += '\n' + chalk_1.default.bold('Subtask Types:') + '\n';
222
+ const subtaskTable = createTable(['Name', 'Type', 'Description'], [20, 15, 55]);
223
+ subtaskTypes.forEach((issueType) => {
224
+ subtaskTable.push([
225
+ chalk_1.default.cyan(issueType.name),
226
+ chalk_1.default.yellow('Subtask'),
227
+ (0, utils_1.truncate)(issueType.description || chalk_1.default.gray('No description'), 55),
228
+ ]);
229
+ });
230
+ output += subtaskTable.toString() + '\n';
231
+ }
232
+ return output;
233
+ }
@@ -9,6 +9,7 @@ exports.getProjectStatuses = getProjectStatuses;
9
9
  exports.searchIssuesByJql = searchIssuesByJql;
10
10
  exports.updateIssueDescription = updateIssueDescription;
11
11
  exports.addIssueComment = addIssueComment;
12
+ exports.getProjectIssueTypes = getProjectIssueTypes;
12
13
  const jira_js_1 = require("jira.js");
13
14
  const utils_1 = require("./utils");
14
15
  const auth_storage_1 = require("./auth-storage");
@@ -252,3 +253,20 @@ async function addIssueComment(taskId, adfContent) {
252
253
  comment: adfContent,
253
254
  });
254
255
  }
256
+ /**
257
+ * Get all issue types for a project
258
+ */
259
+ async function getProjectIssueTypes(projectIdOrKey) {
260
+ const client = getJiraClient();
261
+ const project = await client.projects.getProject({
262
+ projectIdOrKey,
263
+ expand: 'issueTypes',
264
+ });
265
+ return project.issueTypes?.map((issueType) => ({
266
+ id: issueType.id || '',
267
+ name: issueType.name || '',
268
+ description: issueType.description,
269
+ subtask: issueType.subtask || false,
270
+ hierarchyLevel: issueType.hierarchyLevel || 0,
271
+ })) || [];
272
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jira-ai",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "CLI tool for interacting with Atlassian Jira",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {
package/settings.yaml CHANGED
@@ -11,7 +11,7 @@ projects:
11
11
  # - all
12
12
 
13
13
  # Commands: List of allowed commands (use "all" to allow all commands)
14
- # Available commands: me, projects, task-with-details, project-statuses, run-jql, update-description, about
14
+ # Available commands: me, projects, task-with-details, project-statuses, list-issue-types, run-jql, update-description, add-comment, about
15
15
  commands:
16
16
  - me
17
17
  - projects
@@ -20,5 +20,6 @@ commands:
20
20
  # - all
21
21
  - task-with-details
22
22
  # - project-statuses
23
+ - list-issue-types
23
24
  - update-description
24
25
  - add-comment