kenso 0.1.116 → 0.1.117
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/kenso.js +166 -50
- package/dist/operations.index.json +1 -1
- package/dist/operations.json +1 -1
- package/docs/crm.md +91 -8
- package/docs/output-and-errors.md +3 -3
- package/docs/reference.md +13 -4
- package/package.json +2 -2
package/dist/kenso.js
CHANGED
|
@@ -2477,7 +2477,7 @@ var VERSION;
|
|
|
2477
2477
|
var init_version = __esm({
|
|
2478
2478
|
"src/core/version.ts"() {
|
|
2479
2479
|
"use strict";
|
|
2480
|
-
VERSION = true ? "0.1.
|
|
2480
|
+
VERSION = true ? "0.1.117" : "0.0.0-dev";
|
|
2481
2481
|
}
|
|
2482
2482
|
});
|
|
2483
2483
|
|
|
@@ -6829,7 +6829,7 @@ function preview(request, op) {
|
|
|
6829
6829
|
async function runEach(ctx, op, values, file, opts = {}) {
|
|
6830
6830
|
const args = eachArgs(op, opts.argValues ?? values, file);
|
|
6831
6831
|
const applyCommand = commandLine(op, args, ctx, ["--yes"]);
|
|
6832
|
-
if (op
|
|
6832
|
+
if (!isRead(op) && ctx.flags.yes !== true && ctx.flags.dryRun !== true) {
|
|
6833
6833
|
throw usageError(`--each sends one ${op.method} per row: add --yes to send them, or --dry-run to see the plan first.`, { field: "yes", next: applyCommand });
|
|
6834
6834
|
}
|
|
6835
6835
|
const input = await readInput(file, { stdin: ctx.stdin });
|
|
@@ -6893,6 +6893,7 @@ __export(execute_exports, {
|
|
|
6893
6893
|
helpFlagText: () => helpFlagText,
|
|
6894
6894
|
helpNotes: () => helpNotes,
|
|
6895
6895
|
isDestructive: () => isDestructive,
|
|
6896
|
+
isRead: () => isRead,
|
|
6896
6897
|
operationExamples: () => operationExamples,
|
|
6897
6898
|
operationFlags: () => operationFlags,
|
|
6898
6899
|
operationToCommand: () => operationToCommand,
|
|
@@ -6905,7 +6906,10 @@ function commandOf(op) {
|
|
|
6905
6906
|
return `kenso ${op.resource} ${op.action}`;
|
|
6906
6907
|
}
|
|
6907
6908
|
function isDestructive(op) {
|
|
6908
|
-
return op.method === "DELETE" || /(^|-)(delete|archive|remove)(-|$)/.test(op.action);
|
|
6909
|
+
return op.method === "DELETE" || /(^|-)(delete|archive|remove|merge)(-|$)/.test(op.action);
|
|
6910
|
+
}
|
|
6911
|
+
function isRead(op) {
|
|
6912
|
+
return op.method === "GET" || op.read === true;
|
|
6909
6913
|
}
|
|
6910
6914
|
function fileProps(op) {
|
|
6911
6915
|
return op.body?.format === "multipart" ? op.body.props.filter((p) => p.flag === "file") : [];
|
|
@@ -7028,7 +7032,7 @@ function operationExamples(op) {
|
|
|
7028
7032
|
const base = [commandOf(op), ...required].join(" ");
|
|
7029
7033
|
const upload2 = op.body?.format === "multipart" ? `${base} --file ./file.csv` : base;
|
|
7030
7034
|
const first = op.download ? `${upload2} --out ./${op.download.contentTypes.some((t) => t.includes("csv")) ? "export.csv" : "download"}` : upload2;
|
|
7031
|
-
const examples = op
|
|
7035
|
+
const examples = isRead(op) ? [first] : [`${first} --dry-run`, isDestructive(op) ? `${first} --yes` : first];
|
|
7032
7036
|
if (op.body && op.body.format !== "multipart") examples.push(`${base} --data @body.json`);
|
|
7033
7037
|
if (op.list) examples.push(`${base} --all`);
|
|
7034
7038
|
if (op.stream === "sse") examples.push(`${base} --until <event>`, `${base} --max-events 1`);
|
|
@@ -7296,7 +7300,10 @@ async function runOperation(ctx, op, flags) {
|
|
|
7296
7300
|
await writeFileResponse(ctx, res, { out, ...next ? { next } : {} });
|
|
7297
7301
|
return ExitCode.Ok;
|
|
7298
7302
|
}
|
|
7299
|
-
if (res.status === 204 || res.body === null || res.body === "")
|
|
7303
|
+
if (res.status === 204 || res.body === null || res.body === "") {
|
|
7304
|
+
ctx.output.object({ ok: true, status: res.status, request: { method: req.method, path: req.path } });
|
|
7305
|
+
return ExitCode.Ok;
|
|
7306
|
+
}
|
|
7300
7307
|
printWarnings(ctx, res.body);
|
|
7301
7308
|
if (op.list && isRecord3(res.body) && Array.isArray(res.body.data)) {
|
|
7302
7309
|
if (res.body.counts !== void 0) {
|
|
@@ -7360,11 +7367,11 @@ function operationToCommand(op) {
|
|
|
7360
7367
|
if (flag && !flags[alias]) flag.aliases = [alias];
|
|
7361
7368
|
}
|
|
7362
7369
|
const write2 = op.stream === "sse" ? `
|
|
7363
|
-
${STREAM_HELP}` : op.method === "GET" ? "" : isDestructive(op) ? "\nIt deletes, archives or
|
|
7370
|
+
${STREAM_HELP}` : op.method === "GET" ? "" : op.read === true ? "\nA read: it sends a body but changes nothing." : isDestructive(op) ? "\nIt deletes, archives, removes or merges, so it needs --yes (on a terminal it asks). Run it with --dry-run first." : "\nA write: it sends at once. Run it with --dry-run first, then without.";
|
|
7364
7371
|
const api = `API: ${op.method} ${op.path} (${op.id}).${write2}`;
|
|
7365
7372
|
const named = [...op.routeParams, ...op.queryParams].find((p) => p.flag !== p.name);
|
|
7366
7373
|
const keys = named ? `keys fill flags, by flag or API name: ${named.flag} or ${named.name}` : "keys fill flags";
|
|
7367
|
-
const rows = `Many rows: --each <file>, once per CSV or JSONL row (${keys}${op.body ? "; other keys the body" : ""}; --concurrency 1-16)${op
|
|
7374
|
+
const rows = `Many rows: --each <file>, once per CSV or JSONL row (${keys}${op.body ? "; other keys the body" : ""}; --concurrency 1-16)${isRead(op) ? "" : ", --dry-run then --yes"}.`;
|
|
7368
7375
|
const more = [
|
|
7369
7376
|
op.body ? "--data <json|@file|->: the body (flags win)." : "",
|
|
7370
7377
|
// The same text helpNotes measures, so the pointer shows only when something was left out.
|
|
@@ -7385,7 +7392,7 @@ ${api}` : api,
|
|
|
7385
7392
|
// (agents copy examples, and one with only --<id> flags led them to one call per row).
|
|
7386
7393
|
examples: [
|
|
7387
7394
|
...operationExamples(op).filter((e) => !e.endsWith(" --data @body.json")),
|
|
7388
|
-
...op
|
|
7395
|
+
...isRead(op) ? [] : [`${commandOf(op)} --each rows.csv --dry-run # a file of rows: one command`]
|
|
7389
7396
|
],
|
|
7390
7397
|
helpFooter: footer,
|
|
7391
7398
|
...op.featureGates ? { beta: { featureGates: op.featureGates } } : {},
|
|
@@ -8777,7 +8784,7 @@ var init_connect = __esm({
|
|
|
8777
8784
|
var crm_default;
|
|
8778
8785
|
var init_crm = __esm({
|
|
8779
8786
|
"docs/crm.md"() {
|
|
8780
|
-
crm_default = '# CRM (beta)\n\nThe CRM commands work on Kenso\'s Accounts lane: accounts (companies), the people on them, and opportunities. They are beta: they need the `accounts` feature flag on your workspace (opportunities need `opportunities`, CRM sync needs `ingestion`). Help and `kenso describe` hide them until your workspace has the flag; `--all-commands` shows them.\n\n| Command | What it does |\n|---|---|\n| `accounts import` | Create accounts from a CSV or JSONL file. Research is charged per created account |\n| `people import` | Create or match people from a file, optionally onto accounts |\n| `import accounts <file.csv>`, `import people <file.csv>`, `import deals <file.csv>` | Import a CSV export of another CRM, up to 50,000 rows: Kenso proposes the mapping, you approve once, it runs in the background and can be undone for 30 days |\n| `accounts update --each`, `people update --each`, `opportunities update --each` | Edit many records from a file, one call per row |\n| `accounts bulk-update`, `people bulk-update`, `opportunities bulk-update` | Set the same fields on many records at once, by ids or by a filter, with a preview first. Needs `bulk_edit` too |\n| `accounts bulk-delete`, `people bulk-delete`, `opportunities bulk-delete` | Delete many records at once, by ids or by a filter, with a preview first. Not undone. Needs `bulk_edit` too |\n| `changes list`, `get`, `rows`, `apply`, `cancel`, `undo` | Follow a bulk change, read what each record got, stop it, or put the old values back for 30 days |\n| `accounts write-research`, `people write-research` | Store research you gathered as a record\'s latest research, free. `--each` writes many |\n| `opportunities move <id> [--stage <key>] [--pipeline <pipelineId>] [--reason <key>]` | Move a deal to a stage or another pipeline, with its won or lost reason; a field the stage asks for never stops it |\n| `opportunities stage-history <id>` | A deal\'s stage history: each stage, when, who moved it and how long it sat there |\n| `notes list`, `notes add`, `notes edit`, `notes delete` | Notes and comments on accounts, people and deals (needs `record_notes`) |\n| `deleted-accounts list`, `accounts restore <id>` | The accounts deleted in the last 30 days, and bringing one back |\n| `accounts duplicates`, `accounts merge <id> --into <id>`, `accounts merges list` | The pairs that look like one company, merging a pair, and the log of merges |\n| `export <accounts\\|people\\|deals>` | The list as CSV: everything, a saved view (`--view <id>`), or what the filters match |\n| `capture status` | Your captured mailbox, its backfill progress and what teammates see of a captured email. Needs the `crm_capture` flag |\n| `capture connect` | Turn capture on for your own mailbox. `--private` starts it hidden from teammates; `--provider google` prints a sign-in link when no account is connected yet |\n| `capture private on\\|off` | Hide your captured email from teammates, or show it again. Email only: meetings stay visible. `--thread <id>` sets the switch for one thread |\n| `capture thread <threadId>` | One captured email thread: subject, people, time, Ken\'s summary, the members whose mailboxes hold it, and each body you may open. The id is `capturedThread.id` on a timeline row |\n| `views pin <viewId>`, `views unpin <viewId>` | Pin a saved view to your own sidebar, or take it off. Needs the `shared_views` flag |\n| `capture sync` | Read your captured mailbox now, instead of waiting for the next two-minute poll. Prints what the pass read, logged and created |\n| `capture disconnect` | Turn capture off and delete your stored email bodies. Asks first; `--yes` skips the question |\n| `capture teammates-see summary\\|full_email` | Workspace admin: what teammates see of captured email |\n| `pipelines stage-rules` | List or set the fields a deal should have in each stage |\n| `opportunity-reasons get`, `opportunity-reasons replace` | List or edit why deals are lost and won |\n| `layouts show\\|set\\|reset <object>` | How every account, person or deal page in the workspace lays out its fields: header, rail sections and hidden fields (needs `record_layout`) |\n| `crm-connections`, `crm-imports`, `crm-sync-issues` | Read and run CRM sync. Connecting a CRM stays in the app |\n| `tasks add`, `tasks done`, `tasks assign`, `tasks queue` | Add a to-do for a member on an account, person or deal, complete it, hand it on, or read your open work (needs `tasks`) |\n\nImport accounts first, then people: `people import` never creates an account.\n\n## Import accounts\n\n```bash\nkenso accounts import --file accounts.csv\nkenso accounts import --file accounts.csv --yes\n```\n\n```csv\nname,domain,industry,employeeCount\nAcme,acme.io,Software,120\nGlobex,globex.com,Manufacturing,"1,200"\n```\n\n- **Columns** map by name, ignoring case, spaces and dashes: `name` (or `company`, `companyName`, `accountName`), `domains` (several, split on `,` or `;`) or one `domain` (or `website`, `companyDomain`), `industry`, `employeeCount`, `hqLocation`, `linkedinUrl`, `stage`, `angle`, `whyNow`, `fitScore`, `fundingRound`, `cadenceDays`, `ownerMemberId`, `kenCompanyId`, `sendsFromInboxId`, `sendsFromLinkedInAccountId` and `source`.\n- **A domain is required.** A file with no domain column is a usage error, and a row without a domain is `invalid` (`domain_required`).\n- **The dry run prices the research.** It asks for a credit estimate per 1,000 accounts and puts the sum in the plan: `kind`, `accountCount`, `totalMillicredits`, `availableMillicredits` and `sufficient`.\n- **Rows go 100 per call** to `POST /v1/accounts/bulk-create`.\n\nEach row comes back `created` (`id` is the new account; its research is queued, `researchQueued`, or waits for credits, `researchWaitingCredits`), `skipped` with reason `domain_taken` (already an account; `id` is that account) or `failed` (`reason` is the API\'s code, `error` names the field; an item Kenso failed to save is sent once more first). Rerunning the same file is safe: accounts that exist come back `domain_taken`.\n\n## Import people\n\n```bash\nkenso people import --file people.csv\nkenso people import --file people.csv --find-emails --yes\nkenso people import --file people.jsonl --dry-run\n```\n\n```csv\nfullName,email,title,accountDomain,role\nAnn Lee,ann@acme.io,VP Sales,acme.io,champion\nBob Ray,,CTO,acme.io,\n```\n\n- **Columns** map by name, ignoring case, spaces and dashes: `email`, `fullName` (or `name`), `firstName`, `lastName`, `title`, `linkedinUrl` (or `linkedin`, `profileUrl`), `accountDomain` (or `domain`, `website`, `companyDomain`), `accountId`, `role` and `priority`. Other columns are ignored with one warning.\n- **A person needs a name:** `fullName`, or `firstName`, `lastName` or both (the CLI joins them). A row with none of them is `invalid` (`name_required`).\n- **To put a person on an account,** give `accountDomain` or `accountId`. A row with both sends only `accountId`.\n- **`--find-emails`** queues an email find (charged in credits) for each person without an email.\n- **Rows go 200 per call** to `POST /v1/people/batch`.\n\nPeople already in the workspace are matched by email, then LinkedIn URL, so running the same file again creates nobody twice. A row comes back `created` (a new person), `updated` (an existing person added to the account), `skipped` with reason `already_on_account`, `matched` (no account asked) or `previously_removed`, or `failed`: `account_not_found` saves the person without an account (import the account, then rerun to place them), any other reason is the API\'s. The summary adds `matched`, `addedToAccounts` and `emailFindsQueued`.\n\n## List and search accounts\n\n`accounts list` and `accounts search` sort and page on the server, so they reach every account in the workspace, however many there are.\n\n```bash\nkenso accounts list --sort score:desc --limit 100 # one page; the output\'s next: line is the following one\nkenso accounts list --sort score:desc --limit 100 --all # every page, to the end\nkenso accounts search --search hiring --sort latestSignalAt:desc --data \'{"qFields": ["name", "latestSignal"]}\'\nkenso accounts search --limit 1 --data \'{"countBy": ["stage"]}\' # how many accounts sit in each stage\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "tier", "operator": "is", "values": ["1"]}]}, "sort": "tier,-pipelineAmount"}\' --all\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "hqLocation", "operator": "contains", "values": ["Germany"]}]}}\' --all\n# my accounts with a meeting this quarter: me is whoever runs it, so a saved view with it lists each member\'s own\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "owner", "operator": "is", "values": ["me"]}, {"field": "lastMeeting", "operator": "in_period", "values": ["this_quarter"]}]}}\' --all\n# tier 1 accounts with no meeting in 30 days: none since then, or none ever\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "tier", "operator": "is", "values": ["1"]}, {"match": "any", "conditions": [{"field": "lastMeeting", "operator": "older_than_days", "values": ["30"]}, {"field": "lastMeeting", "operator": "is_empty"}]}]}}\' --all\n```\n\n- **`--sort`** takes up to 3 comma-separated keys, each `field` (ascending), `field:asc` or `field:desc`. The API\'s `-field` form needs the equals sign here, `--sort=-score`, because a value that starts with a dash reads as a flag. Fields: `createdAt`, `name`, `score`, `tier` (ascending is tier 1 first), `latestSignalAt`, `committee`, `pipelineAmount`, `nextTouchAt`, `lastTouchAt`. An account with no value for a key comes last in both directions. The default is `-createdAt`.\n- **`--limit`** is 1 to 1000 (default 50). `--cursor` takes the previous page\'s `nextCursor` with the same filters and sort; `--all` follows the cursors for you.\n- **`--search`** (also `--q`) matches the name or a domain.\n- **Lists and objects go in `--data`** on `search`, as the API takes them (`kenso describe accounts search`); a flag beside it sets or replaces one key:\n - `qFields` picks where the search text looks: `name`, `domain`, `latestSignal` (the latest signal\'s title).\n - `countBy` (`stage`, `stageGroup`) adds `counts` to the output: every value with the number of matching accounts that hold it, whatever the page. The output is then one object: `data`, `pagination` and `counts`.\n - `filters` and `where` narrow the accounts.\n\nAn account\'s timeline pages the same way. `kenso accounts activity 812` returns the newest 100 earlier rows and, when older ones exist, `data.nextCursor`. Pass it back as `--cursor` (with the same `--category`) for the rows before them, until a page comes without one.\n\n## Edit accounts, people and opportunities\n\nTo set the same fields on many records, use `bulk-update` (below; it needs the `bulk_edit` flag). When every row gets its own values, or the workspace has no `bulk_edit`, run the generated `update` command once per row with `--each`. Columns are the command\'s flags by API name or flag name, and the id column fills the route:\n\n```bash\nkenso accounts update --each accounts-edit.csv --dry-run # then the same with --yes\nkenso people update --each people-edit.csv --dry-run\nkenso opportunities update --each deals.csv --dry-run\n```\n\n```csv\naccountId,stage,ownerMemberId,overwritePinned\n501,engaged,42,true\n502,customer,42,true\n```\n\nA row that changes a field someone pinned in the app fails as a whole (`409 conflict`, `pinned_by_user`: nothing on that record changes, the other fields of the row included), unless the row sets `overwritePinned` to `true` (or you pass `--overwrite-pinned`, only with the person\'s OK). Every flag of an update command: `kenso accounts update --help`.\n\n## Change many accounts at once\n\n```bash\nkenso accounts bulk-update --filter \'{"filters":[{"field":"stage","operator":"is","values":["new"]}]}\' --set owner=42 --dry-run\nkenso changes apply --change-id 31\nkenso accounts bulk-update --ids 812,813 --set stage=engaged --set tier=2 --yes\nkenso changes get --change-id 31\n```\n\n`accounts bulk-update` sets the same fields on every account you name: `--ids` (1,000 at most), everything a `--filter` matches (the body `kenso accounts search --data` takes: `filters`, `where`, `q`; up to 50,000), or `--all`. A filter that holds only options and no condition (`--filter \'{"includeImportOnly":true}\'`) takes `--all` beside it. `--exclude-ids` leaves some of a filter\'s accounts out. `--set field=value` takes `ownerMemberId` (or `owner`), `stage`, `tierOverride` (or `tier`), `industry`, `fundingRound`, `employeeCount`, `hqLocation` and `cadenceDays`, and a custom field as `custom.<key>` (`--set custom.region=EMEA`; `kenso api GET \'/v1/fields?object=account\'` gives the keys); a value of `null` clears the field. `--add-tag 12,14` and `--remove-tag 13` put tags on every account or take them off (`kenso tags list` gives the ids); each tag is one row per account from `false` to `true` or back, so `kenso changes undo` takes off only the tags the change put on. People take them too; deals have no tags. A text field\'s value is sent as you type it (`--set hqLocation=10001` is the text "10001"); a custom field\'s type is not known to the CLI, so quote its text when it reads as a number or as true or false: `--set \'custom.code="10001"\'`. Use `accounts update --each` when every row gets its own values.\n\nIt makes a change set: the accounts it names and, for each, the field, its value before and its value after. Without `--yes` (or with `--dry-run`) it previews: it prints `count` and a `sample`, writes nothing, and `next` is the `kenso changes apply` command that writes exactly those accounts. With `--yes` it writes in the background and waits (`--timeout`, default 10m), then prints the change with its `counts`: `applied`, `unchanged` (already had the value), `conflict` (the account changed after the preview, so it was left alone) and `failed` (for example `pinned`: a person set the field by hand; `--overwrite-pinned` replaces it). Exit 5 when some accounts failed or conflicted. It needs the `bulk_edit` flag as well as `accounts`.\n\n`kenso accounts bulk-update` used to be the generated command for the route\'s older one-field body, which sets one `accountType` on up to 500 accounts and needs only `accounts`. The route still takes that body, but this command no longer sends it: use `kenso accounts update --each` with an `accountType` column, or `kenso api POST /v1/accounts/bulk-update --data \'{"accountIds":[812,813],"accountType":"lost"}\'`.\n\n`people bulk-update` and `opportunities bulk-update` work the same way. People take `--set` for `ownerMemberId` (or `owner`), `leadStatus`, `title`, `seniority`, `department` and `location`, and a `--filter` of `kenso people search --data` fields (`leadStatus`, `roles`, `tagIds`, `q` and the rest). Deals take `stage` (a live stage key), `ownerMemberId` (or `owner`), `closeDate` (or `close`), `amount`, `dealType` and `nextStep`, and a `--filter` of `kenso opportunities search --data` fields (`filters`, `accountId`, `q`):\n\n```bash\nkenso opportunities bulk-update --filter \'{"filters":[{"field":"stageCategory","operator":"is","values":["open"]}]}\' --set stage=proposal --dry-run\nkenso people bulk-update --ids 501,502 --set owner=42 --yes\n```\n\n### Delete many records at once\n\n```bash\nkenso people bulk-delete --filter \'{"onAccount":"none","leadStatus":["disqualified"]}\' --dry-run\nkenso changes apply --change-id 32\nkenso opportunities bulk-delete --ids 71,72,73 --yes\n```\n\n`accounts bulk-delete`, `people bulk-delete` and `opportunities bulk-delete` name their records the way `bulk-update` does (`--ids`, `--filter`, `--all`, `--exclude-ids`) and take no `--set`. Without `--yes` they preview: `count`, a `sample`, and `next` is the `kenso changes apply` command that deletes exactly those records. The API itself previews a delete whose body leaves `dryRun` out, so `--yes` sends `dryRun: false`. Each record is deleted as its own `delete` command deletes it, so one that cannot be deleted (a person still on an account) is counted as `failed` and the rest go on. A delete is not undone with `kenso changes undo`.\n\n### Follow, stop and undo a change\n\n```bash\nkenso changes list --object accounts\nkenso changes rows --change-id 31 --status conflict,failed\nkenso changes cancel --change-id 31\nkenso changes undo --change-id 31\n```\n\n`changes list` shows the workspace\'s bulk changes, newest first, whoever made them. `changes rows` lists a change\'s records with the value before (`from`) and after (`to`) and a `status`; `--status conflict,failed` reads what a change missed. `changes cancel` drops a preview or stops a change that is still writing; what it already wrote stays. `changes undo` puts the old value back on every record that still holds the value the change wrote, for 30 days after it was applied (`undoUntil`). A record someone changed again since keeps its newer value: `counts.undone` is how many went back, `counts.applied` how many still hold the change. Undo answers `409 invalid_state` with `undo_expired`, `still_running`, `nothing_applied` or `not_undoable` when there is nothing it can put back.\n\n## Search opportunities\n\n`kenso opportunities search` works as `accounts search` does: it takes `--search`, `--sort`, `--limit`, `--cursor`, `--all`, and its lists in `--data`.\n\n```bash\nkenso opportunities search --data \'{"filters": [{"field": "stageCategory", "operator": "is", "values": ["open"]}]}\' --all\nkenso opportunities search --data \'{"filters": [{"field": "ownerMemberId", "operator": "is", "values": ["none"]}, {"field": "closeDate", "operator": "is", "values": ["past_due", "next_30_days"]}]}\'\nkenso opportunities search --limit 1 --data \'{"countBy": ["stage", "ownerMemberId"]}\' # how many opportunities hold each value\n```\n\n- **`filters`** is a list of `{field, operator, values}`, all of which must hold. Fields: `stage` (a stage key), `stageCategory` (`open`, `won`, `lost`), `ownerMemberId` (member ids, or `me` for whoever runs it), `closeDate` (`past_due`, `next_30_days`, `later`, `none`, or a period such as `this_week` or `next_quarter`), `sourceCampaignId`, `closedAt` and `createdAt` (periods). `operator` is `is` or `is_not`; the values of one condition are OR. `none` in `values` matches an opportunity with no owner, no source campaign or no close date.\n- **`countBy`** takes the same field names and adds `counts` to the output: per field, every value with the number of matching opportunities that hold it.\n- `--account-id` keeps the search to one account. `closeDate` counts days in the member\'s app time zone.\n\nOne person\'s deals, meetings and campaign contacts, as their person page lists them:\n\n```bash\nkenso opportunities list --person-id 9001 # the deals they are on, or are the primary person of\nkenso meetings list --person-id 9001 # the meetings they attend, among the ones you can see\nkenso contacts list --person-id 9001 # their contact in each campaign they are in\n```\n\n## Write research you gathered\n\n`accounts write-research` and `people write-research` store research you gathered outside Kenso as the record\'s latest research (`PUT /v1/accounts/{accountId}/research`, `PUT /v1/people/{personId}/research`). The Research tab shows it like a Ken run, with `trigger: agent` and `researchedAt` now. Nothing is charged, and no account or person field changes: set an account\'s own `fitScore`, `whyNow` or `angle` with `accounts update`. They need the `accounts_research` flag and accounts edit.\n\nThe body is the research block `accounts get --expand research` (or `people get-research`) returns, without its read-only fields: leave out `id`, `status`, `trigger`, `errorCode`, `researchedAt`, `isStale` and `appliedPrompt` (for a person also `mode`, `requestedAt`, `researchedMode`, `firecrawlCredits` and `webNote`), or the write fails with `unknown_field`. Pass it with `--data @file`:\n\n```bash\nkenso accounts write-research --account-id 501 --data @acme-dossier.json\nkenso people write-research --person-id 9001 --data @jane.json\n```\n\n```json\n{\n "tagline": { "text": "Payroll for EU contractors", "sourceUrls": ["https://acme.example"] },\n "description": { "text": "Acme runs payroll and compliance for companies hiring contractors in 30 EU countries.", "sourceUrls": ["https://acme.example"] },\n "links": { "website": "https://acme.example" },\n "whyNow": { "text": "Raised a $40M Series B in October", "sourceUrls": ["https://news.example/acme-b"], "date": "2026-10" },\n "fitScore": 82,\n "angle": "Lead with contractor onboarding time."\n}\n```\n\nMany records: one JSONL line per record, with the id next to the block\'s fields. Nested objects are sent as written. Use JSONL, not CSV: the block\'s fields are objects and lists, which a CSV cell cannot carry.\n\n```bash\nkenso accounts write-research --each dossiers.jsonl --dry-run # then the same with --yes\nkenso people write-research --each people-research.jsonl --yes --concurrency 8\n```\n\n```jsonl\n{"accountId": 501, "tagline": {"text": "Payroll for EU contractors"}, "links": {"website": "https://acme.example"}}\n{"accountId": 502, "description": {"text": "Cloud cost tooling for retailers."}, "links": {"website": "https://beta.example"}}\n```\n\nA row fails as a whole with the API\'s code: `validation_failed` (an unknown field is `unknown_field`, and `error.details` names every bad field), `research_in_progress` (`409`: Ken is researching that record now, write it again once the run ends; an account run waiting for credits counts too: it runs once the workspace has credits, and the write stays refused until that run ends) or `not_found`. Rerunning a file is safe: each write replaces the record\'s research shown.\n\n## CRM sync\n\nCRM sync has generated commands only: read connections, preview, start an import, and work through sync issues. Connect the CRM itself in the app.\n\n```bash\nkenso crm-connections list\nkenso crm-connections get --connection-id 7\nkenso crm-imports create --connection-id 7 --dry-run\nkenso crm-sync-issues list --connection-id 7 --all\n```\n\nRun `kenso crm-connections --help` (or add `--all-commands` when the actions are hidden) to see every action.\n\n## Pipelines\n\nA workspace with the `pipelines` flag on can run several deal pipelines, each with its own stages. These are generated commands (beta):\n\n```bash\nkenso pipelines list\nkenso pipelines list --query "[].{id: id, name: name, default: isDefault, stages: stages[].key}"\nkenso pipelines get --pipeline-id 5\n```\n\n`list` prints every pipeline in display order, archived ones included: `id`, `name`, `routingRule` (the one sentence Ken reads to decide whether a new deal belongs there), `isDefault`, `isArchived`, `position`, `opportunityCount`, `amountTotal` and `stages`, each stage as `kenso opportunity-stages list` prints it. A stage key is unique in the workspace, across pipelines, so a deal\'s `stage` names its pipeline and its `pipelineId` repeats it. The first read turns the workspace\'s stage list into its default pipeline, named Sales, with every deal in it. The same rows as the MCP\'s `pipelines(operation="list")`.\n\nShaping them needs the `workspace_settings` permission:\n\n```bash\nkenso pipelines create --name Renewals --routing-rule "The account is already a customer" --data \'{"stages": [{"label": "Up for renewal", "category": "open"}, {"label": "Won", "category": "won"}, {"label": "Lost", "category": "lost"}]}\'\nkenso pipelines update --pipeline-id 6 --name Expansion --position 0\nkenso pipelines update --pipeline-id 6 --data @stages.json\nkenso pipelines archive --pipeline-id 6\nkenso pipelines restore --pipeline-id 6\nkenso pipelines propose --description "upsells and renewals for customers"\n```\n\n- **`create`** takes a unique `name`, the pipeline\'s `stages` in display order (at least one `open`, one `won` and one `lost`) and an optional `routingRule`: one sentence that says which deals belong there, which Ken reads to route a new deal that names no pipeline. Each stage gets a key from its label; a key another pipeline already uses gets the pipeline\'s name in front (`renewals_won`). A workspace has at most 10 pipelines.\n- **`update`** changes what you send. `stages` is the pipeline\'s whole stage list: read it with `pipelines get`, keep each stage\'s `key`, and add a new stage without one. A stage with live deals in it cannot be left out; archive it with `"isArchived": true` instead.\n- **`propose`** asks Ken to draft a pipeline from one sentence: a `name`, a `routingRule` and `stages`, in the shape `create` takes. It saves nothing. Read it, change what you want, and send it to `create`.\n- **`archive`** stops new deals from entering a pipeline and keeps the deals in it. The default pipeline cannot be archived, and nothing is deleted: `restore` brings a pipeline back.\n\n## Deals in a pipeline\n\nA deal\'s stage names its pipeline, and the deal\'s `pipelineId` repeats it. To work one pipeline\'s deals, or move a deal between pipelines:\n\n```bash\nkenso opportunities list --pipeline-id 6\nkenso opportunities search --pipeline-id 6 --data \'{"countBy": ["stage"]}\'\nkenso opportunities create --account-id 501 --pipeline-id 6\nkenso opportunities move 77 --pipeline 6\nkenso opportunities move 77 --pipeline 6 --stage negotiating\n```\n\n- **`create --pipeline-id`** opens the deal in that pipeline\'s first live open stage. Without it, and without a `stage`, Ken reads each pipeline\'s `routingRule` and opens the deal in the pipeline whose rule clearly fits the account, else in the default pipeline. A pipeline you name always wins.\n- **`move --pipeline`** alone keeps the deal\'s category (`open`, `won` or `lost`): it lands in that pipeline\'s live stage of the category with the same label as its stage now, else in the category\'s first live stage. The printed deal says where it landed. With `--stage`, the stage must be that pipeline\'s; the error lists the pipeline\'s stage keys otherwise.\n- An archived pipeline takes no deal from another pipeline (`pipeline_archived`). The deals already in it still move between its stages.\n- A move is a stage change: it writes the same history, and a stage a person set is refused with `pinned_by_user` unless you pass `--overwrite-pinned`.\n\n## Restore a deleted account\n\n```bash\nkenso deleted-accounts list\nkenso accounts restore 812\n```\n\nA deleted account can be restored for 30 days. `deleted-accounts list` shows each one with who deleted it, `expiresAt` (restore works until then) and what comes back: `personCount`, `opportunityCount` and `touchCount`. `accounts restore <id>` brings the account back with its domains, its people, its deals and its planned touches, which wait for approval again. A domain another account took since stays with that account and is listed in `domainsTaken`. A merged account is not listed and cannot be restored: a merge has no undo. Both commands are behind the `crm_import_export` feature flag (`404` while it is off).\n\n## Import a CSV export of another CRM\n\n```bash\nkenso import accounts companies.csv\nkenso import accounts companies.csv --map "Company=name" --map "Notes=" --yes\nkenso import accounts --id 42 --yes\nkenso record-import-rows list --import-id 42 --outcome skipped\nkenso record-imports undo --import-id 42\n```\n\n`kenso import accounts <file.csv>` uploads the file (a header row, at most 50,000 rows) and prints Kenso\'s plan: which field each column fills, which columns it skips, how owner and stage values are read (`valueMaps`) and what it could not settle (`questions`). Headers of Kenso, Twenty, HubSpot, Attio and Salesforce exports are recognized. Nothing is written to your accounts yet. `--map "Header=field"` changes a column and `--map "Header="` skips it. A column fills a custom field with `--map "Header=custom.<key>"` (`kenso fields list --object account` has the keys; people are `person`, deals `opportunity`), and `--map "Header=new"` adds the custom field Kenso proposes for a column no field matches (`new:text` picks the type), and a column whose header is a custom field\'s label is mapped to it already; owner and stage values change with `kenso record-imports update --import-id <id>`.\n\nWith `--yes` the import starts and the command waits for it (`--timeout`, default 30m; the import keeps running on the server either way), then prints how many rows were created, updated, restored, left unchanged and skipped. Without `--yes` it stops at the plan and prints the command that starts that import (`--id <importId> --yes`), so the file is uploaded once. `--dry-run` sends nothing: with a file it prints the upload it would make, since the plan needs the upload, and with `--id` it reads the planned import and prints what `--map`, `--source` and `--research` would change on it. `--source twenty` names the system the file\'s record ids come from: pass the same one for every file of an export, so the people and deals files find the accounts by their old ids. `kenso record-imports delete --import-id <id>` discards an import that was planned and never started; one left planned for 30 days is discarded by itself.\n\nPer row: a domain no account has creates an account; a domain that is already an account fills only that account\'s empty fields, so nothing you entered is overwritten; an account deleted in the last 30 days is restored; a row with no usable domain is skipped, and `kenso record-import-rows list --import-id <id> --outcome skipped` says why. Research of new accounts is off unless you pass `--research`, which is charged per account. It needs the `accounts` and `crm_import_export` flags. This is a different command from `accounts import`, which creates accounts row by row from the machine running the CLI.\n\n`kenso record-imports undo --import-id <id>` takes a finished import back in the background (`kenso record-imports get --import-id <id>` reads `undoing`, then `undone`): an account the import created is deleted, and can be restored for 30 days, unless someone changed it since, it holds a deal, a person was added to it since, or it was merged; a field the import filled is emptied while it still holds the imported value. `kenso record-import-rows list --import-id <id>` shows each row\'s `undoOutcome`.\n\n`kenso import people <file.csv>` works the same way for people. Import the accounts file first: a people row\'s company id (Twenty\'s `Company Id`, HubSpot\'s associated company id) places the person on the account that kept that id, and without one the person goes on the account that holds their email\'s or company\'s domain. A people import never creates an account; a person whose company is no account comes in without one and the row says so. A row matches a person by email, then LinkedIn URL, then name on the company, as every other way into People does; a matched person gets only their empty fields filled (a phone only when they have none). A row with none of the three is skipped, and a row with only a name needs a company that is an account with a domain. `kenso record-imports undo --import-id <id>` takes a people import back too: a person it created leaves the accounts the row placed them on and is deleted, unless someone changed them since, they were contacted or have a touch planned, or they are on an open deal; a field it filled is emptied while it still holds the imported value. `kenso people import` stays the JSONL and enrichment path (`--find-emails`); `kenso import people` is the CRM file with a plan, a row report and one approval.\n\n`kenso import deals <file.csv>` works the same way for deals, after the accounts file and the people file. A row opens a deal on the account that kept its company id (Twenty\'s `Company Id`, HubSpot\'s associated company id), else on the account that holds its company domain; a row whose account Kenso does not know is skipped and says so. Its contact is the person a people import kept the row\'s contact id for (Twenty\'s `Point of Contact Id`). The plan maps each stage in the file to one of the workspace\'s deal stages (`valueMaps`, field `stage`): a stage\'s key or label matches by itself, Closed Won and Closed Lost go to the first won and lost stage, and a value with no match opens in the first open stage until you pick one with `kenso record-imports update`. Amounts stay in the workspace currency: an amount in another currency is left out with a warning, never converted. A row whose deal id an earlier import kept is that deal and only gets its empty fields filled; a file with no id column opens every deal again each time it is imported, and the plan says so (`no_source_id`). `kenso record-imports undo --import-id <id>` takes a deals import back: a deal it opened is deleted unless someone changed it since, and a field it filled is emptied while it still holds the imported value. Undo in the reverse order of the imports (deals, then people, then accounts): an account that holds a deal is kept.\n\n## Export accounts, people or deals\n\n```bash\nkenso export accounts --out accounts.csv\nkenso export accounts --view 12 --out tier-1.csv\nkenso export deals --view 40 --out pipeline.csv\nkenso export deals --filters \'[{"field":"stageCategory","operator":"is","values":["open"]}]\' > open-deals.csv\n```\n\nIt writes the CSV that `POST /v1/accounts/export`, `/v1/people/export` or `/v1/opportunities/export` returns, to stdout or to `--out` (then it prints the file and its row count). With no filter it exports every record. More than 50,000 rows is refused: narrow the filters. `--view <id>` exports a saved view of that object, your own or one shared with the workspace (`kenso views list --object account` shows the ids; people are `person`, deals `opportunity`): the file holds the rows the view lists, in its sort, so its row count is the view\'s count. `--filters`, `--where` (accounts), `--q` and `--sort` are the search operation\'s own fields; given with `--view`, each replaces that key of the view. The accounts and deals files start with `id` and import back as they are. Each export writes an audit-log entry and needs the export permission. Accounts and deals also need the `crm_import_export` flag while it is in beta.\n\n## Duplicates and merges\n\n```bash\nkenso accounts duplicates --scan\nkenso accounts merge 812 --into 77 --dry-run\nkenso accounts merge 812 --into 77 --yes\nkenso accounts merges list --merged-by system\nkenso accounts merges 41\n```\n\nThese need the `crm_import_export` flag beside `accounts`. `accounts duplicates` lists the pairs of accounts that look like one company: both accounts, why they were paired (`reasons`: `domain`, `linkedin`, `name`) and `isCertain`, true when the two share the name and the domain apart from its ending (acme.com and acme.co). `--scan` compares every account first; a scan also runs after each accounts import. `--status dismissed` or `merged` shows the answered pairs. `kenso account-duplicates dismiss --duplicate-id <duplicateId>` answers that a pair is not a duplicate, for good.\n\n`accounts merge <accountId> --into <id>` merges the first account into the second, the one you keep. A merge cannot be undone, so look first: `--dry-run` prints `mergeSummary` (each field that changes with its value before and after, and how many people, deals, touches and domains move) and writes nothing. The merge itself needs `--yes` when no person is at the terminal. It answers the kept account with the same summary and a `mergeId`.\n\n`accounts merges list` is the log, newest first, and `accounts merges <mergeId>` opens one merge with `mergedValues`: the merged-away account as it was. `--merged-by system` shows the merges Ken made itself. Where automatic merging is on for the workspace, Ken merges only certain pairs, keeps the customer, then the owned, then the last touched account, and leaves a pair for you when both are customers, the two have different owners, or one is being worked and the other is set aside (`heldReason` on the pair says which). That job is off unless it was turned on for the workspace.\n\n## A deal\'s stage history\n\n```bash\nkenso opportunities stage-history 77\nkenso opportunities stage-history 77 --query "entries[].{to: stageLabel, at: enteredAt, by: changedBy}"\n```\n\nIt prints `GET /v1/opportunities/{id}/stage-history` as it is, the same rows as the deal page and the MCP\'s `opportunities(operation="get-stage-history")`: the stage now, `isComplete` and `entries`, oldest first, each with `fromStage`, `stage`, `stageLabel`, `enteredAt`, `leftAt`, `durationSeconds`, `actorKind`, `actorMemberId` and Ken\'s `reason` on a move its stage judge made. With the `deal_stage_rules` flag on, each entry also has `changedBy` (`member`, `agent`, `api_key`, `workflow`, `stage_judge`, `crm_sync` or `ken_automation`), `crmProvider` on a CRM sync, and on a move `fromStageLabel` and `fromStageDurationSeconds`, how long the deal sat in the stage it left. `isComplete` false means Kenso has no record of part of the history.\n\n## Notes on accounts, people and deals\n\nWith the `record_notes` feature on, everyone who can see a record reads its notes. Name the record with exactly one of `--account`, `--person` and `--deal`:\n\n```bash\nkenso notes list --account 5\nkenso notes add --account 5 --body \'Budget approved, @[Jane Doe](41) please send the DPA\'\nkenso notes add --parent 900 --body \'Sent it this morning\' # a comment under note 900\ncat call-notes.md | kenso notes add --deal 77 --body - # the body from stdin\nkenso notes edit 900 --body \'Budget approved for Q1\' # the author only\nkenso notes edit 900 --pin\nkenso notes delete 900 --yes # kenso notes restore 900 brings it back\n```\n\nThe body is markdown, up to 20,000 characters. Mention a teammate as `@[Name](memberId)`: they get a notification that opens the note. A note shows on the record\'s Notes tab and its Activity timeline, and Ken\'s account brief quotes the account\'s notes. The MCP\'s `notes` tool does the same. A note on an account needs the accounts plan feature; people and deals work on every plan.\n\n## Required fields per stage\n\n```bash\nkenso pipelines stage-rules\nkenso pipelines stage-rules proposal --require amount,closeDate,custom.tier\nkenso pipelines stage-rules proposal --none\nkenso pipelines stage-rules lost --default\n```\n\nWith the `deal_stage_rules` flag on, each stage can name the fields a deal should have in it. Without a stage the command prints every stage\'s `key`, `label`, `category`, `isArchived`, `requiredFields` and `isDefault`, plus `requirableFields`: `amount`, `closeDate`, `ownerMemberId`, `primaryPersonId`, `nextStep`, `lostReasonKey`, `wonReasonKey` and `custom.<key>` for each custom deal field. `--require` sets the stage\'s whole list, in order, at most 10. `--none` requires nothing, and `--default` goes back to the default: a lost stage asks for `lostReasonKey`, any other stage nothing. Setting a rule needs the `workspace_settings` permission. The same as the MCP\'s `opportunities(operation="stages-set-required-fields")`.\n\nA missing field never stops a move. The deal moves, and it is flagged Missing on the board, the list and the deal page until the field is filled. A rule also applies to deals already in the stage.\n\n```bash\nkenso opportunities update --opportunity-id 4401 --stage proposal\nkenso opportunities list --missing-fields\n```\n\nEvery deal then carries `missingFields` (`[{field, label}]`). A create, or an update that sends a stage, answers `warnings` beside the deal for each field the stage asks for that the deal leaves empty: each prints on stderr as `warning: <message>`, stdout stays the deal and the exit code stays 0. `--missing-fields` keeps only the deals flagged Missing (also `missingFields: true` on `kenso opportunities search`).\n\n## Won and lost reasons\n\n```bash\nkenso opportunity-reasons get\nkenso opportunity-reasons replace --kind lost --data \'{"reasons":[{"key":"no_budget","label":"No budget"},{"label":"Built it in-house"}]}\'\nkenso opportunities move 4401 --stage lost --reason built_it_in_house\n```\n\n`kenso opportunities move <id> --stage <key> [--reason <key>]` sends the reason as `lostReasonKey` for a lost stage or `wonReasonKey` for a won stage; an open stage takes none. Each field the new stage asks for that the deal leaves empty prints a warning on stderr, and the move still goes through.\n\nWith the `deal_stage_rules` flag on, each workspace edits why its deals are lost and won. `get` prints `lost` and `won`, each `{isDefault, reasons: [{key, label, isArchived}]}`. `replace` takes a kind\'s whole list in order, as `get` prints it: keep a reason by its `key`, leave `key` out for a new one, and set `isArchived` to archive a reason or bring one back. A reason left out is archived too: deals keep it, and no write can pick it again. At least one reason stays live and at most 30, and labels stay unique, archived ones included. A deal takes a live key in `lostReasonKey` (a lost stage) or `wonReasonKey` (a won stage). A move to Lost without a reason still goes through, with a warning and "Missing: Lost reason" on the deal. Editing the lists needs the `workspace_settings` permission. The same as the MCP\'s `pipelines(operation="reasons-get")` and `reasons-replace`.\n\n## Record page layouts\n\n```bash\nkenso layouts show account\nkenso layouts set account --header tier,ownerMemberId,score,custom.arr\nkenso layouts show account > layout.json && kenso layouts set account --data @layout.json\nkenso layouts reset account\n```\n\nWith the `record_layout` flag on, a workspace lays out each record page once, for every member: `account`, `person` or `opportunity` (a deal). `show` prints `GET /v1/record-layouts/{object}`: `isDefault`, `version`, `headerFields` (up to 6, pinned under the record\'s name), `railSections` (`{name, fields}`), `hiddenFields` (under the rail\'s More), `sections` (`{key, label, placement, locked, hidden}`, in page order) and `availableFields`. Field keys are the field catalog\'s (`ownerMemberId`, `closeDate`, `primaryDomain`); a custom field is `custom.<field_key>`, and a new one joins the last rail section.\n\n`set --header` pins up to 6 fields and keeps the rest of the saved layout; the fields it unpins go to the top of the first rail section. `set --data` saves a whole layout, so group the rail into sections or hide a section that way, starting from `show`. A save made after someone else\'s answers a conflict: show it again. `reset` puts the page back to Kenso\'s default. Saving needs the `workspace_settings` permission, and the account page also needs the `accounts` plan. The same as the MCP\'s `account_views` operations `record-layouts-get`, `record-layouts-replace` and `record-layouts-reset`.\n\n## Pin a saved view\n\n```bash\nkenso views pin 118\nkenso views unpin 118\n```\n\nWith the `shared_views` flag on, `views pin` adds a saved view to your own sidebar, nested under its list (an account view under Accounts, a person view under People, a deal view under Deals). It is `kenso pins add --kind view --view-id <viewId>` under the name you would try: it prints the pin, and a view already pinned answers the pin it has. Pins are yours alone: pinning a shared view does not pin it for a teammate. `views unpin` finds your pin of the view and removes it, and prints `{"viewId": ..., "removed": true}`; a view you had not pinned prints `removed: false` and changes nothing. The view itself stays either way. `kenso pins list` shows every pin you have.\n\n## Tasks\n\nTasks are to-dos a member owes: a title, an optional due day or time, an assignee and at most one account, person or deal. They need the `tasks` flag. The app calls deals "Deals"; the CLI keeps `--deal` for an opportunity id.\n\n```bash\nkenso tasks add "Send the deck" --due tomorrow --account 812\nkenso tasks add "Call Ada back" --due friday --at 16:00 --person 501 --assignee ada@acme.com\nkenso tasks list --assignee me --due overdue,today\nkenso tasks queue --scope mine\nkenso tasks assign 7 me\nkenso tasks done 7 8 9\nkenso tasks done 7 --undo\n```\n\n- `tasks add` sends `POST /v1/tasks`. `--due` takes `today`, `tomorrow`, a weekday (the next one: `friday` or `fri`), a day (`2026-11-20`) or an ISO 8601 time with its offset (`2026-11-20T15:00:00Z`); `--at HH:MM` puts a time on that day (today without `--due`). Day words and `--at` read this computer\'s clock and time zone (`TZ`); a time\'s day is read in the assignee\'s app time zone. `--assignee` takes `me`, a member id or an email; without it the task is yours.\n- `tasks done` completes each task it names, in order (`PATCH /v1/tasks/{id}` with `status: done`); `--undo` reopens them. When one fails, its error names the tasks before it, which are already changed. `tasks assign` gives a task to `me`, a member id or a member\'s email; that member gets a `task_assigned` notification.\n- `tasks queue` is `task-queue list` under the name you would try: the Tasks screen\'s open work by due day, with `--scope mine|assigned_by_me|everyone`. It lists tasks, manual touches, call tasks, inbox threads with a reminder due (when you can view the Inbox) and Ken\'s follow-ups to you, each with the app path in `href` (null for a task, which opens in its panel).\n- `tasks list`, `get`, `update`, `delete`, `restore` and `task-queue list` are generated from the API: `kenso tasks --help` lists them.\n';
|
|
8787
|
+
crm_default = '# CRM (beta)\n\nThe CRM commands work on Kenso\'s Accounts lane: accounts (companies), the people on them, and opportunities. They are beta: they need the `accounts` feature flag on your workspace (opportunities need `opportunities`, CRM sync needs `ingestion`). Help and `kenso describe` hide them until your workspace has the flag; `--all-commands` shows them.\n\n| Command | What it does |\n|---|---|\n| `accounts import` | Create accounts from a CSV or JSONL file. Research is charged per created account |\n| `people import` | Create or match people from a file, optionally onto accounts |\n| `import accounts <file.csv>`, `import people <file.csv>`, `import deals <file.csv>` | Import a CSV export of another CRM, up to 50,000 rows: Kenso proposes the mapping, you approve once, it runs in the background and can be undone for 30 days |\n| `accounts update --each`, `people update --each`, `opportunities update --each` | Edit many records from a file, one call per row |\n| `accounts bulk-update`, `people bulk-update`, `opportunities bulk-update` | Set the same fields on many records at once, by ids or by a filter, with a preview first. Needs `bulk_edit` too |\n| `accounts bulk-delete`, `people bulk-delete`, `opportunities bulk-delete` | Delete many records at once, by ids or by a filter, with a preview first. Not undone. Needs `bulk_edit` too |\n| `changes list`, `get`, `rows`, `apply`, `cancel`, `undo` | Follow a bulk change, read what each record got, stop it, or put the old values back for 30 days |\n| `accounts write-research`, `people write-research` | Store research you gathered as a record\'s latest research, free. `--each` writes many |\n| `opportunities move <id> [--stage <key>] [--pipeline <pipelineId>] [--reason <key>]` | Move a deal to a stage or another pipeline, with its won or lost reason; a field the stage asks for never stops it |\n| `opportunities stage-history <id>` | A deal\'s stage history: each stage, when, who moved it and how long it sat there |\n| `notes list`, `notes add`, `notes edit`, `notes delete` | Notes and comments on accounts, people and deals (needs `record_notes`) |\n| `deleted-accounts list`, `accounts restore --account-id <id>` | The accounts deleted in the last 30 days, and bringing one back |\n| `accounts duplicates`, `accounts merge <id> --into <id>`, `accounts merges list` | The pairs that look like one company, merging a pair, and the log of merges |\n| `export <accounts\\|people\\|deals>` | The list as CSV: everything, a saved view (`--view <id>`), or what the filters match |\n| `capture status` | Your captured mailbox, its backfill progress and what teammates see of a captured email. Needs the `crm_capture` flag |\n| `capture connect` | Turn capture on for your own mailbox. `--private` starts it hidden from teammates; `--provider google` prints a sign-in link when no account is connected yet |\n| `capture private on\\|off` | Hide your captured email from teammates, or show it again. Email only: meetings stay visible. `--thread <id>` sets the switch for one thread |\n| `capture thread <threadId>` | One captured email thread: subject, people, time, Ken\'s summary, the members whose mailboxes hold it, and each body you may open. The id is `capturedThread.id` on a timeline row |\n| `views pin <viewId>`, `views unpin <viewId>` | Pin a saved view to your own sidebar, or take it off. Needs the `shared_views` flag |\n| `capture sync` | Read your captured mailbox now, instead of waiting for the next two-minute poll. Prints what the pass read, logged and created |\n| `capture disconnect` | Turn capture off and delete your stored email bodies. Asks first; `--yes` skips the question |\n| `capture teammates-see summary\\|full_email` | Workspace admin: what teammates see of captured email |\n| `pipelines stage-rules` | List or set the fields a deal should have in each stage |\n| `opportunity-reasons get`, `opportunity-reasons replace` | List or edit why deals are lost and won |\n| `layouts show\\|set\\|reset <object>` | How every account, person or deal page in the workspace lays out its fields: header, rail sections and hidden fields (needs `record_layout`) |\n| `crm-connections`, `crm-imports`, `crm-sync-issues` | Read and run CRM sync. Connecting a CRM stays in the app |\n| `tasks add`, `tasks done`, `tasks assign`, `tasks queue` | Add a to-do for a member on an account, person or deal, complete it, hand it on, or read your open work (needs `tasks`) |\n| `fields list`, `create`, `update`, `archive` | The built-in and custom fields of accounts, people and deals, and adding your own (needs `custom_fields`) |\n| `field-fill-settings`, `suggestions`, `fields fill` | How Ken fills each field from email, calls and meetings, the values it waits on you for, and filling a deal field for existing deals (needs `ken_field_fill`) |\n| `views list`, `create`, `run`, `update`, `delete` | Saved views of accounts, people and deals, private or shared with the workspace (needs `shared_views`) |\n| `reports summary`, `reports run <report>`, `reports query`, `dashboards` | Pipeline reports over your deals, your own counts and sums, and dashboards of saved charts (needs `opportunities` and `reports`) |\n| `forecast show`, `quotas list`, `set`, `propose` | Closed won, commit and best case against each member\'s quota for a month or quarter (needs `opportunities` and `forecast`) |\n\nImport accounts first, then people: `people import` never creates an account.\n\n## Import accounts\n\n```bash\nkenso accounts import --file accounts.csv\nkenso accounts import --file accounts.csv --yes\n```\n\n```csv\nname,domain,industry,employeeCount\nAcme,acme.io,Software,120\nGlobex,globex.com,Manufacturing,"1,200"\n```\n\n- **Columns** map by name, ignoring case, spaces and dashes: `name` (or `company`, `companyName`, `accountName`), `domains` (several, split on `,` or `;`) or one `domain` (or `website`, `companyDomain`), `industry`, `employeeCount`, `hqLocation`, `linkedinUrl`, `stage`, `angle`, `whyNow`, `fitScore`, `fundingRound`, `cadenceDays`, `ownerMemberId`, `kenCompanyId`, `sendsFromInboxId`, `sendsFromLinkedInAccountId` and `source`.\n- **A domain is required.** A file with no domain column is a usage error, and a row without a domain is `invalid` (`domain_required`).\n- **The dry run prices the research.** It asks for a credit estimate per 1,000 accounts and puts the sum in the plan: `kind`, `accountCount`, `totalMillicredits`, `availableMillicredits` and `sufficient`.\n- **Rows go 100 per call** to `POST /v1/accounts/bulk-create`.\n\nEach row comes back `created` (`id` is the new account; its research is queued, `researchQueued`, or waits for credits, `researchWaitingCredits`), `skipped` with reason `domain_taken` (already an account; `id` is that account) or `failed` (`reason` is the API\'s code, `error` names the field; an item Kenso failed to save is sent once more first). Rerunning the same file is safe: accounts that exist come back `domain_taken`.\n\n## Import people\n\n```bash\nkenso people import --file people.csv\nkenso people import --file people.csv --find-emails --yes\nkenso people import --file people.jsonl --dry-run\n```\n\n```csv\nfullName,email,title,accountDomain,role\nAnn Lee,ann@acme.io,VP Sales,acme.io,champion\nBob Ray,,CTO,acme.io,\n```\n\n- **Columns** map by name, ignoring case, spaces and dashes: `email`, `fullName` (or `name`), `firstName`, `lastName`, `title`, `linkedinUrl` (or `linkedin`, `profileUrl`), `accountDomain` (or `domain`, `website`, `companyDomain`), `accountId`, `role` and `priority`. Other columns are ignored with one warning.\n- **A person needs a name:** `fullName`, or `firstName`, `lastName` or both (the CLI joins them). A row with none of them is `invalid` (`name_required`).\n- **To put a person on an account,** give `accountDomain` or `accountId`. A row with both sends only `accountId`.\n- **`--find-emails`** queues an email find (charged in credits) for each person without an email.\n- **Rows go 200 per call** to `POST /v1/people/batch`.\n\nPeople already in the workspace are matched by email, then LinkedIn URL, so running the same file again creates nobody twice. A row comes back `created` (a new person), `updated` (an existing person added to the account), `skipped` with reason `already_on_account`, `matched` (no account asked) or `previously_removed`, or `failed`: `account_not_found` saves the person without an account (import the account, then rerun to place them), any other reason is the API\'s. The summary adds `matched`, `addedToAccounts` and `emailFindsQueued`.\n\n## List and search accounts\n\n`accounts list` and `accounts search` sort and page on the server, so they reach every account in the workspace, however many there are.\n\n```bash\nkenso accounts list --sort score:desc --limit 100 # one page; the output\'s next: line is the following one\nkenso accounts list --sort score:desc --limit 100 --all # every page, to the end\nkenso accounts search --search hiring --sort latestSignalAt:desc --data \'{"qFields": ["name", "latestSignal"]}\'\nkenso accounts search --limit 1 --data \'{"countBy": ["stage"]}\' # how many accounts sit in each stage\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "tier", "operator": "is", "values": ["1"]}]}, "sort": "tier,-pipelineAmount"}\' --all\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "hqLocation", "operator": "contains", "values": ["Germany"]}]}}\' --all\n# my accounts with a meeting this quarter: me is whoever runs it, so a saved view with it lists each member\'s own\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "owner", "operator": "is", "values": ["me"]}, {"field": "lastMeeting", "operator": "in_period", "values": ["this_quarter"]}]}}\' --all\n# tier 1 accounts with no meeting in 30 days: none since then, or none ever\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "tier", "operator": "is", "values": ["1"]}, {"match": "any", "conditions": [{"field": "lastMeeting", "operator": "older_than_days", "values": ["30"]}, {"field": "lastMeeting", "operator": "is_empty"}]}]}}\' --all\n```\n\n- **`--sort`** takes up to 3 comma-separated keys, each `field` (ascending), `field:asc` or `field:desc`. The API\'s `-field` form needs the equals sign here, `--sort=-score`, because a value that starts with a dash reads as a flag. Fields: `createdAt`, `name`, `score`, `tier` (ascending is tier 1 first), `latestSignalAt`, `committee`, `pipelineAmount`, `nextTouchAt`, `lastTouchAt`. An account with no value for a key comes last in both directions. The default is `-createdAt`.\n- **`--limit`** is 1 to 1000 (default 50). `--cursor` takes the previous page\'s `nextCursor` with the same filters and sort; `--all` follows the cursors for you.\n- **`--search`** (also `--q`) matches the name or a domain.\n- **Lists and objects go in `--data`** on `search`, as the API takes them (`kenso describe accounts search`); a flag beside it sets or replaces one key:\n - `qFields` picks where the search text looks: `name`, `domain`, `latestSignal` (the latest signal\'s title).\n - `countBy` (`stage`, `stageGroup`) adds `counts` to the output: every value with the number of matching accounts that hold it, whatever the page. The output is then one object: `data`, `pagination` and `counts`.\n - `filters` and `where` narrow the accounts.\n\nAn account\'s timeline pages the same way. `kenso accounts activity --account-id 812` returns the newest 100 earlier rows and, when older ones exist, `data.nextCursor`. Pass it back as `--cursor` (with the same `--category`) for the rows before them, until a page comes without one.\n\n## Edit accounts, people and opportunities\n\nTo set the same fields on many records, use `bulk-update` (below; it needs the `bulk_edit` flag). When every row gets its own values, or the workspace has no `bulk_edit`, run the generated `update` command once per row with `--each`. Columns are the command\'s flags by API name or flag name, and the id column fills the route:\n\n```bash\nkenso accounts update --each accounts-edit.csv --dry-run # then the same with --yes\nkenso people update --each people-edit.csv --dry-run\nkenso opportunities update --each deals.csv --dry-run\n```\n\n```csv\naccountId,stage,ownerMemberId,overwritePinned\n501,engaged,42,true\n502,customer,42,true\n```\n\nA row that changes a field someone pinned in the app fails as a whole (`409 conflict`, `pinned_by_user`: nothing on that record changes, the other fields of the row included), unless the row sets `overwritePinned` to `true` (or you pass `--overwrite-pinned`, only with the person\'s OK). Every flag of an update command: `kenso accounts update --help`.\n\n## Change many accounts at once\n\n```bash\nkenso accounts bulk-update --filter \'{"filters":[{"field":"stage","operator":"is","values":["new"]}]}\' --set owner=42 --dry-run\nkenso changes apply --change-id 31\nkenso accounts bulk-update --ids 812,813 --set stage=engaged --set tier=2 --yes\nkenso changes get --change-id 31\n```\n\n`accounts bulk-update` sets the same fields on every account you name: `--ids` (1,000 at most), everything a `--filter` matches (the body `kenso accounts search --data` takes: `filters`, `where`, `q`; up to 50,000), or `--all`. A filter that holds only options and no condition (`--filter \'{"includeImportOnly":true}\'`) takes `--all` beside it. `--exclude-ids` leaves some of a filter\'s accounts out. `--set field=value` takes `ownerMemberId` (or `owner`), `stage`, `tierOverride` (or `tier`), `industry`, `fundingRound`, `employeeCount`, `hqLocation` and `cadenceDays`, and a custom field as `custom.<key>` (`--set custom.region=EMEA`; `kenso api GET \'/v1/fields?object=account\'` gives the keys); a value of `null` clears the field. `--add-tag 12,14` and `--remove-tag 13` put tags on every account or take them off (`kenso tags list` gives the ids); each tag is one row per account from `false` to `true` or back, so `kenso changes undo` takes off only the tags the change put on. People take them too; deals have no tags. A text field\'s value is sent as you type it (`--set hqLocation=10001` is the text "10001"); a custom field\'s type is not known to the CLI, so quote its text when it reads as a number or as true or false: `--set \'custom.code="10001"\'`. Use `accounts update --each` when every row gets its own values.\n\nIt makes a change set: the accounts it names and, for each, the field, its value before and its value after. Without `--yes` (or with `--dry-run`) it previews: it prints `count` and a `sample`, writes nothing, and `next` is the `kenso changes apply` command that writes exactly those accounts. With `--yes` it writes in the background and waits (`--timeout`, default 10m), then prints the change with its `counts`: `applied`, `unchanged` (already had the value), `conflict` (the account changed after the preview, so it was left alone) and `failed` (for example `pinned`: a person set the field by hand; `--overwrite-pinned` replaces it). Exit 5 when some accounts failed or conflicted. It needs the `bulk_edit` flag as well as `accounts`.\n\n`kenso accounts bulk-update` used to be the generated command for the route\'s older one-field body, which sets one `accountType` on up to 500 accounts and needs only `accounts`. The route still takes that body, but this command no longer sends it: use `kenso accounts update --each` with an `accountType` column, or `kenso api POST /v1/accounts/bulk-update --data \'{"accountIds":[812,813],"accountType":"lost"}\'`.\n\n`people bulk-update` and `opportunities bulk-update` work the same way. People take `--set` for `ownerMemberId` (or `owner`), `leadStatus`, `title`, `seniority`, `department` and `location`, and a `--filter` of `kenso people search --data` fields (`leadStatus`, `roles`, `tagIds`, `q` and the rest). Deals take `stage` (a live stage key), `ownerMemberId` (or `owner`), `closeDate` (or `close`), `amount`, `dealType` and `nextStep`, and a `--filter` of `kenso opportunities search --data` fields (`filters`, `accountId`, `q`):\n\n```bash\nkenso opportunities bulk-update --filter \'{"filters":[{"field":"stageCategory","operator":"is","values":["open"]}]}\' --set stage=proposal --dry-run\nkenso people bulk-update --ids 501,502 --set owner=42 --yes\n```\n\n### Delete many records at once\n\n```bash\nkenso people bulk-delete --filter \'{"onAccount":"none","leadStatus":["disqualified"]}\' --dry-run\nkenso changes apply --change-id 32\nkenso opportunities bulk-delete --ids 71,72,73 --yes\n```\n\n`accounts bulk-delete`, `people bulk-delete` and `opportunities bulk-delete` name their records the way `bulk-update` does (`--ids`, `--filter`, `--all`, `--exclude-ids`) and take no `--set`. Without `--yes` they preview: `count`, a `sample`, and `next` is the `kenso changes apply` command that deletes exactly those records. The API itself previews a delete whose body leaves `dryRun` out, so `--yes` sends `dryRun: false`. Each record is deleted as its own `delete` command deletes it, so one that cannot be deleted (a person still on an account) is counted as `failed` and the rest go on. A delete is not undone with `kenso changes undo`.\n\n### Follow, stop and undo a change\n\n```bash\nkenso changes list --object accounts\nkenso changes rows --change-id 31 --status conflict,failed\nkenso changes cancel --change-id 31\nkenso changes undo --change-id 31\n```\n\n`changes list` shows the workspace\'s bulk changes, newest first, whoever made them. `changes rows` lists a change\'s records with the value before (`from`) and after (`to`) and a `status`; `--status conflict,failed` reads what a change missed. `changes cancel` drops a preview or stops a change that is still writing; what it already wrote stays. `changes undo` puts the old value back on every record that still holds the value the change wrote, for 30 days after it was applied (`undoUntil`). A record someone changed again since keeps its newer value: `counts.undone` is how many went back, `counts.applied` how many still hold the change. Undo answers `409 invalid_state` with `undo_expired`, `still_running`, `nothing_applied` or `not_undoable` when there is nothing it can put back.\n\n## Search opportunities\n\n`kenso opportunities search` works as `accounts search` does: it takes `--search`, `--sort`, `--limit`, `--cursor`, `--all`, and its lists in `--data`.\n\n```bash\nkenso opportunities search --data \'{"filters": [{"field": "stageCategory", "operator": "is", "values": ["open"]}]}\' --all\nkenso opportunities search --data \'{"filters": [{"field": "ownerMemberId", "operator": "is", "values": ["none"]}, {"field": "closeDate", "operator": "is", "values": ["past_due", "next_30_days"]}]}\'\nkenso opportunities search --limit 1 --data \'{"countBy": ["stage", "ownerMemberId"]}\' # how many opportunities hold each value\n```\n\n- **`filters`** is a list of `{field, operator, values}`, all of which must hold. Fields: `stage` (a stage key), `stageCategory` (`open`, `won`, `lost`), `ownerMemberId` (member ids, or `me` for whoever runs it), `closeDate` (`past_due`, `next_30_days`, `later`, `none`, or a period such as `this_week` or `next_quarter`), `sourceCampaignId`, `closedAt` and `createdAt` (periods). `operator` is `is` or `is_not`; the values of one condition are OR. `none` in `values` matches an opportunity with no owner, no source campaign or no close date.\n- **`countBy`** takes the same field names and adds `counts` to the output: per field, every value with the number of matching opportunities that hold it.\n- `--account-id` keeps the search to one account. `closeDate` counts days in the member\'s app time zone.\n\nOne person\'s deals, meetings and campaign contacts, as their person page lists them:\n\n```bash\nkenso opportunities list --person-id 9001 # the deals they are on, or are the primary person of\nkenso meetings list --person-id 9001 # the meetings they attend, among the ones you can see\nkenso contacts list --person-id 9001 # their contact in each campaign they are in\n```\n\n## Write research you gathered\n\n`accounts write-research` and `people write-research` store research you gathered outside Kenso as the record\'s latest research (`PUT /v1/accounts/{accountId}/research`, `PUT /v1/people/{personId}/research`). The Research tab shows it like a Ken run, with `trigger: agent` and `researchedAt` now. Nothing is charged, and no account or person field changes: set an account\'s own `fitScore`, `whyNow` or `angle` with `accounts update`. They need the `accounts_research` flag and accounts edit.\n\nThe body is the research block `accounts get --expand research` (or `people get-research`) returns, without its read-only fields: leave out `id`, `status`, `trigger`, `errorCode`, `researchedAt`, `isStale` and `appliedPrompt` (for a person also `mode`, `requestedAt`, `researchedMode`, `firecrawlCredits` and `webNote`), or the write fails with `unknown_field`. Pass it with `--data @file`:\n\n```bash\nkenso accounts write-research --account-id 501 --data @acme-dossier.json\nkenso people write-research --person-id 9001 --data @jane.json\n```\n\n```json\n{\n "tagline": { "text": "Payroll for EU contractors", "sourceUrls": ["https://acme.example"] },\n "description": { "text": "Acme runs payroll and compliance for companies hiring contractors in 30 EU countries.", "sourceUrls": ["https://acme.example"] },\n "links": { "website": "https://acme.example" },\n "whyNow": { "text": "Raised a $40M Series B in October", "sourceUrls": ["https://news.example/acme-b"], "date": "2026-10" },\n "fitScore": 82,\n "angle": "Lead with contractor onboarding time."\n}\n```\n\nMany records: one JSONL line per record, with the id next to the block\'s fields. Nested objects are sent as written. Use JSONL, not CSV: the block\'s fields are objects and lists, which a CSV cell cannot carry.\n\n```bash\nkenso accounts write-research --each dossiers.jsonl --dry-run # then the same with --yes\nkenso people write-research --each people-research.jsonl --yes --concurrency 8\n```\n\n```jsonl\n{"accountId": 501, "tagline": {"text": "Payroll for EU contractors"}, "links": {"website": "https://acme.example"}}\n{"accountId": 502, "description": {"text": "Cloud cost tooling for retailers."}, "links": {"website": "https://beta.example"}}\n```\n\nA row fails as a whole with the API\'s code: `validation_failed` (an unknown field is `unknown_field`, and `error.details` names every bad field), `research_in_progress` (`409`: Ken is researching that record now, write it again once the run ends; an account run waiting for credits counts too: it runs once the workspace has credits, and the write stays refused until that run ends) or `not_found`. Rerunning a file is safe: each write replaces the record\'s research shown.\n\n## CRM sync\n\nCRM sync has generated commands only: read connections, preview, start an import, and work through sync issues. Connect the CRM itself in the app.\n\n```bash\nkenso crm-connections list\nkenso crm-connections get --connection-id 7\nkenso crm-imports create --connection-id 7 --dry-run\nkenso crm-sync-issues list --connection-id 7 --all\n```\n\nRun `kenso crm-connections --help` (or add `--all-commands` when the actions are hidden) to see every action.\n\n## Pipelines\n\nA workspace with the `pipelines` flag on can run several deal pipelines, each with its own stages. These are generated commands (beta):\n\n```bash\nkenso pipelines list\nkenso pipelines list --query "[].{id: id, name: name, default: isDefault, stages: stages[].key}"\nkenso pipelines get --pipeline-id 5\n```\n\n`list` prints every pipeline in display order, archived ones included: `id`, `name`, `routingRule` (the one sentence Ken reads to decide whether a new deal belongs there), `isDefault`, `isArchived`, `position`, `opportunityCount`, `amountTotal` and `stages`, each stage as `kenso opportunity-stages list` prints it. A stage key is unique in the workspace, across pipelines, so a deal\'s `stage` names its pipeline and its `pipelineId` repeats it. The first read turns the workspace\'s stage list into its default pipeline, named Sales, with every deal in it. The same rows as the MCP\'s `pipelines(operation="list")`.\n\nShaping them needs the `workspace_settings` permission:\n\n```bash\nkenso pipelines create --name Renewals --routing-rule "The account is already a customer" --data \'{"stages": [{"label": "Up for renewal", "category": "open"}, {"label": "Won", "category": "won"}, {"label": "Lost", "category": "lost"}]}\'\nkenso pipelines update --pipeline-id 6 --name Expansion --position 0\nkenso pipelines update --pipeline-id 6 --data @stages.json\nkenso pipelines archive --pipeline-id 6\nkenso pipelines restore --pipeline-id 6\nkenso pipelines propose --description "upsells and renewals for customers"\n```\n\n- **`create`** takes a unique `name`, the pipeline\'s `stages` in display order (at least one `open`, one `won` and one `lost`) and an optional `routingRule`: one sentence that says which deals belong there, which Ken reads to route a new deal that names no pipeline. Each stage gets a key from its label; a key another pipeline already uses gets the pipeline\'s name in front (`renewals_won`). A workspace has at most 10 pipelines.\n- **`update`** changes what you send. `stages` is the pipeline\'s whole stage list: read it with `pipelines get`, keep each stage\'s `key`, and add a new stage without one. A stage with live deals in it cannot be left out; archive it with `"isArchived": true` instead.\n- **`propose`** asks Ken to draft a pipeline from one sentence: a `name`, a `routingRule` and `stages`, in the shape `create` takes. It saves nothing. Read it, change what you want, and send it to `create`.\n- **`archive`** stops new deals from entering a pipeline and keeps the deals in it. The default pipeline cannot be archived, and nothing is deleted: `restore` brings a pipeline back.\n\n## Deals in a pipeline\n\nA deal\'s stage names its pipeline, and the deal\'s `pipelineId` repeats it. To work one pipeline\'s deals, or move a deal between pipelines:\n\n```bash\nkenso opportunities list --pipeline-id 6\nkenso opportunities search --pipeline-id 6 --data \'{"countBy": ["stage"]}\'\nkenso opportunities create --account-id 501 --pipeline-id 6\nkenso opportunities move 77 --pipeline 6\nkenso opportunities move 77 --pipeline 6 --stage negotiating\n```\n\n- **`create --pipeline-id`** opens the deal in that pipeline\'s first live open stage. Without it, and without a `stage`, Ken reads each pipeline\'s `routingRule` and opens the deal in the pipeline whose rule clearly fits the account, else in the default pipeline. A pipeline you name always wins.\n- **`move --pipeline`** alone keeps the deal\'s category (`open`, `won` or `lost`): it lands in that pipeline\'s live stage of the category with the same label as its stage now, else in the category\'s first live stage. The printed deal says where it landed. With `--stage`, the stage must be that pipeline\'s; the error lists the pipeline\'s stage keys otherwise.\n- An archived pipeline takes no deal from another pipeline (`pipeline_archived`). The deals already in it still move between its stages.\n- A move is a stage change: it writes the same history, and a stage a person set is refused with `pinned_by_user` unless you pass `--overwrite-pinned`.\n\n## Restore a deleted account\n\n```bash\nkenso deleted-accounts list\nkenso accounts restore --account-id 812\n```\n\nA deleted account can be restored for 30 days. `deleted-accounts list` shows each one with who deleted it, `expiresAt` (restore works until then) and what comes back: `personCount`, `opportunityCount` and `touchCount`. `accounts restore --account-id <id>` brings the account back with its domains, its people, its deals and its planned touches, which wait for approval again. Its Studio pages, committee seats and Knowledge facts do not come back: the delete purged them. A domain another account took since stays with that account and is listed in `domainsTaken`. A merged account is not listed and cannot be restored: a merge has no undo. Both commands are behind the `crm_import_export` feature flag (`404` while it is off).\n\n## Import a CSV export of another CRM\n\n```bash\nkenso import accounts companies.csv\nkenso import accounts companies.csv --map "Company=name" --map "Notes=" --yes\nkenso import accounts --id 42 --yes\nkenso record-import-rows list --import-id 42 --outcome skipped\nkenso record-imports undo --import-id 42\n```\n\n`kenso import accounts <file.csv>` uploads the file (a header row, at most 50,000 rows) and prints Kenso\'s plan: which field each column fills, which columns it skips, how owner and stage values are read (`valueMaps`) and what it could not settle (`questions`). Headers of Kenso, Twenty, HubSpot, Attio and Salesforce exports are recognized. Nothing is written to your accounts yet. `--map "Header=field"` changes a column and `--map "Header="` skips it. A column fills a custom field with `--map "Header=custom.<key>"` (`kenso fields list --object account` has the keys; people are `person`, deals `opportunity`), and `--map "Header=new"` adds the custom field Kenso proposes for a column no field matches (`new:text` picks the type), and a column whose header is a custom field\'s label is mapped to it already; owner and stage values change with `kenso record-imports update --import-id <id>`.\n\nWith `--yes` the import starts and the command waits for it (`--timeout`, default 30m; the import keeps running on the server either way), then prints how many rows were created, updated, restored, left unchanged and skipped. Without `--yes` it stops at the plan and prints the command that starts that import (`--id <importId> --yes`), so the file is uploaded once. `--dry-run` sends nothing: with a file it prints the upload it would make, since the plan needs the upload, and with `--id` it reads the planned import and prints what `--map`, `--source` and `--research` would change on it. `--source twenty` names the system the file\'s record ids come from: pass the same one for every file of an export, so the people and deals files find the accounts by their old ids. `kenso record-imports delete --import-id <id>` discards an import that was planned and never started; one left planned for 30 days is discarded by itself.\n\nPer row: a domain no account has creates an account; a domain that is already an account fills only that account\'s empty fields, so nothing you entered is overwritten; an account deleted in the last 30 days is restored; a row with no usable domain is skipped, and `kenso record-import-rows list --import-id <id> --outcome skipped` says why. Research of new accounts is off unless you pass `--research`, which is charged per account. It needs the `accounts` and `crm_import_export` flags. This is a different command from `accounts import`, which creates accounts row by row from the machine running the CLI.\n\n`kenso record-imports undo --import-id <id>` takes a finished import back in the background (`kenso record-imports get --import-id <id>` reads `undoing`, then `undone`): an account the import created is deleted, and can be restored for 30 days, unless someone changed it since, it holds a deal, a person was added to it since, or it was merged; a field the import filled is emptied while it still holds the imported value. `kenso record-import-rows list --import-id <id>` shows each row\'s `undoOutcome`.\n\n`kenso import people <file.csv>` works the same way for people. Import the accounts file first: a people row\'s company id (Twenty\'s `Company Id`, HubSpot\'s associated company id) places the person on the account that kept that id, and without one the person goes on the account that holds their email\'s or company\'s domain. A people import never creates an account; a person whose company is no account comes in without one and the row says so. A row matches a person by email, then LinkedIn URL, then name on the company, as every other way into People does; a matched person gets only their empty fields filled (a phone only when they have none). A row with none of the three is skipped, and a row with only a name needs a company that is an account with a domain. `kenso record-imports undo --import-id <id>` takes a people import back too: a person it created leaves the accounts the row placed them on and is deleted, unless someone changed them since, they were contacted or have a touch planned, or they are on an open deal; a field it filled is emptied while it still holds the imported value. `kenso people import` stays the JSONL and enrichment path (`--find-emails`); `kenso import people` is the CRM file with a plan, a row report and one approval.\n\n`kenso import deals <file.csv>` works the same way for deals, after the accounts file and the people file. A row opens a deal on the account that kept its company id (Twenty\'s `Company Id`, HubSpot\'s associated company id), else on the account that holds its company domain; a row whose account Kenso does not know is skipped and says so. Its contact is the person a people import kept the row\'s contact id for (Twenty\'s `Point of Contact Id`). The plan maps each stage in the file to one of the workspace\'s deal stages (`valueMaps`, field `stage`): a stage\'s key or label matches by itself, Closed Won and Closed Lost go to the first won and lost stage, and a value with no match opens in the first open stage until you pick one with `kenso record-imports update`. Amounts stay in the workspace currency: an amount in another currency is left out with a warning, never converted. A row whose deal id an earlier import kept is that deal and only gets its empty fields filled; a file with no id column opens every deal again each time it is imported, and the plan says so (`no_source_id`). `kenso record-imports undo --import-id <id>` takes a deals import back: a deal it opened is deleted unless someone changed it since, and a field it filled is emptied while it still holds the imported value. Undo in the reverse order of the imports (deals, then people, then accounts): an account that holds a deal is kept.\n\n## Export accounts, people or deals\n\n```bash\nkenso export accounts --out accounts.csv\nkenso export accounts --view 12 --out tier-1.csv\nkenso export deals --view 40 --out pipeline.csv\nkenso export deals --filters \'[{"field":"stageCategory","operator":"is","values":["open"]}]\' > open-deals.csv\n```\n\nIt writes the CSV that `POST /v1/accounts/export`, `/v1/people/export` or `/v1/opportunities/export` returns, to stdout or to `--out` (then it prints the file and its row count). With no filter it exports every record. More than 50,000 rows is refused: narrow the filters. `--view <id>` exports a saved view of that object, your own or one shared with the workspace (`kenso views list --object account` shows the ids; people are `person`, deals `opportunity`): the file holds the rows the view lists, in its sort, so its row count is the view\'s count. `--filters`, `--where` (accounts), `--q` and `--sort` are the search operation\'s own fields; given with `--view`, each replaces that key of the view. The accounts and deals files start with `id` and import back as they are. Each export writes an audit-log entry and needs the export permission. Accounts and deals also need the `crm_import_export` flag while it is in beta.\n\n## Duplicates and merges\n\n```bash\nkenso accounts duplicates --scan\nkenso accounts merge 812 --into 77 --dry-run\nkenso accounts merge 812 --into 77 --yes\nkenso accounts merges list --merged-by system\nkenso accounts merges 41\n```\n\nThese need the `crm_import_export` flag beside `accounts`. `accounts duplicates` lists the pairs of accounts that look like one company: both accounts, why they were paired (`reasons`: `domain`, `linkedin`, `name`) and `isCertain`, true when the two share the name and the domain apart from its ending (acme.com and acme.co). `--scan` compares every account first; a scan also runs after each accounts import. `--status dismissed` or `merged` shows the answered pairs. `kenso account-duplicates dismiss --duplicate-id <duplicateId>` answers that a pair is not a duplicate, for good.\n\n`accounts merge <accountId> --into <id>` merges the first account into the second, the one you keep. A merge cannot be undone, so look first: `--dry-run` prints `mergeSummary` (each field that changes with its value before and after, and how many people, deals, touches and domains move) and writes nothing. The merge itself needs `--yes` when no person is at the terminal. It answers the kept account with the same summary and a `mergeId`.\n\n`accounts merges list` is the log, newest first, and `accounts merges <mergeId>` opens one merge with `mergedValues`: the merged-away account as it was. `--merged-by system` shows the merges Ken made itself. Where automatic merging is on for the workspace, Ken merges only certain pairs, keeps the customer, then the owned, then the last touched account, and leaves a pair for you when both are customers, the two have different owners, or one is being worked and the other is set aside (`heldReason` on the pair says which). That job is off unless it was turned on for the workspace.\n\n## A deal\'s stage history\n\n```bash\nkenso opportunities stage-history 77\nkenso opportunities stage-history 77 --query "entries[].{to: stageLabel, at: enteredAt, by: changedBy}"\n```\n\nIt prints `GET /v1/opportunities/{id}/stage-history` as it is, the same rows as the deal page and the MCP\'s `opportunities(operation="get-stage-history")`: the stage now, `isComplete` and `entries`, oldest first, each with `fromStage`, `stage`, `stageLabel`, `enteredAt`, `leftAt`, `durationSeconds`, `actorKind`, `actorMemberId` and Ken\'s `reason` on a move its stage judge made. With the `deal_stage_rules` flag on, each entry also has `changedBy` (`member`, `agent`, `api_key`, `workflow`, `stage_judge`, `crm_sync` or `ken_automation`), `crmProvider` on a CRM sync, and on a move `fromStageLabel` and `fromStageDurationSeconds`, how long the deal sat in the stage it left. `isComplete` false means Kenso has no record of part of the history.\n\n## Notes on accounts, people and deals\n\nWith the `record_notes` feature on, everyone who can see a record reads its notes. Name the record with exactly one of `--account`, `--person` and `--deal`:\n\n```bash\nkenso notes list --account 5\nkenso notes add --account 5 --body \'Budget approved, @[Jane Doe](41) please send the DPA\'\nkenso notes add --parent 900 --body \'Sent it this morning\' # a comment under note 900\ncat call-notes.md | kenso notes add --deal 77 --body - # the body from stdin\nkenso notes edit 900 --body \'Budget approved for Q1\' # the author only\nkenso notes edit 900 --pin\nkenso notes delete 900 --yes # kenso notes restore --note-id 900 brings it back\n```\n\nThe body is markdown, up to 20,000 characters. Mention a teammate as `@[Name](memberId)`: they get a notification that opens the note. A note shows on the record\'s Notes tab and its Activity timeline, and Ken\'s account brief quotes the account\'s notes. The MCP\'s `notes` tool does the same. A note on an account needs the accounts plan feature; people and deals work on every plan.\n\n## Required fields per stage\n\n```bash\nkenso pipelines stage-rules\nkenso pipelines stage-rules --pipeline 6\nkenso pipelines stage-rules proposal --require amount,closeDate,custom.tier --dry-run\nkenso pipelines stage-rules proposal --require amount,closeDate,custom.tier\nkenso pipelines stage-rules proposal --none\nkenso pipelines stage-rules lost --default\n```\n\nWith the `deal_stage_rules` flag on, each stage can name the fields a deal should have in it. Without a stage the command prints every stage\'s `key`, `label`, `category`, `isArchived`, `requiredFields` and `isDefault`, plus `requirableFields`: `amount`, `closeDate`, `ownerMemberId`, `primaryPersonId`, `nextStep`, `lostReasonKey`, `wonReasonKey` and `custom.<key>` for each custom deal field. `--require` sets the stage\'s whole list, in order, at most 10. `--none` requires nothing, and `--default` goes back to the default: a lost stage asks for `lostReasonKey`, any other stage nothing. Without `--pipeline` the list is the default pipeline\'s stages; `--pipeline <id>` lists that pipeline\'s. A stage key is unique across pipelines, so a stage of any pipeline is set by its key, and with `--pipeline` the command first checks the stage is that pipeline\'s. Setting a rule needs the `workspace_settings` permission. The same as the MCP\'s `opportunities(operation="stages-set-required-fields")`.\n\nA missing field never stops a move. The deal moves, and it is flagged Missing on the board, the list and the deal page until the field is filled. A rule also applies to deals already in the stage.\n\n```bash\nkenso opportunities update --opportunity-id 4401 --stage proposal\nkenso opportunities list --missing-fields\n```\n\nEvery deal then carries `missingFields` (`[{field, label}]`). A create, or an update that sends a stage, answers `warnings` beside the deal for each field the stage asks for that the deal leaves empty: each prints on stderr as `warning: <message>`, stdout stays the deal and the exit code stays 0. `--missing-fields` keeps only the deals flagged Missing (also `missingFields: true` on `kenso opportunities search`).\n\n## Won and lost reasons\n\n```bash\nkenso opportunity-reasons get\nkenso opportunity-reasons replace --kind lost --data \'{"reasons":[{"key":"no_budget","label":"No budget"},{"label":"Built it in-house"}]}\'\nkenso opportunities move 4401 --stage lost --reason built_it_in_house\n```\n\n`kenso opportunities move <id> --stage <key> [--reason <key>]` sends the reason as `lostReasonKey` for a lost stage or `wonReasonKey` for a won stage; an open stage takes none. Each field the new stage asks for that the deal leaves empty prints a warning on stderr, and the move still goes through.\n\nWith the `deal_stage_rules` flag on, each workspace edits why its deals are lost and won. `get` prints `lost` and `won`, each `{isDefault, reasons: [{key, label, isArchived}]}`. `replace` takes a kind\'s whole list in order, as `get` prints it: keep a reason by its `key`, leave `key` out for a new one, and set `isArchived` to archive a reason or bring one back. A reason left out is archived too: deals keep it, and no write can pick it again. At least one reason stays live and at most 30, and labels stay unique, archived ones included. A deal takes a live key in `lostReasonKey` (a lost stage) or `wonReasonKey` (a won stage). A move to Lost without a reason still goes through, with a warning and "Missing: Lost reason" on the deal. Editing the lists needs the `workspace_settings` permission. The same as the MCP\'s `pipelines(operation="reasons-get")` and `reasons-replace`.\n\n## Record page layouts\n\n```bash\nkenso layouts show account\nkenso layouts set account --header tier,ownerMemberId,score,custom.arr\nkenso layouts show account > layout.json && kenso layouts set account --data @layout.json\nkenso layouts reset account --dry-run\nkenso layouts reset account --yes\n```\n\nWith the `record_layout` flag on, a workspace lays out each record page once, for every member: `account`, `person` or `opportunity` (a deal). `show` prints `GET /v1/record-layouts/{object}`: `isDefault`, `version`, `headerFields` (up to 6, pinned under the record\'s name), `railSections` (`{name, fields}`), `hiddenFields` (under the rail\'s More), `sections` (`{key, label, placement, locked, hidden}`, in page order) and `availableFields`. Field keys are the field catalog\'s (`ownerMemberId`, `closeDate`, `primaryDomain`); a custom field is `custom.<field_key>`, and a new one joins the last rail section.\n\n`set --header` pins up to 6 fields and keeps the rest of the saved layout; the fields it unpins go to the top of the first rail section. `set --data` saves a whole layout, so group the rail into sections or hide a section that way, starting from `show`. A save made after someone else\'s answers a conflict: show it again. `reset` puts the page back to Kenso\'s default for every member, so it needs `--yes` (save the layout with `show` first). `set` and `reset` print the request with `--dry-run` and change nothing. Saving needs the `workspace_settings` permission, and the account page also needs the `accounts` plan. The same as the MCP\'s `account_views` operations `record-layouts-get`, `record-layouts-replace` and `record-layouts-reset`.\n\n## Pin a saved view\n\n```bash\nkenso views pin 118\nkenso views unpin 118\n```\n\nWith the `shared_views` flag on, `views pin` adds a saved view to your own sidebar, nested under its list (an account view under Accounts, a person view under People, a deal view under Deals). It is `kenso pins add --kind view --view-id <viewId>` under the name you would try: it prints the pin, and a view already pinned answers the pin it has. Pins are yours alone: pinning a shared view does not pin it for a teammate. `views unpin` finds your pin of the view and removes it, and prints `{"viewId": ..., "removed": true}`; a view you had not pinned prints `removed: false` and changes nothing. The view itself stays either way. `kenso pins list` shows every pin you have.\n\n## Tasks\n\nTasks are to-dos a member owes: a title, an optional due day or time, an assignee and at most one account, person or deal. They need the `tasks` flag. The app calls deals "Deals"; the CLI keeps `--deal` for an opportunity id.\n\n```bash\nkenso tasks add "Send the deck" --due tomorrow --account 812\nkenso tasks add "Call Ada back" --due friday --at 16:00 --person 501 --assignee ada@acme.com\nkenso tasks list --assignee me --due overdue,today\nkenso tasks queue --scope mine\nkenso tasks assign 7 me\nkenso tasks done 7 8 9\nkenso tasks done 7 --undo\n```\n\n- `tasks add` sends `POST /v1/tasks`. `--due` takes `today`, `tomorrow`, a weekday (the next one: `friday` or `fri`), a day (`2026-11-20`) or an ISO 8601 time with its offset (`2026-11-20T15:00:00Z`); `--at HH:MM` puts a time on that day (today without `--due`). Day words and `--at` read this computer\'s clock and time zone (`TZ`); a time\'s day is read in the assignee\'s app time zone. `--assignee` takes `me`, a member id or an email; without it the task is yours.\n- `tasks done` completes each task it names, in order (`PATCH /v1/tasks/{id}` with `status: done`); `--undo` reopens them. When one fails, its error names the tasks before it, which are already changed. `tasks assign` gives a task to `me`, a member id or a member\'s email; that member gets a `task_assigned` notification.\n- `tasks queue` is `task-queue list` under the name you would try: the Tasks screen\'s open work by due day, with `--scope mine|assigned_by_me|everyone`. It lists tasks, manual touches, call tasks, inbox threads with a reminder due (when you can view the Inbox) and Ken\'s follow-ups to you, each with the app path in `href` (null for a task, which opens in its panel).\n- `tasks list`, `get`, `update`, `delete`, `restore` and `task-queue list` are generated from the API: `kenso tasks --help` lists them.\n\n## Custom fields\n\n```bash\nkenso fields list --object account\nkenso fields create --object account --type select --label Region --data \'{"options":["EMEA","North America"]}\' --dry-run\nkenso fields create --object account --type select --label Region --data \'{"options":["EMEA","North America"]}\'\nkenso fields update --field-id 412 --label "Sales region"\nkenso fields archive --field-id 412 --yes\n```\n\nWith the `custom_fields` flag on, each workspace adds its own fields to accounts, people and deals (`--object account`, `person` or `opportunity`). `fields list` prints the built-in and custom fields; a custom field is `custom.<key>`, the name `customFields`, `bulk-update --set`, stage rules, layouts and imports use. Run it before you add a field that may already exist.\n\n- **`create`** takes `--object`, `--type` (`text`, `number`, `boolean`, `date`, `json`, `select`, `multi_select`, `currency`, `url` or `user`; fixed once created) and `--label`. `--key` is made from the label when you leave it out ("Contract value" is `contract_value`). `--description` says what the field means; Ken reads it when it fills the field. A select or multi_select takes its choices in `--data` as `options`, each a label or `{label, color, key}`, up to 200.\n- **`update`** changes the label, the description or the options. `options` in `--data` is the whole list: keep an option by its `key`, and one you leave out is archived, never deleted, so the records that hold it keep it.\n- **`archive`** hides a field from the pickers, the columns and the record rail and keeps every value, so it asks for `--yes`. `kenso fields update --field-id 412 --no-is-archived` brings it back. An object holds at most 100 live custom fields.\n\n## Field-fill settings and Ken\'s suggestions\n\n```bash\nkenso field-fill-settings list\nkenso field-fill-settings update --object opportunity --field amount --mode suggest --instruction "Budget the buyer named, in USD"\nkenso suggestions list --account-id 812\nkenso suggestions approve --suggestion-id 31\nkenso suggestions reject --suggestion-id 32 --reason "That was last year\'s budget"\nkenso fields fill --object opportunity --field nextStep --all\n```\n\nWith the `ken_field_fill` flag on, Ken reads email, calls and meetings and fills record fields. `field-fill-settings list` shows each field Ken can fill with its `mode`: `default` (Ken fills an empty field and suggests a change to a filled one), `off`, `suggest` (every value waits for a person) or `auto`. `update` sets a field\'s mode and an `--instruction` of up to 500 characters that tells Ken what to look for. A new mode applies to the next email, call or meeting Ken reads.\n\nA value that waits for a person is a suggestion: the field, its value now (`from`), Ken\'s value (`to`), the quote and its source. `suggestions list` shows the pending ones; narrow it with `--status`, `--object` and `--record-id` (one record), `--account-id` (the account, its people and its deals) or `--meeting-id`. `approve` writes Ken\'s value to the record (`--data \'{"value": ...}\'` writes yours instead) and `reject` leaves the record as it is. Both are a person\'s call: run them on the user\'s word.\n\n`fields fill` fills one deal field for the deals that have none, from their recorded meetings and captured email. As written above it only answers how many deals have no value and what filling them costs, and starts nothing; `--no-body-dry-run` starts it. It needs `bulk_edit` too, and works on deal fields only.\n\n## Saved views\n\n```bash\nkenso views list --object account\nkenso views create --object account --name "Tier 1, no meeting in 30 days" --visibility workspace --data @view.json --dry-run\nkenso views run --view-id 140 --limit 100 --include-total\nkenso views update --view-id 140 --name "Tier 1, quiet for 30 days"\nkenso views delete --view-id 140 --yes\n```\n\nWith the `shared_views` flag on, a saved view is a name, its object\'s search `filter` and `sort`, `columns` and a `layout` (`list` or `board`), private to its maker or shared with the workspace (`--visibility workspace`). `view.json` holds `filter` and `sort` in the shape the object\'s search takes (`filters`, `where`, `q`), so try it with `kenso accounts search --data` first. `views list` shows the workspace\'s shared views and your private ones. `run` lists a view\'s records exactly as its object\'s search returns them, page by page. `update` changes what you send, and `filter` replaces the whole filter. Any member changes or deletes a shared view, but only its maker makes it private. `delete` asks for `--yes` and takes the view off every member\'s sidebar. `kenso views pin` (above) pins one.\n\n## Reports and dashboards\n\n```bash\nkenso reports summary\nkenso reports list\nkenso reports run won_by_month --period this_year --owner 41\nkenso reports query --data \'{"measures":[{"op":"sum","field":"amount"}],"dimensions":[{"field":"stage"}]}\'\nkenso dashboards create --name "Q4 pipeline" --visibility workspace\nkenso dashboards add-chart --dashboard-id 3 --title "Won by month" --data \'{"report":{"key":"won_by_month","period":"this_year"}}\'\n```\n\nWith the `opportunities` and `reports` flags on, reports count and sum your deals. `reports summary` prints where the period stands (closed won, open pipeline, weighted pipeline, win rate) and what needs you, then one row per stock report. `reports run <report>` prints one stock report as a table: `pipeline_by_stage`, `won_by_month`, `stage_conversion`, `time_in_stage`, `won_by_source_campaign` or `activity_by_member`. Each takes `--period` (`this_quarter` by default, a month such as `2026-03`, a quarter, a year or a day range), `--owner` and `--pipeline`, and `--full` prints the whole answer with each bucket\'s filter for `opportunities search`.\n\n`reports query` asks your own question: `measures` (1 to 4 of `count`, `sum`, `avg` or `weighted_sum` of `amount`), `dimensions` (up to 2 of `stage`, `stageCategory`, `ownerMemberId`, `sourceCampaignId`, `closedAt`, `createdAt` or `closeDate`, the dates by `month`, `quarter` or `year`) and a `filter` as `opportunities search` takes it. It only reads.\n\nA dashboard keeps charts, up to 12, private to its owner or shared with the workspace. A chart is a stock report (`report`: its `key`, `period`, `ownerMemberId`, `pipelineId`) or a `query`, drawn as `bars` or a `trend`. `dashboards get --dashboard-id 3` reads one, and `update`, `remove-chart` and `delete` change it (the last two ask for `--yes`).\n\n## Forecast and quotas\n\n```bash\nkenso forecast show --period 2026-Q4\nkenso forecast show --period 2026-11 --include-deals\nkenso quotas list --period 2026-Q4\nkenso quotas propose --period 2027-Q1 --uplift-percent 15\nkenso quotas propose --period 2027-Q1 --uplift-percent 15 --apply\nkenso quotas set --period 2027-Q1 --member-id 41 --amount 120000\n```\n\nWith the `opportunities` and `forecast` flags on, `forecast show` reads closed won, commit and best case for a quarter (`2026-Q4`) or a month (`2026-11`), per member and for the team, each against its quota. Without `--period` it reads the current quarter. `--include-deals` adds the deals it counted. `quotas propose` works out each member\'s quota from what they closed won in the quarter before the period (or the last quarter that has ended) plus `--uplift-percent` (0 to 200, default 15), and writes nothing; with `--apply` it saves those amounts. `quotas set` sets one member\'s quota in the workspace currency, and `--data \'{"memberId":41,"amount":null}\'` removes it.\n';
|
|
8781
8788
|
}
|
|
8782
8789
|
});
|
|
8783
8790
|
|
|
@@ -8793,7 +8800,7 @@ var init_leads = __esm({
|
|
|
8793
8800
|
var output_and_errors_default;
|
|
8794
8801
|
var init_output_and_errors = __esm({
|
|
8795
8802
|
"docs/output-and-errors.md"() {
|
|
8796
|
-
output_and_errors_default = '# Output and errors\n\nEvery command follows one contract, so a script or an agent can parse any of them the same way.\n\n## stdout and stderr\n\n- **stdout carries data only.** Progress, warnings, notices and errors go to stderr.\n- No colors, spinners or pagers. On a terminal you get readable tables; in a pipe you get JSON.\n- A batch command (an import, update, remove, tag or `--each` write) takes `--yes`; without it, the command plans or refuses.\n- A command that deletes, archives or removes, such as `kenso tags delete --tag-id 7`, `kenso campaigns archive` or `kenso api DELETE /v1/tags/7`, needs `--yes` too. Without it, a person at a terminal is asked to confirm; anywhere else (a pipe, a script, CI, a coding agent) it sends nothing and fails with `confirmation_required`, whose `next` is the same command with `--yes`.\n- Any other single write, such as `kenso tags create` or a write through `kenso api` or `kenso mcp call`, sends at once: add `--dry-run` to print the request first (it sends nothing), then run the command without it.\n- A command with no dry run, such as `kenso contacts export`, `kenso auth logout` or `kenso workspace use`, refuses `--dry-run` with `usage_error` (exit 2) and does nothing. Its help ends with `No --dry-run`, and `kenso describe <resource> <action>` shows `"dryRun": false`.\n\n## Formats\n\n| What the command returns | stdout is a terminal | stdout is a pipe or file |\n|---|---|---|\n| One object | key-value lines | compact JSON on one line |\n| A list | a table (first 8 scalar fields, cells cut at 60 characters) | NDJSON: one JSON object per line |\n| A batch run | key-value lines | one JSON summary object |\n| No content (HTTP 204) | nothing | nothing |\n\n`-o` or `--output` picks the format: `json`, `ndjson`, `table` or `ids`. `--json` is the same as `-o json`.\n\n- `-o json` on a list prints one JSON array. On a terminal, `-o json` pretty-prints an object.\n- `-o ids` prints one id per line, ready for `--ids -`. Items without an `id` are skipped with one warning.\n\n```bash\nkenso campaigns list --limit 3\nkenso campaigns list --limit 3 -o json\nkenso contacts list --campaign-id 812 --all -o ids\n```\n\n## Shape the output\n\n- `--fields a,b.c` keeps only those fields (dots reach into nested objects).\n- `--query <JMESPath>` filters or reshapes in-process, so you need no `jq`. On a list it sees the whole list. There is no `--jq`: `--query` takes JMESPath, not jq syntax.\n- Neither applies to a batch summary, which always prints in full.\n- `threads list`, `contacts list` and `contacts search` print a short set of fields per row, in every format: a thread\'s id, channel, sender, subject, interest, read state, newest message time and preview, a contact\'s id, name, email, title, company and email validity, and a few more (the command\'s `--help` names them all). `--full` prints every field (`--full -o json` for a script that reads them all), `--fields` picks your own, and `--query` sees every field.\n\n```bash\nkenso campaigns list --fields id,name,status\nkenso campaigns list --all --query "[?status==\'active\'].id"\nkenso me get --query "length(features)"\nkenso threads list --folder inbox --full\n```\n\n## Lists and pages\n\nA list command prints one page. When there are more, it prints the command for the next page on stderr, for example `next: kenso tags list --limit 1 --cursor MQ`. `--all` follows every page and streams the items. `--limit` sets the page size and `--cursor` starts at a cursor.\n\n`accounts search`, `contacts search` and `people search` page the same way: one page with the `next:` command, or every page with `--all`. A search that asks for counts (`countBy` in `--data`) prints the whole answer instead: `data`, `pagination` and `counts`. Counts cover every match whatever the page, so ask for them on one page (`--limit 1`): `--all` with `countBy` is a usage error.\n\n```bash\nkenso tags list --limit 50\nkenso tags list --all\n```\n\n## Files: uploads and downloads\n\nA command whose API action takes a multipart upload takes `--file <path>`: the CLI reads the file and sends it in the form, with a content type from its extension (a `.png` goes as `image/png`), and the other flags as form fields. `--file <field>=<path>` names the form field, for a form with more than one file. An upload that also takes JSON, such as a logo from a URL instead of a file, sends JSON when you leave `--file` out.\n\nA command whose API action answers with a file (a CSV, an image, a ZIP) takes `--out <path>`: it saves the answer byte for byte (mode 0600) and prints `out`, `bytes` and `contentType`, so the file never passes through an agent\'s context. Without `--out`, a CSV prints as it came, and a binary file goes to stdout only when stdout is a pipe or a file: on a terminal it fails with `binary_output`, whose `next` adds `--out`.\n\n`kenso api` takes both, for any route: `--file` (repeat it for more files) sends multipart with the keys of a `--data` object as form fields, and `--out` saves any answer.\n\n```bash\nkenso saved-lists create-upload --saved-list-id 12 --file people.csv\nkenso workspaces replace-logo --workspace-id 42 --file ./logo.png\nkenso workspaces replace-logo --workspace-id 42 --source-url https://example.com/logo.png\nkenso attachments get-content --attachment-id att_123 --out ./invoice.pdf\nkenso api POST /v1/campaigns/812/email-sequence/images --file ./hero.png\nkenso api GET /v1/knowledge/exports/77/content --out knowledge.zip\n```\n\n## Live streams\n\n`kenso sync events` and `kenso onboarding-builds events` follow a live stream of server-sent events. They print one JSON line per event as it arrives, on a terminal too, with the event\'s name, its id when it has one, and its data:\n\n```json\n{"event":"hello","data":{"buildId":"obd_2x","status":"building","stage":"read","lastEventId":0}}\n{"event":"stage","id":"41","data":{"stage":"plan"}}\n{"event":"done","id":"42","data":{}}\n```\n\nA stream has no time limit while events arrive. The server ends each connection after 15 minutes with a `bye` event; the command then connects again at once, and after a dropped connection or 60 s without even a keepalive, after a second. A connection that brought nothing but `hello` and `bye` (a server that is restarting) backs off 1, 2, 4 ... 30 s. Once events carry an id (`onboarding-builds events`), it sends the last whole event\'s id as `Last-Event-ID`, so no event is lost or printed twice. A refusal (401, 403, 404) ends it at once; eight failed or empty connects in a row end it with the last error.\n\nIt runs until Ctrl-C (exit 130; every line printed is whole), or until one of these:\n\n| Flag | Ends the command |\n|---|---|\n| `--until <event>` | After the first event with that name; several names are comma-separated: `--until done,error` |\n| `--max-events <n>` | After n events, `hello` and `bye` included |\n| `--once` | When the server closes the connection, instead of connecting again |\n\n```bash\nkenso onboarding-builds events --build-id obd_2x --until done,error\nkenso sync events --max-events 2 # hello, then the first poke\n```\n\n`--output`, `--fields` and `--query` do not apply to a stream. `--last-event-id` starts an onboarding build stream after that id.\n\n## Errors\n\nWhen stderr is not a terminal, an error is one JSON line on stderr:\n\n```json\n{"error":{"code":"unknown_flag","message":"Unknown flag --fiel for kenso contacts import.","field":"fiel","hint":"did you mean --file?","next":"kenso contacts import --help"}}\n```\n\n| Key | Always there | Meaning |\n|---|---|---|\n| `code` | yes | A stable snake_case code to branch on |\n| `message` | yes | One sentence for a person |\n| `field` | no | The flag or input field at fault |\n| `hint` | no | What to change |\n| `next` | no | The exact command to run next, such as `kenso auth login`, `kenso workspace list --search <name>` or the same command with `--yes` |\n| `httpStatus` | no | The API\'s HTTP status, when the API answered |\n| `requestId` | no | The API\'s request id: quote it when you contact Kenso support |\n\nOn a terminal the same error prints as text: `Error: <message>`, then `field:`, `hint:`, `next:` and `requestId:` lines. The key never appears in an error.\n\n### How API errors map\n\nThe CLI looks at the HTTP status first, then at the API\'s own `error.code`, which wins when present.\n\n| HTTP status | Default code | Exit |\n|---|---|---|\n| 400, 422 | `validation_failed` | 2 |\n| 401 | `unauthorized` (`next`: `kenso auth login`) | 3 |\n| 403 | `forbidden`: the key\'s user or role cannot do this in this workspace | 3 |\n| 404 | `not_found` | 4 |\n| 409 | `conflict` | 7 |\n| 429 | `rate_limited`, after the CLI waited and retried | 6 |\n| 5xx | `server_error`, after retries where they are safe | 8 |\n| anything else | `http_error` | 1 |\n\nTwo API codes change the exit code: `workspace_required` exits 2 with `"next":"kenso workspace list --search <name>"`, and `limit_reached` (the plan\'s or the campaign\'s lead limit) exits 6.\n\n### Errors from the CLI itself\n\n| Code | Exit | When |\n|---|---|---|\n| `usage_error` | 2 | A required flag or argument is missing, two flags conflict (`--yes` with `--dry-run`), or `--dry-run` on a command that has no dry run |\n| `unknown_command` | 2 | No such command; `hint` suggests the closest one |\n| `unknown_flag`, `invalid_flag`, `invalid_flag_value`, `unexpected_argument` | 2 | A flag or argument the command does not take |\n| `invalid_query` | 2 | `--query` is not valid JMESPath |\n| `confirmation_required` | 2 | A delete, archive or remove ran without `--yes` where nobody can confirm: nothing was sent; `next` adds `--yes` |\n| `cancelled` | 2 | A person answered no to the confirmation: nothing was sent |\n| `file_unreadable` | 2 | An input file is missing, is a folder, cannot be opened, or cannot be parsed; the message names the line, such as `leads.csv line 3: a quote is not closed.` |\n| `config_invalid` | 2 | `~/.kenso/config.json` is not valid JSON: fix or delete it |\n| `feature_not_enabled` | 2 | Every action of the resource is a beta command your workspace has not enabled |\n| `invalid_key_format`, `key_required` | 2 | `auth login --with-key` read something that is not a Kenso key, or stdin is a terminal instead of a pipe |\n| `invalid_workspace_id` | 2 | `kenso workspace use` got an id that is not a positive whole number |\n| `unknown_topic` | 2 | `kenso docs` got a topic it does not have; `hint` lists the topics |\n| `file_unwritable` | 2 or 1 | An output file cannot be written: `--out` on `contacts export`, `kenso api` or a download command (2), `skill install` (1) |\n| `binary_output` | 2 | The answer is a binary file and stdout is a terminal: nothing was printed; `next` saves it with `--out` |\n| `no_api_key` | 3 | No key in `KENSO_API_KEY` or the profile (`next`: `kenso auth login`) |\n| `browser_login_unavailable`, `access_denied`, `login_expired` | 3 | Browser login is off, was denied, or timed out |\n| `run_not_found` | 4 | `kenso runs show` or `resume` got an unknown run id |\n| `docs_not_found` | 4 | `kenso docs reference` before the reference was generated (a source checkout without `pnpm build`) |\n| `run_in_progress`, `already_filled` | 7 | Another process is working on the run, or `studio fill` already ran with this file and these flags |\n| `skill_exists` | 7 | `kenso skill install` found a different `SKILL.md`; `next` adds `--force` to replace it |\n| `local_changes` | 7 | `studio pull` would replace files that no earlier pull wrote or push sent, or that changed since; nothing was written, and `next` adds `--force` to replace them |\n| `job_timeout`, `job_failed`, `job_canceled` | 1 | `kenso jobs wait` (or a command that waits on a job) ran out of time, or the job failed or was canceled |\n| `mcp_tool_error` | 1 | `kenso mcp call`: the MCP tool answered with an error |\n| `unsafe_path` | 1 | `studio pull` refused a file path that would land outside `--dir`, starts a file or folder name with a dot, or passes through a symbolic link |\n| `network_error` | 8 | The API could not be reached after retries |\n| `upload_failed`, `download_failed` | 8 or 1 | A signed upload or download of a Studio file failed: 8 when storage was unreachable or answered 5xx, 1 on a 4xx (often an expired link: run the command again) |\n| `pull_incomplete` | 8 | `studio pull`: a file came back with neither text nor a download link |\n| `unexpected_response` | 1 or 8 | The API answered something the CLI could not read |\n| `unexpected_error` | 1 | A bug: run again with `--verbose` and report it |\n| `interrupted` | 130 | Ctrl-C |\n\n## Exit codes\n\n| Code | Meaning |\n|---|---|\n| 0 | OK, including a batch where every row succeeded or was skipped |\n| 1 | Unexpected error |\n| 2 | Usage or input error: a bad flag, a bad file, a validation error |\n| 3 | Auth: no key, an invalid, revoked or expired key, or HTTP 401 or 403 |\n| 4 | Not found |\n| 5 | Partial: the batch finished and some rows failed, were not found or were invalid. See `results.csv` |\n| 6 | Rate limited after retries, or a plan or campaign lead limit stopped the run (`limit_reached`) |\n| 7 | Conflict or invalid state (HTTP 409), or a run another process holds |\n| 8 | Server error after retries (5xx), or the API is unreachable |\n| 9 | Answer refused: a Kenso sandbox run stopped because an answer held a credential or something shaped like one |\n| 130 | Interrupted. A batch run can be resumed: see its `next` |\n\nSkipped rows (duplicates, blocklisted, already contacted) are not failures: a batch with only created, updated and skipped rows exits 0.\n\n## Flags\n\n- Command flags go after the command: `kenso contacts import --campaign 812`. Global flags can go anywhere.\n- A boolean flag takes `--flag`, `--no-flag`, `--flag=true` and `--flag=false`.\n- A flag that carries a secret (`--password`, `--api-key`, `--api-secret`, any `--\u2026-token` or `--\u2026-secret`) also takes `-` (read stdin), `@file` (read the file) or `env:NAME` (read that environment variable), so the value stays out of shell history: `printf \'%s\' "$FATHOM_KEY" | kenso fathom-connection connect --api-key -`. A value typed on the command line still works and prints one warning. A typed secret that itself starts with `@` is written `@@` (`--password @@Spring2026` sends `@Spring2026`); one that is exactly `-` or starts with `env:` has to come through `@file` or `env:NAME`. `-` refuses a terminal, an empty value is refused, and only one flag can read stdin. `--dry-run` shows a secret as `***`. With `--each`, the plan, its `next` and the run record keep `@file` or `env:NAME` as typed and `kenso runs resume` reads it again; a secret from stdin is refused there.\n- `--help` on any command prints its flags, arguments and examples. `kenso describe <resource> <action>` prints the same as JSON, with the body schema.\n\n## Beta commands\n\nCommands that need a workspace feature flag (CRM, Studio and others) are beta. Help and `kenso describe` hide the ones your workspace has not enabled and say how many they hid; `--all-commands` shows them. Calling a hidden command still works: Kenso decides. `kenso <resource>` on a resource whose every action is hidden answers `feature_not_enabled` (exit 2) and names the flags it needs.\n\n```bash\nkenso --help --all-commands\nkenso describe --all-commands\n```\n\n## What the CLI sends\n\nEvery API call carries `Authorization: Bearer <key>`, `Ken-Version: 1.1`, `X-Ken-Workspace-Id` (when a workspace is picked), `User-Agent: kenso-cli/<version> (node <version>; <platform>)` and `X-Ken-Client: Kenso CLI`. When a coding agent runs the CLI, `X-Ken-Client` names it (`Kenso CLI via Claude Code`) and writes carry `X-Ken-Actor: agent`, so Kenso\'s activity log shows who made a change.\n';
|
|
8803
|
+
output_and_errors_default = '# Output and errors\n\nEvery command follows one contract, so a script or an agent can parse any of them the same way.\n\n## stdout and stderr\n\n- **stdout carries data only.** Progress, warnings, notices and errors go to stderr.\n- No colors, spinners or pagers. On a terminal you get readable tables; in a pipe you get JSON.\n- A batch command (an import, update, remove, tag or `--each` write) takes `--yes`; without it, the command plans or refuses.\n- A command that deletes, archives, removes or merges, such as `kenso tags delete --tag-id 7`, `kenso campaigns archive`, `kenso people merge` or `kenso api DELETE /v1/tags/7`, needs `--yes` too. Without it, a person at a terminal is asked to confirm; anywhere else (a pipe, a script, CI, a coding agent) it sends nothing and fails with `confirmation_required`, whose `next` is the same command with `--yes`.\n- Any other single write, such as `kenso tags create`, `kenso notes add` or a write through `kenso api` or `kenso mcp call`, sends at once: add `--dry-run` to print the request first (it sends nothing), then run the command without it. A command that reads before it writes (`kenso layouts set --header` reads the layout it edits) still reads with `--dry-run`, and prints the write it would send. A POST that changes nothing, such as `kenso accounts search` or `kenso reports query`, is a read like a GET.\n- A command with no dry run, such as `kenso contacts export`, `kenso auth logout` or `kenso workspace use`, refuses `--dry-run` with `usage_error` (exit 2) and does nothing. Its help ends with `No --dry-run`, and `kenso describe <resource> <action>` shows `"dryRun": false`.\n\n## Formats\n\n| What the command returns | stdout is a terminal | stdout is a pipe or file |\n|---|---|---|\n| One object | key-value lines | compact JSON on one line |\n| A list | a table (first 8 scalar fields, cells cut at 60 characters) | NDJSON: one JSON object per line |\n| A batch run | key-value lines | one JSON summary object |\n| No content (HTTP 204, such as a delete) | key-value lines: `ok`, `status`, `request` | `{"ok":true,"status":204,"request":{"method":"DELETE","path":"/v1/tasks/7"}}` |\n\n`-o` or `--output` picks the format: `json`, `ndjson`, `table` or `ids`. `--json` is the same as `-o json`.\n\n- `-o json` on a list prints one JSON array. On a terminal, `-o json` pretty-prints an object.\n- `-o ids` prints one id per line, ready for `--ids -`. Items without an `id` are skipped with one warning.\n\n```bash\nkenso campaigns list --limit 3\nkenso campaigns list --limit 3 -o json\nkenso contacts list --campaign-id 812 --all -o ids\n```\n\n## Shape the output\n\n- `--fields a,b.c` keeps only those fields (dots reach into nested objects).\n- `--query <JMESPath>` filters or reshapes in-process, so you need no `jq`. On a list it sees the whole list. There is no `--jq`: `--query` takes JMESPath, not jq syntax.\n- Neither applies to a batch summary, which always prints in full.\n- `threads list`, `contacts list` and `contacts search` print a short set of fields per row, in every format: a thread\'s id, channel, sender, subject, interest, read state, newest message time and preview, a contact\'s id, name, email, title, company and email validity, and a few more (the command\'s `--help` names them all). `--full` prints every field (`--full -o json` for a script that reads them all), `--fields` picks your own, and `--query` sees every field.\n\n```bash\nkenso campaigns list --fields id,name,status\nkenso campaigns list --all --query "[?status==\'active\'].id"\nkenso me get --query "length(features)"\nkenso threads list --folder inbox --full\n```\n\n## Lists and pages\n\nA list command prints one page. When there are more, it prints the command for the next page on stderr, for example `next: kenso tags list --limit 1 --cursor MQ`. `--all` follows every page and streams the items. `--limit` sets the page size and `--cursor` starts at a cursor.\n\n`accounts search`, `contacts search` and `people search` page the same way: one page with the `next:` command, or every page with `--all`. A search that asks for counts (`countBy` in `--data`) prints the whole answer instead: `data`, `pagination` and `counts`. Counts cover every match whatever the page, so ask for them on one page (`--limit 1`): `--all` with `countBy` is a usage error.\n\n```bash\nkenso tags list --limit 50\nkenso tags list --all\n```\n\n## Files: uploads and downloads\n\nA command whose API action takes a multipart upload takes `--file <path>`: the CLI reads the file and sends it in the form, with a content type from its extension (a `.png` goes as `image/png`), and the other flags as form fields. `--file <field>=<path>` names the form field, for a form with more than one file. An upload that also takes JSON, such as a logo from a URL instead of a file, sends JSON when you leave `--file` out.\n\nA command whose API action answers with a file (a CSV, an image, a ZIP) takes `--out <path>`: it saves the answer byte for byte (mode 0600) and prints `out`, `bytes` and `contentType`, so the file never passes through an agent\'s context. Without `--out`, a CSV prints as it came, and a binary file goes to stdout only when stdout is a pipe or a file: on a terminal it fails with `binary_output`, whose `next` adds `--out`.\n\n`kenso api` takes both, for any route: `--file` (repeat it for more files) sends multipart with the keys of a `--data` object as form fields, and `--out` saves any answer.\n\n```bash\nkenso saved-lists create-upload --saved-list-id 12 --file people.csv\nkenso workspaces replace-logo --workspace-id 42 --file ./logo.png\nkenso workspaces replace-logo --workspace-id 42 --source-url https://example.com/logo.png\nkenso attachments get-content --attachment-id att_123 --out ./invoice.pdf\nkenso api POST /v1/campaigns/812/email-sequence/images --file ./hero.png\nkenso api GET /v1/knowledge/exports/77/content --out knowledge.zip\n```\n\n## Live streams\n\n`kenso sync events` and `kenso onboarding-builds events` follow a live stream of server-sent events. They print one JSON line per event as it arrives, on a terminal too, with the event\'s name, its id when it has one, and its data:\n\n```json\n{"event":"hello","data":{"buildId":"obd_2x","status":"building","stage":"read","lastEventId":0}}\n{"event":"stage","id":"41","data":{"stage":"plan"}}\n{"event":"done","id":"42","data":{}}\n```\n\nA stream has no time limit while events arrive. The server ends each connection after 15 minutes with a `bye` event; the command then connects again at once, and after a dropped connection or 60 s without even a keepalive, after a second. A connection that brought nothing but `hello` and `bye` (a server that is restarting) backs off 1, 2, 4 ... 30 s. Once events carry an id (`onboarding-builds events`), it sends the last whole event\'s id as `Last-Event-ID`, so no event is lost or printed twice. A refusal (401, 403, 404) ends it at once; eight failed or empty connects in a row end it with the last error.\n\nIt runs until Ctrl-C (exit 130; every line printed is whole), or until one of these:\n\n| Flag | Ends the command |\n|---|---|\n| `--until <event>` | After the first event with that name; several names are comma-separated: `--until done,error` |\n| `--max-events <n>` | After n events, `hello` and `bye` included |\n| `--once` | When the server closes the connection, instead of connecting again |\n\n```bash\nkenso onboarding-builds events --build-id obd_2x --until done,error\nkenso sync events --max-events 2 # hello, then the first poke\n```\n\n`--output`, `--fields` and `--query` do not apply to a stream. `--last-event-id` starts an onboarding build stream after that id.\n\n## Errors\n\nWhen stderr is not a terminal, an error is one JSON line on stderr:\n\n```json\n{"error":{"code":"unknown_flag","message":"Unknown flag --fiel for kenso contacts import.","field":"fiel","hint":"did you mean --file?","next":"kenso contacts import --help"}}\n```\n\n| Key | Always there | Meaning |\n|---|---|---|\n| `code` | yes | A stable snake_case code to branch on |\n| `message` | yes | One sentence for a person |\n| `field` | no | The flag or input field at fault |\n| `hint` | no | What to change |\n| `next` | no | The exact command to run next, such as `kenso auth login`, `kenso workspace list --search <name>` or the same command with `--yes` |\n| `httpStatus` | no | The API\'s HTTP status, when the API answered |\n| `requestId` | no | The API\'s request id: quote it when you contact Kenso support |\n\nOn a terminal the same error prints as text: `Error: <message>`, then `field:`, `hint:`, `next:` and `requestId:` lines. The key never appears in an error.\n\n### How API errors map\n\nThe CLI looks at the HTTP status first, then at the API\'s own `error.code`, which wins when present.\n\n| HTTP status | Default code | Exit |\n|---|---|---|\n| 400, 422 | `validation_failed` | 2 |\n| 401 | `unauthorized` (`next`: `kenso auth login`) | 3 |\n| 403 | `forbidden`: the key\'s user or role cannot do this in this workspace | 3 |\n| 404 | `not_found` | 4 |\n| 409 | `conflict` | 7 |\n| 429 | `rate_limited`, after the CLI waited and retried | 6 |\n| 5xx | `server_error`, after retries where they are safe | 8 |\n| anything else | `http_error` | 1 |\n\nTwo API codes change the exit code: `workspace_required` exits 2 with `"next":"kenso workspace list --search <name>"`, and `limit_reached` (the plan\'s or the campaign\'s lead limit) exits 6.\n\n### Errors from the CLI itself\n\n| Code | Exit | When |\n|---|---|---|\n| `usage_error` | 2 | A required flag or argument is missing, two flags conflict (`--yes` with `--dry-run`), or `--dry-run` on a command that has no dry run |\n| `unknown_command` | 2 | No such command; `hint` suggests the closest one |\n| `unknown_flag`, `invalid_flag`, `invalid_flag_value`, `unexpected_argument` | 2 | A flag or argument the command does not take |\n| `invalid_query` | 2 | `--query` is not valid JMESPath |\n| `confirmation_required` | 2 | A delete, archive or remove ran without `--yes` where nobody can confirm: nothing was sent; `next` adds `--yes` |\n| `cancelled` | 2 | A person answered no to the confirmation: nothing was sent |\n| `file_unreadable` | 2 | An input file is missing, is a folder, cannot be opened, or cannot be parsed; the message names the line, such as `leads.csv line 3: a quote is not closed.` |\n| `config_invalid` | 2 | `~/.kenso/config.json` is not valid JSON: fix or delete it |\n| `feature_not_enabled` | 2 | Every action of the resource is a beta command your workspace has not enabled |\n| `invalid_key_format`, `key_required` | 2 | `auth login --with-key` read something that is not a Kenso key, or stdin is a terminal instead of a pipe |\n| `invalid_workspace_id` | 2 | `kenso workspace use` got an id that is not a positive whole number |\n| `unknown_topic` | 2 | `kenso docs` got a topic it does not have; `hint` lists the topics |\n| `file_unwritable` | 2 or 1 | An output file cannot be written: `--out` on `contacts export`, `kenso api` or a download command (2), `skill install` (1) |\n| `binary_output` | 2 | The answer is a binary file and stdout is a terminal: nothing was printed; `next` saves it with `--out` |\n| `no_api_key` | 3 | No key in `KENSO_API_KEY` or the profile (`next`: `kenso auth login`) |\n| `browser_login_unavailable`, `access_denied`, `login_expired` | 3 | Browser login is off, was denied, or timed out |\n| `run_not_found` | 4 | `kenso runs show` or `resume` got an unknown run id |\n| `docs_not_found` | 4 | `kenso docs reference` before the reference was generated (a source checkout without `pnpm build`) |\n| `run_in_progress`, `already_filled` | 7 | Another process is working on the run, or `studio fill` already ran with this file and these flags |\n| `skill_exists` | 7 | `kenso skill install` found a different `SKILL.md`; `next` adds `--force` to replace it |\n| `local_changes` | 7 | `studio pull` would replace files that no earlier pull wrote or push sent, or that changed since; nothing was written, and `next` adds `--force` to replace them |\n| `job_timeout`, `job_failed`, `job_canceled` | 1 | `kenso jobs wait` (or a command that waits on a job) ran out of time, or the job failed or was canceled |\n| `mcp_tool_error` | 1 | `kenso mcp call`: the MCP tool answered with an error |\n| `unsafe_path` | 1 | `studio pull` refused a file path that would land outside `--dir`, starts a file or folder name with a dot, or passes through a symbolic link |\n| `network_error` | 8 | The API could not be reached after retries |\n| `upload_failed`, `download_failed` | 8 or 1 | A signed upload or download of a Studio file failed: 8 when storage was unreachable or answered 5xx, 1 on a 4xx (often an expired link: run the command again) |\n| `pull_incomplete` | 8 | `studio pull`: a file came back with neither text nor a download link |\n| `unexpected_response` | 1 or 8 | The API answered something the CLI could not read |\n| `unexpected_error` | 1 | A bug: run again with `--verbose` and report it |\n| `interrupted` | 130 | Ctrl-C |\n\n## Exit codes\n\n| Code | Meaning |\n|---|---|\n| 0 | OK, including a batch where every row succeeded or was skipped |\n| 1 | Unexpected error |\n| 2 | Usage or input error: a bad flag, a bad file, a validation error |\n| 3 | Auth: no key, an invalid, revoked or expired key, or HTTP 401 or 403 |\n| 4 | Not found |\n| 5 | Partial: the batch finished and some rows failed, were not found or were invalid. See `results.csv` |\n| 6 | Rate limited after retries, or a plan or campaign lead limit stopped the run (`limit_reached`) |\n| 7 | Conflict or invalid state (HTTP 409), or a run another process holds |\n| 8 | Server error after retries (5xx), or the API is unreachable |\n| 9 | Answer refused: a Kenso sandbox run stopped because an answer held a credential or something shaped like one |\n| 130 | Interrupted. A batch run can be resumed: see its `next` |\n\nSkipped rows (duplicates, blocklisted, already contacted) are not failures: a batch with only created, updated and skipped rows exits 0.\n\n## Flags\n\n- Command flags go after the command: `kenso contacts import --campaign 812`. Global flags can go anywhere.\n- A boolean flag takes `--flag`, `--no-flag`, `--flag=true` and `--flag=false`.\n- A flag that carries a secret (`--password`, `--api-key`, `--api-secret`, any `--\u2026-token` or `--\u2026-secret`) also takes `-` (read stdin), `@file` (read the file) or `env:NAME` (read that environment variable), so the value stays out of shell history: `printf \'%s\' "$FATHOM_KEY" | kenso fathom-connection connect --api-key -`. A value typed on the command line still works and prints one warning. A typed secret that itself starts with `@` is written `@@` (`--password @@Spring2026` sends `@Spring2026`); one that is exactly `-` or starts with `env:` has to come through `@file` or `env:NAME`. `-` refuses a terminal, an empty value is refused, and only one flag can read stdin. `--dry-run` shows a secret as `***`. With `--each`, the plan, its `next` and the run record keep `@file` or `env:NAME` as typed and `kenso runs resume` reads it again; a secret from stdin is refused there.\n- `--help` on any command prints its flags, arguments and examples. `kenso describe <resource> <action>` prints the same as JSON, with the body schema.\n\n## Beta commands\n\nCommands that need a workspace feature flag (CRM, Studio and others) are beta. Help and `kenso describe` hide the ones your workspace has not enabled and say how many they hid; `--all-commands` shows them. Calling a hidden command still works: Kenso decides. `kenso <resource>` on a resource whose every action is hidden answers `feature_not_enabled` (exit 2) and names the flags it needs.\n\n```bash\nkenso --help --all-commands\nkenso describe --all-commands\n```\n\n## What the CLI sends\n\nEvery API call carries `Authorization: Bearer <key>`, `Ken-Version: 1.1`, `X-Ken-Workspace-Id` (when a workspace is picked), `User-Agent: kenso-cli/<version> (node <version>; <platform>)` and `X-Ken-Client: Kenso CLI`. When a coding agent runs the CLI, `X-Ken-Client` names it (`Kenso CLI via Claude Code`) and writes carry `X-Ken-Actor: agent`, so Kenso\'s activity log shows who made a change.\n';
|
|
8797
8804
|
}
|
|
8798
8805
|
});
|
|
8799
8806
|
|
|
@@ -10230,12 +10237,13 @@ var init_status = __esm({
|
|
|
10230
10237
|
const meRes = await ctx.client.request({ method: "GET", path: "/v1/me", noWorkspace: true, signal: ctx.signal });
|
|
10231
10238
|
const me = unwrap(meRes.body) ?? {};
|
|
10232
10239
|
const workspaces = Array.isArray(me.workspaces) ? me.workspaces : [];
|
|
10240
|
+
const staff = me.isSuperAdmin === true;
|
|
10233
10241
|
const activeId = ctx.auth.workspaceId;
|
|
10234
10242
|
let activeWorkspace = null;
|
|
10235
10243
|
if (activeId) {
|
|
10236
10244
|
const match = workspaces.find((w) => String(w.id) === activeId);
|
|
10237
10245
|
activeWorkspace = { id: activeId, name: match?.name ?? null };
|
|
10238
|
-
if (!match) ctx.output.warn(`The active workspace ${activeId} is not one of this key's workspaces.`);
|
|
10246
|
+
if (!match && !staff) ctx.output.warn(`The active workspace ${activeId} is not one of this key's workspaces.`);
|
|
10239
10247
|
}
|
|
10240
10248
|
const saved = readConfig(ctx.env).profiles[ctx.auth.profileName] ?? {};
|
|
10241
10249
|
const envOverrides = [];
|
|
@@ -10250,7 +10258,7 @@ var init_status = __esm({
|
|
|
10250
10258
|
);
|
|
10251
10259
|
}
|
|
10252
10260
|
const memberIds = workspaces.map((w) => String(w.id));
|
|
10253
|
-
const keysWorkspace = activeId && memberIds.includes(activeId) ? activeId : memberIds[0];
|
|
10261
|
+
const keysWorkspace = activeId && (staff || memberIds.includes(activeId)) ? activeId : memberIds[0];
|
|
10254
10262
|
let keyExpiresAt = null;
|
|
10255
10263
|
const apiKey = ctx.auth.apiKey ?? "";
|
|
10256
10264
|
try {
|
|
@@ -10287,6 +10295,7 @@ var init_status = __esm({
|
|
|
10287
10295
|
activeWorkspace,
|
|
10288
10296
|
keyExpiresAt,
|
|
10289
10297
|
keySource: ctx.auth.source,
|
|
10298
|
+
...staff ? { isSuperAdmin: true } : {},
|
|
10290
10299
|
profile: ctx.auth.profileName,
|
|
10291
10300
|
// A test key reaches only the sandbox it was made for, which kenso sandbox create saved as the workspace.
|
|
10292
10301
|
...isTestKey(apiKey) ? { keyKind: "test", sandboxId: activeId ?? null } : {},
|
|
@@ -10342,6 +10351,24 @@ var init_status2 = __esm({
|
|
|
10342
10351
|
}
|
|
10343
10352
|
});
|
|
10344
10353
|
|
|
10354
|
+
// src/core/dry-run.ts
|
|
10355
|
+
function printDryRun(ctx, ...requests) {
|
|
10356
|
+
if (ctx.flags.dryRun !== true) return false;
|
|
10357
|
+
const shown = requests.map((req) => ({
|
|
10358
|
+
method: req.method,
|
|
10359
|
+
path: req.path,
|
|
10360
|
+
...req.query ? { query: req.query } : {},
|
|
10361
|
+
...req.body !== void 0 ? { body: req.body } : {}
|
|
10362
|
+
}));
|
|
10363
|
+
ctx.output.object(shown.length === 1 ? { dryRun: true, request: shown[0] } : { dryRun: true, requests: shown });
|
|
10364
|
+
return true;
|
|
10365
|
+
}
|
|
10366
|
+
var init_dry_run = __esm({
|
|
10367
|
+
"src/core/dry-run.ts"() {
|
|
10368
|
+
"use strict";
|
|
10369
|
+
}
|
|
10370
|
+
});
|
|
10371
|
+
|
|
10345
10372
|
// src/commands/capture/connect.ts
|
|
10346
10373
|
var connect_exports = {};
|
|
10347
10374
|
__export(connect_exports, {
|
|
@@ -10351,6 +10378,7 @@ var PROVIDERS, command13, connect_default2;
|
|
|
10351
10378
|
var init_connect2 = __esm({
|
|
10352
10379
|
"src/commands/capture/connect.ts"() {
|
|
10353
10380
|
"use strict";
|
|
10381
|
+
init_dry_run();
|
|
10354
10382
|
init_errors();
|
|
10355
10383
|
init_exit_codes();
|
|
10356
10384
|
init_http();
|
|
@@ -10359,7 +10387,7 @@ var init_connect2 = __esm({
|
|
|
10359
10387
|
resource: "capture",
|
|
10360
10388
|
action: "connect",
|
|
10361
10389
|
summary: "Turn capture on for your own mailbox",
|
|
10362
|
-
description: "Sends PUT /v1/capture/mailbox. Kenso then logs your email with people in Kenso on the person, the account and its open deals, starting with the newest mail and going back 90 days; kenso capture status shows the progress. Running it again changes nothing. It uses the Google or Microsoft account you connected in Kenso with email access. With none, the answer is mailbox_not_connected: run it with --provider to get a sign-in link (POST /v1/calendar-accounts/connect-sessions), open the link, sign in, then run kenso capture connect again. other_mailbox_connected means your captured mailbox needs its sign-in again and the account connected now is another one: sign in to the captured mailbox again, or run kenso capture disconnect and then connect.",
|
|
10390
|
+
description: "Sends PUT /v1/capture/mailbox. Kenso then logs your email with people in Kenso on the person, the account and its open deals, starting with the newest mail and going back 90 days; kenso capture status shows the progress. Running it again changes nothing. It uses the Google or Microsoft account you connected in Kenso with email access. With none, the answer is mailbox_not_connected: run it with --provider to get a sign-in link (POST /v1/calendar-accounts/connect-sessions), open the link, sign in, then run kenso capture connect again. other_mailbox_connected means your captured mailbox needs its sign-in again and the account connected now is another one: sign in to the captured mailbox again, or run kenso capture disconnect and then connect. --dry-run prints the PUT and turns nothing on.",
|
|
10363
10391
|
flags: {
|
|
10364
10392
|
private: { type: "boolean", description: "Start with the Private switch on: teammates see none of this mailbox's email" },
|
|
10365
10393
|
provider: { type: "string", description: "google or microsoft: when no account is connected yet, print the sign-in link for one" }
|
|
@@ -10367,11 +10395,15 @@ var init_connect2 = __esm({
|
|
|
10367
10395
|
examples: ["kenso capture connect", "kenso capture connect --private", "kenso capture connect --provider google"],
|
|
10368
10396
|
beta: { featureGates: { all: ["crm_capture"] } },
|
|
10369
10397
|
operationIds: ["capture-mailbox.connect", "calendar-accounts.create-connect-session"],
|
|
10398
|
+
dryRun: true,
|
|
10370
10399
|
async run(ctx, { flags }) {
|
|
10371
10400
|
const provider = typeof flags.provider === "string" ? flags.provider : void 0;
|
|
10372
10401
|
if (provider !== void 0 && !PROVIDERS.includes(provider)) {
|
|
10373
10402
|
throw usageError("--provider is google or microsoft.", { field: "provider" });
|
|
10374
10403
|
}
|
|
10404
|
+
if (printDryRun(ctx, { method: "PUT", path: "/v1/capture/mailbox", body: flags.private === true ? { isPrivate: true } : {} })) {
|
|
10405
|
+
return ExitCode.Ok;
|
|
10406
|
+
}
|
|
10375
10407
|
try {
|
|
10376
10408
|
const res = await ctx.client.request({
|
|
10377
10409
|
method: "PUT",
|
|
@@ -10457,6 +10489,7 @@ var THREAD_FLAG, command15, private_default;
|
|
|
10457
10489
|
var init_private = __esm({
|
|
10458
10490
|
"src/commands/capture/private.ts"() {
|
|
10459
10491
|
"use strict";
|
|
10492
|
+
init_dry_run();
|
|
10460
10493
|
init_errors();
|
|
10461
10494
|
init_exit_codes();
|
|
10462
10495
|
init_http();
|
|
@@ -10466,7 +10499,7 @@ var init_private = __esm({
|
|
|
10466
10499
|
resource: "capture",
|
|
10467
10500
|
action: "private",
|
|
10468
10501
|
summary: "Hide your captured email from teammates, or show it again",
|
|
10469
|
-
description: "Sends PATCH /v1/capture/mailbox with isPrivate. on hides your captured email from teammates, mail already captured included: a teammate sees no trace of a thread only your mailbox holds, and a private mailbox creates no people or accounts. A message a teammate's own mailbox also holds stays visible through theirs. off shows your email again as the workspace setting allows. Email only: meetings stay visible, and Ken still reads the mailbox for you. With --thread it sends PATCH /v1/capture/threads/{threadId} instead: the switch for that one thread, as far as your own mailbox holds it.",
|
|
10502
|
+
description: "Sends PATCH /v1/capture/mailbox with isPrivate. on hides your captured email from teammates, mail already captured included: a teammate sees no trace of a thread only your mailbox holds, and a private mailbox creates no people or accounts. A message a teammate's own mailbox also holds stays visible through theirs. off shows your email again as the workspace setting allows. Email only: meetings stay visible, and Ken still reads the mailbox for you. With --thread it sends PATCH /v1/capture/threads/{threadId} instead: the switch for that one thread, as far as your own mailbox holds it. --dry-run prints the PATCH and changes nothing.",
|
|
10470
10503
|
flags: {
|
|
10471
10504
|
thread: { type: "string", description: "Set the switch for this one captured thread (its id), not the whole mailbox" }
|
|
10472
10505
|
},
|
|
@@ -10474,15 +10507,17 @@ var init_private = __esm({
|
|
|
10474
10507
|
examples: ["kenso capture private on", "kenso capture private off", "kenso capture private on --thread 4821"],
|
|
10475
10508
|
beta: { featureGates: { all: ["crm_capture"] } },
|
|
10476
10509
|
operationIds: ["capture-mailbox.update", "capture-threads.update"],
|
|
10510
|
+
dryRun: true,
|
|
10477
10511
|
async run(ctx, { positionals, flags }) {
|
|
10478
10512
|
const state = positionals[0];
|
|
10479
10513
|
if (state !== "on" && state !== "off") throw usageError("Say on or off: kenso capture private on.", { field: "state" });
|
|
10480
|
-
const
|
|
10514
|
+
const req = {
|
|
10481
10515
|
method: "PATCH",
|
|
10482
10516
|
path: flags.thread === void 0 ? "/v1/capture/mailbox" : `/v1/capture/threads/${threadId(flags.thread, THREAD_FLAG)}`,
|
|
10483
|
-
body: { isPrivate: state === "on" }
|
|
10484
|
-
|
|
10485
|
-
|
|
10517
|
+
body: { isPrivate: state === "on" }
|
|
10518
|
+
};
|
|
10519
|
+
if (printDryRun(ctx, req)) return ExitCode.Ok;
|
|
10520
|
+
const res = await ctx.client.request({ ...req, signal: ctx.signal });
|
|
10486
10521
|
ctx.output.object(unwrap(res.body));
|
|
10487
10522
|
return ExitCode.Ok;
|
|
10488
10523
|
}
|
|
@@ -10500,18 +10535,21 @@ var command16, sync_default;
|
|
|
10500
10535
|
var init_sync3 = __esm({
|
|
10501
10536
|
"src/commands/capture/sync.ts"() {
|
|
10502
10537
|
"use strict";
|
|
10538
|
+
init_dry_run();
|
|
10503
10539
|
init_exit_codes();
|
|
10504
10540
|
init_http();
|
|
10505
10541
|
command16 = {
|
|
10506
10542
|
resource: "capture",
|
|
10507
10543
|
action: "sync",
|
|
10508
10544
|
summary: "Read your captured mailbox now",
|
|
10509
|
-
description: "Sends POST /v1/capture/mailbox/sync: one sync pass over your own mailbox. Kenso lists up to 25 messages and logs the ones with people and accounts in Kenso on their timelines; a reply from someone new to mail you sent creates the person and their account. Prints outcome (completed, busy while another pass reads the mailbox or it waits on a retry, timed_out when the pass ran out of its 70 seconds before the page was done: what it logged is kept, so run it again, or why the pass stopped: connection_unavailable, missing_scope, login_refused, token_unavailable, provider_unavailable, store_unavailable), messagesRead, messagesLogged, peopleCreated, threadsSummarized (threads Ken summarized after the pass, up to 3 a call), meetingsLogged (meetings you held that went on a guest's timeline), hasMore (true while the mailbox has more to read: run it again, or leave the rest to the poll) and the mailbox after the pass.",
|
|
10545
|
+
description: "Sends POST /v1/capture/mailbox/sync: one sync pass over your own mailbox. Kenso lists up to 25 messages and logs the ones with people and accounts in Kenso on their timelines; a reply from someone new to mail you sent creates the person and their account. Prints outcome (completed, busy while another pass reads the mailbox or it waits on a retry, timed_out when the pass ran out of its 70 seconds before the page was done: what it logged is kept, so run it again, or why the pass stopped: connection_unavailable, missing_scope, login_refused, token_unavailable, provider_unavailable, store_unavailable), messagesRead, messagesLogged, peopleCreated, threadsSummarized (threads Ken summarized after the pass, up to 3 a call), meetingsLogged (meetings you held that went on a guest's timeline), hasMore (true while the mailbox has more to read: run it again, or leave the rest to the poll) and the mailbox after the pass. --dry-run prints the POST and reads nothing.",
|
|
10510
10546
|
flags: {},
|
|
10511
10547
|
examples: ["kenso capture sync", "kenso capture sync --query '{outcome: outcome, logged: messagesLogged, more: hasMore}'"],
|
|
10512
10548
|
beta: { featureGates: { all: ["crm_capture"] } },
|
|
10513
10549
|
operationIds: ["capture-mailbox.sync"],
|
|
10550
|
+
dryRun: true,
|
|
10514
10551
|
async run(ctx) {
|
|
10552
|
+
if (printDryRun(ctx, { method: "POST", path: "/v1/capture/mailbox/sync" })) return ExitCode.Ok;
|
|
10515
10553
|
const res = await ctx.client.request({ method: "POST", path: "/v1/capture/mailbox/sync", signal: ctx.signal });
|
|
10516
10554
|
ctx.output.object(unwrap(res.body));
|
|
10517
10555
|
return ExitCode.Ok;
|
|
@@ -10530,18 +10568,21 @@ var command17, disconnect_default;
|
|
|
10530
10568
|
var init_disconnect = __esm({
|
|
10531
10569
|
"src/commands/capture/disconnect.ts"() {
|
|
10532
10570
|
"use strict";
|
|
10571
|
+
init_dry_run();
|
|
10533
10572
|
init_confirm();
|
|
10534
10573
|
init_exit_codes();
|
|
10535
10574
|
command17 = {
|
|
10536
10575
|
resource: "capture",
|
|
10537
10576
|
action: "disconnect",
|
|
10538
10577
|
summary: "Turn capture off for your own mailbox and delete its stored email bodies",
|
|
10539
|
-
description: "Sends DELETE /v1/capture/mailbox. Sync stops and Kenso deletes the stored body of every email only your mailbox holds. Subject, people, time and Ken's summary stay on the records. Your Google or Microsoft account stays connected for calendar and scheduling. Deleted bodies do not come back, so it asks first: add --yes to run it without the question.",
|
|
10578
|
+
description: "Sends DELETE /v1/capture/mailbox. Sync stops and Kenso deletes the stored body of every email only your mailbox holds. Subject, people, time and Ken's summary stay on the records. Your Google or Microsoft account stays connected for calendar and scheduling. Deleted bodies do not come back, so it asks first: add --yes to run it without the question. --dry-run prints the DELETE and deletes nothing.",
|
|
10540
10579
|
flags: {},
|
|
10541
|
-
examples: ["kenso capture disconnect --yes"],
|
|
10580
|
+
examples: ["kenso capture disconnect --dry-run", "kenso capture disconnect --yes"],
|
|
10542
10581
|
beta: { featureGates: { all: ["crm_capture"] } },
|
|
10543
10582
|
operationIds: ["capture-mailbox.disconnect"],
|
|
10583
|
+
dryRun: true,
|
|
10544
10584
|
async run(ctx) {
|
|
10585
|
+
if (printDryRun(ctx, { method: "DELETE", path: "/v1/capture/mailbox" })) return ExitCode.Ok;
|
|
10545
10586
|
await confirmDestructive(ctx, "This turns capture off and deletes your stored email bodies", "kenso capture disconnect --yes");
|
|
10546
10587
|
await ctx.client.request({ method: "DELETE", path: "/v1/capture/mailbox", signal: ctx.signal });
|
|
10547
10588
|
ctx.output.object({ disconnected: true });
|
|
@@ -10561,6 +10602,7 @@ var VALUES, command18, teammates_see_default;
|
|
|
10561
10602
|
var init_teammates_see = __esm({
|
|
10562
10603
|
"src/commands/capture/teammates-see.ts"() {
|
|
10563
10604
|
"use strict";
|
|
10605
|
+
init_dry_run();
|
|
10564
10606
|
init_errors();
|
|
10565
10607
|
init_exit_codes();
|
|
10566
10608
|
init_http();
|
|
@@ -10569,17 +10611,19 @@ var init_teammates_see = __esm({
|
|
|
10569
10611
|
resource: "capture",
|
|
10570
10612
|
action: "teammates-see",
|
|
10571
10613
|
summary: "Pick what teammates see of captured email: the summary, or the full email (workspace admin)",
|
|
10572
|
-
description: "Sends PATCH /v1/capture with teammatesSee. summary (the default): teammates read subject, people, time and Ken's summary, and only the mailbox owner opens the body. full_email: every member can open a captured body. It applies to every read from then on, mail already captured included. A member's Private switch still hides their email either way. Only a workspace admin can change it.",
|
|
10614
|
+
description: "Sends PATCH /v1/capture with teammatesSee. summary (the default): teammates read subject, people, time and Ken's summary, and only the mailbox owner opens the body. full_email: every member can open a captured body. It applies to every read from then on, mail already captured included. A member's Private switch still hides their email either way. Only a workspace admin can change it. --dry-run prints the PATCH and changes nothing.",
|
|
10573
10615
|
flags: {},
|
|
10574
10616
|
positionals: [{ name: "value", required: true, description: "summary or full_email" }],
|
|
10575
10617
|
examples: ["kenso capture teammates-see summary", "kenso capture teammates-see full_email"],
|
|
10576
10618
|
beta: { featureGates: { all: ["crm_capture"] } },
|
|
10577
10619
|
operationIds: ["capture.update"],
|
|
10620
|
+
dryRun: true,
|
|
10578
10621
|
async run(ctx, { positionals }) {
|
|
10579
10622
|
const value = positionals[0];
|
|
10580
10623
|
if (value === void 0 || !VALUES.includes(value)) {
|
|
10581
10624
|
throw usageError("Say summary or full_email: kenso capture teammates-see summary.", { field: "value" });
|
|
10582
10625
|
}
|
|
10626
|
+
if (printDryRun(ctx, { method: "PATCH", path: "/v1/capture", body: { teammatesSee: value } })) return ExitCode.Ok;
|
|
10583
10627
|
const res = await ctx.client.request({ method: "PATCH", path: "/v1/capture", body: { teammatesSee: value }, signal: ctx.signal });
|
|
10584
10628
|
ctx.output.object(unwrap(res.body));
|
|
10585
10629
|
return ExitCode.Ok;
|
|
@@ -13665,6 +13709,8 @@ var OBJECTS3, BETA2, OBJECT_ARG, show, set, reset2;
|
|
|
13665
13709
|
var init_layouts = __esm({
|
|
13666
13710
|
"src/commands/layouts/layouts.ts"() {
|
|
13667
13711
|
"use strict";
|
|
13712
|
+
init_confirm();
|
|
13713
|
+
init_dry_run();
|
|
13668
13714
|
init_errors();
|
|
13669
13715
|
init_exit_codes();
|
|
13670
13716
|
init_http();
|
|
@@ -13691,18 +13737,20 @@ var init_layouts = __esm({
|
|
|
13691
13737
|
resource: "layouts",
|
|
13692
13738
|
action: "set",
|
|
13693
13739
|
summary: "Save the layout every account, person or deal page in the workspace draws",
|
|
13694
|
-
description: "PUT /v1/record-layouts/{object}. --header pins up to 6 fields to the header: it reads the layout, takes those fields out of the rail and the hidden list, puts the fields it unpins at the top of the first rail section, and saves the rest as it was. --data sends a whole layout (headerFields, railSections, hiddenFields, sections, version) inline, from @file or from - (stdin); start from `kenso layouts show <object>`. A save after someone else's answers conflict: show it again. Needs the workspace_settings permission; it changes the page for every member.",
|
|
13740
|
+
description: "PUT /v1/record-layouts/{object}. --header pins up to 6 fields to the header: it reads the layout, takes those fields out of the rail and the hidden list, puts the fields it unpins at the top of the first rail section, and saves the rest as it was. --data sends a whole layout (headerFields, railSections, hiddenFields, sections, version) inline, from @file or from - (stdin); start from `kenso layouts show <object>`. A save after someone else's answers conflict: show it again. Needs the workspace_settings permission; it changes the page for every member. --dry-run prints the PUT and saves nothing.",
|
|
13695
13741
|
flags: {
|
|
13696
13742
|
header: { type: "string", description: "Field keys to pin to the header, comma separated (tier,custom.arr)" },
|
|
13697
13743
|
data: { type: "string", description: "The whole layout as JSON: inline, @file or - for stdin" }
|
|
13698
13744
|
},
|
|
13699
13745
|
positionals: [OBJECT_ARG],
|
|
13700
13746
|
examples: [
|
|
13747
|
+
"kenso layouts set account --header tier,custom.arr --dry-run",
|
|
13701
13748
|
"kenso layouts set account --header tier,custom.arr",
|
|
13702
13749
|
"kenso layouts show account > layout.json && kenso layouts set account --data @layout.json"
|
|
13703
13750
|
],
|
|
13704
13751
|
beta: BETA2,
|
|
13705
13752
|
operationIds: ["record-layouts.get", "record-layouts.replace"],
|
|
13753
|
+
dryRun: true,
|
|
13706
13754
|
async run(ctx, { flags, positionals }) {
|
|
13707
13755
|
const object = objectOf(positionals, "set");
|
|
13708
13756
|
const header = typeof flags.header === "string" ? flags.header : void 0;
|
|
@@ -13721,6 +13769,7 @@ var init_layouts = __esm({
|
|
|
13721
13769
|
}
|
|
13722
13770
|
body2 = bodyOf(parsed2);
|
|
13723
13771
|
}
|
|
13772
|
+
if (printDryRun(ctx, { method: "PUT", path: `/v1/record-layouts/${object}`, body: body2 })) return ExitCode.Ok;
|
|
13724
13773
|
ctx.output.object(await call(ctx, "PUT", object, body2));
|
|
13725
13774
|
return ExitCode.Ok;
|
|
13726
13775
|
}
|
|
@@ -13729,14 +13778,22 @@ var init_layouts = __esm({
|
|
|
13729
13778
|
resource: "layouts",
|
|
13730
13779
|
action: "reset",
|
|
13731
13780
|
summary: "Put the account, person or deal page back to Kenso's default layout",
|
|
13732
|
-
description: "DELETE /v1/record-layouts/{object}: drops the saved layout for the whole workspace (the version keeps counting) and prints the default.",
|
|
13781
|
+
description: "DELETE /v1/record-layouts/{object}: drops the saved layout for the whole workspace, so every member's page goes back to the default (the version keeps counting), and prints the default. Needs --yes, or a yes at the prompt; --dry-run prints the DELETE and drops nothing. Save the layout first with `kenso layouts show <object> > layout.json`.",
|
|
13733
13782
|
flags: {},
|
|
13734
13783
|
positionals: [OBJECT_ARG],
|
|
13735
|
-
examples: ["kenso layouts reset account"],
|
|
13784
|
+
examples: ["kenso layouts reset account --dry-run", "kenso layouts reset account --yes"],
|
|
13736
13785
|
beta: BETA2,
|
|
13737
13786
|
operationIds: ["record-layouts.reset"],
|
|
13787
|
+
dryRun: true,
|
|
13738
13788
|
async run(ctx, { positionals }) {
|
|
13739
|
-
|
|
13789
|
+
const object = objectOf(positionals, "reset");
|
|
13790
|
+
if (printDryRun(ctx, { method: "DELETE", path: `/v1/record-layouts/${object}` })) return ExitCode.Ok;
|
|
13791
|
+
await confirmDestructive(
|
|
13792
|
+
ctx,
|
|
13793
|
+
`This drops the saved ${object} page layout for every member of the workspace`,
|
|
13794
|
+
`kenso layouts reset ${object} --yes`
|
|
13795
|
+
);
|
|
13796
|
+
ctx.output.object(await call(ctx, "DELETE", object));
|
|
13740
13797
|
return ExitCode.Ok;
|
|
13741
13798
|
}
|
|
13742
13799
|
};
|
|
@@ -14157,6 +14214,7 @@ var command33, add_default;
|
|
|
14157
14214
|
var init_add = __esm({
|
|
14158
14215
|
"src/commands/notes/add.ts"() {
|
|
14159
14216
|
"use strict";
|
|
14217
|
+
init_dry_run();
|
|
14160
14218
|
init_errors();
|
|
14161
14219
|
init_exit_codes();
|
|
14162
14220
|
init_http();
|
|
@@ -14166,7 +14224,7 @@ var init_add = __esm({
|
|
|
14166
14224
|
resource: "notes",
|
|
14167
14225
|
action: "add",
|
|
14168
14226
|
summary: "Write a note on an account, a person or a deal, or a comment under a note",
|
|
14169
|
-
description: "Sends POST /v1/notes and prints the note. Name the record with one of --account, --person and --deal, or answer a note with --parent. The body is markdown, up to 20,000 characters; mention a teammate as @[Name](memberId) and they are notified. The note shows on the record's Notes tab and its Activity timeline. A note on an account needs the accounts plan feature.",
|
|
14227
|
+
description: "Sends POST /v1/notes and prints the note. Name the record with one of --account, --person and --deal, or answer a note with --parent. The body is markdown, up to 20,000 characters; mention a teammate as @[Name](memberId) and they are notified. The note shows on the record's Notes tab and its Activity timeline. A note on an account needs the accounts plan feature. --dry-run prints the POST and writes nothing.",
|
|
14170
14228
|
flags: {
|
|
14171
14229
|
...targetFlags,
|
|
14172
14230
|
parent: { type: "string", description: "The note to comment on (instead of a record flag)" },
|
|
@@ -14179,6 +14237,7 @@ var init_add = __esm({
|
|
|
14179
14237
|
],
|
|
14180
14238
|
beta: { featureGates: { all: ["record_notes"] } },
|
|
14181
14239
|
operationIds: ["notes.create"],
|
|
14240
|
+
dryRun: true,
|
|
14182
14241
|
async run(ctx, { flags }) {
|
|
14183
14242
|
const next = "kenso notes add --account <accountId> --body <text>";
|
|
14184
14243
|
const record3 = target(flags, next, flags.parent !== void 0);
|
|
@@ -14187,7 +14246,9 @@ var init_add = __esm({
|
|
|
14187
14246
|
}
|
|
14188
14247
|
const parent = flags.parent === void 0 ? {} : { parentNoteId: positiveId2(flags.parent, "parent", next) };
|
|
14189
14248
|
const body2 = await bodyText(ctx, flags.body, next);
|
|
14190
|
-
const
|
|
14249
|
+
const req = { method: "POST", path: "/v1/notes", body: { ...record3, ...parent, body: body2 } };
|
|
14250
|
+
if (printDryRun(ctx, req)) return ExitCode.Ok;
|
|
14251
|
+
const res = await ctx.client.request({ ...req, signal: ctx.signal });
|
|
14191
14252
|
ctx.output.object(unwrap(res.body));
|
|
14192
14253
|
return ExitCode.Ok;
|
|
14193
14254
|
}
|
|
@@ -14205,6 +14266,7 @@ var command34, edit_default;
|
|
|
14205
14266
|
var init_edit = __esm({
|
|
14206
14267
|
"src/commands/notes/edit.ts"() {
|
|
14207
14268
|
"use strict";
|
|
14269
|
+
init_dry_run();
|
|
14208
14270
|
init_errors();
|
|
14209
14271
|
init_exit_codes();
|
|
14210
14272
|
init_http();
|
|
@@ -14214,7 +14276,7 @@ var init_edit = __esm({
|
|
|
14214
14276
|
resource: "notes",
|
|
14215
14277
|
action: "edit",
|
|
14216
14278
|
summary: "Change a note's text, or pin or unpin it",
|
|
14217
|
-
description: "Sends PATCH /v1/notes/{noteId} and prints the note. Only the note's author changes its text; anyone who can edit accounts pins or unpins a note (not a comment). Teammates a new text mentions for the first time are notified.",
|
|
14279
|
+
description: "Sends PATCH /v1/notes/{noteId} and prints the note. Only the note's author changes its text; anyone who can edit accounts pins or unpins a note (not a comment). Teammates a new text mentions for the first time are notified. --dry-run prints the PATCH and changes nothing.",
|
|
14218
14280
|
flags: {
|
|
14219
14281
|
body: { type: "string", description: "The new text, in markdown. - reads it from stdin" },
|
|
14220
14282
|
pin: { type: "boolean", description: "Pin the note to the top of the record's notes" },
|
|
@@ -14224,6 +14286,7 @@ var init_edit = __esm({
|
|
|
14224
14286
|
examples: ["kenso notes edit 900 --body 'Budget approved for Q1'", "kenso notes edit 900 --pin"],
|
|
14225
14287
|
beta: { featureGates: { all: ["record_notes"] } },
|
|
14226
14288
|
operationIds: ["notes.update"],
|
|
14289
|
+
dryRun: true,
|
|
14227
14290
|
async run(ctx, { flags, positionals }) {
|
|
14228
14291
|
const next = "kenso notes edit <noteId> --body <text>";
|
|
14229
14292
|
const id = positiveId2(positionals[0], "noteId", next);
|
|
@@ -14232,7 +14295,9 @@ var init_edit = __esm({
|
|
|
14232
14295
|
if (flags.body !== void 0) patch.body = await bodyText(ctx, flags.body, next);
|
|
14233
14296
|
if (flags.pin === true || flags.unpin === true) patch.isPinned = flags.pin === true;
|
|
14234
14297
|
if (Object.keys(patch).length === 0) throw usageError("Pass --body, --pin or --unpin.", { field: "body", next });
|
|
14235
|
-
const
|
|
14298
|
+
const req = { method: "PATCH", path: `/v1/notes/${id}`, body: patch };
|
|
14299
|
+
if (printDryRun(ctx, req)) return ExitCode.Ok;
|
|
14300
|
+
const res = await ctx.client.request({ ...req, signal: ctx.signal });
|
|
14236
14301
|
ctx.output.object(unwrap(res.body));
|
|
14237
14302
|
return ExitCode.Ok;
|
|
14238
14303
|
}
|
|
@@ -14251,21 +14316,24 @@ var init_delete = __esm({
|
|
|
14251
14316
|
"src/commands/notes/delete.ts"() {
|
|
14252
14317
|
"use strict";
|
|
14253
14318
|
init_confirm();
|
|
14319
|
+
init_dry_run();
|
|
14254
14320
|
init_exit_codes();
|
|
14255
14321
|
init_target();
|
|
14256
14322
|
command35 = {
|
|
14257
14323
|
resource: "notes",
|
|
14258
14324
|
action: "delete",
|
|
14259
14325
|
summary: "Delete a note or a comment (its author or a workspace admin)",
|
|
14260
|
-
description: "Sends DELETE /v1/notes/{noteId}. The note leaves the record's Notes tab and Activity timeline; `kenso notes restore <noteId>` brings it back. Needs --yes, or a yes at the prompt.",
|
|
14326
|
+
description: "Sends DELETE /v1/notes/{noteId}. The note leaves the record's Notes tab and Activity timeline; `kenso notes restore <noteId>` brings it back. Needs --yes, or a yes at the prompt; --dry-run prints the DELETE and deletes nothing.",
|
|
14261
14327
|
flags: {},
|
|
14262
14328
|
positionals: [{ name: "noteId", required: true, description: "The note or comment id" }],
|
|
14263
|
-
examples: ["kenso notes delete 900 --yes"],
|
|
14329
|
+
examples: ["kenso notes delete 900 --dry-run", "kenso notes delete 900 --yes"],
|
|
14264
14330
|
beta: { featureGates: { all: ["record_notes"] } },
|
|
14265
14331
|
operationIds: ["notes.delete"],
|
|
14332
|
+
dryRun: true,
|
|
14266
14333
|
async run(ctx, { positionals }) {
|
|
14267
14334
|
const next = "kenso notes delete <noteId> --yes";
|
|
14268
14335
|
const id = positiveId2(positionals[0], "noteId", next);
|
|
14336
|
+
if (printDryRun(ctx, { method: "DELETE", path: `/v1/notes/${id}` })) return ExitCode.Ok;
|
|
14269
14337
|
await confirmDestructive(ctx, `This deletes note ${id}`, `kenso notes delete ${id} --yes`);
|
|
14270
14338
|
await ctx.client.request({ method: "DELETE", path: `/v1/notes/${id}`, signal: ctx.signal });
|
|
14271
14339
|
ctx.output.object({ id, deleted: true });
|
|
@@ -14312,6 +14380,7 @@ var KEY, ID, command36, move_default;
|
|
|
14312
14380
|
var init_move = __esm({
|
|
14313
14381
|
"src/commands/opportunities/move.ts"() {
|
|
14314
14382
|
"use strict";
|
|
14383
|
+
init_dry_run();
|
|
14315
14384
|
init_errors();
|
|
14316
14385
|
init_exit_codes();
|
|
14317
14386
|
init_http();
|
|
@@ -14321,7 +14390,7 @@ var init_move = __esm({
|
|
|
14321
14390
|
resource: "opportunities",
|
|
14322
14391
|
action: "move",
|
|
14323
14392
|
summary: "Move a deal to a stage or another pipeline, with its won or lost reason",
|
|
14324
|
-
description: "Sends PATCH /v1/opportunities/{opportunityId} with stage, pipelineId or both, and prints the deal. With --pipeline alone the deal keeps its category (open, won or lost): it lands in that pipeline's live stage of the category with the same label as its stage now, else in the category's first live stage. Read where it landed from the printed stage. With --stage too, the stage must be that pipeline's. --stage alone moves the deal to that stage, in whichever pipeline holds it. An archived pipeline takes no deal from another one. A stage a person set is refused with pinned_by_user unless --overwrite-pinned. Pipeline ids and stage keys: kenso pipelines list. With --reason (it needs --stage) the reason key goes as wonReasonKey for a won stage or lostReasonKey for a lost stage (it reads GET /v1/opportunity-stages, and GET /v1/pipelines for a stage of another pipeline, to tell which; an open stage takes no reason). Reason keys come from kenso opportunity-reasons get. A move never waits for a field the stage asks for: the deal moves, each missing field prints a warning on stderr, and the deal is flagged Missing until the field is filled (kenso opportunities list --missing-fields).",
|
|
14393
|
+
description: "Sends PATCH /v1/opportunities/{opportunityId} with stage, pipelineId or both, and prints the deal. With --pipeline alone the deal keeps its category (open, won or lost): it lands in that pipeline's live stage of the category with the same label as its stage now, else in the category's first live stage. Read where it landed from the printed stage. With --stage too, the stage must be that pipeline's. --stage alone moves the deal to that stage, in whichever pipeline holds it. An archived pipeline takes no deal from another one. A stage a person set is refused with pinned_by_user unless --overwrite-pinned. Pipeline ids and stage keys: kenso pipelines list. With --reason (it needs --stage) the reason key goes as wonReasonKey for a won stage or lostReasonKey for a lost stage (it reads GET /v1/opportunity-stages, and GET /v1/pipelines for a stage of another pipeline, to tell which; an open stage takes no reason). Reason keys come from kenso opportunity-reasons get. A move never waits for a field the stage asks for: the deal moves, each missing field prints a warning on stderr, and the deal is flagged Missing until the field is filled (kenso opportunities list --missing-fields). --dry-run prints the PATCH and moves nothing.",
|
|
14325
14394
|
flags: {
|
|
14326
14395
|
stage: { type: "string", description: "The stage key to move to (kenso pipelines list lists every pipeline's). Without it, --pipeline maps the stage" },
|
|
14327
14396
|
pipeline: { type: "string", aliases: ["pipeline-id"], description: "The id of the pipeline to move the deal to (kenso pipelines list)" },
|
|
@@ -14330,6 +14399,7 @@ var init_move = __esm({
|
|
|
14330
14399
|
},
|
|
14331
14400
|
positionals: [{ name: "opportunityId", description: "The deal's id" }],
|
|
14332
14401
|
examples: [
|
|
14402
|
+
"kenso opportunities move 4401 --stage proposal --dry-run",
|
|
14333
14403
|
"kenso opportunities move 4401 --stage proposal",
|
|
14334
14404
|
"kenso opportunities move 4401 --stage lost --reason no_budget",
|
|
14335
14405
|
"kenso opportunities move 77 --pipeline 6",
|
|
@@ -14337,6 +14407,7 @@ var init_move = __esm({
|
|
|
14337
14407
|
],
|
|
14338
14408
|
beta: { featureGates: { all: ["opportunities"] } },
|
|
14339
14409
|
operationIds: ["opportunities.update", "opportunity-stages.list", "pipelines.list"],
|
|
14410
|
+
dryRun: true,
|
|
14340
14411
|
async run(ctx, { flags, positionals }) {
|
|
14341
14412
|
const id = (positionals[0] ?? "").trim();
|
|
14342
14413
|
const stage = typeof flags.stage === "string" ? flags.stage.trim() : "";
|
|
@@ -14373,6 +14444,7 @@ var init_move = __esm({
|
|
|
14373
14444
|
}
|
|
14374
14445
|
body2[category === "won" ? "wonReasonKey" : "lostReasonKey"] = reason;
|
|
14375
14446
|
}
|
|
14447
|
+
if (printDryRun(ctx, { method: "PATCH", path: `/v1/opportunities/${id}`, body: body2 })) return ExitCode.Ok;
|
|
14376
14448
|
const res = await ctx.client.request({ method: "PATCH", path: `/v1/opportunities/${id}`, body: body2, signal: ctx.signal });
|
|
14377
14449
|
const answer = res.body;
|
|
14378
14450
|
for (const warning of answer?.warnings ?? []) {
|
|
@@ -14733,6 +14805,10 @@ var stage_rules_exports = {};
|
|
|
14733
14805
|
__export(stage_rules_exports, {
|
|
14734
14806
|
default: () => stage_rules_default
|
|
14735
14807
|
});
|
|
14808
|
+
async function pipelineStages(ctx, pipelineId) {
|
|
14809
|
+
const res = await ctx.client.request({ method: "GET", path: `/v1/pipelines/${pipelineId}`, signal: ctx.signal });
|
|
14810
|
+
return unwrap(res.body).stages ?? [];
|
|
14811
|
+
}
|
|
14736
14812
|
function rule(stage) {
|
|
14737
14813
|
return {
|
|
14738
14814
|
key: stage.key,
|
|
@@ -14743,36 +14819,46 @@ function rule(stage) {
|
|
|
14743
14819
|
isDefault: stage.isDefaultRequiredFields
|
|
14744
14820
|
};
|
|
14745
14821
|
}
|
|
14746
|
-
var command39, stage_rules_default;
|
|
14822
|
+
var ID2, command39, stage_rules_default;
|
|
14747
14823
|
var init_stage_rules = __esm({
|
|
14748
14824
|
"src/commands/pipelines/stage-rules.ts"() {
|
|
14749
14825
|
"use strict";
|
|
14826
|
+
init_dry_run();
|
|
14750
14827
|
init_errors();
|
|
14751
14828
|
init_exit_codes();
|
|
14752
14829
|
init_http();
|
|
14830
|
+
ID2 = /^[1-9]\d*$/;
|
|
14753
14831
|
command39 = {
|
|
14754
14832
|
resource: "pipelines",
|
|
14755
14833
|
action: "stage-rules",
|
|
14756
14834
|
summary: "List or set the fields a deal should have in each stage",
|
|
14757
|
-
description: "Without a stage, reads GET /v1/opportunity-stages and prints each stage's key, label, category, isArchived, requiredFields and isDefault, plus requirableFields: every field a stage can require (amount, closeDate, ownerMemberId, primaryPersonId, nextStep, lostReasonKey, wonReasonKey, and custom.<key> for each custom deal field). With a stage and --require, --default or --none, sends PUT /v1/opportunity-stages/{stageKey}/required-fields and prints that stage's rule. --require is the stage's whole list, in order, at most 10. --default puts it back on the default: a lost stage asks for lostReasonKey, any other stage nothing. A missing field never stops a move: the deal moves, the move prints a warning, and the deal is flagged Missing until the field is filled. Setting a rule needs the workspace_settings permission.",
|
|
14835
|
+
description: "Without a stage, reads GET /v1/opportunity-stages (the default pipeline's stages; --pipeline <id> reads that pipeline's from GET /v1/pipelines/{pipelineId}) and prints each stage's key, label, category, isArchived, requiredFields and isDefault, plus requirableFields: every field a stage can require (amount, closeDate, ownerMemberId, primaryPersonId, nextStep, lostReasonKey, wonReasonKey, and custom.<key> for each custom deal field). With a stage and --require, --default or --none, sends PUT /v1/opportunity-stages/{stageKey}/required-fields and prints that stage's rule. --require is the stage's whole list, in order, at most 10. --default puts it back on the default: a lost stage asks for lostReasonKey, any other stage nothing. A missing field never stops a move: the deal moves, the move prints a warning, and the deal is flagged Missing until the field is filled. Setting a rule needs the workspace_settings permission. A stage key is unique across pipelines, so it sets a stage of any pipeline; with --pipeline it first checks the stage is that pipeline's. --dry-run prints the PUT and changes nothing.",
|
|
14758
14836
|
flags: {
|
|
14759
14837
|
require: { type: "string", description: "Comma-separated field ids the stage requires, in order (amount,closeDate,custom.tier)" },
|
|
14760
14838
|
default: { type: "boolean", description: "Put the stage back on the default rule" },
|
|
14761
|
-
none: { type: "boolean", description: "Require nothing in the stage" }
|
|
14839
|
+
none: { type: "boolean", description: "Require nothing in the stage" },
|
|
14840
|
+
pipeline: { type: "string", aliases: ["pipeline-id"], description: "The pipeline whose stages to list or check (kenso pipelines list); default the default pipeline" }
|
|
14762
14841
|
},
|
|
14763
14842
|
positionals: [{ name: "stage", description: "The stage key to set (kenso pipelines stage-rules lists them)" }],
|
|
14764
14843
|
examples: [
|
|
14765
14844
|
"kenso pipelines stage-rules",
|
|
14845
|
+
"kenso pipelines stage-rules --pipeline 6",
|
|
14846
|
+
"kenso pipelines stage-rules proposal --require amount,closeDate --dry-run",
|
|
14766
14847
|
"kenso pipelines stage-rules proposal --require amount,closeDate",
|
|
14767
14848
|
"kenso pipelines stage-rules lost --default"
|
|
14768
14849
|
],
|
|
14769
14850
|
beta: { featureGates: { all: ["opportunities", "deal_stage_rules"] } },
|
|
14770
|
-
operationIds: ["opportunity-stages.list", "opportunity-stages.set-required-fields"],
|
|
14851
|
+
operationIds: ["opportunity-stages.list", "opportunity-stages.set-required-fields", "pipelines.get"],
|
|
14852
|
+
dryRun: true,
|
|
14771
14853
|
async run(ctx, { flags, positionals }) {
|
|
14772
14854
|
const stage = (positionals[0] ?? "").trim();
|
|
14773
14855
|
const require2 = typeof flags.require === "string" ? flags.require : void 0;
|
|
14774
14856
|
const chosen = [require2 !== void 0, flags.default === true, flags.none === true].filter(Boolean).length;
|
|
14775
14857
|
const next = "kenso pipelines stage-rules <stage> --require amount,closeDate";
|
|
14858
|
+
const pipeline = typeof flags.pipeline === "string" ? flags.pipeline.trim() : void 0;
|
|
14859
|
+
if (pipeline !== void 0 && !(ID2.test(pipeline) && Number.isSafeInteger(Number(pipeline)))) {
|
|
14860
|
+
throw usageError(`--pipeline takes a pipeline id (got "${pipeline}").`, { field: "pipeline", next: "kenso pipelines list" });
|
|
14861
|
+
}
|
|
14776
14862
|
if (!stage) {
|
|
14777
14863
|
if (chosen > 0) throw usageError("Name the stage to set: kenso pipelines stage-rules <stage> ...", { field: "stage", next });
|
|
14778
14864
|
const res2 = await ctx.client.request({ method: "GET", path: "/v1/opportunity-stages", signal: ctx.signal });
|
|
@@ -14780,7 +14866,12 @@ var init_stage_rules = __esm({
|
|
|
14780
14866
|
if (!data.requirableFields) {
|
|
14781
14867
|
throw usageError("Stage rules are off in this workspace (the deal_stage_rules flag).", { hint: "Ask Kenso support to turn them on." });
|
|
14782
14868
|
}
|
|
14783
|
-
|
|
14869
|
+
const stages = pipeline === void 0 ? data.items ?? [] : await pipelineStages(ctx, pipeline);
|
|
14870
|
+
ctx.output.object({
|
|
14871
|
+
...pipeline === void 0 ? {} : { pipelineId: Number(pipeline) },
|
|
14872
|
+
requirableFields: data.requirableFields,
|
|
14873
|
+
stages: stages.map(rule)
|
|
14874
|
+
});
|
|
14784
14875
|
return ExitCode.Ok;
|
|
14785
14876
|
}
|
|
14786
14877
|
if (!/^[a-z][a-z0-9_]{0,62}$/.test(stage)) {
|
|
@@ -14793,12 +14884,18 @@ var init_stage_rules = __esm({
|
|
|
14793
14884
|
if (fields?.length === 0 && require2 !== void 0) {
|
|
14794
14885
|
throw usageError("--require names no field. Pass the field ids, --none to require nothing, or --default.", { field: "require", next });
|
|
14795
14886
|
}
|
|
14796
|
-
|
|
14797
|
-
|
|
14798
|
-
|
|
14799
|
-
|
|
14800
|
-
|
|
14801
|
-
|
|
14887
|
+
if (pipeline !== void 0) {
|
|
14888
|
+
const keys = (await pipelineStages(ctx, pipeline)).map((s) => s.key);
|
|
14889
|
+
if (!keys.includes(stage)) {
|
|
14890
|
+
throw usageError(`"${stage}" is not a stage of pipeline ${pipeline}. Its stages: ${keys.join(", ")}.`, {
|
|
14891
|
+
field: "stage",
|
|
14892
|
+
next: `kenso pipelines stage-rules --pipeline ${pipeline}`
|
|
14893
|
+
});
|
|
14894
|
+
}
|
|
14895
|
+
}
|
|
14896
|
+
const req = { method: "PUT", path: `/v1/opportunity-stages/${stage}/required-fields`, body: { fields } };
|
|
14897
|
+
if (printDryRun(ctx, req)) return ExitCode.Ok;
|
|
14898
|
+
const res = await ctx.client.request({ ...req, signal: ctx.signal });
|
|
14802
14899
|
ctx.output.object(rule(unwrap(res.body)));
|
|
14803
14900
|
return ExitCode.Ok;
|
|
14804
14901
|
}
|
|
@@ -16580,6 +16677,7 @@ var NEXT, command55, add_default2;
|
|
|
16580
16677
|
var init_add2 = __esm({
|
|
16581
16678
|
"src/commands/tasks/add.ts"() {
|
|
16582
16679
|
"use strict";
|
|
16680
|
+
init_dry_run();
|
|
16583
16681
|
init_errors();
|
|
16584
16682
|
init_exit_codes();
|
|
16585
16683
|
init_http();
|
|
@@ -16589,7 +16687,7 @@ var init_add2 = __esm({
|
|
|
16589
16687
|
resource: "tasks",
|
|
16590
16688
|
action: "add",
|
|
16591
16689
|
summary: "Add a task: a title, an optional due day and time, assignee and the account, person or deal it is about",
|
|
16592
|
-
description: "Sends POST /v1/tasks and prints the task. The words after add are the title (1-500 characters). --due takes today, tomorrow, a weekday (the next one: friday or fri), a day (2026-11-20) or an ISO 8601 time with its offset; --at HH:MM puts a time on that day (today without --due). Day words and --at read this computer's clock and time zone (TZ); a time's day is read in the assignee's app time zone. --assignee takes me, a member id or an email; without it the task is yours. Link at most one of --account, --person, --deal: a person's task also shows on their first account, a deal's on its account and primary person. Linking an account on a plan without Accounts is plan_required.",
|
|
16690
|
+
description: "Sends POST /v1/tasks and prints the task. The words after add are the title (1-500 characters). --due takes today, tomorrow, a weekday (the next one: friday or fri), a day (2026-11-20) or an ISO 8601 time with its offset; --at HH:MM puts a time on that day (today without --due). Day words and --at read this computer's clock and time zone (TZ); a time's day is read in the assignee's app time zone. --assignee takes me, a member id or an email; without it the task is yours. Link at most one of --account, --person, --deal: a person's task also shows on their first account, a deal's on its account and primary person. Linking an account on a plan without Accounts is plan_required. --dry-run prints the POST and writes nothing.",
|
|
16593
16691
|
flags: {
|
|
16594
16692
|
due: { type: "string", description: "Due day: today, tomorrow, a weekday, YYYY-MM-DD, or an ISO 8601 time with an offset" },
|
|
16595
16693
|
at: { type: "string", description: "Due time on that day, HH:MM (today without --due)" },
|
|
@@ -16603,6 +16701,7 @@ var init_add2 = __esm({
|
|
|
16603
16701
|
examples: [NEXT, 'kenso tasks add "Call Ada back" --due friday --at 16:00 --person 501 --assignee ada@acme.com'],
|
|
16604
16702
|
beta: { featureGates: { all: ["tasks"] } },
|
|
16605
16703
|
operationIds: ["tasks.create", "me.get", "members.list"],
|
|
16704
|
+
dryRun: true,
|
|
16606
16705
|
async run(ctx, { flags, positionals }) {
|
|
16607
16706
|
const title = positionals.join(" ").trim();
|
|
16608
16707
|
if (title === "") throw usageError("Give the task a title.", { field: "title", next: NEXT });
|
|
@@ -16615,6 +16714,7 @@ var init_add2 = __esm({
|
|
|
16615
16714
|
if (typeof flags.person === "string") body2.personId = positiveId4(flags.person, "person", NEXT);
|
|
16616
16715
|
if (typeof flags.deal === "string") body2.opportunityId = positiveId4(flags.deal, "deal", NEXT);
|
|
16617
16716
|
if (typeof flags.assignee === "string") body2.assigneeMemberId = await memberId(ctx, flags.assignee, "assignee", NEXT);
|
|
16717
|
+
if (printDryRun(ctx, { method: "POST", path: "/v1/tasks", body: body2 })) return ExitCode.Ok;
|
|
16618
16718
|
const res = await ctx.client.request({ method: "POST", path: "/v1/tasks", body: body2, signal: ctx.signal });
|
|
16619
16719
|
ctx.output.object(unwrap(res.body));
|
|
16620
16720
|
return ExitCode.Ok;
|
|
@@ -16661,6 +16761,7 @@ var command56, done_default;
|
|
|
16661
16761
|
var init_done = __esm({
|
|
16662
16762
|
"src/commands/tasks/done.ts"() {
|
|
16663
16763
|
"use strict";
|
|
16764
|
+
init_dry_run();
|
|
16664
16765
|
init_errors();
|
|
16665
16766
|
init_exit_codes();
|
|
16666
16767
|
init_http();
|
|
@@ -16669,15 +16770,17 @@ var init_done = __esm({
|
|
|
16669
16770
|
resource: "tasks",
|
|
16670
16771
|
action: "done",
|
|
16671
16772
|
summary: "Complete one or more tasks (--undo reopens them)",
|
|
16672
|
-
description: "Sends PATCH /v1/tasks/{taskId} with status done for each id, in order, and prints the task (one line per task for several): completedAt and completedByMemberId set, and task.completed written on the record's timeline. --undo sends status open, which reopens it. An error stops at that id; its message names the ids before it, which are done.",
|
|
16773
|
+
description: "Sends PATCH /v1/tasks/{taskId} with status done for each id, in order, and prints the task (one line per task for several): completedAt and completedByMemberId set, and task.completed written on the record's timeline. --undo sends status open, which reopens it. An error stops at that id; its message names the ids before it, which are done. --dry-run prints the PATCH for each id and changes nothing.",
|
|
16673
16774
|
flags: { undo: { type: "boolean", description: "Reopen the task instead" } },
|
|
16674
16775
|
positionals: [{ name: "taskId", required: true, variadic: true, description: "One or more task ids" }],
|
|
16675
16776
|
examples: ["kenso tasks done 7", "kenso tasks done 7 8 9", "kenso tasks done 7 --undo"],
|
|
16676
16777
|
beta: { featureGates: { all: ["tasks"] } },
|
|
16677
16778
|
operationIds: ["tasks.update"],
|
|
16779
|
+
dryRun: true,
|
|
16678
16780
|
async run(ctx, { flags, positionals }) {
|
|
16679
16781
|
const ids2 = [...new Set(positionals.map((text4) => positiveId4(text4, "taskId", "kenso tasks done <taskId>...")))];
|
|
16680
16782
|
const change = { status: flags.undo === true ? "open" : "done" };
|
|
16783
|
+
if (printDryRun(ctx, ...ids2.map((id) => ({ method: "PATCH", path: `/v1/tasks/${id}`, body: change })))) return ExitCode.Ok;
|
|
16681
16784
|
if (ids2.length === 1) ctx.output.object(await patchTask(ctx, ids2[0], change));
|
|
16682
16785
|
else
|
|
16683
16786
|
await ctx.output.list(
|
|
@@ -16709,6 +16812,7 @@ var NEXT2, command57, assign_default;
|
|
|
16709
16812
|
var init_assign = __esm({
|
|
16710
16813
|
"src/commands/tasks/assign.ts"() {
|
|
16711
16814
|
"use strict";
|
|
16815
|
+
init_dry_run();
|
|
16712
16816
|
init_exit_codes();
|
|
16713
16817
|
init_done();
|
|
16714
16818
|
init_shared2();
|
|
@@ -16717,7 +16821,7 @@ var init_assign = __esm({
|
|
|
16717
16821
|
resource: "tasks",
|
|
16718
16822
|
action: "assign",
|
|
16719
16823
|
summary: "Give a task to a member",
|
|
16720
|
-
description: "Sends PATCH /v1/tasks/{taskId} with assigneeMemberId and prints the task. The member is me, a member id or a member's email. They get a task_assigned notification unless they assigned it themselves. A member id outside the workspace is invalid_member.",
|
|
16824
|
+
description: "Sends PATCH /v1/tasks/{taskId} with assigneeMemberId and prints the task. The member is me, a member id or a member's email. They get a task_assigned notification unless they assigned it themselves. A member id outside the workspace is invalid_member. --dry-run prints the PATCH and changes nothing.",
|
|
16721
16825
|
flags: {},
|
|
16722
16826
|
positionals: [
|
|
16723
16827
|
{ name: "taskId", required: true, description: "The task id" },
|
|
@@ -16726,10 +16830,13 @@ var init_assign = __esm({
|
|
|
16726
16830
|
examples: ["kenso tasks assign 7 42", "kenso tasks assign 7 me", "kenso tasks assign 7 ada@acme.com"],
|
|
16727
16831
|
beta: { featureGates: { all: ["tasks"] } },
|
|
16728
16832
|
operationIds: ["tasks.update", "me.get", "members.list"],
|
|
16833
|
+
dryRun: true,
|
|
16729
16834
|
async run(ctx, { positionals }) {
|
|
16730
16835
|
const taskId = positiveId4(positionals[0], "taskId", NEXT2);
|
|
16731
16836
|
const assignee = await memberId(ctx, positionals[1] ?? "", "member", NEXT2);
|
|
16732
|
-
|
|
16837
|
+
const change = { assigneeMemberId: assignee };
|
|
16838
|
+
if (printDryRun(ctx, { method: "PATCH", path: `/v1/tasks/${taskId}`, body: change })) return ExitCode.Ok;
|
|
16839
|
+
ctx.output.object(await patchTask(ctx, taskId, change));
|
|
16733
16840
|
return ExitCode.Ok;
|
|
16734
16841
|
}
|
|
16735
16842
|
};
|
|
@@ -16810,6 +16917,7 @@ var PIN_NEXT, UNPIN_NEXT, pin, unpin;
|
|
|
16810
16917
|
var init_pin = __esm({
|
|
16811
16918
|
"src/commands/views/pin.ts"() {
|
|
16812
16919
|
"use strict";
|
|
16920
|
+
init_dry_run();
|
|
16813
16921
|
init_errors();
|
|
16814
16922
|
init_exit_codes();
|
|
16815
16923
|
init_http();
|
|
@@ -16819,14 +16927,16 @@ var init_pin = __esm({
|
|
|
16819
16927
|
resource: "views",
|
|
16820
16928
|
action: "pin",
|
|
16821
16929
|
summary: "Pin a saved view to your sidebar",
|
|
16822
|
-
description: "Sends POST /v1/pins with kind view and the view's id, and prints the pin. The view nests under its list's row in your sidebar (an account view under Accounts). Pins are your own: a teammate pins a shared view for themselves. A view already pinned answers its pin. Pinning a person or deal view pins People or Deals too. Same as kenso pins add --kind view --view-id <viewId>; kenso views unpin <viewId> undoes it.",
|
|
16930
|
+
description: "Sends POST /v1/pins with kind view and the view's id, and prints the pin. The view nests under its list's row in your sidebar (an account view under Accounts). Pins are your own: a teammate pins a shared view for themselves. A view already pinned answers its pin. Pinning a person or deal view pins People or Deals too. Same as kenso pins add --kind view --view-id <viewId>; kenso views unpin <viewId> undoes it. --dry-run prints the POST and pins nothing.",
|
|
16823
16931
|
flags: {},
|
|
16824
16932
|
positionals: [{ name: "viewId", required: true, description: "The saved view's id (kenso views list)" }],
|
|
16825
16933
|
examples: ["kenso views pin 118"],
|
|
16826
16934
|
beta: { featureGates: { all: ["shared_views"] } },
|
|
16827
16935
|
operationIds: ["pins.add"],
|
|
16936
|
+
dryRun: true,
|
|
16828
16937
|
async run(ctx, { positionals }) {
|
|
16829
16938
|
const id = viewId(positionals[0], PIN_NEXT);
|
|
16939
|
+
if (printDryRun(ctx, { method: "POST", path: "/v1/pins", body: { kind: "view", viewId: id } })) return ExitCode.Ok;
|
|
16830
16940
|
const added = await ctx.client.request({ method: "POST", path: "/v1/pins", body: { kind: "view", viewId: id }, signal: ctx.signal });
|
|
16831
16941
|
ctx.output.object(unwrap(added.body));
|
|
16832
16942
|
return ExitCode.Ok;
|
|
@@ -16836,15 +16946,21 @@ var init_pin = __esm({
|
|
|
16836
16946
|
resource: "views",
|
|
16837
16947
|
action: "unpin",
|
|
16838
16948
|
summary: "Unpin a saved view from your sidebar",
|
|
16839
|
-
description: "Finds your pin of the view (GET /v1/pins) and sends DELETE /v1/pins/{pinId}. Prints the view id and whether a pin was removed: a view you had not pinned prints removed false and changes nothing. The view itself stays. Same as kenso pins remove --pin-id <pinId>.",
|
|
16949
|
+
description: "Finds your pin of the view (GET /v1/pins) and sends DELETE /v1/pins/{pinId}. Prints the view id and whether a pin was removed: a view you had not pinned prints removed false and changes nothing. The view itself stays. Same as kenso pins remove --pin-id <pinId>. --dry-run reads your pins and prints the DELETE (or removed false), removing nothing.",
|
|
16840
16950
|
flags: {},
|
|
16841
16951
|
positionals: [{ name: "viewId", required: true, description: "The saved view's id (kenso views list)" }],
|
|
16842
16952
|
examples: ["kenso views unpin 118"],
|
|
16843
16953
|
beta: { featureGates: { all: ["shared_views"] } },
|
|
16844
16954
|
operationIds: ["pins.list", "pins.remove"],
|
|
16955
|
+
dryRun: true,
|
|
16845
16956
|
async run(ctx, { positionals }) {
|
|
16846
16957
|
const id = viewId(positionals[0], UNPIN_NEXT);
|
|
16847
16958
|
const found = await pinOf(ctx, id);
|
|
16959
|
+
if (found && printDryRun(ctx, { method: "DELETE", path: `/v1/pins/${found.id}` })) return ExitCode.Ok;
|
|
16960
|
+
if (!found && ctx.flags.dryRun === true) {
|
|
16961
|
+
ctx.output.object({ dryRun: true, viewId: id, removed: false });
|
|
16962
|
+
return ExitCode.Ok;
|
|
16963
|
+
}
|
|
16848
16964
|
if (found) await ctx.client.request({ method: "DELETE", path: `/v1/pins/${found.id}`, signal: ctx.signal });
|
|
16849
16965
|
ctx.output.object({ viewId: id, removed: found !== void 0 });
|
|
16850
16966
|
return ExitCode.Ok;
|