@cavelon/cli 0.1.8 → 0.1.10

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.
Files changed (53) hide show
  1. package/dist/branches.js +4 -3
  2. package/dist/capacity.js +3 -2
  3. package/dist/code-hints.js +5 -4
  4. package/dist/command.js +6 -0
  5. package/dist/commands/api.js +3 -3
  6. package/dist/commands/async.js +7 -4
  7. package/dist/commands/chat.js +10 -12
  8. package/dist/commands/docs.js +5 -3
  9. package/dist/commands/fmt.js +6 -4
  10. package/dist/commands/index.js +2 -0
  11. package/dist/commands/init.js +106 -28
  12. package/dist/commands/limits-set.js +8 -9
  13. package/dist/commands/limits.js +4 -3
  14. package/dist/commands/loops.js +15 -14
  15. package/dist/commands/models.js +10 -12
  16. package/dist/commands/sandboxes.js +15 -14
  17. package/dist/commands/schema.js +6 -5
  18. package/dist/commands/session.js +27 -15
  19. package/dist/commands/setup.js +4 -2
  20. package/dist/commands/solution.js +152 -68
  21. package/dist/commands/tenants.js +14 -14
  22. package/dist/commands/values.js +62 -38
  23. package/dist/commands/work.js +18 -12
  24. package/dist/confirm-token.js +3 -1
  25. package/dist/contracts.js +2 -1
  26. package/dist/default-route.js +1 -1
  27. package/dist/features.js +2 -1
  28. package/dist/harness-ref.js +6 -4
  29. package/dist/http.js +4 -3
  30. package/dist/invoke.js +3 -2
  31. package/dist/kit-codes.js +9 -2
  32. package/dist/limits.js +1 -1
  33. package/dist/main.js +13 -1
  34. package/dist/mcp.js +65 -32
  35. package/dist/openapi.js +5 -2
  36. package/dist/operations.js +3 -2
  37. package/dist/package-check.js +10 -4
  38. package/dist/package-files.js +5 -1
  39. package/dist/package-format.js +10 -0
  40. package/dist/preview-report.js +44 -5
  41. package/dist/printed.js +182 -0
  42. package/dist/project.js +2 -1
  43. package/dist/results.js +1 -1
  44. package/dist/secret-access.js +30 -0
  45. package/dist/session.js +3 -11
  46. package/dist/shell.js +0 -3
  47. package/dist/skills/cavelon-authoring/SKILL.md +9 -2
  48. package/dist/skills/cavelon-long-running/SKILL.md +1 -1
  49. package/dist/skills/cavelon-loop/SKILL.md +16 -4
  50. package/dist/tenant-choice.js +7 -7
  51. package/dist/trace-view.js +1 -1
  52. package/dist/update-check.js +156 -10
  53. package/package.json +1 -1
package/dist/session.js CHANGED
@@ -6,19 +6,11 @@ import { readTenantless } from "./principal.js";
6
6
  import { listsTenants, searchTenants, tenantMissError } from "./tenant-choice.js";
7
7
  import { findProject, readEnvFile } from "./project.js";
8
8
  import { loadUserConfig, tokenKind, updateInstance } from "./user-config.js";
9
- import { shellWord } from "./shell.js";
9
+ import { cavelonCommand, fill } from "./printed.js";
10
10
  const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
11
11
  export function isUuid(value) {
12
12
  return UUID.test(value);
13
13
  }
