@everyai/cli 0.9.0 → 0.11.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/README.md CHANGED
@@ -34,6 +34,8 @@ In Claude Code:
34
34
  /plugin install every@everyai-cli
35
35
  ```
36
36
 
37
+ The marketplace is `.claude-plugin/marketplace.json` in this repository; it lists one plugin, `every`, whose source is the repository root.
38
+
37
39
  Codex's repo-scoped marketplace location is `.agents/plugins/marketplace.json`.
38
40
 
39
41
  ## Why a CLI (vs. adding the MCP server to each host)
@@ -41,14 +43,14 @@ Codex's repo-scoped marketplace location is `.agents/plugins/marketplace.json`.
41
43
  The CLI talks to the same Every MCP server (`admin-mcp.every.ai`) and inherits its full tool surface automatically — new tools appear with no CLI upgrade. What the CLI adds:
42
44
 
43
45
  - **Portability** — one install + one login covers every agent and machine context; remote-MCP config is per-host, per-format, and often impossible in CI.
44
- - **Safety gates** — reads run freely; writes require `--yes`; destructive actions (sends, deletes, voids, payments) additionally require `--allow-destructive`; `--read-only` (or `EVERY_READ_ONLY=1`) locks everything else out. Classifications are enforced locally — including for tools whose server annotations are too optimistic. When trusted MCP metadata asks for an ordinary-write text confirmation, the CLI forwards the server's exact phrase and retries once.
46
+ - **Safety gates** — reads run freely; writes require `--yes`; destructive actions (sends, deletes, voids, payments) additionally require `--allow-destructive`; `--read-only` (or `EVERY_READ_ONLY=1`) locks everything else out. Classifications are enforced locally — including for tools whose server annotations are too optimistic. `every tool call deal_outreach` is destructive for all of its actions because it can send a deal's message. The short commands gate by action: `every deal outreach edit` and `cancel` are writes, and `every deal outreach send` is destructive. `update_deal` is a write. When trusted MCP metadata asks for an ordinary-write text confirmation, the CLI forwards the server's exact phrase and retries once.
45
47
  - **Deterministic output** — a stable `--json` envelope and exit-code taxonomy an agent can parse and branch on.
46
48
 
47
49
  ## Commands
48
50
 
49
51
  ```bash
50
52
  # Auth
51
- every signup [--timeout <seconds>] # new account or sign-in via one browser step; works without a TTY
53
+ every signup [--timeout <seconds>] [--no-skill] # new account or sign-in via one browser step; works without a TTY
52
54
  every signup status
53
55
  every signup complete --org-name <name> [--description <text>] [--link <url> ...] --yes
54
56
  every login [--org <name|slug|id>] [--staging] # browser OAuth; keychain storage; refresh handled
@@ -65,14 +67,40 @@ every policy explain <name> # classification + exactly what running it requir
65
67
  # Run any tool
66
68
  every tool call <name> [--args file.json|-] [--arg k=v ...] [--yes] [--allow-destructive] [--read-only]
67
69
 
68
- # Curated aliases (same gates, nicer flags)
70
+ # Short commands (same gates, nicer flags; each calls one tool)
69
71
  every invoice list [--status <s>] [--search <q>] [--limit <n>]
70
72
  every invoice create (--company <name> | --person <name> | --company-id <id> | --person-id <id>) --amount <n>
71
73
  # write: needs --yes
72
- every invoice send <invoice_id> # destructive: needs --yes --allow-destructive
73
- every deal list [--stage <s>] [--search <q>]
74
- every deal move <deal_id> <stage> # write: needs --yes
74
+ every invoice send <invoice_id> # shows the recipients, then needs --yes
75
+ every proposal send <proposal_id> # shows the recipients, then needs --yes
76
+ every recipients get|set <party> --kind invoice|proposal
77
+ every company list [--search <q>] [--limit <n>]
78
+ every company view <company_id>
79
+ every company create --name <name> [--email] [--phone] [--website] [--industry] [--address] [--lead-source] [--notes]
80
+ # write: needs --yes
75
81
  every person list [--search <q>] # People
