@agentmeshhq/agent 0.4.1 → 0.4.3

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.
Files changed (122) hide show
  1. package/dist/__tests__/bootstrap.test.d.ts +1 -0
  2. package/dist/__tests__/bootstrap.test.js +39 -0
  3. package/dist/__tests__/bootstrap.test.js.map +1 -0
  4. package/dist/__tests__/claims.integration.test.d.ts +1 -0
  5. package/dist/__tests__/claims.integration.test.js +128 -0
  6. package/dist/__tests__/claims.integration.test.js.map +1 -0
  7. package/dist/__tests__/context-template.test.js +15 -0
  8. package/dist/__tests__/context-template.test.js.map +1 -1
  9. package/dist/__tests__/evicted-cleanup.test.d.ts +10 -0
  10. package/dist/__tests__/evicted-cleanup.test.js +459 -0
  11. package/dist/__tests__/evicted-cleanup.test.js.map +1 -0
  12. package/dist/__tests__/handoff-sla.test.d.ts +1 -0
  13. package/dist/__tests__/handoff-sla.test.js +29 -0
  14. package/dist/__tests__/handoff-sla.test.js.map +1 -0
  15. package/dist/__tests__/handoff.integration.test.d.ts +1 -0
  16. package/dist/__tests__/handoff.integration.test.js +77 -0
  17. package/dist/__tests__/handoff.integration.test.js.map +1 -0
  18. package/dist/__tests__/injector.test.js +31 -2
  19. package/dist/__tests__/injector.test.js.map +1 -1
  20. package/dist/__tests__/local.test.d.ts +1 -0
  21. package/dist/__tests__/local.test.js +124 -0
  22. package/dist/__tests__/local.test.js.map +1 -0
  23. package/dist/__tests__/registry.claims.test.d.ts +1 -0
  24. package/dist/__tests__/registry.claims.test.js +70 -0
  25. package/dist/__tests__/registry.claims.test.js.map +1 -0
  26. package/dist/__tests__/registry.retry.test.d.ts +1 -0
  27. package/dist/__tests__/registry.retry.test.js +33 -0
  28. package/dist/__tests__/registry.retry.test.js.map +1 -0
  29. package/dist/__tests__/status.test.d.ts +1 -0
  30. package/dist/__tests__/status.test.js +55 -0
  31. package/dist/__tests__/status.test.js.map +1 -0
  32. package/dist/__tests__/tmux-send.test.d.ts +10 -0
  33. package/dist/__tests__/tmux-send.test.js +96 -0
  34. package/dist/__tests__/tmux-send.test.js.map +1 -0
  35. package/dist/__tests__/worker.test.d.ts +1 -0
  36. package/dist/__tests__/worker.test.js +51 -0
  37. package/dist/__tests__/worker.test.js.map +1 -0
  38. package/dist/cli/autopilot.d.ts +17 -0
  39. package/dist/cli/autopilot.js +20 -0
  40. package/dist/cli/autopilot.js.map +1 -0
  41. package/dist/cli/claims.d.ts +18 -0
  42. package/dist/cli/claims.js +133 -0
  43. package/dist/cli/claims.js.map +1 -0
  44. package/dist/cli/handoff.d.ts +22 -0
  45. package/dist/cli/handoff.js +147 -0
  46. package/dist/cli/handoff.js.map +1 -0
  47. package/dist/cli/inbox.d.ts +5 -0
  48. package/dist/cli/inbox.js +123 -0
  49. package/dist/cli/inbox.js.map +1 -0
  50. package/dist/cli/index.js +496 -13
  51. package/dist/cli/index.js.map +1 -1
  52. package/dist/cli/issue.d.ts +42 -0
  53. package/dist/cli/issue.js +297 -0
  54. package/dist/cli/issue.js.map +1 -0
  55. package/dist/cli/local.d.ts +27 -6
  56. package/dist/cli/local.js +319 -36
  57. package/dist/cli/local.js.map +1 -1
  58. package/dist/cli/ready.d.ts +5 -0
  59. package/dist/cli/ready.js +131 -0
  60. package/dist/cli/ready.js.map +1 -0
  61. package/dist/cli/start.d.ts +2 -0
  62. package/dist/cli/start.js +3 -0
  63. package/dist/cli/start.js.map +1 -1
  64. package/dist/cli/status.d.ts +14 -1
  65. package/dist/cli/status.js +46 -1
  66. package/dist/cli/status.js.map +1 -1
  67. package/dist/cli/sync.d.ts +8 -0
  68. package/dist/cli/sync.js +154 -0
  69. package/dist/cli/sync.js.map +1 -0
  70. package/dist/cli/token.js +242 -9
  71. package/dist/cli/token.js.map +1 -1
  72. package/dist/cli/whoami.d.ts +6 -0
  73. package/dist/cli/whoami.js +109 -5
  74. package/dist/cli/whoami.js.map +1 -1
  75. package/dist/cli/worker.d.ts +2 -0
  76. package/dist/cli/worker.js +52 -0
  77. package/dist/cli/worker.js.map +1 -0
  78. package/dist/config/schema.d.ts +12 -0
  79. package/dist/core/cleanup/eligibility.d.ts +41 -0
  80. package/dist/core/cleanup/eligibility.js +64 -0
  81. package/dist/core/cleanup/eligibility.js.map +1 -0
  82. package/dist/core/cleanup/scheduler.d.ts +50 -0
  83. package/dist/core/cleanup/scheduler.js +120 -0
  84. package/dist/core/cleanup/scheduler.js.map +1 -0
  85. package/dist/core/cleanup/worker.d.ts +63 -0
  86. package/dist/core/cleanup/worker.js +191 -0
  87. package/dist/core/cleanup/worker.js.map +1 -0
  88. package/dist/core/daemon/bootstrap.d.ts +2 -0
  89. package/dist/core/daemon/bootstrap.js +10 -1
  90. package/dist/core/daemon/bootstrap.js.map +1 -1
  91. package/dist/core/daemon/context-template.d.ts +7 -2
  92. package/dist/core/daemon/context-template.js +18 -11
  93. package/dist/core/daemon/context-template.js.map +1 -1
  94. package/dist/core/daemon/workspace.d.ts +5 -0
  95. package/dist/core/daemon/workspace.js +47 -7
  96. package/dist/core/daemon/workspace.js.map +1 -1
  97. package/dist/core/daemon.d.ts +20 -0
  98. package/dist/core/daemon.js +304 -20
  99. package/dist/core/daemon.js.map +1 -1
  100. package/dist/core/handoff-sla.d.ts +6 -0
  101. package/dist/core/handoff-sla.js +29 -0
  102. package/dist/core/handoff-sla.js.map +1 -0
  103. package/dist/core/heartbeat.d.ts +6 -1
  104. package/dist/core/heartbeat.js +44 -39
  105. package/dist/core/heartbeat.js.map +1 -1
  106. package/dist/core/injector.js +2 -2
  107. package/dist/core/injector.js.map +1 -1
  108. package/dist/core/issue-cache.d.ts +44 -0
  109. package/dist/core/issue-cache.js +75 -0
  110. package/dist/core/issue-cache.js.map +1 -0
  111. package/dist/core/registry.d.ts +48 -0
  112. package/dist/core/registry.js +106 -0
  113. package/dist/core/registry.js.map +1 -1
  114. package/dist/core/tmux-runtime.js +5 -2
  115. package/dist/core/tmux-runtime.js.map +1 -1
  116. package/dist/core/token-lifecycle.d.ts +81 -0
  117. package/dist/core/token-lifecycle.js +210 -0
  118. package/dist/core/token-lifecycle.js.map +1 -0
  119. package/dist/core/token-lifecycle.test.d.ts +10 -0
  120. package/dist/core/token-lifecycle.test.js +309 -0
  121. package/dist/core/token-lifecycle.test.js.map +1 -0
  122. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -3,24 +3,31 @@ import { createRequire } from "node:module";