14
- export function contextFlags(session) {
15
- let flags = "";
16
- if (session.urlSource === "option" && session.url)
17
- flags += ` --instance ${shellWord(session.url)}`;
18
- if (session.tenantSource === "option" && session.tenant)
19
- flags += ` --tenant ${shellWord(session.tenant)}`;
20
- return flags;
21
- }
22
14
  function isLocalHost(hostname) {
23
15
  return (hostname === "localhost" ||
24
16
  hostname.endsWith(".localhost") ||
@@ -62,7 +54,7 @@ export async function resolveSession(env, cwd, globals) {
62
54
  let envFile;
63
55
  if (globals.solutionEnv) {
64
56
  if (!project) {
65
- throw usageError(`--env ${globals.solutionEnv} needs a solution folder.`, "Run it inside a folder with cavelon.yaml, or run `cavelon init` first.");
57
+ throw usageError(`--env ${globals.solutionEnv} needs a solution folder.`, `Run it inside a folder with cavelon.yaml, or run \`${cavelonCommand("init")}\` first.`);
66
58
  }
67
59
  envFile = await readEnvFile(project, globals.solutionEnv);
68
60
  }
@@ -114,7 +106,7 @@ export function requireInstance(session) {
114
106
  throw new CavelonError(ExitCode.usage, {
115
107
  code: "no_instance",
116
108
  message: "No Cavelon instance selected.",
117
- hint: "Run `cavelon login --instance <url>`, set CAVELON_URL, or work inside a folder with cavelon.yaml.",
109
+ hint: `Run \`${cavelonCommand("login", "--instance", fill("url"))}\`, set CAVELON_URL, or work inside a folder with cavelon.yaml.`,
118
110
  });
119
111
  }
120
112
  return session.url;
package/dist/shell.js CHANGED
@@ -36,6 +36,3 @@ export function shellWord(word, shell = current) {
36
36
  return `"${word.replaceAll('"', '""')}"`;
37
37
  }
38
38
  }
39
- export function cavelonCommand(...words) {
40
- return ["cavelon", ...words.map((w) => shellWord(w))].join(" ");
41
- }
@@ -138,7 +138,9 @@ it and where, as the output says.
138
138
 
139
139
  A file of a section the instance does not know is kept as it is; the preview
140
140
  lists it under "ignored". `package/manifest.yaml` names the package format
141
- version; leave it as `pull` wrote it. Some fields are not applied by an
141
+ version and the tenant the package is for; leave it as `pull` or `init`
142
+ wrote it (`init` writes a minimal one for a new solution, and the first `pull`
143
+ replaces it). Some fields are not applied by an
142
144
  import: the preview lists them under "not applied", each with the command
143
145
  that sets it (a solution's `status` with `cavelon activate`, its `is_default`
144
146
  with `cavelon harness default`).
@@ -300,7 +302,12 @@ schema has them: `cavelon validate` reports an unknown section):
300
302
  without echoing it. Never ask for the value, never put it into a file,
301
303
  an argument or a message, and never put a credential into a variable.
302
304
  `cavelon secrets list` (the `secrets_list` tool) shows which are set,
303
- never a value. A tenant API key cannot set a secret at all.
305
+ never a value. A tenant API key cannot set a secret at all, and neither can
306
+ a person whose role may not manage secrets (a Builder): `cavelon whoami`
307
+ says "may set secrets: no", and `secrets set`, `activate` and `status` then
308
+ name who does instead. Tell the person that a tenant Owner sets it, in the
309
+ Admin under Settings › Secrets or with their own token; do not suggest the
310
+ command to someone whose role cannot run it.
304
311
 
305
312
  ## After each edit
306
313
 
@@ -72,7 +72,7 @@ run's traces. Keep each `watch` or `wait` under your shell's time
72
72
  limit and run it again to resume (exit 6 means still running). Over MCP, use the
73
73
  `loop_iterations` and `operation_status` tools; `loop_iterations` never
74
74
  blocks, and `operation_status` waits only when given a `timeout` (at most 50
75
- seconds).
75
+ seconds); its `resume` is the `operation_status` call to make again.
76
76
 
77
77
  - **Pause** at the next safe point: `cavelon loop pause <run>`. Resume with
78
78
  `cavelon loop resume <run>`. A paused loop makes `wait` and `loop watch` exit
@@ -29,6 +29,11 @@ use it when you parse the result.
29
29
  `--env` and `--tenant`). Never ask for the value, never pipe or pass one yourself; there is
30
30
  no MCP tool for it. Plain-text variables you may set with `cavelon variables
31
31
  set <name> <value>` when the value is not a credential.
