baton-issue-tracker 1.12.0 → 1.13.0

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": "baton-issue-tracker",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "A CLI issue tracker for AI agents",
5
5
  "type": "module",
6
6
  "bin": {
package/source/cli.js CHANGED
@@ -26,6 +26,7 @@ import { run as runPriority } from './commands/priority.js';
26
26
  import { run as runLog } from './commands/log.js';
27
27
  import { run as runRegister } from './commands/register.js';
28
28
  import { run as runAgents } from './commands/agents.js';
29
+ import { run as runWhoami } from './commands/whoami.js';
29
30
  import { run as runSubmit } from './commands/submit.js';
30
31
  import { run as runUnclaim } from './commands/unclaim.js';
31
32
  import { run as runClaim } from './commands/claim.js';
@@ -41,6 +42,7 @@ Commands:
41
42
  init Initialize storage and seed issues from product specs
42
43
  register Register a new AI agent or human user
43
44
  agents List all registered agents and humans
45
+ whoami Show the currently authenticated agent or user
44
46
  status Show issue counts and overall progress
45
47
  view View all issue fields for a given issue ID
46
48
  search Search issues by title and description (case insensitive)
@@ -64,6 +66,7 @@ Options:
64
66
  register --name <name> Name of the agent or user
65
67
  register --type <type> agent | human (default: agent)
66
68
  agents [--json]
69
+ whoami [--json]
67
70
  status --json Output as JSON (for AI agents)
68
71
  view <id> [--json]
69
72
  search <query> [--json]
@@ -99,6 +102,7 @@ Examples:
99
102
  baton init --force
100
103
  baton register --name claude-dev --type agent
101
104
  baton agents
105
+ baton whoami
102
106
  baton status
103
107
  baton view 29
104
108
  baton search system
@@ -138,6 +142,7 @@ async function main() {
138
142
  init: () => runInit(args),
139
143
  register: () => runRegister(args),
140
144
  agents: () => runAgents(args),
145
+ whoami: () => runWhoami(args),
141
146
  status: () => runStatus(args),
142
147
  view: () => runView(args),
143
148
  search: () => runSearch(args),
@@ -0,0 +1,54 @@
1
+ // whoami.js
2
+ // Shows the currently authenticated agent or user.
3
+ // Usage: baton whoami [--json]
4
+ //
5
+ // Options:
6
+ // --json Output as JSON (for AI agents)
7
+ // -h, --help Show this help
8
+ //
9
+ // Examples:
10
+ // baton whoami
11
+
12
+ import { getCurrentActor } from '../services/authService.js';
13
+ import { hasFlag, renderOutput, renderError, wantsHelp } from '../util.js';
14
+
15
+ const VALID_FLAGS = ['--json', '-h', '--help'];
16
+
17
+ function serializeActor(actor) {
18
+ return {
19
+ id: actor.id,
20
+ name: actor.name,
21
+ type: actor.type,
22
+ };
23
+ }
24
+
25
+ export async function run(args = []) {
26
+ const isJson = hasFlag(args, '--json');
27
+
28
+ if (wantsHelp(args)) {
29
+ console.log(
30
+ `Usage: baton whoami [--json]\n\nOptions:\n --json Output as JSON (for AI agents)\n -h, --help Show this help\n\nExamples:\n baton whoami`,
31
+ );
32
+ return 0;
33
+ }
34
+
35
+ for (const arg of args) {
36
+ if (arg.startsWith('-') && !VALID_FLAGS.includes(arg)) {
37
+ throw new Error(`Unknown flag provided: ${arg}.\nFlags: --json, -h, --help`);
38
+ }
39
+ }
40
+
41
+ const actor = getCurrentActor();
42
+ if (!actor) {
43
+ renderError(isJson, 'No authenticated actor found. Please sign in with a registered agent.', 'UNAUTHORIZED');
44
+ return 1;
45
+ }
46
+
47
+ const envelope = { status: 'success', actor: serializeActor(actor) };
48
+
49
+ renderOutput(isJson, envelope, () => {
50
+ console.log(`Active Agent: "${actor.name}" (ID: ${actor.id}, Type: ${actor.type})`);
51
+ });
52
+
53
+ return 0;
54
+ }