82
+ every person view <person_id>
83
+ every person create --name <name> [--email] [--phone] [--job-title] [--company] [--location] [--headline] [--industry] [--address] [--notes]
84
+ # write: needs --yes
85
+ every deal stages # this workspace's stages: label, key, role, criteria
86
+ every deal list [--stage <s>] [--search <q>] [--limit <n>] # <s>: a stage key or label
87
+ [--attention needs_reply,step_due,draft_ready,stale] [--stale-days <n>]
88
+ [--owner <me|email|id> | --mine] [--since <iso time>] [--sort last_activity_at]
89
+ every deal view <deal_id> [--plan] [--draft] [--auto-sends]
90
+ every deal create (--person-id <id> | --company-id <id> | --name <name> [--email <email>])
91
+ [--stage <s>] [--deal-name <name>] [--value <n>] [--owner <owner>] [--goal <text>]
92
+ # write: needs --yes
93
+ every deal update <deal_id> [--name <name>] [--value <n>] [--owner <owner>]
94
+ [--person-id <id> | --company-id <id>] [--add-member <id> ...] [--remove-member <id> ...]
95
+ # write: needs --yes; a flag you leave out does not change
96
+ every deal move <deal_id> <stage> # write: needs --yes; stage = key or label
97
+ every deal outreach edit <deal_id> [--subject <text>] [--body <text> | --body-file <path>]
98
+ [--recipient <email>] [--thread <id|new>] # write: needs --yes
99
+ every deal outreach send <deal_id> [--draft-version <v>]
100
+ # destructive: needs --yes --allow-destructive;
101
+ # the owner then approves the send in Every
102
+ every deal outreach cancel <deal_id> --send-id <id> # write: needs --yes
103
+ every approvals [--all] # requests that wait in Every: Settings > Approvals
76
104
 
77
105
  # Teach your coding agent to use all of this well
78
106
  every skills install claude # → .claude/skills/use-every/