32
+ - **Pass on an update warning.** The first MCP result of a session may warn
33
+ that `cavelon`, the Cavelon plugin or this folder's skills are behind the
34
+ latest release (`… is out; this is …`, `The Cavelon plugin is …`), with the
35
+ commands that update them. Tell the person, with those commands, before you
36
+ go on; they run them (an update takes effect in a new session), you do not.
32
37
  - **Read the limits before you plan a solution:** `cavelon limits` (the
33
38
  `limits` tool over MCP). It lists what this instance allows the tenant
34
39
  (upload size and file types, agent turns, tool calls, timeouts, rate limits,
@@ -53,7 +58,7 @@ use it when you parse the result.
53
58
  pass `--tenant` (and `--instance`) to every command, `harness new` and
54
59
  `pull` included: without it a command acts in the tenant `cavelon use`
55
60
  chose, which may be another one. The commands `cavelon` prints carry the
56
- `--tenant` you gave; run them as printed. `apply` never creates a solution: when the one an env file names
61
+ `--tenant` (and `--env`) you gave, confirm lines included; run them as printed. `apply` never creates a solution: when the one an env file names
57
62
  is missing it stops with `solution_not_found` and names that command. To start from a package file (a blueprint, an
58
63
  export from another instance), run
59
64
  `cavelon init --instance <url> --tenant <tenant> --from <file>` instead of
@@ -79,7 +84,9 @@ use it when you parse the result.
79
84
  import. `pull --include-tenant-wide` writes them; `apply
80
85
  --include-tenant-wide` (the MCP tool's `include_tenant_wide`) imports them,
81
86
  for every solution of the tenant, so only with the person's say-so; its
82
- preview names the active solutions the change reaches.
87
+ preview names the sections the confirm would import (`would_import`) and
88
+ the active solutions the change reaches, and warns of a change only where
89
+ one of those sections differs from the instance's.
83
90
  `validate` warns about a tenant-wide file in the folder
84
91
  (`tenant_wide_section`); on an instance that does not publish
85
92
  `include_tenant_wide`, `apply` imports such a file anyway and says so:
@@ -229,7 +236,10 @@ refused (`confirm_token_required`), and a token of another change returns the
229
236
  new preview with `token_mismatch` (exit code 4): show that one instead. Tool
230
237
  arguments are spelled in snake_case (`make_default`, `keep_both`, `dry_run`);
231
238
  an argument a tool does not list is refused (`unknown_argument`) with the
232
- closest one named.
239
+ closest one named. Over MCP the next steps a tool returns (hints, `next`,
240
+ `resume`, `confirm`) are tool calls, `harness_default {"solution":"support"}`:
241
+ make the call as written, filling a value in angle brackets (a
242
+ `confirm_token` comes from that tool's preview).
233
243
 
234
244
  **From your shell, `--confirm` takes the same token.** Run by a coding agent,
235
245
  `limits set`, `models set-limit`, `loop cancel`, `sandbox seed`,
@@ -239,7 +249,9 @@ print their preview with a confirm token and the command that confirms it
239
249
  (`… --confirm <token>`). Show the preview, then run exactly that command. A
240
250
  bare `--confirm`, as the docs show it for a person's terminal, changes nothing
241
251
  from your shell and exits 5; a token of another change exits 4 with the new
242
- preview.
252
+ preview. A line printed before its preview exists ends in
253
+ `--confirm <confirm_token of its preview>`: run the command without
254
+ `--confirm` first for the preview and its token.
243
255
 
244
256
  **`cavelon api` from your shell has the guards of the MCP `api` tool**, since
245
257
  `cavelon` sees that a coding agent runs it (`CLAUDECODE`, `CODEX_THREAD_ID`, `CODEX_SANDBOX`,
@@ -2,7 +2,7 @@ import { closest, displayName, MAX_LISTED, pick } from "./choose.js";
2
2
  import { CavelonError, ExitCode } from "./errors.js";
3
3
  import { readTenantless } from "./principal.js";
4
4
  import { canAsk } from "./prompt.js";
5
- import { cavelonCommand } from "./shell.js";
5
+ import { cavelonCommand, fill } from "./printed.js";
6
6
  export function listsTenants(tenantless) {
7
7
  return Boolean(tenantless && !tenantless.refused && tenantless.tenants);
8
8
  }
@@ -27,7 +27,7 @@ export async function chooseTenant(ctx, client, reach, options = {}) {
27
27
  return { kind: "open" };
28
28
  const later = reachesAll && options.later;
29
29
  const intro = later
30
- ? `This token works in every tenant on ${client.url}, one at a time: \`cavelon use\` switches, ` +
30
+ ? `This token works in every tenant on ${client.url}, one at a time: \`${cavelonCommand("use")}\` switches, ` +
31
31
  `and --tenant or \`tenant:\` in cavelon.yaml choose one per command or per solution folder.${tenants.length ? "\nYours:" : ""}`
32
32
  : reachesAll
33
33
  ? `This token reaches every tenant on ${client.url}.${tenants.length ? " Yours:" : ""}`
@@ -52,18 +52,18 @@ export function commandLines(tenants, command) {
52
52
  const width = Math.max(...shown.map((s) => s.text.length));
53
53
  const lines = shown.map((s) => ` ${s.name ? `${s.text.padEnd(width)} ${s.name}` : s.text}`);
54
54
  if (tenants.length > shown.length)
55
- lines.push(` … and ${tenants.length - shown.length} more (\`cavelon tenant list\` lists them)`);
55
+ lines.push(` … and ${tenants.length - shown.length} more (\`${cavelonCommand("tenant", "list")}\` lists them)`);
56
56
  return lines.join("\n");
57
57
  }
58
58
  export function choicesOf(tenants, command) {
59
59
  return tenants.map((t) => ({ id: t.id, slug: t.slug, name: t.name, role: t.role, is_default: t.is_default, command: command(tenantRef(t)) }));
60
60
  }
61
- export function tenantOpenError(url, reach, lead, command = { line: (ref) => cavelonCommand("use", ref), template: "cavelon use <name or slug>" }) {
61
+ export function tenantOpenError(url, reach, lead, command = { line: (ref) => cavelonCommand("use", ref), template: cavelonCommand("use", fill("name or slug")) }) {
62
62
  const { tenants, reachesAll } = reach;
63
63
  const what = reachesAll ? "every tenant" : `${tenants.length} tenants`;
64
64
  const lines = tenants.length ? `Run the line for the tenant you want:\n${commandLines(tenants, command.line)}` : "";
65
65
  const search = reachesAll
66
- ? `${lines ? "\nAny other tenant: " : "Choose one: "}\`${command.template}\`; \`cavelon tenant list --search <part of the name>\` finds its slug.`
66
+ ? `${lines ? "\nAny other tenant: " : "Choose one: "}\`${command.template}\`; \`${cavelonCommand("tenant", "list", "--search", fill("part of the name"))}\` finds its slug.`
67
67
  : "";
68
68
  return new CavelonError(ExitCode.usage, {
69
69
  code: "tenant_required",
@@ -89,8 +89,8 @@ export function tenantMissError(ref, pool, reachesAll, from) {
89
89
  if (listed.length)
90
90
  hints.push(`Run the line for the tenant you mean:\n${commandLines(listed, (r) => cavelonCommand("use", r))}`);
91
91
  hints.push(reachesAll
92
- ? "This token reaches every tenant: `cavelon tenant list --search <part of the name>` finds one."
93
- : "`cavelon tenant list` shows the tenants this token reaches with name, slug and id; `cavelon use` alone lets you choose.");
92
+ ? `This token reaches every tenant: \`${cavelonCommand("tenant", "list", "--search", fill("part of the name"))}\` finds one.`
93
+ : `\`${cavelonCommand("tenant", "list")}\` shows the tenants this token reaches with name, slug and id; \`${cavelonCommand("use")}\` alone lets you choose.`);
94
94
  return new CavelonError(ExitCode.failure, {
95
95
  code: "tenant_not_found",
96
96
  message: `No tenant "${ref}" that this token reaches${from ? ` (from ${from})` : ""}.${names ? ` ${label}: ${names}.` : ""}`,
@@ -148,7 +148,7 @@ export const KNOWLEDGE_OUTCOMES = [
148
148
  value: "unusable_hits",
149
149
  recorded_as: "no_usable_evidence",
150
150
  message: "The agent recorded no_usable_evidence although the search returned hits: none of them answers the question. A question the knowledge base does not cover usually shows here, not as content_gap, because a search almost always returns its closest passages.",
151
- hint: "Read the hits on the retrieval span (`cavelon trace … --span <span_id>`). Add the missing content, or improve the document whose passage should have answered it.",
151
+ hint: "Read the hits on the retrieval span (`cavelon trace <run> --trace <trace_id> --span <span_id>`). Add the missing content, or improve the document whose passage should have answered it.",
152
152
  },
153
153
  {
154
154
  value: "retrieval_fault",
@@ -1,11 +1,20 @@
1
+ import fs from "node:fs/promises";
1
2
  import path from "node:path";
2
- import { NPM_PACKAGE, REPOSITORY } from "./install.js";
3
- import { readJsonFile, writeFileAtomic } from "./fsutil.js";
3
+ import { SKILL_ROOTS } from "./agents.js";
4
+ import { currentInstall, NPM_PACKAGE, REPOSITORY } from "./install.js";
5
+ import { readJsonFile, readTextFile, writeFileAtomic } from "./fsutil.js";
6
+ import { isGenerated } from "./markers.js";
4
7
  import { cacheDir } from "./paths.js";
8
+ import { findProject } from "./project.js";
9
+ import { KIT_VERSION } from "./version.js";
5
10
  export const DAY_MS = 24 * 60 * 60 * 1000;
6
11
  export const CHECK_TIMEOUT_MS = 1500;
7
12
  const MAX_BODY = 1024 * 1024;
8
13
  const STATE_FILE = "update-check.json";
14
+ export const PLUGIN_VERSION_VARIABLE = "CAVELON_PLUGIN_VERSION";
15
+ export const CLAUDE_PLUGIN_ROOT_VARIABLE = "CLAUDE_PLUGIN_ROOT";
16
+ const PLUGIN_NAME = "cavelon";
17
+ const UPDATING_DOCS = `https://github.com/${REPOSITORY}/blob/main/docs/installation.md#updating`;
9
18
  const SOURCES = {
10
19
  github: { url: `https://api.github.com/repos/${REPOSITORY}/releases/latest`, field: "tag_name" },
11
20
  npm: { url: `https://registry.npmjs.org/${NPM_PACKAGE}/latest`, field: "version" },
@@ -37,7 +46,14 @@ export function startUpdateCheck(request) {
37
46
  }
38
47
  async function check(request) {
39
48
  const { io, install, version } = request;
40
- const source = install.source;
49
+ return withState(io, install.source, version, request.fetch ?? fetch, (state, now) => {
50
+ if (!state.latest || !newer(state.latest, version) || within(state.notified_at, now))
51
+ return undefined;
52
+ state.notified_at = now.toISOString();
53
+ return noticeText(state.latest, version, install);
54
+ });
55
+ }
56
+ async function withState(io, source, version, fetchImpl, use) {
41
57
  const file = path.join(cacheDir(io.env), STATE_FILE);
42
58
  const state = (await readJsonFile(file)) ?? {};
43
59
  const now = io.now();
@@ -49,18 +65,14 @@ async function check(request) {
49
65
  }
50
66
  if (!within(state.checked_at, now)) {
51
67
  state.checked_at = now.toISOString();
52
- const latest = await latestVersion(source, version, request.fetch ?? fetch).catch(() => undefined);
68
+ const latest = await latestVersion(source, version, fetchImpl).catch(() => undefined);
53
69
  if (latest)
54
70
  state.latest = latest;
55
71
  }
56
- let notice;
57
- if (state.latest && newer(state.latest, version) && !within(state.notified_at, now)) {
58
- notice = noticeText(state.latest, version, install);
59
- state.notified_at = now.toISOString();
60
- }
72
+ const result = use(state, now);
61
73
  if (JSON.stringify(state) !== before)
62
74
  await writeFileAtomic(file, `${JSON.stringify(state, null, 2)}\n`, 0o600, 0o700);
63
- return notice;
75
+ return result;
64
76
  }
65
77
  function within(stamp, now) {
66
78
  const at = stamp ? Date.parse(stamp) : NaN;
@@ -116,3 +128,137 @@ export function noticeText(latest, version, install) {
116
128
  return `${head} Update with:\n ${install.update}\n`;
117
129
  return `${head}${install.advice ? ` ${install.advice}` : ""}\n`;
118
130
  }
131
+ export function sessionQuietReason(io, install) {
132
+ if (setTo(io.env.CAVELON_NO_UPDATE_CHECK))
133
+ return "CAVELON_NO_UPDATE_CHECK";
134
+ if (CI_VARIABLES.some((name) => setTo(io.env[name])))
135
+ return "ci";
136
+ if (install.method === "source")
137
+ return "source";
138
+ return undefined;
139
+ }
140
+ export function startSessionUpdateCheck(io, options = {}) {
141
+ const install = options.install ?? currentInstall(io.env);
142
+ const version = options.version ?? KIT_VERSION;
143
+ if (sessionQuietReason(io, install))
144
+ return { forCall: async () => undefined, keep: () => undefined };
145
+ let facts;
146
+ let settled = false;
147
+ const gathered = Promise.all([
148
+ pluginVersion(io.env)
149
+ .catch(() => undefined)
150
+ .then((plugin) => {
151
+ const source = install.source ?? (plugin ? "github" : undefined);
152
+ const latest = source ? withState(io, source, version, options.fetch ?? fetch, (state) => state.latest).catch(() => undefined) : undefined;
153
+ return Promise.all([plugin, latest]);
154
+ }),
155
+ initSkillsVersion(io.cwd).catch(() => undefined),
156
+ ]).then(([[plugin, latest], skills]) => {
157
+ facts = { plugin, latest, skills };
158
+ settled = true;
159
+ });
160
+ let first = true;
161
+ let delivered = false;
162
+ return {
163
+ async forCall(client) {
164
+ if (delivered)
165
+ return undefined;
166
+ if (first) {
167
+ first = false;
168
+ await bounded(gathered, CHECK_TIMEOUT_MS);
169
+ }
170
+ if (delivered || !settled)
171
+ return undefined;
172
+ delivered = true;
173
+ return facts && sessionWarning({ ...facts, version, install, client: client() });
174
+ },
175
+ keep() {
176
+ delivered = false;
177
+ },
178
+ };
179
+ }
180
+ function bounded(promise, ms) {
181
+ let timer;
182
+ const timeout = new Promise((resolve) => {
183
+ timer = setTimeout(resolve, ms);
184
+ });
185
+ return Promise.race([promise.then(() => undefined), timeout]).finally(() => clearTimeout(timer));
186
+ }
187
+ export async function pluginVersion(env) {
188
+ const said = parseVersion(env[PLUGIN_VERSION_VARIABLE] ?? "")?.text;
189
+ if (said)
190
+ return said;
191
+ const root = env[CLAUDE_PLUGIN_ROOT_VARIABLE];
192
+ if (!root || !path.isAbsolute(root))
193
+ return undefined;
194
+ const manifest = await readJsonFile(path.join(root, ".claude-plugin", "plugin.json"));
195
+ if (manifest?.name !== PLUGIN_NAME || typeof manifest.version !== "string")
196
+ return undefined;
197
+ return parseVersion(manifest.version)?.text;
198
+ }
199
+ const INIT_MARK = /written by `cavelon init --agents` \(cavelon ([0-9][0-9A-Za-z.-]{0,80})\)/;
200
+ const SKILL_FOLDER = /^cavelon-[a-z0-9-]{1,64}$/;
201
+ async function initSkillsVersion(cwd) {
202
+ const root = (await findProject(cwd))?.root ?? cwd;
203
+ let oldest;
204
+ for (const skillRoot of SKILL_ROOTS) {
205
+ let names;
206
+ try {
207
+ names = await fs.readdir(path.join(root, skillRoot));
208
+ }
209
+ catch {
210
+ continue;
211
+ }
212
+ for (const name of names.filter((n) => SKILL_FOLDER.test(n))) {
213
+ const text = await readTextFile(path.join(root, skillRoot, name, "SKILL.md"));
214
+ if (!isGenerated(text))
215
+ continue;
216
+ const found = parseVersion(INIT_MARK.exec(text)?.[1] ?? "")?.text;
217
+ if (found && (!oldest || newer(oldest, found)))
218
+ oldest = found;
219
+ }
220
+ }
221
+ return oldest;
222
+ }
223
+ const PLUGIN_UPDATE = {
224
+ claude: "`claude plugin marketplace update cavelon-dev-kit` and `claude plugin update cavelon@cavelon-dev-kit`",
225
+ codex: "`codex plugin marketplace upgrade cavelon-dev-kit` and `codex plugin add cavelon@cavelon-dev-kit`",
226
+ };
227
+ function pluginUpdate(client) {
228
+ const name = client?.toLowerCase() ?? "";
229
+ if (name.includes("claude"))
230
+ return PLUGIN_UPDATE.claude;
231
+ if (name.includes("codex"))
232
+ return PLUGIN_UPDATE.codex;
233
+ return undefined;
234
+ }
235
+ export function sessionWarning(facts) {
236
+ const { version, install, plugin, skills } = facts;
237
+ const latest = facts.latest && install.source && newer(facts.latest, version) ? facts.latest : undefined;
238
+ const newest = facts.latest && newer(facts.latest, version) ? facts.latest : version;
239
+ const pluginBehind = plugin !== undefined && newer(newest, plugin);
240
+ const skillsBehind = skills !== undefined && newer(latest ?? version, skills);
241
+ if (!latest && !pluginBehind && !skillsBehind)
242
+ return undefined;
243
+ const said = [];
244
+ const asks = [];
245
+ if (latest) {
246
+ said.push(`cavelon ${latest} is out; this is ${version}.`);
247
+ asks.push(install.update ? `Update cavelon with \`${install.update}\`.` : (install.advice ?? `Update cavelon to ${latest}.`));
248
+ }
249
+ if (pluginBehind) {
250
+ said.push(`The Cavelon plugin is ${plugin}${latest ? "" : `, older than cavelon ${newest}`}.`);
251
+ const commands = pluginUpdate(facts.client);
252
+ asks.push(commands ? `Update the plugin with ${commands}.` : `Update the plugin: in Claude Code with ${PLUGIN_UPDATE.claude}; in Codex with ${PLUGIN_UPDATE.codex}.`);
253
+ }
254
+ else if (latest && plugin === undefined && pluginUpdate(facts.client)) {
255
+ asks.push(`If they use the Cavelon plugin, also update it with ${pluginUpdate(facts.client)}.`);
256
+ }
257
+ if (skillsBehind) {
258
+ said.push(`The skills \`cavelon init --agents\` wrote in this solution folder are from cavelon ${skills}.`);
259
+ asks.push(`Run \`cavelon init --update\` in it${latest ? " after updating cavelon" : ""}, and commit the result.`);
260
+ }
261
+ if (latest || pluginBehind)
262
+ asks.push("Then start a new agent session.");
263
+ return `${said.join(" ")} Tell the user: ${asks.join(" ")} More: ${UPDATING_DOCS}`;
264
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cavelon/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "The cavelon binary: CLI and local MCP server for building Cavelon solutions with a coding agent.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/goodguys-gmbh/cavelon-dev-kit",