kenso 0.1.213 → 0.1.215
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/README.md +2 -0
- package/dist/discover.json +1 -1
- package/dist/kenso.js +149 -55
- package/dist/operations.index.json +1 -1
- package/dist/operations.json +1 -1
- package/dist/step-types.json +1 -1
- package/docs/README.md +1 -0
- package/docs/reference.md +145 -4
- package/docs/social.md +37 -0
- package/package.json +2 -2
package/dist/kenso.js
CHANGED
|
@@ -3540,7 +3540,7 @@ var VERSION;
|
|
|
3540
3540
|
var init_version = __esm({
|
|
3541
3541
|
"src/core/version.ts"() {
|
|
3542
3542
|
"use strict";
|
|
3543
|
-
VERSION = true ? "0.1.
|
|
3543
|
+
VERSION = true ? "0.1.215" : "0.0.0-dev";
|
|
3544
3544
|
}
|
|
3545
3545
|
});
|
|
3546
3546
|
|
|
@@ -10156,7 +10156,7 @@ var init_output_and_errors = __esm({
|
|
|
10156
10156
|
var README_default;
|
|
10157
10157
|
var init_README = __esm({
|
|
10158
10158
|
"docs/README.md"() {
|
|
10159
|
-
README_default = '# Kenso CLI\n\nThe Kenso CLI (`kenso`) is the command line for Kenso. It does bulk work in your Kenso workspace from files: add thousands of leads to a campaign, update or clean them up, import accounts and people, and build Studio templates. It is made for coding agents (Claude Code, Codex, Cursor) and the people who drive them: JSON on stdout, fixed exit codes, a dry run before every bulk write, and runs you can resume.\n\nEvery canonical API operation a workspace member can call is also a command, such as `kenso campaigns list` or `kenso tags create`. So the CLI reaches what the Kenso MCP reaches, straight against `https://api.ken.so`. The legacy routes with no canonical successor, such as sequence images, AI variables or thread opens, have no command: reach them with `kenso api <METHOD> <path>`.\n\n## Install\n\nOn macOS or Linux, with or without Node, run the [install script](https://ken.so/install.sh): fetch it with `curl -fsSL` and pipe it to `sh`. It installs a standalone build that brings its own Node.js, checks the release\'s `SHA256SUMS` against its signature by the Kenso release key (with `ssh-keygen`, part of OpenSSH) and the download against that list, puts the CLI in `~/.local/share/kenso` and links `~/.local/bin/kenso`. Run it again to update.\n\nWith Homebrew, on macOS or Linux, the same standalone build:\n\n```bash\nbrew install ken-technology/tap/kenso\n```\n\n`brew upgrade kenso` updates it.\n\nWith Node 22 or newer, on any system, Windows included:\n\n```bash\nnpm i -g kenso\nkenso --version\n```\n\nTo run it once without installing, use `npx kenso --version`. On an older Node, kenso stops with one line that says so.\n\nEvery way to install:\n\n| Way | Systems | Needs |\n|---|---|---|\n| Install script, above | macOS, Linux (glibc) | `ssh-keygen` from OpenSSH 8.1 or newer: macOS has it, and on Debian or Ubuntu it is in `openssh-client` |\n| Homebrew, above | macOS, Linux | Homebrew |\n| npm, above | Any | Node 22 or newer |\n| Standalone build: unpack it and put its `bin` folder on your PATH | macOS, Linux, Windows | Nothing |\n\nThe standalone builds are at `https://downloads.ken.so/desktop/cli/<version>/`, one per system: `kenso-<version>-darwin-arm64.tar.gz`, `darwin-x64`, `linux-arm64`, `linux-x64` and `kenso-<version>-windows-x64.zip`, with their `SHA256SUMS` and its signature `SHA256SUMS.sig` (0.1.184 and later). To check a list by hand, save the `SIGNERS` line of the install script, without its quotes, as `allowed_signers`, then run `ssh-keygen -Y verify -f allowed_signers -I kenso-cli-release -n file -s SHA256SUMS.sig < SHA256SUMS`. `https://downloads.ken.so/desktop/cli/latest.yml` names the newest version. The builds come out nightly and Homebrew follows them, so a command added that day reaches npm first.\n\n### Tab completion\n\nTab completes resources, actions and flags once you install the script for your shell. The script asks `kenso` for the candidates on each Tab, so it stays right as the CLI updates: install it once.\n\n```bash\n# zsh: add this line to ~/.zshrc\nsource <(kenso completion zsh)\n# bash: add this line to ~/.bashrc (on bash 3.2, the macOS default, use: eval "$(kenso completion bash)")\nsource <(kenso completion bash)\n# fish: save the script once\nkenso completion fish > ~/.config/fish/completions/kenso.fish\n```\n\n### Update notice\n\nWhen a newer version is out, `kenso` says so on stderr after the command\'s own output, at most once a week: `kenso 0.1.40 is out (you have 0.1.35): npm i -g kenso@latest`. It checks `registry.npmjs.org` at most once every 7 days and never delays a command by more than about a second. A standalone build checks `latest.yml` on `downloads.ken.so` instead and names its own update: the install script, or `brew upgrade kenso` when Homebrew installed it. It stays quiet in CI (`CI` set) and when stderr is not a terminal. Under a coding agent it asks nothing: it prints the line once per agent session, from the last check. Set `KENSO_NO_UPDATE_NOTIFIER=1` to turn it off.\n\n## 60-second quickstart\n\n1. Create an API key in app.ken.so at Settings > API keys.\n2. Save the key, pick a workspace, then plan and apply a CSV import:\n\n```bash\necho $KEY | kenso auth login --with-key\nkenso workspace list --search acme\nkenso workspace use 1234\nkenso campaigns list --limit 5\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\n`workspace list` and `workspace use` are only needed when your key reaches more than one workspace.\n\nThe dry run reads the file, maps the columns, checks every row, asks Kenso for a credit estimate, and writes nothing. It prints the plan, with the exact apply command in `next`:\n\n```json\n{"run":"r_tdi5cdnx","dryRun":true,"command":"contacts import","rows":4,"valid":2,"invalid":2,"chunks":1,"chunkSize":1000,"campaignId":812,"mapping":{"Email":"email","First Name":"firstName","Last Name":"lastName","Company":"companyName","Pain Point":"customVariables.pain_point"},"customVariableKeys":["pain_point"],"estimate":{"kind":"leads","totalMillicredits":2000,"availableMillicredits":500000,"sufficient":true},"credits":{"needed":2,"available":500,"sufficient":true},"next":"kenso contacts import --campaign 812 --file leads.csv --yes","plan":"/home/you/.kenso/runs/r_tdi5cdnx/plan.json","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv"}\n```\n\nThe apply sends the rows and prints one summary. Every input row has one line in `results.csv`:\n\n```json\n{"run":"r_tdi5cdnx","rows":4,"ok":0,"created":1,"updated":0,"skipped":{"duplicate":1},"failed":0,"notFound":0,"invalid":2,"changed":1,"results":"/home/you/.kenso/runs/r_tdi5cdnx/results.csv","resultsNdjson":"/home/you/.kenso/runs/r_tdi5cdnx/results.ndjson","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv","resumed":false,"durationMs":1840,"campaignId":812,"notSendable":0}\n```\n\nThis run exits 5 because two rows were invalid: open `invalid.csv` to see why, fix those rows, and import them again. Running the same command again is safe: an email that is already in the campaign comes back `updated` or `skipped`, never as a second lead.\n\n## CLI or MCP\n\n- **Use the CLI for volume:** anything that starts from a file, anything over about 50 records, anything you may need to rerun or resume. Records never pass through the model\'s context: the agent passes a file path and reads a short summary.\n- **Use the MCP for conversation and single records:** look up a campaign, draft a reply, read a report. The MCP is at `https://mcp.ken.so/mcp`, signs in with OAuth and needs no install ([connection guide](https://ken.so/mcp)).\n- **Both use the same API and the same permissions.** `kenso mcp call` reaches MCP-only tools, such as skills, from the shell.\n\n## Docs\n\nEvery page is in the package and prints offline with `kenso docs <topic>`.\n\n| Page | Topic | What it covers |\n|---|---|---|\n| [Authentication](auth.md) | `auth` | API keys, browser login, profiles, workspaces, `doctor` |\n| [Leads](leads.md) | `leads` | Import, update, remove, pause, tag and export leads, with recipes |\n| [Batch runs](batch.md) | `batch` | Dry run and apply, run folders, results files, resume, rate limits, `--each` |\n| [Output and errors](output-and-errors.md) | `output-and-errors` | The output contract, error JSON, error codes, exit codes, live streams |\n| [CRM (beta)](crm.md) | `crm` | Accounts, people, opportunities and CRM sync |\n| [Images (beta)](images.md) | `images` | Upload one image per lead into an image variable, from a folder or a CSV |\n| [Studio (beta)](studio.md) | `studio` | Pull, push, validate, preview and fill templates |\n| [Workflows (beta)](workflows.md) | `workflows` | Keep a workflow as a file: `kenso.json`, init, pull, check, push, test, publish, and run it on ids or a CSV with a credit cap |\n| [Agent work (beta)](work.md) | `work` | My agent: your own coding agent writes Kenso\'s AI work with `kenso work run`, or pull and submit |\n| [Webhooks](webhooks.md) | `webhooks` | Build a webhook handler locally: `kenso webhooks listen --forward-to`, `trigger`, the signature |\n| [Developer sandbox](sandbox.md) | `sandbox` | `kenso sandbox`: a workspace of your own where sends are simulated, its test key, the reserved test leads |\n| [Connect accounts](connect.md) | `connect` | `kenso connect`: an inbox, calendar, CRM, GitHub or other OAuth account, signed in by the person in a browser |\n| [Coding agents](agents.md) | `agents` | Claude Code, Codex, Cursor, the Agent Skill, environment variables, sandboxes |\n| Command reference | `reference` | Every command with its flags, generated from the CLI at build time: `kenso docs reference`, or `docs/reference.md` in the installed package |\n\n```bash\nkenso docs\nkenso docs leads\n```\n\nFor machine-readable help, run `kenso describe`: it prints every command, its flags and its body schema as JSON.\n';
|
|
10159
|
+
README_default = '# Kenso CLI\n\nThe Kenso CLI (`kenso`) is the command line for Kenso. It does bulk work in your Kenso workspace from files: add thousands of leads to a campaign, update or clean them up, import accounts and people, and build Studio templates. It is made for coding agents (Claude Code, Codex, Cursor) and the people who drive them: JSON on stdout, fixed exit codes, a dry run before every bulk write, and runs you can resume.\n\nEvery canonical API operation a workspace member can call is also a command, such as `kenso campaigns list` or `kenso tags create`. So the CLI reaches what the Kenso MCP reaches, straight against `https://api.ken.so`. The legacy routes with no canonical successor, such as sequence images, AI variables or thread opens, have no command: reach them with `kenso api <METHOD> <path>`.\n\n## Install\n\nOn macOS or Linux, with or without Node, run the [install script](https://ken.so/install.sh): fetch it with `curl -fsSL` and pipe it to `sh`. It installs a standalone build that brings its own Node.js, checks the release\'s `SHA256SUMS` against its signature by the Kenso release key (with `ssh-keygen`, part of OpenSSH) and the download against that list, puts the CLI in `~/.local/share/kenso` and links `~/.local/bin/kenso`. Run it again to update.\n\nWith Homebrew, on macOS or Linux, the same standalone build:\n\n```bash\nbrew install ken-technology/tap/kenso\n```\n\n`brew upgrade kenso` updates it.\n\nWith Node 22 or newer, on any system, Windows included:\n\n```bash\nnpm i -g kenso\nkenso --version\n```\n\nTo run it once without installing, use `npx kenso --version`. On an older Node, kenso stops with one line that says so.\n\nEvery way to install:\n\n| Way | Systems | Needs |\n|---|---|---|\n| Install script, above | macOS, Linux (glibc) | `ssh-keygen` from OpenSSH 8.1 or newer: macOS has it, and on Debian or Ubuntu it is in `openssh-client` |\n| Homebrew, above | macOS, Linux | Homebrew |\n| npm, above | Any | Node 22 or newer |\n| Standalone build: unpack it and put its `bin` folder on your PATH | macOS, Linux, Windows | Nothing |\n\nThe standalone builds are at `https://downloads.ken.so/desktop/cli/<version>/`, one per system: `kenso-<version>-darwin-arm64.tar.gz`, `darwin-x64`, `linux-arm64`, `linux-x64` and `kenso-<version>-windows-x64.zip`, with their `SHA256SUMS` and its signature `SHA256SUMS.sig` (0.1.184 and later). To check a list by hand, save the `SIGNERS` line of the install script, without its quotes, as `allowed_signers`, then run `ssh-keygen -Y verify -f allowed_signers -I kenso-cli-release -n file -s SHA256SUMS.sig < SHA256SUMS`. `https://downloads.ken.so/desktop/cli/latest.yml` names the newest version. The builds come out nightly and Homebrew follows them, so a command added that day reaches npm first.\n\n### Tab completion\n\nTab completes resources, actions and flags once you install the script for your shell. The script asks `kenso` for the candidates on each Tab, so it stays right as the CLI updates: install it once.\n\n```bash\n# zsh: add this line to ~/.zshrc\nsource <(kenso completion zsh)\n# bash: add this line to ~/.bashrc (on bash 3.2, the macOS default, use: eval "$(kenso completion bash)")\nsource <(kenso completion bash)\n# fish: save the script once\nkenso completion fish > ~/.config/fish/completions/kenso.fish\n```\n\n### Update notice\n\nWhen a newer version is out, `kenso` says so on stderr after the command\'s own output, at most once a week: `kenso 0.1.40 is out (you have 0.1.35): npm i -g kenso@latest`. It checks `registry.npmjs.org` at most once every 7 days and never delays a command by more than about a second. A standalone build checks `latest.yml` on `downloads.ken.so` instead and names its own update: the install script, or `brew upgrade kenso` when Homebrew installed it. It stays quiet in CI (`CI` set) and when stderr is not a terminal. Under a coding agent it asks nothing: it prints the line once per agent session, from the last check. Set `KENSO_NO_UPDATE_NOTIFIER=1` to turn it off.\n\n## 60-second quickstart\n\n1. Create an API key in app.ken.so at Settings > API keys.\n2. Save the key, pick a workspace, then plan and apply a CSV import:\n\n```bash\necho $KEY | kenso auth login --with-key\nkenso workspace list --search acme\nkenso workspace use 1234\nkenso campaigns list --limit 5\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\n`workspace list` and `workspace use` are only needed when your key reaches more than one workspace.\n\nThe dry run reads the file, maps the columns, checks every row, asks Kenso for a credit estimate, and writes nothing. It prints the plan, with the exact apply command in `next`:\n\n```json\n{"run":"r_tdi5cdnx","dryRun":true,"command":"contacts import","rows":4,"valid":2,"invalid":2,"chunks":1,"chunkSize":1000,"campaignId":812,"mapping":{"Email":"email","First Name":"firstName","Last Name":"lastName","Company":"companyName","Pain Point":"customVariables.pain_point"},"customVariableKeys":["pain_point"],"estimate":{"kind":"leads","totalMillicredits":2000,"availableMillicredits":500000,"sufficient":true},"credits":{"needed":2,"available":500,"sufficient":true},"next":"kenso contacts import --campaign 812 --file leads.csv --yes","plan":"/home/you/.kenso/runs/r_tdi5cdnx/plan.json","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv"}\n```\n\nThe apply sends the rows and prints one summary. Every input row has one line in `results.csv`:\n\n```json\n{"run":"r_tdi5cdnx","rows":4,"ok":0,"created":1,"updated":0,"skipped":{"duplicate":1},"failed":0,"notFound":0,"invalid":2,"changed":1,"results":"/home/you/.kenso/runs/r_tdi5cdnx/results.csv","resultsNdjson":"/home/you/.kenso/runs/r_tdi5cdnx/results.ndjson","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv","resumed":false,"durationMs":1840,"campaignId":812,"notSendable":0}\n```\n\nThis run exits 5 because two rows were invalid: open `invalid.csv` to see why, fix those rows, and import them again. Running the same command again is safe: an email that is already in the campaign comes back `updated` or `skipped`, never as a second lead.\n\n## CLI or MCP\n\n- **Use the CLI for volume:** anything that starts from a file, anything over about 50 records, anything you may need to rerun or resume. Records never pass through the model\'s context: the agent passes a file path and reads a short summary.\n- **Use the MCP for conversation and single records:** look up a campaign, draft a reply, read a report. The MCP is at `https://mcp.ken.so/mcp`, signs in with OAuth and needs no install ([connection guide](https://ken.so/mcp)).\n- **Both use the same API and the same permissions.** `kenso mcp call` reaches MCP-only tools, such as skills, from the shell.\n\n## Docs\n\nEvery page is in the package and prints offline with `kenso docs <topic>`.\n\n| Page | Topic | What it covers |\n|---|---|---|\n| [Authentication](auth.md) | `auth` | API keys, browser login, profiles, workspaces, `doctor` |\n| [Leads](leads.md) | `leads` | Import, update, remove, pause, tag and export leads, with recipes |\n| [Batch runs](batch.md) | `batch` | Dry run and apply, run folders, results files, resume, rate limits, `--each` |\n| [Output and errors](output-and-errors.md) | `output-and-errors` | The output contract, error JSON, error codes, exit codes, live streams |\n| [CRM (beta)](crm.md) | `crm` | Accounts, people, opportunities and CRM sync |\n| [Images (beta)](images.md) | `images` | Upload one image per lead into an image variable, from a folder or a CSV |\n| [Studio (beta)](studio.md) | `studio` | Pull, push, validate, preview and fill templates |\n| [Workflows (beta)](workflows.md) | `workflows` | Keep a workflow as a file: `kenso.json`, init, pull, check, push, test, publish, and run it on ids or a CSV with a credit cap |\n| [Agent work (beta)](work.md) | `work` | My agent: your own coding agent writes Kenso\'s AI work with `kenso work run`, or pull and submit |\n| [Social (beta)](social.md) | `social` | Posts, channels and the rest of Kenso Social |\n| [Webhooks](webhooks.md) | `webhooks` | Build a webhook handler locally: `kenso webhooks listen --forward-to`, `trigger`, the signature |\n| [Developer sandbox](sandbox.md) | `sandbox` | `kenso sandbox`: a workspace of your own where sends are simulated, its test key, the reserved test leads |\n| [Connect accounts](connect.md) | `connect` | `kenso connect`: an inbox, calendar, CRM, GitHub or other OAuth account, signed in by the person in a browser |\n| [Coding agents](agents.md) | `agents` | Claude Code, Codex, Cursor, the Agent Skill, environment variables, sandboxes |\n| Command reference | `reference` | Every command with its flags, generated from the CLI at build time: `kenso docs reference`, or `docs/reference.md` in the installed package |\n\n```bash\nkenso docs\nkenso docs leads\n```\n\nFor machine-readable help, run `kenso describe`: it prints every command, its flags and its body schema as JSON.\n';
|
|
10160
10160
|
}
|
|
10161
10161
|
});
|
|
10162
10162
|
|
|
@@ -10176,6 +10176,14 @@ var init_studio = __esm({
|
|
|
10176
10176
|
}
|
|
10177
10177
|
});
|
|
10178
10178
|
|
|
10179
|
+
// docs/social.md
|
|
10180
|
+
var social_default;
|
|
10181
|
+
var init_social = __esm({
|
|
10182
|
+
"docs/social.md"() {
|
|
10183
|
+
social_default = '# Social (beta)\n\nKenso Social is Kenso\'s content calendar: social posts, the blog, research, the changelog and the help center, on one calendar in the app. Every route of it is a command under `kenso social`. It is in beta: a workspace without the `social` feature gets a "not found" answer from the API, and `kenso social --help` hides its commands (`--all-commands` shows them).\n\n`kenso social <resource> <action>` is the same command as `kenso social-<resource> <action>`. The two differ only in the words you type: `kenso social posts list` runs `kenso social-posts list`.\n\n| Command | What it does |\n|---|---|\n| `social channels list` | List channels |\n| `social channels get <channelId>` | Get a channel |\n| `social channels create` | Create an internal channel |\n| `social posts list` | List posts |\n| `social posts get <postId>` | Get a post |\n| `social posts create` | Create a post |\n| `social posts update <postId>` | Update a post |\n| `social posts delete <postId>` | Delete a post |\n| `social posts schedule <postId>` | Schedule a post |\n| `social posts approve <postId>` | Approve a post |\n\n## Examples\n\n```bash\nkenso social channels list\nkenso social posts list\nkenso social posts get <postId>\nkenso social posts create --title "Launch notes" --body-markdown "Kenso Social is live." --needs-review\nkenso social posts approve <postId>\nkenso social posts schedule <postId> --dry-run\n```\n\nRun `kenso social posts create --help` for the flags of a command, and `kenso describe social-posts create` for the full JSON body.\n\n## What only a person can do\n\nPublishing a help article or its pending changes, publishing a changelog entry, changing a help topic that has published articles, and sending the changelog email (test or real) need a person signed in to the app. With an API key the API answers 403 with a message that says so (detail code `api_key_not_allowed`). You can still draft each of them from the CLI.\n\nNew Social resources (media, analytics, comments, help topics, revisions, the changelog email) join `kenso social` on their own when their routes ship: `kenso social --help` lists what your CLI version has.\n';
|
|
10184
|
+
}
|
|
10185
|
+
});
|
|
10186
|
+
|
|
10179
10187
|
// docs/webhooks.md
|
|
10180
10188
|
var webhooks_default;
|
|
10181
10189
|
var init_webhooks = __esm({
|
|
@@ -10238,6 +10246,7 @@ var init_embedded = __esm({
|
|
|
10238
10246
|
init_README();
|
|
10239
10247
|
init_sandbox();
|
|
10240
10248
|
init_studio();
|
|
10249
|
+
init_social();
|
|
10241
10250
|
init_webhooks();
|
|
10242
10251
|
init_work();
|
|
10243
10252
|
init_workflows();
|
|
@@ -10254,6 +10263,7 @@ var init_embedded = __esm({
|
|
|
10254
10263
|
"studio.md": studio_default,
|
|
10255
10264
|
"workflows.md": workflows_default,
|
|
10256
10265
|
"work.md": work_default,
|
|
10266
|
+
"social.md": social_default,
|
|
10257
10267
|
"webhooks.md": webhooks_default,
|
|
10258
10268
|
"sandbox.md": sandbox_default,
|
|
10259
10269
|
"connect.md": connect_default,
|
|
@@ -15322,6 +15332,7 @@ var init_content = __esm({
|
|
|
15322
15332
|
{ topic: "studio", file: "studio.md", title: "Studio (beta)", description: "Pull, push, validate, preview and fill templates" },
|
|
15323
15333
|
{ topic: "workflows", file: "workflows.md", title: "Workflows (beta)", description: "Keep a workflow as a file: kenso.json, init, pull, check, push, test, publish, and run it on ids or a CSV with a credit cap" },
|
|
15324
15334
|
{ topic: "work", file: "work.md", title: "Agent work (beta)", description: "My agent: your own coding agent writes Kenso AI work with kenso work run, or pull and submit" },
|
|
15335
|
+
{ topic: "social", file: "social.md", title: "Social (beta)", description: "Posts, channels and the rest of Kenso Social: kenso social <resource> <action>" },
|
|
15325
15336
|
{ topic: "webhooks", file: "webhooks.md", title: "Webhooks", description: "Build a webhook handler locally: kenso webhooks listen --forward-to, trigger, the signature" },
|
|
15326
15337
|
{ topic: "sandbox", file: "sandbox.md", title: "Developer sandbox", description: "kenso sandbox: a workspace of your own where sends are simulated, its test key, the reserved test leads" },
|
|
15327
15338
|
{ topic: "connect", file: "connect.md", title: "Connect accounts", description: "kenso connect: an inbox, calendar, CRM, GitHub or other OAuth account, signed in by the person in a browser" },
|
|
@@ -26046,6 +26057,8 @@ var init_workspace = __esm({
|
|
|
26046
26057
|
// src/commands/registry.ts
|
|
26047
26058
|
var registry_exports = {};
|
|
26048
26059
|
__export(registry_exports, {
|
|
26060
|
+
commandGroups: () => commandGroups,
|
|
26061
|
+
groupMembers: () => groupMembers,
|
|
26049
26062
|
handWritten: () => handWritten,
|
|
26050
26063
|
registerForTest: () => registerForTest,
|
|
26051
26064
|
resourceAliases: () => resourceAliases
|
|
@@ -26058,6 +26071,17 @@ function topLevel(name, load2, of) {
|
|
|
26058
26071
|
}
|
|
26059
26072
|
};
|
|
26060
26073
|
}
|
|
26074
|
+
function groupMembers(group, operations) {
|
|
26075
|
+
const prefix = commandGroups[group];
|
|
26076
|
+
const members = /* @__PURE__ */ new Map();
|
|
26077
|
+
if (prefix === void 0) return members;
|
|
26078
|
+
for (const op of operations) {
|
|
26079
|
+
if (!op.path.startsWith(prefix)) continue;
|
|
26080
|
+
const word = op.resource.startsWith(`${group}-`) ? op.resource.slice(group.length + 1) : op.resource;
|
|
26081
|
+
members.set(word, op.resource);
|
|
26082
|
+
}
|
|
26083
|
+
return members;
|
|
26084
|
+
}
|
|
26061
26085
|
function registerForTest(resource, action, loader) {
|
|
26062
26086
|
const area = handWritten[resource] ??= {};
|
|
26063
26087
|
const previous = area[action];
|
|
@@ -26067,7 +26091,7 @@ function registerForTest(resource, action, loader) {
|
|
|
26067
26091
|
else delete area[action];
|
|
26068
26092
|
};
|
|
26069
26093
|
}
|
|
26070
|
-
var handWritten, resourceAliases;
|
|
26094
|
+
var handWritten, resourceAliases, commandGroups;
|
|
26071
26095
|
var init_registry = __esm({
|
|
26072
26096
|
"src/commands/registry.ts"() {
|
|
26073
26097
|
"use strict";
|
|
@@ -26155,6 +26179,7 @@ var init_registry = __esm({
|
|
|
26155
26179
|
workspace: actions39
|
|
26156
26180
|
};
|
|
26157
26181
|
resourceAliases = { leads: "contacts" };
|
|
26182
|
+
commandGroups = { social: "/v1/social/" };
|
|
26158
26183
|
}
|
|
26159
26184
|
});
|
|
26160
26185
|
|
|
@@ -26455,24 +26480,48 @@ No --dry-run: this command runs for real, so --dry-run is refused.`;
|
|
|
26455
26480
|
}
|
|
26456
26481
|
});
|
|
26457
26482
|
|
|
26458
|
-
// src/
|
|
26459
|
-
function
|
|
26460
|
-
|
|
26461
|
-
|
|
26462
|
-
|
|
26463
|
-
|
|
26464
|
-
|
|
26465
|
-
|
|
26466
|
-
|
|
26467
|
-
throw err;
|
|
26468
|
-
});
|
|
26483
|
+
// src/commands/groups.ts
|
|
26484
|
+
async function expandGroup(tokens) {
|
|
26485
|
+
const typed = [tokens[0]];
|
|
26486
|
+
if (commandGroups[tokens[0]] === void 0 || tokens[1] === void 0) return { typed, tokens };
|
|
26487
|
+
const { listOperations: listOperations2 } = await Promise.resolve().then(() => (init_manifest(), manifest_exports));
|
|
26488
|
+
const member = groupMembers(tokens[0], listOperations2()).get(tokens[1]);
|
|
26489
|
+
if (member === void 0) return { typed, tokens };
|
|
26490
|
+
const spelled = tokens.slice(0, 2);
|
|
26491
|
+
return { typed: spelled, tokens: [member, ...tokens.slice(2)], spelled };
|
|
26469
26492
|
}
|
|
26470
|
-
|
|
26471
|
-
|
|
26472
|
-
|
|
26493
|
+
function spellAs(text5, spelled, resource) {
|
|
26494
|
+
return spelled ? text5.replaceAll(`kenso ${resource} `, `kenso ${spelled.join(" ")} `) : text5;
|
|
26495
|
+
}
|
|
26496
|
+
async function renderGroupHelp(group, opts) {
|
|
26497
|
+
if (commandGroups[group] === void 0) return null;
|
|
26498
|
+
const { listOperations: listOperations2 } = await Promise.resolve().then(() => (init_manifest(), manifest_exports));
|
|
26499
|
+
const members = groupMembers(group, listOperations2());
|
|
26500
|
+
if (members.size === 0) return null;
|
|
26501
|
+
const listed = await listGenerated({ features: opts.allCommands ? [] : lazyFeatures(opts), env: opts.env });
|
|
26502
|
+
const resources2 = new Set(members.values());
|
|
26503
|
+
const inGroup = listed.filter((g) => resources2.has(g.resource));
|
|
26504
|
+
const visible = inGroup.filter((g) => opts.allCommands || !g.beta);
|
|
26505
|
+
const shown = visible.length > 0 ? visible : inGroup;
|
|
26506
|
+
const rows = [...members].sort(([a], [b]) => a.localeCompare(b)).map(([word, resource]) => {
|
|
26507
|
+
const actions41 = shown.filter((g) => g.resource === resource).map((g) => `${g.action}${g.beta ? " (beta)" : ""}`);
|
|
26508
|
+
return [word, actions41.sort().join(", ")];
|
|
26509
|
+
}).filter(([, actions41]) => actions41.length > 0);
|
|
26510
|
+
const lines = [`Usage: kenso ${group} <resource> <action> [flags]`, "", "Resources:", columns(rows)];
|
|
26511
|
+
const hidden = inGroup.length - visible.length;
|
|
26512
|
+
if (visible.length > 0 && hidden > 0) {
|
|
26513
|
+
lines.push("", `${hidden} beta actions are hidden for this workspace (they still run; the server decides): kenso ${group} --all-commands.`);
|
|
26514
|
+
}
|
|
26515
|
+
lines.push("", `Run kenso ${group} <resource> --help for a resource's actions.`);
|
|
26516
|
+
return withAgentBlock(lines.join("\n"), opts);
|
|
26517
|
+
}
|
|
26518
|
+
var init_groups = __esm({
|
|
26519
|
+
"src/commands/groups.ts"() {
|
|
26473
26520
|
"use strict";
|
|
26474
|
-
|
|
26475
|
-
|
|
26521
|
+
init_generated_hook();
|
|
26522
|
+
init_help_agent();
|
|
26523
|
+
init_help();
|
|
26524
|
+
init_registry();
|
|
26476
26525
|
}
|
|
26477
26526
|
});
|
|
26478
26527
|
|
|
@@ -26555,6 +26604,69 @@ var init_flag_names = __esm({
|
|
|
26555
26604
|
}
|
|
26556
26605
|
});
|
|
26557
26606
|
|
|
26607
|
+
// src/commands/unknown-command.ts
|
|
26608
|
+
async function knownCommands() {
|
|
26609
|
+
const commands = /* @__PURE__ */ new Set();
|
|
26610
|
+
for (const [resource, area] of Object.entries(handWritten)) {
|
|
26611
|
+
const actions41 = Object.keys(area);
|
|
26612
|
+
if (actions41.length > 0) commands.add(resource);
|
|
26613
|
+
for (const action of actions41) commands.add(action ? `${resource} ${action}` : resource);
|
|
26614
|
+
}
|
|
26615
|
+
for (const g of await listGenerated({ features: [] })) {
|
|
26616
|
+
commands.add(g.resource);
|
|
26617
|
+
commands.add(`${g.resource} ${g.action}`);
|
|
26618
|
+
}
|
|
26619
|
+
return commands;
|
|
26620
|
+
}
|
|
26621
|
+
async function unknownCommand(tokens, resource, spelled) {
|
|
26622
|
+
const typed = [resource, ...tokens.slice(1)].join(" ");
|
|
26623
|
+
const all = await knownCommands();
|
|
26624
|
+
const scoped = tokens.length > 1 && all.has(resource) ? [...all].filter((c) => c.startsWith(`${resource} `)) : [...all];
|
|
26625
|
+
const asAction = all.has(resource) ? [] : [...all].filter((c) => c.endsWith(` ${resource}`));
|
|
26626
|
+
const best = asAction.length === 1 ? asAction[0] : closest(typed, scoped);
|
|
26627
|
+
const related = all.has(resource) ? [] : [...all].filter((c) => !c.includes(" ") && c !== best && (c.includes(resource) || c.length >= 4 && resource.includes(c))).sort().slice(0, 6);
|
|
26628
|
+
const spelledBest = spelled && best?.startsWith(`${resource} `) ? [...spelled, best.slice(resource.length + 1)].join(" ") : best;
|
|
26629
|
+
const hints = [spelledBest ? `did you mean "kenso ${spelledBest}"?` : "", related.length ? `Resources named like it: ${related.join(", ")}.` : ""];
|
|
26630
|
+
return new KensoError({
|
|
26631
|
+
code: "unknown_command",
|
|
26632
|
+
message: `Unknown command "kenso ${(spelled ? [...spelled, ...tokens.slice(1)] : tokens).join(" ")}".`,
|
|
26633
|
+
exitCode: ExitCode.Usage,
|
|
26634
|
+
hint: hints.filter(Boolean).join(" ") || "Run kenso --help to list the commands.",
|
|
26635
|
+
next: "kenso --help"
|
|
26636
|
+
});
|
|
26637
|
+
}
|
|
26638
|
+
var init_unknown_command = __esm({
|
|
26639
|
+
"src/commands/unknown-command.ts"() {
|
|
26640
|
+
"use strict";
|
|
26641
|
+
init_errors();
|
|
26642
|
+
init_exit_codes();
|
|
26643
|
+
init_flag_names();
|
|
26644
|
+
init_generated_hook();
|
|
26645
|
+
init_registry();
|
|
26646
|
+
}
|
|
26647
|
+
});
|
|
26648
|
+
|
|
26649
|
+
// src/core/closed-pipe.ts
|
|
26650
|
+
function guardClosedPipe(stream) {
|
|
26651
|
+
if (guardedStreams.has(stream)) return;
|
|
26652
|
+
guardedStreams.add(stream);
|
|
26653
|
+
stream.on("error", (err) => {
|
|
26654
|
+
if (err.code === "EPIPE") {
|
|
26655
|
+
process.exit(ExitCode.Ok);
|
|
26656
|
+
return;
|
|
26657
|
+
}
|
|
26658
|
+
throw err;
|
|
26659
|
+
});
|
|
26660
|
+
}
|
|
26661
|
+
var guardedStreams;
|
|
26662
|
+
var init_closed_pipe = __esm({
|
|
26663
|
+
"src/core/closed-pipe.ts"() {
|
|
26664
|
+
"use strict";
|
|
26665
|
+
init_exit_codes();
|
|
26666
|
+
guardedStreams = /* @__PURE__ */ new WeakSet();
|
|
26667
|
+
}
|
|
26668
|
+
});
|
|
26669
|
+
|
|
26558
26670
|
// src/core/invoked.ts
|
|
26559
26671
|
import { realpathSync } from "node:fs";
|
|
26560
26672
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
@@ -26814,7 +26926,14 @@ function flagsOf2(spec, globals, commandless) {
|
|
|
26814
26926
|
const global = Object.keys(globals).filter((name) => commandless || name !== "version" && (name !== "dry-run" || spec?.dryRun === true));
|
|
26815
26927
|
return sorted([...Object.keys(spec?.flags ?? {}), ...global].map((name) => `--${name}`));
|
|
26816
26928
|
}
|
|
26817
|
-
async function completions(
|
|
26929
|
+
async function completions(typedWords, globals) {
|
|
26930
|
+
let words2 = typedWords;
|
|
26931
|
+
if (commandGroups[words2[0] ?? ""] !== void 0 && words2.length > 1) {
|
|
26932
|
+
const members = groupMembers(words2[0], listOperations());
|
|
26933
|
+
if (words2.length === 2) return sorted(members.keys());
|
|
26934
|
+
const member = members.get(words2[1]);
|
|
26935
|
+
if (member !== void 0) words2 = [member, ...words2.slice(2)];
|
|
26936
|
+
}
|
|
26818
26937
|
const current = words2.at(-1) ?? "";
|
|
26819
26938
|
const positionals = [];
|
|
26820
26939
|
let spec;
|
|
@@ -26923,35 +27042,6 @@ function leaveRun(active) {
|
|
|
26923
27042
|
graceTimer = void 0;
|
|
26924
27043
|
}
|
|
26925
27044
|
}
|
|
26926
|
-
async function knownCommands() {
|
|
26927
|
-
const commands = /* @__PURE__ */ new Set();
|
|
26928
|
-
for (const [resource, area] of Object.entries(handWritten)) {
|
|
26929
|
-
const actions41 = Object.keys(area);
|
|
26930
|
-
if (actions41.length > 0) commands.add(resource);
|
|
26931
|
-
for (const action of actions41) commands.add(action ? `${resource} ${action}` : resource);
|
|
26932
|
-
}
|
|
26933
|
-
for (const g of await listGenerated({ features: [] })) {
|
|
26934
|
-
commands.add(g.resource);
|
|
26935
|
-
commands.add(`${g.resource} ${g.action}`);
|
|
26936
|
-
}
|
|
26937
|
-
return commands;
|
|
26938
|
-
}
|
|
26939
|
-
async function unknownCommand(tokens, resource) {
|
|
26940
|
-
const typed = [resource, ...tokens.slice(1)].join(" ");
|
|
26941
|
-
const all = await knownCommands();
|
|
26942
|
-
const scoped = tokens.length > 1 && all.has(resource) ? [...all].filter((c) => c.startsWith(`${resource} `)) : [...all];
|
|
26943
|
-
const asAction = all.has(resource) ? [] : [...all].filter((c) => c.endsWith(` ${resource}`));
|
|
26944
|
-
const best = asAction.length === 1 ? asAction[0] : closest(typed, scoped);
|
|
26945
|
-
const related = all.has(resource) ? [] : [...all].filter((c) => !c.includes(" ") && c !== best && (c.includes(resource) || c.length >= 4 && resource.includes(c))).sort().slice(0, 6);
|
|
26946
|
-
const hints = [best ? `did you mean "kenso ${best}"?` : "", related.length ? `Resources named like it: ${related.join(", ")}.` : ""];
|
|
26947
|
-
return new KensoError({
|
|
26948
|
-
code: "unknown_command",
|
|
26949
|
-
message: `Unknown command "kenso ${tokens.join(" ")}".`,
|
|
26950
|
-
exitCode: ExitCode.Usage,
|
|
26951
|
-
hint: hints.filter(Boolean).join(" ") || "Run kenso --help to list the commands.",
|
|
26952
|
-
next: "kenso --help"
|
|
26953
|
-
});
|
|
26954
|
-
}
|
|
26955
27045
|
function versionHint(spec) {
|
|
26956
27046
|
const own = Object.keys(spec.flags).filter((name) => name.includes("version") && !name.startsWith("no-"));
|
|
26957
27047
|
const cli = "--version prints the CLI version, and only on its own: kenso --version.";
|
|
@@ -27121,6 +27211,8 @@ async function main(argv, env = process.env, overrides2 = {}) {
|
|
|
27121
27211
|
stdout.write(await renderTopHelp(helpOptions));
|
|
27122
27212
|
return ExitCode.Ok;
|
|
27123
27213
|
}
|
|
27214
|
+
const group = await expandGroup(tokens);
|
|
27215
|
+
tokens = group.tokens;
|
|
27124
27216
|
const resourceToken = tokens[0];
|
|
27125
27217
|
const resource = resourceAliases[resourceToken] ?? resourceToken;
|
|
27126
27218
|
const area = handWritten[resource] ?? {};
|
|
@@ -27129,19 +27221,19 @@ async function main(argv, env = process.env, overrides2 = {}) {
|
|
|
27129
27221
|
const self = area[""];
|
|
27130
27222
|
if (self) {
|
|
27131
27223
|
spec = await self();
|
|
27132
|
-
commandTokens =
|
|
27224
|
+
commandTokens = group.typed;
|
|
27133
27225
|
} else {
|
|
27134
27226
|
const actionToken = tokens[1];
|
|
27135
27227
|
if (actionToken === void 0) {
|
|
27136
|
-
const help = await renderResourceHelp(resource, { ...helpOptions, listHiddenWhenEmpty: wantHelp });
|
|
27137
|
-
if (!help) throw await unknownCommand([resourceToken], resource);
|
|
27138
|
-
stdout.write(help);
|
|
27228
|
+
const help = await renderResourceHelp(resource, { ...helpOptions, listHiddenWhenEmpty: wantHelp }) ?? (group.typed.length === 1 ? await renderGroupHelp(resource, helpOptions) : null);
|
|
27229
|
+
if (!help) throw await unknownCommand([resourceToken], resource, group.spelled);
|
|
27230
|
+
stdout.write(spellAs(help, group.spelled, resource));
|
|
27139
27231
|
return ExitCode.Ok;
|
|
27140
27232
|
}
|
|
27141
27233
|
const loader = area[actionToken];
|
|
27142
27234
|
spec = loader ? await loader() : await resolveGenerated(resource, actionToken);
|
|
27143
|
-
if (!spec) throw await unknownCommand([resourceToken, actionToken], resource);
|
|
27144
|
-
commandTokens = [
|
|
27235
|
+
if (!spec) throw await unknownCommand([resourceToken, actionToken], resource, group.spelled);
|
|
27236
|
+
commandTokens = [...group.typed, actionToken];
|
|
27145
27237
|
}
|
|
27146
27238
|
if (wantHelp) {
|
|
27147
27239
|
const rateCards = spec.cost?.length ? await rateCardsForHelp(env, lookupFlags, lookupOverrides) : void 0;
|
|
@@ -27187,9 +27279,11 @@ var GLOBAL_OPTIONS, INTERRUPT_GRACE_MS, GLOBAL_BOOLEANS, COMMAND_GLOBAL_OPTIONS,
|
|
|
27187
27279
|
var init_main = __esm({
|
|
27188
27280
|
"src/main.ts"() {
|
|
27189
27281
|
init_generated_hook();
|
|
27282
|
+
init_groups();
|
|
27190
27283
|
init_help();
|
|
27191
27284
|
init_registry();
|
|
27192
27285
|
init_state2();
|
|
27286
|
+
init_unknown_command();
|
|
27193
27287
|
init_agent();
|
|
27194
27288
|
init_closed_pipe();
|
|
27195
27289
|
init_context();
|