@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.
- package/dist/branches.js +4 -3
- package/dist/capacity.js +3 -2
- package/dist/code-hints.js +5 -4
- package/dist/command.js +6 -0
- package/dist/commands/api.js +3 -3
- package/dist/commands/async.js +7 -4
- package/dist/commands/chat.js +10 -12
- package/dist/commands/docs.js +5 -3
- package/dist/commands/fmt.js +6 -4
- package/dist/commands/index.js +2 -0
- package/dist/commands/init.js +106 -28
- package/dist/commands/limits-set.js +8 -9
- package/dist/commands/limits.js +4 -3
- package/dist/commands/loops.js +15 -14
- package/dist/commands/models.js +10 -12
- package/dist/commands/sandboxes.js +15 -14
- package/dist/commands/schema.js +6 -5
- package/dist/commands/session.js +27 -15
- package/dist/commands/setup.js +4 -2
- package/dist/commands/solution.js +152 -68
- package/dist/commands/tenants.js +14 -14
- package/dist/commands/values.js +62 -38
- package/dist/commands/work.js +18 -12
- package/dist/confirm-token.js +3 -1
- package/dist/contracts.js +2 -1
- package/dist/default-route.js +1 -1
- package/dist/features.js +2 -1
- package/dist/harness-ref.js +6 -4
- package/dist/http.js +4 -3
- package/dist/invoke.js +3 -2
- package/dist/kit-codes.js +9 -2
- package/dist/limits.js +1 -1
- package/dist/main.js +13 -1
- package/dist/mcp.js +65 -32
- package/dist/openapi.js +5 -2
- package/dist/operations.js +3 -2
- package/dist/package-check.js +10 -4
- package/dist/package-files.js +5 -1
- package/dist/package-format.js +10 -0
- package/dist/preview-report.js +44 -5
- package/dist/printed.js +182 -0
- package/dist/project.js +2 -1
- package/dist/results.js +1 -1
- package/dist/secret-access.js +30 -0
- package/dist/session.js +3 -11
- package/dist/shell.js +0 -3
- package/dist/skills/cavelon-authoring/SKILL.md +9 -2
- package/dist/skills/cavelon-long-running/SKILL.md +1 -1
- package/dist/skills/cavelon-loop/SKILL.md +16 -4
- package/dist/tenant-choice.js +7 -7
- package/dist/trace-view.js +1 -1
- package/dist/update-check.js +156 -10
- package/package.json +1 -1
package/dist/branches.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isOperatorChange } from "./limits.js";
|
|
2
|
+
import { cavelonCommand, fill } from "./printed.js";
|
|
2
3
|
export const BRANCH_WIDTH_KEY = "orchestration_max_branch_concurrency";
|
|
3
4
|
export const BRANCH_PROCESS_KEY = "orchestration_process_max_branch_inflight";
|
|
4
5
|
export const PARALLEL_BRANCHES_KEY = "orchestration_parallel_branches";
|
|
@@ -30,11 +31,11 @@ export function switchOnText(item, change) {
|
|
|
30
31
|
if (item.source !== "tenant")
|
|
31
32
|
return `the instance operator turns it on with ${item.setting} (a deploy)`;
|
|
32
33
|
if (change && isOperatorChange(change)) {
|
|
33
|
-
return (`an operator turns it on in the Admin (Configure › Feature Flags), or with
|
|
34
|
-
"--tenant
|
|
34
|
+
return (`an operator turns it on in the Admin (Configure › Feature Flags), or with ` +
|
|
35
|
+
`${cavelonCommand("limits", "set", PARALLEL_BRANCHES_KEY, "on", "--tenant", fill("tenant"), "--confirm")} and a Platform-mode token`);
|
|
35
36
|
}
|
|
36
37
|
if (change)
|
|
37
|
-
return `a tenant admin turns it on with
|
|
38
|
+
return `a tenant admin turns it on with ${cavelonCommand("limits", "set", PARALLEL_BRANCHES_KEY, "on", "--confirm")}`;
|
|
38
39
|
return "the instance operator turns it on for this tenant in the Admin (Configure › Feature Flags)";
|
|
39
40
|
}
|
|
40
41
|
export function offText(branches) {
|
package/dist/capacity.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { changedBy, formatValue, readLimits } from "./limits.js";
|
|
2
|
+
import { cavelonCommand, fill } from "./printed.js";
|
|
2
3
|
export const CAPACITY_WAIT_AFTER_MS = 30_000;
|
|
3
4
|
export const RUN_CAPACITY_BUSY = "run_capacity_busy";
|
|
4
5
|
export const MODEL_ENDPOINT_BUSY = "model_endpoint_busy";
|
|
@@ -86,7 +87,7 @@ export function capacityHint(code, limits) {
|
|
|
86
87
|
const caps = runCaps(limits);
|
|
87
88
|
const now = caps.length ? ` Now: ${caps.map(capText).join("; ")}.` : "";
|
|
88
89
|
const kit = caps.some((c) => c.change?.requires_role?.length)
|
|
89
|
-
? ` With a Platform-mode personal access token, the operator runs
|
|
90
|
+
? ` With a Platform-mode personal access token, the operator runs ${cavelonCommand("limits", "set", "max_concurrent_agent_runs_per_tenant", fill("n"), "--tenant", fill("tenant"), "--confirm")}.`
|
|
90
91
|
: "";
|
|
91
92
|
return ("Retrying later is fine; a trigger or channel run waits for a free slot on its own. " +
|
|
92
93
|
"To run more at once, the instance operator raises max_concurrent_agent_runs_per_tenant: for this tenant alone " +
|
|
@@ -97,7 +98,7 @@ export function capacityHint(code, limits) {
|
|
|
97
98
|
const waited = wait ? ` (${ENDPOINT_SLOT_WAIT_KEY} is ${formatValue(wait)}; ${changedBy(wait)} changes it with ${wait.setting})` : "";
|
|
98
99
|
return (`Retrying later is fine. The model endpoint was serving its max_concurrent_requests and no slot freed in time${waited}. ` +
|
|
99
100
|
"If the endpoint can serve more at once, a tenant admin raises max_concurrent_requests on its Model Registry row " +
|
|
100
|
-
"
|
|
101
|
+
`(${cavelonCommand("models", "set-limit", fill("model_id"), fill("n"))}, the Admin's model form, or PATCH /api/v1/model-registry/{model_registry_id}); ` +
|
|
101
102
|
"every row with the same base_url shares that count.");
|
|
102
103
|
}
|
|
103
104
|
function readLinkedRun(client, op) {
|
package/dist/code-hints.js
CHANGED
|
@@ -41,14 +41,15 @@ export function similarCodes(code, known, max = 8) {
|
|
|
41
41
|
}
|
|
42
42
|
return ranked.sort((a, b) => a.rank - b.rank || a.code.localeCompare(b.code, "en")).slice(0, max).map((r) => r.code);
|
|
43
43
|
}
|
|
44
|
-
const BY_CODE = {
|
|
44
|
+
export const BY_CODE = {
|
|
45
45
|
package_schema_invalid: "Run `cavelon validate`: it checks the package files against the package schema offline and names each field that " +
|
|
46
|
-
"does not match, with file, line and path. `cavelon schema <section>` shows a section's fields and a minimal entry."
|
|
46
|
+
"does not match, with file, line and path. `cavelon schema <section>` shows a section's fields and a minimal entry. " +
|
|
47
|
+
"A missing manifest comes from `cavelon pull`, or `cavelon init` in the folder writes a minimal one.",
|
|
47
48
|
package_requirements_changed: "Run `cavelon apply` again for a new preview, show it, and confirm its id with `cavelon apply --confirm <preview-id>`.",
|
|
48
49
|
import_preview_stale: "Run `cavelon apply` again for a new preview, show it, and confirm its id with `cavelon apply --confirm <preview-id>`.",
|
|
49
50
|
};
|
|
50
|
-
const BY_ROUTE = [
|
|
51
|
-
{ route: "/api/v1/meta/package-schema", command: "`cavelon schema
|
|
51
|
+
export const BY_ROUTE = [
|
|
52
|
+
{ route: "/api/v1/meta/package-schema", command: "`cavelon schema` shows the package schema, `cavelon schema <section>` one section; `cavelon validate` checks the files against it." },
|
|
52
53
|
{ route: "/api/v1/meta/error-catalog", command: "`cavelon explain <code>` reads the error catalog." },
|
|
53
54
|
{ route: "/api/v1/meta/capabilities", command: "`cavelon status` and `cavelon limits` read the capabilities." },
|
|
54
55
|
{ route: "/api/v1/agent-graph/import/preview", command: "`cavelon apply` previews the package files." },
|
package/dist/command.js
CHANGED
|
@@ -29,6 +29,12 @@ export function renameFormerOptions(spec, args, warn) {
|
|
|
29
29
|
}
|
|
30
30
|
return out;
|
|
31
31
|
}
|
|
32
|
+
export function propertyName(name) {
|
|
33
|
+
return name.replaceAll("-", "_");
|
|
34
|
+
}
|
|
35
|
+
export function ownsTenant(spec) {
|
|
36
|
+
return Boolean(spec.positionals?.some((p) => p.name === "tenant") || spec.options?.tenant);
|
|
37
|
+
}
|
|
32
38
|
export const GLOBAL_OPTIONS = {
|
|
33
39
|
json: { type: "boolean", description: "Print one JSON document instead of text." },
|
|
34
40
|
instance: { type: "string", value: "<url>", description: "The instance URL (overrides CAVELON_URL and cavelon.yaml)." },
|
package/dist/commands/api.js
CHANGED
|
@@ -10,7 +10,7 @@ import { confinedPath } from "../paths.js";
|
|
|
10
10
|
import { describeSchema, findOperation, jsonBodySchema, matchedLoosely, operations, schemaTypes, secretFields, secretPaths } from "../openapi.js";
|
|
11
11
|
import { harnessNotFoundError, lookupHarness } from "../harness-ref.js";
|
|
12
12
|
import { CONFIRM_TOKEN, confirmToken, confirmTokenRequired, confirmWith } from "../confirm-token.js";
|
|
13
|
-
import { cavelonCommand } from "../
|
|
13
|
+
import { cavelonCommand, fill } from "../printed.js";
|
|
14
14
|
export const JSON_BODY_DEPRECATED = "`--json <body>` as the request body is deprecated and will be removed in a later release; pass the body with --body. " +
|
|
15
15
|
"--json alone prints JSON, as on every command.";
|
|
16
16
|
export function splitJsonBody(args, warn) {
|
|
@@ -160,7 +160,7 @@ function secretRefusal(op, fields, driven) {
|
|
|
160
160
|
code: "secret_field_for_a_person",
|
|
161
161
|
message: `The request to ${op.alias} sets ${named}, which the instance marks as a secret value (x-cavelon-secret); ` +
|
|
162
162
|
`a person enters secret values, so ${notSentBy(driven)}`,
|
|
163
|
-
hint: personHint(
|
|
163
|
+
hint: personHint(`A person sets a secret value in their terminal with \`${cavelonCommand("secrets", "set", fill("name"))}\`, or enters it in the Admin. Leave the field out to send the rest.`, driven),
|
|
164
164
|
details: { fields },
|
|
165
165
|
});
|
|
166
166
|
}
|
|
@@ -364,7 +364,7 @@ export const apiList = {
|
|
|
364
364
|
if (tag) {
|
|
365
365
|
ops = ops.filter((o) => o.tags.includes(tag));
|
|
366
366
|
if (ops.length === 0)
|
|
367
|
-
throw usageError(`No operations tagged "${tag}".`, "
|
|
367
|
+
throw usageError(`No operations tagged "${tag}".`, `\`${cavelonCommand("api", "list", "--tags")}\` shows the tags.`);
|
|
368
368
|
}
|
|
369
369
|
const method = stringOption(input, "method")?.toUpperCase();
|
|
370
370
|
if (method)
|
package/dist/commands/async.js
CHANGED
|
@@ -3,6 +3,7 @@ import { stringOption, parseDuration } from "../command.js";
|
|
|
3
3
|
import { CavelonError, ExitCode, usageError } from "../errors.js";
|
|
4
4
|
import { combinedExitCode, describe, exitCodeFor, getOperation, isSettled, TERMINAL, waitFor } from "../operations.js";
|
|
5
5
|
import { failureLines, resultFailure } from "../results.js";
|
|
6
|
+
import { cavelonCommand } from "../printed.js";
|
|
6
7
|
import { readEvents } from "../sse.js";
|
|
7
8
|
export const DEFAULT_WAIT = "90s";
|
|
8
9
|
const MCP_TIMEOUT_MS = 0;
|
|
@@ -42,6 +43,7 @@ export async function waitAndReport(ctx, ids, timeout) {
|
|
|
42
43
|
onChange: progress ? (op) => ctx.io.stderr.write(`${ctx.style.dim(describe(op).split("\n")[0])}\n`) : undefined,
|
|
43
44
|
});
|
|
44
45
|
const pending = operations.filter((o) => !isSettled(o)).map((o) => o.id);
|
|
46
|
+
const resume = cavelonCommand("wait", ...pending);
|
|
45
47
|
const note = capacityNotes(ctx, client);
|
|
46
48
|
const notes = await Promise.all(operations.map(async (op) => withResult(await note(op), await resultFailure(ctx, op))));
|
|
47
49
|
const exitCode = combinedExitCode(operations, notes);
|
|
@@ -54,7 +56,7 @@ export async function waitAndReport(ctx, ids, timeout) {
|
|
|
54
56
|
timed_out: timedOut,
|
|
55
57
|
timeout_ms: timeout,
|
|
56
58
|
waited_ms: waitedMs,
|
|
57
|
-
...(pending.length ? { resume
|
|
59
|
+
...(pending.length ? { resume } : {}),
|
|
58
60
|
...(waits.length ? { capacity_waits: waits } : {}),
|
|
59
61
|
...(refusals.length ? { capacity_refusals: refusals } : {}),
|
|
60
62
|
...(failedResults.length ? { failed_results: failedResults } : {}),
|
|
@@ -63,7 +65,7 @@ export async function waitAndReport(ctx, ids, timeout) {
|
|
|
63
65
|
const body = lines.join("\n");
|
|
64
66
|
const why = waits.length === pending.length ? "Waiting for run capacity" : "Still running";
|
|
65
67
|
if (pending.length) {
|
|
66
|
-
lines.push(timeout === 0 ? `${why}. Wait with:
|
|
68
|
+
lines.push(timeout === 0 ? `${why}. Wait with: ${resume}` : `${why} after the timeout; resume with: ${resume}`);
|
|
67
69
|
}
|
|
68
70
|
return { data, text: lines.join("\n"), exitCode, body, pending, why };
|
|
69
71
|
}
|
|
@@ -97,6 +99,7 @@ export const wait = {
|
|
|
97
99
|
};
|
|
98
100
|
export const watch = {
|
|
99
101
|
name: "watch",
|
|
102
|
+
mcpInstead: "wait",
|
|
100
103
|
summary: "Stream an operation's changes until it ends (server-sent events).",
|
|
101
104
|
description: "Prints one line per change (one JSON object per line with --json). A needs_action state is shown and the stream goes on.",
|
|
102
105
|
readOnly: true,
|
|
@@ -129,7 +132,7 @@ export const watch = {
|
|
|
129
132
|
throw new CavelonError(ExitCode.server, {
|
|
130
133
|
code: "stream_error",
|
|
131
134
|
message: `The event stream of ${id} kept dropping.`,
|
|
132
|
-
hint:
|
|
135
|
+
hint: `\`${cavelonCommand("wait", id)}\` polls instead.`,
|
|
133
136
|
});
|
|
134
137
|
}
|
|
135
138
|
await ctx.io.sleep(Math.min(1000 * 2 ** (failures - 1), 10_000, Math.max(0, deadline - Date.now())));
|
|
@@ -220,7 +223,7 @@ export const watch = {
|
|
|
220
223
|
}
|
|
221
224
|
if (!settled) {
|
|
222
225
|
const wait = (await note(last))?.capacity_wait;
|
|
223
|
-
ctx.io.stderr.write(`Stopped watching; ${id} is still ${last.status}. Resume:
|
|
226
|
+
ctx.io.stderr.write(`Stopped watching; ${id} is still ${last.status}. Resume: ${cavelonCommand("watch", id)}\n${wait ? ` ${wait.note}\n` : ""}`);
|
|
224
227
|
}
|
|
225
228
|
const unsettled = last.status === "needs_action" ? ExitCode.needsAction : ExitCode.timeout;
|
|
226
229
|
return { data: undefined, text: "", exitCode: settled ? exitCodeFor(last, { result_failure: failure }) : unsettled };
|
package/dist/commands/chat.js
CHANGED
|
@@ -5,8 +5,7 @@ import { CavelonError, ExitCode, usageError } from "../errors.js";
|
|
|
5
5
|
import { clip } from "../format.js";
|
|
6
6
|
import { harnessNotFoundError, lookupHarness } from "../harness-ref.js";
|
|
7
7
|
import { callStable, workflowOperation } from "../invoke.js";
|
|
8
|
-
import {
|
|
9
|
-
import { cavelonCommand } from "../shell.js";
|
|
8
|
+
import { cavelonCommand, fill } from "../printed.js";
|
|
10
9
|
import { MCP_MAX_WAIT_MS } from "./async.js";
|
|
11
10
|
function harnessRef(session, input) {
|
|
12
11
|
const option = stringOption(input, "harness");
|
|
@@ -22,8 +21,7 @@ async function findHarness(ctx, ref, source, command) {
|
|
|
22
21
|
const { harness, candidates } = await lookupHarness(ctx, ref);
|
|
23
22
|
if (harness)
|
|
24
23
|
return harness;
|
|
25
|
-
|
|
26
|
-
throw harnessNotFoundError(ref, candidates, source === "option" ? undefined : source, (slug) => command(slug) + flags, flags);
|
|
24
|
+
throw harnessNotFoundError(ref, candidates, source === "option" ? undefined : source, command);
|
|
27
25
|
}
|
|
28
26
|
const HARNESS_OPTION = {
|
|
29
27
|
type: "string",
|
|
@@ -36,9 +34,9 @@ function chatError(error, harness) {
|
|
|
36
34
|
if (!(error instanceof CavelonError) || error.status !== 409)
|
|
37
35
|
return error;
|
|
38
36
|
const hint = !harness
|
|
39
|
-
?
|
|
37
|
+
? `Nothing answers on the tenant's default route yet: name a solution with --harness, or make an active one the default (\`${cavelonCommand("harness", "default", fill("solution"))}\`).`
|
|
40
38
|
: harness.status !== "active"
|
|
41
|
-
? `${named(harness)} is ${harness.status}: a draft answers only a person's token (as a Playground run), never a tenant API key. Use a personal access token, or activate it first (
|
|
39
|
+
? `${named(harness)} is ${harness.status}: a draft answers only a person's token (as a Playground run), never a tenant API key. Use a personal access token, or activate it first (\`${cavelonCommand("activate", "--harness", harness.slug)}\`).`
|
|
42
40
|
: "A session belongs to the solution it started with: leave out --session to start a new one.";
|
|
43
41
|
return new CavelonError(error.exitCode, { code: error.code, status: error.status, message: error.message, hint, docs: error.docs, details: error.details });
|
|
44
42
|
}
|
|
@@ -69,7 +67,7 @@ export const chat = {
|
|
|
69
67
|
const timeout = Math.min(parseDuration(raw ?? DEFAULT_CHAT_TIMEOUT), ctx.mode === "mcp" ? MCP_MAX_WAIT_MS : Number.MAX_SAFE_INTEGER);
|
|
70
68
|
const session = await ctx.session();
|
|
71
69
|
const { ref, source } = harnessRef(session, input);
|
|
72
|
-
const harness = ref ? await findHarness(ctx, ref, source, (slug) => cavelonCommand("chat", "
|
|
70
|
+
const harness = ref ? await findHarness(ctx, ref, source, (slug) => cavelonCommand("chat", fill("message"), "--harness", slug)) : undefined;
|
|
73
71
|
const body = { message, stream: false };
|
|
74
72
|
if (harness)
|
|
75
73
|
body.harness_id = harness.id;
|
|
@@ -87,7 +85,7 @@ export const chat = {
|
|
|
87
85
|
if (answer.retrieval_warning)
|
|
88
86
|
ctx.warn(answer.retrieval_warning);
|
|
89
87
|
const next = {
|
|
90
|
-
continue: cavelonCommand("chat", "
|
|
88
|
+
continue: cavelonCommand("chat", fill("message"), "--session", answer.session_id),
|
|
91
89
|
trace: cavelonCommand("trace", answer.conversation_id, "--kind", "conversation"),
|
|
92
90
|
};
|
|
93
91
|
const who = harness ? named(harness) : "The default route";
|
|
@@ -131,7 +129,7 @@ export const deactivate = {
|
|
|
131
129
|
const session = await ctx.session();
|
|
132
130
|
const { ref, source } = harnessRef(session, input);
|
|
133
131
|
if (!ref)
|
|
134
|
-
throw usageError("Which solution?",
|
|
132
|
+
throw usageError("Which solution?", `Pass --harness <name or slug> (\`${cavelonCommand("harness", "list")}\` shows them), or set harness in cavelon.yaml or the env file.`);
|
|
135
133
|
if (ctx.mode === "mcp" && input.options.confirm === true)
|
|
136
134
|
throw confirmTokenRequired("deactivate");
|
|
137
135
|
await workflowOperation(ctx, "POST", "/api/v1/harnesses/{harness_id}/deactivate", "deactivating solutions").catch((error) => {
|
|
@@ -139,7 +137,7 @@ export const deactivate = {
|
|
|
139
137
|
throw new CavelonError(ExitCode.failure, {
|
|
140
138
|
code: "operation_unavailable",
|
|
141
139
|
message: "This instance publishes no route to deactivate a solution; nothing was changed.",
|
|
142
|
-
hint:
|
|
140
|
+
hint: `A person deactivates it in the Admin; the instance may be older than the route (\`${cavelonCommand("status")}\` shows its version).`,
|
|
143
141
|
});
|
|
144
142
|
}
|
|
145
143
|
throw error;
|
|
@@ -154,7 +152,7 @@ export const deactivate = {
|
|
|
154
152
|
throw new CavelonError(ExitCode.needsAction, {
|
|
155
153
|
code: "default_route_deactivate",
|
|
156
154
|
message: `${named(harness)} is the tenant's default route: the tenant's chat and widget answer with it. Nothing was changed.`,
|
|
157
|
-
hint:
|
|
155
|
+
hint: `Ask the person which solution should answer there instead, make it the default (\`${cavelonCommand("harness", "default", fill("solution"))}\`, previews first), then deactivate this one.`,
|
|
158
156
|
details: { harness: target },
|
|
159
157
|
});
|
|
160
158
|
}
|
|
@@ -177,7 +175,7 @@ export const deactivate = {
|
|
|
177
175
|
});
|
|
178
176
|
return {
|
|
179
177
|
data: { changed: true, harness: { ...target, status: updated?.status ?? target.status } },
|
|
180
|
-
text: `Deactivated ${named(harness)}; status ${updated?.status ?? "unknown"}.
|
|
178
|
+
text: `Deactivated ${named(harness)}; status ${updated?.status ?? "unknown"}. \`${cavelonCommand("activate", "--harness", harness.slug)}\` puts it back through its readiness gate.`,
|
|
181
179
|
};
|
|
182
180
|
},
|
|
183
181
|
};
|
package/dist/commands/docs.js
CHANGED
|
@@ -2,7 +2,7 @@ import { intOption, positional } from "../command.js";
|
|
|
2
2
|
import { CavelonError, ExitCode } from "../errors.js";
|
|
3
3
|
import { table } from "../format.js";
|
|
4
4
|
import { NOT_HERE } from "../http.js";
|
|
5
|
-
import { cavelonCommand } from "../
|
|
5
|
+
import { cavelonCommand, fill } from "../printed.js";
|
|
6
6
|
const INDEX_PATHS = ["/llms.txt", "/api/v1/docs/llms.txt"];
|
|
7
7
|
function unavailable(url) {
|
|
8
8
|
return new CavelonError(ExitCode.failure, {
|
|
@@ -296,6 +296,7 @@ export function searchIndex(entries, query) {
|
|
|
296
296
|
const INDEX_REF = "index";
|
|
297
297
|
export const docsSearch = {
|
|
298
298
|
name: "docs search",
|
|
299
|
+
tenantless: true,
|
|
299
300
|
summary: "Search this instance's docs (titles and summaries).",
|
|
300
301
|
description: "Ranks the pages of the instance's docs index by the words of the question in their titles, addresses and\n" +
|
|
301
302
|
"summaries, rare words counting more than common ones. Stop words (English and German) are ignored, words match\n" +
|
|
@@ -320,12 +321,13 @@ export const docsSearch = {
|
|
|
320
321
|
`or read the list of all ${entries.length} pages with: ${cavelonCommand("docs", "get", INDEX_REF)}`;
|
|
321
322
|
return {
|
|
322
323
|
data: { query, terms, items, total: hits.length, ...(items.length ? {} : { hint: none }) },
|
|
323
|
-
text: items.length ? `${table(items, ["page", "title", "description"], 70)}\n\nRead one:
|
|
324
|
+
text: items.length ? `${table(items, ["page", "title", "description"], 70)}\n\nRead one: ${cavelonCommand("docs", "get", fill("page"))}` : none,
|
|
324
325
|
};
|
|
325
326
|
},
|
|
326
327
|
};
|
|
327
328
|
export const docsGet = {
|
|
328
329
|
name: "docs get",
|
|
330
|
+
tenantless: true,
|
|
329
331
|
summary: "Print one docs page as markdown.",
|
|
330
332
|
readOnly: true,
|
|
331
333
|
idempotent: true,
|
|
@@ -357,7 +359,7 @@ export const docsGet = {
|
|
|
357
359
|
throw new CavelonError(ExitCode.failure, {
|
|
358
360
|
code: "doc_not_found",
|
|
359
361
|
message: `No docs page "${ref}" on this instance.`,
|
|
360
|
-
hint: near.length ? `Did you mean: ${near.join(", ")}?` :
|
|
362
|
+
hint: near.length ? `Did you mean: ${near.join(", ")}?` : `Find it with \`${cavelonCommand("docs", "search", fill("words"))}\`.`,
|
|
361
363
|
});
|
|
362
364
|
}
|
|
363
365
|
const response = await client.get(entry.url, { accept: "text/markdown, text/plain" });
|
package/dist/commands/fmt.js
CHANGED
|
@@ -7,6 +7,7 @@ import { uncommitted } from "../git.js";
|
|
|
7
7
|
import { fileDigest, fileDigests, readPulledFiles, rememberAppliedFiles } from "../local-state.js";
|
|
8
8
|
import { packageVersionOf } from "../package-check.js";
|
|
9
9
|
import { canonical, contentPath, readPackage } from "../package-files.js";
|
|
10
|
+
import { cavelonCommand } from "../printed.js";
|
|
10
11
|
import { exportForm, sectionContent, toYaml } from "../package-format.js";
|
|
11
12
|
import { requireInstance } from "../session.js";
|
|
12
13
|
import { requireSolution, schemaFor } from "./solution.js";
|
|
@@ -31,6 +32,7 @@ function droppedComments(before, after) {
|
|
|
31
32
|
}
|
|
32
33
|
export const fmt = {
|
|
33
34
|
name: "fmt",
|
|
35
|
+
tenantless: true,
|
|
34
36
|
summary: "Bring the package files into the export's form (field order and defaults from the package schema), offline.",
|
|
35
37
|
description: "A file whose value the export would spell differently is rewritten: each field in the schema's order, and each field it\n" +
|
|
36
38
|
"leaves out set to what the instance gives it, as the export writes it: the schema's default, an empty list or object for\n" +
|
|
@@ -63,7 +65,7 @@ export const fmt = {
|
|
|
63
65
|
throw new CavelonError(ExitCode.validation, {
|
|
64
66
|
code: "package_file_invalid",
|
|
65
67
|
message: `${invalid.length} package file${invalid.length === 1 ? "" : "s"} cannot be read: ${invalid.map((f) => `${f.file}${f.line ? `:${f.line}` : ""}`).join(", ")}.`,
|
|
66
|
-
hint:
|
|
68
|
+
hint: `Fix them first (\`${cavelonCommand("validate")}\` names each); fmt changes nothing until then.`,
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
71
|
const version = packageVersionOf(disk.package) ?? project.packageVersion;
|
|
@@ -72,7 +74,7 @@ export const fmt = {
|
|
|
72
74
|
throw new CavelonError(ExitCode.failure, {
|
|
73
75
|
code: "package_schema_unavailable",
|
|
74
76
|
message: `No package schema${version ? ` for format ${version}` : ""} is cached for this instance, and it was not read.`,
|
|
75
|
-
hint:
|
|
77
|
+
hint: `Run \`${cavelonCommand("fmt")}\` (or \`${cavelonCommand("validate")}\`) once without --offline while the instance is reachable.`,
|
|
76
78
|
});
|
|
77
79
|
}
|
|
78
80
|
const changes = [];
|
|
@@ -141,7 +143,7 @@ export const fmt = {
|
|
|
141
143
|
text: files.length
|
|
142
144
|
? [
|
|
143
145
|
...files.map((f) => `would format ${f}`),
|
|
144
|
-
`${files.length} file${files.length === 1 ? "" : "s"} not in the export's form; run
|
|
146
|
+
`${files.length} file${files.length === 1 ? "" : "s"} not in the export's form; run \`${cavelonCommand("fmt")}\`.`,
|
|
145
147
|
...(lost.length ? [`fmt would drop the comments of ${commentList}; keep notes you need elsewhere first.`] : []),
|
|
146
148
|
].join("\n")
|
|
147
149
|
: `All ${unchanged} package files are in the export's form.`,
|
|
@@ -165,7 +167,7 @@ export const fmt = {
|
|
|
165
167
|
text: [
|
|
166
168
|
...written.map((f) => `formatted ${f}`),
|
|
167
169
|
`${written.length} file${written.length === 1 ? "" : "s"} formatted, ${unchanged} already in the export's form.`,
|
|
168
|
-
...(written.length ? [
|
|
170
|
+
...(written.length ? [`Check it: ${cavelonCommand("validate")}${diffable ? "; then git diff shows what changed." : "."}`] : []),
|
|
169
171
|
].join("\n"),
|
|
170
172
|
};
|
|
171
173
|
},
|
package/dist/commands/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import { loopCancel, loopIterations, loopPause, loopResume, loopStart, loopWatch
|
|
|
19
19
|
import { artifactsExport, sandboxActivity, sandboxCat, sandboxFiles, sandboxList, sandboxLogs, sandboxReceipt, sandboxRefresh, sandboxSeed, sandboxValidate, } from "./sandboxes.js";
|
|
20
20
|
const commandsList = {
|
|
21
21
|
name: "commands",
|
|
22
|
+
tenantless: true,
|
|
22
23
|
summary: "List every command, whether it is read-only, and its MCP tool.",
|
|
23
24
|
readOnly: true,
|
|
24
25
|
idempotent: true,
|
|
@@ -36,6 +37,7 @@ const commandsList = {
|
|
|
36
37
|
};
|
|
37
38
|
const mcp = {
|
|
38
39
|
name: "mcp",
|
|
40
|
+
tenantless: true,
|
|
39
41
|
summary: "Serve the commands as MCP tools on stdio (for coding agents).",
|
|
40
42
|
description: "Started by the agent's plugin (`cavelon mcp`); it does not return until the agent disconnects.",
|
|
41
43
|
readOnly: false,
|