@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/dist/index.js CHANGED
@@ -7,7 +7,8 @@ import { authStatusCommand, loginCommand, logoutCommand, orgCommand, orgSwitchCo
7
7
  import { policyExplainCommand } from './commands/policy.js';
8
8
  import { signupCommand, signupCompleteCommand, signupStatusCommand, } from './commands/signup.js';
9
9
  import { toolCallCommand, toolsDescribeCommand, toolsListCommand, } from './commands/tools.js';
10
- import { dealListCommand, dealMoveCommand, invoiceCreateCommand, invoiceListCommand, invoiceSendCommand, personListCommand, proposalSendCommand, recipientsGetCommand, recipientsSetCommand, } from './commands/aliases.js';
10
+ import { approvalsCommand, companyCreateCommand, companyListCommand, companyViewCommand, dealCreateCommand, dealUpdateCommand, dealViewCommand, outreachCancelCommand, outreachEditCommand, outreachSendCommand, personCreateCommand, personViewCommand, } from './commands/crm.js';
11
+ import { dealListCommand, dealMoveCommand, dealStagesCommand, invoiceCreateCommand, invoiceListCommand, invoiceSendCommand, personListCommand, proposalSendCommand, recipientsGetCommand, recipientsSetCommand, } from './commands/aliases.js';
11
12
  import { skillsInstallCommand, skillsListCommand } from './commands/skills.js';
12
13
  import { CliError } from './lib/errors.js';
13
14
  import { deprecationNote, emit, emitError } from './lib/output.js';
@@ -63,17 +64,29 @@ const signup = withGlobalOptions(program
63
64
  .allowExcessArguments(false)
64
65
  .description('Create an Every account or sign in via one browser step; no TTY needed')
65
66
  .option('--timeout <seconds>', 'how long to wait for the browser authorization', '300')
67
+ .option('--no-skill', 'do not install the use-every skill for detected coding agents')
66
68
  .addHelpText('after', [
67
69
  '',
68
70
  'With --json, stdout is NDJSON: an authorization_required event with the URL,',
69
71
  'a waiting_for_authorization event, then the result envelope as the last line.',
72
+ 'The command waits up to --timeout seconds (default 300) for the browser step:',
73
+ 'an agent must run it in the background or allow at least 5 minutes.',
74
+ '',
75
+ 'With --json or without a TTY, it also installs the use-every skill at user level',
76
+ 'for each detected coding agent (~/.claude, ~/.codex or ~/.agents) that has no copy,',
77
+ 'and reports the result in data.skill. Use --no-skill to skip that.',
70
78
  '',
71
79
  'Then finish signup:',
72
80
  ' every signup complete --org-name "Acme Studio" --yes --json',
73
81
  '',
74
82
  ].join('\n'))).action(async (_options, command) => {
75
83
  const opts = command.optsWithGlobals();
76
- await signupCommand({ json: opts.json, staging: opts.staging, timeout: opts.timeout });
84
+ await signupCommand({
85
+ json: opts.json,
86
+ staging: opts.staging,
87
+ timeout: opts.timeout,
88
+ skill: opts.skill,
89
+ });
77
90
  });
78
91
  withGlobalOptions(signup.command('status').description('Show signup status and the profile still needed')).action(async (_options, command) => {
79
92
  const opts = command.optsWithGlobals();
@@ -180,6 +193,19 @@ function withToolExecutionOptions(cmd) {
180
193
  .option('--read-only', 'deny write, destructive, and AI-mediated tool calls')
181
194
  .option('--timeout <secs>', 'tool call timeout in seconds');
182
195
  }
196
+ /** The tool execution options of a parsed command, for the short commands. */
197
+ function executionOptions(opts) {
198
+ return {
199
+ json: opts.json,
200
+ staging: opts.staging,
201
+ // Commander represents --no-cache as cache:false.
202
+ noCache: opts.cache === false,
203
+ yes: opts.yes,
204
+ allowDestructive: opts.allowDestructive,
205
+ readOnly: opts.readOnly,
206
+ timeout: opts.timeout,
207
+ };
208
+ }
183
209
  const TOOL_CALL_HELP = [
184
210
  '',
185
211
  'Fastest full-tool argument forms:',
@@ -331,9 +357,15 @@ const dealCommand = withToolExecutionOptions(withGlobalOptions(program
331
357
  withGlobalOptions(withToolExecutionOptions(dealCommand
332
358
  .command('list')
333
359
  .description('List deals')
334
- .option('--stage <s>', 'deal stage filter')
360
+ .option('--stage <s>', 'deal stage filter: a key or label from `every deal stages`')
335
361
  .option('--search <q>', 'deal search query')
336
- .option('--limit <n>', 'maximum number of deals to return'))).action(async (_options, command) => {
362
+ .option('--limit <n>', 'maximum number of deals to return')
363
+ .option('--attention <reason>', 'only deals that need work: needs_reply, step_due, draft_ready, stale; repeat or use a comma list', collectOption)
364
+ .option('--stale-days <n>', 'only deals with no activity for at least this many days')
365
+ .option('--owner <owner>', 'only deals owned by: me, a teammate\'s email, or a user id')
366
+ .option('--mine', 'only your deals (same as --owner me)')
367
+ .option('--since <time>', 'only deals changed at or after this ISO 8601 time')
368
+ .option('--sort <field>', 'sort order: last_activity_at'))).action(async (_options, command) => {
337
369
  const opts = command.optsWithGlobals();
338
370
  await dealListCommand({
339
371
  json: opts.json,
@@ -346,13 +378,116 @@ withGlobalOptions(withToolExecutionOptions(dealCommand
346
378
  stage: opts.stage,
347
379
  search: opts.search,
348
380
  limit: opts.limit,
381
+ attention: opts.attention,
382
+ staleDays: opts.staleDays,
383
+ owner: opts.owner,
384
+ mine: opts.mine,
385
+ since: opts.since,
386
+ sort: opts.sort,
387
+ });
388
+ });
389
+ withGlobalOptions(withToolExecutionOptions(dealCommand
390
+ .command('view')
391
+ .description('Show one deal')
392
+ .argument('<deal_id>', 'deal id')
393
+ .option('--plan', 'add every open plan step')
394
+ .option('--draft', 'add the unsent draft and its draft version')
395
+ .option('--auto-sends', 'add scheduled and recent sends'))).action(async (dealId, _options, command) => {
396
+ const opts = command.optsWithGlobals();
397
+ await dealViewCommand(dealId, { ...executionOptions(opts), plan: opts.plan, draft: opts.draft, autoSends: opts.autoSends });
398
+ });
399
+ withGlobalOptions(withToolExecutionOptions(dealCommand
400
+ .command('create')
401
+ .description('Create a deal with an existing Person or Company, or with a new Person')
402
+ .option('--person-id <id>', 'existing Person id')
403
+ .option('--company-id <id>', 'existing Company id')
404
+ .option('--name <name>', 'name of a new Person (when no id is given)')
405
+ .option('--email <email>', 'email of a new Person')
406
+ .option('--stage <s>', 'stage key or label (default: Lead)')
407
+ .option('--deal-name <name>', 'what the deal is called, for example "Q3 brand refresh"')
408
+ .option('--value <amount>', 'expected value in the workspace currency')
409
+ .option('--owner <owner>', 'deal owner: me, a teammate\'s email, or a user id')
410
+ .option('--goal <text>', 'what the deal sells, in one or two sentences'))).action(async (_options, command) => {
411
+ const opts = command.optsWithGlobals();
412
+ await dealCreateCommand({
413
+ ...executionOptions(opts),
414
+ personId: opts.personId,
415
+ companyId: opts.companyId,
416
+ name: opts.name,
417
+ email: opts.email,
418
+ stage: opts.stage,
419
+ dealName: opts.dealName,
420
+ value: opts.value,
421
+ owner: opts.owner,
422
+ goal: opts.goal,
423
+ });
424
+ });
425
+ withGlobalOptions(withToolExecutionOptions(dealCommand
426
+ .command('update')
427
+ .description('Change deal fields; a flag you leave out does not change')
428
+ .argument('<deal_id>', 'deal id')
429
+ .option('--name <name>', 'what the deal is called; "" resets the default name')
430
+ .option('--value <amount>', 'expected value; 0 clears it')
431
+ .option('--owner <owner>', 'new owner: me, a teammate\'s email, or a user id')
432
+ .option('--person-id <id>', 'set the deal\'s Person')
433
+ .option('--company-id <id>', 'set the deal\'s Company')
434
+ .option('--add-member <id>', 'add a teammate (user id or email); repeatable', collectOption)
435
+ .option('--remove-member <id>', 'remove a teammate (user id or email); waits for approval in Every; repeatable', collectOption))).action(async (dealId, _options, command) => {
436
+ const opts = command.optsWithGlobals();
437
+ await dealUpdateCommand(dealId, {
438
+ ...executionOptions(opts),
439
+ name: opts.name,
440
+ value: opts.value,
441
+ owner: opts.owner,
442
+ personId: opts.personId,
443
+ companyId: opts.companyId,
444
+ addMember: opts.addMember,
445
+ removeMember: opts.removeMember,
446
+ });
447
+ });
448
+ const outreachCommand = withToolExecutionOptions(withGlobalOptions(dealCommand.command('outreach').description("Edit, send, or cancel a deal's message")));
449
+ withGlobalOptions(withToolExecutionOptions(outreachCommand
450
+ .command('edit')
451
+ .description("Edit the deal's unsent draft (write: needs --yes)")
452
+ .argument('<deal_id>', 'deal id')
453
+ .option('--subject <text>', 'new email subject')
454
+ .option('--body <text>', 'new message text')
455
+ .option('--body-file <path>', 'read the new message text from a file; - for stdin')
456
+ .option('--recipient <email>', 'new email recipient: an email of a Person on the deal')
457
+ .option('--thread <id>', 'Gmail thread of the deal to reply in, or "new"')
458
+ .option('--draft-version <v>', 'refuse the edit if the draft changed since this version'))).action(async (dealId, _options, command) => {
459
+ const opts = command.optsWithGlobals();
460
+ await outreachEditCommand(dealId, {
461
+ ...executionOptions(opts),
462
+ subject: opts.subject,
463
+ body: opts.body,
464
+ bodyFile: opts.bodyFile,
465
+ recipient: opts.recipient,
466
+ thread: opts.thread,
467
+ draftVersion: opts.draftVersion,
349
468
  });
350
469
  });
470
+ withGlobalOptions(withToolExecutionOptions(outreachCommand
471
+ .command('send')
472
+ .description("Preview, confirm, and send the deal's draft; the owner approves it in Every (destructive)")
473
+ .argument('<deal_id>', 'deal id')
474
+ .option('--draft-version <v>', 'send this exact draft version without reading the draft first'))).action(async (dealId, _options, command) => {
475
+ const opts = command.optsWithGlobals();
476
+ await outreachSendCommand(dealId, { ...executionOptions(opts), draftVersion: opts.draftVersion });
477
+ });
478
+ withGlobalOptions(withToolExecutionOptions(outreachCommand
479
+ .command('cancel')
480
+ .description('Stop a scheduled or held send (write: needs --yes)')
481
+ .argument('<deal_id>', 'deal id')
482
+ .requiredOption('--send-id <id>', 'send id from every deal view <deal_id> --auto-sends'))).action(async (dealId, _options, command) => {
483
+ const opts = command.optsWithGlobals();
484
+ await outreachCancelCommand(dealId, { ...executionOptions(opts), sendId: opts.sendId });
485
+ });
351
486
  withGlobalOptions(withToolExecutionOptions(dealCommand
352
487
  .command('move')
353
488
  .description('Move a deal to another stage')
354
489
  .argument('<deal_id>', 'deal id')
355
- .argument('<stage>', 'target stage'))).action(async (dealId, stage, _options, command) => {
490
+ .argument('<stage>', 'target stage: a key or label from `every deal stages`'))).action(async (dealId, stage, _options, command) => {
356
491
  const opts = command.optsWithGlobals();
357
492
  await dealMoveCommand(dealId, stage, {
358
493
  json: opts.json,
@@ -364,6 +499,20 @@ withGlobalOptions(withToolExecutionOptions(dealCommand
364
499
  timeout: opts.timeout,
365
500
  });
366
501
  });
502
+ withGlobalOptions(withToolExecutionOptions(dealCommand
503
+ .command('stages')
504
+ .description("List this workspace's pipeline stages (label, key, role, criteria)"))).action(async (_options, command) => {
505
+ const opts = command.optsWithGlobals();
506
+ await dealStagesCommand({
507
+ json: opts.json,
508
+ staging: opts.staging,
509
+ noCache: opts.noCache,
510
+ yes: opts.yes,
511
+ allowDestructive: opts.allowDestructive,
512
+ readOnly: opts.readOnly,
513
+ timeout: opts.timeout,
514
+ });
515
+ });
367
516
  /**
368
517
  * Register `list` under `every person` and under the hidden, deprecated
369
518
  * `every contact` alias ("contact" is retired vocabulary: the product's people
@@ -391,10 +540,94 @@ function addPersonListCommand(parent, deprecation) {
391
540
  });
392
541
  });
393
542
  }
394
- addPersonListCommand(withToolExecutionOptions(withGlobalOptions(program
543
+ const personCommand = withToolExecutionOptions(withGlobalOptions(program
395
544
  .command('person')
396
545
  .description('Work with People')
397
- .addHelpText('after', TOOL_CALL_HELP))));
546
+ .addHelpText('after', TOOL_CALL_HELP)));
547
+ addPersonListCommand(personCommand);
548
+ withGlobalOptions(withToolExecutionOptions(personCommand
549
+ .command('view')
550
+ .description('Show one Person')
551
+ .argument('<person_id>', 'Person id'))).action(async (personId, _options, command) => {
552
+ await personViewCommand(personId, executionOptions(command.optsWithGlobals()));
553
+ });
554
+ withGlobalOptions(withToolExecutionOptions(personCommand
555
+ .command('create')
556
+ .description('Create a Person (write: needs --yes); search with every person list first')
557
+ .requiredOption('--name <name>', 'full name')
558
+ .option('--email <email>', 'primary email')
559
+ .option('--phone <phone>', 'primary phone')
560
+ .option('--job-title <title>', 'job title')
561
+ .option('--company <name>', 'employer name as text')
562
+ .option('--location <text>', 'location')
563
+ .option('--headline <text>', 'short headline')
564
+ .option('--industry <text>', 'industry')
565
+ .option('--address <text>', 'postal address')
566
+ .option('--notes <text>', 'notes'))).action(async (_options, command) => {
567
+ const opts = command.optsWithGlobals();
568
+ await personCreateCommand({
569
+ ...executionOptions(opts),
570
+ name: opts.name,
571
+ email: opts.email,
572
+ phone: opts.phone,
573
+ jobTitle: opts.jobTitle,
574
+ company: opts.company,
575
+ location: opts.location,
576
+ headline: opts.headline,
577
+ industry: opts.industry,
578
+ address: opts.address,
579
+ notes: opts.notes,
580
+ });
581
+ });
582
+ const companyCommand = withToolExecutionOptions(withGlobalOptions(program
583
+ .command('company')
584
+ .description('Work with Companies')
585
+ .addHelpText('after', TOOL_CALL_HELP)));
586
+ withGlobalOptions(withToolExecutionOptions(companyCommand
587
+ .command('list')
588
+ .description('List Companies')
589
+ .option('--search <q>', 'search Companies by name, email, phone, or industry')
590
+ .option('--limit <n>', 'maximum number of Companies to return (up to 100)'))).action(async (_options, command) => {
591
+ const opts = command.optsWithGlobals();
592
+ await companyListCommand({ ...executionOptions(opts), search: opts.search, limit: opts.limit });
593
+ });
594
+ withGlobalOptions(withToolExecutionOptions(companyCommand
595
+ .command('view')
596
+ .description('Show one Company')
597
+ .argument('<company_id>', 'Company id'))).action(async (companyId, _options, command) => {
598
+ await companyViewCommand(companyId, executionOptions(command.optsWithGlobals()));
599
+ });
600
+ withGlobalOptions(withToolExecutionOptions(companyCommand
601
+ .command('create')
602
+ .description('Create a Company (write: needs --yes); search with every company list first')
603
+ .requiredOption('--name <name>', 'Company name')
604
+ .option('--email <email>', 'primary email')
605
+ .option('--phone <phone>', 'primary phone')
606
+ .option('--website <url>', 'website')
607
+ .option('--industry <text>', 'industry')
608
+ .option('--address <text>', 'postal address')
609
+ .option('--lead-source <text>', 'where the Company came from')
610
+ .option('--notes <text>', 'notes'))).action(async (_options, command) => {
611
+ const opts = command.optsWithGlobals();
612
+ await companyCreateCommand({
613
+ ...executionOptions(opts),
614
+ name: opts.name,
615
+ email: opts.email,
616
+ phone: opts.phone,
617
+ website: opts.website,
618
+ industry: opts.industry,
619
+ address: opts.address,
620
+ leadSource: opts.leadSource,
621
+ notes: opts.notes,
622
+ });
623
+ });
624
+ withGlobalOptions(withToolExecutionOptions(program
625
+ .command('approvals')
626
+ .description('List requests that wait for approval in Every (read only)')
627
+ .option('--all', 'show every request of the last 24 hours, from every connection'))).action(async (_options, command) => {
628
+ const opts = command.optsWithGlobals();
629
+ await approvalsCommand({ ...executionOptions(opts), all: opts.all });
630
+ });
398
631
  addPersonListCommand(withToolExecutionOptions(withGlobalOptions(program
399
632
  .command('contact', { hidden: true })
400
633
  .description('Deprecated alias for every person'))), '`every contact` is deprecated; use `every person`.');
@@ -248,7 +248,7 @@ export async function getToken(opts = {}) {
248
248
  const store = opts.store ?? (await createTokenStore());
249
249
  const tokenSet = await store.get(environmentKey);
250
250
  if (!tokenSet) {
251
- throw new CliError('Not logged in. Run \'every login\'.', ExitCode.AUTH, 'auth');
251
+ throw new CliError('Not logged in. Run \'every signup\' (or \'every login\' at a terminal).', ExitCode.AUTH, 'auth');
252
252
  }
253
253
  const now = opts.now ?? Date.now;
254
254
  if (tokenSet.expires_at - 60 > nowSeconds(now))
@@ -256,7 +256,7 @@ export async function getToken(opts = {}) {
256
256
  if (tokenSet.refresh_token) {
257
257
  return refreshToken(baseUrl, environmentKey, store, tokenSet, now);
258
258
  }
259
- throw new CliError('Not logged in. Run \'every login\'.', ExitCode.AUTH, 'auth');
259
+ throw new CliError('Not logged in. Run \'every signup\' (or \'every login\' at a terminal).', ExitCode.AUTH, 'auth');
260
260
  }
261
261
  export function toStoredTokenSet(params) {
262
262
  assertAccessToken(params.response);
@@ -131,7 +131,7 @@ export async function requestUserInfo({ baseUrl, accessToken }) {
131
131
  }
132
132
  catch (err) {
133
133
  if (err instanceof HttpStatusError && err.status === 401) {
134
- throw new CliError('Not logged in. Run \'every login\'.', ExitCode.AUTH, 'auth');
134
+ throw new CliError('Not logged in. Run \'every signup\' (or \'every login\' at a terminal).', ExitCode.AUTH, 'auth');
135
135
  }
136
136
  if (err instanceof HttpStatusError) {
137
137
  throw new CliError(`User info request failed for ${err.url}: HTTP ${err.status}`, ExitCode.NETWORK, 'network');
@@ -18,6 +18,9 @@ export const STAGING_BASE_URL = 'https://admin-mcp-staging.up.railway.app';
18
18
  /** Where an org admin mints, inspects and revokes org API keys. */
19
19
  export const PROD_API_KEYS_URL = 'https://app.every.ai/settings/api-keys';
20
20
  export const STAGING_API_KEYS_URL = 'https://app.staging.every.ai/settings/api-keys';
21
+ /** Where a person approves or cancels the requests that wait for approval. */
22
+ export const PROD_APPROVALS_URL = 'https://app.every.ai/settings/approvals';
23
+ export const STAGING_APPROVALS_URL = 'https://app.staging.every.ai/settings/approvals';
21
24
  /**
22
25
  * Resolve the MCP base URL to target.
23
26
  *
@@ -57,3 +60,9 @@ export function apiKeysUrlForBaseUrl(baseUrl) {
57
60
  ? STAGING_API_KEYS_URL
58
61
  : PROD_API_KEYS_URL;
59
62
  }
63
+ /** The web-app page where a person approves the requests that a given MCP base URL holds. */
64
+ export function approvalsUrlForBaseUrl(baseUrl) {
65
+ return environmentNameForBaseUrl(baseUrl) === 'staging'
66
+ ? STAGING_APPROVALS_URL
67
+ : PROD_APPROVALS_URL;
68
+ }
package/dist/lib/mcp.js CHANGED
@@ -112,7 +112,7 @@ function parseJsonRpcResponse(raw, params) {
112
112
  */
113
113
  async function unauthorizedError(response, baseUrl, token) {
114
114
  if (!isApiKeyToken(token)) {
115
- return new CliError('Not logged in. Run \'every login\'.', ExitCode.AUTH, 'auth');
115
+ return new CliError('Not logged in. Run \'every signup\' (or \'every login\' at a terminal).', ExitCode.AUTH, 'auth');
116
116
  }
117
117
  let reason;
118
118
  try {
@@ -123,6 +123,48 @@ async function unauthorizedError(response, baseUrl, token) {
123
123
  }
124
124
  return new CliError(apiKeyRejectedMessage(baseUrl, reason), ExitCode.AUTH, 'auth');
125
125
  }
126
+ /**
127
+ * Explain a non-401 refusal with the server's own words when it sent them.
128
+ *
129
+ * admin-mcp refuses some requests on purpose with an RFC 6750 style body,
130
+ * for example `{"error":"workspace_not_selected","error_description":"..."}`
131
+ * (403) or `{"error":"org_binding_unavailable",...}` (503). The description
132
+ * already tells the user what to do, so the CLI shows it. A body that is not
133
+ * that shape keeps the generic "HTTP <status>" message. The exit code and the
134
+ * machine `code` come from the status only, so scripts see no change.
135
+ */
136
+ async function httpStatusError(response, method, url) {
137
+ const classified = classifyHttpStatus(response.status);
138
+ let raw = '';
139
+ try {
140
+ raw = await response.text();
141
+ }
142
+ catch {
143
+ // A body that cannot be read falls back to the status message.
144
+ }
145
+ const reason = authErrorReasonFromBody(raw);
146
+ const serverError = serverErrorCode(raw);
147
+ const details = { http_status: response.status };
148
+ if (serverError !== undefined)
149
+ details.server_error = serverError;
150
+ const message = reason === undefined
151
+ ? `MCP ${method} failed for ${url}: HTTP ${response.status}`
152
+ : `${reason} (HTTP ${response.status})`;
153
+ return new CliError(message, classified.exitCode, classified.code, details);
154
+ }
155
+ function serverErrorCode(raw) {
156
+ try {
157
+ const body = JSON.parse(raw);
158
+ if (!body || typeof body !== 'object' || Array.isArray(body))
159
+ return undefined;
160
+ const value = body.error;
161
+ // A machine code only: short and without spaces, so it is safe in --json.
162
+ return typeof value === 'string' && /^[a-z0-9_.-]{1,64}$/i.test(value) ? value : undefined;
163
+ }
164
+ catch {
165
+ return undefined;
166
+ }
167
+ }
126
168
  export async function mcpCall(baseUrl, token, method, params = {}, { timeoutMs = DEFAULT_MCP_TIMEOUT_MS } = {}) {
127
169
  const url = mcpUrl(baseUrl);
128
170
  let response;
@@ -154,8 +196,7 @@ export async function mcpCall(baseUrl, token, method, params = {}, { timeoutMs =
154
196
  throw await unauthorizedError(response, baseUrl, token);
155
197
  }
156
198
  if (!response.ok) {
157
- const classified = classifyHttpStatus(response.status);
158
- throw new CliError(`MCP ${method} failed for ${url}: HTTP ${response.status}`, classified.exitCode, classified.code);
199
+ throw await httpStatusError(response, method, url);
159
200
  }
160
201
  return parseJsonRpcResponse(await response.text(), params);
161
202
  }
@@ -93,6 +93,25 @@ function overrideClassification(name) {
93
93
  reason: 'set_deal_name renames a deal, or clears the name back to the system default; pin write tier regardless of server annotation drift.',
94
94
  };
95
95
  }
96
+ // Agent CRM automation tools (2026-11). update_deal replaces set_deal_name and
97
+ // set_deal_value_estimate. deal_outreach edits, sends, schedules and cancels
98
+ // the deal's outbound message. Its name does not match send_ or cancel_, and
99
+ // one tool has one local tier, so the send action sets the tier for all
100
+ // actions.
101
+ if (name === 'update_deal') {
102
+ return {
103
+ level: 'write',
104
+ source: 'override',
105
+ reason: 'update_deal changes the name, value estimate, owner, party, members or goal of a deal; pin write tier regardless of server annotation drift.',
106
+ };
107
+ }
108
+ if (name === 'deal_outreach') {
109
+ return {
110
+ level: 'destructive',
111
+ source: 'override',
112
+ reason: 'deal_outreach can send or schedule a message to real recipients on email, LinkedIn or Instagram; sending has external impact, so every action needs destructive confirmation.',
113
+ };
114
+ }
96
115
  if (name === 'link_deal_item') {
97
116
  return {
98
117
  level: 'write',
@@ -127,6 +146,19 @@ function overrideClassification(name) {
127
146
  }
128
147
  return undefined;
129
148
  }
149
+ /**
150
+ * How the short commands gate a tool that has more than one action. The tool
151
+ * keeps one tier for `every tool call`, because that path cannot know the
152
+ * action before the call. A short command knows its action, so it gates by
153
+ * action.
154
+ */
155
+ export function shortCommandNote(name) {
156
+ if (name === 'deal_outreach') {
157
+ return 'The short commands gate by action: `every deal outreach edit` and `every deal outreach cancel` are writes (--yes). ' +
158
+ '`every deal outreach send` is destructive (--yes --allow-destructive). `every tool call deal_outreach` stays destructive for every action.';
159
+ }
160
+ return undefined;
161
+ }
130
162
  export function classify(tool) {
131
163
  const overridden = overrideClassification(tool.name);
132
164
  if (overridden)
@@ -0,0 +1,103 @@
1
+ import { access, cp, mkdir } from 'node:fs/promises';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
4
+ import { readHints } from './hints.js';
5
+ import { bundledSkillDir, SKILL_NAME, skillInstallPaths } from './skill-refresh.js';
6
+ const HOST_LABEL = { claude: 'Claude Code', codex: 'Codex' };
7
+ async function defaultPathExists(filePath) {
8
+ try {
9
+ await access(filePath);
10
+ return true;
11
+ }
12
+ catch {
13
+ return false;
14
+ }
15
+ }
16
+ async function defaultCopySkill(sourceDir, targetDir) {
17
+ await mkdir(path.dirname(targetDir), { recursive: true });
18
+ await cp(sourceDir, targetDir, { recursive: true, force: true });
19
+ }
20
+ /**
21
+ * Where an agent host keeps its user-level state (the detection markers) and
22
+ * where its user-level skill goes. The targets are members of
23
+ * `skillInstallPaths`, so the refresh after a later login keeps them current.
24
+ */
25
+ export function userSkillTargets(homeDir) {
26
+ return {
27
+ claude: {
28
+ markers: [path.join(homeDir, '.claude')],
29
+ target: path.join(homeDir, '.claude', 'skills', SKILL_NAME),
30
+ },
31
+ codex: {
32
+ markers: [path.join(homeDir, '.codex'), path.join(homeDir, '.agents')],
33
+ target: path.join(homeDir, '.agents', 'skills', SKILL_NAME),
34
+ },
35
+ };
36
+ }
37
+ function emptyResult(skipped_reason) {
38
+ return { name: SKILL_NAME, installed: [], already_present: [], failed: [], skipped_reason };
39
+ }
40
+ async function firstExisting(pathExists, paths) {
41
+ for (const candidate of paths) {
42
+ if (await pathExists(candidate))
43
+ return candidate;
44
+ }
45
+ return undefined;
46
+ }
47
+ /**
48
+ * Install the bundled skill at user level for each detected agent host that has
49
+ * no copy. A coding agent runs `every signup` without a TTY, so the interactive
50
+ * offer cannot reach the person; this is the equivalent step for that case.
51
+ *
52
+ * It never overwrites a copy, never throws, and never fails the caller.
53
+ */
54
+ export async function autoInstallSkill(opts = {}) {
55
+ if (opts.enabled === false)
56
+ return emptyResult('opt_out');
57
+ const errorOutput = opts.errorOutput;
58
+ try {
59
+ const hints = await (opts.readHints ?? readHints)();
60
+ if (hints.skill_offer_declined)
61
+ return emptyResult('declined');
62
+ const pathExists = opts.pathExists ?? defaultPathExists;
63
+ const copySkill = opts.copySkill ?? defaultCopySkill;
64
+ const homeDir = opts.homeDir ?? os.homedir();
65
+ const sourceDir = opts.sourceDir ?? bundledSkillDir();
66
+ // Only user-level copies count. A project copy in the current folder serves
67
+ // that project alone, so the agent still needs the user-level copy.
68
+ // (skillInstallPaths with cwd = homeDir yields exactly the user-level paths.)
69
+ const known = skillInstallPaths(homeDir, homeDir);
70
+ const targets = userSkillTargets(homeDir);
71
+ const result = emptyResult(null);
72
+ let detected = 0;
73
+ for (const host of ['claude', 'codex']) {
74
+ if (!(await firstExisting(pathExists, targets[host].markers)))
75
+ continue;
76
+ detected += 1;
77
+ const existing = await firstExisting(pathExists, known[host]);
78
+ if (existing) {
79
+ result.already_present.push({ host, path: existing });
80
+ continue;
81
+ }
82
+ const target = targets[host].target;
83
+ try {
84
+ await copySkill(sourceDir, target);
85
+ result.installed.push({ host, path: target });
86
+ errorOutput?.write(`Installed the ${SKILL_NAME} skill for ${HOST_LABEL[host]} at ${target}.\n`);
87
+ }
88
+ catch (err) {
89
+ const reason = err instanceof Error ? err.message : String(err);
90
+ result.failed.push({ host, path: target, reason });
91
+ errorOutput?.write(`Warning: could not install the ${SKILL_NAME} skill for ${HOST_LABEL[host]} at ${target}. ` +
92
+ `Run: every skills install ${host} --global\n`);
93
+ }
94
+ }
95
+ if (detected === 0)
96
+ result.skipped_reason = 'no_agent_host';
97
+ return result;
98
+ }
99
+ catch {
100
+ errorOutput?.write(`Warning: could not check for the ${SKILL_NAME} skill.\n`);
101
+ return emptyResult('error');
102
+ }
103
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Plain-text tables for human output, in the same layout as `every tools list`
3
+ * and `every deal stages`: a header row, a dash row, then one row per record.
4
+ * The last column is not padded. A cell longer than its column width ends in
5
+ * "...".
6
+ */
7
+ /** One line of text: whitespace collapses, and a long value ends in "...". */
8
+ export function cell(value, max = 60) {
9
+ if (value === null || value === undefined)
10
+ return '';
11
+ const text = String(value).replace(/\s+/g, ' ').trim();
12
+ return text.length > max ? `${text.slice(0, Math.max(0, max - 3))}...` : text;
13
+ }
14
+ export function renderTable(columns, rows) {
15
+ const widths = columns.map((column, index) => {
16
+ const longest = Math.max(column.header.length, ...rows.map((row) => (row[index] ?? '').length));
17
+ return column.max === undefined ? longest : Math.min(column.max, longest);
18
+ });
19
+ const last = columns.length - 1;
20
+ const line = (cells) => cells
21
+ .map((value, index) => {
22
+ const text = cell(value, columns[index].max ?? Number.MAX_SAFE_INTEGER);
23
+ return index === last ? text : text.padEnd(widths[index]);
24
+ })
25
+ .join(' ')
26
+ .trimEnd();
27
+ return [
28
+ line(columns.map((column) => column.header)),
29
+ line(widths.map((width) => '-'.repeat(width))),
30
+ ...rows.map(line),
31
+ ].join('\n');
32
+ }
33
+ /** An ISO time as `YYYY-MM-DD HH:MM` (UTC), or the value as given when it does not parse. */
34
+ export function shortTime(value) {
35
+ if (typeof value !== 'string' || !value.trim())
36
+ return '';
37
+ const time = Date.parse(value);
38
+ if (Number.isNaN(time))
39
+ return value;
40
+ return new Date(time).toISOString().slice(0, 16).replace('T', ' ');
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everyai/cli",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Every-AI-Inc/everyai-cli.git"
@@ -5,7 +5,7 @@ try {
5
5
  [
6
6
  '@everyai/cli installed.',
7
7
  '- Command: every (also available as everyai)',
8
- '- Get started: every login',
8
+ '- Get started: every signup (new and existing accounts; an agent can run it)',
9
9
  '- Teach agents: every skills install claude|codex',
10
10
  '- One-shot docs: every docs',
11
11
  '',