@everyai/cli 0.9.0 → 0.10.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.
@@ -0,0 +1,453 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { approvalsUrlForBaseUrl, resolveBaseUrl } from '../lib/config.js';
4
+ import { CliError } from '../lib/errors.js';
5
+ import { ExitCode } from '../lib/exit-codes.js';
6
+ import { emit } from '../lib/output.js';
7
+ import { record } from '../lib/recipients.js';
8
+ import { renderTable, shortTime } from '../lib/table.js';
9
+ import { addLimit, nonEmpty } from './aliases.js';
10
+ import { executeToolCall, invokeToolCall, toolCallHuman, } from './tools.js';
11
+ function usage(message) {
12
+ return new CliError(message, ExitCode.USAGE, 'usage');
13
+ }
14
+ function requireId(value, label) {
15
+ const id = value.trim();
16
+ if (!id)
17
+ throw usage(`${label} is required`);
18
+ return id;
19
+ }
20
+ /** Copy each flag that has a value to the tool argument of the same meaning. */
21
+ function scalarFields(source, mapping) {
22
+ const fields = {};
23
+ for (const [option, argument] of Object.entries(mapping)) {
24
+ const value = source[option];
25
+ if (typeof value === 'string' && value.trim())
26
+ fields[argument] = value.trim();
27
+ }
28
+ return fields;
29
+ }
30
+ /** Email and phone go in as primary contact methods (create_person/create_company `methods`). */
31
+ function contactMethods(opts) {
32
+ const methods = [];
33
+ for (const kind of ['email', 'phone']) {
34
+ const value = nonEmpty(opts[kind]);
35
+ if (value)
36
+ methods.push({ action: 'upsert', kind, display_value: value, is_primary: true });
37
+ }
38
+ return methods.length ? methods : undefined;
39
+ }
40
+ function requiredName(value) {
41
+ const name = nonEmpty(value);
42
+ if (!name)
43
+ throw usage('--name is required');
44
+ return name;
45
+ }
46
+ function parseValue(value) {
47
+ if (value === undefined)
48
+ return undefined;
49
+ const parsed = Number(value);
50
+ if (value.trim() === '' || !Number.isFinite(parsed) || parsed < 0) {
51
+ throw usage('--value must be a number, 0 or more');
52
+ }
53
+ return parsed;
54
+ }
55
+ function partyFromIds(opts) {
56
+ const personId = nonEmpty(opts.personId);
57
+ const companyId = nonEmpty(opts.companyId);
58
+ if (personId && companyId)
59
+ throw usage('Use only one of --person-id or --company-id');
60
+ if (personId)
61
+ return { kind: 'person', id: personId };
62
+ if (companyId)
63
+ return { kind: 'company', id: companyId };
64
+ return undefined;
65
+ }
66
+ function ownerValue(value) {
67
+ if (value === undefined)
68
+ return undefined;
69
+ const owner = nonEmpty(value);
70
+ if (!owner)
71
+ throw usage('--owner must be me, a teammate\'s email, or a user id');
72
+ return owner;
73
+ }
74
+ function goalValue(value) {
75
+ if (value === undefined)
76
+ return undefined;
77
+ const summary = nonEmpty(value);
78
+ if (!summary)
79
+ throw usage('--goal must describe what the deal sells');
80
+ return { summary };
81
+ }
82
+ function memberList(values) {
83
+ if (!values)
84
+ return undefined;
85
+ const members = Array.from(new Set(values.flatMap((value) => value.split(',')).map((value) => value.trim()).filter(Boolean)));
86
+ return members.length ? members : undefined;
87
+ }
88
+ /** The approvals page for the environment this call targets. */
89
+ function approvalsUrl(opts) {
90
+ return approvalsUrlForBaseUrl(resolveBaseUrl({ staging: opts.staging }));
91
+ }
92
+ /**
93
+ * A request that waits for a person's approval stays a permission result
94
+ * (exit 4, `error.mcp_gate`). This adds where to approve it and what to do next.
95
+ */
96
+ async function withApprovalLink(opts, run) {
97
+ try {
98
+ await run();
99
+ }
100
+ catch (err) {
101
+ const gate = err instanceof CliError ? record(err.details?.mcp_gate) : {};
102
+ if (!(err instanceof CliError) || gate.type !== 'human_approval')
103
+ throw err;
104
+ const url = approvalsUrl(opts);
105
+ const status = typeof gate.status === 'string' ? gate.status : 'pending';
106
+ throw new CliError([
107
+ err.message,
108
+ `Approval status: ${status}.`,
109
+ `Approve in Every: Settings > Approvals ${url}`,
110
+ 'After the approval, run the same command again. `every approvals` lists the requests.',
111
+ ].join('\n'), err.exitCode, err.code, { ...err.details, approvals_url: url });
112
+ }
113
+ }
114
+ // ── Companies ───────────────────────────────────────────────────────────────
115
+ export function companyTableHuman(data) {
116
+ const structured = record(data.structured_content);
117
+ if (!Array.isArray(structured.items))
118
+ return toolCallHuman(data);
119
+ const items = structured.items.map(record);
120
+ if (items.length === 0)
121
+ return 'No Companies found.';
122
+ const columns = [
123
+ { header: 'id', max: 36 },
124
+ { header: 'name', max: 40 },
125
+ { header: 'industry', max: 24 },
126
+ { header: 'email', max: 32 },
127
+ { header: 'website' },
128
+ ];
129
+ const rows = items.map((item) => [item.id, item.name, item.industry, item.email, item.website]
130
+ .map((value) => (typeof value === 'string' ? value : value === undefined || value === null ? '' : String(value))));
131
+ const lines = [renderTable(columns, rows)];
132
+ if (structured.has_more === true) {
133
+ const total = typeof structured.total === 'number' ? ` of ${structured.total}` : '';
134
+ lines.push('', `Showing ${items.length}${total} Companies. Raise --limit (up to 100) or narrow --search to see more.`);
135
+ }
136
+ return lines.join('\n');
137
+ }
138
+ export async function companyListCommand(opts = {}) {
139
+ const args = {};
140
+ if (opts.search !== undefined)
141
+ args.query = opts.search;
142
+ addLimit(args, opts.limit);
143
+ await executeToolCall('list_companies', opts, async () => args, undefined, undefined, companyTableHuman);
144
+ }
145
+ export async function companyViewCommand(companyId, opts = {}) {
146
+ const id = requireId(companyId, '<company_id>');
147
+ await executeToolCall('view_company', opts, async () => ({ company_id: id }));
148
+ }
149
+ export async function companyCreateCommand(opts = {}) {
150
+ const name = requiredName(opts.name);
151
+ const methods = contactMethods(opts);
152
+ // One operation_id per invocation, so the one confirmation retry reuses it.
153
+ const command = {
154
+ operation_id: randomUUID(),
155
+ name,
156
+ ...scalarFields(opts, {
157
+ website: 'website', industry: 'industry', address: 'address', notes: 'notes', leadSource: 'lead_source',
158
+ }),
159
+ ...(methods ? { methods } : {}),
160
+ };
161
+ await executeToolCall('create_company', opts, async () => ({ command }));
162
+ }
163
+ // ── People ──────────────────────────────────────────────────────────────────
164
+ export async function personViewCommand(personId, opts = {}) {
165
+ const id = requireId(personId, '<person_id>');
166
+ await executeToolCall('view_person', opts, async () => ({ person_id: id }));
167
+ }
168
+ export async function personCreateCommand(opts = {}) {
169
+ const name = requiredName(opts.name);
170
+ const methods = contactMethods(opts);
171
+ const command = {
172
+ operation_id: randomUUID(),
173
+ name,
174
+ ...scalarFields(opts, {
175
+ jobTitle: 'job_title', company: 'company', location: 'location', headline: 'headline',
176
+ industry: 'industry', address: 'address', notes: 'notes',
177
+ }),
178
+ ...(methods ? { methods } : {}),
179
+ };
180
+ await executeToolCall('create_person', opts, async () => ({ command }));
181
+ }
182
+ // ── Deals ───────────────────────────────────────────────────────────────────
183
+ export async function dealViewCommand(dealId, opts = {}) {
184
+ const id = requireId(dealId, '<deal_id>');
185
+ const include = [
186
+ opts.plan ? 'plan' : undefined,
187
+ opts.draft ? 'draft' : undefined,
188
+ opts.autoSends ? 'auto_sends' : undefined,
189
+ ].filter((value) => value !== undefined);
190
+ await executeToolCall('view_deal', opts, async () => ({ deal_id: id, ...(include.length ? { include } : {}) }));
191
+ }
192
+ /** create_deal requires target_name. For an existing record it is the record's own name. */
193
+ async function partyName(party, opts) {
194
+ const tool = party.kind === 'person' ? 'view_person' : 'view_company';
195
+ const result = await invokeToolCall(tool, opts, async () => ({ [`${party.kind}_id`]: party.id }));
196
+ const structured = record(result.structured_content);
197
+ const name = record(structured.party).name ?? structured.name;
198
+ if (typeof name !== 'string' || !name.trim()) {
199
+ throw new CliError(`${tool} returned no name for ${party.id}. No deal was created.`, ExitCode.NOT_FOUND, 'not_found');
200
+ }
201
+ return name.trim();
202
+ }
203
+ export async function dealCreateCommand(opts = {}) {
204
+ const party = partyFromIds(opts);
205
+ const personName = nonEmpty(opts.name);
206
+ const personEmail = nonEmpty(opts.email);
207
+ if (party && (personName || personEmail)) {
208
+ throw usage('Use --name and --email for a new Person, or --person-id or --company-id for an existing record, not both');
209
+ }
210
+ if (!party && !personName) {
211
+ throw usage('Name who the deal is with: --person-id, --company-id, or --name (and --email) for a new Person');
212
+ }
213
+ const value = parseValue(opts.value);
214
+ const owner = ownerValue(opts.owner);
215
+ const goal = goalValue(opts.goal);
216
+ const stage = nonEmpty(opts.stage);
217
+ const dealName = nonEmpty(opts.dealName);
218
+ let args = {};
219
+ const build = (targetName) => ({
220
+ target_name: targetName,
221
+ ...(party ? { party } : {}),
222
+ ...(personEmail ? { target_email: personEmail } : {}),
223
+ ...(stage ? { stage } : {}),
224
+ ...(dealName ? { name: dealName } : {}),
225
+ ...(value !== undefined ? { value_estimate: value } : {}),
226
+ ...(owner ? { owner } : {}),
227
+ ...(goal ? { goal } : {}),
228
+ });
229
+ if (personName)
230
+ args = build(personName);
231
+ await withApprovalLink(opts, () => executeToolCall('create_deal', opts, async () => args, undefined, {
232
+ // The record read runs after the local write gate, so a refused call reads nothing.
233
+ beforeConfirmation: party ? async () => { args = build(await partyName(party, opts)); } : undefined,
234
+ }));
235
+ }
236
+ export async function dealUpdateCommand(dealId, opts = {}) {
237
+ const id = requireId(dealId, '<deal_id>');
238
+ const party = partyFromIds(opts);
239
+ const value = parseValue(opts.value);
240
+ const owner = ownerValue(opts.owner);
241
+ const add = memberList(opts.addMember);
242
+ const remove = memberList(opts.removeMember);
243
+ const args = { deal_id: id };
244
+ // An absent flag means no change. `--name ""` resets the name to the default.
245
+ if (opts.name !== undefined)
246
+ args.name = opts.name.trim();
247
+ if (value !== undefined)
248
+ args.value_estimate = value;
249
+ if (party)
250
+ args.party = party;
251
+ if (owner)
252
+ args.owner = owner;
253
+ if (add || remove)
254
+ args.members = { ...(add ? { add } : {}), ...(remove ? { remove } : {}) };
255
+ // No --goal here: update_deal replaces the whole goal, so a summary alone
256
+ // clears the services and the targeting. Use `every tool call update_deal`.
257
+ if (Object.keys(args).length === 1) {
258
+ throw usage('Nothing to change. Pass at least one of --name, --value, --owner, --person-id, --company-id, --add-member or --remove-member');
259
+ }
260
+ await withApprovalLink(opts, () => executeToolCall('update_deal', opts, async () => args));
261
+ }
262
+ // ── Deal outreach ───────────────────────────────────────────────────────────
263
+ async function readBody(opts) {
264
+ if (opts.body !== undefined && opts.bodyFile !== undefined)
265
+ throw usage('Use --body or --body-file, not both');
266
+ if (opts.bodyFile === undefined)
267
+ return opts.body;
268
+ if (opts.bodyFile === '-') {
269
+ process.stdin.setEncoding('utf8');
270
+ let text = '';
271
+ for await (const chunk of process.stdin)
272
+ text += chunk;
273
+ return text;
274
+ }
275
+ try {
276
+ return await readFile(opts.bodyFile, 'utf8');
277
+ }
278
+ catch (err) {
279
+ const detail = err instanceof Error ? err.message : String(err);
280
+ throw usage(`Could not read --body-file: ${detail}`);
281
+ }
282
+ }
283
+ export async function outreachEditCommand(dealId, opts = {}) {
284
+ const id = requireId(dealId, '<deal_id>');
285
+ const body = await readBody(opts);
286
+ const changes = {};
287
+ if (opts.subject !== undefined)
288
+ changes.subject = opts.subject;
289
+ if (body !== undefined)
290
+ changes.body = body;
291
+ if (opts.recipient !== undefined)
292
+ changes.recipient = opts.recipient.trim();
293
+ if (opts.thread !== undefined)
294
+ changes.thread_id = opts.thread.trim();
295
+ if (Object.keys(changes).length === 0) {
296
+ throw usage('Nothing to change. Pass at least one of --subject, --body, --body-file, --recipient or --thread');
297
+ }
298
+ const draftVersion = nonEmpty(opts.draftVersion);
299
+ const args = { deal_id: id, action: 'edit', ...changes, ...(draftVersion ? { draft_version: draftVersion } : {}) };
300
+ // Edit changes only the stored draft: an ordinary write, as `deal move` is.
301
+ await withApprovalLink(opts, () => executeToolCall('deal_outreach', opts, async () => args, undefined, { level: 'write' }));
302
+ }
303
+ export async function outreachCancelCommand(dealId, opts = {}) {
304
+ const id = requireId(dealId, '<deal_id>');
305
+ const sendId = nonEmpty(opts.sendId);
306
+ if (!sendId)
307
+ throw usage('--send-id is required. Read it with every deal view <deal_id> --auto-sends');
308
+ // Cancel stops a send, so nothing reaches a recipient: an ordinary write.
309
+ await withApprovalLink(opts, () => executeToolCall('deal_outreach', opts, async () => ({ deal_id: id, action: 'cancel', send_id: sendId }), undefined, { level: 'write' }));
310
+ }
311
+ /** A view_deal block: at the top of the result, or under `deal` or `result`. */
312
+ function viewBlock(structured, key) {
313
+ const top = record(structured);
314
+ for (const candidate of [top, record(top.deal), record(top.result)]) {
315
+ if (key in candidate)
316
+ return candidate[key];
317
+ }
318
+ return undefined;
319
+ }
320
+ export function outreachPreviewLines(preview) {
321
+ return [
322
+ `Channel: ${preview.channel}`,
323
+ `To: ${preview.to ?? 'the recipient on the draft'}`,
324
+ ...(preview.subject !== null ? [`Subject: ${preview.subject}`] : []),
325
+ `Draft version: ${preview.draft_version}`,
326
+ '',
327
+ preview.body ?? '(The message text is not available to this connection.)',
328
+ '',
329
+ ].join('\n');
330
+ }
331
+ async function readDraft(dealId, opts) {
332
+ const result = await invokeToolCall('view_deal', opts, async () => ({ deal_id: dealId, include: ['draft'] }));
333
+ const draft = viewBlock(result.structured_content, 'draft');
334
+ if (!draft || typeof draft !== 'object') {
335
+ throw new CliError('This deal has no unsent draft. Nothing was sent.', ExitCode.NOT_FOUND, 'draft_not_found');
336
+ }
337
+ const fields = record(draft);
338
+ const version = fields.draft_version;
339
+ if (typeof version !== 'string' || !version) {
340
+ throw new CliError('The server returned the draft without a draft_version. Nothing was sent.', ExitCode.GENERIC, 'draft_version_missing');
341
+ }
342
+ const text = (key) => (typeof fields[key] === 'string' ? fields[key] : null);
343
+ return {
344
+ channel: text('channel') ?? 'message',
345
+ to: text('to') ?? text('profile_url') ?? text('recipient_name'),
346
+ subject: text('subject'),
347
+ body: text('body'),
348
+ draft_version: version,
349
+ };
350
+ }
351
+ export async function outreachSendCommand(dealId, opts = {}) {
352
+ const id = requireId(dealId, '<deal_id>');
353
+ const given = nonEmpty(opts.draftVersion);
354
+ let preview;
355
+ let draftVersion = given;
356
+ await withApprovalLink(opts, () => executeToolCall('deal_outreach', opts, async () => ({ deal_id: id, action: 'send', draft_version: draftVersion }), (data) => (preview ? { ...data, preview } : data), {
357
+ level: 'destructive',
358
+ // Without --draft-version, show the exact draft and send that version.
359
+ // The read runs after the local destructive gate and before the prompt.
360
+ beforeConfirmation: given ? undefined : async () => {
361
+ preview = await readDraft(id, opts);
362
+ draftVersion = preview.draft_version;
363
+ process.stderr.write(outreachPreviewLines(preview));
364
+ },
365
+ }));
366
+ }
367
+ // ── Approvals ───────────────────────────────────────────────────────────────
368
+ const ARGUMENT_SUMMARY_KEYS = [
369
+ 'action', 'deal_id', 'send_id', 'invoice_id', 'proposal_id', 'prospect_id', 'person_id', 'company_id', 'stage',
370
+ ];
371
+ /** Ids and the action only: arguments can hold message text, which this line never shows. */
372
+ export function argumentSummary(value) {
373
+ const args = record(value);
374
+ const parts = ARGUMENT_SUMMARY_KEYS
375
+ .filter((key) => typeof args[key] === 'string' || typeof args[key] === 'number')
376
+ .map((key) => `${key}=${String(args[key])}`);
377
+ if (Array.isArray(args.records))
378
+ parts.push(`records=${args.records.length}`);
379
+ if (parts.length)
380
+ return parts.join(' ');
381
+ const count = Object.keys(args).length;
382
+ return count ? `${count} argument(s)` : '';
383
+ }
384
+ function connectionLabel(request) {
385
+ const name = typeof request.connection_name === 'string' && request.connection_name ? request.connection_name : 'unknown';
386
+ return request.this_connection === false ? `${name} (other connection)` : name;
387
+ }
388
+ export async function approvalsCommand(opts = {}) {
389
+ const data = await invokeToolCall('get_workspace_priorities', opts);
390
+ const url = approvalsUrl(opts);
391
+ const approveLine = `Approve in Every: Settings > Approvals ${url}`;
392
+ const block = record(data.structured_content).pending_approvals;
393
+ let result;
394
+ let human;
395
+ if (!block || typeof block !== 'object' || Array.isArray(block)) {
396
+ // A server before 2026-11-09 has no pending_approvals block.
397
+ const message = 'This Every server does not report approval requests yet.';
398
+ result = { available: false, reason: 'unsupported', message, requests: [], approvals_url: url };
399
+ human = `${message}\n${approveLine}`;
400
+ }
401
+ else if (record(block).available === false) {
402
+ const raw = record(block).message;
403
+ const message = typeof raw === 'string' && raw ? raw : 'Approval requests are unavailable right now.';
404
+ result = { available: false, reason: 'unavailable', message, requests: [], approvals_url: url };
405
+ human = `${message}\n${approveLine}`;
406
+ }
407
+ else {
408
+ const requests = Array.isArray(record(block).requests) ? record(block).requests.map(record) : [];
409
+ // A server before 2026-11-10 sends no this_connection field: its rows are this connection's.
410
+ const shown = opts.all ? requests : requests.filter((request) => (request.status === 'pending' || request.status === 'approved') && request.this_connection !== false);
411
+ const hidden = requests.length - shown.length;
412
+ result = {
413
+ available: true,
414
+ window_hours: record(block).window_hours ?? null,
415
+ filter: opts.all ? 'all' : 'pending_or_approved_this_connection',
416
+ requests: shown,
417
+ total: requests.length,
418
+ hidden,
419
+ approvals_url: url,
420
+ };
421
+ const lines = [];
422
+ if (shown.length === 0) {
423
+ lines.push(opts.all
424
+ ? 'No approval requests in the last 24 hours.'
425
+ : 'No approval requests are pending or approved for this connection.');
426
+ }
427
+ else {
428
+ lines.push(renderTable([
429
+ { header: 'status', max: 9 },
430
+ { header: 'tool', max: 24 },
431
+ { header: 'arguments', max: 60 },
432
+ { header: 'connection', max: 40 },
433
+ { header: 'created', max: 16 },
434
+ { header: 'expires' },
435
+ ], shown.map((request) => [
436
+ String(request.status ?? ''),
437
+ String(request.tool ?? ''),
438
+ argumentSummary(request.arguments),
439
+ connectionLabel(request),
440
+ shortTime(request.created_at),
441
+ shortTime(request.expires_at),
442
+ ])));
443
+ }
444
+ if (hidden > 0)
445
+ lines.push(`${hidden} more request(s) are hidden. Run every approvals --all to show every row.`);
446
+ lines.push('', approveLine);
447
+ human = lines.join('\n');
448
+ }
449
+ if (opts.json)
450
+ emit(result, { json: true, staging: opts.staging });
451
+ else
452
+ process.stdout.write(`${human}\n`);
453
+ }
@@ -57,6 +57,12 @@ export function conventionsBlock() {
57
57
  ' destructive: requires typed confirmation interactively or --yes --allow-destructive non-interactively',
58
58
  ' ai-mediated: server-enforced read-only, but gated because it routes through Every AI; prefer deterministic tools',
59
59
  ' human approval: never auto-retries; approve in Every, then re-run the identical command',
60
+ ' short commands gate by action: deal outreach edit and cancel are writes, deal outreach send is destructive',
61
+ ' (every tool call deal_outreach stays destructive for every action)',
62
+ '',
63
+ 'Short commands:',
64
+ ' Each one calls one tool (company, person, deal, approvals). every tool call <name> stays valid for every tool.',
65
+ ' every approvals lists the requests that wait in Every: Settings > Approvals.',
60
66
  '',
61
67
  'Argument forms:',
62
68
  ' every tool call <name> --arg k=v --arg count=2',
@@ -1,7 +1,7 @@
1
1
  import { resolveBaseUrl } from '../lib/config.js';
2
2
  import { readCachedTools } from '../lib/mcp.js';
3
3
  import { emit } from '../lib/output.js';
4
- import { classify, requirementDescription } from '../lib/policy.js';
4
+ import { classify, requirementDescription, shortCommandNote } from '../lib/policy.js';
5
5
  function emitCommand(data, human, opts) {
6
6
  if (opts.json)
7
7
  emit(data, { json: true, staging: opts.staging });
@@ -17,6 +17,7 @@ export async function policyExplainCommand(name, opts = {}) {
17
17
  const note = cachedTools?.some((candidate) => candidate.name === name)
18
18
  ? undefined
19
19
  : 'No cached tool metadata matched this name; classification used local overrides and name patterns only.';
20
+ const shortCommands = shortCommandNote(name);
20
21
  const data = {
21
22
  tool: name,
22
23
  level: classification.level,
@@ -24,6 +25,7 @@ export async function policyExplainCommand(name, opts = {}) {
24
25
  reason: classification.reason,
25
26
  requirements,
26
27
  note,
28
+ ...(shortCommands ? { short_commands: shortCommands } : {}),
27
29
  };
28
30
  const human = [
29
31
  `Tool: ${name}`,
@@ -32,6 +34,7 @@ export async function policyExplainCommand(name, opts = {}) {
32
34
  `Reason: ${data.reason}`,
33
35
  `Interactive: ${requirements.interactive}`,
34
36
  `Non-interactive: ${requirements.non_interactive}`,
37
+ shortCommands,
35
38
  note ? `Note: ${note}` : undefined,
36
39
  ].filter((line) => Boolean(line)).join('\n');
37
40
  emitCommand(data, human, opts);
@@ -213,7 +213,7 @@ function contentAsText(content) {
213
213
  return '';
214
214
  return typeof content === 'string' ? content : JSON.stringify(content, null, 2);
215
215
  }
216
- function toolCallHuman(result) {
216
+ export function toolCallHuman(result) {
217
217
  const parts = [];
218
218
  const text = contentAsText(result.content);
219
219
  if (text)
@@ -257,7 +257,7 @@ export async function invokeToolCall(name, opts = {}, argsFactory = async () =>
257
257
  const token = await getToken({ baseUrl });
258
258
  const tools = await listTools(baseUrl, token, { noCache: opts.noCache });
259
259
  const tool = findTool(tools, name, hooks);
260
- const classification = classify(tool);
260
+ const classification = hooks.level ? { ...classify(tool), level: hooks.level } : classify(tool);
261
261
  const interactive = Boolean(process.stdin.isTTY && process.stderr.isTTY);
262
262
  const readOnlyMode = opts.readOnly === true || process.env.EVERY_READ_ONLY === '1';
263
263
  const requirement = requirementFor(classification.level, {