kenso 0.1.93 → 0.1.94
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/CHANGELOG.md +5 -0
- package/dist/kenso.js +513 -298
- package/dist/operations.json +1 -1
- package/docs/crm.md +17 -0
- package/docs/reference.md +36 -7
- package/package.json +2 -2
package/dist/kenso.js
CHANGED
|
@@ -21,9 +21,9 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
21
21
|
throw mod = 0, e;
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
var __export = (
|
|
24
|
+
var __export = (target2, all) => {
|
|
25
25
|
for (var name in all)
|
|
26
|
-
__defProp(
|
|
26
|
+
__defProp(target2, name, { get: all[name], enumerable: true });
|
|
27
27
|
};
|
|
28
28
|
var __copyProps = (to, from, except, desc) => {
|
|
29
29
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -33,12 +33,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
33
33
|
}
|
|
34
34
|
return to;
|
|
35
35
|
};
|
|
36
|
-
var __toESM = (mod, isNodeMode,
|
|
36
|
+
var __toESM = (mod, isNodeMode, target2) => (target2 = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
37
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
38
38
|
// file that has been converted to a CommonJS file using a Babel-
|
|
39
39
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
40
40
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
41
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(
|
|
41
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target2, "default", { value: mod, enumerable: true }) : target2,
|
|
42
42
|
mod
|
|
43
43
|
));
|
|
44
44
|
|
|
@@ -2215,12 +2215,12 @@ function pickFields(value, paths) {
|
|
|
2215
2215
|
for (const path of paths) {
|
|
2216
2216
|
const { found, value: picked } = getPath(value, path);
|
|
2217
2217
|
if (!found) continue;
|
|
2218
|
-
let
|
|
2218
|
+
let target2 = out;
|
|
2219
2219
|
for (const segment of path.slice(0, -1)) {
|
|
2220
|
-
if (!isRecord(
|
|
2221
|
-
|
|
2220
|
+
if (!isRecord(target2[segment])) target2[segment] = {};
|
|
2221
|
+
target2 = target2[segment];
|
|
2222
2222
|
}
|
|
2223
|
-
|
|
2223
|
+
target2[path[path.length - 1]] = picked;
|
|
2224
2224
|
}
|
|
2225
2225
|
return out;
|
|
2226
2226
|
}
|
|
@@ -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.94" : "0.0.0-dev";
|
|
2481
2481
|
}
|
|
2482
2482
|
});
|
|
2483
2483
|
|
|
@@ -4174,9 +4174,9 @@ async function readRunDir(dir) {
|
|
|
4174
4174
|
return null;
|
|
4175
4175
|
}
|
|
4176
4176
|
if (!raw) return null;
|
|
4177
|
-
const { runId, command:
|
|
4177
|
+
const { runId, command: command65, createdAt, status } = raw;
|
|
4178
4178
|
if (typeof runId !== "string" || !RUN_ID_PATTERN.test(runId)) return null;
|
|
4179
|
-
if (typeof
|
|
4179
|
+
if (typeof command65 !== "string" || typeof createdAt !== "string") return null;
|
|
4180
4180
|
if (typeof status !== "string" || !STATUSES.includes(status)) return null;
|
|
4181
4181
|
let chunksDone = chunkList(raw.chunksDone) ?? [];
|
|
4182
4182
|
try {
|
|
@@ -4187,7 +4187,7 @@ async function readRunDir(dir) {
|
|
|
4187
4187
|
const record = {
|
|
4188
4188
|
...raw,
|
|
4189
4189
|
runId,
|
|
4190
|
-
command:
|
|
4190
|
+
command: command65,
|
|
4191
4191
|
args: asRecord3(raw.args) ?? {},
|
|
4192
4192
|
createdAt,
|
|
4193
4193
|
status,
|
|
@@ -4242,11 +4242,11 @@ async function loadRun(runId, env = process.env) {
|
|
|
4242
4242
|
}
|
|
4243
4243
|
return run;
|
|
4244
4244
|
}
|
|
4245
|
-
async function findIdentical(
|
|
4245
|
+
async function findIdentical(command65, args, inputSha256, env, workspaceId, anyWorkspace = false) {
|
|
4246
4246
|
const identity = argsIdentity(args);
|
|
4247
4247
|
const runs = await listRuns(env);
|
|
4248
4248
|
return runs.filter(
|
|
4249
|
-
(run) => run.command ===
|
|
4249
|
+
(run) => run.command === command65 && (run.inputSha256 || void 0) === (inputSha256 || void 0) && (anyWorkspace || (run.workspaceId || void 0) === (workspaceId || void 0)) && argsIdentity(run.args) === identity
|
|
4250
4250
|
);
|
|
4251
4251
|
}
|
|
4252
4252
|
function isOtherLiveProcess(pid) {
|
|
@@ -4340,10 +4340,10 @@ async function alreadyDone(run, totalRows, started, ctx) {
|
|
|
4340
4340
|
async function dryRun(spec, ctx, plan) {
|
|
4341
4341
|
let runId;
|
|
4342
4342
|
let dir;
|
|
4343
|
-
const
|
|
4344
|
-
if (
|
|
4345
|
-
runId =
|
|
4346
|
-
dir =
|
|
4343
|
+
const target2 = plan.finished ?? plan.resumable;
|
|
4344
|
+
if (target2) {
|
|
4345
|
+
runId = target2.runId;
|
|
4346
|
+
dir = target2.dir;
|
|
4347
4347
|
} else {
|
|
4348
4348
|
runId = newRunId();
|
|
4349
4349
|
dir = await prepareRunDir(spec.outDir, runId, plan.identical, ctx);
|
|
@@ -7458,8 +7458,8 @@ function idValue(value, field) {
|
|
|
7458
7458
|
function shellQuote3(arg) {
|
|
7459
7459
|
return /^[A-Za-z0-9_./:=@%+,-]+$/.test(arg) ? arg : `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
7460
7460
|
}
|
|
7461
|
-
function commandLine2(ctx,
|
|
7462
|
-
const parts2 = ["kenso", ...
|
|
7461
|
+
function commandLine2(ctx, command65, args, extra = []) {
|
|
7462
|
+
const parts2 = ["kenso", ...command65.split(" "), ...(args.positionals ?? []).map(shellQuote3)];
|
|
7463
7463
|
for (const [name, value] of Object.entries(args.flags)) {
|
|
7464
7464
|
if (value === void 0 || value === false) continue;
|
|
7465
7465
|
if (value === true) parts2.push(`--${name}`);
|
|
@@ -7791,7 +7791,7 @@ var init_connect = __esm({
|
|
|
7791
7791
|
var crm_default;
|
|
7792
7792
|
var init_crm = __esm({
|
|
7793
7793
|
"docs/crm.md"() {
|
|
7794
|
-
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| `accounts update --each`, `people update --each`, `opportunities update --each` | Edit many records from a file, one call per row |\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> [--reason <key>]` | Move a deal, 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| `deleted-accounts list`, `accounts restore <id>` | The accounts deleted in the last 30 days, and bringing one back |\n| `export <accounts\\|people\\|deals>` | The list as CSV: everything, a saved Accounts view, 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, and each body you may open. The id is `capturedThread.id` on a timeline row |\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| `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# 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\nApart from `accounts bulk-update`, which sets one `accountType` on up to 500 accounts, there is no bulk edit route, so 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## 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`, `closeDate` (`past_due`, `next_30_days`, `later`, `none`) and `sourceCampaignId`. `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\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- **`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## 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## 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 --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 Accounts view (`kenso account-views list` shows the ids). `--filters`, `--where` (accounts), `--q` and `--sort` are the search operation\'s own fields, so a deals or people view exports with its filters and sort. 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## 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## 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## 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; `--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. `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';
|
|
7794
|
+
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| `accounts update --each`, `people update --each`, `opportunities update --each` | Edit many records from a file, one call per row |\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> [--reason <key>]` | Move a deal, 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| `export <accounts\\|people\\|deals>` | The list as CSV: everything, a saved Accounts view, 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, and each body you may open. The id is `capturedThread.id` on a timeline row |\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| `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# 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\nApart from `accounts bulk-update`, which sets one `accountType` on up to 500 accounts, there is no bulk edit route, so 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## 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`, `closeDate` (`past_due`, `next_30_days`, `later`, `none`) and `sourceCampaignId`. `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\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- **`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## 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## 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 --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 Accounts view (`kenso account-views list` shows the ids). `--filters`, `--where` (accounts), `--q` and `--sort` are the search operation\'s own fields, so a deals or people view exports with its filters and sort. 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## 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## 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; `--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. `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';
|
|
7795
7795
|
}
|
|
7796
7796
|
});
|
|
7797
7797
|
|
|
@@ -8266,8 +8266,8 @@ var init_install = __esm({
|
|
|
8266
8266
|
next
|
|
8267
8267
|
});
|
|
8268
8268
|
}
|
|
8269
|
-
for (const
|
|
8270
|
-
if (
|
|
8269
|
+
for (const target2 of targets) {
|
|
8270
|
+
if (target2.status !== "unchanged") write(target2.path, text4);
|
|
8271
8271
|
}
|
|
8272
8272
|
if (dir !== void 0 && basename2(resolve5(dir)) !== SKILL_NAME) {
|
|
8273
8273
|
ctx.output.warn(`Agents expect the skill's folder to be named ${SKILL_NAME}, like the skill: ${resolve5(dir)} is not.`);
|
|
@@ -8983,8 +8983,8 @@ var init_browser_login = __esm({
|
|
|
8983
8983
|
defaultDeps = {
|
|
8984
8984
|
sleep: (ms, signal) => delay2(ms, void 0, signal ? { signal } : void 0),
|
|
8985
8985
|
now: () => Date.now(),
|
|
8986
|
-
spawn: (
|
|
8987
|
-
const child = nodeSpawn(
|
|
8986
|
+
spawn: (command65, args) => {
|
|
8987
|
+
const child = nodeSpawn(command65, args, { detached: true, stdio: "ignore" });
|
|
8988
8988
|
child.on("error", () => {
|
|
8989
8989
|
});
|
|
8990
8990
|
child.unref();
|
|
@@ -10248,8 +10248,8 @@ var init_run = __esm({
|
|
|
10248
10248
|
defaultDeps2 = {
|
|
10249
10249
|
sleep: (ms, signal) => delay3(ms, void 0, signal ? { signal } : void 0),
|
|
10250
10250
|
now: () => Date.now(),
|
|
10251
|
-
spawn: (
|
|
10252
|
-
const child = nodeSpawn2(
|
|
10251
|
+
spawn: (command65, args) => {
|
|
10252
|
+
const child = nodeSpawn2(command65, args, { detached: true, stdio: "ignore" });
|
|
10253
10253
|
child.on("error", () => {
|
|
10254
10254
|
});
|
|
10255
10255
|
child.unref();
|
|
@@ -10290,9 +10290,9 @@ function stringFlag2(flags, name) {
|
|
|
10290
10290
|
const text4 = value.trim();
|
|
10291
10291
|
return text4 === "" ? void 0 : text4;
|
|
10292
10292
|
}
|
|
10293
|
-
function requireFlag(flags, name,
|
|
10293
|
+
function requireFlag(flags, name, command65, hint) {
|
|
10294
10294
|
const value = stringFlag2(flags, name);
|
|
10295
|
-
if (value === void 0) throw usageError(`--${name} is required for ${
|
|
10295
|
+
if (value === void 0) throw usageError(`--${name} is required for ${command65}.`, { field: name, next: `${command65} --help`, ...hint ? { hint } : {} });
|
|
10296
10296
|
return value;
|
|
10297
10297
|
}
|
|
10298
10298
|
function positiveId(value) {
|
|
@@ -10301,8 +10301,8 @@ function positiveId(value) {
|
|
|
10301
10301
|
const id = Number(text4);
|
|
10302
10302
|
return Number.isSafeInteger(id) && id > 0 ? id : void 0;
|
|
10303
10303
|
}
|
|
10304
|
-
function idFlag(flags, name,
|
|
10305
|
-
const raw = requireFlag(flags, name,
|
|
10304
|
+
function idFlag(flags, name, command65) {
|
|
10305
|
+
const raw = requireFlag(flags, name, command65);
|
|
10306
10306
|
const id = positiveId(raw);
|
|
10307
10307
|
if (id === void 0) throw usageError(`--${name} must be a positive whole number (got "${raw}").`, { field: name });
|
|
10308
10308
|
return id;
|
|
@@ -10322,8 +10322,8 @@ function isDryRun(ctx) {
|
|
|
10322
10322
|
function shellQuote4(value) {
|
|
10323
10323
|
return /^[A-Za-z0-9_\-.,:/@=+%]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
|
|
10324
10324
|
}
|
|
10325
|
-
function sameCommand2(
|
|
10326
|
-
const parts2 = [
|
|
10325
|
+
function sameCommand2(command65, flags, ctx, extra = []) {
|
|
10326
|
+
const parts2 = [command65];
|
|
10327
10327
|
for (const [name, value] of Object.entries(flags)) {
|
|
10328
10328
|
if (value === void 0 || value === false) continue;
|
|
10329
10329
|
if (value === true) parts2.push(`--${name}`);
|
|
@@ -10516,16 +10516,16 @@ function parseMapOverrides(value) {
|
|
|
10516
10516
|
});
|
|
10517
10517
|
}
|
|
10518
10518
|
const out = {};
|
|
10519
|
-
for (const [column,
|
|
10520
|
-
if (
|
|
10519
|
+
for (const [column, target2] of Object.entries(value)) {
|
|
10520
|
+
if (target2 !== null && typeof target2 !== "string") {
|
|
10521
10521
|
throw usageError(`--map "${column}" must name a field, customVariables.<key>, or null.`, { field: "map" });
|
|
10522
10522
|
}
|
|
10523
|
-
out[column] =
|
|
10523
|
+
out[column] = target2;
|
|
10524
10524
|
}
|
|
10525
10525
|
return out;
|
|
10526
10526
|
}
|
|
10527
|
-
function targetName(
|
|
10528
|
-
return "field" in
|
|
10527
|
+
function targetName(target2) {
|
|
10528
|
+
return "field" in target2 ? target2.field : `${CUSTOM_PREFIX}${target2.customKey}`;
|
|
10529
10529
|
}
|
|
10530
10530
|
function overrideTarget(column, value, mode) {
|
|
10531
10531
|
const text4 = value.trim();
|
|
@@ -10569,13 +10569,13 @@ function buildMapping(headers, overrides, mode) {
|
|
|
10569
10569
|
};
|
|
10570
10570
|
for (const header of headers) {
|
|
10571
10571
|
const override2 = overrideFor(header, overrides);
|
|
10572
|
-
let
|
|
10572
|
+
let target2;
|
|
10573
10573
|
if (override2.found) {
|
|
10574
10574
|
if (override2.value === null) {
|
|
10575
10575
|
drop(header, "mapped_to_null");
|
|
10576
10576
|
continue;
|
|
10577
10577
|
}
|
|
10578
|
-
|
|
10578
|
+
target2 = overrideTarget(header, override2.value, mode);
|
|
10579
10579
|
} else {
|
|
10580
10580
|
const field = fieldOf(header);
|
|
10581
10581
|
const custom = CUSTOM_HEADER.exec(header)?.[1];
|
|
@@ -10585,7 +10585,7 @@ function buildMapping(headers, overrides, mode) {
|
|
|
10585
10585
|
drop(header, problem);
|
|
10586
10586
|
continue;
|
|
10587
10587
|
}
|
|
10588
|
-
|
|
10588
|
+
target2 = { customKey: normalizeVariableName(custom) };
|
|
10589
10589
|
} else if (isBagHeader(header)) {
|
|
10590
10590
|
drop(header, "not_an_object");
|
|
10591
10591
|
continue;
|
|
@@ -10594,20 +10594,20 @@ function buildMapping(headers, overrides, mode) {
|
|
|
10594
10594
|
drop(header, "not_updatable");
|
|
10595
10595
|
continue;
|
|
10596
10596
|
}
|
|
10597
|
-
|
|
10597
|
+
target2 = { field };
|
|
10598
10598
|
} else {
|
|
10599
10599
|
const problem = customVariableKeyProblem(header);
|
|
10600
10600
|
if (problem) {
|
|
10601
10601
|
drop(header, problem);
|
|
10602
10602
|
continue;
|
|
10603
10603
|
}
|
|
10604
|
-
|
|
10604
|
+
target2 = { customKey: normalizeVariableName(header) };
|
|
10605
10605
|
}
|
|
10606
10606
|
}
|
|
10607
|
-
result.columns.push({ header, target });
|
|
10608
|
-
result.mapping[header] = targetName(
|
|
10609
|
-
if ("field" in
|
|
10610
|
-
else if (!result.customVariableKeys.includes(
|
|
10607
|
+
result.columns.push({ header, target: target2 });
|
|
10608
|
+
result.mapping[header] = targetName(target2);
|
|
10609
|
+
if ("field" in target2) result.fields.add(target2.field);
|
|
10610
|
+
else if (!result.customVariableKeys.includes(target2.customKey)) result.customVariableKeys.push(target2.customKey);
|
|
10611
10611
|
}
|
|
10612
10612
|
return result;
|
|
10613
10613
|
}
|
|
@@ -10621,15 +10621,15 @@ function readCell(value) {
|
|
|
10621
10621
|
}
|
|
10622
10622
|
function rowValues(row, mapping, mode) {
|
|
10623
10623
|
const out = { fields: {}, customVariables: {} };
|
|
10624
|
-
for (const { header, target } of mapping.columns) {
|
|
10624
|
+
for (const { header, target: target2 } of mapping.columns) {
|
|
10625
10625
|
const cell2 = readCell(row[header]);
|
|
10626
10626
|
if (cell2.kind === "blank") continue;
|
|
10627
10627
|
const value = cell2.kind === "null" ? null : cell2.text;
|
|
10628
|
-
if ("field" in
|
|
10628
|
+
if ("field" in target2) {
|
|
10629
10629
|
if (value === null && mode === "import") continue;
|
|
10630
|
-
if (!Object.hasOwn(out.fields,
|
|
10631
|
-
} else if (!Object.hasOwn(out.customVariables,
|
|
10632
|
-
out.customVariables[
|
|
10630
|
+
if (!Object.hasOwn(out.fields, target2.field)) out.fields[target2.field] = value;
|
|
10631
|
+
} else if (!Object.hasOwn(out.customVariables, target2.customKey)) {
|
|
10632
|
+
out.customVariables[target2.customKey] = value;
|
|
10633
10633
|
}
|
|
10634
10634
|
}
|
|
10635
10635
|
return out;
|
|
@@ -10986,10 +10986,10 @@ function columnMappings(mapping) {
|
|
|
10986
10986
|
const sent = new Map(mapping.columns.map((column) => [column.header, column.target]));
|
|
10987
10987
|
const out = [];
|
|
10988
10988
|
for (const header of Object.keys(mapping.mapping)) {
|
|
10989
|
-
const
|
|
10990
|
-
const csvTarget =
|
|
10991
|
-
if (
|
|
10992
|
-
else if (
|
|
10989
|
+
const target2 = sent.get(header);
|
|
10990
|
+
const csvTarget = target2 ? void 0 : csvTargetOf(header, mapping);
|
|
10991
|
+
if (target2 && "field" in target2) out.push({ csvColumn: header, targetField: TARGET_FIELDS[target2.field] ?? target2.field });
|
|
10992
|
+
else if (target2) out.push({ csvColumn: header, targetField: "custom_variable", customVariableName: target2.customKey });
|
|
10993
10993
|
else if (csvTarget) out.push({ csvColumn: header, targetField: csvTarget });
|
|
10994
10994
|
}
|
|
10995
10995
|
return out;
|
|
@@ -11460,12 +11460,12 @@ import { join as join11 } from "node:path";
|
|
|
11460
11460
|
function whereDir(env) {
|
|
11461
11461
|
return join11(runsRoot(env), WHERE_DIR);
|
|
11462
11462
|
}
|
|
11463
|
-
async function unfinishedWhereIds(ctx,
|
|
11463
|
+
async function unfinishedWhereIds(ctx, command65, args) {
|
|
11464
11464
|
const dir = whereDir(ctx.env);
|
|
11465
11465
|
const identity = argsIdentity(args);
|
|
11466
11466
|
const workspaceId = ctx.client.workspaceId ?? ctx.auth.workspaceId;
|
|
11467
11467
|
for (const run of await listRuns(ctx.env)) {
|
|
11468
|
-
if (run.command !==
|
|
11468
|
+
if (run.command !== command65 || run.status === "done" || run.status === "planned") continue;
|
|
11469
11469
|
if ((run.workspaceId || void 0) !== (workspaceId || void 0) || argsIdentity(run.args) !== identity) continue;
|
|
11470
11470
|
if (run.inputPath?.startsWith(`${dir}/`) && existsSync6(run.inputPath)) return run.inputPath;
|
|
11471
11471
|
}
|
|
@@ -11611,14 +11611,14 @@ async function idsFromRun(ctx, runId) {
|
|
|
11611
11611
|
return { ...idItems(ids2), source: "run" };
|
|
11612
11612
|
}
|
|
11613
11613
|
async function collectIds(ctx, flags, kind, dryRun2) {
|
|
11614
|
-
const
|
|
11614
|
+
const command65 = `kenso contacts ${kind}`;
|
|
11615
11615
|
const ids2 = stringFlag2(flags, "ids");
|
|
11616
11616
|
const where = kind === "restore" ? void 0 : stringFlag2(flags, "where");
|
|
11617
11617
|
const run = kind === "restore" ? stringFlag2(flags, "run") : void 0;
|
|
11618
11618
|
const given = [ids2, where, run].filter((v) => v !== void 0).length;
|
|
11619
11619
|
if (given !== 1) {
|
|
11620
11620
|
const choices = kind === "restore" ? "--ids <file|-> or --run <runId>" : "--ids <file|-> or --where '<json>'";
|
|
11621
|
-
throw usageError(`${
|
|
11621
|
+
throw usageError(`${command65} needs exactly one of ${choices}.`, { field: "ids", next: `${command65} --help` });
|
|
11622
11622
|
}
|
|
11623
11623
|
if (ids2 !== void 0) return idsFromFile(ctx, ids2);
|
|
11624
11624
|
if (where !== void 0) return idsFromWhere(ctx, kind, flags, where, dryRun2);
|
|
@@ -12920,6 +12920,219 @@ var init_mcp = __esm({
|
|
|
12920
12920
|
}
|
|
12921
12921
|
});
|
|
12922
12922
|
|
|
12923
|
+
// src/commands/notes/target.ts
|
|
12924
|
+
function positiveId2(value, field, next) {
|
|
12925
|
+
const text4 = String(value ?? "").trim();
|
|
12926
|
+
const id = /^\d+$/.test(text4) ? Number(text4) : Number.NaN;
|
|
12927
|
+
if (!Number.isSafeInteger(id) || id < 1) {
|
|
12928
|
+
throw usageError(`${field} must be a positive whole number (got "${text4}").`, { field, next });
|
|
12929
|
+
}
|
|
12930
|
+
return id;
|
|
12931
|
+
}
|
|
12932
|
+
function target(flags, next, allowNone = false) {
|
|
12933
|
+
const given = ["account", "person", "deal"].filter((name2) => flags[name2] !== void 0);
|
|
12934
|
+
if (given.length === 0 && allowNone) return {};
|
|
12935
|
+
if (given.length !== 1) {
|
|
12936
|
+
throw usageError("Name the record with exactly one of --account, --person and --deal.", { field: "account", next });
|
|
12937
|
+
}
|
|
12938
|
+
const name = given[0];
|
|
12939
|
+
const key = name === "deal" ? "opportunityId" : `${name}Id`;
|
|
12940
|
+
return { [key]: positiveId2(flags[name], name, next) };
|
|
12941
|
+
}
|
|
12942
|
+
var targetFlags;
|
|
12943
|
+
var init_target = __esm({
|
|
12944
|
+
"src/commands/notes/target.ts"() {
|
|
12945
|
+
"use strict";
|
|
12946
|
+
init_errors();
|
|
12947
|
+
targetFlags = {
|
|
12948
|
+
account: { type: "string", description: "The account id", aliases: ["account-id"] },
|
|
12949
|
+
person: { type: "string", description: "The person id", aliases: ["person-id"] },
|
|
12950
|
+
deal: { type: "string", description: "The deal (opportunity) id", aliases: ["opportunity", "opportunity-id"] }
|
|
12951
|
+
};
|
|
12952
|
+
}
|
|
12953
|
+
});
|
|
12954
|
+
|
|
12955
|
+
// src/commands/notes/list.ts
|
|
12956
|
+
var list_exports = {};
|
|
12957
|
+
__export(list_exports, {
|
|
12958
|
+
default: () => list_default
|
|
12959
|
+
});
|
|
12960
|
+
var command28, list_default;
|
|
12961
|
+
var init_list = __esm({
|
|
12962
|
+
"src/commands/notes/list.ts"() {
|
|
12963
|
+
"use strict";
|
|
12964
|
+
init_exit_codes();
|
|
12965
|
+
init_target();
|
|
12966
|
+
command28 = {
|
|
12967
|
+
resource: "notes",
|
|
12968
|
+
action: "list",
|
|
12969
|
+
summary: "List the notes on an account, a person or a deal, pinned first, then newest",
|
|
12970
|
+
description: "Reads GET /v1/notes for the one record you name and follows every page. Each note has id, body (markdown, mentions as @[Name](memberId)), mentions, isPinned, createdBy, createdAt, editedAt, commentCount and its first 50 comments, oldest first. A record outside your workspace or account scope is not_found.",
|
|
12971
|
+
flags: targetFlags,
|
|
12972
|
+
examples: [
|
|
12973
|
+
"kenso notes list --account 5",
|
|
12974
|
+
"kenso notes list --deal 77 --query '[].{id: id, by: createdBy.name, body: body}'"
|
|
12975
|
+
],
|
|
12976
|
+
beta: { featureGates: { all: ["record_notes"] } },
|
|
12977
|
+
operationIds: ["notes.list"],
|
|
12978
|
+
async run(ctx, { flags }) {
|
|
12979
|
+
const query = target(flags, "kenso notes list --account <accountId>");
|
|
12980
|
+
await ctx.output.list(ctx.client.paginate({ method: "GET", path: "/v1/notes", query, signal: ctx.signal }));
|
|
12981
|
+
return ExitCode.Ok;
|
|
12982
|
+
}
|
|
12983
|
+
};
|
|
12984
|
+
list_default = command28;
|
|
12985
|
+
}
|
|
12986
|
+
});
|
|
12987
|
+
|
|
12988
|
+
// src/commands/notes/add.ts
|
|
12989
|
+
var add_exports = {};
|
|
12990
|
+
__export(add_exports, {
|
|
12991
|
+
bodyText: () => bodyText,
|
|
12992
|
+
default: () => add_default
|
|
12993
|
+
});
|
|
12994
|
+
async function bodyText(ctx, value, next) {
|
|
12995
|
+
const text4 = value === "-" ? await readStream(ctx.stdin ?? process.stdin) : String(value ?? "");
|
|
12996
|
+
if (text4.trim() === "") throw usageError("--body cannot be empty: the note's text, in markdown (--body - reads stdin).", { field: "body", next });
|
|
12997
|
+
return text4;
|
|
12998
|
+
}
|
|
12999
|
+
var command29, add_default;
|
|
13000
|
+
var init_add = __esm({
|
|
13001
|
+
"src/commands/notes/add.ts"() {
|
|
13002
|
+
"use strict";
|
|
13003
|
+
init_errors();
|
|
13004
|
+
init_exit_codes();
|
|
13005
|
+
init_http();
|
|
13006
|
+
init_input();
|
|
13007
|
+
init_target();
|
|
13008
|
+
command29 = {
|
|
13009
|
+
resource: "notes",
|
|
13010
|
+
action: "add",
|
|
13011
|
+
summary: "Write a note on an account, a person or a deal, or a comment under a note",
|
|
13012
|
+
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.",
|
|
13013
|
+
flags: {
|
|
13014
|
+
...targetFlags,
|
|
13015
|
+
parent: { type: "string", description: "The note to comment on (instead of a record flag)" },
|
|
13016
|
+
body: { type: "string", required: true, description: "The text, in markdown. - reads it from stdin" }
|
|
13017
|
+
},
|
|
13018
|
+
examples: [
|
|
13019
|
+
"kenso notes add --account 5 --body 'Budget approved, @[Jane Doe](41) please send the DPA'",
|
|
13020
|
+
"kenso notes add --parent 900 --body 'Sent it this morning'",
|
|
13021
|
+
"cat call-notes.md | kenso notes add --deal 77 --body -"
|
|
13022
|
+
],
|
|
13023
|
+
beta: { featureGates: { all: ["record_notes"] } },
|
|
13024
|
+
operationIds: ["notes.create"],
|
|
13025
|
+
async run(ctx, { flags }) {
|
|
13026
|
+
const next = "kenso notes add --account <accountId> --body <text>";
|
|
13027
|
+
const record = target(flags, next, flags.parent !== void 0);
|
|
13028
|
+
if (flags.parent !== void 0 && Object.keys(record).length > 0) {
|
|
13029
|
+
throw usageError("A comment takes --parent alone: its note decides the record.", { field: "parent", next });
|
|
13030
|
+
}
|
|
13031
|
+
const parent = flags.parent === void 0 ? {} : { parentNoteId: positiveId2(flags.parent, "parent", next) };
|
|
13032
|
+
const body2 = await bodyText(ctx, flags.body, next);
|
|
13033
|
+
const res = await ctx.client.request({ method: "POST", path: "/v1/notes", body: { ...record, ...parent, body: body2 }, signal: ctx.signal });
|
|
13034
|
+
ctx.output.object(unwrap(res.body));
|
|
13035
|
+
return ExitCode.Ok;
|
|
13036
|
+
}
|
|
13037
|
+
};
|
|
13038
|
+
add_default = command29;
|
|
13039
|
+
}
|
|
13040
|
+
});
|
|
13041
|
+
|
|
13042
|
+
// src/commands/notes/edit.ts
|
|
13043
|
+
var edit_exports = {};
|
|
13044
|
+
__export(edit_exports, {
|
|
13045
|
+
default: () => edit_default
|
|
13046
|
+
});
|
|
13047
|
+
var command30, edit_default;
|
|
13048
|
+
var init_edit = __esm({
|
|
13049
|
+
"src/commands/notes/edit.ts"() {
|
|
13050
|
+
"use strict";
|
|
13051
|
+
init_errors();
|
|
13052
|
+
init_exit_codes();
|
|
13053
|
+
init_http();
|
|
13054
|
+
init_add();
|
|
13055
|
+
init_target();
|
|
13056
|
+
command30 = {
|
|
13057
|
+
resource: "notes",
|
|
13058
|
+
action: "edit",
|
|
13059
|
+
summary: "Change a note's text, or pin or unpin it",
|
|
13060
|
+
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.",
|
|
13061
|
+
flags: {
|
|
13062
|
+
body: { type: "string", description: "The new text, in markdown. - reads it from stdin" },
|
|
13063
|
+
pin: { type: "boolean", description: "Pin the note to the top of the record's notes" },
|
|
13064
|
+
unpin: { type: "boolean", description: "Unpin the note" }
|
|
13065
|
+
},
|
|
13066
|
+
positionals: [{ name: "noteId", required: true, description: "The note or comment id" }],
|
|
13067
|
+
examples: ["kenso notes edit 900 --body 'Budget approved for Q1'", "kenso notes edit 900 --pin"],
|
|
13068
|
+
beta: { featureGates: { all: ["record_notes"] } },
|
|
13069
|
+
operationIds: ["notes.update"],
|
|
13070
|
+
async run(ctx, { flags, positionals }) {
|
|
13071
|
+
const next = "kenso notes edit <noteId> --body <text>";
|
|
13072
|
+
const id = positiveId2(positionals[0], "noteId", next);
|
|
13073
|
+
if (flags.pin === true && flags.unpin === true) throw usageError("Pass --pin or --unpin, not both.", { field: "pin", next });
|
|
13074
|
+
const patch = {};
|
|
13075
|
+
if (flags.body !== void 0) patch.body = await bodyText(ctx, flags.body, next);
|
|
13076
|
+
if (flags.pin === true || flags.unpin === true) patch.isPinned = flags.pin === true;
|
|
13077
|
+
if (Object.keys(patch).length === 0) throw usageError("Pass --body, --pin or --unpin.", { field: "body", next });
|
|
13078
|
+
const res = await ctx.client.request({ method: "PATCH", path: `/v1/notes/${id}`, body: patch, signal: ctx.signal });
|
|
13079
|
+
ctx.output.object(unwrap(res.body));
|
|
13080
|
+
return ExitCode.Ok;
|
|
13081
|
+
}
|
|
13082
|
+
};
|
|
13083
|
+
edit_default = command30;
|
|
13084
|
+
}
|
|
13085
|
+
});
|
|
13086
|
+
|
|
13087
|
+
// src/commands/notes/delete.ts
|
|
13088
|
+
var delete_exports = {};
|
|
13089
|
+
__export(delete_exports, {
|
|
13090
|
+
default: () => delete_default
|
|
13091
|
+
});
|
|
13092
|
+
var command31, delete_default;
|
|
13093
|
+
var init_delete = __esm({
|
|
13094
|
+
"src/commands/notes/delete.ts"() {
|
|
13095
|
+
"use strict";
|
|
13096
|
+
init_confirm();
|
|
13097
|
+
init_exit_codes();
|
|
13098
|
+
init_target();
|
|
13099
|
+
command31 = {
|
|
13100
|
+
resource: "notes",
|
|
13101
|
+
action: "delete",
|
|
13102
|
+
summary: "Delete a note or a comment (its author or a workspace admin)",
|
|
13103
|
+
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.",
|
|
13104
|
+
flags: {},
|
|
13105
|
+
positionals: [{ name: "noteId", required: true, description: "The note or comment id" }],
|
|
13106
|
+
examples: ["kenso notes delete 900 --yes"],
|
|
13107
|
+
beta: { featureGates: { all: ["record_notes"] } },
|
|
13108
|
+
operationIds: ["notes.delete"],
|
|
13109
|
+
async run(ctx, { positionals }) {
|
|
13110
|
+
const next = "kenso notes delete <noteId> --yes";
|
|
13111
|
+
const id = positiveId2(positionals[0], "noteId", next);
|
|
13112
|
+
await confirmDestructive(ctx, `This deletes note ${id}`, `kenso notes delete ${id} --yes`);
|
|
13113
|
+
await ctx.client.request({ method: "DELETE", path: `/v1/notes/${id}`, signal: ctx.signal });
|
|
13114
|
+
ctx.output.object({ id, deleted: true });
|
|
13115
|
+
return ExitCode.Ok;
|
|
13116
|
+
}
|
|
13117
|
+
};
|
|
13118
|
+
delete_default = command31;
|
|
13119
|
+
}
|
|
13120
|
+
});
|
|
13121
|
+
|
|
13122
|
+
// src/commands/notes/index.ts
|
|
13123
|
+
var actions17;
|
|
13124
|
+
var init_notes = __esm({
|
|
13125
|
+
"src/commands/notes/index.ts"() {
|
|
13126
|
+
"use strict";
|
|
13127
|
+
actions17 = {
|
|
13128
|
+
list: () => Promise.resolve().then(() => (init_list(), list_exports)).then((m) => m.default),
|
|
13129
|
+
add: () => Promise.resolve().then(() => (init_add(), add_exports)).then((m) => m.default),
|
|
13130
|
+
edit: () => Promise.resolve().then(() => (init_edit(), edit_exports)).then((m) => m.default),
|
|
13131
|
+
delete: () => Promise.resolve().then(() => (init_delete(), delete_exports)).then((m) => m.default)
|
|
13132
|
+
};
|
|
13133
|
+
}
|
|
13134
|
+
});
|
|
13135
|
+
|
|
12923
13136
|
// src/commands/opportunities/move.ts
|
|
12924
13137
|
var move_exports = {};
|
|
12925
13138
|
__export(move_exports, {
|
|
@@ -12938,7 +13151,7 @@ async function categoryOf(ctx, stage) {
|
|
|
12938
13151
|
throw err;
|
|
12939
13152
|
}
|
|
12940
13153
|
}
|
|
12941
|
-
var KEY,
|
|
13154
|
+
var KEY, command32, move_default;
|
|
12942
13155
|
var init_move = __esm({
|
|
12943
13156
|
"src/commands/opportunities/move.ts"() {
|
|
12944
13157
|
"use strict";
|
|
@@ -12946,7 +13159,7 @@ var init_move = __esm({
|
|
|
12946
13159
|
init_exit_codes();
|
|
12947
13160
|
init_http();
|
|
12948
13161
|
KEY = /^[a-z][a-z0-9_]{0,62}$/;
|
|
12949
|
-
|
|
13162
|
+
command32 = {
|
|
12950
13163
|
resource: "opportunities",
|
|
12951
13164
|
action: "move",
|
|
12952
13165
|
summary: "Move a deal to a stage, with its won or lost reason",
|
|
@@ -12992,7 +13205,7 @@ var init_move = __esm({
|
|
|
12992
13205
|
return ExitCode.Ok;
|
|
12993
13206
|
}
|
|
12994
13207
|
};
|
|
12995
|
-
move_default =
|
|
13208
|
+
move_default = command32;
|
|
12996
13209
|
}
|
|
12997
13210
|
});
|
|
12998
13211
|
|
|
@@ -13001,14 +13214,14 @@ var stage_history_exports = {};
|
|
|
13001
13214
|
__export(stage_history_exports, {
|
|
13002
13215
|
default: () => stage_history_default
|
|
13003
13216
|
});
|
|
13004
|
-
var
|
|
13217
|
+
var command33, stage_history_default;
|
|
13005
13218
|
var init_stage_history = __esm({
|
|
13006
13219
|
"src/commands/opportunities/stage-history.ts"() {
|
|
13007
13220
|
"use strict";
|
|
13008
13221
|
init_errors();
|
|
13009
13222
|
init_exit_codes();
|
|
13010
13223
|
init_http();
|
|
13011
|
-
|
|
13224
|
+
command33 = {
|
|
13012
13225
|
resource: "opportunities",
|
|
13013
13226
|
action: "stage-history",
|
|
13014
13227
|
summary: "Show a deal's stage history: each stage, when, who moved it and how long it sat there",
|
|
@@ -13032,16 +13245,16 @@ var init_stage_history = __esm({
|
|
|
13032
13245
|
return ExitCode.Ok;
|
|
13033
13246
|
}
|
|
13034
13247
|
};
|
|
13035
|
-
stage_history_default =
|
|
13248
|
+
stage_history_default = command33;
|
|
13036
13249
|
}
|
|
13037
13250
|
});
|
|
13038
13251
|
|
|
13039
13252
|
// src/commands/opportunities/index.ts
|
|
13040
|
-
var
|
|
13253
|
+
var actions18;
|
|
13041
13254
|
var init_opportunities = __esm({
|
|
13042
13255
|
"src/commands/opportunities/index.ts"() {
|
|
13043
13256
|
"use strict";
|
|
13044
|
-
|
|
13257
|
+
actions18 = {
|
|
13045
13258
|
move: () => Promise.resolve().then(() => (init_move(), move_exports)).then((m) => m.default),
|
|
13046
13259
|
"stage-history": () => Promise.resolve().then(() => (init_stage_history(), stage_history_exports)).then((m) => m.default)
|
|
13047
13260
|
};
|
|
@@ -13119,7 +13332,7 @@ function summarize3(results) {
|
|
|
13119
13332
|
}
|
|
13120
13333
|
return { matched, addedToAccounts, emailFindsQueued };
|
|
13121
13334
|
}
|
|
13122
|
-
var COMMAND5, CHUNK_SIZE6, ALIASES3, PERSON_FIELDS, ACCOUNT_NOT_FOUND,
|
|
13335
|
+
var COMMAND5, CHUNK_SIZE6, ALIASES3, PERSON_FIELDS, ACCOUNT_NOT_FOUND, command34, import_default3;
|
|
13123
13336
|
var init_import3 = __esm({
|
|
13124
13337
|
"src/commands/people/import.ts"() {
|
|
13125
13338
|
"use strict";
|
|
@@ -13151,7 +13364,7 @@ var init_import3 = __esm({
|
|
|
13151
13364
|
};
|
|
13152
13365
|
PERSON_FIELDS = ["email", "fullName", "firstName", "lastName", "linkedinUrl", "title"];
|
|
13153
13366
|
ACCOUNT_NOT_FOUND = "No account in this workspace has that domain. The person was saved without an account: add the account (kenso accounts import) and run the same command again.";
|
|
13154
|
-
|
|
13367
|
+
command34 = {
|
|
13155
13368
|
resource: "people",
|
|
13156
13369
|
action: "import",
|
|
13157
13370
|
summary: "Create or match people from a CSV or JSONL file, optionally onto accounts",
|
|
@@ -13216,16 +13429,16 @@ var init_import3 = __esm({
|
|
|
13216
13429
|
return outcome.exitCode;
|
|
13217
13430
|
}
|
|
13218
13431
|
};
|
|
13219
|
-
import_default3 =
|
|
13432
|
+
import_default3 = command34;
|
|
13220
13433
|
}
|
|
13221
13434
|
});
|
|
13222
13435
|
|
|
13223
13436
|
// src/commands/people/index.ts
|
|
13224
|
-
var
|
|
13437
|
+
var actions19;
|
|
13225
13438
|
var init_people = __esm({
|
|
13226
13439
|
"src/commands/people/index.ts"() {
|
|
13227
13440
|
"use strict";
|
|
13228
|
-
|
|
13441
|
+
actions19 = {
|
|
13229
13442
|
import: () => Promise.resolve().then(() => (init_import3(), import_exports3)).then((m) => m.default)
|
|
13230
13443
|
};
|
|
13231
13444
|
}
|
|
@@ -13246,14 +13459,14 @@ function rule(stage) {
|
|
|
13246
13459
|
isDefault: stage.isDefaultRequiredFields
|
|
13247
13460
|
};
|
|
13248
13461
|
}
|
|
13249
|
-
var
|
|
13462
|
+
var command35, stage_rules_default;
|
|
13250
13463
|
var init_stage_rules = __esm({
|
|
13251
13464
|
"src/commands/pipelines/stage-rules.ts"() {
|
|
13252
13465
|
"use strict";
|
|
13253
13466
|
init_errors();
|
|
13254
13467
|
init_exit_codes();
|
|
13255
13468
|
init_http();
|
|
13256
|
-
|
|
13469
|
+
command35 = {
|
|
13257
13470
|
resource: "pipelines",
|
|
13258
13471
|
action: "stage-rules",
|
|
13259
13472
|
summary: "List or set the fields a deal should have in each stage",
|
|
@@ -13306,16 +13519,16 @@ var init_stage_rules = __esm({
|
|
|
13306
13519
|
return ExitCode.Ok;
|
|
13307
13520
|
}
|
|
13308
13521
|
};
|
|
13309
|
-
stage_rules_default =
|
|
13522
|
+
stage_rules_default = command35;
|
|
13310
13523
|
}
|
|
13311
13524
|
});
|
|
13312
13525
|
|
|
13313
13526
|
// src/commands/pipelines/index.ts
|
|
13314
|
-
var
|
|
13527
|
+
var actions20;
|
|
13315
13528
|
var init_pipelines = __esm({
|
|
13316
13529
|
"src/commands/pipelines/index.ts"() {
|
|
13317
13530
|
"use strict";
|
|
13318
|
-
|
|
13531
|
+
actions20 = {
|
|
13319
13532
|
"stage-rules": () => Promise.resolve().then(() => (init_stage_rules(), stage_rules_exports)).then((m) => m.default)
|
|
13320
13533
|
};
|
|
13321
13534
|
}
|
|
@@ -13326,7 +13539,7 @@ var run_exports2 = {};
|
|
|
13326
13539
|
__export(run_exports2, {
|
|
13327
13540
|
default: () => run_default
|
|
13328
13541
|
});
|
|
13329
|
-
var REPORTS,
|
|
13542
|
+
var REPORTS, command36, run_default;
|
|
13330
13543
|
var init_run2 = __esm({
|
|
13331
13544
|
"src/commands/reports/run.ts"() {
|
|
13332
13545
|
"use strict";
|
|
@@ -13334,7 +13547,7 @@ var init_run2 = __esm({
|
|
|
13334
13547
|
init_exit_codes();
|
|
13335
13548
|
init_http();
|
|
13336
13549
|
REPORTS = ["pipeline_by_stage", "won_by_month", "stage_conversion", "time_in_stage", "won_by_source_campaign", "activity_by_member"];
|
|
13337
|
-
|
|
13550
|
+
command36 = {
|
|
13338
13551
|
resource: "reports",
|
|
13339
13552
|
action: "run",
|
|
13340
13553
|
summary: "Run a stock pipeline report and print its table",
|
|
@@ -13396,7 +13609,7 @@ var init_run2 = __esm({
|
|
|
13396
13609
|
return ExitCode.Ok;
|
|
13397
13610
|
}
|
|
13398
13611
|
};
|
|
13399
|
-
run_default =
|
|
13612
|
+
run_default = command36;
|
|
13400
13613
|
}
|
|
13401
13614
|
});
|
|
13402
13615
|
|
|
@@ -13405,14 +13618,14 @@ var summary_exports = {};
|
|
|
13405
13618
|
__export(summary_exports, {
|
|
13406
13619
|
default: () => summary_default
|
|
13407
13620
|
});
|
|
13408
|
-
var
|
|
13621
|
+
var command37, summary_default;
|
|
13409
13622
|
var init_summary = __esm({
|
|
13410
13623
|
"src/commands/reports/summary.ts"() {
|
|
13411
13624
|
"use strict";
|
|
13412
13625
|
init_errors();
|
|
13413
13626
|
init_exit_codes();
|
|
13414
13627
|
init_http();
|
|
13415
|
-
|
|
13628
|
+
command37 = {
|
|
13416
13629
|
resource: "reports",
|
|
13417
13630
|
action: "summary",
|
|
13418
13631
|
summary: "Read where the period stands and what needs you",
|
|
@@ -13467,16 +13680,16 @@ var init_summary = __esm({
|
|
|
13467
13680
|
return ExitCode.Ok;
|
|
13468
13681
|
}
|
|
13469
13682
|
};
|
|
13470
|
-
summary_default =
|
|
13683
|
+
summary_default = command37;
|
|
13471
13684
|
}
|
|
13472
13685
|
});
|
|
13473
13686
|
|
|
13474
13687
|
// src/commands/reports/index.ts
|
|
13475
|
-
var
|
|
13688
|
+
var actions21;
|
|
13476
13689
|
var init_reports = __esm({
|
|
13477
13690
|
"src/commands/reports/index.ts"() {
|
|
13478
13691
|
"use strict";
|
|
13479
|
-
|
|
13692
|
+
actions21 = {
|
|
13480
13693
|
run: () => Promise.resolve().then(() => (init_run2(), run_exports2)).then((m) => m.default),
|
|
13481
13694
|
summary: () => Promise.resolve().then(() => (init_summary(), summary_exports)).then((m) => m.default)
|
|
13482
13695
|
};
|
|
@@ -13484,18 +13697,18 @@ var init_reports = __esm({
|
|
|
13484
13697
|
});
|
|
13485
13698
|
|
|
13486
13699
|
// src/commands/runs/list.ts
|
|
13487
|
-
var
|
|
13488
|
-
__export(
|
|
13489
|
-
default: () =>
|
|
13700
|
+
var list_exports2 = {};
|
|
13701
|
+
__export(list_exports2, {
|
|
13702
|
+
default: () => list_default2
|
|
13490
13703
|
});
|
|
13491
|
-
var
|
|
13492
|
-
var
|
|
13704
|
+
var command38, list_default2;
|
|
13705
|
+
var init_list2 = __esm({
|
|
13493
13706
|
"src/commands/runs/list.ts"() {
|
|
13494
13707
|
"use strict";
|
|
13495
13708
|
init_runs();
|
|
13496
13709
|
init_errors();
|
|
13497
13710
|
init_exit_codes();
|
|
13498
|
-
|
|
13711
|
+
command38 = {
|
|
13499
13712
|
resource: "runs",
|
|
13500
13713
|
action: "list",
|
|
13501
13714
|
summary: "List batch runs, newest first (finds an interrupted run)",
|
|
@@ -13516,7 +13729,7 @@ var init_list = __esm({
|
|
|
13516
13729
|
return ExitCode.Ok;
|
|
13517
13730
|
}
|
|
13518
13731
|
};
|
|
13519
|
-
|
|
13732
|
+
list_default2 = command38;
|
|
13520
13733
|
}
|
|
13521
13734
|
});
|
|
13522
13735
|
|
|
@@ -13527,7 +13740,7 @@ __export(show_exports2, {
|
|
|
13527
13740
|
});
|
|
13528
13741
|
import { existsSync as existsSync7, readFileSync as readFileSync9 } from "node:fs";
|
|
13529
13742
|
import { join as join12 } from "node:path";
|
|
13530
|
-
var FILES,
|
|
13743
|
+
var FILES, command39, show_default2;
|
|
13531
13744
|
var init_show2 = __esm({
|
|
13532
13745
|
"src/commands/runs/show.ts"() {
|
|
13533
13746
|
"use strict";
|
|
@@ -13542,7 +13755,7 @@ var init_show2 = __esm({
|
|
|
13542
13755
|
["plan", "plan.json"],
|
|
13543
13756
|
["summary", "summary.json"]
|
|
13544
13757
|
];
|
|
13545
|
-
|
|
13758
|
+
command39 = {
|
|
13546
13759
|
resource: "runs",
|
|
13547
13760
|
action: "show",
|
|
13548
13761
|
summary: "Show one batch run and its files",
|
|
@@ -13569,7 +13782,7 @@ var init_show2 = __esm({
|
|
|
13569
13782
|
return ExitCode.Ok;
|
|
13570
13783
|
}
|
|
13571
13784
|
};
|
|
13572
|
-
show_default2 =
|
|
13785
|
+
show_default2 = command39;
|
|
13573
13786
|
}
|
|
13574
13787
|
});
|
|
13575
13788
|
|
|
@@ -13628,14 +13841,14 @@ function resumeArgv(run, globals = {}) {
|
|
|
13628
13841
|
async function sha256(path) {
|
|
13629
13842
|
return createHash5("sha256").update(await readFile9(path)).digest("hex");
|
|
13630
13843
|
}
|
|
13631
|
-
var SKIPPED_KEYS,
|
|
13844
|
+
var SKIPPED_KEYS, command40, resume_default;
|
|
13632
13845
|
var init_resume = __esm({
|
|
13633
13846
|
"src/commands/runs/resume.ts"() {
|
|
13634
13847
|
"use strict";
|
|
13635
13848
|
init_runs();
|
|
13636
13849
|
init_errors();
|
|
13637
13850
|
SKIPPED_KEYS = /* @__PURE__ */ new Set(["positionals", "yes", "dryRun", "dry-run", "help", "version"]);
|
|
13638
|
-
|
|
13851
|
+
command40 = {
|
|
13639
13852
|
resource: "runs",
|
|
13640
13853
|
action: "resume",
|
|
13641
13854
|
summary: "Continue an interrupted batch run (its command with --yes, no dry run)",
|
|
@@ -13690,17 +13903,17 @@ var init_resume = __esm({
|
|
|
13690
13903
|
}
|
|
13691
13904
|
}
|
|
13692
13905
|
};
|
|
13693
|
-
resume_default =
|
|
13906
|
+
resume_default = command40;
|
|
13694
13907
|
}
|
|
13695
13908
|
});
|
|
13696
13909
|
|
|
13697
13910
|
// src/commands/runs/index.ts
|
|
13698
|
-
var
|
|
13911
|
+
var actions22;
|
|
13699
13912
|
var init_runs2 = __esm({
|
|
13700
13913
|
"src/commands/runs/index.ts"() {
|
|
13701
13914
|
"use strict";
|
|
13702
|
-
|
|
13703
|
-
list: () => Promise.resolve().then(() => (
|
|
13915
|
+
actions22 = {
|
|
13916
|
+
list: () => Promise.resolve().then(() => (init_list2(), list_exports2)).then((m) => m.default),
|
|
13704
13917
|
show: () => Promise.resolve().then(() => (init_show2(), show_exports2)).then((m) => m.default),
|
|
13705
13918
|
resume: () => Promise.resolve().then(() => (init_resume(), resume_exports)).then((m) => m.default)
|
|
13706
13919
|
};
|
|
@@ -13798,7 +14011,7 @@ var create_exports = {};
|
|
|
13798
14011
|
__export(create_exports, {
|
|
13799
14012
|
default: () => create_default
|
|
13800
14013
|
});
|
|
13801
|
-
var
|
|
14014
|
+
var command41, create_default;
|
|
13802
14015
|
var init_create = __esm({
|
|
13803
14016
|
"src/commands/sandbox/create.ts"() {
|
|
13804
14017
|
"use strict";
|
|
@@ -13806,7 +14019,7 @@ var init_create = __esm({
|
|
|
13806
14019
|
init_exit_codes();
|
|
13807
14020
|
init_http();
|
|
13808
14021
|
init_shared();
|
|
13809
|
-
|
|
14022
|
+
command41 = {
|
|
13810
14023
|
resource: "sandbox",
|
|
13811
14024
|
action: "create",
|
|
13812
14025
|
summary: "Create your developer sandbox and save its test key as the sandbox profile",
|
|
@@ -13848,24 +14061,24 @@ var init_create = __esm({
|
|
|
13848
14061
|
return ExitCode.Ok;
|
|
13849
14062
|
}
|
|
13850
14063
|
};
|
|
13851
|
-
create_default =
|
|
14064
|
+
create_default = command41;
|
|
13852
14065
|
}
|
|
13853
14066
|
});
|
|
13854
14067
|
|
|
13855
14068
|
// src/commands/sandbox/delete.ts
|
|
13856
|
-
var
|
|
13857
|
-
__export(
|
|
13858
|
-
default: () =>
|
|
14069
|
+
var delete_exports2 = {};
|
|
14070
|
+
__export(delete_exports2, {
|
|
14071
|
+
default: () => delete_default2
|
|
13859
14072
|
});
|
|
13860
|
-
var
|
|
13861
|
-
var
|
|
14073
|
+
var command42, delete_default2;
|
|
14074
|
+
var init_delete2 = __esm({
|
|
13862
14075
|
"src/commands/sandbox/delete.ts"() {
|
|
13863
14076
|
"use strict";
|
|
13864
14077
|
init_config();
|
|
13865
14078
|
init_confirm();
|
|
13866
14079
|
init_exit_codes();
|
|
13867
14080
|
init_shared();
|
|
13868
|
-
|
|
14081
|
+
command42 = {
|
|
13869
14082
|
resource: "sandbox",
|
|
13870
14083
|
action: "delete",
|
|
13871
14084
|
summary: "Delete your sandbox and its test keys",
|
|
@@ -13892,7 +14105,7 @@ var init_delete = __esm({
|
|
|
13892
14105
|
return ExitCode.Ok;
|
|
13893
14106
|
}
|
|
13894
14107
|
};
|
|
13895
|
-
|
|
14108
|
+
delete_default2 = command42;
|
|
13896
14109
|
}
|
|
13897
14110
|
});
|
|
13898
14111
|
|
|
@@ -13901,14 +14114,14 @@ var key_exports = {};
|
|
|
13901
14114
|
__export(key_exports, {
|
|
13902
14115
|
default: () => key_default
|
|
13903
14116
|
});
|
|
13904
|
-
var
|
|
14117
|
+
var command43, key_default;
|
|
13905
14118
|
var init_key = __esm({
|
|
13906
14119
|
"src/commands/sandbox/key.ts"() {
|
|
13907
14120
|
"use strict";
|
|
13908
14121
|
init_exit_codes();
|
|
13909
14122
|
init_http();
|
|
13910
14123
|
init_shared();
|
|
13911
|
-
|
|
14124
|
+
command43 = {
|
|
13912
14125
|
resource: "sandbox",
|
|
13913
14126
|
action: "key",
|
|
13914
14127
|
summary: "Create a new test key for your sandbox and save it as the sandbox profile",
|
|
@@ -13928,22 +14141,22 @@ var init_key = __esm({
|
|
|
13928
14141
|
return ExitCode.Ok;
|
|
13929
14142
|
}
|
|
13930
14143
|
};
|
|
13931
|
-
key_default =
|
|
14144
|
+
key_default = command43;
|
|
13932
14145
|
}
|
|
13933
14146
|
});
|
|
13934
14147
|
|
|
13935
14148
|
// src/commands/sandbox/list.ts
|
|
13936
|
-
var
|
|
13937
|
-
__export(
|
|
13938
|
-
default: () =>
|
|
14149
|
+
var list_exports3 = {};
|
|
14150
|
+
__export(list_exports3, {
|
|
14151
|
+
default: () => list_default3
|
|
13939
14152
|
});
|
|
13940
|
-
var
|
|
13941
|
-
var
|
|
14153
|
+
var command44, list_default3;
|
|
14154
|
+
var init_list3 = __esm({
|
|
13942
14155
|
"src/commands/sandbox/list.ts"() {
|
|
13943
14156
|
"use strict";
|
|
13944
14157
|
init_exit_codes();
|
|
13945
14158
|
init_shared();
|
|
13946
|
-
|
|
14159
|
+
command44 = {
|
|
13947
14160
|
resource: "sandbox",
|
|
13948
14161
|
action: "list",
|
|
13949
14162
|
summary: "List your developer sandbox",
|
|
@@ -13959,7 +14172,7 @@ var init_list2 = __esm({
|
|
|
13959
14172
|
return ExitCode.Ok;
|
|
13960
14173
|
}
|
|
13961
14174
|
};
|
|
13962
|
-
|
|
14175
|
+
list_default3 = command44;
|
|
13963
14176
|
}
|
|
13964
14177
|
});
|
|
13965
14178
|
|
|
@@ -13968,14 +14181,14 @@ var reset_exports = {};
|
|
|
13968
14181
|
__export(reset_exports, {
|
|
13969
14182
|
default: () => reset_default
|
|
13970
14183
|
});
|
|
13971
|
-
var
|
|
14184
|
+
var command45, reset_default;
|
|
13972
14185
|
var init_reset = __esm({
|
|
13973
14186
|
"src/commands/sandbox/reset.ts"() {
|
|
13974
14187
|
"use strict";
|
|
13975
14188
|
init_exit_codes();
|
|
13976
14189
|
init_http();
|
|
13977
14190
|
init_shared();
|
|
13978
|
-
|
|
14191
|
+
command45 = {
|
|
13979
14192
|
resource: "sandbox",
|
|
13980
14193
|
action: "reset",
|
|
13981
14194
|
summary: "Reset your sandbox to its seed data",
|
|
@@ -13993,38 +14206,38 @@ var init_reset = __esm({
|
|
|
13993
14206
|
return ExitCode.Ok;
|
|
13994
14207
|
}
|
|
13995
14208
|
};
|
|
13996
|
-
reset_default =
|
|
14209
|
+
reset_default = command45;
|
|
13997
14210
|
}
|
|
13998
14211
|
});
|
|
13999
14212
|
|
|
14000
14213
|
// src/commands/sandbox/index.ts
|
|
14001
|
-
var
|
|
14214
|
+
var actions23;
|
|
14002
14215
|
var init_sandbox2 = __esm({
|
|
14003
14216
|
"src/commands/sandbox/index.ts"() {
|
|
14004
14217
|
"use strict";
|
|
14005
|
-
|
|
14218
|
+
actions23 = {
|
|
14006
14219
|
create: () => Promise.resolve().then(() => (init_create(), create_exports)).then((m) => m.default),
|
|
14007
|
-
delete: () => Promise.resolve().then(() => (
|
|
14220
|
+
delete: () => Promise.resolve().then(() => (init_delete2(), delete_exports2)).then((m) => m.default),
|
|
14008
14221
|
key: () => Promise.resolve().then(() => (init_key(), key_exports)).then((m) => m.default),
|
|
14009
|
-
list: () => Promise.resolve().then(() => (
|
|
14222
|
+
list: () => Promise.resolve().then(() => (init_list3(), list_exports3)).then((m) => m.default),
|
|
14010
14223
|
reset: () => Promise.resolve().then(() => (init_reset(), reset_exports)).then((m) => m.default)
|
|
14011
14224
|
};
|
|
14012
14225
|
}
|
|
14013
14226
|
});
|
|
14014
14227
|
|
|
14015
14228
|
// src/commands/skill/index.ts
|
|
14016
|
-
var
|
|
14229
|
+
var actions24;
|
|
14017
14230
|
var init_skill = __esm({
|
|
14018
14231
|
"src/commands/skill/index.ts"() {
|
|
14019
14232
|
"use strict";
|
|
14020
|
-
|
|
14233
|
+
actions24 = {
|
|
14021
14234
|
install: () => Promise.resolve().then(() => (init_install(), install_exports)).then((m) => m.default)
|
|
14022
14235
|
};
|
|
14023
14236
|
}
|
|
14024
14237
|
});
|
|
14025
14238
|
|
|
14026
14239
|
// src/commands/studio/common.ts
|
|
14027
|
-
function
|
|
14240
|
+
function positiveId3(value, field) {
|
|
14028
14241
|
const text4 = (value ?? "").trim();
|
|
14029
14242
|
const id = /^\d+$/.test(text4) ? Number(text4) : Number.NaN;
|
|
14030
14243
|
if (!Number.isSafeInteger(id) || id < 1) throw usageError(`${field} must be a positive whole number (got "${text4}").`, { field });
|
|
@@ -14090,8 +14303,8 @@ async function readFolder(dir) {
|
|
|
14090
14303
|
function safeJoin(root2, bundlePath) {
|
|
14091
14304
|
const segments = bundlePath.split("/");
|
|
14092
14305
|
const bad = bundlePath === "" || isAbsolute(bundlePath) || /^[A-Za-z]:/.test(bundlePath) || bundlePath.includes("\\") || bundlePath.includes("\0") || segments.some((s) => s === "" || s === "." || s === "..");
|
|
14093
|
-
const
|
|
14094
|
-
if (bad || !
|
|
14306
|
+
const target2 = resolve10(root2, ...segments);
|
|
14307
|
+
if (bad || !target2.startsWith(root2.endsWith(sep) ? root2 : root2 + sep)) {
|
|
14095
14308
|
throw new KensoError({
|
|
14096
14309
|
code: "unsafe_path",
|
|
14097
14310
|
message: `Refusing to write "${bundlePath}": it is not a plain relative path inside ${root2}.`,
|
|
@@ -14099,7 +14312,7 @@ function safeJoin(root2, bundlePath) {
|
|
|
14099
14312
|
hint: "The template holds a file path the CLI will not write. Nothing was written."
|
|
14100
14313
|
});
|
|
14101
14314
|
}
|
|
14102
|
-
return
|
|
14315
|
+
return target2;
|
|
14103
14316
|
}
|
|
14104
14317
|
function contentTypeOf(path) {
|
|
14105
14318
|
return CONTENT_TYPES2[extname5(path).toLowerCase()] ?? "application/octet-stream";
|
|
@@ -14192,13 +14405,13 @@ async function upload(ctx, templateId, file) {
|
|
|
14192
14405
|
body: { path: file.path, contentType: contentTypeOf(file.path), bytes: file.bytes.length },
|
|
14193
14406
|
signal: ctx.signal
|
|
14194
14407
|
});
|
|
14195
|
-
const
|
|
14196
|
-
if (!
|
|
14408
|
+
const target2 = unwrap(res.body);
|
|
14409
|
+
if (!target2?.uploadId || !target2.url) {
|
|
14197
14410
|
throw new KensoError({ code: "upload_failed", message: `No upload URL came back for ${file.path}.`, exitCode: ExitCode.Server });
|
|
14198
14411
|
}
|
|
14199
|
-
const method = typeof
|
|
14200
|
-
await presigned(
|
|
14201
|
-
return
|
|
14412
|
+
const method = typeof target2.method === "string" && target2.method.trim() !== "" ? target2.method.toUpperCase() : "PUT";
|
|
14413
|
+
await presigned(target2.url, { method, headers: target2.headers ?? {}, body: new Uint8Array(file.bytes) }, `Uploading ${file.path}`, "upload_failed", ctx.signal);
|
|
14414
|
+
return target2.uploadId;
|
|
14202
14415
|
}
|
|
14203
14416
|
function refuseOversize(files) {
|
|
14204
14417
|
const tooBig = files.filter((f) => f.text === void 0 && f.bytes.length > UPLOAD_MAX_BYTES);
|
|
@@ -14253,7 +14466,7 @@ __export(pull_exports, {
|
|
|
14253
14466
|
});
|
|
14254
14467
|
import { mkdir, writeFile as writeFile4 } from "node:fs/promises";
|
|
14255
14468
|
import { dirname as dirname2, resolve as resolve11 } from "node:path";
|
|
14256
|
-
var
|
|
14469
|
+
var command46, pull_default;
|
|
14257
14470
|
var init_pull = __esm({
|
|
14258
14471
|
"src/commands/studio/pull.ts"() {
|
|
14259
14472
|
"use strict";
|
|
@@ -14263,7 +14476,7 @@ var init_pull = __esm({
|
|
|
14263
14476
|
init_common2();
|
|
14264
14477
|
init_folder();
|
|
14265
14478
|
init_transfer2();
|
|
14266
|
-
|
|
14479
|
+
command46 = {
|
|
14267
14480
|
resource: "studio",
|
|
14268
14481
|
action: "pull",
|
|
14269
14482
|
summary: "Write a template version's files to a folder",
|
|
@@ -14278,7 +14491,7 @@ var init_pull = __esm({
|
|
|
14278
14491
|
operationIds: ["asset-templates.pull"],
|
|
14279
14492
|
dryRun: true,
|
|
14280
14493
|
async run(ctx, { flags, positionals }) {
|
|
14281
|
-
const templateId =
|
|
14494
|
+
const templateId = positiveId3(positionals[0], "templateId");
|
|
14282
14495
|
const version = typeof flags["template-version"] === "string" ? flags["template-version"].trim() : void 0;
|
|
14283
14496
|
if (version !== void 0 && !/^(draft|latest|\d+)$/.test(version)) {
|
|
14284
14497
|
throw usageError(`--template-version must be draft, latest or a version id (got "${version}").`, { field: "template-version" });
|
|
@@ -14301,16 +14514,16 @@ var init_pull = __esm({
|
|
|
14301
14514
|
return ExitCode.Ok;
|
|
14302
14515
|
}
|
|
14303
14516
|
await mkdir(dir, { recursive: true });
|
|
14304
|
-
await mapLimit(files, PARALLEL_TRANSFERS, async ({ path, file, target }) => {
|
|
14517
|
+
await mapLimit(files, PARALLEL_TRANSFERS, async ({ path, file, target: target2 }) => {
|
|
14305
14518
|
const content = typeof file.text === "string" ? file.text : await download2(file.downloadUrl, path, file.sha256, ctx.signal);
|
|
14306
|
-
await mkdir(dirname2(
|
|
14307
|
-
await writeFile4(
|
|
14519
|
+
await mkdir(dirname2(target2), { recursive: true });
|
|
14520
|
+
await writeFile4(target2, content);
|
|
14308
14521
|
});
|
|
14309
14522
|
ctx.output.object({ templateId, versionId: pulled.versionId, files: files.length, dir });
|
|
14310
14523
|
return ExitCode.Ok;
|
|
14311
14524
|
}
|
|
14312
14525
|
};
|
|
14313
|
-
pull_default =
|
|
14526
|
+
pull_default = command46;
|
|
14314
14527
|
}
|
|
14315
14528
|
});
|
|
14316
14529
|
|
|
@@ -14343,7 +14556,7 @@ var push_exports = {};
|
|
|
14343
14556
|
__export(push_exports, {
|
|
14344
14557
|
default: () => push_default
|
|
14345
14558
|
});
|
|
14346
|
-
var BUILT_BY, DEFAULT_MESSAGE,
|
|
14559
|
+
var BUILT_BY, DEFAULT_MESSAGE, command47, push_default;
|
|
14347
14560
|
var init_push = __esm({
|
|
14348
14561
|
"src/commands/studio/push.ts"() {
|
|
14349
14562
|
"use strict";
|
|
@@ -14355,7 +14568,7 @@ var init_push = __esm({
|
|
|
14355
14568
|
init_read();
|
|
14356
14569
|
BUILT_BY = "customer_agent";
|
|
14357
14570
|
DEFAULT_MESSAGE = "Pushed with the Kenso CLI";
|
|
14358
|
-
|
|
14571
|
+
command47 = {
|
|
14359
14572
|
resource: "studio",
|
|
14360
14573
|
action: "push",
|
|
14361
14574
|
summary: "Save a folder's files to a template's draft and print the validation",
|
|
@@ -14373,7 +14586,7 @@ var init_push = __esm({
|
|
|
14373
14586
|
dryRun: true,
|
|
14374
14587
|
async run(ctx, args) {
|
|
14375
14588
|
const { flags, positionals } = args;
|
|
14376
|
-
const templateId =
|
|
14589
|
+
const templateId = positiveId3(positionals[0], "templateId");
|
|
14377
14590
|
const message = typeof flags.message === "string" && flags.message.trim() !== "" ? flags.message : DEFAULT_MESSAGE;
|
|
14378
14591
|
if (ctx.flags.dryRun) {
|
|
14379
14592
|
const local = await readLocalTemplate(templateId, String(flags.dir));
|
|
@@ -14447,7 +14660,7 @@ var init_push = __esm({
|
|
|
14447
14660
|
);
|
|
14448
14661
|
}
|
|
14449
14662
|
};
|
|
14450
|
-
push_default =
|
|
14663
|
+
push_default = command47;
|
|
14451
14664
|
}
|
|
14452
14665
|
});
|
|
14453
14666
|
|
|
@@ -14456,7 +14669,7 @@ var validate_exports = {};
|
|
|
14456
14669
|
__export(validate_exports, {
|
|
14457
14670
|
default: () => validate_default
|
|
14458
14671
|
});
|
|
14459
|
-
var
|
|
14672
|
+
var command48, validate_default;
|
|
14460
14673
|
var init_validate = __esm({
|
|
14461
14674
|
"src/commands/studio/validate.ts"() {
|
|
14462
14675
|
"use strict";
|
|
@@ -14465,7 +14678,7 @@ var init_validate = __esm({
|
|
|
14465
14678
|
init_columns();
|
|
14466
14679
|
init_common2();
|
|
14467
14680
|
init_read();
|
|
14468
|
-
|
|
14681
|
+
command48 = {
|
|
14469
14682
|
resource: "studio",
|
|
14470
14683
|
action: "validate",
|
|
14471
14684
|
summary: "Validate a folder's files against a template without saving them",
|
|
@@ -14480,7 +14693,7 @@ var init_validate = __esm({
|
|
|
14480
14693
|
operationIds: ["asset-templates.create-upload-url", "asset-templates.validate"],
|
|
14481
14694
|
async run(ctx, args) {
|
|
14482
14695
|
const { flags, positionals } = args;
|
|
14483
|
-
const templateId =
|
|
14696
|
+
const templateId = positiveId3(positionals[0], "templateId");
|
|
14484
14697
|
const files = await readTemplateFolder(ctx, templateId, String(flags.dir));
|
|
14485
14698
|
const res = await ctx.client.request({
|
|
14486
14699
|
method: "POST",
|
|
@@ -14494,7 +14707,7 @@ var init_validate = __esm({
|
|
|
14494
14707
|
throw validationFailed(validation, "The files have validation errors", commandLine2(ctx, "studio validate", args));
|
|
14495
14708
|
}
|
|
14496
14709
|
};
|
|
14497
|
-
validate_default =
|
|
14710
|
+
validate_default = command48;
|
|
14498
14711
|
}
|
|
14499
14712
|
});
|
|
14500
14713
|
|
|
@@ -14543,7 +14756,7 @@ function accountIds(value) {
|
|
|
14543
14756
|
}
|
|
14544
14757
|
return ids2.map(Number);
|
|
14545
14758
|
}
|
|
14546
|
-
var SHOWN,
|
|
14759
|
+
var SHOWN, command49, preview_default;
|
|
14547
14760
|
var init_preview = __esm({
|
|
14548
14761
|
"src/commands/studio/preview.ts"() {
|
|
14549
14762
|
"use strict";
|
|
@@ -14555,7 +14768,7 @@ var init_preview = __esm({
|
|
|
14555
14768
|
init_common2();
|
|
14556
14769
|
init_folder();
|
|
14557
14770
|
SHOWN = 5;
|
|
14558
|
-
|
|
14771
|
+
command49 = {
|
|
14559
14772
|
resource: "studio",
|
|
14560
14773
|
action: "preview",
|
|
14561
14774
|
summary: "Render a saved version for up to 3 accounts; for local edits, studio push them to the draft first",
|
|
@@ -14575,9 +14788,9 @@ var init_preview = __esm({
|
|
|
14575
14788
|
operationIds: ["asset-templates.preview", "asset-templates.pull"],
|
|
14576
14789
|
async run(ctx, args) {
|
|
14577
14790
|
const { flags, positionals } = args;
|
|
14578
|
-
const templateId =
|
|
14791
|
+
const templateId = positiveId3(positionals[0], "templateId");
|
|
14579
14792
|
const versionText = stringFlag(flags["version-id"]);
|
|
14580
|
-
const versionId = versionText !== void 0 ?
|
|
14793
|
+
const versionId = versionText !== void 0 ? positiveId3(versionText, "version-id") : void 0;
|
|
14581
14794
|
const ids2 = accountIds(stringFlag(flags["account-ids"]));
|
|
14582
14795
|
const interact = flags.interact !== void 0 ? await readDataArg(String(flags.interact), ctx.stdin) : void 0;
|
|
14583
14796
|
if (interact !== void 0 && !Array.isArray(interact)) throw usageError("--interact must be a JSON array of steps.", { field: "interact" });
|
|
@@ -14604,7 +14817,7 @@ var init_preview = __esm({
|
|
|
14604
14817
|
return ExitCode.Ok;
|
|
14605
14818
|
}
|
|
14606
14819
|
};
|
|
14607
|
-
preview_default =
|
|
14820
|
+
preview_default = command49;
|
|
14608
14821
|
}
|
|
14609
14822
|
});
|
|
14610
14823
|
|
|
@@ -14745,35 +14958,35 @@ async function readTarget(ctx, flags) {
|
|
|
14745
14958
|
flag,
|
|
14746
14959
|
items: [...firstRow].map(([id, row]) => ({ id, row })),
|
|
14747
14960
|
duplicates: raw.length - firstRow.size,
|
|
14748
|
-
...campaign !== void 0 ? { campaignId:
|
|
14961
|
+
...campaign !== void 0 ? { campaignId: positiveId3(campaign, "campaign") } : {},
|
|
14749
14962
|
input: source === "-" ? { path: "-", sha256: sha2562(raw.join("\n")) } : { path: resolve12(source), sha256: sha2562(await readFile11(resolve12(source))) }
|
|
14750
14963
|
};
|
|
14751
14964
|
}
|
|
14752
|
-
async function refuseRefill(ctx, args,
|
|
14965
|
+
async function refuseRefill(ctx, args, target2) {
|
|
14753
14966
|
const workspaceId = ctx.client.workspaceId ?? ctx.auth.workspaceId;
|
|
14754
14967
|
const sameFill = (a) => argsIdentity({ ...a, wait: void 0 });
|
|
14755
14968
|
const earlier = (await listRuns(ctx.env)).find(
|
|
14756
|
-
(run) => run.command === COMMAND6 && run.status !== "planned" && run.inputSha256 ===
|
|
14969
|
+
(run) => run.command === COMMAND6 && run.status !== "planned" && run.inputSha256 === target2.input.sha256 && (run.workspaceId || void 0) === (workspaceId || void 0) && sameFill(run.args) === sameFill(args)
|
|
14757
14970
|
);
|
|
14758
14971
|
if (!earlier) return;
|
|
14759
14972
|
const unfinished = earlier.status !== "done";
|
|
14760
|
-
const succeeded = !unfinished && await allSucceeded(earlier,
|
|
14973
|
+
const succeeded = !unfinished && await allSucceeded(earlier, target2.items.length);
|
|
14761
14974
|
if (argsIdentity(earlier.args) === argsIdentity(args) && (unfinished || succeeded)) return;
|
|
14762
|
-
const ids2 =
|
|
14975
|
+
const ids2 = target2.flag === "accounts" ? "accounts" : "leads";
|
|
14763
14976
|
throw new KensoError({
|
|
14764
14977
|
code: "already_filled",
|
|
14765
14978
|
exitCode: ExitCode.Conflict,
|
|
14766
14979
|
message: unfinished ? `Run ${earlier.runId} is already filling these ${ids2} (${earlier.status}).` : `Run ${earlier.runId} already filled these ${ids2}.`,
|
|
14767
|
-
hint: unfinished ? "Continue that run instead: a new fill would create every fill run again." : succeeded ? "Every page was filled. Filling again rebuilds and charges every page that is not building or live; to do that anyway, use kenso asset-runs create." : `Filling again rebuilds and charges every page that is not building or live. To retry only the failed ones, put the ${
|
|
14980
|
+
hint: unfinished ? "Continue that run instead: a new fill would create every fill run again." : succeeded ? "Every page was filled. Filling again rebuilds and charges every page that is not building or live; to do that anyway, use kenso asset-runs create." : `Filling again rebuilds and charges every page that is not building or live. To retry only the failed ones, put the ${target2.key} values of the failed rows in ${join14(earlier.dir, "results.csv")} in a file and fill that file.`,
|
|
14768
14981
|
next: unfinished ? `kenso runs resume ${earlier.runId}` : `kenso runs show ${earlier.runId}`
|
|
14769
14982
|
});
|
|
14770
14983
|
}
|
|
14771
|
-
async function fillChunk(ctx, templateId,
|
|
14984
|
+
async function fillChunk(ctx, templateId, target2, wait3, chunk, chunkCtx) {
|
|
14772
14985
|
const ids2 = chunk.map((item) => item.id);
|
|
14773
|
-
const body2 =
|
|
14986
|
+
const body2 = target2.campaignId !== void 0 ? { templateId, campaignId: target2.campaignId, contactIds: ids2 } : { templateId, accountIds: ids2 };
|
|
14774
14987
|
const res = await chunkCtx.client.request({ method: "POST", path: "/v1/asset-runs", body: body2, signal: chunkCtx.signal });
|
|
14775
14988
|
let run = unwrap(res.body) ?? {};
|
|
14776
|
-
ctx.output.info(`Run ${run.id} started for ${ids2.length} ${
|
|
14989
|
+
ctx.output.info(`Run ${run.id} started for ${ids2.length} ${target2.flag} (${run.state ?? "queued"}).`);
|
|
14777
14990
|
if (wait3 && run.id !== void 0) {
|
|
14778
14991
|
const created = run;
|
|
14779
14992
|
try {
|
|
@@ -14792,20 +15005,20 @@ async function fillChunk(ctx, templateId, target, wait3, chunk, chunkCtx) {
|
|
|
14792
15005
|
}
|
|
14793
15006
|
}
|
|
14794
15007
|
}
|
|
14795
|
-
return { results: runResults(chunk, run,
|
|
15008
|
+
return { results: runResults(chunk, run, target2.key) };
|
|
14796
15009
|
}
|
|
14797
|
-
function estimateOutput(templateId,
|
|
15010
|
+
function estimateOutput(templateId, target2, estimate2) {
|
|
14798
15011
|
return {
|
|
14799
15012
|
templateId,
|
|
14800
|
-
...
|
|
14801
|
-
[
|
|
14802
|
-
...
|
|
14803
|
-
runs: Math.ceil(
|
|
15013
|
+
...target2.campaignId !== void 0 ? { campaignId: target2.campaignId } : {},
|
|
15014
|
+
[target2.flag]: target2.items.length,
|
|
15015
|
+
...target2.duplicates > 0 ? { duplicates: target2.duplicates } : {},
|
|
15016
|
+
runs: Math.ceil(target2.items.length / RUN_SIZE),
|
|
14804
15017
|
estimate: estimate2,
|
|
14805
|
-
...
|
|
15018
|
+
...target2.campaignId !== void 0 ? { estimateNote: "An upper bound: it counts one page per lead, and a campaign run builds one page per company." } : {}
|
|
14806
15019
|
};
|
|
14807
15020
|
}
|
|
14808
|
-
var COMMAND6, sha2562,
|
|
15021
|
+
var COMMAND6, sha2562, command50, fill_default;
|
|
14809
15022
|
var init_fill = __esm({
|
|
14810
15023
|
"src/commands/studio/fill.ts"() {
|
|
14811
15024
|
"use strict";
|
|
@@ -14821,7 +15034,7 @@ var init_fill = __esm({
|
|
|
14821
15034
|
init_fill_runs();
|
|
14822
15035
|
COMMAND6 = "studio fill";
|
|
14823
15036
|
sha2562 = (data) => createHash8("sha256").update(data).digest("hex");
|
|
14824
|
-
|
|
15037
|
+
command50 = {
|
|
14825
15038
|
resource: "studio",
|
|
14826
15039
|
action: "fill",
|
|
14827
15040
|
summary: "Fill a template on many accounts or campaign leads (estimate first)",
|
|
@@ -14846,15 +15059,15 @@ var init_fill = __esm({
|
|
|
14846
15059
|
dryRun: true,
|
|
14847
15060
|
async run(ctx, args) {
|
|
14848
15061
|
const { flags, positionals } = args;
|
|
14849
|
-
const templateId =
|
|
15062
|
+
const templateId = positiveId3(positionals[0], "templateId");
|
|
14850
15063
|
if (flags.estimate === true && ctx.flags.yes === true) throw usageError("Pick one of --estimate and --yes.", { field: "estimate" });
|
|
14851
|
-
const
|
|
15064
|
+
const target2 = await readTarget(ctx, flags);
|
|
14852
15065
|
const batchArgs = { ...flags, positionals };
|
|
14853
|
-
if (ctx.flags.yes === true) await refuseRefill(ctx, batchArgs,
|
|
14854
|
-
const estimate2 = await estimateFill(ctx, templateId,
|
|
15066
|
+
if (ctx.flags.yes === true) await refuseRefill(ctx, batchArgs, target2);
|
|
15067
|
+
const estimate2 = await estimateFill(ctx, templateId, target2.items.length);
|
|
14855
15068
|
if (ctx.flags.yes !== true) {
|
|
14856
15069
|
const next = commandLine2(ctx, COMMAND6, { flags: { ...flags, estimate: void 0 }, positionals }, ["--yes"]);
|
|
14857
|
-
ctx.output.object({ ...estimateOutput(templateId,
|
|
15070
|
+
ctx.output.object({ ...estimateOutput(templateId, target2, estimate2), next });
|
|
14858
15071
|
return ExitCode.Ok;
|
|
14859
15072
|
}
|
|
14860
15073
|
const wait3 = flags.wait === true;
|
|
@@ -14862,16 +15075,16 @@ var init_fill = __esm({
|
|
|
14862
15075
|
{
|
|
14863
15076
|
command: COMMAND6,
|
|
14864
15077
|
args: batchArgs,
|
|
14865
|
-
input:
|
|
14866
|
-
items:
|
|
15078
|
+
input: target2.input,
|
|
15079
|
+
items: target2.items,
|
|
14867
15080
|
rowOf: (item) => item.row,
|
|
14868
15081
|
chunkSize: RUN_SIZE,
|
|
14869
15082
|
concurrency: 1,
|
|
14870
|
-
execChunk: (chunk, chunkCtx) => fillChunk(ctx, templateId,
|
|
15083
|
+
execChunk: (chunk, chunkCtx) => fillChunk(ctx, templateId, target2, wait3, chunk, chunkCtx),
|
|
14871
15084
|
summarize: (results) => ({
|
|
14872
15085
|
templateId,
|
|
14873
|
-
...
|
|
14874
|
-
...
|
|
15086
|
+
...target2.campaignId !== void 0 ? { campaignId: target2.campaignId } : {},
|
|
15087
|
+
...target2.duplicates > 0 ? { duplicates: target2.duplicates } : {},
|
|
14875
15088
|
estimatedMillicredits: estimate2.millicredits,
|
|
14876
15089
|
runs: runsOf(results)
|
|
14877
15090
|
})
|
|
@@ -14881,16 +15094,16 @@ var init_fill = __esm({
|
|
|
14881
15094
|
return outcome.exitCode;
|
|
14882
15095
|
}
|
|
14883
15096
|
};
|
|
14884
|
-
fill_default =
|
|
15097
|
+
fill_default = command50;
|
|
14885
15098
|
}
|
|
14886
15099
|
});
|
|
14887
15100
|
|
|
14888
15101
|
// src/commands/studio/index.ts
|
|
14889
|
-
var
|
|
15102
|
+
var actions25;
|
|
14890
15103
|
var init_studio2 = __esm({
|
|
14891
15104
|
"src/commands/studio/index.ts"() {
|
|
14892
15105
|
"use strict";
|
|
14893
|
-
|
|
15106
|
+
actions25 = {
|
|
14894
15107
|
pull: () => Promise.resolve().then(() => (init_pull(), pull_exports)).then((m) => m.default),
|
|
14895
15108
|
push: () => Promise.resolve().then(() => (init_push(), push_exports)).then((m) => m.default),
|
|
14896
15109
|
validate: () => Promise.resolve().then(() => (init_validate(), validate_exports)).then((m) => m.default),
|
|
@@ -14901,7 +15114,7 @@ var init_studio2 = __esm({
|
|
|
14901
15114
|
});
|
|
14902
15115
|
|
|
14903
15116
|
// src/commands/tasks/shared.ts
|
|
14904
|
-
function
|
|
15117
|
+
function positiveId4(text4, field, next) {
|
|
14905
15118
|
const value = (text4 ?? "").trim();
|
|
14906
15119
|
const id = /^\d+$/.test(value) ? Number(value) : Number.NaN;
|
|
14907
15120
|
if (!Number.isSafeInteger(id) || id < 1) throw usageError(`${field} must be a positive whole number (got "${value}").`, { field, next });
|
|
@@ -14961,7 +15174,7 @@ async function memberId(ctx, text4, field, next) {
|
|
|
14961
15174
|
next: "kenso members list"
|
|
14962
15175
|
});
|
|
14963
15176
|
}
|
|
14964
|
-
return
|
|
15177
|
+
return positiveId4(value, field, next);
|
|
14965
15178
|
}
|
|
14966
15179
|
var WEEKDAYS, DUE_NEXT, startOfDay, addDays, ymd;
|
|
14967
15180
|
var init_shared2 = __esm({
|
|
@@ -14979,12 +15192,12 @@ var init_shared2 = __esm({
|
|
|
14979
15192
|
});
|
|
14980
15193
|
|
|
14981
15194
|
// src/commands/tasks/add.ts
|
|
14982
|
-
var
|
|
14983
|
-
__export(
|
|
14984
|
-
default: () =>
|
|
15195
|
+
var add_exports2 = {};
|
|
15196
|
+
__export(add_exports2, {
|
|
15197
|
+
default: () => add_default2
|
|
14985
15198
|
});
|
|
14986
|
-
var NEXT,
|
|
14987
|
-
var
|
|
15199
|
+
var NEXT, command51, add_default2;
|
|
15200
|
+
var init_add2 = __esm({
|
|
14988
15201
|
"src/commands/tasks/add.ts"() {
|
|
14989
15202
|
"use strict";
|
|
14990
15203
|
init_errors();
|
|
@@ -14992,7 +15205,7 @@ var init_add = __esm({
|
|
|
14992
15205
|
init_http();
|
|
14993
15206
|
init_shared2();
|
|
14994
15207
|
NEXT = 'kenso tasks add "Send the deck" --due tomorrow --account 812';
|
|
14995
|
-
|
|
15208
|
+
command51 = {
|
|
14996
15209
|
resource: "tasks",
|
|
14997
15210
|
action: "add",
|
|
14998
15211
|
summary: "Add a task: a title, an optional due day and time, assignee and the account, person or deal it is about",
|
|
@@ -15019,15 +15232,15 @@ var init_add = __esm({
|
|
|
15019
15232
|
if (typeof flags.notes === "string") body2.notes = flags.notes;
|
|
15020
15233
|
Object.assign(body2, due(typeof flags.due === "string" ? flags.due : void 0, typeof flags.at === "string" ? flags.at : void 0));
|
|
15021
15234
|
if (typeof flags.assignee === "string") body2.assigneeMemberId = await memberId(ctx, flags.assignee, "assignee", NEXT);
|
|
15022
|
-
if (typeof flags.account === "string") body2.accountId =
|
|
15023
|
-
if (typeof flags.person === "string") body2.personId =
|
|
15024
|
-
if (typeof flags.deal === "string") body2.opportunityId =
|
|
15235
|
+
if (typeof flags.account === "string") body2.accountId = positiveId4(flags.account, "account", NEXT);
|
|
15236
|
+
if (typeof flags.person === "string") body2.personId = positiveId4(flags.person, "person", NEXT);
|
|
15237
|
+
if (typeof flags.deal === "string") body2.opportunityId = positiveId4(flags.deal, "deal", NEXT);
|
|
15025
15238
|
const res = await ctx.client.request({ method: "POST", path: "/v1/tasks", body: body2, signal: ctx.signal });
|
|
15026
15239
|
ctx.output.object(unwrap(res.body));
|
|
15027
15240
|
return ExitCode.Ok;
|
|
15028
15241
|
}
|
|
15029
15242
|
};
|
|
15030
|
-
|
|
15243
|
+
add_default2 = command51;
|
|
15031
15244
|
}
|
|
15032
15245
|
});
|
|
15033
15246
|
|
|
@@ -15046,7 +15259,7 @@ async function patchTask(ctx, taskId, change) {
|
|
|
15046
15259
|
return unwrap((await send2()).body);
|
|
15047
15260
|
}
|
|
15048
15261
|
}
|
|
15049
|
-
var
|
|
15262
|
+
var command52, done_default;
|
|
15050
15263
|
var init_done = __esm({
|
|
15051
15264
|
"src/commands/tasks/done.ts"() {
|
|
15052
15265
|
"use strict";
|
|
@@ -15054,7 +15267,7 @@ var init_done = __esm({
|
|
|
15054
15267
|
init_exit_codes();
|
|
15055
15268
|
init_http();
|
|
15056
15269
|
init_shared2();
|
|
15057
|
-
|
|
15270
|
+
command52 = {
|
|
15058
15271
|
resource: "tasks",
|
|
15059
15272
|
action: "done",
|
|
15060
15273
|
summary: "Complete one or more tasks (--undo reopens them)",
|
|
@@ -15065,7 +15278,7 @@ var init_done = __esm({
|
|
|
15065
15278
|
beta: { featureGates: { all: ["tasks"] } },
|
|
15066
15279
|
operationIds: ["tasks.update"],
|
|
15067
15280
|
async run(ctx, { flags, positionals }) {
|
|
15068
|
-
const ids2 = [...new Set(positionals.map((text4) =>
|
|
15281
|
+
const ids2 = [...new Set(positionals.map((text4) => positiveId4(text4, "taskId", "kenso tasks done <taskId>...")))];
|
|
15069
15282
|
const change = { status: flags.undo === true ? "open" : "done" };
|
|
15070
15283
|
if (ids2.length === 1) ctx.output.object(await patchTask(ctx, ids2[0], change));
|
|
15071
15284
|
else
|
|
@@ -15077,7 +15290,7 @@ var init_done = __esm({
|
|
|
15077
15290
|
return ExitCode.Ok;
|
|
15078
15291
|
}
|
|
15079
15292
|
};
|
|
15080
|
-
done_default =
|
|
15293
|
+
done_default = command52;
|
|
15081
15294
|
}
|
|
15082
15295
|
});
|
|
15083
15296
|
|
|
@@ -15086,7 +15299,7 @@ var assign_exports = {};
|
|
|
15086
15299
|
__export(assign_exports, {
|
|
15087
15300
|
default: () => assign_default
|
|
15088
15301
|
});
|
|
15089
|
-
var NEXT2,
|
|
15302
|
+
var NEXT2, command53, assign_default;
|
|
15090
15303
|
var init_assign = __esm({
|
|
15091
15304
|
"src/commands/tasks/assign.ts"() {
|
|
15092
15305
|
"use strict";
|
|
@@ -15094,7 +15307,7 @@ var init_assign = __esm({
|
|
|
15094
15307
|
init_done();
|
|
15095
15308
|
init_shared2();
|
|
15096
15309
|
NEXT2 = "kenso tasks assign <taskId> <me|memberId|email>";
|
|
15097
|
-
|
|
15310
|
+
command53 = {
|
|
15098
15311
|
resource: "tasks",
|
|
15099
15312
|
action: "assign",
|
|
15100
15313
|
summary: "Give a task to a member",
|
|
@@ -15108,13 +15321,13 @@ var init_assign = __esm({
|
|
|
15108
15321
|
beta: { featureGates: { all: ["tasks"] } },
|
|
15109
15322
|
operationIds: ["tasks.update", "me.get", "members.list"],
|
|
15110
15323
|
async run(ctx, { positionals }) {
|
|
15111
|
-
const taskId =
|
|
15324
|
+
const taskId = positiveId4(positionals[0], "taskId", NEXT2);
|
|
15112
15325
|
const assignee = await memberId(ctx, positionals[1] ?? "", "member", NEXT2);
|
|
15113
15326
|
ctx.output.object(await patchTask(ctx, taskId, { assigneeMemberId: assignee }));
|
|
15114
15327
|
return ExitCode.Ok;
|
|
15115
15328
|
}
|
|
15116
15329
|
};
|
|
15117
|
-
assign_default =
|
|
15330
|
+
assign_default = command53;
|
|
15118
15331
|
}
|
|
15119
15332
|
});
|
|
15120
15333
|
|
|
@@ -15123,14 +15336,14 @@ var queue_exports = {};
|
|
|
15123
15336
|
__export(queue_exports, {
|
|
15124
15337
|
default: () => queue_default
|
|
15125
15338
|
});
|
|
15126
|
-
var SCOPES,
|
|
15339
|
+
var SCOPES, command54, queue_default;
|
|
15127
15340
|
var init_queue = __esm({
|
|
15128
15341
|
"src/commands/tasks/queue.ts"() {
|
|
15129
15342
|
"use strict";
|
|
15130
15343
|
init_errors();
|
|
15131
15344
|
init_exit_codes();
|
|
15132
15345
|
SCOPES = ["mine", "assigned_by_me", "everyone"];
|
|
15133
|
-
|
|
15346
|
+
command54 = {
|
|
15134
15347
|
resource: "tasks",
|
|
15135
15348
|
action: "queue",
|
|
15136
15349
|
summary: "Your open work by due day: tasks, touches, call tasks, reply reminders and Ken follow-ups",
|
|
@@ -15151,17 +15364,17 @@ var init_queue = __esm({
|
|
|
15151
15364
|
return ExitCode.Ok;
|
|
15152
15365
|
}
|
|
15153
15366
|
};
|
|
15154
|
-
queue_default =
|
|
15367
|
+
queue_default = command54;
|
|
15155
15368
|
}
|
|
15156
15369
|
});
|
|
15157
15370
|
|
|
15158
15371
|
// src/commands/tasks/index.ts
|
|
15159
|
-
var
|
|
15372
|
+
var actions26;
|
|
15160
15373
|
var init_tasks = __esm({
|
|
15161
15374
|
"src/commands/tasks/index.ts"() {
|
|
15162
15375
|
"use strict";
|
|
15163
|
-
|
|
15164
|
-
add: () => Promise.resolve().then(() => (
|
|
15376
|
+
actions26 = {
|
|
15377
|
+
add: () => Promise.resolve().then(() => (init_add2(), add_exports2)).then((m) => m.default),
|
|
15165
15378
|
done: () => Promise.resolve().then(() => (init_done(), done_exports)).then((m) => m.default),
|
|
15166
15379
|
assign: () => Promise.resolve().then(() => (init_assign(), assign_exports)).then((m) => m.default),
|
|
15167
15380
|
queue: () => Promise.resolve().then(() => (init_queue(), queue_exports)).then((m) => m.default)
|
|
@@ -15301,7 +15514,7 @@ function readBody(req) {
|
|
|
15301
15514
|
function reply(res, status, body2) {
|
|
15302
15515
|
res.writeHead(status, { "content-type": "application/json" }).end(JSON.stringify(body2));
|
|
15303
15516
|
}
|
|
15304
|
-
var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES,
|
|
15517
|
+
var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command55, listen_default;
|
|
15305
15518
|
var init_listen = __esm({
|
|
15306
15519
|
"src/commands/webhooks/listen.ts"() {
|
|
15307
15520
|
"use strict";
|
|
@@ -15312,7 +15525,7 @@ var init_listen = __esm({
|
|
|
15312
15525
|
MIN_POLL_MS = 1e3;
|
|
15313
15526
|
MAX_POLL_MS = 6e4;
|
|
15314
15527
|
MAX_TRIGGER_BYTES = 1e6;
|
|
15315
|
-
|
|
15528
|
+
command55 = {
|
|
15316
15529
|
resource: "webhooks",
|
|
15317
15530
|
action: "listen",
|
|
15318
15531
|
summary: "Stream the workspace's events and forward them, signed, to a local handler",
|
|
@@ -15338,17 +15551,17 @@ var init_listen = __esm({
|
|
|
15338
15551
|
`);
|
|
15339
15552
|
return ExitCode.Ok;
|
|
15340
15553
|
}
|
|
15341
|
-
const
|
|
15554
|
+
const target2 = typeof flags["forward-to"] === "string" ? forwardUrl(flags["forward-to"]) : void 0;
|
|
15342
15555
|
const types = eventTypes(flags.events);
|
|
15343
15556
|
const workspaceId = ctx.auth.workspaceId;
|
|
15344
15557
|
if (ctx.flags.dryRun) {
|
|
15345
|
-
const next = ["kenso webhooks listen",
|
|
15346
|
-
ctx.output.object({ dryRun: true, forwardTo:
|
|
15558
|
+
const next = ["kenso webhooks listen", target2 ? `--forward-to ${target2}` : "", types.length > 0 ? `--events ${types.join(",")}` : ""];
|
|
15559
|
+
ctx.output.object({ dryRun: true, forwardTo: target2 ?? null, events: types.length > 0 ? types : "all", secretFile: signingSecretPath(ctx.env), next: next.filter((p) => p).join(" ") });
|
|
15347
15560
|
return ExitCode.Ok;
|
|
15348
15561
|
}
|
|
15349
15562
|
const counts2 = { events: 0, forwarded: 0, failed: 0 };
|
|
15350
15563
|
const deliver = async (event) => {
|
|
15351
|
-
const result =
|
|
15564
|
+
const result = target2 ? await forward(target2, event, secret, ctx.signal) : void 0;
|
|
15352
15565
|
counts2.events++;
|
|
15353
15566
|
if (result?.status !== void 0 && result.status < 300) counts2.forwarded++;
|
|
15354
15567
|
else if (result) counts2.failed++;
|
|
@@ -15384,9 +15597,9 @@ var init_listen = __esm({
|
|
|
15384
15597
|
});
|
|
15385
15598
|
await new Promise((resolve16) => server.listen(0, "127.0.0.1", resolve16));
|
|
15386
15599
|
const url = `http://127.0.0.1:${server.address().port}/events`;
|
|
15387
|
-
writeListenerState(ctx.env, workspaceId, { pid: process.pid, url, token, forwardTo:
|
|
15600
|
+
writeListenerState(ctx.env, workspaceId, { pid: process.pid, url, token, forwardTo: target2, startedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
15388
15601
|
try {
|
|
15389
|
-
ctx.output.info(`Ready. ${
|
|
15602
|
+
ctx.output.info(`Ready. ${target2 ? `Forwarding events to ${target2}.` : "Printing events (add --forward-to to send them to your handler)."}`);
|
|
15390
15603
|
ctx.output.info(`Signing secret: ${secret} (the same on every run; kept in ${signingSecretPath(ctx.env)}).`);
|
|
15391
15604
|
ctx.output.info(`Send a sample: kenso webhooks trigger reply.received. Stop with Ctrl-C.`);
|
|
15392
15605
|
while (!ctx.signal.aborted) {
|
|
@@ -15418,7 +15631,7 @@ var init_listen = __esm({
|
|
|
15418
15631
|
return ExitCode.Ok;
|
|
15419
15632
|
}
|
|
15420
15633
|
};
|
|
15421
|
-
listen_default =
|
|
15634
|
+
listen_default = command55;
|
|
15422
15635
|
}
|
|
15423
15636
|
});
|
|
15424
15637
|
|
|
@@ -15437,7 +15650,7 @@ function notRunning() {
|
|
|
15437
15650
|
next: LISTEN_NEXT
|
|
15438
15651
|
});
|
|
15439
15652
|
}
|
|
15440
|
-
var LISTEN_NEXT,
|
|
15653
|
+
var LISTEN_NEXT, command56, trigger_default;
|
|
15441
15654
|
var init_trigger = __esm({
|
|
15442
15655
|
"src/commands/webhooks/trigger.ts"() {
|
|
15443
15656
|
"use strict";
|
|
@@ -15446,7 +15659,7 @@ var init_trigger = __esm({
|
|
|
15446
15659
|
init_http();
|
|
15447
15660
|
init_local();
|
|
15448
15661
|
LISTEN_NEXT = "kenso webhooks listen --forward-to http://localhost:3000/hook";
|
|
15449
|
-
|
|
15662
|
+
command56 = {
|
|
15450
15663
|
resource: "webhooks",
|
|
15451
15664
|
action: "trigger",
|
|
15452
15665
|
summary: "Send a sample event of one type through the running kenso webhooks listen",
|
|
@@ -15503,16 +15716,16 @@ var init_trigger = __esm({
|
|
|
15503
15716
|
return ExitCode.Ok;
|
|
15504
15717
|
}
|
|
15505
15718
|
};
|
|
15506
|
-
trigger_default =
|
|
15719
|
+
trigger_default = command56;
|
|
15507
15720
|
}
|
|
15508
15721
|
});
|
|
15509
15722
|
|
|
15510
15723
|
// src/commands/webhooks/index.ts
|
|
15511
|
-
var
|
|
15724
|
+
var actions27;
|
|
15512
15725
|
var init_webhooks2 = __esm({
|
|
15513
15726
|
"src/commands/webhooks/index.ts"() {
|
|
15514
15727
|
"use strict";
|
|
15515
|
-
|
|
15728
|
+
actions27 = {
|
|
15516
15729
|
listen: () => Promise.resolve().then(() => (init_listen(), listen_exports)).then((m) => m.default),
|
|
15517
15730
|
trigger: () => Promise.resolve().then(() => (init_trigger(), trigger_exports)).then((m) => m.default)
|
|
15518
15731
|
};
|
|
@@ -15707,14 +15920,14 @@ var status_exports3 = {};
|
|
|
15707
15920
|
__export(status_exports3, {
|
|
15708
15921
|
default: () => status_default3
|
|
15709
15922
|
});
|
|
15710
|
-
var
|
|
15923
|
+
var command57, status_default3;
|
|
15711
15924
|
var init_status3 = __esm({
|
|
15712
15925
|
"src/commands/work/status.ts"() {
|
|
15713
15926
|
"use strict";
|
|
15714
15927
|
init_exit_codes();
|
|
15715
15928
|
init_http();
|
|
15716
15929
|
init_common3();
|
|
15717
|
-
|
|
15930
|
+
command57 = {
|
|
15718
15931
|
resource: "work",
|
|
15719
15932
|
action: "status",
|
|
15720
15933
|
summary: "Show the Kenso AI work waiting for your own agent, per kind",
|
|
@@ -15748,7 +15961,7 @@ var init_status3 = __esm({
|
|
|
15748
15961
|
return ExitCode.Ok;
|
|
15749
15962
|
}
|
|
15750
15963
|
};
|
|
15751
|
-
status_default3 =
|
|
15964
|
+
status_default3 = command57;
|
|
15752
15965
|
}
|
|
15753
15966
|
});
|
|
15754
15967
|
|
|
@@ -15880,9 +16093,9 @@ var init_files = __esm({
|
|
|
15880
16093
|
import { execFile, spawnSync as spawnSync2 } from "node:child_process";
|
|
15881
16094
|
import { readFileSync as readFileSync12 } from "node:fs";
|
|
15882
16095
|
import { isAbsolute as isAbsolute2 } from "node:path";
|
|
15883
|
-
function sudoArgs(user,
|
|
16096
|
+
function sudoArgs(user, command65, args, keep = [], set = {}) {
|
|
15884
16097
|
const assignments = Object.entries(set).map(([name, value]) => `${name}=${value}`);
|
|
15885
|
-
return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--",
|
|
16098
|
+
return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--", command65, ...args];
|
|
15886
16099
|
}
|
|
15887
16100
|
function agentKensoEnv(opts) {
|
|
15888
16101
|
return {
|
|
@@ -15892,12 +16105,12 @@ function agentKensoEnv(opts) {
|
|
|
15892
16105
|
AI_AGENT: opts.agentName
|
|
15893
16106
|
};
|
|
15894
16107
|
}
|
|
15895
|
-
function sudoExec(user,
|
|
16108
|
+
function sudoExec(user, command65, args, opts = {}) {
|
|
15896
16109
|
const [sudo = "/usr/bin/sudo", ...lead] = user.sudo;
|
|
15897
16110
|
return new Promise((resolve16) => {
|
|
15898
16111
|
execFile(
|
|
15899
16112
|
sudo,
|
|
15900
|
-
[...lead, ...sudoArgs(user.name,
|
|
16113
|
+
[...lead, ...sudoArgs(user.name, command65, args)],
|
|
15901
16114
|
{ env: { PATH: SUDO_PATH }, cwd: "/", timeout: opts.timeoutMs ?? PROBE_TIMEOUT_MS, maxBuffer: opts.maxBuffer ?? 1024 * 1024, encoding: "utf8", windowsHide: true, shell: false },
|
|
15902
16115
|
(err, stdout, stderr) => {
|
|
15903
16116
|
const code = err ? err.code : 0;
|
|
@@ -16007,9 +16220,9 @@ var init_folder2 = __esm({
|
|
|
16007
16220
|
init_redact();
|
|
16008
16221
|
init_agent_user();
|
|
16009
16222
|
WorkRunFolder = class {
|
|
16010
|
-
constructor(ctx,
|
|
16223
|
+
constructor(ctx, command65, args, outDir, shared = false) {
|
|
16011
16224
|
this.ctx = ctx;
|
|
16012
|
-
this.command =
|
|
16225
|
+
this.command = command65;
|
|
16013
16226
|
this.args = args;
|
|
16014
16227
|
this.outDir = outDir;
|
|
16015
16228
|
this.shared = shared;
|
|
@@ -16124,7 +16337,7 @@ var pull_exports2 = {};
|
|
|
16124
16337
|
__export(pull_exports2, {
|
|
16125
16338
|
default: () => pull_default2
|
|
16126
16339
|
});
|
|
16127
|
-
var MAX_FILES,
|
|
16340
|
+
var MAX_FILES, command58, pull_default2;
|
|
16128
16341
|
var init_pull2 = __esm({
|
|
16129
16342
|
"src/commands/work/pull.ts"() {
|
|
16130
16343
|
"use strict";
|
|
@@ -16133,7 +16346,7 @@ var init_pull2 = __esm({
|
|
|
16133
16346
|
init_common3();
|
|
16134
16347
|
init_folder2();
|
|
16135
16348
|
MAX_FILES = 100;
|
|
16136
|
-
|
|
16349
|
+
command58 = {
|
|
16137
16350
|
resource: "work",
|
|
16138
16351
|
action: "pull",
|
|
16139
16352
|
summary: "Claim waiting work into local work files, to answer by hand",
|
|
@@ -16211,7 +16424,7 @@ var init_pull2 = __esm({
|
|
|
16211
16424
|
return interrupted7 ? ExitCode.Interrupted : ExitCode.Ok;
|
|
16212
16425
|
}
|
|
16213
16426
|
};
|
|
16214
|
-
pull_default2 =
|
|
16427
|
+
pull_default2 = command58;
|
|
16215
16428
|
}
|
|
16216
16429
|
});
|
|
16217
16430
|
|
|
@@ -16353,7 +16566,7 @@ __export(submit_exports, {
|
|
|
16353
16566
|
default: () => submit_default
|
|
16354
16567
|
});
|
|
16355
16568
|
import { resolve as resolve14 } from "node:path";
|
|
16356
|
-
var
|
|
16569
|
+
var command59, submit_default;
|
|
16357
16570
|
var init_submit = __esm({
|
|
16358
16571
|
"src/commands/work/submit.ts"() {
|
|
16359
16572
|
"use strict";
|
|
@@ -16362,7 +16575,7 @@ var init_submit = __esm({
|
|
|
16362
16575
|
init_files();
|
|
16363
16576
|
init_answers();
|
|
16364
16577
|
init_common3();
|
|
16365
|
-
|
|
16578
|
+
command59 = {
|
|
16366
16579
|
resource: "work",
|
|
16367
16580
|
action: "submit",
|
|
16368
16581
|
summary: "Send answers files to Kenso and write each one's results",
|
|
@@ -16394,7 +16607,7 @@ var init_submit = __esm({
|
|
|
16394
16607
|
return totals.rejected > 0 ? ExitCode.Partial : ExitCode.Ok;
|
|
16395
16608
|
}
|
|
16396
16609
|
};
|
|
16397
|
-
submit_default =
|
|
16610
|
+
submit_default = command59;
|
|
16398
16611
|
}
|
|
16399
16612
|
});
|
|
16400
16613
|
|
|
@@ -16415,7 +16628,7 @@ function claimIdOf(arg) {
|
|
|
16415
16628
|
if (!CLAIM_ID.test(arg)) throw usageError(`"${arg}" is neither a claim id nor a work file.`, { field: "claim", hint: "Claim ids look like awc_8fK2..." });
|
|
16416
16629
|
return arg;
|
|
16417
16630
|
}
|
|
16418
|
-
var CLAIM_ID,
|
|
16631
|
+
var CLAIM_ID, command60, release_default;
|
|
16419
16632
|
var init_release = __esm({
|
|
16420
16633
|
"src/commands/work/release.ts"() {
|
|
16421
16634
|
"use strict";
|
|
@@ -16424,7 +16637,7 @@ var init_release = __esm({
|
|
|
16424
16637
|
init_files();
|
|
16425
16638
|
init_common3();
|
|
16426
16639
|
CLAIM_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
16427
|
-
|
|
16640
|
+
command60 = {
|
|
16428
16641
|
resource: "work",
|
|
16429
16642
|
action: "release",
|
|
16430
16643
|
summary: "Give claimed work back to the queue now",
|
|
@@ -16443,7 +16656,7 @@ var init_release = __esm({
|
|
|
16443
16656
|
return ExitCode.Ok;
|
|
16444
16657
|
}
|
|
16445
16658
|
};
|
|
16446
|
-
release_default =
|
|
16659
|
+
release_default = command60;
|
|
16447
16660
|
}
|
|
16448
16661
|
});
|
|
16449
16662
|
|
|
@@ -16782,12 +16995,12 @@ function plain(text4) {
|
|
|
16782
16995
|
return text4.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "");
|
|
16783
16996
|
}
|
|
16784
16997
|
function runStatus(bin, args, env, adapter, runAs) {
|
|
16785
|
-
const
|
|
16998
|
+
const command65 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
|
|
16786
16999
|
const commandArgs2 = runAs ? [...runAs.sudo.slice(1), ...sudoArgs(runAs.name, bin, args)] : args;
|
|
16787
17000
|
const options = runAs ? { env: { PATH: SUDO_PATH }, cwd: "/" } : { env: childEnv(env, adapter) };
|
|
16788
17001
|
return new Promise((resolve16) => {
|
|
16789
17002
|
execFile2(
|
|
16790
|
-
|
|
17003
|
+
command65,
|
|
16791
17004
|
commandArgs2,
|
|
16792
17005
|
{ ...options, timeout: STATUS_TIMEOUT_MS, maxBuffer: 1024 * 1024, windowsHide: true, shell: false },
|
|
16793
17006
|
(err, stdout, stderr) => {
|
|
@@ -17869,7 +18082,7 @@ var run_exports3 = {};
|
|
|
17869
18082
|
__export(run_exports3, {
|
|
17870
18083
|
default: () => run_default2
|
|
17871
18084
|
});
|
|
17872
|
-
var FAILURES_IN_A_ROW,
|
|
18085
|
+
var FAILURES_IN_A_ROW, command61, run_default2;
|
|
17873
18086
|
var init_run3 = __esm({
|
|
17874
18087
|
"src/commands/work/run.ts"() {
|
|
17875
18088
|
"use strict";
|
|
@@ -17890,7 +18103,7 @@ var init_run3 = __esm({
|
|
|
17890
18103
|
init_folder2();
|
|
17891
18104
|
init_stop();
|
|
17892
18105
|
FAILURES_IN_A_ROW = 3;
|
|
17893
|
-
|
|
18106
|
+
command61 = {
|
|
17894
18107
|
resource: "work",
|
|
17895
18108
|
action: "run",
|
|
17896
18109
|
summary: "Run your own coding agent on the waiting work until the queue is empty",
|
|
@@ -18215,16 +18428,16 @@ var init_run3 = __esm({
|
|
|
18215
18428
|
return exitCodeFor(reason, totals.rejected > 0 || jobsFailed > 0);
|
|
18216
18429
|
}
|
|
18217
18430
|
};
|
|
18218
|
-
run_default2 =
|
|
18431
|
+
run_default2 = command61;
|
|
18219
18432
|
}
|
|
18220
18433
|
});
|
|
18221
18434
|
|
|
18222
18435
|
// src/commands/work/index.ts
|
|
18223
|
-
var
|
|
18436
|
+
var actions28;
|
|
18224
18437
|
var init_work2 = __esm({
|
|
18225
18438
|
"src/commands/work/index.ts"() {
|
|
18226
18439
|
"use strict";
|
|
18227
|
-
|
|
18440
|
+
actions28 = {
|
|
18228
18441
|
status: () => Promise.resolve().then(() => (init_status3(), status_exports3)).then((m) => m.default),
|
|
18229
18442
|
pull: () => Promise.resolve().then(() => (init_pull2(), pull_exports2)).then((m) => m.default),
|
|
18230
18443
|
submit: () => Promise.resolve().then(() => (init_submit(), submit_exports)).then((m) => m.default),
|
|
@@ -18255,7 +18468,7 @@ function rewrap(err, overrides) {
|
|
|
18255
18468
|
details: err.details
|
|
18256
18469
|
});
|
|
18257
18470
|
}
|
|
18258
|
-
var TEMPLATES, APP_NEXT_STEP, NOT_AVAILABLE,
|
|
18471
|
+
var TEMPLATES, APP_NEXT_STEP, NOT_AVAILABLE, command62, keys_default;
|
|
18259
18472
|
var init_keys = __esm({
|
|
18260
18473
|
"src/commands/workspace/keys.ts"() {
|
|
18261
18474
|
"use strict";
|
|
@@ -18265,7 +18478,7 @@ var init_keys = __esm({
|
|
|
18265
18478
|
TEMPLATES = ["admin", "editor", "viewer"];
|
|
18266
18479
|
APP_NEXT_STEP = "A workspace admin can create it in the app: Settings > API keys > Workspace keys";
|
|
18267
18480
|
NOT_AVAILABLE = "Workspace keys are not available for this workspace yet.";
|
|
18268
|
-
|
|
18481
|
+
command62 = {
|
|
18269
18482
|
resource: "workspace",
|
|
18270
18483
|
action: "keys",
|
|
18271
18484
|
summary: "Create an API key the workspace owns",
|
|
@@ -18326,14 +18539,14 @@ var init_keys = __esm({
|
|
|
18326
18539
|
return ExitCode.Ok;
|
|
18327
18540
|
}
|
|
18328
18541
|
};
|
|
18329
|
-
keys_default =
|
|
18542
|
+
keys_default = command62;
|
|
18330
18543
|
}
|
|
18331
18544
|
});
|
|
18332
18545
|
|
|
18333
18546
|
// src/commands/workspace/list.ts
|
|
18334
|
-
var
|
|
18335
|
-
__export(
|
|
18336
|
-
default: () =>
|
|
18547
|
+
var list_exports4 = {};
|
|
18548
|
+
__export(list_exports4, {
|
|
18549
|
+
default: () => list_default4
|
|
18337
18550
|
});
|
|
18338
18551
|
function parseLimit(value) {
|
|
18339
18552
|
if (value === void 0) return void 0;
|
|
@@ -18344,14 +18557,14 @@ function parseLimit(value) {
|
|
|
18344
18557
|
}
|
|
18345
18558
|
return limit;
|
|
18346
18559
|
}
|
|
18347
|
-
var MAX_LIMIT,
|
|
18348
|
-
var
|
|
18560
|
+
var MAX_LIMIT, command63, list_default4;
|
|
18561
|
+
var init_list4 = __esm({
|
|
18349
18562
|
"src/commands/workspace/list.ts"() {
|
|
18350
18563
|
"use strict";
|
|
18351
18564
|
init_errors();
|
|
18352
18565
|
init_exit_codes();
|
|
18353
18566
|
MAX_LIMIT = 200;
|
|
18354
|
-
|
|
18567
|
+
command63 = {
|
|
18355
18568
|
resource: "workspace",
|
|
18356
18569
|
action: "list",
|
|
18357
18570
|
summary: "List the workspaces your key can use",
|
|
@@ -18379,7 +18592,7 @@ var init_list3 = __esm({
|
|
|
18379
18592
|
return ExitCode.Ok;
|
|
18380
18593
|
}
|
|
18381
18594
|
};
|
|
18382
|
-
|
|
18595
|
+
list_default4 = command63;
|
|
18383
18596
|
}
|
|
18384
18597
|
});
|
|
18385
18598
|
|
|
@@ -18388,7 +18601,7 @@ var use_exports = {};
|
|
|
18388
18601
|
__export(use_exports, {
|
|
18389
18602
|
default: () => use_default
|
|
18390
18603
|
});
|
|
18391
|
-
var
|
|
18604
|
+
var command64, use_default;
|
|
18392
18605
|
var init_use = __esm({
|
|
18393
18606
|
"src/commands/workspace/use.ts"() {
|
|
18394
18607
|
"use strict";
|
|
@@ -18396,7 +18609,7 @@ var init_use = __esm({
|
|
|
18396
18609
|
init_errors();
|
|
18397
18610
|
init_exit_codes();
|
|
18398
18611
|
init_http();
|
|
18399
|
-
|
|
18612
|
+
command64 = {
|
|
18400
18613
|
resource: "workspace",
|
|
18401
18614
|
action: "use",
|
|
18402
18615
|
summary: "Set the profile's default workspace",
|
|
@@ -18453,18 +18666,18 @@ var init_use = __esm({
|
|
|
18453
18666
|
return ExitCode.Ok;
|
|
18454
18667
|
}
|
|
18455
18668
|
};
|
|
18456
|
-
use_default =
|
|
18669
|
+
use_default = command64;
|
|
18457
18670
|
}
|
|
18458
18671
|
});
|
|
18459
18672
|
|
|
18460
18673
|
// src/commands/workspace/index.ts
|
|
18461
|
-
var
|
|
18674
|
+
var actions29;
|
|
18462
18675
|
var init_workspace = __esm({
|
|
18463
18676
|
"src/commands/workspace/index.ts"() {
|
|
18464
18677
|
"use strict";
|
|
18465
|
-
|
|
18678
|
+
actions29 = {
|
|
18466
18679
|
keys: () => Promise.resolve().then(() => (init_keys(), keys_exports)).then((m) => m.default),
|
|
18467
|
-
list: () => Promise.resolve().then(() => (
|
|
18680
|
+
list: () => Promise.resolve().then(() => (init_list4(), list_exports4)).then((m) => m.default),
|
|
18468
18681
|
use: () => Promise.resolve().then(() => (init_use(), use_exports)).then((m) => m.default)
|
|
18469
18682
|
};
|
|
18470
18683
|
}
|
|
@@ -18499,6 +18712,7 @@ var init_registry = __esm({
|
|
|
18499
18712
|
init_jobs2();
|
|
18500
18713
|
init_logs();
|
|
18501
18714
|
init_mcp();
|
|
18715
|
+
init_notes();
|
|
18502
18716
|
init_opportunities();
|
|
18503
18717
|
init_people();
|
|
18504
18718
|
init_pipelines();
|
|
@@ -18530,19 +18744,20 @@ var init_registry = __esm({
|
|
|
18530
18744
|
logout: topLevel("logout", actions4.logout, "kenso auth logout"),
|
|
18531
18745
|
logs: actions15,
|
|
18532
18746
|
mcp: actions16,
|
|
18533
|
-
|
|
18534
|
-
|
|
18535
|
-
|
|
18536
|
-
|
|
18537
|
-
|
|
18538
|
-
|
|
18539
|
-
|
|
18540
|
-
|
|
18541
|
-
|
|
18542
|
-
|
|
18747
|
+
notes: actions17,
|
|
18748
|
+
opportunities: actions18,
|
|
18749
|
+
people: actions19,
|
|
18750
|
+
pipelines: actions20,
|
|
18751
|
+
reports: actions21,
|
|
18752
|
+
runs: actions22,
|
|
18753
|
+
sandbox: actions23,
|
|
18754
|
+
skill: actions24,
|
|
18755
|
+
studio: actions25,
|
|
18756
|
+
tasks: actions26,
|
|
18757
|
+
webhooks: actions27,
|
|
18543
18758
|
whoami: topLevel("whoami", actions4.status, "kenso auth status"),
|
|
18544
|
-
work:
|
|
18545
|
-
workspace:
|
|
18759
|
+
work: actions28,
|
|
18760
|
+
workspace: actions29
|
|
18546
18761
|
};
|
|
18547
18762
|
resourceAliases = { leads: "contacts" };
|
|
18548
18763
|
}
|
|
@@ -18679,8 +18894,8 @@ async function renderTopHelp(opts) {
|
|
|
18679
18894
|
names.push(withPositionals(spec, spec.action));
|
|
18680
18895
|
groups.set(hint, names);
|
|
18681
18896
|
}
|
|
18682
|
-
const
|
|
18683
|
-
if (
|
|
18897
|
+
const actions31 = [...groups.entries()].map(([hint, names]) => `${names.join(", ")}${hint}`);
|
|
18898
|
+
if (actions31.length > 0) rows.push([resource, actions31.join(", ")]);
|
|
18684
18899
|
}
|
|
18685
18900
|
const at = 4 + Math.min(22, Math.max(0, ...rows.map(([left]) => left.length)));
|
|
18686
18901
|
lines.push(
|
|
@@ -18693,7 +18908,7 @@ async function renderTopHelp(opts) {
|
|
|
18693
18908
|
const [area = "", action = ""] = name.split(" ");
|
|
18694
18909
|
byArea.set(area, [...byArea.get(area) ?? [], action]);
|
|
18695
18910
|
}
|
|
18696
|
-
const named = [...byArea.entries()].map(([area,
|
|
18911
|
+
const named = [...byArea.entries()].map(([area, actions31]) => `${area} ${actions31.join("|")}`);
|
|
18697
18912
|
lines.push(wrap(`Beta, hidden here but they run (the server decides): ${named.join(", ")}.`, " "));
|
|
18698
18913
|
}
|
|
18699
18914
|
const generated = await listGenerated({ features: opts.allCommands ? [] : getFeatures, env: opts.env });
|
|
@@ -18701,13 +18916,13 @@ async function renderTopHelp(opts) {
|
|
|
18701
18916
|
if (visible.length > 0) {
|
|
18702
18917
|
const byResource = /* @__PURE__ */ new Map();
|
|
18703
18918
|
for (const g of visible) {
|
|
18704
|
-
const
|
|
18705
|
-
|
|
18706
|
-
byResource.set(g.resource,
|
|
18919
|
+
const actions31 = byResource.get(g.resource) ?? [];
|
|
18920
|
+
actions31.push(`${g.action}${g.beta ? " (beta)" : ""}`);
|
|
18921
|
+
byResource.set(g.resource, actions31);
|
|
18707
18922
|
}
|
|
18708
18923
|
const sorted2 = [...byResource.entries()].sort(([a], [b]) => a.localeCompare(b));
|
|
18709
18924
|
if (opts.allCommands) {
|
|
18710
|
-
const generatedRows = sorted2.map(([resource,
|
|
18925
|
+
const generatedRows = sorted2.map(([resource, actions31]) => [resource, actions31.sort().join(", ")]);
|
|
18711
18926
|
lines.push("", "API resources (kenso <resource> <action>):", columns(generatedRows));
|
|
18712
18927
|
} else {
|
|
18713
18928
|
const names = new Set(sorted2.map(([resource]) => resource));
|
|
@@ -19023,8 +19238,8 @@ function startUpdateNotice(argv, opts = {}) {
|
|
|
19023
19238
|
if (!found) return;
|
|
19024
19239
|
writeCheck(file, { checkedAt: new Date(now).toISOString(), latest: found });
|
|
19025
19240
|
if (isNewer(found, version)) {
|
|
19026
|
-
const
|
|
19027
|
-
stderr.write(`kenso ${found} is out (you have ${version}): ${
|
|
19241
|
+
const command65 = updateCommand(install, opts.platform ?? process.platform);
|
|
19242
|
+
stderr.write(`kenso ${found} is out (you have ${version}): ${command65}
|
|
19028
19243
|
Turn this off with KENSO_NO_UPDATE_NOTIFIER=1.
|
|
19029
19244
|
`);
|
|
19030
19245
|
}
|
|
@@ -19066,7 +19281,7 @@ function resources() {
|
|
|
19066
19281
|
const names = Object.entries(handWritten).filter(([, area]) => Object.keys(area).length > 0).map(([resource]) => resource);
|
|
19067
19282
|
return sorted([...names, ...Object.keys(resourceAliases), ...loadManifest().operations.map((op) => op.resource)]);
|
|
19068
19283
|
}
|
|
19069
|
-
function
|
|
19284
|
+
function actions30(resource) {
|
|
19070
19285
|
const own = Object.keys(handWritten[resource] ?? {}).filter((action) => action !== "");
|
|
19071
19286
|
return sorted([...own, ...loadManifest().operations.filter((op) => op.resource === resource).map((op) => op.action)]);
|
|
19072
19287
|
}
|
|
@@ -19131,7 +19346,7 @@ async function completions(words, globals) {
|
|
|
19131
19346
|
return flagsOf2(spec, globals, positionals.length === 0);
|
|
19132
19347
|
}
|
|
19133
19348
|
if (positionals.length === 0) return resources();
|
|
19134
|
-
if (!spec) return positionals.length === 1 ?
|
|
19349
|
+
if (!spec) return positionals.length === 1 ? actions30(resourceAliases[positionals[0]] ?? positionals[0]) : [];
|
|
19135
19350
|
const given = positionals.length - commandWords;
|
|
19136
19351
|
const declared = spec.positionals ?? [];
|
|
19137
19352
|
if (given < declared.length || declared.at(-1)?.variadic === true) {
|
|
@@ -19225,9 +19440,9 @@ function normalizeBooleans(argv, names, strict) {
|
|
|
19225
19440
|
async function knownCommands() {
|
|
19226
19441
|
const commands = /* @__PURE__ */ new Set();
|
|
19227
19442
|
for (const [resource, area] of Object.entries(handWritten)) {
|
|
19228
|
-
const
|
|
19229
|
-
if (
|
|
19230
|
-
for (const action of
|
|
19443
|
+
const actions31 = Object.keys(area);
|
|
19444
|
+
if (actions31.length > 0) commands.add(resource);
|
|
19445
|
+
for (const action of actions31) commands.add(action ? `${resource} ${action}` : resource);
|
|
19231
19446
|
}
|
|
19232
19447
|
for (const g of await listGenerated({ features: [] })) {
|
|
19233
19448
|
commands.add(g.resource);
|