3
3
  import { Command } from "commander";
4
4
  import pc from "picocolors";
5
5
  import { attach } from "./attach.js";
6
+ import { runAutopilot } from "./autopilot.js";
6
7
  import { build } from "./build.js";
8
+ import { createClaim, listClaims, releaseClaim } from "./claims.js";
7
9
  import { configCmd } from "./config.js";
8
10
  import { contextCmd } from "./context.js";
9
11
  import { deploy } from "./deploy.js";
12
+ import { completeHandoff, inbox, reassignHandoff, updateHandoffStatus } from "./handoff.js";
10
13
  import { init } from "./init.js";
14
+ import { claimIssue, closeIssue, createIssue, handoffIssue, listIssues, showIssue, updateIssue, } from "./issue.js";
11
15
  import { list } from "./list.js";
12
- import { localDown, localLogs, localStatus, localUp } from "./local.js";
16
+ import { localDoctor, localDown, localLogs, localSmoke, localStatus, localUp } from "./local.js";
13
17
  import { logs } from "./logs.js";
14
18
  import { migrate } from "./migrate.js";
15
19
  import { nudge } from "./nudge.js";
20
+ import { ready } from "./ready.js";
16
21
  import { restart } from "./restart.js";
17
22
  import { slack } from "./slack.js";
