kenso 0.1.35 → 0.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/kenso.js CHANGED
@@ -2409,7 +2409,7 @@ var VERSION;
2409
2409
  var init_version = __esm({
2410
2410
  "src/core/version.ts"() {
2411
2411
  "use strict";
2412
- VERSION = true ? "0.1.35" : "0.0.0-dev";
2412
+ VERSION = true ? "0.1.37" : "0.0.0-dev";
2413
2413
  }
2414
2414
  });
2415
2415
 
@@ -6607,6 +6607,7 @@ ${api}` : api,
6607
6607
  helpFooter: footer,
6608
6608
  ...op.featureGates ? { beta: { featureGates: op.featureGates } } : {},
6609
6609
  operationIds: [op.id],
6610
+ dryRun: true,
6610
6611
  run: (ctx, args) => runOperation(ctx, op, args.flags)
6611
6612
  };
6612
6613
  }
@@ -6973,6 +6974,7 @@ var init_import = __esm({
6973
6974
  examples: ["kenso accounts import --file accounts.csv --dry-run", "kenso accounts import --file accounts.csv --yes"],
6974
6975
  beta: { featureGates: { all: ["accounts"] } },
6975
6976
  operationIds: ["accounts.bulk-create", "credit-estimates.create"],
6977
+ dryRun: true,
6976
6978
  async run(ctx, args) {
6977
6979
  const { flags } = args;
6978
6980
  const concurrency2 = concurrencyOf(flags.concurrency);
@@ -7065,7 +7067,7 @@ var init_api3 = __esm({
7065
7067
  action: "",
7066
7068
  summary: "Call any API route, only when no command fits",
7067
7069
  brief: "only when no command fits",
7068
- description: "The raw escape hatch: sends Authorization, Ken-Version: 1.1 and X-Ken-Workspace-Id, prints the full JSON body. The path may carry a query string. --all (GET only) follows pagination.nextCursor and prints the data[] items as a list. Writes run without --yes.",
7070
+ description: "The raw escape hatch: sends Authorization, Ken-Version: 1.1 and X-Ken-Workspace-Id, prints the full JSON body. The path may carry a query string. --all (GET only) follows pagination.nextCursor and prints the data[] items as a list. Writes run without --yes. --dry-run prints the request (method, path, body) and sends nothing.",
7069
7071
  flags: {
7070
7072
  data: { type: "string", description: "Request body: inline JSON, @file or - for stdin" },
7071
7073
  all: { type: "boolean", description: "GET only: follow every page and print the data[] items" },
@@ -7079,8 +7081,10 @@ var init_api3 = __esm({
7079
7081
  "kenso api GET /v1/me",
7080
7082
  "kenso api GET '/v1/campaigns?limit=200' --all --output ids",
7081
7083
  `kenso api PATCH /v1/campaigns/123 --data '{"name":"Q4 outbound"}'`,
7082
- "kenso api POST /v1/tags --data @tag.json"
7084
+ "kenso api POST /v1/tags --data @tag.json",
7085
+ "kenso api DELETE /v1/tags/7 --dry-run"
7083
7086
  ],
7087
+ dryRun: true,
7084
7088
  async run(ctx, { flags, positionals }) {
7085
7089
  const method = (positionals[0] ?? "").toUpperCase();
7086
7090
  if (!METHODS.includes(method)) {
@@ -7094,6 +7098,10 @@ var init_api3 = __esm({
7094
7098
  }
7095
7099
  const body = typeof flags.data === "string" ? await readDataArg(flags.data, ctx.stdin) : void 0;
7096
7100
  const noWorkspace = flags["no-workspace"] === true;
7101
+ if (ctx.flags.dryRun) {
7102
+ ctx.output.object({ dryRun: true, request: { method, path, ...body !== void 0 ? { body } : {} } });
7103
+ return ExitCode.Ok;
7104
+ }
7097
7105
  if (all) {
7098
7106
  await ctx.output.list(ctx.client.paginate({ method, path, noWorkspace, signal: ctx.signal }));
7099
7107
  return ExitCode.Ok;
@@ -8515,6 +8523,7 @@ var init_import2 = __esm({
8515
8523
  "kenso contacts import --campaign 812 --file big.csv --server-import --yes"
8516
8524
  ],
8517
8525
  operationIds: ["contacts.create", "campaigns.get", "credit-estimates.create", "contact-imports.create", "jobs.get"],
8526
+ dryRun: true,
8518
8527
  async run(ctx, { flags }) {
8519
8528
  if (flags.template === true) {
8520
8529
  ctx.output.object(template());
@@ -8721,6 +8730,7 @@ var init_update = __esm({
8721
8730
  "printf 'id,title\\n9001,VP Sales\\n' | kenso contacts update --file - --match id --dry-run # one lead"
8722
8731
  ],
8723
8732
  operationIds: ["contacts.bulk-update", "contacts.list"],
8733
+ dryRun: true,
8724
8734
  async run(ctx, { flags }) {
8725
8735
  const file = requireFlag(flags, "file", COMMAND3);
8726
8736
  const match = requireFlag(flags, "match", COMMAND3, "Use --match id or --match email --campaign <id>.");
@@ -8997,6 +9007,7 @@ function bulkCommand(kind) {
8997
9007
  ],
8998
9008
  ...kind === "pause" ? { beta: { featureGates: { all: ["pause_leads"] } } } : {},
8999
9009
  operationIds: kind === "restore" ? [route.operationId] : [route.operationId, "contacts.search"],
9010
+ dryRun: true,
9000
9011
  async run(ctx, { flags: given }) {
9001
9012
  const dryRun2 = isDryRun(ctx);
9002
9013
  const collected = await collectIds(ctx, given, kind, dryRun2);
@@ -9144,6 +9155,7 @@ function tagCommand(kind) {
9144
9155
  },
9145
9156
  examples: [`kenso contacts ${kind} --tag 31 --ids ids.txt --dry-run`, `kenso contacts ${kind} --tag 31 --ids ids.txt --yes`],
9146
9157
  operationIds: [kind === "tag" ? "tags.assign" : "tags.unassign"],
9158
+ dryRun: true,
9147
9159
  async run(ctx, { flags }) {
9148
9160
  const tagId = idFlag(flags, "tag", name);
9149
9161
  const collected = await idsFromFile(ctx, requireFlag(flags, "ids", name, "Pass a file of contact ids, or - for stdin."));
@@ -9420,7 +9432,9 @@ function detailOf(entry) {
9420
9432
  body: body ? { format: body.format, ...body.schema !== void 0 ? { schema: body.schema } : {}, ...body.schemaTruncated ? { schemaTruncated: true } : {} } : null,
9421
9433
  list: op?.list ?? false,
9422
9434
  examples: entry.op ? operationExamples(entry.op) : spec?.examples ?? [],
9423
- beta: entry.gates !== void 0
9435
+ beta: entry.gates !== void 0,
9436
+ // Every generated command previews with --dry-run; a hand-written one only when it says so (main refuses the rest).
9437
+ dryRun: entry.op !== void 0 || spec?.dryRun === true
9424
9438
  };
9425
9439
  if (entry.gates) out.featureGates = entry.gates;
9426
9440
  return out;
@@ -9507,7 +9521,7 @@ var init_describe2 = __esm({
9507
9521
  var agents_default;
9508
9522
  var init_agents = __esm({
9509
9523
  "docs/agents.md"() {
9510
- agents_default = '# Coding agents\n\nThe CLI is built to be driven by a coding agent: Claude Code, Codex, Cursor, Gemini CLI or anything else that runs shell commands. An agent learns it from the Agent Skill, `kenso --help` and `kenso describe`, and never needs these web pages.\n\n## Set up an agent in three steps\n\n1. Install the CLI where the agent runs: `npm i -g kenso` (Node 22 or newer).\n2. Give it a key. Either set `KENSO_API_KEY` (and `KENSO_WORKSPACE_ID` when the key reaches several workspaces) in the agent\'s environment, or log in once on that machine:\n\n```bash\necho $KEY | kenso auth login --with-key\nkenso workspace use 1234\n```\n\n3. Install the Agent Skill, so the agent knows the rules before its first command:\n\n```bash\nkenso skill install\n```\n\n## The Agent Skill\n\n`kenso skill install` writes the skill `kenso-cli` (one `SKILL.md`) where each agent looks for skills:\n\n| Agent | `--client` | Folder |\n|---|---|---|\n| Claude Code | `claude-code` | `~/.claude/skills/kenso-cli/` |\n| Codex | `codex` | `~/.agents/skills/kenso-cli/` |\n| Cursor | `cursor` | `~/.cursor/skills/kenso-cli/` |\n\nWithout `--client`, it installs for the agent that runs it when that is Claude Code, Codex or Cursor (detected from the environment, see below), else for all three. It prints what it wrote:\n\n```json\n{"installed":[{"client":"claude-code","path":"/home/you/.claude/skills/kenso-cli/SKILL.md","status":"created"}]}\n```\n\n```bash\nkenso skill install --client claude-code\nkenso skill install --client all\nkenso skill install --dir .claude/skills/kenso-cli\nkenso skill install --force\n```\n\n- `--dir` writes the skill into that folder instead, for example a project\'s own skills folder. Name the folder `kenso-cli`, as agents expect the folder to match the skill name.\n- A different `SKILL.md` already in a target folder is replaced only with `--force`; without it the command exits 7, writes nothing, and its `next` adds `--force`. The same file is left alone (`"status":"unchanged"`).\n- `--dry-run` writes nothing and exits 0. It prints each target\'s status (`replaced` marks a different file there) and a `next` that applies it, with `--force` when a file would be replaced.\n- Cursor also reads `~/.claude/skills/` and `~/.agents/skills/`, so after a default install for all three it may list `kenso-cli` more than once. To avoid that, install with `--client cursor` only, or remove the copies you do not need.\n\nThe skill also ships in the Kenso plugin for Claude Code (`Ken-Technology/ken-ai-plugin`), so `npx skills add Ken-Technology/ken-ai-plugin` installs it along with the MCP skills. To read it without installing, open `skill/kenso-cli/SKILL.md` in the package.\n\n## Rules the skill teaches\n\n- **Data is on stdout, as JSON when piped.** Progress, warnings and errors are on stderr. Parse stdout; read stderr when the exit code is not 0.\n- **Plan, then apply.** Run a write with `--dry-run`, read the plan, then run the exact command in its `next` (the same command with `--yes`).\n- **Pass files, not rows.** Never paste a CSV into the conversation. Write the file, pass its path with `--file`, and read the summary.\n- **Read failures only.** If the summary\'s `failed`, `notFound` and `invalid` are 0, the work is done. Otherwise read just the problem rows from `results.csv` or `invalid.csv`.\n- **Follow `next`.** Every error with a known fix carries the exact command to run.\n- **Branch on the exit code:** 0 ok, 2 fix the command, 3 fix the key, 5 some rows failed, 6 wait or raise a limit, 130 resume.\n- **Look things up, do not guess.** `kenso describe <resource> <action>` prints any command\'s flags and body schema as JSON.\n\n## The token-saving pattern\n\nAdding 5,000 leads through the MCP sends every lead through the model, hundreds of thousands of tokens. Through the CLI it is two commands and two short JSON objects:\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\nThen, only if the summary shows failures:\n\n```bash\ngrep -E \'^[0-9]+,(failed|not_found|invalid),\' ~/.kenso/runs/r_tdi5cdnx/results.csv | head -50\n```\n\n## Environment variables\n\n| Variable | What it does |\n|---|---|\n| `KENSO_API_KEY` | The API key. Wins over any saved profile |\n| `KENSO_WORKSPACE_ID` | The workspace for every command. `--workspace` wins over it |\n| `KENSO_PROFILE` | The saved profile to use. `--profile` wins over it |\n| `KENSO_API_URL` | The API, default `https://api.ken.so` |\n| `KENSO_CONFIG_DIR` | Where the config file and cache live, default `~/.kenso` |\n| `KENSO_RUNS_DIR` | Where run folders live, default `<config dir>/runs` |\n| `KENSO_MCP_URL` | The MCP for `kenso mcp`, default `https://mcp.ken.so/mcp` |\n\n## Cloud sandboxes\n\nCloud agents (Claude Code on the web, Codex cloud, Cursor background agents and similar) often run with a network allowlist. Allow:\n\n- `api.ken.so`: every command\n- `mcp.ken.so`: only `kenso mcp tools` and `kenso mcp call`\n- `registry.npmjs.org`: to install the CLI with npm\n\nStore the key as the platform\'s secret and expose it as `KENSO_API_KEY`. Run `kenso doctor` as the first command: it checks Node, the config, that the API is reachable and that the key works, and exits 0 when all four pass.\n\n```bash\nkenso doctor\n```\n\nPoint the run folders at the workspace if the home folder does not persist between sessions: `KENSO_RUNS_DIR=./.kenso-runs`. Keep that folder out of git.\n\n## How Kenso knows an agent ran a command\n\nThe CLI checks these environment variables, in this order: `CLAUDECODE` and `CLAUDE_CODE_ENTRYPOINT` (Claude Code), `CODEX_SANDBOX` and `CODEX_THREAD_ID` (Codex), `CURSOR_AGENT` (Cursor), `GEMINI_CLI` (Gemini CLI), `OPENCODE` (OpenCode), then `AI_AGENT`, a free-form name any other agent can set. When one is set:\n\n- every request carries `X-Ken-Client: Kenso CLI via <agent>`, and writes carry `X-Ken-Actor: agent`, so Kenso shows the change as made by you through that agent;\n- help ends with a short "For agents" block;\n- browser login never opens a browser itself: it prints the link for you to open.\n\n`kenso doctor` shows the agent it detected.\n\n## MCP-only tools\n\nA few Kenso MCP tools have no API route, such as the skills Kenso\'s own agents use. Reach them from the shell with the same key:\n\n```bash\nkenso mcp tools\nkenso mcp call list_skills\nkenso mcp call load_skill --args \'{"name":"create-campaign"}\'\nkenso mcp call contacts --operation list --args \'{"limit":5}\'\n```\n\n`mcp call` prints the tool\'s structured result, else its text parsed as JSON, else the text. A tool error exits 1 with `mcp_tool_error`.\n';
9524
+ agents_default = '# Coding agents\n\nThe CLI is built to be driven by a coding agent: Claude Code, Codex, Cursor, Gemini CLI or anything else that runs shell commands. An agent learns it from the Agent Skill, `kenso --help` and `kenso describe`, and never needs these web pages.\n\n## Set up an agent in three steps\n\n1. Install the CLI where the agent runs: `npm i -g kenso` (Node 22 or newer).\n2. Give it a key. Either set `KENSO_API_KEY` (and `KENSO_WORKSPACE_ID` when the key reaches several workspaces) in the agent\'s environment, or log in once on that machine:\n\n```bash\necho $KEY | kenso auth login --with-key\nkenso workspace use 1234\n```\n\n3. Install the Agent Skill, so the agent knows the rules before its first command:\n\n```bash\nkenso skill install\n```\n\n## The Agent Skill\n\n`kenso skill install` writes the skill `kenso-cli` (one `SKILL.md`) where each agent looks for skills:\n\n| Agent | `--client` | Folder |\n|---|---|---|\n| Claude Code | `claude-code` | `~/.claude/skills/kenso-cli/` |\n| Codex | `codex` | `~/.agents/skills/kenso-cli/` |\n| Cursor | `cursor` | `~/.cursor/skills/kenso-cli/` |\n\nWithout `--client`, it installs for the agent that runs it when that is Claude Code, Codex or Cursor (detected from the environment, see below), else for all three. It prints what it wrote:\n\n```json\n{"installed":[{"client":"claude-code","path":"/home/you/.claude/skills/kenso-cli/SKILL.md","status":"created"}]}\n```\n\n```bash\nkenso skill install --client claude-code\nkenso skill install --client all\nkenso skill install --dir .claude/skills/kenso-cli\nkenso skill install --force\n```\n\n- `--dir` writes the skill into that folder instead, for example a project\'s own skills folder. Name the folder `kenso-cli`, as agents expect the folder to match the skill name.\n- A different `SKILL.md` already in a target folder is replaced only with `--force`; without it the command exits 7, writes nothing, and its `next` adds `--force`. The same file is left alone (`"status":"unchanged"`).\n- `--dry-run` writes nothing and exits 0. It prints each target\'s status (`replaced` marks a different file there) and a `next` that applies it, with `--force` when a file would be replaced.\n- Cursor also reads `~/.claude/skills/` and `~/.agents/skills/`, so after a default install for all three it may list `kenso-cli` more than once. To avoid that, install with `--client cursor` only, or remove the copies you do not need.\n\nThe skill also ships in the Kenso plugin for Claude Code (`Ken-Technology/ken-ai-plugin`), so `npx skills add Ken-Technology/ken-ai-plugin` installs it along with the MCP skills. To read it without installing, open `skill/kenso-cli/SKILL.md` in the package.\n\n## Rules the skill teaches\n\n- **Data is on stdout, as JSON when piped.** Progress, warnings and errors are on stderr. Parse stdout; read stderr when the exit code is not 0.\n- **Plan, then apply.** Run a write with `--dry-run`, read the plan, then run the exact command in its `next` (the same command with `--yes`). A command with no dry run refuses `--dry-run` with `usage_error` and does nothing.\n- **Pass files, not rows.** Never paste a CSV into the conversation. Write the file, pass its path with `--file`, and read the summary.\n- **Read failures only.** If the summary\'s `failed`, `notFound` and `invalid` are 0, the work is done. Otherwise read just the problem rows from `results.csv` or `invalid.csv`.\n- **Follow `next`.** Every error with a known fix carries the exact command to run.\n- **Branch on the exit code:** 0 ok, 2 fix the command, 3 fix the key, 5 some rows failed, 6 wait or raise a limit, 130 resume.\n- **Look things up, do not guess.** `kenso describe <resource> <action>` prints any command\'s flags and body schema as JSON.\n\n## The token-saving pattern\n\nAdding 5,000 leads through the MCP sends every lead through the model, hundreds of thousands of tokens. Through the CLI it is two commands and two short JSON objects:\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\nThen, only if the summary shows failures:\n\n```bash\ngrep -E \'^[0-9]+,(failed|not_found|invalid),\' ~/.kenso/runs/r_tdi5cdnx/results.csv | head -50\n```\n\n## Environment variables\n\n| Variable | What it does |\n|---|---|\n| `KENSO_API_KEY` | The API key. Wins over any saved profile |\n| `KENSO_WORKSPACE_ID` | The workspace for every command. `--workspace` wins over it |\n| `KENSO_PROFILE` | The saved profile to use. `--profile` wins over it |\n| `KENSO_API_URL` | The API, default `https://api.ken.so` |\n| `KENSO_CONFIG_DIR` | Where the config file and cache live, default `~/.kenso` |\n| `KENSO_RUNS_DIR` | Where run folders live, default `<config dir>/runs` |\n| `KENSO_MCP_URL` | The MCP for `kenso mcp`, default `https://mcp.ken.so/mcp` |\n\n## Cloud sandboxes\n\nCloud agents (Claude Code on the web, Codex cloud, Cursor background agents and similar) often run with a network allowlist. Allow:\n\n- `api.ken.so`: every command\n- `mcp.ken.so`: only `kenso mcp tools` and `kenso mcp call`\n- `registry.npmjs.org`: to install the CLI with npm\n\nStore the key as the platform\'s secret and expose it as `KENSO_API_KEY`. Run `kenso doctor` as the first command: it checks Node, the config, that the API is reachable and that the key works, and exits 0 when all four pass.\n\n```bash\nkenso doctor\n```\n\nPoint the run folders at the workspace if the home folder does not persist between sessions: `KENSO_RUNS_DIR=./.kenso-runs`. Keep that folder out of git.\n\n## How Kenso knows an agent ran a command\n\nThe CLI checks these environment variables, in this order: `CLAUDECODE` and `CLAUDE_CODE_ENTRYPOINT` (Claude Code), `CODEX_SANDBOX` and `CODEX_THREAD_ID` (Codex), `CURSOR_AGENT` (Cursor), `GEMINI_CLI` (Gemini CLI), `OPENCODE` (OpenCode), then `AI_AGENT`, a free-form name any other agent can set. When one is set:\n\n- every request carries `X-Ken-Client: Kenso CLI via <agent>`, and writes carry `X-Ken-Actor: agent`, so Kenso shows the change as made by you through that agent;\n- help ends with a short "For agents" block;\n- browser login never opens a browser itself: it prints the link for you to open.\n\n`kenso doctor` shows the agent it detected.\n\n## MCP-only tools\n\nA few Kenso MCP tools have no API route, such as the skills Kenso\'s own agents use. Reach them from the shell with the same key:\n\n```bash\nkenso mcp tools\nkenso mcp call list_skills\nkenso mcp call load_skill --args \'{"name":"create-campaign"}\'\nkenso mcp call contacts --operation list --args \'{"limit":5}\'\n```\n\n`mcp call` prints the tool\'s structured result, else its text parsed as JSON, else the text. A tool error exits 1 with `mcp_tool_error`.\n';
9511
9525
  }
