@everyai/cli 0.6.3 → 0.6.5
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 +2 -3
- package/dist/commands/aliases.js +75 -28
- package/dist/index.js +8 -4
- package/dist/lib/policy.js +32 -0
- package/package.json +1 -1
- package/skills/use-every/SKILL.md +9 -9
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @everyai/cli
|
|
2
2
|
|
|
3
|
-
The **agent-agnostic** command line for [Every AI](https://every.ai) — manage invoices,
|
|
3
|
+
The **agent-agnostic** command line for [Every AI](https://every.ai) — manage invoices, People, Companies, proposals, deals, and pipeline work from any shell, coding agent, or CI job.
|
|
4
4
|
|
|
5
5
|
Install once, log in once, and teach each coding agent the same `every` command instead of wiring MCP + OAuth separately into every host.
|
|
6
6
|
|
|
@@ -17,8 +17,7 @@ One-shot invoice example with inline args:
|
|
|
17
17
|
```bash
|
|
18
18
|
every invoice list --status overdue --json
|
|
19
19
|
every tool call create_invoice \
|
|
20
|
-
--arg
|
|
21
|
-
--arg line_items='[{"description":"Strategy work","quantity":1,"unit_price":1500}]' \
|
|
20
|
+
--arg command='{"operation_id":"<uuid>","party":{"kind":"company","id":"client_123"},"line_items":[{"description":"Strategy work","quantity":1,"unit_price":1500}]}' \
|
|
22
21
|
--yes \
|
|
23
22
|
--json
|
|
24
23
|
```
|
package/dist/commands/aliases.js
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
1
2
|
import { CliError } from '../lib/errors.js';
|
|
2
3
|
import { ExitCode } from '../lib/exit-codes.js';
|
|
3
4
|
import { executeToolCall, invokeToolCall, } from './tools.js';
|
|
4
5
|
const INVOICE_STATUSES = new Set(['draft', 'issued', 'void']);
|
|
5
6
|
const PAYMENT_STATUSES = new Set(['unpaid', 'paid', 'overdue', 'partial']);
|
|
6
7
|
const DEAL_STAGES = new Set(['lead', 'opportunity', 'won', 'lost']);
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
// list_companies/list_people (the live People/Companies search tools) take a
|
|
9
|
+
// free-text `query` param — the retired list_clients/list_contacts tools took `name`.
|
|
10
|
+
const NETWORK_SEARCH_QUERY_PARAM = 'query';
|
|
11
|
+
// create_invoice's arguments now nest under a single structured `command` object
|
|
12
|
+
// (server commit that retired the flat client_id argument): command.operation_id
|
|
13
|
+
// (a fresh UUID per write, reused only for the exact server-directed retry),
|
|
14
|
+
// command.party = {kind: person|company, id}, and command.line_items.
|
|
15
|
+
const CREATE_INVOICE_COMMAND_PARAM = 'command';
|
|
16
|
+
const CREATE_INVOICE_OPERATION_ID_PARAM = 'operation_id';
|
|
17
|
+
const CREATE_INVOICE_PARTY_PARAM = 'party';
|
|
9
18
|
const CREATE_INVOICE_LINE_ITEMS_PARAM = 'line_items';
|
|
19
|
+
const PARTY_KIND_PARAM = 'kind';
|
|
20
|
+
const PARTY_ID_PARAM = 'id';
|
|
10
21
|
const LINE_ITEM_DESCRIPTION_PARAM = 'description';
|
|
11
22
|
const LINE_ITEM_QUANTITY_PARAM = 'quantity';
|
|
12
23
|
const LINE_ITEM_UNIT_PRICE_PARAM = 'unit_price';
|
|
@@ -77,7 +88,7 @@ function stripMarkdown(value) {
|
|
|
77
88
|
function cleanClientNameFromLine(value) {
|
|
78
89
|
let name = stripMarkdown(value)
|
|
79
90
|
.replace(/^\s*(?:[-*+]|\d+[.)])\s*/, '')
|
|
80
|
-
.replace(/^client(?:\s+name)?:\s*/i, '')
|
|
91
|
+
.replace(/^(?:client|company|person)(?:\s+name)?:\s*/i, '')
|
|
81
92
|
// Drop a trailing status parenthetical like "(active)" / "(archived)".
|
|
82
93
|
.replace(/\s*\((?:active|inactive|archived)\)\s*$/i, '')
|
|
83
94
|
.trim();
|
|
@@ -124,8 +135,16 @@ function collectStructuredCandidates(value, seen = new Set()) {
|
|
|
124
135
|
}
|
|
125
136
|
const record = value;
|
|
126
137
|
const direct = candidateFromObject(record);
|
|
127
|
-
|
|
128
|
-
|
|
138
|
+
// Once a record itself resolves to a candidate, its own nested fields describe
|
|
139
|
+
// THAT candidate (e.g. a Person/Company's `affiliations[].person`/`.company`
|
|
140
|
+
// sub-objects, which carry their own id+name) rather than sibling matches. Real
|
|
141
|
+
// list_people/list_companies results nest exactly this shape, so descending
|
|
142
|
+
// into an already-matched record's children turned every single real match into
|
|
143
|
+
// a false "multiple candidates" ambiguity — only keep walking children when the
|
|
144
|
+
// current object was NOT itself a match.
|
|
145
|
+
if (direct)
|
|
146
|
+
return [direct];
|
|
147
|
+
return Object.values(record).flatMap((entry) => collectStructuredCandidates(entry, seen));
|
|
129
148
|
}
|
|
130
149
|
function textFromContent(content) {
|
|
131
150
|
if (typeof content === 'string')
|
|
@@ -171,31 +190,49 @@ export function parseClientCandidates(result) {
|
|
|
171
190
|
...parseClientCandidatesFromText(textFromContent(result.content)),
|
|
172
191
|
]);
|
|
173
192
|
}
|
|
174
|
-
function
|
|
193
|
+
function partyCandidatesMessage(label, query, candidates) {
|
|
175
194
|
return [
|
|
176
|
-
`Multiple
|
|
195
|
+
`Multiple ${label}s matching "${query}".`,
|
|
177
196
|
...candidates.map((candidate) => `${candidate.client_id} ${candidate.name}`),
|
|
178
197
|
'Re-run with --client-id <id>',
|
|
179
198
|
].join('\n');
|
|
180
199
|
}
|
|
200
|
+
// --client is the deprecated alias for --company (the historical "client" concept is
|
|
201
|
+
// now the Company record); --person resolves via the People half of the same schema.
|
|
202
|
+
function selectParty(opts) {
|
|
203
|
+
const companyName = nonEmpty(opts.company) ?? nonEmpty(opts.client);
|
|
204
|
+
const personName = nonEmpty(opts.person);
|
|
205
|
+
if (companyName && personName) {
|
|
206
|
+
throw new CliError('Use only one of --company/--client or --person to resolve the invoice recipient', ExitCode.USAGE, 'usage');
|
|
207
|
+
}
|
|
208
|
+
if (personName)
|
|
209
|
+
return { kind: 'person', name: personName };
|
|
210
|
+
if (companyName)
|
|
211
|
+
return { kind: 'company', name: companyName };
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
181
214
|
async function resolveClient(opts) {
|
|
182
215
|
const clientId = nonEmpty(opts.clientId);
|
|
183
|
-
const
|
|
184
|
-
if (clientId)
|
|
185
|
-
return { client_id: clientId, name:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
216
|
+
const selector = selectParty(opts);
|
|
217
|
+
if (clientId) {
|
|
218
|
+
return { client_id: clientId, kind: selector?.kind ?? 'company', name: selector?.name ?? null };
|
|
219
|
+
}
|
|
220
|
+
if (!selector) {
|
|
221
|
+
throw new CliError('--client, --company, --person, or --client-id is required', ExitCode.USAGE, 'usage');
|
|
222
|
+
}
|
|
223
|
+
const tool = selector.kind === 'person' ? 'list_people' : 'list_companies';
|
|
224
|
+
const label = selector.kind;
|
|
225
|
+
const result = await invokeToolCall(tool, opts, async () => ({
|
|
226
|
+
[NETWORK_SEARCH_QUERY_PARAM]: selector.name,
|
|
191
227
|
}));
|
|
192
228
|
const candidates = parseClientCandidates(result);
|
|
193
|
-
if (candidates.length === 1)
|
|
194
|
-
return candidates[0];
|
|
229
|
+
if (candidates.length === 1) {
|
|
230
|
+
return { client_id: candidates[0].client_id, kind: selector.kind, name: candidates[0].name };
|
|
231
|
+
}
|
|
195
232
|
if (candidates.length === 0) {
|
|
196
|
-
throw new CliError(`No
|
|
233
|
+
throw new CliError(`No ${label} matching "${selector.name}". Run: every tool call ${tool} --json`, ExitCode.NOT_FOUND, 'not_found');
|
|
197
234
|
}
|
|
198
|
-
throw new CliError(
|
|
235
|
+
throw new CliError(partyCandidatesMessage(label, selector.name, candidates), ExitCode.NOT_FOUND, 'not_found', { candidates });
|
|
199
236
|
}
|
|
200
237
|
export async function invoiceListCommand(opts = {}) {
|
|
201
238
|
const args = {};
|
|
@@ -214,15 +251,24 @@ export async function invoiceCreateCommand(opts = {}) {
|
|
|
214
251
|
? 1
|
|
215
252
|
: parsePositiveNumber(opts.quantity, '--quantity');
|
|
216
253
|
const resolvedClient = await resolveClient(opts);
|
|
254
|
+
// A fresh operation_id per invocation, computed once here (not inside the args
|
|
255
|
+
// factory) so the one server-directed confirmation retry in tools.ts reuses this
|
|
256
|
+
// exact same closed-over `args` object/UUID instead of minting a second one.
|
|
217
257
|
const args = {
|
|
218
|
-
[
|
|
219
|
-
|
|
220
|
-
{
|
|
221
|
-
[
|
|
222
|
-
[
|
|
223
|
-
[LINE_ITEM_UNIT_PRICE_PARAM]: amount,
|
|
258
|
+
[CREATE_INVOICE_COMMAND_PARAM]: {
|
|
259
|
+
[CREATE_INVOICE_OPERATION_ID_PARAM]: randomUUID(),
|
|
260
|
+
[CREATE_INVOICE_PARTY_PARAM]: {
|
|
261
|
+
[PARTY_KIND_PARAM]: resolvedClient.kind,
|
|
262
|
+
[PARTY_ID_PARAM]: resolvedClient.client_id,
|
|
224
263
|
},
|
|
225
|
-
|
|
264
|
+
[CREATE_INVOICE_LINE_ITEMS_PARAM]: [
|
|
265
|
+
{
|
|
266
|
+
[LINE_ITEM_DESCRIPTION_PARAM]: opts.description ?? 'Services',
|
|
267
|
+
[LINE_ITEM_QUANTITY_PARAM]: quantity,
|
|
268
|
+
[LINE_ITEM_UNIT_PRICE_PARAM]: amount,
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
},
|
|
226
272
|
};
|
|
227
273
|
await executeToolCall('create_invoice', opts, async () => args, (data) => ({ ...data, resolved_client: resolvedClient }));
|
|
228
274
|
}
|
|
@@ -244,7 +290,8 @@ export async function dealMoveCommand(dealId, stage, opts = {}) {
|
|
|
244
290
|
export async function contactListCommand(opts = {}) {
|
|
245
291
|
const args = {};
|
|
246
292
|
if (opts.search !== undefined)
|
|
247
|
-
args
|
|
293
|
+
args[NETWORK_SEARCH_QUERY_PARAM] = opts.search;
|
|
248
294
|
addLimit(args, opts.limit);
|
|
249
|
-
|
|
295
|
+
// list_contacts is retired; list_people is the live People/Companies replacement.
|
|
296
|
+
await executeToolCall('list_people', opts, async () => args);
|
|
250
297
|
}
|
package/dist/index.js
CHANGED
|
@@ -163,10 +163,10 @@ const invoiceCommand = withToolExecutionOptions(withGlobalOptions(program
|
|
|
163
163
|
.addHelpText('after', [
|
|
164
164
|
'',
|
|
165
165
|
'Create a simple invoice:',
|
|
166
|
-
' every invoice create --
|
|
166
|
+
' every invoice create --company "Acme" --amount 100 --yes --json',
|
|
167
167
|
'',
|
|
168
168
|
'For rich invoices, use the full tool:',
|
|
169
|
-
' every tool call create_invoice --arg
|
|
169
|
+
' every tool call create_invoice --arg command=\'{"operation_id":"<uuid>","party":{"kind":"company","id":"<id>"},"line_items":[{"description":"Work","quantity":1,"unit_price":100}]}\'',
|
|
170
170
|
' every tool call create_invoice --args -',
|
|
171
171
|
' every tool call create_invoice --args file.json',
|
|
172
172
|
'',
|
|
@@ -174,8 +174,10 @@ const invoiceCommand = withToolExecutionOptions(withGlobalOptions(program
|
|
|
174
174
|
withGlobalOptions(withToolExecutionOptions(invoiceCommand
|
|
175
175
|
.command('create')
|
|
176
176
|
.description('Create a simple draft invoice')
|
|
177
|
-
.option('--client <name>', '
|
|
178
|
-
.option('--
|
|
177
|
+
.option('--client <name>', 'company name to resolve via list_companies (deprecated alias for --company)')
|
|
178
|
+
.option('--company <name>', 'company name to resolve via list_companies')
|
|
179
|
+
.option('--person <name>', 'person name to resolve via list_people')
|
|
180
|
+
.option('--client-id <id>', 'client id; skips name resolution')
|
|
179
181
|
.requiredOption('--amount <n>', 'unit price for the single line item')
|
|
180
182
|
.option('--description <text>', 'line item description')
|
|
181
183
|
.option('--quantity <q>', 'line item quantity'))).action(async (_options, command) => {
|
|
@@ -189,6 +191,8 @@ withGlobalOptions(withToolExecutionOptions(invoiceCommand
|
|
|
189
191
|
readOnly: opts.readOnly,
|
|
190
192
|
timeout: opts.timeout,
|
|
191
193
|
client: opts.client,
|
|
194
|
+
company: opts.company,
|
|
195
|
+
person: opts.person,
|
|
192
196
|
clientId: opts.clientId,
|
|
193
197
|
amount: opts.amount,
|
|
194
198
|
description: opts.description,
|
package/dist/lib/policy.js
CHANGED
|
@@ -58,6 +58,38 @@ function overrideClassification(name) {
|
|
|
58
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
59
|
};
|
|
60
60
|
}
|
|
61
|
+
// Deal tools (admin MCP, shipped 2026-09-03; create_client_deal renamed to
|
|
62
|
+
// create_delivery_deal in the 2026-09-09 People/Companies retirement). None
|
|
63
|
+
// match the send_/delete_/void_/cancel_ name patterns, so without these
|
|
64
|
+
// entries their tier would rest entirely on server annotations.
|
|
65
|
+
if (name === 'create_delivery_deal') {
|
|
66
|
+
return {
|
|
67
|
+
level: 'write',
|
|
68
|
+
source: 'override',
|
|
69
|
+
reason: 'create_delivery_deal opens a new won deal for a Person or Company and makes the caller its delivery lead; pin write tier regardless of server annotation drift.',
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (name === 'set_deal_title') {
|
|
73
|
+
return {
|
|
74
|
+
level: 'write',
|
|
75
|
+
source: 'override',
|
|
76
|
+
reason: 'set_deal_title renames a deal, or clears the name back to the system default; pin write tier regardless of server annotation drift.',
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (name === 'link_deal_item') {
|
|
80
|
+
return {
|
|
81
|
+
level: 'write',
|
|
82
|
+
source: 'override',
|
|
83
|
+
reason: 'link_deal_item attaches an invoice or proposal to a deal and can change how that deal is valued; pin write tier regardless of server annotation drift.',
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (name === 'unlink_deal_item') {
|
|
87
|
+
return {
|
|
88
|
+
level: 'destructive',
|
|
89
|
+
source: 'override',
|
|
90
|
+
reason: 'unlink_deal_item detaches an invoice or proposal from a deal and the automatic matcher never re-links it, so the relationship is gone for good; same destructive tier as end_affiliation.',
|
|
91
|
+
};
|
|
92
|
+
}
|
|
61
93
|
return undefined;
|
|
62
94
|
}
|
|
63
95
|
export function classify(tool) {
|
package/package.json
CHANGED
|
@@ -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,
|
|
3
|
+
description: Drive the Every AI CLI (`every`) to manage the user's service business — invoices, People, Companies, 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,
|
|
16
|
+
Use Every as a service-business workspace for the sales pipeline, deals, People and Companies, 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
|
|
|
@@ -71,7 +71,7 @@ Use `every whoami --json` to verify the authenticated user, org, environment, ba
|
|
|
71
71
|
|
|
72
72
|
### Deal activity auto-tracking is creation-only
|
|
73
73
|
|
|
74
|
-
Creating a proposal or invoice automatically records activity on a matching deal when exactly one deal/
|
|
74
|
+
Creating a proposal or invoice automatically records activity on a matching deal when exactly one deal/party (Person or Company) matches. After an Every creation command, never double-log that action:
|
|
75
75
|
|
|
76
76
|
```bash
|
|
77
77
|
every invoice create --client-id <client_id> --amount 100 --yes --json
|
|
@@ -85,7 +85,7 @@ every deal list --search "Acme" --json
|
|
|
85
85
|
every tool call log_deal_activity --arg deal_id=<deal_id> --arg note="Call completed; client approved scope" --yes --json
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
### Won deals require
|
|
88
|
+
### Won deals require a linked Person or Company
|
|
89
89
|
|
|
90
90
|
Pipeline stages are `lead`, `opportunity`, `won`, and `lost`:
|
|
91
91
|
|
|
@@ -93,7 +93,7 @@ Pipeline stages are `lead`, `opportunity`, `won`, and `lost`:
|
|
|
93
93
|
every deal move <deal_id> won --yes --json
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
Moving to `won` requires
|
|
96
|
+
Moving to `won` requires the deal to already be linked to a Person or Company. If the command errors because no party is assigned, assign one first (e.g. via `create_deal`'s `party`, or by updating the deal's target in the Every app), then retry the same command.
|
|
97
97
|
|
|
98
98
|
### Invoice rates and tax
|
|
99
99
|
|
|
@@ -101,7 +101,7 @@ Treat `unit_price` as the per-unit rate, not the line total. The simple CLI's `-
|
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
103
|
every invoice create --client-id <client_id> --description "Workshop" --quantity 3 --amount 100 --yes --json
|
|
104
|
-
every tool call create_invoice --arg client_id
|
|
104
|
+
every tool call create_invoice --arg command='{"operation_id":"<uuid>","party":{"kind":"company","id":"<client_id>"},"line_items":[{"description":"Workshop","quantity":3,"unit_price":100}]}' --yes --json
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
Leave `sales_tax_applied` unset so the business default applies. Never add tax as a line item. When currency, tax, or timezone matters, read settings first with `every tool call business_settings --json`; let Every compute tax, numbering, due dates, and totals.
|
|
@@ -140,7 +140,7 @@ Calendar tools operate on the user's personal calendar. Confirm attendees and ti
|
|
|
140
140
|
|
|
141
141
|
### Custom fields are schema, not events
|
|
142
142
|
|
|
143
|
-
`every tool call set_meta_fields ...` stores current state (e.g. a tracked boolean) on a
|
|
143
|
+
`every tool call set_meta_fields ...` stores current state (e.g. a tracked boolean) on a Person, Company, 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.
|
|
144
144
|
|
|
145
145
|
### Scheduled tasks report in-app, never in this session
|
|
146
146
|
|
|
@@ -207,11 +207,11 @@ Intake a new lead:
|
|
|
207
207
|
|
|
208
208
|
```bash
|
|
209
209
|
every contact list --search "person@example.com" --json
|
|
210
|
-
every tool call
|
|
210
|
+
every tool call create_person --args person.json --yes --json
|
|
211
211
|
every tool call create_deal --args deal.json --yes --json
|
|
212
212
|
```
|
|
213
213
|
|
|
214
|
-
Search
|
|
214
|
+
Search People first because email deduplication is real. Create only missing records, then progress the deal as the relationship develops.
|
|
215
215
|
|
|
216
216
|
For a general activity snapshot, combine complete/paginated invoice reads with recent payments and expenses. Use the currency from `business_settings`; if any source is only a partial page, describe it as recent activity rather than a definitive cash position.
|
|
217
217
|
|