18
23
  import { start } from "./start.js";
19
24
  import { status } from "./status.js";
20
25
  import { stop } from "./stop.js";
26
+ import { sync } from "./sync.js";
21
27
  import { test } from "./test.js";
22
28
  import { token } from "./token.js";
23
- import { whoami } from "./whoami.js";
29
+ import { resolvePO, whoami } from "./whoami.js";
30
+ import { pauseWorkerAutomation, resumeWorkerAutomation } from "./worker.js";
24
31
  const require = createRequire(import.meta.url);
25
32
  const pkg = require("../../package.json");
26
33
  const program = new Command();
@@ -28,6 +35,40 @@ program
28
35
  .name("agentmesh")
29
36
  .description("AgentMesh Agent Wrapper - Turn any AI assistant into a dispatchable agent")
30
37
  .version(pkg.version);
38
+ program
39
+ .command("autopilot")
40
+ .description("Legacy compatibility wrapper for worker autopilot mode")
41
+ .command("run")
42
+ .description("Run autonomous worker mode (canonical path: agentmesh start --worker)")
43
+ .requiredOption("-n, --name <name>", "Agent name")
44
+ .option("-c, --command <command>", "Command to run (default: opencode)")
45
+ .option("-w, --workdir <path>", "Working directory")
46
+ .option("-m, --model <model>", "Model identifier")
47
+ .option("--restore-context", "Restore context from previous session")
48
+ .option("--auto-setup", "Auto-clone repository for project assignments")
49
+ .option("-p, --project <code>", "Project code — auto-resolves workdir from project settings")
50
+ .option("--role <role>", "Role for auto-assignment (default: dev)")
51
+ .option("--no-auto-accept-handoffs", "Disable automatic handoff acceptance in worker mode (enabled by default)")
52
+ .action(async (options) => {
53
+ try {
54
+ console.log(pc.yellow("[deprecated] `agentmesh autopilot run` is a compatibility wrapper. Prefer `agentmesh start --worker`."));
55
+ await runAutopilot({
56
+ name: options.name,
57
+ command: options.command,
58
+ workdir: options.workdir,
59
+ model: options.model,
60
+ restoreContext: options.restoreContext,
61
+ autoSetup: options.autoSetup,
62
+ project: options.project,
63
+ role: options.role,
64
+ noAutoAcceptHandoffs: options.noAutoAcceptHandoffs,
65
+ });
66
+ }
67
+ catch (error) {
68
+ console.error(pc.red(error.message));
69
+ process.exit(1);
70
+ }
71
+ });
31
72
  program
32
73
  .command("init")
33
74
  .description("Initialize AgentMesh configuration")