@@ -85,15 +113,28 @@ Deprecated aliases still work and print a one-line note to stderr: `every contac
85
113
 
86
114
  `every signup` creates an Every account, or signs an existing user in, through a single browser authorization. It never opens a separate sign-up page and never waits for Enter, so a coding agent can run it on the user's behalf without a TTY:
87
115
 
88
- 1. It prints the authorization URL first, tries to open the browser, then waits on a local loopback callback for up to `--timeout` seconds (default 300). With `--json`, stdout is NDJSON: `{"event":"authorization_required","url":"..."}`, then `{"event":"waiting_for_authorization","browser_opened":true|false,"timeout_seconds":300}`, then the usual envelope as the last line. If `browser_opened` is false, open the printed URL yourself.
89
- 2. After the browser step it reports the server's signup status: `signup_status` is `ready` for an account that is good to go, or `needs_profile` with the one required field (`organization_name`) and unverified `profile_suggestions` to confirm with the user.
116
+ 1. It prints the authorization URL first, tries to open the browser, then waits on a local loopback callback for up to `--timeout` seconds (default 300). With `--json`, stdout is NDJSON: `{"event":"authorization_required","url":"...","timeout_seconds":300,"guidance":"..."}`, then `{"event":"waiting_for_authorization","browser_opened":true|false,"timeout_seconds":300}`, then the usual envelope as the last line. If `browser_opened` is false, open the printed URL yourself. The command waits for the browser step, so an agent must run it in the background or allow a tool timeout of at least 5 minutes; the first event says so in `guidance`.
117
+ 2. After the browser step it reports the server's signup status: `signup_status` is `ready` for an account that is good to go, or `needs_profile` with the one required field (`organization_name`) and unverified `profile_suggestions` to confirm with the user. For an account that is not ready, the output also states the next step in plain words (`data.next_step` with `--json`): ask the person for the organization name, then run `every signup complete`.
90
118
  3. `every signup complete --org-name "<name>" [--description "<text>"] [--link <https url> ...] --yes` saves the confirmed profile and returns `account_ready: true`. Background setup (Business DNA and friends) is reported separately and never blocks the account. It is an ordinary write: `--yes` when non-interactive, never `--allow-destructive`.
91
119
 
92
120
  `every signup status` re-reads the state at any time. Signup commands always fetch a fresh tool list. A server without agent signup yields exit `6` with `error.code: "signup_unsupported"` ("this server does not support agent signup yet"). Denials and timeouts exit `3`; rerun `every signup`. While signup is unfinished, other tools are refused with `error.code: "signup_incomplete"`, and the CLI says which commands finish it. `EVERY_TOKEN` is never a signup path.
93
121
 
94
122
  The CLI sends the RFC 8707 `resource` parameter (the MCP server's canonical URL from its protected-resource metadata) on the authorization request, the code exchange and every refresh.
95
123
 
96
- After a successful `every signup` or `every login`, the CLI updates any copy of the `use-every` skill it installed earlier whose revision stamp is older than the bundled one. It never installs a copy where none exists and skips symlinked installs.
124
+ ### The skill after signup
125
+
126
+ When an agent runs `every signup` (with `--json`, or without a TTY), nobody can answer an install prompt. The command therefore installs the bundled `use-every` skill itself, at user level, for each coding agent it detects that has no copy:
127
+
128
+ | Agent | Detected by | Installed to |
129
+ |-|-|-|
130
+ | Claude Code | `~/.claude` | `~/.claude/skills/use-every/` |
131
+ | Codex | `~/.codex` or `~/.agents` | `~/.agents/skills/use-every/` |
132
+
133
+ This applies to new and existing accounts. A project or user copy that already exists is left as it is. The result is in `data.skill` on the last line: `installed`, `already_present` and `failed` (each a list of `{host, path}`), and `skipped_reason` (`opt_out`, `declined`, `no_agent_host`, `error` or `null`). An install failure prints a warning and never fails the signup. Pass `--no-skill` to skip the install. If you declined the interactive offer earlier, the command does not install either.
134
+
135
+ At an interactive terminal, `every signup` and `every login` keep the prompt that offers a project-level install.
136
+
137
+ After a successful `every signup` or `every login`, the CLI also updates any copy of the `use-every` skill it installed earlier whose revision stamp is older than the bundled one. The update skips symlinked installs.
97
138
 
98
139
  `every login` remains the interactive login for existing users; `every login --create-account` still works as a deprecated alias for `every signup`.
99
140
 
@@ -118,6 +159,10 @@ Server-side human approvals never trigger an automatic destructive retry. If Eve
118
159
 
119
160
  In `--json` mode, a server approval response uses exit `4` and includes a structured `error.mcp_gate` object. After local `--yes` or interactive consent, `type: "text_confirmation"` is retried once automatically; `type: "human_approval"` is returned to the caller without retrying.
120
161
 
162
+ ## Scheduled agent runs
163
+
164
+ The bundled `use-every` skill has an **Agent automation** part: the routine for an agent that runs the owner's deals and prospects on a schedule (start-of-run priorities and pending approvals, the attention sweep, follow-ups through `deal_outreach`, plan steps, stage moves, prune and restore, prospect triage). The server returns the same text from `get_started` with `topic=automation`. A send waits for the owner in Every → Settings → Approvals for up to 24 hours; the next run repeats the identical command.
165
+
121
166
  ## Headless / CI
122
167
 
123
168
  Set `EVERY_TOKEN` to a valid access token to skip the browser flow entirely. `login` requires a TTY by design and fails fast (exit `3`) without one; `signup` does not need one.
@@ -1,11 +1,12 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { CliError } from '../lib/errors.js';
3
3
  import { ExitCode } from '../lib/exit-codes.js';
4
+ import { emit } from '../lib/output.js';
4
5
  import { documentKind, preservedExclusions, record, recipientBinding, recipientLines } from '../lib/recipients.js';
5
- import { executeToolCall, invokeToolCall, } from './tools.js';
6
+ import { renderTable, shortTime } from '../lib/table.js';
7
+ import { executeToolCall, invokeToolCall, toolCallHuman, } from './tools.js';
6
8
  const INVOICE_STATUSES = new Set(['draft', 'issued', 'void']);
7
9
  const PAYMENT_STATUSES = new Set(['unpaid', 'paid', 'overdue', 'partial']);
8
- const DEAL_STAGES = new Set(['lead', 'opportunity', 'won', 'lost']);
9
10
  // list_companies/list_people (the live People/Companies search tools) take a
10
11
  // free-text `query` param — the retired list_clients/list_contacts tools took `name`.
11
12
  const NETWORK_SEARCH_QUERY_PARAM = 'query';
@@ -31,12 +32,7 @@ function parseLimit(value) {
31
32
  }
32
33
  return limit;
33
34
  }
34
- function assertDealStage(stage) {
35
- if (!DEAL_STAGES.has(stage)) {
36
- throw new CliError(`stage must be one of: ${Array.from(DEAL_STAGES).join(', ')}`, ExitCode.USAGE, 'usage');
37
- }
38
- }
39
- function addLimit(args, value) {
35
+ export function addLimit(args, value) {
40
36
  const limit = parseLimit(value);
41
37
  if (limit !== undefined)
42
38
  args.limit = limit;
@@ -67,7 +63,7 @@ function parsePositiveNumber(value, flag) {
67
63
  }
68
64
  return parsed;
69
65
  }
70
- function nonEmpty(value) {
66
+ export function nonEmpty(value) {
71
67
  const trimmed = value?.trim();
72
68
  return trimmed ? trimmed : undefined;
73
69
  }
@@ -409,18 +405,226 @@ export async function invoiceCreateCommand(opts = {}) {
409
405
  }
410
406
  export async function dealListCommand(opts = {}) {
411
407
  const args = {};
412
- if (opts.stage !== undefined) {
413
- assertDealStage(opts.stage);
408
+ // Stages are per-workspace (a key or a label, e.g. "lead" or "Discovery
409
+ // booked"); the server resolves them and answers stage_not_found with the
410
+ // workspace's live list, so there is no client-side stage check.
411
+ if (opts.stage !== undefined)
414
412
  args.stage = opts.stage;
415
- }
416
413
  if (opts.search !== undefined)
417
414
  args.search = opts.search;
418
415
  addLimit(args, opts.limit);
419
- await executeToolCall('list_deals', opts, async () => args);
416
+ // The attention-sweep filters (list_deals, 2026-11). A call without them
417
+ // sends the same arguments and prints the same output as before.
418
+ const sweep = dealSweepArgs(opts);
419
+ Object.assign(args, sweep);
420
+ const human = Object.keys(sweep).length > 0 ? dealTableHuman : undefined;
421
+ await withStageErrors(opts.stage, () => executeToolCall('list_deals', opts, async () => args, undefined, undefined, human));
422
+ }
423
+ export const ATTENTION_REASONS = ['needs_reply', 'step_due', 'draft_ready', 'stale'];
424
+ const DEAL_SORTS = new Set(['last_activity_at']);
425
+ function parseAttention(values) {
426
+ if (values === undefined)
427
+ return undefined;
428
+ const reasons = Array.from(new Set(values
429
+ .flatMap((value) => value.split(','))
430
+ .map((value) => value.trim())
431
+ .filter(Boolean)));
432
+ const unknown = reasons.filter((reason) => !ATTENTION_REASONS.includes(reason));
433
+ if (reasons.length === 0 || unknown.length > 0) {
434
+ throw new CliError(`--attention must be one or more of: ${ATTENTION_REASONS.join(', ')}`, ExitCode.USAGE, 'usage');
435
+ }
436
+ return reasons;
437
+ }
438
+ function dealSweepArgs(opts) {
439
+ const args = {};
440
+ const attention = parseAttention(opts.attention);
441
+ if (attention)
442
+ args.attention = attention;
443
+ if (opts.staleDays !== undefined) {
444
+ const days = Number(opts.staleDays);
445
+ if (!Number.isInteger(days) || days < 1) {
446
+ throw new CliError('--stale-days must be a whole number of days, 1 or more', ExitCode.USAGE, 'usage');
447
+ }
448
+ args.inactive_days = days;
449
+ }
450
+ const owner = nonEmpty(opts.owner);
451
+ if (opts.owner !== undefined && !owner) {
452
+ throw new CliError('--owner must be me, an email, or a user id', ExitCode.USAGE, 'usage');
453
+ }
454
+ if (opts.mine && owner && owner !== 'me') {
455
+ throw new CliError('Use --mine or --owner, not both', ExitCode.USAGE, 'usage');
456
+ }
457
+ if (opts.mine)
458
+ args.owner = 'me';
459
+ else if (owner)
460
+ args.owner = owner;
461
+ if (opts.since !== undefined) {
462
+ const since = opts.since.trim();
463
+ if (!since || Number.isNaN(Date.parse(since))) {
464
+ throw new CliError('--since must be an ISO 8601 time, for example 2026-11-01T00:00:00Z', ExitCode.USAGE, 'usage');
465
+ }
466
+ args.updated_since = since;
467
+ }
468
+ if (opts.sort !== undefined) {
469
+ if (!DEAL_SORTS.has(opts.sort)) {
470
+ throw new CliError(`--sort must be: ${Array.from(DEAL_SORTS).join(', ')}`, ExitCode.USAGE, 'usage');
471
+ }
472
+ args.sort = opts.sort;
473
+ }
474
+ return args;
475
+ }
476
+ function dealName(deal) {
477
+ return stringField(deal, ['display_name', 'name', 'label', 'contact', 'company']) ?? '';
478
+ }
479
+ function nextStepText(value) {
480
+ const step = record(value);
481
+ const title = typeof step.title === 'string' ? step.title : '';
482
+ if (!title)
483
+ return '';
484
+ return typeof step.do_by === 'string' && step.do_by ? `${title} (${step.do_by})` : title;
485
+ }
486
+ /** The deal table for the attention-sweep filters. It shows only what the server returned. */
487
+ export function dealTableHuman(data) {
488
+ const structured = record(data.structured_content);
489
+ if (!Array.isArray(structured.deals))
490
+ return toolCallHuman(data);
491
+ const deals = structured.deals.map(record);
492
+ if (deals.length === 0)
493
+ return 'No deals match these filters.';
494
+ const columns = [
495
+ { header: 'id', max: 36 },
496
+ { header: 'deal', max: 32 },
497
+ { header: 'stage', max: 20 },
498
+ ];
499
+ const cells = [
500
+ (deal) => String(deal.id ?? ''),
501
+ dealName,
502
+ (deal) => stringField(deal, ['stage_label', 'stage']) ?? '',
503
+ ];
504
+ if (deals.some((deal) => typeof deal.last_activity_at === 'string')) {
505
+ columns.push({ header: 'last activity', max: 16 });
506
+ cells.push((deal) => shortTime(deal.last_activity_at));
507
+ }
508
+ if (deals.some((deal) => nextStepText(deal.next_step))) {
509
+ columns.push({ header: 'next step', max: 48 });
510
+ cells.push((deal) => nextStepText(deal.next_step));
511
+ }
512
+ if (deals.some((deal) => Array.isArray(deal.attention) && deal.attention.length > 0)) {
513
+ columns.push({ header: 'attention' });
514
+ cells.push((deal) => (Array.isArray(deal.attention) ? deal.attention.join(', ') : ''));
515
+ }
516
+ const lines = [renderTable(columns, deals.map((deal) => cells.map((render) => render(deal))))];
517
+ const page = record(structured.pagination);
518
+ if (page.has_more === true) {
519
+ const total = typeof page.total_matched === 'number' ? ` of ${page.total_matched}` : '';
520
+ lines.push('', `Showing ${deals.length}${total} deals. Raise --limit to see more.`);
521
+ }
522
+ return lines.join('\n');
420
523
  }
421
524
  export async function dealMoveCommand(dealId, stage, opts = {}) {
422
- assertDealStage(stage);
423
- await executeToolCall('move_deal_stage', opts, async () => ({ deal_id: dealId, stage }));
525
+ await withStageErrors(stage, () => executeToolCall('move_deal_stage', opts, async () => ({ deal_id: dealId, stage })));
526
+ }
527
+ function stageName(stage) {
528
+ for (const field of ['label', 'key']) {
529
+ const value = stage[field];
530
+ if (typeof value === 'string' && value.trim())
531
+ return value.trim();
532
+ }
533
+ return undefined;
534
+ }
535
+ /** `Unknown stage "<input>". Available stages: Lead, Discovery booked, ...` */
536
+ export function unknownStageMessage(input, available) {
537
+ const names = Array.isArray(available)
538
+ ? available
539
+ .map((entry) => entry && typeof entry === 'object' ? stageName(entry) : undefined)
540
+ .filter((name) => name !== undefined)
541
+ : [];
542
+ const list = names.length ? names.join(', ') : 'run `every deal stages` to list them';
543
+ return `Unknown stage "${input}". Available stages: ${list}`;
544
+ }
545
+ // The server's stage_not_found refusal carries the workspace's live stage list
546
+ // (structuredContent.error.available_stages). Re-render it as one readable
547
+ // sentence; the error code, exit status and tool_error details are unchanged.
548
+ async function withStageErrors(input, run) {
549
+ try {
550
+ await run();
551
+ }
552
+ catch (err) {
553
+ if (err instanceof CliError && err.code === 'stage_not_found') {
554
+ const toolError = (err.details?.tool_error ?? {});
555
+ const stage = typeof toolError.stage === 'string' ? toolError.stage : input ?? '';
556
+ throw new CliError(unknownStageMessage(stage, toolError.available_stages), err.exitCode, err.code, err.details);
557
+ }
558
+ throw err;
559
+ }
560
+ }
561
+ function oneLine(value, max = 80) {
562
+ const text = typeof value === 'string' ? value.replace(/\s+/g, ' ').trim() : '';
563
+ return text.length > max ? `${text.slice(0, max - 3)}...` : text;
564
+ }
565
+ /** The ordered stage list from get_pipeline_settings' structured result. */
566
+ export function parsePipelineStages(structured) {
567
+ if (!structured || typeof structured !== 'object')
568
+ return [];
569
+ const record = structured;
570
+ const body = (record.result && typeof record.result === 'object' ? record.result : record);
571
+ let entries = body.stages;
572
+ // A server that predates customizable stages returns a map keyed by the
573
+ // four default stage names instead of the ordered list.
574
+ if (entries && typeof entries === 'object' && !Array.isArray(entries)) {
575
+ entries = Object.entries(entries).map(([key, value]) => ({
576
+ ...(value && typeof value === 'object' ? value : {}),
577
+ key,
578
+ label: key.charAt(0).toUpperCase() + key.slice(1),
579
+ role: LEGACY_STAGE_ROLES[key] ?? 'middle',
580
+ }));
581
+ }
582
+ if (!Array.isArray(entries))
583
+ return [];
584
+ return entries
585
+ .filter((entry) => Boolean(entry) && typeof entry === 'object')
586
+ .map((entry) => ({
587
+ key: String(entry.key ?? entry.name ?? ''),
588
+ label: String(entry.label ?? entry.display_name ?? entry.key ?? ''),
589
+ role: String(entry.role ?? ''),
590
+ criteria: typeof entry.criteria === 'string' ? entry.criteria : '',
591
+ ...(typeof entry.agent_can_move_to_stage === 'boolean'
592
+ ? { agent_can_move_to_stage: entry.agent_can_move_to_stage }
593
+ : {}),
594
+ }))
595
+ .filter((stage) => stage.key);
596
+ }
597
+ const LEGACY_STAGE_ROLES = {
598
+ lead: 'lead',
599
+ opportunity: 'middle',
600
+ won: 'won',
601
+ lost: 'lost',
602
+ };
603
+ export function stagesHuman(stages) {
604
+ if (!stages.length) {
605
+ return 'No pipeline stages returned. Run: every tool call get_pipeline_settings --json';
606
+ }
607
+ // Labels can be up to 40 characters (the server limit), so the column fits them all.
608
+ const labelWidth = Math.min(40, Math.max('label'.length, ...stages.map((s) => s.label.length)));
609
+ const keyWidth = Math.min(20, Math.max('key'.length, ...stages.map((s) => s.key.length)));
610
+ const roleWidth = Math.max('role'.length, ...stages.map((s) => s.role.length));
611
+ const lines = [
612
+ `${'label'.padEnd(labelWidth)} ${'key'.padEnd(keyWidth)} ${'role'.padEnd(roleWidth)} criteria`,
613
+ `${'-'.repeat(labelWidth)} ${'-'.repeat(keyWidth)} ${'-'.repeat(roleWidth)} ${'-'.repeat(8)}`,
614
+ ];
615
+ for (const stage of stages) {
616
+ lines.push(`${stage.label.padEnd(labelWidth)} ${stage.key.padEnd(keyWidth)} ${stage.role.padEnd(roleWidth)} ${oneLine(stage.criteria)}`);
617
+ }
618
+ lines.push('', 'Pass a key or a label to: every deal move <deal_id> <stage> | every deal list --stage <stage>');
619
+ return lines.join('\n');
620
+ }
621
+ export async function dealStagesCommand(opts = {}) {
622
+ const data = await invokeToolCall('get_pipeline_settings', opts);
623
+ const stages = parsePipelineStages(data.structured_content);
624
+ if (opts.json)
625
+ emit({ ...data, stages }, { json: true, staging: opts.staging });
626
+ else
627
+ process.stdout.write(`${stagesHuman(stages)}\n`);
424
628
  }
425
629
  export async function personListCommand(opts = {}) {
426
630
  const args = {};
@@ -61,16 +61,22 @@ function targetsForAnswer(answer) {
61
61
  function targetLabel(target) {
62
62
  return target === 'claude' ? 'Claude Code' : 'Codex';
63
63
  }
64
- /** Best-effort interactive offer shown only after a browser login succeeds. */
65
- export async function maybeOfferSkillAfterLogin(opts = {}) {
64
+ /** True when a person at a terminal can answer the skill offer. */
65
+ export function skillOfferIsInteractive(opts = {}) {
66
66
  const input = opts.input ?? process.stdin;
67
67
  const output = opts.output ?? process.stdout;
68
- const errorOutput = opts.errorOutput ?? process.stderr;
69
68
  const promptsToProcessStderr = opts.errorOutput === undefined || opts.errorOutput === process.stderr;
70
- if (opts.json ||
69
+ return !(opts.json ||
71
70
  input.isTTY !== true ||
72
71
  output.isTTY !== true ||
73
- (promptsToProcessStderr && process.stderr.isTTY !== true))
72
+ (promptsToProcessStderr && process.stderr.isTTY !== true));
73
+ }
74
+ /** Best-effort interactive offer shown only after a browser login succeeds. */
75
+ export async function maybeOfferSkillAfterLogin(opts = {}) {
76
+ const input = opts.input ?? process.stdin;
77
+ const output = opts.output ?? process.stdout;
78
+ const errorOutput = opts.errorOutput ?? process.stderr;
79
+ if (!skillOfferIsInteractive(opts))
74
80
  return;
75
81
  try {
76
82
  const fileSystem = opts.fileSystem ?? defaultSkillOfferFileSystem;