@everyai/cli 0.4.0 → 0.6.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 });
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
  });
@@ -51,6 +51,13 @@ function overrideClassification(name) {
51
51
  reason: 'Running a recurring invoice now may immediately send an invoice email.',
52
52
  };
53
53
  }
54
+ if (name === 'approve_pending_deal') {
55
+ return {
56
+ level: 'write',
57
+ source: 'override',
58
+ reason: 'approve_pending_deal activates a deal and queues its plan; hard to undo, so pin write tier regardless of server annotation drift.',
59
+ };
60
+ }
54
61
  return undefined;
55
62
  }
56
63
  export function classify(tool) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everyai/cli",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "private": false,
5
5
  "description": "The agent-agnostic command-line surface for Every AI.",
6
6
  "type": "module",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "publishConfig": {
20
20
  "access": "public",
21
- "provenance": true
21
+ "provenance": false
22
22
  },
23
23
  "scripts": {
24
24
  "build": "tsc",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: use-every
3
- description: Drive the Every AI CLI (`every`) to manage the user's service business — invoices, clients, contacts, proposals, deals, pipeline, payments, services, and bookings. Use when the user asks “who owes me money?”, wants a lead or deal follow-up, asks to look up, create, update, convert, or send a business record, or mentions their Every workspace.
3
+ description: Drive the Every AI CLI (`every`) to manage the user's service business — invoices, clients, contacts, proposals, deals, pipeline, payments, services, custom fields, and scheduled tasks. Use when the user asks “who owes me money?”, wants a lead or deal follow-up, asks to look up, create, update, convert, or send a business record, or mentions their Every workspace.
4
4
  ---
5
5
 
6
6
  # Use Every
@@ -13,7 +13,7 @@ For headless use, accept `EVERY_TOKEN` from the environment instead of browser l
13
13
 
14
14
  ## What Every Is
15
15
 
16
- Use Every as a service-business workspace for the sales pipeline, deals, contacts and clients, proposals, invoices, payments, services, and bookings. The authenticated CLI operates on one connected Every workspace at a time. If the user means a different business, tell them to switch accounts in Every.
16
+ Use Every as a service-business workspace for the sales pipeline, deals, contacts and clients, proposals, invoices, payments, and services. The authenticated CLI operates on one connected Every workspace at a time. If the user means a different business, tell them to switch accounts in Every.
17
17
 
18
18
  ## Required Workflow
19
19
 
@@ -67,7 +67,7 @@ Use `every whoami --json` to verify the authenticated user, org, environment, ba
67
67
 
68
68
  ### Deal activity auto-tracking is creation-only
69
69
 
70
- Creating a proposal, invoice, or booking automatically records activity on a matching deal when exactly one deal/client matches. After an Every creation command, never double-log that action:
70
+ Creating a proposal or invoice automatically records activity on a matching deal when exactly one deal/client matches. After an Every creation command, never double-log that action:
71
71
 
72
72
  ```bash
73
73
  every invoice create --client-id <client_id> --amount 100 --yes --json
@@ -130,11 +130,17 @@ every invoice send <invoice_id> --yes --allow-destructive --json
130
130
 
131
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
132
 
133
- ### Calendar and booking ownership
133
+ ### Calendar ownership
134
134
 
135
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
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.
137
+ ### Custom fields are schema, not events
138
+
139
+ `every tool call set_meta_fields ...` stores current state (e.g. a tracked boolean) on a contact, client, or deal; missing field definitions are created automatically, but check `every tool call list_meta_field_definitions --json` first and reuse an existing one when it fits. Something that *happened* (a call, visit, touchpoint) belongs in `log_deal_activity`, not a meta field. Tags are the `custom.tags` list field, not a separate feature.
140
+
141
+ ### Scheduled tasks report in-app, never in this session
142
+
143
+ `every tool call create_scheduled_task ...` sets up a saved instruction that runs on a cadence (once/daily/weekly/monthly). Results and any notifications always arrive in the Every app (Daily Brief / notifications) and by email if enabled — never back in this CLI session, so don't tell the user to expect output here.
138
144
 
139
145
  ### Prospecting reads
140
146
 
@@ -170,7 +176,7 @@ every tool call view_deal --arg deal_id=<deal_id> --json
170
176
  every deal move <deal_id> <stage> --yes --json
171
177
  ```
172
178
 
173
- Recommend follow-ups before moving anything. Log only outside events the user reports; creation of proposals, invoices, and bookings is already tracked.
179
+ Recommend follow-ups before moving anything. Log only outside events the user reports; creation of proposals and invoices is already tracked.
174
180
 
175
181
  Invoice flow: find who owes money:
176
182