@@ -50,6 +91,7 @@ program
50
91
  .option("-f, --foreground", "Run in foreground (blocking)")
51
92
  .option("--restore-context", "Restore context from previous session (default: disabled)")
52
93
  .option("--worker", "Enable auto-nudge and restart for worker agents (default: disabled)")
94
+ .option("--no-auto-accept-handoffs", "Disable automatic handoff acceptance in worker mode (enabled by default for --worker)")
53
95
  .option("--auto-setup", "Auto-clone repository for project assignments")
54
96
  .option("-p, --project <code>", "Project code — auto-resolves workdir from project settings")
55
97
  .option("--role <role>", "Role for auto-assignment (default: dev)")
@@ -129,13 +171,175 @@ program
129
171
  process.exit(1);
130
172
  }
131
173
  });
174
+ program
175
+ .command("inbox")
176
+ .description("List inbox items (defaults to pending handoffs)")
177
+ .option("-n, --name <name>", "Agent name")
178
+ .option("--type <type>", "Inbox type filter", "handoff")
179
+ .option("--all", "Include all statuses (default: pending only)")
180
+ .option("--json", "Output JSON")
181
+ .action(async (options) => {
182
+ try {
183
+ await inbox({
184
+ name: options.name,
185
+ type: options.type,
186
+ includeAll: options.all,
187
+ json: options.json,
188
+ });
189
+ }
190
+ catch (error) {
191
+ console.error(pc.red(error.message));
192
+ process.exit(1);
193
+ }
194
+ });
195
+ const handoffCommand = program.command("handoff").description("Manage handoff lifecycle");
196
+ handoffCommand
197
+ .command("accept")
198
+ .description("Accept a handoff")
199
+ .argument("<handoffId>", "Handoff ID")
200
+ .option("-n, --name <name>", "Agent name")
201
+ .action(async (handoffId, options) => {
202
+ try {
203
+ await updateHandoffStatus(handoffId, "accepted", options.name);
204
+ }
205
+ catch (error) {
206
+ console.error(pc.red(error.message));
207
+ process.exit(1);
208
+ }
209
+ });
210
+ const claimsCommand = program.command("claims").description("Manage coordination claims");
211
+ claimsCommand
212
+ .command("create")
213
+ .description("Create a claim for path patterns")
214
+ .requiredOption("--scope <scope>", "Claim scope")
215
+ .requiredOption("--path <pattern...>", "Path pattern(s), repeat or pass comma-separated values")
216
+ .option("--ttl-seconds <seconds>", "Claim TTL in seconds (30-86400)")
217
+ .option("-n, --name <name>", "Agent name")
218
+ .action(async (options) => {
219
+ try {
220
+ await createClaim({
221
+ name: options.name,
222
+ scope: options.scope,
223
+ paths: options.path,
224
+ ttlSeconds: options.ttlSeconds ? parseInt(options.ttlSeconds, 10) : undefined,
225
+ });
226
+ }
227
+ catch (error) {
228
+ console.error(pc.red(error.message));
229
+ process.exit(1);
230
+ }
231
+ });
232
+ claimsCommand
233
+ .command("list")
234
+ .description("List claims in the current workspace")
235
+ .option("-n, --name <name>", "Agent name")
236
+ .option("--status <status>", "Filter by status (active, released, expired, force_released)")
237
+ .option("--json", "Output JSON")
238
+ .action(async (options) => {
239
+ try {
240
+ await listClaims({
241
+ name: options.name,
242
+ status: options.status,
243
+ json: options.json,
244
+ });
245
+ }
246
+ catch (error) {
247
+ console.error(pc.red(error.message));
248
+ process.exit(1);
249
+ }
250
+ });
251
+ claimsCommand
252
+ .command("release")
253
+ .description("Release an active claim")
254
+ .argument("<claimId>", "Claim ID")
255
+ .option("-n, --name <name>", "Agent name")
256
+ .action(async (claimId, options) => {
257
+ try {
258
+ await releaseClaim(claimId, { name: options.name });
259
+ }
260
+ catch (error) {
261
+ console.error(pc.red(error.message));
262
+ process.exit(1);
263
+ }
264
+ });
265
+ handoffCommand
266
+ .command("reject")
267
+ .description("Reject a handoff")
268
+ .argument("<handoffId>", "Handoff ID")
269
+ .option("-n, --name <name>", "Agent name")
270
+ .action(async (handoffId, options) => {
271
+ try {
272
+ await updateHandoffStatus(handoffId, "rejected", options.name);
273
+ }
274
+ catch (error) {
275
+ console.error(pc.red(error.message));
276
+ process.exit(1);
277
+ }
278
+ });
279
+ handoffCommand
280
+ .command("complete")
281
+ .description("Complete an accepted handoff")
282
+ .argument("<handoffId>", "Handoff ID")
283
+ .option("-n, --name <name>", "Agent name")
284
+ .option("--notes <notes>", "Completion notes")
285
+ .action(async (handoffId, options) => {
286
+ try {
287
+ await completeHandoff(handoffId, { name: options.name, notes: options.notes });
288
+ }
289
+ catch (error) {
290
+ console.error(pc.red(error.message));
291
+ process.exit(1);
292
+ }
293
+ });
294
+ handoffCommand
295
+ .command("reassign")
296
+ .description("Reassign a handoff to another agent")
297
+ .argument("<handoffId>", "Handoff ID")
298
+ .requiredOption("--to-agent-id <agentId>", "Target agent ID")
299
+ .option("-n, --name <name>", "Agent name")
300
+ .option("--scope <scope>", "Optional scope override for reassigned handoff")
301
+ .option("--reason <reason>", "Optional reason override for reassigned handoff")
302
+ .action(async (handoffId, options) => {
303
+ try {
304
+ await reassignHandoff(handoffId, {
305
+ name: options.name,
306
+ toAgentId: options.toAgentId,
307
+ scope: options.scope,
308
+ reason: options.reason,
309
+ });
310
+ }
311
+ catch (error) {
312
+ console.error(pc.red(error.message));
313
+ process.exit(1);
314
+ }
315
+ });
132
316
  program