9512
9526
  });
9513
9527
 
@@ -9547,7 +9561,7 @@ var init_leads = __esm({
9547
9561
  var output_and_errors_default;
9548
9562
  var init_output_and_errors = __esm({
9549
9563
  "docs/output-and-errors.md"() {
9550
- output_and_errors_default = '# Output and errors\n\nEvery command follows one contract, so a script or an agent can parse any of them the same way.\n\n## stdout and stderr\n\n- **stdout carries data only.** Progress, warnings, notices and errors go to stderr.\n- No colors, spinners or pagers. On a terminal you get readable tables; in a pipe you get JSON.\n- The CLI never prompts. A batch command (an import, update, remove, tag or `--each` write) takes `--yes`; without it, the command plans or refuses. A single generated write, such as `kenso tags delete --tag-id 7`, and a write through `kenso api` send at once: add `--dry-run` to see the request first, then run the command without it.\n\n## Formats\n\n| What the command returns | stdout is a terminal | stdout is a pipe or file |\n|---|---|---|\n| One object | key-value lines | compact JSON on one line |\n| A list | a table (first 8 scalar fields, cells cut at 60 characters) | NDJSON: one JSON object per line |\n| A batch run | key-value lines | one JSON summary object |\n| No content (HTTP 204) | nothing | nothing |\n\n`-o` or `--output` picks the format: `json`, `ndjson`, `table` or `ids`.\n\n- `-o json` on a list prints one JSON array. On a terminal, `-o json` pretty-prints an object.\n- `-o ids` prints one id per line, ready for `--ids -`. Items without an `id` are skipped with one warning.\n\n```bash\nkenso campaigns list --limit 3\nkenso campaigns list --limit 3 -o json\nkenso contacts list --campaign-id 812 --all -o ids\n```\n\n## Shape the output\n\n- `--fields a,b.c` keeps only those fields (dots reach into nested objects).\n- `--query <JMESPath>` filters or reshapes in-process, so you need no `jq`. On a list it sees the whole list.\n- Neither applies to a batch summary, which always prints in full.\n\n```bash\nkenso campaigns list --fields id,name,status\nkenso campaigns list --all --query "[?status==\'active\'].id"\nkenso me get --query "length(features)"\n```\n\n## Lists and pages\n\nA list command prints one page. When there are more, it prints the command for the next page on stderr, for example `next: kenso tags list --limit 1 --cursor MQ`. `--all` follows every page and streams the items. `--limit` sets the page size and `--cursor` starts at a cursor.\n\n```bash\nkenso tags list --limit 50\nkenso tags list --all\n```\n\n## Errors\n\nWhen stderr is not a terminal, an error is one JSON line on stderr:\n\n```json\n{"error":{"code":"unknown_flag","message":"Unknown flag --fiel for kenso contacts import.","field":"fiel","hint":"did you mean --file?","next":"kenso contacts import --help"}}\n```\n\n| Key | Always there | Meaning |\n|---|---|---|\n| `code` | yes | A stable snake_case code to branch on |\n| `message` | yes | One sentence for a person |\n| `field` | no | The flag or input field at fault |\n| `hint` | no | What to change |\n| `next` | no | The exact command to run next, such as `kenso auth login`, `kenso workspace list --q <name>` or the same command with `--yes` |\n| `httpStatus` | no | The API\'s HTTP status, when the API answered |\n| `requestId` | no | The API\'s request id: quote it when you contact Kenso support |\n\nOn a terminal the same error prints as text: `Error: <message>`, then `field:`, `hint:`, `next:` and `requestId:` lines. The key never appears in an error.\n\n### How API errors map\n\nThe CLI looks at the HTTP status first, then at the API\'s own `error.code`, which wins when present.\n\n| HTTP status | Default code | Exit |\n|---|---|---|\n| 400, 422 | `validation_failed` | 2 |\n| 401 | `unauthorized` (`next`: `kenso auth login`) | 3 |\n| 403 | `forbidden`: the key\'s user or role cannot do this in this workspace | 3 |\n| 404 | `not_found` | 4 |\n| 409 | `conflict` | 7 |\n| 429 | `rate_limited`, after the CLI waited and retried | 6 |\n| 5xx | `server_error`, after retries where they are safe | 8 |\n| anything else | `http_error` | 1 |\n\nTwo API codes change the exit code: `workspace_required` exits 2 with `"next":"kenso workspace list --q <name>"`, and `limit_reached` (the plan\'s or the campaign\'s lead limit) exits 6.\n\n### Errors from the CLI itself\n\n| Code | Exit | When |\n|---|---|---|\n| `usage_error` | 2 | A required flag or argument is missing, or two flags conflict (`--yes` with `--dry-run`) |\n| `unknown_command` | 2 | No such command; `hint` suggests the closest one |\n| `unknown_flag`, `invalid_flag`, `invalid_flag_value`, `unexpected_argument` | 2 | A flag or argument the command does not take |\n| `invalid_query` | 2 | `--query` is not valid JMESPath |\n| `file_unreadable` | 2 | An input file is missing or cannot be parsed |\n| `config_invalid` | 2 | `~/.kenso/config.json` is not valid JSON: fix or delete it |\n| `feature_not_enabled` | 2 | Every action of the resource is a beta command your workspace has not enabled |\n| `invalid_key_format`, `key_required` | 2 | `auth login --with-key` read something that is not a Kenso key, or stdin is a terminal instead of a pipe |\n| `invalid_workspace_id` | 2 | `kenso workspace use` got an id that is not a positive whole number |\n| `unknown_topic` | 2 | `kenso docs` got a topic it does not have; `hint` lists the topics |\n| `file_unwritable` | 2 or 1 | An output file cannot be written: `contacts export --out` (2), `skill install` (1) |\n| `no_api_key` | 3 | No key in `KENSO_API_KEY` or the profile (`next`: `kenso auth login`) |\n| `browser_login_unavailable`, `access_denied`, `login_expired` | 3 | Browser login is off, was denied, or timed out |\n| `run_not_found` | 4 | `kenso runs show` or `resume` got an unknown run id |\n| `docs_not_found` | 4 | `kenso docs reference` before the reference was generated (a source checkout without `pnpm build`) |\n| `run_in_progress`, `already_filled` | 7 | Another process is working on the run, or `studio fill` already ran with this file and these flags |\n| `skill_exists` | 7 | `kenso skill install` found a different `SKILL.md`; `next` adds `--force` to replace it |\n| `job_timeout`, `job_failed`, `job_canceled` | 1 | `kenso jobs wait` (or a command that waits on a job) ran out of time, or the job failed or was canceled |\n| `mcp_tool_error` | 1 | `kenso mcp call`: the MCP tool answered with an error |\n| `unsafe_path` | 1 | `studio pull` refused a file path that would land outside `--dir` |\n| `network_error` | 8 | The API could not be reached after retries |\n| `upload_failed`, `download_failed` | 8 or 1 | A signed upload or download of a Studio file failed: 8 when storage was unreachable or answered 5xx, 1 on a 4xx (often an expired link: run the command again) |\n| `pull_incomplete` | 8 | `studio pull`: a file came back with neither text nor a download link |\n| `unexpected_response` | 1 or 8 | The API answered something the CLI could not read |\n| `unexpected_error` | 1 | A bug: run again with `--verbose` and report it |\n| `interrupted` | 130 | Ctrl-C |\n\n## Exit codes\n\n| Code | Meaning |\n|---|---|\n| 0 | OK, including a batch where every row succeeded or was skipped |\n| 1 | Unexpected error |\n| 2 | Usage or input error: a bad flag, a bad file, a validation error |\n| 3 | Auth: no key, an invalid, revoked or expired key, or HTTP 401 or 403 |\n| 4 | Not found |\n| 5 | Partial: the batch finished and some rows failed, were not found or were invalid. See `results.csv` |\n| 6 | Rate limited after retries, or a plan or campaign lead limit stopped the run (`limit_reached`) |\n| 7 | Conflict or invalid state (HTTP 409), or a run another process holds |\n| 8 | Server error after retries (5xx), or the API is unreachable |\n| 9 | Answer refused: a Kenso sandbox run stopped because an answer held a credential or something shaped like one |\n| 130 | Interrupted. A batch run can be resumed: see its `next` |\n\nSkipped rows (duplicates, blocklisted, already contacted) are not failures: a batch with only created, updated and skipped rows exits 0.\n\n## Flags\n\n- Command flags go after the command: `kenso contacts import --campaign 812`. Global flags can go anywhere.\n- A boolean flag takes `--flag`, `--no-flag`, `--flag=true` and `--flag=false`.\n- `--help` on any command prints its flags, arguments and examples. `kenso describe <resource> <action>` prints the same as JSON, with the body schema.\n\n## Beta commands\n\nCommands that need a workspace feature flag (CRM, Studio and others) are beta. Help and `kenso describe` hide the ones your workspace has not enabled and say how many they hid; `--all-commands` shows them. Calling a hidden command still works: Kenso decides. `kenso <resource>` on a resource whose every action is hidden answers `feature_not_enabled` (exit 2) and names the flags it needs.\n\n```bash\nkenso --help --all-commands\nkenso describe --all-commands\n```\n\n## What the CLI sends\n\nEvery API call carries `Authorization: Bearer <key>`, `Ken-Version: 1.1`, `X-Ken-Workspace-Id` (when a workspace is picked), `User-Agent: kenso-cli/<version> (node <version>; <platform>)` and `X-Ken-Client: Kenso CLI`. When a coding agent runs the CLI, `X-Ken-Client` names it (`Kenso CLI via Claude Code`) and writes carry `X-Ken-Actor: agent`, so Kenso\'s activity log shows who made a change.\n';
9564
+ output_and_errors_default = '# Output and errors\n\nEvery command follows one contract, so a script or an agent can parse any of them the same way.\n\n## stdout and stderr\n\n- **stdout carries data only.** Progress, warnings, notices and errors go to stderr.\n- No colors, spinners or pagers. On a terminal you get readable tables; in a pipe you get JSON.\n- The CLI never prompts. A batch command (an import, update, remove, tag or `--each` write) takes `--yes`; without it, the command plans or refuses. A single generated write, such as `kenso tags delete --tag-id 7`, and a write through `kenso api` or `kenso mcp call` send at once: add `--dry-run` to print the request first (it sends nothing), then run the command without it.\n- A command with no dry run, such as `kenso contacts export`, `kenso auth logout` or `kenso workspace use`, refuses `--dry-run` with `usage_error` (exit 2) and does nothing. Its help ends with `No --dry-run`, and `kenso describe <resource> <action>` shows `"dryRun": false`.\n\n## Formats\n\n| What the command returns | stdout is a terminal | stdout is a pipe or file |\n|---|---|---|\n| One object | key-value lines | compact JSON on one line |\n| A list | a table (first 8 scalar fields, cells cut at 60 characters) | NDJSON: one JSON object per line |\n| A batch run | key-value lines | one JSON summary object |\n| No content (HTTP 204) | nothing | nothing |\n\n`-o` or `--output` picks the format: `json`, `ndjson`, `table` or `ids`.\n\n- `-o json` on a list prints one JSON array. On a terminal, `-o json` pretty-prints an object.\n- `-o ids` prints one id per line, ready for `--ids -`. Items without an `id` are skipped with one warning.\n\n```bash\nkenso campaigns list --limit 3\nkenso campaigns list --limit 3 -o json\nkenso contacts list --campaign-id 812 --all -o ids\n```\n\n## Shape the output\n\n- `--fields a,b.c` keeps only those fields (dots reach into nested objects).\n- `--query <JMESPath>` filters or reshapes in-process, so you need no `jq`. On a list it sees the whole list.\n- Neither applies to a batch summary, which always prints in full.\n\n```bash\nkenso campaigns list --fields id,name,status\nkenso campaigns list --all --query "[?status==\'active\'].id"\nkenso me get --query "length(features)"\n```\n\n## Lists and pages\n\nA list command prints one page. When there are more, it prints the command for the next page on stderr, for example `next: kenso tags list --limit 1 --cursor MQ`. `--all` follows every page and streams the items. `--limit` sets the page size and `--cursor` starts at a cursor.\n\n```bash\nkenso tags list --limit 50\nkenso tags list --all\n```\n\n## Errors\n\nWhen stderr is not a terminal, an error is one JSON line on stderr:\n\n```json\n{"error":{"code":"unknown_flag","message":"Unknown flag --fiel for kenso contacts import.","field":"fiel","hint":"did you mean --file?","next":"kenso contacts import --help"}}\n```\n\n| Key | Always there | Meaning |\n|---|---|---|\n| `code` | yes | A stable snake_case code to branch on |\n| `message` | yes | One sentence for a person |\n| `field` | no | The flag or input field at fault |\n| `hint` | no | What to change |\n| `next` | no | The exact command to run next, such as `kenso auth login`, `kenso workspace list --q <name>` or the same command with `--yes` |\n| `httpStatus` | no | The API\'s HTTP status, when the API answered |\n| `requestId` | no | The API\'s request id: quote it when you contact Kenso support |\n\nOn a terminal the same error prints as text: `Error: <message>`, then `field:`, `hint:`, `next:` and `requestId:` lines. The key never appears in an error.\n\n### How API errors map\n\nThe CLI looks at the HTTP status first, then at the API\'s own `error.code`, which wins when present.\n\n| HTTP status | Default code | Exit |\n|---|---|---|\n| 400, 422 | `validation_failed` | 2 |\n| 401 | `unauthorized` (`next`: `kenso auth login`) | 3 |\n| 403 | `forbidden`: the key\'s user or role cannot do this in this workspace | 3 |\n| 404 | `not_found` | 4 |\n| 409 | `conflict` | 7 |\n| 429 | `rate_limited`, after the CLI waited and retried | 6 |\n| 5xx | `server_error`, after retries where they are safe | 8 |\n| anything else | `http_error` | 1 |\n\nTwo API codes change the exit code: `workspace_required` exits 2 with `"next":"kenso workspace list --q <name>"`, and `limit_reached` (the plan\'s or the campaign\'s lead limit) exits 6.\n\n### Errors from the CLI itself\n\n| Code | Exit | When |\n|---|---|---|\n| `usage_error` | 2 | A required flag or argument is missing, two flags conflict (`--yes` with `--dry-run`), or `--dry-run` on a command that has no dry run |\n| `unknown_command` | 2 | No such command; `hint` suggests the closest one |\n| `unknown_flag`, `invalid_flag`, `invalid_flag_value`, `unexpected_argument` | 2 | A flag or argument the command does not take |\n| `invalid_query` | 2 | `--query` is not valid JMESPath |\n| `file_unreadable` | 2 | An input file is missing or cannot be parsed |\n| `config_invalid` | 2 | `~/.kenso/config.json` is not valid JSON: fix or delete it |\n| `feature_not_enabled` | 2 | Every action of the resource is a beta command your workspace has not enabled |\n| `invalid_key_format`, `key_required` | 2 | `auth login --with-key` read something that is not a Kenso key, or stdin is a terminal instead of a pipe |\n| `invalid_workspace_id` | 2 | `kenso workspace use` got an id that is not a positive whole number |\n| `unknown_topic` | 2 | `kenso docs` got a topic it does not have; `hint` lists the topics |\n| `file_unwritable` | 2 or 1 | An output file cannot be written: `contacts export --out` (2), `skill install` (1) |\n| `no_api_key` | 3 | No key in `KENSO_API_KEY` or the profile (`next`: `kenso auth login`) |\n| `browser_login_unavailable`, `access_denied`, `login_expired` | 3 | Browser login is off, was denied, or timed out |\n| `run_not_found` | 4 | `kenso runs show` or `resume` got an unknown run id |\n| `docs_not_found` | 4 | `kenso docs reference` before the reference was generated (a source checkout without `pnpm build`) |\n| `run_in_progress`, `already_filled` | 7 | Another process is working on the run, or `studio fill` already ran with this file and these flags |\n| `skill_exists` | 7 | `kenso skill install` found a different `SKILL.md`; `next` adds `--force` to replace it |\n| `job_timeout`, `job_failed`, `job_canceled` | 1 | `kenso jobs wait` (or a command that waits on a job) ran out of time, or the job failed or was canceled |\n| `mcp_tool_error` | 1 | `kenso mcp call`: the MCP tool answered with an error |\n| `unsafe_path` | 1 | `studio pull` refused a file path that would land outside `--dir` |\n| `network_error` | 8 | The API could not be reached after retries |\n| `upload_failed`, `download_failed` | 8 or 1 | A signed upload or download of a Studio file failed: 8 when storage was unreachable or answered 5xx, 1 on a 4xx (often an expired link: run the command again) |\n| `pull_incomplete` | 8 | `studio pull`: a file came back with neither text nor a download link |\n| `unexpected_response` | 1 or 8 | The API answered something the CLI could not read |\n| `unexpected_error` | 1 | A bug: run again with `--verbose` and report it |\n| `interrupted` | 130 | Ctrl-C |\n\n## Exit codes\n\n| Code | Meaning |\n|---|---|\n| 0 | OK, including a batch where every row succeeded or was skipped |\n| 1 | Unexpected error |\n| 2 | Usage or input error: a bad flag, a bad file, a validation error |\n| 3 | Auth: no key, an invalid, revoked or expired key, or HTTP 401 or 403 |\n| 4 | Not found |\n| 5 | Partial: the batch finished and some rows failed, were not found or were invalid. See `results.csv` |\n| 6 | Rate limited after retries, or a plan or campaign lead limit stopped the run (`limit_reached`) |\n| 7 | Conflict or invalid state (HTTP 409), or a run another process holds |\n| 8 | Server error after retries (5xx), or the API is unreachable |\n| 9 | Answer refused: a Kenso sandbox run stopped because an answer held a credential or something shaped like one |\n| 130 | Interrupted. A batch run can be resumed: see its `next` |\n\nSkipped rows (duplicates, blocklisted, already contacted) are not failures: a batch with only created, updated and skipped rows exits 0.\n\n## Flags\n\n- Command flags go after the command: `kenso contacts import --campaign 812`. Global flags can go anywhere.\n- A boolean flag takes `--flag`, `--no-flag`, `--flag=true` and `--flag=false`.\n- `--help` on any command prints its flags, arguments and examples. `kenso describe <resource> <action>` prints the same as JSON, with the body schema.\n\n## Beta commands\n\nCommands that need a workspace feature flag (CRM, Studio and others) are beta. Help and `kenso describe` hide the ones your workspace has not enabled and say how many they hid; `--all-commands` shows them. Calling a hidden command still works: Kenso decides. `kenso <resource>` on a resource whose every action is hidden answers `feature_not_enabled` (exit 2) and names the flags it needs.\n\n```bash\nkenso --help --all-commands\nkenso describe --all-commands\n```\n\n## What the CLI sends\n\nEvery API call carries `Authorization: Bearer <key>`, `Ken-Version: 1.1`, `X-Ken-Workspace-Id` (when a workspace is picked), `User-Agent: kenso-cli/<version> (node <version>; <platform>)` and `X-Ken-Client: Kenso CLI`. When a coding agent runs the CLI, `X-Ken-Client` names it (`Kenso CLI via Claude Code`) and writes carry `X-Ken-Actor: agent`, so Kenso\'s activity log shows who made a change.\n';
9551
9565
  }
9552
9566
  });
9553
9567
 
@@ -9579,7 +9593,7 @@ var init_work = __esm({
9579
9593
  var SKILL_default;
9580
9594
  var init_SKILL = __esm({
9581
9595
  "skill/kenso-cli/SKILL.md"() {
9582
- SKILL_default = '---\nname: kenso-cli\ndescription: The Kenso CLI (kenso) for work from a file (of any size, even a few ids) or over about 50 records - import, update, remove (delete), pause, tag or export leads, import CRM accounts and people, edit Studio templates as local files and fill them, run an API operation per file row, resume an interrupted run, write the Kenso AI work a workspace gave to its own coding agent (My agent, with kenso work run, or work pull and submit with subagents), sign in with a key from a variable (pipe it to kenso auth login --with-key, no check first). For records listed in the message (under about 50), one record or a question, use the Kenso MCP.\n---\n\n1. Every write runs first with `--dry-run`; apply with the plan\'s `next`. `--yes` at once only to continue an interrupted run or apply what the person confirmed.\n2. Many rows: one command on the file as it is (`--file`, `--ids`, `--each`). Run kenso only: no python, awk or shell tests, not even on a file or variable.\n3. Any output\'s `next` is the command to run; errors are JSON on stderr. `--force` only with the person\'s OK.\n4. Ids are flags: `--campaign 812` on contacts import, update, export; `--campaign-id 812` on API commands. `--workspace <id>`; by name `kenso workspace list --q acme`. Other commands: `kenso --help`; `kenso api <METHOD> <path>` only when none fits.\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run # skips leads already in; --map \'{"Pain": "customVariables.pain_point", "Notes": null}\'; over 200 MB --server-import\nkenso contacts update --file edits.csv --match id --dry-run # also one lead; or --match email --campaign 812\nkenso contacts remove --ids ids.txt --dry-run # also pause, resume, restore; over 1,000: --confirm <count>\nkenso contacts remove --where \'{"campaignIds": [812], "filters": [{"conditions": {"field": "ContactCompany.Name", "operator": 2, "value": "acme"}}]}\' --dry-run # also pause, resume; 2 = contains; no search first\nkenso contacts tag --tag 31 --ids ids.txt --dry-run # tag, restore: --ids only, so first kenso contacts list --campaign-id 812 --all -o ids > ids.txt\nkenso contact-imports create --source campaign --source-campaign-id 10601 --campaign-id 812 --dry-run # copy another campaign\'s leads in\nkenso contacts export --campaign 812 --out leads.csv # a segment: kenso contact-exports create --segment-id 55\nkenso runs resume <runId> # an interrupted run; terminal lost: kenso runs list finds it. A changed file is a new run\nkenso accounts import --file accounts.csv --dry-run # companies; a file of people: kenso people import --file people.csv\nkenso studio push 12 --dir ./tpl # to preview local edits push first (draft; live needs --publish), then studio preview 12\nkenso studio fill 12 --accounts ids.txt --dry-run # or --campaign 10546 --contacts leads.csv\nkenso opportunities update --each rows.csv --dry-run # any API command on a file of rows (CSV or JSONL; keys fill flags and body). One record: kenso campaigns update --campaign-id 812 --name Q4 --dry-run\nkenso mcp call list_skills # only to list Ken\'s skills\n```\n\nCharges: `accounts import` per new account, `studio fill` per page (again for ids from another file): show the estimate. `pinned_by_user`: with the person\'s OK, rerun with `--overwrite-pinned`. Workflows: `kenso workflows brief` first; secrets only as `{{secrets.NAME}}`. Key: `KENSO_API_KEY`, or pipe a variable, no check: `printf \'%s\' "$KEY" | kenso auth login --with-key`; never in a flag, output or file.\n\n## Work (beta): My agent\n\nA workspace can set a kind of Kenso AI work (personalization, qualification, segmentation, rewriting, meeting brief, call brief, workflow prompt) to My agent in Settings > AI work: then it waits for the person\'s own coding agent, at 0 Kenso AI credits. The `kenso work` commands take no `--dry-run`. Never read the items\' text into the chat: the files carry it.\n\n```bash\nkenso work status # what waits, per kind\nkenso work run --agent claude # does it all: claims, runs headless agents, submits; stops when the queue is empty. Other agents need --allow-unconfined; exit 6 = the plan\'s usage limit\nkenso work pull --files 4 --per-file 10 # by hand: prints the work file paths, never the items\nkenso work submit <dir>/*.answers.json # pull\'s next; exit 5 = some answers rejected (see each <claimId>.results.json)\nkenso work release <claimId> # give back work you will not finish\n```\n\nBy hand in a chat: run `kenso work pull`, then give each work file to its own subagent with only its path ("Read this work file and write its answers file as its rules say"), then run pull\'s `next`. More: `kenso docs work`.\n';
9596
+ SKILL_default = '---\nname: kenso-cli\ndescription: The Kenso CLI (kenso) for work from a file (of any size, even a few ids) or over about 50 records - import, update, remove (delete), pause, tag or export leads, import CRM accounts and people, edit Studio templates as local files and fill them, run an API operation per file row, resume an interrupted run, write the Kenso AI work a workspace gave to its own coding agent (My agent, with kenso work run, or work pull and submit with subagents), sign in with a key from a variable (pipe it to kenso auth login --with-key, no check first). For records listed in the message (under about 50), one record or a question, use the Kenso MCP.\n---\n\n1. Every write runs first with `--dry-run`; apply with the plan\'s `next`. `--yes` at once only to continue an interrupted run or apply what the person confirmed. A command with no dry run refuses `--dry-run` (exit 2, nothing ran): read its `--help`, then run it without.\n2. Many rows: one command on the file as it is (`--file`, `--ids`, `--each`). Run kenso only: no python, awk or shell tests, not even on a file or variable.\n3. Any output\'s `next` is the command to run; errors are JSON on stderr. `--force` only with the person\'s OK.\n4. Ids are flags: `--campaign 812` on contacts import, update, export; `--campaign-id 812` on API commands. `--workspace <id>`; by name `kenso workspace list --q acme`. Other commands: `kenso --help`; `kenso api <METHOD> <path>` only when none fits.\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run # skips leads already in; --map \'{"Pain": "customVariables.pain_point", "Notes": null}\'; over 200 MB --server-import\nkenso contacts update --file edits.csv --match id --dry-run # also one lead; or --match email --campaign 812\nkenso contacts remove --ids ids.txt --dry-run # also pause, resume, restore; over 1,000: --confirm <count>\nkenso contacts remove --where \'{"campaignIds": [812], "filters": [{"conditions": {"field": "ContactCompany.Name", "operator": 2, "value": "acme"}}]}\' --dry-run # also pause, resume; 2 = contains; no search first\nkenso contacts tag --tag 31 --ids ids.txt --dry-run # tag, restore: --ids only, so first kenso contacts list --campaign-id 812 --all -o ids > ids.txt\nkenso contact-imports create --source campaign --source-campaign-id 10601 --campaign-id 812 --dry-run # copy another campaign\'s leads in\nkenso contacts export --campaign 812 --out leads.csv # a segment: kenso contact-exports create --segment-id 55\nkenso runs resume <runId> # an interrupted run; terminal lost: kenso runs list finds it. A changed file is a new run\nkenso accounts import --file accounts.csv --dry-run # companies; a file of people: kenso people import --file people.csv\nkenso studio push 12 --dir ./tpl # to preview local edits push first (draft; live needs --publish), then studio preview 12\nkenso studio fill 12 --accounts ids.txt --dry-run # or --campaign 10546 --contacts leads.csv\nkenso opportunities update --each rows.csv --dry-run # any API command on a file of rows (CSV or JSONL; keys fill flags and body). One record: kenso campaigns update --campaign-id 812 --name Q4 --dry-run\nkenso mcp call list_skills # only to list Ken\'s skills\n```\n\nCharges: `accounts import` per new account, `studio fill` per page (again for ids from another file): show the estimate. `pinned_by_user`: with the person\'s OK, rerun with `--overwrite-pinned`. Workflows: `kenso workflows brief` first; secrets only as `{{secrets.NAME}}`. Key: `KENSO_API_KEY`, or pipe a variable, no check: `printf \'%s\' "$KEY" | kenso auth login --with-key`; never in a flag, output or file.\n\n## Work (beta): My agent\n\nA workspace can set a kind of Kenso AI work (personalization, qualification, segmentation, rewriting, meeting brief, call brief, workflow prompt) to My agent in Settings > AI work: then it waits for the person\'s own coding agent, at 0 Kenso AI credits. The `kenso work` commands take no `--dry-run`. Never read the items\' text into the chat: the files carry it.\n\n```bash\nkenso work status # what waits, per kind\nkenso work run --agent claude # does it all: claims, runs headless agents, submits; stops when the queue is empty. Other agents need --allow-unconfined; exit 6 = the plan\'s usage limit\nkenso work pull --files 4 --per-file 10 # by hand: prints the work file paths, never the items\nkenso work submit <dir>/*.answers.json # pull\'s next; exit 5 = some answers rejected (see each <claimId>.results.json)\nkenso work release <claimId> # give back work you will not finish\n```\n\nBy hand in a chat: run `kenso work pull`, then give each work file to its own subagent with only its path ("Read this work file and write its answers file as its rules say"), then run pull\'s `next`. More: `kenso docs work`.\n';
9583
9597
  }
9584
9598
  });
9585
9599
 
@@ -10024,6 +10038,9 @@ var init_client = __esm({
10024
10038
  });
10025
10039
 
10026
10040
  // src/commands/mcp/connect.ts
10041
+ function mcpUrl(ctx) {
10042
+ return ctx.env.KENSO_MCP_URL?.trim() || DEFAULT_MCP_URL;
10043
+ }
10027
10044
  function mcpClient(ctx) {
10028
10045
  const apiKey = ctx.auth.apiKey;
10029
10046
  if (!apiKey) {
@@ -10035,7 +10052,7 @@ function mcpClient(ctx) {
10035
10052
  next: "kenso auth login"
10036
10053
  });
10037
10054
  }
10038
- const url = ctx.env.KENSO_MCP_URL?.trim() || DEFAULT_MCP_URL;
10055
+ const url = mcpUrl(ctx);
10039
10056
  return new McpClient({
10040
10057
  url,
10041
10058
  apiKey,
@@ -10083,7 +10100,7 @@ var init_call = __esm({
10083
10100
  action: "call",
10084
10101
  summary: "Call a hosted Kenso MCP tool, such as list_skills (no mcp tools first)",
10085
10102
  brief: "list_skills runs directly",
10086
- description: "Calls one Kenso MCP tool with the same API key and prints its result: structuredContent when the tool returns it, else its text parsed as JSON, else the text. Covers MCP-only tools, such as the skills: list_skills and load_skill take no kenso mcp tools first. A tool error exits 1 with the tool's message. A facade tool takes its operation with --operation.",
10103
+ description: "Calls one Kenso MCP tool with the same API key and prints its result: structuredContent when the tool returns it, else its text parsed as JSON, else the text. Covers MCP-only tools, such as the skills: list_skills and load_skill take no kenso mcp tools first. A tool error exits 1 with the tool's message. A facade tool takes its operation with --operation. --dry-run prints the tools/call request (tool and arguments) and sends nothing.",
10087
10104
  flags: {
10088
10105
  operation: { type: "string", description: "The facade operation, for example list" },
10089
10106
  args: { type: "string", description: "Tool arguments as a JSON object: inline, @file or - for stdin" }
@@ -10091,6 +10108,7 @@ var init_call = __esm({
10091
10108
  positionals: [{ name: "tool", required: true, description: "The tool name: list_skills, load_skill, or one from kenso mcp tools" }],
10092
10109
  examples: [`kenso mcp call contacts --operation list --args '{"limit":5}'`, "kenso mcp call list_skills", `kenso mcp call load_skill --args '{"name":"create-campaign"}'`],
10093
10110
  operationIds: [],
10111
+ dryRun: true,
10094
10112
  async run(ctx, { flags, positionals }) {
10095
10113
  const tool = positionals[0];
10096
10114
  let args = {};
@@ -10100,6 +10118,10 @@ var init_call = __esm({
10100
10118
  args = parsed3;
10101
10119
  }
10102
10120
  if (typeof flags.operation === "string") args = { ...args, operation: flags.operation };
10121
+ if (ctx.flags.dryRun) {
10122
+ ctx.output.object({ dryRun: true, request: { method: "POST", url: mcpUrl(ctx), body: { method: "tools/call", params: { name: tool, arguments: args } } } });
10123
+ return ExitCode.Ok;
10124
+ }
10103
10125
  const result = await mcpClient(ctx).callTool(tool, args);
10104
10126
  const text3 = textOf(result);
10105
10127
  if (result.isError === true) {
@@ -10294,6 +10316,7 @@ var init_import3 = __esm({
10294
10316
  ],
10295
10317
  beta: { featureGates: { all: ["accounts"] } },
10296
10318
  operationIds: ["people.batch"],
10319
+ dryRun: true,
10297
10320
  async run(ctx, args) {
10298
10321
  const { flags } = args;
10299
10322
  const findEmails = flags["find-emails"] === true;
@@ -10653,6 +10676,7 @@ var init_install = __esm({
10653
10676
  force: { type: "boolean", description: "Replace a different SKILL.md that is already there" }
10654
10677
  },
10655
10678
  examples: ["kenso skill install", "kenso skill install --client claude-code", "kenso skill install --dir .claude/skills/kenso-cli", "kenso skill install --force"],
10679
+ dryRun: true,
10656
10680
  async run(ctx, { flags }) {
10657
10681
  const clientFlag = typeof flags.client === "string" ? flags.client.trim() : void 0;
10658
10682
  const dir = typeof flags.dir === "string" && flags.dir.trim() !== "" ? flags.dir : void 0;
@@ -10962,6 +10986,7 @@ var init_pull = __esm({
10962
10986
  examples: ["kenso studio pull 12 --dir ./my-template", "kenso studio pull 12 --dir ./v3 --template-version 345"],
10963
10987
  beta: { featureGates: STUDIO_GATES },
10964
10988
  operationIds: ["asset-templates.pull"],
10989
+ dryRun: true,
10965
10990
  async run(ctx, { flags, positionals }) {
10966
10991
  const templateId = positiveId2(positionals[0], "templateId");
10967
10992
  const version = typeof flags["template-version"] === "string" ? flags["template-version"].trim() : void 0;
@@ -11055,6 +11080,7 @@ var init_push = __esm({
11055
11080
  examples: ["kenso studio push 12 --dir ./my-template", "kenso studio push 12 --dir ./my-template --delete-missing --publish"],
11056
11081
  beta: { featureGates: STUDIO_GATES },
11057
11082
  operationIds: ["asset-templates.create-upload-url", "asset-templates.push", "asset-templates.publish"],
11083
+ dryRun: true,
11058
11084
  async run(ctx, args) {
11059
11085
  const { flags, positionals } = args;
11060
11086
  const templateId = positiveId2(positionals[0], "templateId");
@@ -11527,6 +11553,7 @@ var init_fill = __esm({
11527
11553
  ],
11528
11554
  beta: { featureGates: STUDIO_GATES },
11529
11555
  operationIds: ["asset-runs.estimate", "asset-runs.create", "asset-runs.get"],
11556
+ dryRun: true,
11530
11557
  async run(ctx, args) {
11531
11558
  const { flags, positionals } = args;
11532
11559
  const templateId = positiveId2(positionals[0], "templateId");
@@ -11653,14 +11680,6 @@ function leaseMinutes(flags) {
11653
11680
  }
11654
11681
  return minutes;
11655
11682
  }
11656
- function refuseDryRun(ctx, command32) {
11657
- if (ctx.flags.dryRun !== true) return;
11658
- throw usageError(`${command32} has no --dry-run: it claims, answers or releases work and changes nothing else.`, {
11659
- field: "dry-run",
11660
- hint: "kenso work status shows what waits, without claiming anything.",
11661
- next: "kenso work status"
11662
- });
11663
- }
11664
11683
  function shellQuote5(value) {
11665
11684
  return /^[A-Za-z0-9_\-.,:/@=+%]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
11666
11685
  }
@@ -12220,7 +12239,6 @@ var init_pull2 = __esm({
12220
12239
  // After Ctrl-C a claim on its way still lands in a work file and the summary, so it can be answered or released.
12221
12240
  interruptGraceMs: 3e4,
12222
12241
  async run(ctx, { flags }) {
12223
- refuseDryRun(ctx, "kenso work pull");
12224
12242
  const kinds = kindsFlag(flags);
12225
12243
  const campaignId = campaignFlag(flags);
12226
12244
  const files = wholeNumber(flags, "files", 1, MAX_FILES, 16);
@@ -12436,7 +12454,6 @@ var init_submit = __esm({
12436
12454
  beta: BETA,
12437
12455
  operationIds: ["agent-work.submit-answers"],
12438
12456
  async run(ctx, { positionals }) {
12439
- refuseDryRun(ctx, "kenso work submit");
12440
12457
  const paths = [...new Set(positionals.map((p) => resolve14(p)))];
12441
12458
  const jobs = paths.map((path) => {
12442
12459
  const work = workFileNextTo(path);
@@ -12499,7 +12516,6 @@ var init_release = __esm({
12499
12516
  beta: BETA,
12500
12517
  operationIds: ["agent-work.release-claim"],
12501
12518
  async run(ctx, { positionals }) {
12502
- refuseDryRun(ctx, "kenso work release");
12503
12519
  const ids2 = [...new Set(positionals.map(claimIdOf))];
12504
12520
  const claims = [];
12505
12521
  for (const claimId of ids2) claims.push({ claimId, released: await releaseClaim(ctx, claimId) });
@@ -13991,7 +14007,6 @@ var init_run = __esm({
13991
14007
  interruptGraceMs: 3e4,
13992
14008
  ownCredential: (flags) => flags["token-stdin"] === true,
13993
14009
  async run(ctx, { flags }) {
13994
- refuseDryRun(ctx, "kenso work run");
13995
14010
  const adapter = agentFlag(flags);
13996
14011
  const parallel = wholeNumber(flags, "parallel", 1, MAX_PARALLEL, MAX_PARALLEL);
13997
14012
  const perFile = wholeNumber(flags, "per-file", 1, MAX_PER_FILE, 10);
@@ -14578,6 +14593,7 @@ async function renderTopHelp(opts) {
14578
14593
  "Rules: every write runs first with --dry-run. Then a batch command (import, update, remove, tag, --each) applies",
14579
14594
  "with the plan's next (--yes), any other write by running again without --dry-run. A file is one command as it is",
14580
14595
  "(--file, --ids, --each), never one per row; no python, awk or shell tests. Ids are flags (--campaign-id 812).",
14596
+ "A command with no dry run refuses --dry-run and does nothing (its help says so).",
14581
14597
  "Any output's next is the command to run; errors are JSON on stderr.",
14582
14598
  "",
14583
14599
  "Commands:"
@@ -14711,11 +14727,11 @@ function renderCommandHelp(spec, opts) {
14711
14727
  return [label, `${flag.description}${notes.length ? ` (${notes.join(", ")})` : ""}`];
14712
14728
  });
14713
14729
  if (flagRows.length > 0) lines.push("", "Flags:", columns(flagRows));
14714
- lines.push("", ...spec.helpFooter ?? [], GLOBAL_FLAGS_LINE);
14730
+ lines.push("", ...spec.helpFooter ?? [], spec.dryRun === true ? GLOBAL_FLAGS_LINE : GLOBAL_FLAGS_LINE_NO_DRY_RUN);
14715
14731
  if (spec.examples.length > 0) lines.push("", "Examples:", ...spec.examples.map((e) => ` ${e}`));
14716
14732
  return withAgentBlock(lines.join("\n"), opts.agent);
14717
14733
  }
14718
- var GLOBAL_FLAG_HELP, GLOBAL_FLAGS_LINE, COMMON_RESOURCES, EXIT_CODES, FOR_AGENTS;
14734
+ var GLOBAL_FLAG_HELP, GLOBAL_FLAGS_LINE, GLOBAL_FLAGS_LINE_NO_DRY_RUN, COMMON_RESOURCES, EXIT_CODES, FOR_AGENTS;
14719
14735
  var init_help = __esm({
14720
14736
  "src/commands/help.ts"() {
14721
14737
  "use strict";
@@ -14740,6 +14756,7 @@ var init_help = __esm({
14740
14756
  ["--version", "Print the CLI version (only on its own: kenso --version)"]
14741
14757
  ];
14742
14758
  GLOBAL_FLAGS_LINE = "Global flags: --dry-run, -y/--yes, --workspace <id>, -o json|ndjson|table|ids, --fields, --query, -v.";
14759
+ GLOBAL_FLAGS_LINE_NO_DRY_RUN = "Global flags: -y/--yes, --workspace <id>, -o json|ndjson|table|ids, --fields, --query, -v.\nNo --dry-run: this command runs for real, so --dry-run is refused.";
14743
14760
  COMMON_RESOURCES = [
14744
14761
  "accounts",
14745
14762
  "analytics",
@@ -14977,6 +14994,14 @@ function globalFlags(values) {
14977
14994
  if (flags.yes && flags.dryRun) throw usageError("Pick one of --dry-run and --yes.", { field: "yes" });
14978
14995
  return flags;
14979
14996
  }
14997
+ function noDryRun(spec) {
14998
+ const name = commandName(spec);
14999
+ return usageError(`${name} has no --dry-run, so nothing ran: without the flag it runs for real.`, {
15000
+ field: "dry-run",
15001
+ hint: `Read ${name} --help for what it does, then run it without --dry-run when you mean it.`,
15002
+ next: `${name} --help`
15003
+ });
15004
+ }
14980
15005
  function commandArgs(spec, parsed2, tokens) {
14981
15006
  const name = commandName(spec);
14982
15007
  const consumed = tokens.length;
@@ -15070,6 +15095,7 @@ async function main(argv, env = process.env, overrides = {}) {
15070
15095
  }
15071
15096
  const parsed2 = strictParse(argv, spec);
15072
15097
  const flags = globalFlags(parsed2.values);
15098
+ if (flags.dryRun && spec.dryRun !== true) throw noDryRun(spec);
15073
15099
  const args = commandArgs(spec, parsed2, commandTokens);
15074
15100
  const ctx = createContext(flags, env, { ...overrides, signal: controller.signal, noConfig: spec.ownCredential?.(args.flags) === true });
15075
15101
  output = ctx.output;