@everyai/cli 0.3.0 → 0.5.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
@@ -7,7 +7,7 @@ Install once, log in once, and teach each coding agent the same `every` command
7
7
  ```bash
8
8
  npm install -g @everyai/cli
9
9
  every docs # offline command tree, output contract, workflows
10
- every login # opens your browser; tokens land in your OS keychain
10
+ every login # pick "Create an account" if you're new — signup happens in the browser, then the CLI connects automatically
11
11
  every skills install claude|codex # teach Claude Code or Codex how to use Every
12
12
  every whoami # user, org, environment, tool-count check
13
13
  ```
@@ -48,7 +48,7 @@ The CLI talks to the same Every MCP server (`admin-mcp.every.ai`) and inherits i
48
48
 
49
49
  ```bash
50
50
  # Auth
51
- every login [--staging] # browser OAuth; keychain storage; refresh handled
51
+ every login [--create-account] [--staging] # browser OAuth; keychain storage; refresh handled
52
52
  every logout | whoami | auth status | org
53
53
 
54
54
  # Discovery
@@ -72,6 +72,10 @@ every skills install claude # → .claude/skills/use-every/
72
72
  every skills install codex # → .agents/skills/use-every/
73
73
  ```
74
74
 
75
+ ## Login and account creation
76
+
77
+ Run `every login` to choose between logging in and creating an account, or use `every login --create-account` to open Every's signup page directly. After you create your account and workspace, return to the terminal and press Enter; the CLI connects through the normal browser OAuth flow.
78
+
75
79
  ## Output contract
76
80
 
77
81
  Every command supports `--json`: exactly one JSON document on stdout, nothing else.
@@ -2,11 +2,11 @@ import { access } from 'node:fs/promises';
2
2
  import os from 'node:os';
3
3
  import path from 'node:path';
4
4
  import { createInterface } from 'node:readline/promises';
5
- import { environmentNameForBaseUrl, resolveBaseUrl } from '../lib/config.js';
5
+ import { environmentNameForBaseUrl, resolveBaseUrl, signupUrlForBaseUrl, } from '../lib/config.js';
6
6
  import { CliError } from '../lib/errors.js';
7
7
  import { ExitCode } from '../lib/exit-codes.js';
8
8
  import { mcpCall } from '../lib/mcp.js';
9
- import { loginFlow } from '../lib/auth/flow.js';
9
+ import { loginFlow, openBrowser as openBrowserDefault } from '../lib/auth/flow.js';
10
10
  import { decodeJwtClaims } from '../lib/auth/jwt.js';
11
11
  import { createTokenStore, deleteTokenFromAllStores, getAuthStatus, getToken, resolveAuthTarget, } from '../lib/auth/tokens.js';
12
12
  import { fetchUserInfo } from '../lib/auth/userinfo.js';
@@ -69,10 +69,11 @@ export async function maybeOfferSkillAfterLogin(opts = {}) {
69
69
  const input = opts.input ?? process.stdin;
70
70
  const output = opts.output ?? process.stdout;
71
71
  const errorOutput = opts.errorOutput ?? process.stderr;
72
+ const promptsToProcessStderr = opts.errorOutput === undefined || opts.errorOutput === process.stderr;
72
73
  if (opts.json ||
73
74
  input.isTTY !== true ||
74
75
  output.isTTY !== true ||
75
- (opts.errorOutput === undefined && process.stderr.isTTY !== true))
76
+ (promptsToProcessStderr && process.stderr.isTTY !== true))
76
77
  return;
77
78
  try {
78
79
  const fileSystem = opts.fileSystem ?? defaultSkillOfferFileSystem;
@@ -143,14 +144,14 @@ function loginNextSteps() {
143
144
  ' every skills install claude|codex',
144
145
  ].join('\n');
145
146
  }