133
317
  .command("whoami")
134
318
  .description("Show current agent identity and status")
135
319
  .argument("[name]", "Agent name (optional)")
136
- .action(async (name) => {
320
+ .option("--po", "Resolve and print the canonical Product Owner agent ID for this team")
321
+ .action(async (name, options) => {
322
+ try {
323
+ if (options.po) {
324
+ await resolvePO(name);
325
+ }
326
+ else {
327
+ await whoami(name);
328
+ }
329
+ }
330
+ catch (error) {
331
+ console.error(pc.red(error.message));
332
+ process.exit(1);
333
+ }
334
+ });
335
+ const poCmd = program.command("po").description("Product Owner operations");
336
+ poCmd
337
+ .command("resolve")
338
+ .description("Resolve the canonical Product Owner agent ID for the current team/workspace")
339
+ .option("-n, --name <name>", "Agent name (for token resolution)")
340
+ .action(async (options) => {
137
341
  try {
138
- await whoami(name);
342
+ await resolvePO(options.name);
139
343
  }
140
344
  catch (error) {
141
345
  console.error(pc.red(error.message));
@@ -145,7 +349,7 @@ program
145
349
  program
146
350
  .command("token")
147
351
  .description("Manage agent tokens")
148
- .argument("[action]", "Action: show (default), refresh, info")
352
+ .argument("[action]", "Action: show (default), refresh, info, health")
149
353
  .option("-n, --name <name>", "Agent name")
150
354
  .action(async (action, options) => {
151
355
  try {
@@ -159,9 +363,37 @@ program
159
363
  program
160
364
  .command("status")
161
365
  .description("Show AgentMesh status and health")
162
- .action(async () => {
366
+ .option("--sla-minutes <minutes>", "Pending handoff SLA threshold in minutes", "5")
367
+ .action(async (options) => {
368
+ try {
369
+ await status({ pendingHandoffSlaMinutes: parseInt(options.slaMinutes, 10) });
370
+ }
371
+ catch (error) {
372
+ console.error(pc.red(error.message));
373
+ process.exit(1);
374
+ }
375
+ });
376
+ const workerCommand = program.command("worker").description("Worker intervention controls");
377
+ workerCommand
378
+ .command("pause")
379
+ .description("Pause autonomous worker actions for an agent")
380
+ .argument("<name>", "Agent name")
381
+ .action(async (name) => {
382
+ try {
383
+ await pauseWorkerAutomation(name);
384
+ }
385
+ catch (error) {
386
+ console.error(pc.red(error.message));
387
+ process.exit(1);
388
+ }
389
+ });
390
+ workerCommand
391
+ .command("resume")
392
+ .description("Resume autonomous worker actions for an agent")
393
+ .argument("<name>", "Agent name")
394
+ .action(async (name) => {
163
395
  try {
164
- await status();
396
+ await resumeWorkerAutomation(name);
165
397
  }
166
398
  catch (error) {
167
399
  console.error(pc.red(error.message));
@@ -251,9 +483,17 @@ localCmd
251
483
  .command("up")
252
484
  .description("Start local development stack")
253
485
  .option("--no-detach", "Run in foreground")
486
+ .option("--target <path>", "Compose file path or target name (default: docker/docker-compose.local.yml)")
487
+ .option("--slot <number>", "Slot number for deterministic non-overlapping port block (0-based)", parseInt)
488
+ .option("--project <name>", "Docker Compose project name for namespace isolation")
254
489
  .action(async (options) => {
255
490
  try {
256
- await localUp({ detach: options.detach });
491
+ await localUp({
492
+ detach: options.detach,
493
+ target: options.target,
494
+ slot: options.slot,
495
+ project: options.project,
496
+ });
257
497
  }
258
498
  catch (error) {
259
499
  console.error(pc.red(error.message));
@@ -263,9 +503,16 @@ localCmd
263
503
  localCmd
264
504
  .command("down")
265
505
  .description("Stop local development stack")
266
- .action(async () => {
506
+ .option("--target <path>", "Compose file path or target name")
507
+ .option("--slot <number>", "Slot number", parseInt)
508
+ .option("--project <name>", "Docker Compose project name")
509
+ .action(async (options) => {
267
510
  try {
268
- await localDown();
511
+ await localDown({
512
+ target: options.target,
513
+ slot: options.slot,
514
+ project: options.project,
515
+ });
269
516
  }
270
517
  catch (error) {
271
518
  console.error(pc.red(error.message));
@@ -275,9 +522,16 @@ localCmd
275
522
  localCmd
276
523
  .command("status")
277
524
  .description("Show local stack status and ports")
278
- .action(async () => {
525
+ .option("--target <path>", "Compose file path or target name")
526
+ .option("--slot <number>", "Slot number", parseInt)
527
+ .option("--project <name>", "Docker Compose project name")
528
+ .action(async (options) => {
279
529
  try {
280
- await localStatus();
530
+ await localStatus({
531
+ target: options.target,
532
+ slot: options.slot,
533
+ project: options.project,
534
+ });
281
535
  }
282
536
  catch (error) {
283
537
  console.error(pc.red(error.message));
@@ -289,9 +543,50 @@ localCmd
289
543
  .description("View local stack logs")
290
544
  .option("-f, --follow", "Follow log output")
291
545
  .option("-s, --service <name>", "Specific service to show logs for")
546
+ .option("--target <path>", "Compose file path or target name")
547
+ .option("--slot <number>", "Slot number", parseInt)
548
+ .option("--project <name>", "Docker Compose project name")
549
+ .action(async (options) => {
550
+ try {
551
+ await localLogs({
552
+ follow: options.follow,
553
+ service: options.service,
554
+ target: options.target,
555
+ slot: options.slot,
556
+ project: options.project,
557
+ });
558
+ }
559
+ catch (error) {
560
+ console.error(pc.red(error.message));
561
+ process.exit(1);
562
+ }
563
+ });
564
+ localCmd
565
+ .command("doctor")
566
+ .description("Run preflight checks (port availability, compose file) without starting")
567
+ .option("--target <path>", "Compose file path or target name")
568
+ .option("--slot <number>", "Slot number", parseInt)
569
+ .option("--project <name>", "Docker Compose project name")
292
570
  .action(async (options) => {
293
571
  try {
294
- await localLogs({ follow: options.follow, service: options.service });
572
+ await localDoctor({
573
+ target: options.target,
574
+ slot: options.slot,
575
+ project: options.project,
576
+ });
577
+ }
578
+ catch (error) {
579
+ console.error(pc.red(error.message));
580
+ process.exit(1);
581
+ }
582
+ });
583
+ localCmd
584
+ .command("smoke")
585
+ .description("Quick smoke test — verify local stack API is reachable")
586
+ .option("--slot <number>", "Slot number", parseInt)
587
+ .action(async (options) => {
588
+ try {
589
+ await localSmoke({ slot: options.slot });
295
590
  }
296
591
  catch (error) {
297
592
  console.error(pc.red(error.message));
@@ -370,5 +665,193 @@ program
370
665
  process.exit(1);
371
666
  }
372
667
  });
668
+ // Issue tracking commands
669
+ const issueCmd = program.command("issue").description("Manage issues (integrated issue tracking)");
670
+ issueCmd
671
+ .command("create")
672
+ .description("Create a new issue")
673
+ .requiredOption("-t, --title <title>", "Issue title")
674
+ .option("-d, --description <desc>", "Issue description")
675
+ .option("--type <type>", "Issue type: bug, feature, task, epic", "task")
676
+ .option("--priority <priority>", "Priority: P0, P1, P2, P3, P4", "P2")
677
+ .option("--project <id>", "Project ID")
678
+ .option("--parent <id>", "Parent issue ID (for sub-tasks)")
679
+ .option("-l, --labels <labels>", "Comma-separated labels")
680
+ .action(async (options) => {
681
+ try {
682
+ await createIssue({
683
+ title: options.title,
684
+ description: options.description,
685
+ type: options.type,
686
+ priority: options.priority,
687
+ project: options.project,
688
+ parent: options.parent,
689
+ labels: options.labels?.split(",").map((l) => l.trim()),
690
+ });
691
+ }
692
+ catch (error) {
693
+ console.error(pc.red(error.message));
694
+ process.exit(1);
695
+ }
696
+ });
697
+ issueCmd
698
+ .command("list")
699
+ .alias("ls")
700
+ .description("List issues")
701
+ .option("-s, --status <status>", "Filter by status: open, in_progress, review, closed")
702
+ .option("--type <type>", "Filter by type: bug, feature, task, epic")
703
+ .option("--priority <priority>", "Filter by priority: P0, P1, P2, P3, P4")
704
+ .option("-a, --assignee <id>", "Filter by assignee (use 'me' for self)")
705
+ .option("--project <id>", "Filter by project")
706
+ .option("-n, --limit <n>", "Number of issues to show", "20")
707
+ .action(async (options) => {
708
+ try {
709
+ await listIssues({
710
+ status: options.status,
711
+ type: options.type,
712
+ priority: options.priority,
713
+ assignee: options.assignee,
714
+ project: options.project,
715
+ limit: parseInt(options.limit, 10),
716
+ });
717
+ }
718
+ catch (error) {
719
+ console.error(pc.red(error.message));
720
+ process.exit(1);
721
+ }
722
+ });
723
+ issueCmd
724
+ .command("show")
725
+ .description("Show issue details")
726
+ .argument("<id>", "Issue ID (e.g., agentmesh-abc)")
727
+ .action(async (id) => {
728
+ try {
729
+ await showIssue(id);
730
+ }
731
+ catch (error) {
732
+ console.error(pc.red(error.message));
733
+ process.exit(1);
734
+ }
735
+ });
736
+ issueCmd
737
+ .command("update")
738
+ .description("Update an issue")
739
+ .argument("<id>", "Issue ID")
740
+ .option("-t, --title <title>", "New title")
741
+ .option("-d, --description <desc>", "New description")
742
+ .option("--type <type>", "New type")
743
+ .option("--priority <priority>", "New priority")
744
+ .option("-s, --status <status>", "New status")
745
+ .option("--project <id>", "Assign to project")
746
+ .option("-a, --assignee <id>", "Assign to agent")
747
+ .option("-l, --labels <labels>", "Comma-separated labels")
748
+ .action(async (id, options) => {
749
+ try {
750
+ await updateIssue(id, {
751
+ title: options.title,
752
+ description: options.description,
753
+ type: options.type,
754
+ priority: options.priority,
755
+ status: options.status,
756
+ project: options.project,
757
+ assignee: options.assignee,
758
+ labels: options.labels?.split(",").map((l) => l.trim()),
759
+ });
760
+ }
761
+ catch (error) {
762
+ console.error(pc.red(error.message));
763
+ process.exit(1);
764
+ }
765
+ });
766
+ issueCmd
767
+ .command("close")
768
+ .description("Close an issue")
769
+ .argument("<id>", "Issue ID")
770
+ .action(async (id) => {
771
+ try {
772
+ await closeIssue(id);
773
+ }
774
+ catch (error) {
775
+ console.error(pc.red(error.message));
776
+ process.exit(1);
777
+ }
778
+ });
779
+ issueCmd
780
+ .command("claim")
781
+ .description("Claim an issue (assign to self and set in_progress)")
782
+ .argument("<id>", "Issue ID")
783
+ .action(async (id) => {
784
+ try {
785
+ await claimIssue(id);
786
+ }
787
+ catch (error) {
788
+ console.error(pc.red(error.message));
789
+ process.exit(1);
790
+ }
791
+ });
792
+ issueCmd
793
+ .command("handoff")
794
+ .description("Hand off an issue to another agent (creates handoff record)")
795
+ .argument("<id>", "Issue ID")
796
+ .requiredOption("--to <agent>", "Target agent ID")
797
+ .option("-r, --reason <reason>", "Reason for handoff")
798
+ .action(async (id, options) => {
799
+ try {
800
+ await handoffIssue(id, { to: options.to, reason: options.reason });
801
+ }
802
+ catch (error) {
803
+ console.error(pc.red(error.message));
804
+ process.exit(1);
805
+ }
806
+ });
807
+ // Inbox command
808
+ program
809
+ .command("inbox")
810
+ .description("Show your assigned issues and pending handoffs")
811
+ .option("-n, --name <name>", "Agent name")
812
+ .option("--type <type>", "Filter by type (handoff|issue)")
813
+ .option("--all", "Include all statuses")
814
+ .option("--json", "Output as JSON")
815
+ .action(async (options) => {
816
+ try {
817
+ await inbox({
818
+ name: options.name,
819
+ type: options.type,
820
+ includeAll: options.all,
821
+ json: options.json,
822
+ });
823
+ }
824
+ catch (error) {
825
+ console.error(pc.red(error.message));
826
+ process.exit(1);
827
+ }
828
+ });
829
+ // Ready command
830
+ program
831
+ .command("ready")
832
+ .description("Show available unassigned work")
833
+ .action(async () => {
834
+ try {
835
+ await ready();
836
+ }
837
+ catch (error) {
838
+ console.error(pc.red(error.message));
839
+ process.exit(1);
840
+ }
841
+ });
842
+ // Sync command
843
+ program
844
+ .command("sync")
845
+ .description("Sync local issue cache with AgentMesh HQ")
846
+ .option("-f, --force", "Force sync even if there are errors")
847
+ .action(async (options) => {
848
+ try {
849
+ await sync({ force: options.force });
850
+ }
851
+ catch (error) {
852
+ console.error(pc.red(error.message));
853
+ process.exit(1);
854
+ }
855
+ });
373
856
  program.parse();
374
857
  //# sourceMappingURL=index.js.map