@eve-horizon/cli 0.0.1

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.
@@ -0,0 +1,938 @@
1
+ "use strict";
2
+ /**
3
+ * Progressive help system for Eve Horizon CLI.
4
+ *
5
+ * Help is available at every level:
6
+ * - eve --help → top-level commands
7
+ * - eve profile --help → profile subcommands
8
+ * - eve profile set --help → specific usage
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.HELP = void 0;
12
+ exports.showMainHelp = showMainHelp;
13
+ exports.showCommandHelp = showCommandHelp;
14
+ exports.showSubcommandHelp = showSubcommandHelp;
15
+ exports.shouldShowHelp = shouldShowHelp;
16
+ exports.HELP = {
17
+ org: {
18
+ description: 'Manage organizations. Organizations group projects and users.',
19
+ usage: 'eve org <subcommand> [options]',
20
+ subcommands: {
21
+ list: {
22
+ description: 'List all organizations',
23
+ usage: 'eve org list [--limit N] [--offset N]',
24
+ options: [
25
+ '--limit <n> Number of results (default: 10)',
26
+ '--offset <n> Skip first n results',
27
+ '--include-deleted Include soft-deleted orgs',
28
+ ],
29
+ },
30
+ get: {
31
+ description: 'Get organization details',
32
+ usage: 'eve org get <org_id>',
33
+ },
34
+ ensure: {
35
+ description: 'Create org if it doesn\'t exist, or return existing',
36
+ usage: 'eve org ensure <name>',
37
+ examples: ['eve org ensure "My Company"'],
38
+ },
39
+ update: {
40
+ description: 'Update organization',
41
+ usage: 'eve org update <org_id> [--name <name>] [--deleted <bool>]',
42
+ },
43
+ },
44
+ examples: [
45
+ 'eve org ensure "Acme Corp"',
46
+ 'eve org list --limit 20',
47
+ ],
48
+ },
49
+ project: {
50
+ description: 'Manage projects. Projects link a git repo to an organization for running jobs.',
51
+ usage: 'eve project <subcommand> [options]',
52
+ subcommands: {
53
+ list: {
54
+ description: 'List projects in an organization',
55
+ usage: 'eve project list [--org <org_id>]',
56
+ options: [
57
+ '--org <id> Organization ID (uses profile default)',
58
+ '--limit <n> Number of results',
59
+ '--offset <n> Skip first n results',
60
+ ],
61
+ },
62
+ get: {
63
+ description: 'Get project details',
64
+ usage: 'eve project get <project_id>',
65
+ },
66
+ ensure: {
67
+ description: 'Create project if it doesn\'t exist, or return existing',
68
+ usage: 'eve project ensure --name <name> --repo-url <url> [--org <org_id>] [--branch <branch>] [--slug <slug>]',
69
+ options: [
70
+ '--name <name> Project name (required)',
71
+ '--repo-url <url> Git repository URL (required)',
72
+ '--org <id> Organization ID',
73
+ '--branch <branch> Default branch (default: main)',
74
+ '--slug <slug> Short memorable slug (4-8 chars, e.g., MyProj)',
75
+ '--force Re-clone repo even if project exists',
76
+ ],
77
+ examples: [
78
+ 'eve project ensure --name my-app --slug MyApp --repo-url https://github.com/org/repo',
79
+ 'eve project ensure --name my-app --repo-url file:///path/to/repo --force',
80
+ ],
81
+ },
82
+ update: {
83
+ description: 'Update project',
84
+ usage: 'eve project update <project_id> [--name <name>] [--deleted <bool>]',
85
+ },
86
+ sync: {
87
+ description: 'Sync manifest from local .eve/manifest.yaml to Eve API',
88
+ usage: 'eve project sync [project] [--path <manifest_path>]',
89
+ options: [
90
+ '<project> Project ID (uses profile default if omitted)',
91
+ '--path <path> Path to manifest (default: .eve/manifest.yaml)',
92
+ ],
93
+ examples: [
94
+ 'eve project sync',
95
+ 'eve project sync proj_xxx',
96
+ 'eve project sync --path ./custom-manifest.yaml',
97
+ ],
98
+ },
99
+ },
100
+ },
101
+ secrets: {
102
+ description: 'Manage secrets at project/org/user scope. Values are never returned in plaintext.',
103
+ usage: 'eve secrets <subcommand> [options]',
104
+ subcommands: {
105
+ set: {
106
+ description: 'Create or update a secret value',
107
+ usage: 'eve secrets set <key> <value> [--project <id>|--org <id>|--user <id>] [--type <type>]',
108
+ options: [
109
+ '--project <id> Project ID (uses profile default)',
110
+ '--org <id> Organization ID',
111
+ '--user <id> User ID',
112
+ '--type <type> env_var | file | github_token | ssh_key',
113
+ ],
114
+ },
115
+ list: {
116
+ description: 'List secrets (metadata only)',
117
+ usage: 'eve secrets list [--project <id>|--org <id>|--user <id>]',
118
+ },
119
+ show: {
120
+ description: 'Show a masked secret value',
121
+ usage: 'eve secrets show <key> [--project <id>|--org <id>|--user <id>]',
122
+ },
123
+ delete: {
124
+ description: 'Delete a secret',
125
+ usage: 'eve secrets delete <key> [--project <id>|--org <id>|--user <id>]',
126
+ },
127
+ import: {
128
+ description: 'Import EVE_SECRET_* entries from an env file',
129
+ usage: 'eve secrets import [--file <path>] [--project <id>|--org <id>|--user <id>]',
130
+ options: [
131
+ '--file <path> Defaults to .env',
132
+ ],
133
+ },
134
+ },
135
+ examples: [
136
+ 'eve secrets set GITHUB_TOKEN ghp_xxx --project proj_xxx --type github_token',
137
+ 'eve secrets show GITHUB_TOKEN --project proj_xxx',
138
+ ],
139
+ },
140
+ job: {
141
+ description: `Manage jobs. Jobs are units of work executed by AI agents against a project's repo.
142
+
143
+ Phase lifecycle: idea → backlog → ready → active → review → done (or cancelled)
144
+ Jobs default to 'ready' phase, making them immediately schedulable.`,
145
+ usage: 'eve job <subcommand> [options]',
146
+ subcommands: {
147
+ create: {
148
+ description: 'Create a new job',
149
+ usage: 'eve job create --project <id> --description "..." [options]',
150
+ options: [
151
+ '--project <id> Project ID (or use profile default)',
152
+ '--description <text> Work description/prompt (required)',
153
+ '--title <text> Title (auto-generated from description if omitted)',
154
+ '--parent <id> Parent job ID (for sub-jobs)',
155
+ '--type <type> Issue type: task, bug, feature, epic, chore (default: task)',
156
+ '--priority <0-4> Priority P0-P4 (default: 2)',
157
+ '--phase <phase> Initial phase (default: ready)',
158
+ '--review <type> Review requirement: none, human, agent (default: none)',
159
+ '--labels <a,b,c> Comma-separated labels',
160
+ '--assignee <id> Assign to agent/user',
161
+ '--defer-until <date> Hide until date (ISO 8601)',
162
+ '--due-at <date> Deadline (ISO 8601)',
163
+ '',
164
+ 'Scheduling hints (used by scheduler when claiming):',
165
+ '--harness <name> Preferred harness, e.g., mclaude:fast',
166
+ '--worker-type <type> Worker type preference',
167
+ '--permission <policy> Permission policy: default, auto_edit, yolo',
168
+ '--timeout <seconds> Execution timeout',
169
+ '',
170
+ 'Inline execution (for agents creating sub-jobs):',
171
+ '--claim Create and immediately claim the job',
172
+ '--agent <id> Agent ID for claim (default: $EVE_AGENT_ID)',
173
+ ],
174
+ examples: [
175
+ 'eve job create --description "Fix the login bug in auth.ts"',
176
+ 'eve job create --description "Add dark mode" --priority 1 --harness mclaude',
177
+ 'eve job create --parent MyProj-abc123 --description "Implement tokens" --claim',
178
+ ],
179
+ },
180
+ list: {
181
+ description: 'List jobs in a project',
182
+ usage: 'eve job list [--project <id>] [--phase <phase>] [--assignee <id>] [--since <time>] [--stuck]',
183
+ options: [
184
+ '--project <id> Project ID (or use profile default)',
185
+ '--phase <phase> Filter by phase',
186
+ '--assignee <id> Filter by assignee',
187
+ '--priority <n> Filter by priority',
188
+ '--since <time> Filter jobs created after time (e.g., "1h", "30m", "2d", or ISO timestamp)',
189
+ '--stuck Show only jobs stuck in active phase (no progress for 5+ min)',
190
+ '--stuck-minutes <n> Minutes threshold for stuck detection (default: 5)',
191
+ '--limit <n> Number of results (default: 50)',
192
+ '--offset <n> Skip first n results',
193
+ ],
194
+ examples: [
195
+ 'eve job list --phase active',
196
+ 'eve job list --since 1h',
197
+ 'eve job list --stuck',
198
+ ],
199
+ },
200
+ ready: {
201
+ description: 'Show schedulable jobs (ready phase, not blocked, not deferred)',
202
+ usage: 'eve job ready [--project <id>] [--limit <n>]',
203
+ options: [
204
+ '--project <id> Project ID (or use profile default)',
205
+ '--limit <n> Number of results (default: 10)',
206
+ ],
207
+ },
208
+ blocked: {
209
+ description: 'Show jobs blocked by dependencies',
210
+ usage: 'eve job blocked [--project <id>]',
211
+ options: [
212
+ '--project <id> Project ID (or use profile default)',
213
+ ],
214
+ },
215
+ show: {
216
+ description: 'Get job details',
217
+ usage: 'eve job show <job-id> [--verbose]',
218
+ options: [
219
+ '--verbose Include attempt details, exit codes, durations',
220
+ ],
221
+ examples: ['eve job show MyProj-abc123', 'eve job show MyProj-abc123 --verbose'],
222
+ },
223
+ current: {
224
+ description: 'Get the current job context (defaults to EVE_JOB_ID)',
225
+ usage: 'eve job current [<job-id>] [--json|--tree]',
226
+ options: [
227
+ '--tree Render job hierarchy instead of JSON',
228
+ ],
229
+ examples: ['eve job current', 'eve job current MyProj-abc123 --tree'],
230
+ },
231
+ diagnose: {
232
+ description: 'Comprehensive job debugging (state, attempts, timeline, logs, recommendations)',
233
+ usage: 'eve job diagnose <job-id>',
234
+ examples: ['eve job diagnose MyProj-abc123'],
235
+ },
236
+ tree: {
237
+ description: 'Show job hierarchy (parent + children)',
238
+ usage: 'eve job tree <job-id>',
239
+ examples: ['eve job tree MyProj-abc123'],
240
+ },
241
+ update: {
242
+ description: 'Update job fields',
243
+ usage: 'eve job update <job-id> [--phase <phase>] [--priority <n>] ...',
244
+ options: [
245
+ '--phase <phase> Transition phase (validated)',
246
+ '--priority <n> Set priority (0-4)',
247
+ '--assignee <id> Set assignee',
248
+ '--title <text> Update title',
249
+ '--description <text> Update description',
250
+ '--labels <a,b,c> Set labels',
251
+ '--defer-until <date> Set defer date',
252
+ '--due-at <date> Set due date',
253
+ '--review <type> Set review requirement',
254
+ ],
255
+ },
256
+ close: {
257
+ description: 'Mark job as done',
258
+ usage: 'eve job close <job-id> [--reason "..."]',
259
+ options: [
260
+ '--reason <text> Completion reason',
261
+ ],
262
+ },
263
+ cancel: {
264
+ description: 'Mark job as cancelled',
265
+ usage: 'eve job cancel <job-id> [--reason "..."]',
266
+ options: [
267
+ '--reason <text> Cancellation reason',
268
+ ],
269
+ },
270
+ dep: {
271
+ description: 'Manage job dependencies',
272
+ usage: 'eve job dep <add|remove|list> [args]',
273
+ options: [
274
+ 'add <from> <to> Add dependency: from depends on to',
275
+ 'remove <from> <to> Remove dependency',
276
+ 'list <job-id> Show dependencies and dependents',
277
+ ],
278
+ examples: [
279
+ 'eve job dep add MyProj-abc123 MyProj-def456',
280
+ 'eve job dep list MyProj-abc123',
281
+ ],
282
+ },
283
+ claim: {
284
+ description: 'Claim a job for execution (creates attempt, transitions to active)',
285
+ usage: 'eve job claim <job-id> [--agent <id>] [--harness <name>]',
286
+ options: [
287
+ '--agent <id> Agent identifier (default: $EVE_AGENT_ID or cli-user)',
288
+ '--harness <name> Harness to use (overrides hints)',
289
+ '',
290
+ 'NOTE: This is typically called by the scheduler or by agents creating',
291
+ 'sub-jobs. For normal workflows, jobs are auto-scheduled when ready.',
292
+ ],
293
+ },
294
+ release: {
295
+ description: 'Release a claimed job (ends attempt, returns to ready)',
296
+ usage: 'eve job release <job-id> [--agent <id>] [--reason "..."]',
297
+ options: [
298
+ '--agent <id> Agent identifier (default: $EVE_AGENT_ID or cli-user)',
299
+ '--reason <text> Release reason',
300
+ ],
301
+ },
302
+ attempts: {
303
+ description: 'List execution attempts for a job',
304
+ usage: 'eve job attempts <job-id>',
305
+ },
306
+ logs: {
307
+ description: 'View execution logs for a job attempt',
308
+ usage: 'eve job logs <job-id> [--attempt <n>] [--after <seq>]',
309
+ options: [
310
+ '--attempt <n> Attempt number (default: latest)',
311
+ '--after <seq> Return logs after sequence number',
312
+ ],
313
+ },
314
+ submit: {
315
+ description: 'Submit job for review',
316
+ usage: 'eve job submit <job-id> --summary "..."',
317
+ options: [
318
+ '--summary <text> Submission summary (required)',
319
+ '--agent-id <id> Agent ID (default: cli-user)',
320
+ ],
321
+ },
322
+ approve: {
323
+ description: 'Approve a job in review',
324
+ usage: 'eve job approve <job-id> [--comment "..."]',
325
+ options: [
326
+ '--comment <text> Approval comment',
327
+ '--reviewer-id <id> Reviewer ID (default: cli-user)',
328
+ ],
329
+ },
330
+ reject: {
331
+ description: 'Reject a job in review (creates new attempt)',
332
+ usage: 'eve job reject <job-id> --reason "..."',
333
+ options: [
334
+ '--reason <text> Rejection reason (required)',
335
+ '--reviewer-id <id> Reviewer ID (default: cli-user)',
336
+ ],
337
+ },
338
+ result: {
339
+ description: 'Get job execution result',
340
+ usage: 'eve job result <job-id> [--attempt <n>]',
341
+ options: [
342
+ '--attempt <n> Attempt number (default: latest)',
343
+ ],
344
+ examples: ['eve job result MyProj-abc123'],
345
+ },
346
+ wait: {
347
+ description: 'Wait for job completion, polling until done',
348
+ usage: 'eve job wait <job-id> [--timeout <seconds>] [--quiet]',
349
+ options: [
350
+ '--timeout <seconds> Max wait time (default: 300)',
351
+ '--quiet Suppress progress output',
352
+ ],
353
+ examples: ['eve job wait MyProj-abc123', 'eve job wait MyProj-abc123 --timeout 600'],
354
+ },
355
+ follow: {
356
+ description: 'Stream job logs in real-time (SSE)',
357
+ usage: 'eve job follow <job-id> [--raw] [--no-result]',
358
+ options: [
359
+ '--raw Show raw log entries',
360
+ '--no-result Don\'t fetch final result when done',
361
+ ],
362
+ examples: ['eve job follow MyProj-abc123'],
363
+ },
364
+ },
365
+ examples: [
366
+ 'eve job create --description "Fix the bug in auth.ts"',
367
+ 'eve job list --phase ready',
368
+ 'eve job show MyProj-abc123',
369
+ 'eve job close MyProj-abc123 --reason "Completed"',
370
+ ],
371
+ },
372
+ harness: {
373
+ description: 'Inspect available harnesses, variants, and auth status.',
374
+ usage: 'eve harness <subcommand> [options]',
375
+ subcommands: {
376
+ list: {
377
+ description: 'List available harnesses',
378
+ usage: 'eve harness list',
379
+ },
380
+ get: {
381
+ description: 'Get harness details and auth requirements',
382
+ usage: 'eve harness get <name>',
383
+ examples: ['eve harness get mclaude'],
384
+ },
385
+ },
386
+ examples: ['eve harness list', 'eve harness get mclaude'],
387
+ },
388
+ profile: {
389
+ description: `Manage CLI profiles. Profiles store defaults (API URL, org, project) so you don't
390
+ have to specify them on every command. Useful when working with multiple environments.`,
391
+ usage: 'eve profile <subcommand> [options]',
392
+ subcommands: {
393
+ list: {
394
+ description: 'List all profiles',
395
+ usage: 'eve profile list',
396
+ },
397
+ show: {
398
+ description: 'Show profile details',
399
+ usage: 'eve profile show [name]',
400
+ examples: ['eve profile show', 'eve profile show prod'],
401
+ },
402
+ use: {
403
+ description: 'Switch active profile',
404
+ usage: 'eve profile use <name>',
405
+ examples: ['eve profile use prod'],
406
+ },
407
+ create: {
408
+ description: 'Create a new profile',
409
+ usage: 'eve profile create <name> [--api-url <url>] [--org <id>] [--project <id>]',
410
+ options: [
411
+ '--api-url <url> API base URL',
412
+ '--org <id> Default organization ID',
413
+ '--project <id> Default project ID',
414
+ '--harness <name> Default harness (e.g., mclaude:fast)',
415
+ '--supabase-url <url> Supabase URL (for cloud auth)',
416
+ '--supabase-anon-key <key> Supabase anon key',
417
+ ],
418
+ examples: [
419
+ 'eve profile create local --api-url http://localhost:4701',
420
+ 'eve profile create prod --api-url https://api.example.com --org org_xxx',
421
+ ],
422
+ },
423
+ set: {
424
+ description: 'Update profile settings',
425
+ usage: 'eve profile set [name] [--api-url <url>] [--org <id>] [--project <id>]',
426
+ options: [
427
+ '--api-url <url> API base URL',
428
+ '--org <id> Default organization ID',
429
+ '--project <id> Default project ID',
430
+ '--harness <name> Default harness',
431
+ '--supabase-url <url> Supabase URL',
432
+ '--supabase-anon-key <key> Supabase anon key',
433
+ ],
434
+ examples: [
435
+ 'eve profile set --org org_xxx --project proj_yyy',
436
+ 'eve profile set prod --api-url https://new-api.example.com',
437
+ ],
438
+ },
439
+ remove: {
440
+ description: 'Remove a profile',
441
+ usage: 'eve profile remove <name>',
442
+ },
443
+ },
444
+ examples: [
445
+ 'eve profile create local --api-url http://localhost:4701',
446
+ 'eve profile use local',
447
+ 'eve profile set --org org_xxx',
448
+ ],
449
+ },
450
+ auth: {
451
+ description: `Authenticate with Eve Horizon. Auth is optional for local development but required
452
+ for cloud deployments. Credentials are stored per-profile.`,
453
+ usage: 'eve auth <subcommand> [options]',
454
+ subcommands: {
455
+ login: {
456
+ description: 'Login with email and password',
457
+ usage: 'eve auth login --email <email> --password <password>',
458
+ options: [
459
+ '--email <email> Email address',
460
+ '--password <pass> Password',
461
+ ],
462
+ },
463
+ logout: {
464
+ description: 'Clear stored credentials',
465
+ usage: 'eve auth logout',
466
+ },
467
+ status: {
468
+ description: 'Check authentication status',
469
+ usage: 'eve auth status',
470
+ },
471
+ whoami: {
472
+ description: 'Show current user info',
473
+ usage: 'eve auth whoami',
474
+ },
475
+ },
476
+ },
477
+ env: {
478
+ description: 'Manage environments for projects. Environments are deployment targets (staging, production, test).',
479
+ usage: 'eve env <subcommand> [options]',
480
+ subcommands: {
481
+ list: {
482
+ description: 'List environments for a project',
483
+ usage: 'eve env list [project]',
484
+ options: [
485
+ '<project> Project ID or slug (uses profile default if omitted)',
486
+ ],
487
+ examples: ['eve env list', 'eve env list proj_xxx'],
488
+ },
489
+ show: {
490
+ description: 'Show details of an environment',
491
+ usage: 'eve env show <project> <name>',
492
+ examples: ['eve env show proj_xxx staging', 'eve env show my-project production'],
493
+ },
494
+ create: {
495
+ description: 'Create an environment',
496
+ usage: 'eve env create <name> --type=<type> [options]',
497
+ options: [
498
+ '<name> Environment name (e.g., staging, production, test)',
499
+ '--type <type> Environment type: persistent or temporary (required)',
500
+ '--namespace <ns> K8s namespace (optional)',
501
+ '--db-ref <ref> Database reference (optional)',
502
+ '--project <id> Project ID (uses profile default if omitted)',
503
+ ],
504
+ examples: [
505
+ 'eve env create staging --type=persistent',
506
+ 'eve env create test --type=persistent --namespace=eve-test',
507
+ ],
508
+ },
509
+ deploy: {
510
+ description: 'Deploy to an environment',
511
+ usage: 'eve env deploy <project> <name> [--tag=<tag>]',
512
+ options: [
513
+ '<project> Project ID or slug',
514
+ '<name> Environment name (staging, production, test)',
515
+ '--tag <tag> Image tag (e.g., "local" for local images, "sha-abc" for CI)',
516
+ ],
517
+ examples: [
518
+ 'eve env deploy proj_xxx staging',
519
+ 'eve env deploy my-project test --tag local',
520
+ ],
521
+ },
522
+ },
523
+ examples: ['eve env list', 'eve env create test --type=persistent', 'eve env deploy proj_xxx staging'],
524
+ },
525
+ api: {
526
+ description: 'Explore project API sources and call them with Eve auth.',
527
+ usage: 'eve api <subcommand> [options]',
528
+ subcommands: {
529
+ list: {
530
+ description: 'List API sources for a project',
531
+ usage: 'eve api list [project] [--env <name>]',
532
+ options: [
533
+ '<project> Project ID (uses profile default if omitted)',
534
+ '--env <name> Environment name (optional filter)',
535
+ ],
536
+ examples: ['eve api list', 'eve api list proj_xxx --env staging'],
537
+ },
538
+ show: {
539
+ description: 'Show details for a single API source',
540
+ usage: 'eve api show <name> [project]',
541
+ options: ['--env <name> Environment name (optional filter)'],
542
+ examples: ['eve api show app', 'eve api show app proj_xxx --env staging'],
543
+ },
544
+ spec: {
545
+ description: 'Show cached API spec (OpenAPI/GraphQL)',
546
+ usage: 'eve api spec <name> [project]',
547
+ options: ['--env <name> Environment name (optional filter)'],
548
+ examples: ['eve api spec app', 'eve api spec app proj_xxx --env staging'],
549
+ },
550
+ refresh: {
551
+ description: 'Refresh cached API spec',
552
+ usage: 'eve api refresh <name> [project]',
553
+ options: ['--env <name> Environment name (optional filter)'],
554
+ examples: ['eve api refresh app --env staging'],
555
+ },
556
+ examples: {
557
+ description: 'Print curl templates from the cached API spec',
558
+ usage: 'eve api examples <name> [project]',
559
+ options: ['--env <name> Environment name (optional filter)'],
560
+ examples: ['eve api examples app', 'eve api examples app --env staging'],
561
+ },
562
+ call: {
563
+ description: 'Call an API endpoint with Eve auth',
564
+ usage: 'eve api call <name> <method> <path> [options]',
565
+ options: [
566
+ '--project <id> Project ID (uses profile default)',
567
+ '--env <name> Environment name (optional source)',
568
+ '--json <payload> JSON body inline or @file',
569
+ '--jq <expr> Filter JSON output with jq',
570
+ '--graphql <query> GraphQL query inline or @file',
571
+ '--variables <json> JSON variables for GraphQL query',
572
+ '--token <token> Override auth token',
573
+ '--print-curl Print curl command instead of executing',
574
+ ],
575
+ examples: [
576
+ 'eve api call app GET /notes --jq ".items"',
577
+ 'eve api call app POST /notes --json "{\"title\":\"Hello\"}"',
578
+ 'eve api call graphql POST /graphql --graphql "{ notes { id } }"',
579
+ ],
580
+ },
581
+ },
582
+ },
583
+ db: {
584
+ description: 'Inspect and query environment databases with Eve auth + RLS.',
585
+ usage: 'eve db <subcommand> [options]',
586
+ subcommands: {
587
+ schema: {
588
+ description: 'Show database schema for an environment',
589
+ usage: 'eve db schema --env <name> [--project <id>]',
590
+ options: ['--env <name> Environment name (required)'],
591
+ examples: ['eve db schema --env staging'],
592
+ },
593
+ rls: {
594
+ description: 'Show RLS policies and tables for an environment',
595
+ usage: 'eve db rls --env <name> [--project <id>]',
596
+ options: ['--env <name> Environment name (required)'],
597
+ examples: ['eve db rls --env staging'],
598
+ },
599
+ sql: {
600
+ description: 'Run parameterized SQL as the calling user',
601
+ usage: 'eve db sql --env <name> --sql <statement> [options]',
602
+ options: [
603
+ '--env <name> Environment name (required)',
604
+ '--sql <statement> SQL to run (inline)',
605
+ '--file <path> Read SQL from file',
606
+ '--params <json> JSON array/object of parameters',
607
+ '--write Allow writes (requires db.write scope)',
608
+ ],
609
+ examples: [
610
+ 'eve db sql --env staging --sql "select * from notes"',
611
+ 'eve db sql --env staging --file ./query.sql --params "[1]"',
612
+ ],
613
+ },
614
+ migrate: {
615
+ description: 'Apply pending migrations for an environment',
616
+ usage: 'eve db migrate --env <name> [--project <id>]',
617
+ options: [
618
+ '--env <name> Environment name (required)',
619
+ '--path <dir> Migrations directory (default .eve/migrations)',
620
+ ],
621
+ examples: ['eve db migrate --env staging', 'eve db migrate --env test --path ./migrations'],
622
+ },
623
+ },
624
+ },
625
+ pipeline: {
626
+ description: 'Run and inspect pipelines defined in the project manifest.',
627
+ usage: 'eve pipeline <subcommand> [options]',
628
+ subcommands: {
629
+ list: {
630
+ description: 'List pipelines for a project',
631
+ usage: 'eve pipeline list [project]',
632
+ options: [
633
+ '<project> Project ID or slug (uses profile default if omitted)',
634
+ ],
635
+ examples: ['eve pipeline list', 'eve pipeline list proj_xxx'],
636
+ },
637
+ show: {
638
+ description: 'Show pipeline definition',
639
+ usage: 'eve pipeline show <project> <name>',
640
+ examples: ['eve pipeline show proj_xxx release', 'eve pipeline show my-project deploy'],
641
+ },
642
+ run: {
643
+ description: 'Run a pipeline',
644
+ usage: 'eve pipeline run <name> --ref <sha> [--env <env>] [--wait]',
645
+ options: [
646
+ '--ref <sha> Git SHA or ref (required)',
647
+ '--env <env> Target environment',
648
+ '--project <id> Project ID (uses profile default)',
649
+ '--wait Wait for completion',
650
+ '--timeout <n> Max wait time (seconds)',
651
+ '--inputs <json> JSON inputs for the pipeline',
652
+ ],
653
+ examples: [
654
+ 'eve pipeline run deploy-test --ref abc123 --env test',
655
+ 'eve pipeline run deploy-test --ref abc123 --env test --wait --timeout 120',
656
+ ],
657
+ },
658
+ runs: {
659
+ description: 'List runs for a pipeline',
660
+ usage: 'eve pipeline runs <name> [project]',
661
+ options: [
662
+ '--limit <n> Number of results (default: 10)',
663
+ '--offset <n> Skip first n results',
664
+ ],
665
+ examples: ['eve pipeline runs deploy-test', 'eve pipeline runs deploy-test proj_xxx'],
666
+ },
667
+ 'show-run': {
668
+ description: 'Show a pipeline run',
669
+ usage: 'eve pipeline show-run <name> <run-id> [--project <id>]',
670
+ examples: ['eve pipeline show-run deploy-test prun_xxx'],
671
+ },
672
+ approve: {
673
+ description: 'Approve a pipeline run awaiting approval',
674
+ usage: 'eve pipeline approve <run-id>',
675
+ examples: ['eve pipeline approve prun_xxx'],
676
+ },
677
+ cancel: {
678
+ description: 'Cancel a pipeline run',
679
+ usage: 'eve pipeline cancel <run-id> [--reason <text>]',
680
+ examples: ['eve pipeline cancel prun_xxx --reason "superseded"'],
681
+ },
682
+ },
683
+ examples: ['eve pipeline list', 'eve pipeline run deploy-test --ref abc123 --env test'],
684
+ },
685
+ workflow: {
686
+ description: 'Inspect workflows defined in the project manifest (read-only in Phase 1).',
687
+ usage: 'eve workflow <subcommand> [options]',
688
+ subcommands: {
689
+ list: {
690
+ description: 'List workflows for a project',
691
+ usage: 'eve workflow list [project]',
692
+ options: [
693
+ '<project> Project ID or slug (uses profile default if omitted)',
694
+ ],
695
+ examples: ['eve workflow list', 'eve workflow list proj_xxx'],
696
+ },
697
+ show: {
698
+ description: 'Show workflow definition',
699
+ usage: 'eve workflow show <project> <name>',
700
+ examples: ['eve workflow show proj_xxx qa-review', 'eve workflow show my-project release-notes'],
701
+ },
702
+ },
703
+ examples: ['eve workflow list', 'eve workflow show proj_xxx qa-review'],
704
+ },
705
+ event: {
706
+ description: 'Emit and inspect events. Apps use this to participate in the Event Ecosystem.',
707
+ usage: 'eve event <subcommand> [options]',
708
+ subcommands: {
709
+ list: {
710
+ description: 'List events for a project',
711
+ usage: 'eve event list [project] [--type] [--source] [--status]',
712
+ options: [
713
+ '<project> Project ID or slug (uses profile default if omitted)',
714
+ '--type <type> Filter by event type (e.g., github.push, app.deploy.complete)',
715
+ '--source <source> Filter by source (e.g., github, cron, app)',
716
+ '--status <status> Filter by status (pending, processed, failed)',
717
+ '--limit <n> Number of results',
718
+ '--offset <n> Skip first n results',
719
+ ],
720
+ examples: ['eve event list', 'eve event list --type app.deploy.complete --source app'],
721
+ },
722
+ show: {
723
+ description: 'Show event details',
724
+ usage: 'eve event show <event_id> [--project <id>]',
725
+ examples: ['eve event show evt_xxx', 'eve event show evt_xxx --project proj_yyy'],
726
+ },
727
+ emit: {
728
+ description: 'Emit an event to trigger pipelines or notify other services',
729
+ usage: 'eve event emit --type <type> --source <source> [options]',
730
+ options: [
731
+ '--project <id> Project ID (required)',
732
+ '--type <type> Event type (e.g., app.build.complete, deploy.finished)',
733
+ '--source <source> Event source (e.g., app, ci, manual)',
734
+ '--env <name> Environment name',
735
+ '--branch <branch> Git branch reference',
736
+ '--sha <sha> Git commit SHA',
737
+ '--payload <json> JSON payload with event data',
738
+ ],
739
+ examples: [
740
+ 'eve event emit --project proj_xxx --type app.build.complete --source app',
741
+ 'eve event emit --project proj_xxx --type deploy.finished --source ci --env production --payload \'{"version":"1.2.3"}\'',
742
+ ],
743
+ },
744
+ },
745
+ examples: [
746
+ 'eve event list',
747
+ 'eve event emit --type app.ready --source app --project proj_xxx',
748
+ ],
749
+ },
750
+ system: {
751
+ description: 'System administration and health checks.',
752
+ usage: 'eve system <subcommand> [options]',
753
+ subcommands: {
754
+ health: {
755
+ description: 'Quick health check of the API',
756
+ usage: 'eve system health',
757
+ examples: ['eve system health', 'eve system health --json'],
758
+ },
759
+ status: {
760
+ description: 'Show comprehensive system status (API, orchestrator, worker, queue)',
761
+ usage: 'eve system status',
762
+ examples: ['eve system status', 'eve system status --json'],
763
+ },
764
+ jobs: {
765
+ description: 'List all jobs across all projects (admin view)',
766
+ usage: 'eve system jobs [--org <id>] [--project <id>] [--phase <phase>] [--limit <n>] [--offset <n>]',
767
+ options: [
768
+ '--org <id> Filter by organization ID',
769
+ '--project <id> Filter by project ID',
770
+ '--phase <phase> Filter by job phase',
771
+ '--limit <n> Number of results (default: 50)',
772
+ '--offset <n> Skip first n results',
773
+ ],
774
+ examples: [
775
+ 'eve system jobs',
776
+ 'eve system jobs --phase active',
777
+ 'eve system jobs --project proj_xxx',
778
+ ],
779
+ },
780
+ envs: {
781
+ description: 'List all environments across all projects (admin view)',
782
+ usage: 'eve system envs [--org <id>] [--project <id>] [--limit <n>] [--offset <n>]',
783
+ options: [
784
+ '--org <id> Filter by organization ID',
785
+ '--project <id> Filter by project ID',
786
+ '--limit <n> Number of results (default: 50)',
787
+ '--offset <n> Skip first n results',
788
+ ],
789
+ examples: [
790
+ 'eve system envs',
791
+ 'eve system envs --project proj_xxx',
792
+ ],
793
+ },
794
+ logs: {
795
+ description: 'Fetch recent logs for a system service (api, orchestrator, worker, postgres)',
796
+ usage: 'eve system logs <service> [--tail <n>]',
797
+ options: [
798
+ '--tail <n> Number of log lines (default: 100)',
799
+ ],
800
+ examples: [
801
+ 'eve system logs api',
802
+ 'eve system logs worker --tail 200',
803
+ ],
804
+ },
805
+ pods: {
806
+ description: 'List pods across the cluster (admin view)',
807
+ usage: 'eve system pods',
808
+ examples: ['eve system pods'],
809
+ },
810
+ events: {
811
+ description: 'List recent cluster events (admin view)',
812
+ usage: 'eve system events [--limit <n>]',
813
+ options: [
814
+ '--limit <n> Max number of events (default: 50)',
815
+ ],
816
+ examples: ['eve system events', 'eve system events --limit 20'],
817
+ },
818
+ config: {
819
+ description: 'Show deployment configuration summary (system admins only)',
820
+ usage: 'eve system config',
821
+ examples: ['eve system config'],
822
+ },
823
+ },
824
+ examples: [
825
+ 'eve system health',
826
+ 'eve system status',
827
+ 'eve system jobs',
828
+ 'eve system envs',
829
+ 'eve system logs api',
830
+ ],
831
+ },
832
+ };
833
+ function showMainHelp() {
834
+ console.log('Eve Horizon CLI');
835
+ console.log('');
836
+ console.log('Usage: eve <command> [subcommand] [options]');
837
+ console.log('');
838
+ console.log('Commands:');
839
+ console.log(' org Manage organizations');
840
+ console.log(' project Manage projects');
841
+ console.log(' job Manage jobs (create, list, show, update, claim, etc.)');
842
+ console.log(' env Manage environments (list, show, deploy)');
843
+ console.log(' api Explore API sources and call endpoints');
844
+ console.log(' db Inspect env DB schema, RLS, and SQL');
845
+ console.log(' pipeline Inspect manifest pipelines (list, show)');
846
+ console.log(' workflow Inspect manifest workflows (list, show)');
847
+ console.log(' event Emit and inspect events (app integration)');
848
+ console.log(' secrets Manage secrets (project/org/user scope)');
849
+ console.log(' harness Inspect harnesses and auth status');
850
+ console.log(' profile Manage CLI profiles (API URL, defaults)');
851
+ console.log(' auth Authentication (login, logout, status)');
852
+ console.log(' system System health and status checks');
853
+ console.log('');
854
+ console.log('Global options:');
855
+ console.log(' --help Show help for command');
856
+ console.log(' --api-url <url> Override API URL');
857
+ console.log(' --profile <name> Use named profile');
858
+ console.log(' --org <id> Override default org');
859
+ console.log(' --project <id> Override default project');
860
+ console.log(' --json Output as JSON');
861
+ console.log('');
862
+ console.log('Examples:');
863
+ console.log(' eve org ensure "My Company"');
864
+ console.log(' eve project ensure --name my-app --slug MyApp --repo-url https://github.com/org/repo');
865
+ console.log(' eve job create --description "Fix the bug in auth.ts"');
866
+ console.log(' eve job list --phase ready');
867
+ console.log(' eve job show MyProj-abc123');
868
+ console.log('');
869
+ console.log('Run "eve <command> --help" for more information on a command.');
870
+ }
871
+ function showCommandHelp(command) {
872
+ const help = exports.HELP[command];
873
+ if (!help) {
874
+ console.log(`Unknown command: ${command}`);
875
+ console.log('Run "eve --help" for available commands.');
876
+ return;
877
+ }
878
+ console.log(`eve ${command} - ${help.description.split('\n')[0]}`);
879
+ console.log('');
880
+ if (help.description.includes('\n')) {
881
+ console.log(help.description);
882
+ console.log('');
883
+ }
884
+ console.log(`Usage: ${help.usage}`);
885
+ console.log('');
886
+ if (help.subcommands) {
887
+ console.log('Subcommands:');
888
+ const maxLen = Math.max(...Object.keys(help.subcommands).map(k => k.length));
889
+ for (const [name, sub] of Object.entries(help.subcommands)) {
890
+ console.log(` ${name.padEnd(maxLen + 2)} ${sub.description}`);
891
+ }
892
+ console.log('');
893
+ }
894
+ if (help.examples && help.examples.length > 0) {
895
+ console.log('Examples:');
896
+ help.examples.forEach(ex => console.log(` ${ex}`));
897
+ console.log('');
898
+ }
899
+ console.log(`Run "eve ${command} <subcommand> --help" for subcommand details.`);
900
+ }
901
+ function showSubcommandHelp(command, subcommand) {
902
+ const cmdHelp = exports.HELP[command];
903
+ if (!cmdHelp) {
904
+ console.log(`Unknown command: ${command}`);
905
+ return;
906
+ }
907
+ const subHelp = cmdHelp.subcommands?.[subcommand];
908
+ if (!subHelp) {
909
+ console.log(`Unknown subcommand: ${command} ${subcommand}`);
910
+ console.log(`Run "eve ${command} --help" for available subcommands.`);
911
+ return;
912
+ }
913
+ console.log(`eve ${command} ${subcommand} - ${subHelp.description}`);
914
+ console.log('');
915
+ console.log(`Usage: ${subHelp.usage}`);
916
+ if (subHelp.options && subHelp.options.length > 0) {
917
+ console.log('');
918
+ console.log('Options:');
919
+ subHelp.options.forEach(opt => console.log(` ${opt}`));
920
+ }
921
+ if (subHelp.examples && subHelp.examples.length > 0) {
922
+ console.log('');
923
+ console.log('Examples:');
924
+ subHelp.examples.forEach(ex => console.log(` ${ex}`));
925
+ }
926
+ }
927
+ function shouldShowHelp(subcommand, flags) {
928
+ if (flags.help || flags.h) {
929
+ return subcommand ? 'subcommand' : 'command';
930
+ }
931
+ if (subcommand === '--help' || subcommand === '-h') {
932
+ return 'command';
933
+ }
934
+ if (!subcommand) {
935
+ return 'command';
936
+ }
937
+ return false;
938
+ }