146
- function emitLogin(data, opts) {
147
+ function emitLogin(data, opts, output = process.stdout, errorOutput = process.stderr) {
147
148
  const human = `${loginHuman(data)}\n${loginNextSteps()}`;
148
149
  if (opts.json) {
149
150
  emit(data, { json: true, staging: opts.staging });
150
- process.stderr.write(`${loginNextSteps()}\n`);
151
+ errorOutput.write(`${loginNextSteps()}\n`);
151
152
  }
152
153
  else {
153
- process.stdout.write(`${human}\n`);
154
+ output.write(`${human}\n`);
154
155
  }
155
156
  }
156
157
  function statusHuman(status) {
@@ -200,29 +201,17 @@ async function verifyMcpLiveness(baseUrl, token) {
200
201
  tools: Array.isArray(body.tools) ? body.tools.length : 0,
201
202
  };
202
203
  }
203
- export async function loginCommand(opts = {}) {
204
- if (process.env.EVERY_TOKEN) {
205
- const identity = identityFromToken(process.env.EVERY_TOKEN);
206
- const data = {
207
- logged_in: true,
208
- issuer: null,
209
- subject: identity.subject,
210
- email: identity.email,
211
- storage_backend: null,
212
- every_token: true,
213
- };
214
- emitLogin(data, opts);
215
- return;
216
- }
217
- if (!process.stdout.isTTY) {
218
- throw new CliError('login requires a browser; set EVERY_TOKEN for headless use', ExitCode.AUTH, 'auth');
219
- }
204
+ async function runBrowserLogin(opts, streams = {
205
+ input: process.stdin,
206
+ output: process.stdout,
207
+ errorOutput: process.stderr,
208
+ }) {
220
209
  const baseUrl = resolveBaseUrl({ staging: opts.staging });
221
210
  const { environmentKey } = resolveAuthTarget({ baseUrl });
222
211
  const tokenSet = await loginFlow({
223
212
  baseUrl,
224
213
  onAuthorizationUrl(url) {
225
- process.stderr.write(`Open this URL to log in:\n${url}\n`);
214
+ streams.errorOutput.write(`Open this URL to log in:\n${url}\n`);
226
215
  },
227
216
  });
228
217
  const store = await createTokenStore();
@@ -236,8 +225,94 @@ export async function loginCommand(opts = {}) {
236
225
  storage_backend: store.backend,
237
226
  every_token: false,
238
227
  };
239
- emitLogin(data, opts);
240
- await maybeOfferSkillAfterLogin({ json: opts.json });
228
+ emitLogin(data, opts, streams.output, streams.errorOutput);
229
+ await maybeOfferSkillAfterLogin({
230
+ json: opts.json,
231
+ input: streams.input,
232
+ output: streams.output,
233
+ errorOutput: streams.errorOutput,
234
+ });
235
+ }
236
+ export async function createAccountFlow(opts = {}) {
237
+ const input = opts.input ?? process.stdin;
238
+ const output = opts.output ?? process.stdout;
239
+ const errorOutput = opts.errorOutput ?? process.stderr;
240
+ const signupUrl = signupUrlForBaseUrl(resolveBaseUrl({ staging: opts.staging }));
241
+ errorOutput.write(`Opening the Every sign-up page:\n ${signupUrl}\nCreate your account and set up your workspace in the browser.\n`);
242
+ await (opts.openBrowser ?? openBrowserDefault)(signupUrl);
243
+ const rl = createInterface({ input, output: errorOutput, terminal: false });
244
+ try {
245
+ await rl.question("When you're done, press Enter to connect your terminal... ");
246
+ }
247
+ finally {
248
+ rl.close();
249
+ }
250
+ const runLogin = opts.runLogin ?? (() => runBrowserLogin(opts, { input, output, errorOutput }));
251
+ await runLogin();
252
+ }
253
+ async function promptForLoggedOutAction() {
254
+ process.stderr.write([
255
+ "You're not signed in to Every.",
256
+ ' 1) Log in — I already have an account',
257
+ ' 2) Create an account',
258
+ ].join('\n') + '\n');
259
+ const rl = createInterface({
260
+ input: process.stdin,
261
+ output: process.stderr,
262
+ terminal: false,
263
+ });
264
+ try {
265
+ const answer = (await rl.question('Choose [1]: ')).trim();
266
+ if (answer === '2')
267
+ return 'createAccount';
268
+ if (answer !== '' && answer !== '1') {
269
+ process.stderr.write('Unrecognized choice; continuing with log in.\n');
270
+ }
271
+ return 'login';
272
+ }
273
+ finally {
274
+ rl.close();
275
+ }
276
+ }
277
+ export async function loginCommand(opts = {}) {
278
+ if (process.env.EVERY_TOKEN) {
279
+ const identity = identityFromToken(process.env.EVERY_TOKEN);
280
+ const data = {
281
+ logged_in: true,
282
+ issuer: null,
283
+ subject: identity.subject,
284
+ email: identity.email,
285
+ storage_backend: null,
286
+ every_token: true,
287
+ };
288
+ emitLogin(data, opts);
289
+ return;
290
+ }
291
+ if (!process.stdout.isTTY) {
292
+ throw new CliError('login requires a browser; set EVERY_TOKEN for headless use', ExitCode.AUTH, 'auth');
293
+ }
294
+ if (opts.createAccount) {
295
+ // The pause-for-signup prompt reads stdin; a piped/closed stdin would hang there.
296
+ if (process.stdin.isTTY !== true) {
297
+ throw new CliError('create-account requires an interactive terminal; set EVERY_TOKEN for headless use', ExitCode.AUTH, 'auth');
298
+ }
299
+ await createAccountFlow(opts);
300
+ return;
301
+ }
302
+ const baseUrl = resolveBaseUrl({ staging: opts.staging });
303
+ if (!opts.json &&
304
+ !opts.skipMenu &&
305
+ process.stdin.isTTY === true &&
306
+ process.stdout.isTTY === true &&
307
+ process.stderr.isTTY === true &&
308
+ !(await getAuthStatus({ baseUrl })).logged_in) {
309
+ const action = await promptForLoggedOutAction();
310
+ if (action === 'createAccount') {
311
+ await createAccountFlow(opts);
312
+ return;
313
+ }
314
+ }
315
+ await runBrowserLogin(opts);
241
316
  }
242
317
  export async function logoutCommand(opts = {}) {
243
318
  const { environmentKey } = resolveAuthTarget({ staging: opts.staging });
@@ -46,7 +46,7 @@ export function conventionsBlock() {
46
46
  ' read: runs without confirmation',
47
47
  ' write: requires y/N interactively or --yes non-interactively',
48
48
  ' destructive: requires typed confirmation interactively or --yes --allow-destructive non-interactively',
49
- ' ai-mediated: treated as write-capable because it routes to Every AI',
49
+ ' ai-mediated: server-enforced read-only, but gated because it routes through Every AI; prefer deterministic tools',
50
50
  '',
51
51
  'Argument forms:',
52
52
  ' every tool call <name> --arg k=v --arg count=2',
package/dist/index.js CHANGED
@@ -59,9 +59,14 @@ withGlobalOptions(program
59
59
  });
60
60
  withGlobalOptions(program
61
61
  .command('login')
62
- .description('Log in with browser-based OAuth and store tokens locally')).action(async (_options, command) => {
62
+ .description('Log in (or create an account) with browser-based OAuth and store tokens locally')
63
+ .option('--create-account', 'create a new Every account, then connect the CLI')).action(async (_options, command) => {
63
64
  const opts = command.optsWithGlobals();
64
- await loginCommand({ json: opts.json, staging: opts.staging });
65
+ await loginCommand({
66
+ json: opts.json,
67
+ staging: opts.staging,
68
+ createAccount: opts.createAccount,
69
+ });
65
70
  });
66
71
  withGlobalOptions(program
67
72
  .command('logout')
@@ -346,7 +351,8 @@ async function maybeRunFirstRunMenu() {
346
351
  await runDefaultFirstRunMenu({
347
352
  staging: program.opts().staging,
348
353
  showHelp: () => program.outputHelp(),
349
- login: () => loginCommand({ staging: program.opts().staging }),
354
+ login: () => loginCommand({ staging: program.opts().staging, skipMenu: true }),
355
+ createAccount: () => loginCommand({ staging: program.opts().staging, createAccount: true }),
350
356
  });
351
357
  return true;
352
358
  }
@@ -354,10 +360,13 @@ async function main() {
354
360
  jsonMode = process.argv.includes('--json');
355
361
  commanderStdout = '';
356
362
  try {
363
+ // Bare invocation must be handled BEFORE commander: with subcommands and no
364
+ // root action, parseAsync throws commander.help on empty args, so a menu
365
+ // call after it would never run.
366
+ if (await maybeRunFirstRunMenu())
367
+ return;
357
368
  await program.parseAsync(process.argv);
358
369
  if (program.args.length === 0) {
359
- if (await maybeRunFirstRunMenu())
360
- return;
361
370
  if (jsonMode) {
362
371
  emit({ help: program.helpInformation().trimEnd() }, { json: true });
363
372
  }
@@ -15,6 +15,8 @@ export function getConfigDir() {
15
15
  /** Deployed MCP base URLs. */
16
16
  export const PROD_BASE_URL = 'https://admin-mcp.every.ai';
17
17
  export const STAGING_BASE_URL = 'https://admin-mcp-staging.up.railway.app';
18
+ export const PROD_SIGNUP_URL = 'https://app.every.ai/sign-up';
19
+ export const STAGING_SIGNUP_URL = 'https://app.staging.every.ai/sign-up';
18
20
  /**
19
21
  * Resolve the MCP base URL to target.
20
22
  *
@@ -48,3 +50,8 @@ export function environmentNameForBaseUrl(baseUrl) {
48
50
  return 'staging';
49
51
  return 'custom';
50
52
  }
53
+ export function signupUrlForBaseUrl(baseUrl) {
54
+ return environmentNameForBaseUrl(baseUrl) === 'staging'
55
+ ? STAGING_SIGNUP_URL
56
+ : PROD_SIGNUP_URL;
57
+ }
@@ -20,9 +20,10 @@ export async function runFirstRunMenu(opts) {
20
20
  write(opts.output, [
21
21
  "Welcome to Every AI — you're not logged in.",
22
22
  '',
23
- '1) Log in or create an account (opens your browser)',
24
- '2) Show all commands',
25
- '3) Exit',
23
+ '1) Log in — I already have an account (opens your browser)',
24
+ '2) Create an account',
25
+ '3) Show all commands',
26
+ '4) Exit',
26
27
  '',
27
28
  ].join('\n'));
28
29
  const rl = createInterface({ input: opts.input, output: opts.output });
@@ -33,6 +34,9 @@ export async function runFirstRunMenu(opts) {
33
34
  action = 'login';
34
35
  }
35
36
  else if (answer === '2') {
37
+ action = 'createAccount';
38
+ }
39
+ else if (answer === '3') {
36
40
  action = 'help';
37
41
  }
38
42
  }
@@ -40,8 +44,11 @@ export async function runFirstRunMenu(opts) {
40
44
  rl.close();
41
45
  }
42
46
  // Login may open its own post-login prompt, so release stdin first.
47
+ // Account creation also prompts before it starts the normal login flow.
43
48
  if (action === 'login')
44
49
  await opts.login();
50
+ else if (action === 'createAccount')
51
+ await opts.createAccount();
45
52
  else if (action === 'help')
46
53
  opts.showHelp();
47
54
  }
@@ -52,6 +59,7 @@ export async function runDefaultFirstRunMenu(params) {
52
59
  output: process.stdout,
53
60
  showHelp: params.showHelp,
54
61
  login: params.login,
62
+ createAccount: params.createAccount,
55
63
  getStatus: () => getAuthStatus({ baseUrl }),
56
64
  getCachedIdentity: () => readCachedUserInfo(baseUrl, { allowStale: true }),
57
65
  });
@@ -20,14 +20,14 @@ function overrideClassification(name) {
20
20
  return {
21
21
  level: 'ai-mediated',
22
22
  source: 'override',
23
- reason: 'ask_assistant routes to a write-capable Every AI agent despite its read-only annotation.',
23
+ reason: 'ask_assistant is server-enforced read-only, but AI-mediated; prefer deterministic tools when available.',
24
24
  };
25
25
  }
26
- if (/^delete_|^void_/.test(name)) {
26
+ if (/^delete_|^void_|^cancel_/.test(name)) {
27
27
  return {
28
28
  level: 'destructive',
29
29
  source: 'override',
30
- reason: 'Tool name matches delete_/void_, which can remove or void account records.',
30
+ reason: 'Tool name matches delete_/void_/cancel_, which can remove, void, or cancel account records.',
31
31
  };
32
32
  }
33
33
  if (/^send_/.test(name)) {
@@ -44,6 +44,13 @@ function overrideClassification(name) {
44
44
  reason: 'record_payment changes financial records.',
45
45
  };
46
46
  }
47
+ if (name === 'run_recurring_invoice_now') {
48
+ return {
49
+ level: 'destructive',
50
+ source: 'override',
51
+ reason: 'Running a recurring invoice now may immediately send an invoice email.',
52
+ };
53
+ }
47
54
  return undefined;
48
55
  }
49
56
  export function classify(tool) {
@@ -69,9 +76,9 @@ export function classify(tool) {
69
76
  }
70
77
  if (openWorld) {
71
78
  return {
72
- level: 'destructive',
79
+ level: 'write',
73
80
  source: 'annotation',
74
- reason: 'Tool annotation marks it open-world and not read-only.',
81
+ reason: 'Tool annotation marks it open-world and not read-only; defaulting to write.',
75
82
  };
76
83
  }
77
84
  return {
@@ -87,7 +94,7 @@ function readOnlyDenial(level) {
87
94
  return `Denied by read-only mode (--read-only/EVERY_READ_ONLY=1): ${level} tools are not allowed.`;
88
95
  }
89
96
  function aiMediatedExplanation() {
90
- return "This tool sends your request to Every's AI agent, which can take actions on your account; it is not mechanically read-only.";
97
+ return "This tool is server-enforced read-only, but routes through Every's AI agent; prefer deterministic tools when available.";
91
98
  }
92
99
  export function requirementFor(level, { interactive, yes, allowDestructive, readOnlyMode }) {
93
100
  if (level === 'read')
@@ -101,9 +108,10 @@ export function requirementFor(level, { interactive, yes, allowDestructive, read
101
108
  if (interactive)
102
109
  return { allowed: true, prompt: 'confirm' };
103
110
  const prefix = level === 'ai-mediated' ? `${aiMediatedExplanation()} ` : '';
111
+ const action = level === 'ai-mediated' ? 'AI-mediated request' : 'write';
104
112
  return {
105
113
  allowed: false,
106
- denialMessage: `${prefix}Re-run with --yes to confirm this write.`,
114
+ denialMessage: `${prefix}Re-run with --yes to confirm this ${action}.`,
107
115
  };
108
116
  }
109
117
  if (yes && allowDestructive)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everyai/cli",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "description": "The agent-agnostic command-line surface for Every AI.",
6
6
  "type": "module",
@@ -126,6 +126,28 @@ every invoice send <invoice_id> --yes --allow-destructive --json
126
126
  every invoice send <invoice_id> --yes --allow-destructive --json
127
127
  ```
128
128
 
129
+ ### Gmail is draft-first
130
+
131
+ Prefer `draft_email` so the user can review recipients and copy. `send_email` sends immediately from the user's own mailbox; use it only after explicit approval with both destructive flags.
132
+
133
+ ### Calendar and booking ownership
134
+
135
+ Calendar tools operate on the user's personal calendar. Confirm attendees and timezone before creating; reschedules and cancellations can notify attendees according to `send_updates`, so state that effect before acting.
136
+
137
+ Booking create, reschedule, and cancel tools are owner-actions. Resolve the booking and check availability first, then confirm the customer-visible time change or cancellation before executing it.
138
+
139
+ ### Prospecting reads
140
+
141
+ Use `list_prospects`, `view_prospect`, and `network_summary` to research the user's network. Treat the returned personal and relationship context as private; these tools do not contact prospects.
142
+
143
+ ### Stored briefs and reports
144
+
145
+ `get_daily_brief` and `get_heartbeat_summary` read stored artifacts for the authenticated caller only; do not imply they regenerate or share a brief. Use `get_financial_report` for the server-computed financial view and preserve its reported period and currency.
146
+
147
+ ### Recurring invoices
148
+
149
+ List and inspect recurring invoices before changing their schedule or status. Creating, updating, pausing, and resuming are writes; `run_recurring_invoice_now` is destructive because it may auto-send an invoice email when that schedule is configured to send.
150
+
129
151
  ### Complete money totals
130
152
 
131
153
  For invoice counts or money totals, filter `overdue` and `issued` separately and paginate until every result is fetched. Never total one default page; it gives confidently wrong numbers. Use the full tool so you can increment `offset` by `limit` until a page returns fewer records than the limit: