jira-ai 0.3.20 → 0.3.21

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
@@ -8,6 +8,7 @@ import { projectsCommand } from './commands/projects.js';
8
8
  import { taskWithDetailsCommand } from './commands/task-with-details.js';
9
9
  import { projectStatusesCommand } from './commands/project-statuses.js';
10
10
  import { listIssueTypesCommand } from './commands/list-issue-types.js';
11
+ import { listColleaguesCommand } from './commands/list-colleagues.js';
11
12
  import { runJqlCommand } from './commands/run-jql.js';
12
13
  import { updateDescriptionCommand } from './commands/update-description.js';
13
14
  import { addCommentCommand } from './commands/add-comment.js';
@@ -33,7 +34,7 @@ const program = new Command();
33
34
  program
34
35
  .name('jira-ai')
35
36
  .description('CLI tool for interacting with Atlassian Jira')
36
- .version('0.3.20')
37
+ .version('0.3.21')
37
38
  .option('-o, --organization <alias>', 'Override the active Jira organization');
38
39
  // Hook to handle the global option before any command runs
39
40
  program.on('option:organization', (alias) => {
@@ -110,6 +111,17 @@ program
110
111
  .command('projects')
111
112
  .description('Show list of projects')
112
113
  .action(withPermission('projects', projectsCommand));
114
+ // List colleagues command
115
+ program
116
+ .command('list-colleagues [project-key]')
117
+ .description('Show all colleagues in the project or organization')
118
+ .action(withPermission('list-colleagues', listColleaguesCommand, {
119
+ validateArgs: (args) => {
120
+ if (args[0]) {
121
+ validateOptions(ProjectKeySchema, args[0]);
122
+ }
123
+ }
124
+ }));
113
125
  // Task with details command
114
126
  program
115
127
  .command('task-with-details <task-id>')
@@ -0,0 +1,24 @@
1
+ import chalk from 'chalk';
2
+ import { getUsers } from '../lib/jira-client.js';
3
+ import { formatUsers } from '../lib/formatters.js';
4
+ import { ui } from '../lib/ui.js';
5
+ export async function listColleaguesCommand(projectKey) {
6
+ const message = projectKey
7
+ ? `Fetching colleagues for project ${projectKey}...`
8
+ : 'Fetching all active colleagues...';
9
+ ui.startSpinner(message);
10
+ try {
11
+ const users = await getUsers(projectKey);
12
+ ui.succeedSpinner(chalk.green('Colleagues retrieved'));
13
+ if (users.length === 0) {
14
+ console.log(chalk.yellow('\nNo active colleagues found.'));
15
+ }
16
+ else {
17
+ console.log(formatUsers(users));
18
+ }
19
+ }
20
+ catch (error) {
21
+ ui.failSpinner(chalk.red('Failed to fetch colleagues'));
22
+ throw error;
23
+ }
24
+ }
@@ -313,3 +313,22 @@ export function formatIssueStatistics(statsList) {
313
313
  output += table.toString() + '\n';
314
314
  return output;
315
315
  }
316
+ /**
317
+ * Format users list
318
+ */
319
+ export function formatUsers(users) {
320
+ if (users.length === 0) {
321
+ return chalk.yellow('No users found.');
322
+ }
323
+ const table = createTable(['Display Name', 'Email', 'Account ID'], [30, 40, 30]);
324
+ users.forEach((user) => {
325
+ table.push([
326
+ chalk.cyan(user.displayName),
327
+ user.emailAddress || chalk.gray('N/A'),
328
+ chalk.gray(user.accountId),
329
+ ]);
330
+ });
331
+ let output = '\n' + chalk.bold(`Colleagues (${users.length} total)`) + '\n\n';
332
+ output += table.toString() + '\n';
333
+ return output;
334
+ }
@@ -423,3 +423,34 @@ export async function transitionIssue(issueIdOrKey, transitionId) {
423
423
  },
424
424
  });
425
425
  }
426
+ /**
427
+ * Get users, optionally filtered by project
428
+ */
429
+ export async function getUsers(projectKey) {
430
+ const client = getJiraClient();
431
+ let users;
432
+ if (projectKey) {
433
+ users = await client.userSearch.findAssignableUsers({
434
+ project: projectKey,
435
+ maxResults: 1000,
436
+ });
437
+ }
438
+ else {
439
+ users = await client.userSearch.findUsers({
440
+ query: '',
441
+ maxResults: 1000,
442
+ });
443
+ }
444
+ // Filter for active users
445
+ return users
446
+ .filter((user) => user.active && user.accountType === 'atlassian')
447
+ .map((user) => ({
448
+ accountId: user.accountId || '',
449
+ displayName: user.displayName || '',
450
+ emailAddress: user.emailAddress || '',
451
+ active: user.active || false,
452
+ timeZone: user.timeZone || '',
453
+ // @ts-ignore
454
+ host: client.config.host || 'N/A',
455
+ }));
456
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jira-ai",
3
- "version": "0.3.20",
3
+ "version": "0.3.21",
4
4
  "description": "AI friendly Jira CLI to save context",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",