@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
|
@@ -10,7 +10,7 @@ import { clip, keyValues, moreHint, table } from "../format.js";
|
|
|
10
10
|
import { bodyBytes } from "../http.js";
|
|
11
11
|
import { buildRequest, callStable, workflowOperation } from "../invoke.js";
|
|
12
12
|
import { isUuid } from "../session.js";
|
|
13
|
-
import { cavelonCommand } from "../
|
|
13
|
+
import { cavelonCommand, fill } from "../printed.js";
|
|
14
14
|
import { archiveFrom } from "../tar.js";
|
|
15
15
|
import { TIMEOUT_OPTION, timeoutMs, waitAndReport } from "./async.js";
|
|
16
16
|
import { resolveHarnessId } from "../harness-ref.js";
|
|
@@ -61,7 +61,7 @@ export async function resolveSandbox(ctx, ref) {
|
|
|
61
61
|
throw new CavelonError(ExitCode.failure, {
|
|
62
62
|
code: hits.length ? "sandbox_ambiguous" : "sandbox_not_found",
|
|
63
63
|
message: hits.length ? `${hits.length} Sandboxes are named "${ref}"; pass its id.` : `No Sandbox "${ref}" in this tenant.`,
|
|
64
|
-
hint: "
|
|
64
|
+
hint: `\`${cavelonCommand("sandbox", "list")}\` lists them.`,
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
const REFUSALS = {
|
|
@@ -69,17 +69,17 @@ const REFUSALS = {
|
|
|
69
69
|
code: "sandbox_capability_unavailable",
|
|
70
70
|
what: "archive import and export",
|
|
71
71
|
elsewhere: (s) => `On a customer VM, put the files into its directory on the VM, then run \`${cavelonCommand("sandbox", "refresh", s.name)}\`; ` +
|
|
72
|
-
`read results with \`${cavelonCommand("sandbox", "files", s.name)}\` and \`${cavelonCommand("sandbox", "cat", s.name)}
|
|
72
|
+
`read results with \`${cavelonCommand("sandbox", "files", s.name)}\` and \`${cavelonCommand("sandbox", "cat", s.name, fill("path"))}\`.`,
|
|
73
73
|
},
|
|
74
74
|
receipt: {
|
|
75
75
|
code: "sandbox_validation_receipt_unavailable",
|
|
76
76
|
what: "a runner validation receipt (it reports agent_reported completion only)",
|
|
77
|
-
elsewhere: (s) => `The evidence is the files: \`${cavelonCommand("sandbox", "files", s.name)}\` and \`${cavelonCommand("sandbox", "cat", s.name)}
|
|
77
|
+
elsewhere: (s) => `The evidence is the files: \`${cavelonCommand("sandbox", "files", s.name)}\` and \`${cavelonCommand("sandbox", "cat", s.name, fill("path"))}\`.`,
|
|
78
78
|
},
|
|
79
79
|
refresh: {
|
|
80
80
|
code: "sandbox_workspace_refresh_unavailable",
|
|
81
81
|
what: "a workspace refresh (nothing edits it outside Cavelon)",
|
|
82
|
-
elsewhere: (s) => `Seed an isolated container with \`${cavelonCommand("sandbox", "seed", s.name)}
|
|
82
|
+
elsewhere: (s) => `Seed an isolated container with \`${cavelonCommand("sandbox", "seed", s.name, fill("folder"))}\`.`,
|
|
83
83
|
},
|
|
84
84
|
};
|
|
85
85
|
function requireOffer(ctx, sandbox, offer, command) {
|
|
@@ -156,7 +156,7 @@ export const sandboxList = {
|
|
|
156
156
|
return {
|
|
157
157
|
data: { items, next_cursor: next, instance_modes: modes ?? null },
|
|
158
158
|
text: (table(items, ["name", "mode", "state", "ready", "revision", "connection", "id"]) || "No Sandboxes.") +
|
|
159
|
-
moreHint(next, "
|
|
159
|
+
moreHint(next, cavelonCommand("sandbox", "list")) +
|
|
160
160
|
(modes ? `\n\nNew Sandboxes on this instance: ${modes.join(", ") || "none (switched off)"}.` : ""),
|
|
161
161
|
};
|
|
162
162
|
},
|
|
@@ -446,13 +446,13 @@ function jobFailed(job) {
|
|
|
446
446
|
return new CavelonError(ExitCode.failure, {
|
|
447
447
|
code: job.error_code ?? "sandbox_artifact_job_failed",
|
|
448
448
|
message: `Archive job ${job.id} ${job.status}${job.error_code ? ": " + job.error_code : ""}.`,
|
|
449
|
-
hint: job.error_code ?
|
|
449
|
+
hint: job.error_code ? `\`${cavelonCommand("explain", job.error_code)}\` says what it means.` : undefined,
|
|
450
450
|
});
|
|
451
451
|
}
|
|
452
452
|
const UPLOAD_READY_MS = 30_000;
|
|
453
|
-
function seedCommand(sandbox, input) {
|
|
453
|
+
function seedCommand(sandbox, input, token) {
|
|
454
454
|
const harness = stringOption(input, "harness");
|
|
455
|
-
return cavelonCommand("sandbox", "seed", sandbox.name, positional(input, "source"), ...(harness ? ["--harness", harness] : []), "--confirm");
|
|
455
|
+
return cavelonCommand("sandbox", "seed", sandbox.name, positional(input, "source"), ...(harness ? ["--harness", harness] : []), "--confirm", ...(token ? [token] : []));
|
|
456
456
|
}
|
|
457
457
|
export const sandboxSeed = {
|
|
458
458
|
name: "sandbox seed",
|
|
@@ -495,7 +495,7 @@ export const sandboxSeed = {
|
|
|
495
495
|
archive: { from: archive.from, sha256: archive.sha256, size_bytes: archive.bytes.length, ...(archive.files >= 0 ? { files: archive.files, folders: archive.directories } : {}) },
|
|
496
496
|
};
|
|
497
497
|
if (sandbox.lifecycle_state !== "ready")
|
|
498
|
-
ctx.warn(`Sandbox "${sandbox.name}" is ${sandbox.lifecycle_state}; the instance accepts a seed only when it is ready (
|
|
498
|
+
ctx.warn(`Sandbox "${sandbox.name}" is ${sandbox.lifecycle_state}; the instance accepts a seed only when it is ready (\`${cavelonCommand("sandbox", "validate", sandbox.name)}\`).`);
|
|
499
499
|
if (sandbox.writer_owner_run_id)
|
|
500
500
|
ctx.warn(`Run ${sandbox.writer_owner_run_id} holds the Sandbox's writer; the instance refuses a seed until it ends.`);
|
|
501
501
|
const what = archive.files >= 0 ? `${archive.files} files in ${archive.directories} folders` : "the tar archive";
|
|
@@ -523,7 +523,8 @@ export const sandboxSeed = {
|
|
|
523
523
|
}
|
|
524
524
|
if (job.status === "failed" || job.status === "cancelled")
|
|
525
525
|
throw jobFailed(job);
|
|
526
|
-
const
|
|
526
|
+
const given = input.options.confirm;
|
|
527
|
+
const resume = seedCommand(sandbox, input, typeof given === "string" && given ? given : undefined);
|
|
527
528
|
if (job.status === "active" && job.phase === "awaiting_upload") {
|
|
528
529
|
job = await upload(ctx, sandbox.id, job.id, archive.bytes);
|
|
529
530
|
}
|
|
@@ -541,7 +542,7 @@ export const sandboxSeed = {
|
|
|
541
542
|
}
|
|
542
543
|
return {
|
|
543
544
|
data: result,
|
|
544
|
-
text: `Sent ${what} to "${sandbox.name}"; the import runs on the instance.\nWait with:
|
|
545
|
+
text: `Sent ${what} to "${sandbox.name}"; the import runs on the instance.\nWait with: ${cavelonCommand("wait", job.operation_id)}`,
|
|
545
546
|
};
|
|
546
547
|
},
|
|
547
548
|
};
|
|
@@ -599,7 +600,7 @@ async function download(ctx, sandbox, job, out) {
|
|
|
599
600
|
throw new CavelonError(ExitCode.conflict, {
|
|
600
601
|
code: "file_exists",
|
|
601
602
|
message: `${file} exists; cavelon does not overwrite it.`,
|
|
602
|
-
hint: `Choose another file with --out, then: ${cavelonCommand("artifacts", "export", sandbox.name, "--job", job.id, "--out")}
|
|
603
|
+
hint: `Choose another file with --out, then: ${cavelonCommand("artifacts", "export", sandbox.name, "--job", job.id, "--out", fill("file"))}`,
|
|
603
604
|
});
|
|
604
605
|
}
|
|
605
606
|
throw error;
|
|
@@ -657,7 +658,7 @@ export const artifactsExport = {
|
|
|
657
658
|
if (!(boolOption(input, "wait") && ctx.mode === "cli")) {
|
|
658
659
|
return {
|
|
659
660
|
data: { ...base, status: job.status, phase: job.phase, download: later },
|
|
660
|
-
text: `Export job ${job.id} is ${job.phase}.\nWait with:
|
|
661
|
+
text: `Export job ${job.id} is ${job.phase}.\nWait with: ${cavelonCommand("wait", job.operation_id)}\nThen download: ${later}`,
|
|
661
662
|
exitCode: jobRef ? ExitCode.timeout : ExitCode.ok,
|
|
662
663
|
};
|
|
663
664
|
}
|
package/dist/commands/schema.js
CHANGED
|
@@ -4,6 +4,7 @@ import { CavelonError, ExitCode, usageError } from "../errors.js";
|
|
|
4
4
|
import { clip, keyValues, table } from "../format.js";
|
|
5
5
|
import { deref, schemaTypes } from "../openapi.js";
|
|
6
6
|
import { DEFAULT_LAYOUT } from "../package-files.js";
|
|
7
|
+
import { cavelonCommand, fill } from "../printed.js";
|
|
7
8
|
import { requireInstance } from "../session.js";
|
|
8
9
|
import { schemaFor } from "./solution.js";
|
|
9
10
|
const EXAMPLE_DEPTH = 4;
|
|
@@ -204,7 +205,7 @@ function unknownField(found) {
|
|
|
204
205
|
const guess = near.length ? `Did you mean: ${near.map((o) => `${found.at}.${o}`).join(", ")}? ` : "";
|
|
205
206
|
return usageError(`The package schema has no nested field "${found.key}" under ${found.at}.`, found.options.length
|
|
206
207
|
? `${guess}Nested under ${found.at}: ${found.options.join(", ")}.`
|
|
207
|
-
: `Nothing under ${found.at} has fields of its own;
|
|
208
|
+
: `Nothing under ${found.at} has fields of its own; \`${cavelonCommand("schema", found.at)}\` shows its fields.`);
|
|
208
209
|
}
|
|
209
210
|
function findTarget(schema, name) {
|
|
210
211
|
const defs = (schema.$defs ?? {});
|
|
@@ -221,7 +222,7 @@ function findTarget(schema, name) {
|
|
|
221
222
|
}
|
|
222
223
|
const lower = name.toLowerCase();
|
|
223
224
|
const near = [...Object.keys(schema.properties), ...Object.keys(defs)].filter((s) => s.toLowerCase().includes(lower) || lower.includes(s.toLowerCase())).slice(0, 5);
|
|
224
|
-
throw usageError(`The package schema has no section or type "${name}".`, near.length ? `Did you mean: ${near.join(", ")}? (
|
|
225
|
+
throw usageError(`The package schema has no section or type "${name}".`, near.length ? `Did you mean: ${near.join(", ")}? (\`${cavelonCommand("schema")}\` lists them)` : `\`${cavelonCommand("schema")}\` lists the sections.`);
|
|
225
226
|
}
|
|
226
227
|
function targetData(schema, target, context) {
|
|
227
228
|
const { node, usedIn } = target;
|
|
@@ -293,7 +294,7 @@ function fieldLines(data) {
|
|
|
293
294
|
if (data.nested_example)
|
|
294
295
|
lines.push("", "With one entry of each nested list:", yamlOf(data.nested_example));
|
|
295
296
|
if (data.nested.length) {
|
|
296
|
-
const rows = data.nested.map((n) => ({ command:
|
|
297
|
+
const rows = data.nested.map((n) => ({ command: cavelonCommand("schema", n.path), type: n.type }));
|
|
297
298
|
lines.push("", "Fields with fields of their own:", table(rows, ["command", "type"], 60, ["command"]));
|
|
298
299
|
}
|
|
299
300
|
return lines;
|
|
@@ -342,7 +343,7 @@ export const schema = {
|
|
|
342
343
|
code: "package_schema_unavailable",
|
|
343
344
|
message: "No package schema is cached for this instance, and it was not read.",
|
|
344
345
|
hint: offline
|
|
345
|
-
?
|
|
346
|
+
? `Run \`${cavelonCommand("schema")}\` once without --offline while the instance is reachable.`
|
|
346
347
|
: "The instance does not publish its package schema (/api/v1/meta/package-schema).",
|
|
347
348
|
});
|
|
348
349
|
}
|
|
@@ -364,7 +365,7 @@ export const schema = {
|
|
|
364
365
|
"",
|
|
365
366
|
table(items, ["section", "kind", "required", "file"]),
|
|
366
367
|
"",
|
|
367
|
-
|
|
368
|
+
`One section's fields and a minimal example: ${cavelonCommand("schema", fill("section"))}; a nested field's: ${cavelonCommand("schema", fill("section.field"))}`,
|
|
368
369
|
].join("\n"),
|
|
369
370
|
};
|
|
370
371
|
}
|
package/dist/commands/session.js
CHANGED
|
@@ -11,9 +11,10 @@ import { readAll } from "../io.js";
|
|
|
11
11
|
import { listPreviews, readPull } from "../local-state.js";
|
|
12
12
|
import { solutionState, solutionStateLines } from "./solution.js";
|
|
13
13
|
import { expiryOf, readPrincipal, readTenantless } from "../principal.js";
|
|
14
|
+
import { maySetSecrets } from "../secret-access.js";
|
|
14
15
|
import { readHidden } from "../prompt.js";
|
|
15
16
|
import { isUuid, lookupTenantId, requireInstance, requireToken, tenantRequiredError } from "../session.js";
|
|
16
|
-
import { cavelonCommand } from "../
|
|
17
|
+
import { cavelonCommand, fill } from "../printed.js";
|
|
17
18
|
import { choicesOf, chooseTenant, commandLines, describeTenant, listsTenants, noTenantError, tenantOpenError, tenantRef, tenantTitle } from "../tenant-choice.js";
|
|
18
19
|
import { loadUserConfig, saveUserConfig, tokenKind, updateInstance } from "../user-config.js";
|
|
19
20
|
async function readCapabilities(contracts, refresh) {
|
|
@@ -69,6 +70,8 @@ async function readToken(ctx, fromStdin) {
|
|
|
69
70
|
}
|
|
70
71
|
export const login = {
|
|
71
72
|
name: "login",
|
|
73
|
+
storesTarget: true,
|
|
74
|
+
tenantless: true,
|
|
72
75
|
summary: "Store a token for an instance (a person runs this, never the agent).",
|
|
73
76
|
description: "Asks for the token without echoing it, or reads it from standard input with --token-stdin. It is never an argument.\n" +
|
|
74
77
|
"Create a personal access token (cvpat_…) on /account/access-tokens; a tenant API key (cbp_…) also works.\n" +
|
|
@@ -174,11 +177,12 @@ export const login = {
|
|
|
174
177
|
return {
|
|
175
178
|
data: { instance: url, credential: { kind, store: store.kind }, owner: null, tenant: null, instance_version: null, contracts: null },
|
|
176
179
|
text: `Logged in to ${url}. Token stored in the ${store.kind === "keyring" ? "credential store" : "user-only file"}. ` +
|
|
177
|
-
|
|
180
|
+
`No tenant is chosen yet: \`${cavelonCommand("use", fill("name or slug"))}\` chooses one; ` +
|
|
181
|
+
`\`${cavelonCommand("tenant", "list", "--search", fill("part of the name"))}\` finds its slug.`,
|
|
178
182
|
};
|
|
179
183
|
}
|
|
180
184
|
if (needsTenant) {
|
|
181
|
-
ctx.warn(
|
|
185
|
+
ctx.warn(`This token works in Platform mode; choose a tenant with \`${cavelonCommand("use", fill("tenant"))}\` before tenant commands.`);
|
|
182
186
|
}
|
|
183
187
|
else {
|
|
184
188
|
if (acting && reach) {
|
|
@@ -187,7 +191,7 @@ export const login = {
|
|
|
187
191
|
ctx.warn(`Without a tenant this token acts in ${acting.name ?? acting.id}. To work in another tenant, run:\n${commandLines(others, (r) => cavelonCommand("use", r))}`);
|
|
188
192
|
}
|
|
189
193
|
else if (acting && acting.others.length) {
|
|
190
|
-
ctx.warn(`Without a tenant this token acts in ${acting.name ?? acting.id}. Your other tenants: ${acting.others.join(", ")};
|
|
194
|
+
ctx.warn(`Without a tenant this token acts in ${acting.name ?? acting.id}. Your other tenants: ${acting.others.join(", ")}; \`${cavelonCommand("use", fill("tenant"))}\` chooses one this token reaches.`);
|
|
191
195
|
}
|
|
192
196
|
for (const warning of compareContracts(caps))
|
|
193
197
|
ctx.warn(warning);
|
|
@@ -227,7 +231,7 @@ export const login = {
|
|
|
227
231
|
if (tenant && chosen === "only")
|
|
228
232
|
where = ` Using tenant ${tenantTitle(tenant)}, the only one this token reaches.`;
|
|
229
233
|
else if (tenant && chosen === "picked")
|
|
230
|
-
where = ` Using tenant ${tenantTitle(tenant)};
|
|
234
|
+
where = ` Using tenant ${tenantTitle(tenant)}; \`${cavelonCommand("use")}\` chooses another.`;
|
|
231
235
|
else if (acting) {
|
|
232
236
|
const named = { id: acting.id, name: acting.name ?? actingNamed?.name, slug: actingNamed?.slug };
|
|
233
237
|
where = ` Acting in tenant ${tenantTitle(named)}, the one the instance chooses for this token.`;
|
|
@@ -240,6 +244,7 @@ export const login = {
|
|
|
240
244
|
};
|
|
241
245
|
export const logout = {
|
|
242
246
|
name: "logout",
|
|
247
|
+
tenantless: true,
|
|
243
248
|
summary: "Delete the stored token for an instance.",
|
|
244
249
|
readOnly: false,
|
|
245
250
|
destructive: true,
|
|
@@ -301,7 +306,7 @@ function reachText(reach) {
|
|
|
301
306
|
const own = reach.tenants.length;
|
|
302
307
|
return `every tenant (as operator; ${own ? `${own} membership${own === 1 ? "" : "s"} of your own` : "no memberships of your own"})`;
|
|
303
308
|
}
|
|
304
|
-
return `${reach.tenants.length} tenant${reach.tenants.length === 1 ? "" : "s"} (
|
|
309
|
+
return `${reach.tenants.length} tenant${reach.tenants.length === 1 ? "" : "s"} (\`${cavelonCommand("tenant", "list")}\`)`;
|
|
305
310
|
}
|
|
306
311
|
export const whoami = {
|
|
307
312
|
name: "whoami",
|
|
@@ -352,8 +357,8 @@ export const whoami = {
|
|
|
352
357
|
}
|
|
353
358
|
if (nowhere && reach) {
|
|
354
359
|
ctx.warn(reach.tenants.length
|
|
355
|
-
? `No tenant is chosen. Choose one with
|
|
356
|
-
:
|
|
360
|
+
? `No tenant is chosen. Choose one with \`${cavelonCommand("use")}\`, or run the line for the tenant you want:\n${commandLines(reach.tenants, (r) => cavelonCommand("use", r))}`
|
|
361
|
+
: `No tenant is chosen. This token reaches every tenant: \`${cavelonCommand("use", fill("name or slug"))}\` chooses one.`);
|
|
357
362
|
}
|
|
358
363
|
const expiry = expiryOf(principal, ctx.io.now());
|
|
359
364
|
if (expiry.warning)
|
|
@@ -374,6 +379,7 @@ export const whoami = {
|
|
|
374
379
|
expires_at: expiry.expires_at,
|
|
375
380
|
expires_in_days: expiry.days_left,
|
|
376
381
|
may_activate: principal?.token ? principal.token.may_activate : null,
|
|
382
|
+
may_set_secrets: maySetSecrets(principal),
|
|
377
383
|
ceiling_role: principal?.token?.ceiling_role ?? null,
|
|
378
384
|
platform_mode_allowed: principal?.token?.platform_mode_allowed ?? null,
|
|
379
385
|
scopes: principal?.api_key?.scopes ?? null,
|
|
@@ -396,7 +402,7 @@ export const whoami = {
|
|
|
396
402
|
role: me?.context?.effective_role ?? me?.role ?? null,
|
|
397
403
|
};
|
|
398
404
|
if (needsTenant)
|
|
399
|
-
ctx.warn(
|
|
405
|
+
ctx.warn(`No tenant selected; this token is in Platform mode. Choose one with \`${cavelonCommand("use", fill("tenant"))}\`.`);
|
|
400
406
|
const owner = session.tokenKind === "api_key"
|
|
401
407
|
? principal?.api_key
|
|
402
408
|
? `the tenant API key "${principal.api_key.name}"`
|
|
@@ -421,6 +427,7 @@ export const whoami = {
|
|
|
421
427
|
["credential", `${session.tokenKind === "api_key" ? "tenant API key" : session.tokenKind === "personal_access_token" ? "personal access token" : "token"}${tokenName} from ${credentialSource(session)}`],
|
|
422
428
|
["expires", expires],
|
|
423
429
|
["may activate", principal?.token ? (principal.token.may_activate ? "yes" : "no (a person activates in the Admin)") : undefined],
|
|
430
|
+
["may set secrets", secretsText(data.credential.may_set_secrets)],
|
|
424
431
|
["platform mode", typeof principal?.token?.platform_mode_allowed === "boolean" ? platformModeText(principal.token) : undefined],
|
|
425
432
|
["reaches", reach ? reachText(reach) : undefined],
|
|
426
433
|
["version", data.instance.version ? `${data.instance.version}${versionCachedAt ? ` (cached at ${versionCachedAt})` : ""}` : undefined],
|
|
@@ -428,6 +435,11 @@ export const whoami = {
|
|
|
428
435
|
};
|
|
429
436
|
},
|
|
430
437
|
};
|
|
438
|
+
function secretsText(may) {
|
|
439
|
+
if (may === null)
|
|
440
|
+
return undefined;
|
|
441
|
+
return may ? "yes" : "no (a tenant Owner sets them, in the Admin or with their own token)";
|
|
442
|
+
}
|
|
431
443
|
export const use = {
|
|
432
444
|
name: "use",
|
|
433
445
|
summary: "Choose the tenant this instance's commands act in.",
|
|
@@ -460,7 +472,7 @@ export const use = {
|
|
|
460
472
|
else {
|
|
461
473
|
const tenantless = await readTenantless(client);
|
|
462
474
|
if (!listsTenants(tenantless)) {
|
|
463
|
-
throw usageError("Which tenant? This instance does not list the tenants a token reaches.",
|
|
475
|
+
throw usageError("Which tenant? This instance does not list the tenants a token reaches.", `Run \`${cavelonCommand("use", fill("name, slug or id"))}\`; \`${cavelonCommand("tenant", "list")}\` shows the tenants this token can see.`);
|
|
464
476
|
}
|
|
465
477
|
const command = (r) => cavelonCommand("use", r);
|
|
466
478
|
if (ctx.mode === "mcp" && (tenantless.reachesAll || tenantless.tenants.length !== 1)) {
|
|
@@ -537,7 +549,7 @@ function limitsLine(state, near) {
|
|
|
537
549
|
return "not published by this instance";
|
|
538
550
|
const quotas = state.quotas_unavailable ? `\n quotas not readable: ${state.quotas_unavailable}` : "";
|
|
539
551
|
if (!near.length)
|
|
540
|
-
return `${state.quotas_unavailable ? "quotas unknown" : "none close to a quota"} (
|
|
552
|
+
return `${state.quotas_unavailable ? "quotas unknown" : "none close to a quota"} (\`${cavelonCommand("limits")}\` lists them)${quotas}`;
|
|
541
553
|
return `close to a quota: ${near.map((q) => `${q.key} ${formatQuota(q)}`).join("; ")}${quotas}`;
|
|
542
554
|
}
|
|
543
555
|
export const status = {
|
|
@@ -645,9 +657,9 @@ export const status = {
|
|
|
645
657
|
? `${shownTenant?.id && (shownTenant.name || shownTenant.slug) ? tenantTitle({ id: shownTenant.id, name: shownTenant.name, slug: shownTenant.slug }) : session.tenant}, from ${tenantSourceText(session)}`
|
|
646
658
|
: session.tokenKind === "api_key"
|
|
647
659
|
? "the API key's tenant"
|
|
648
|
-
:
|
|
660
|
+
: `not chosen (\`${cavelonCommand("use")}\` lists your tenants to choose from)`;
|
|
649
661
|
const lines = [
|
|
650
|
-
["instance", session.url ? `${session.url} (${session.urlSource})` :
|
|
662
|
+
["instance", session.url ? `${session.url} (${session.urlSource})` : `none (\`${cavelonCommand("login", "--instance", fill("url"))}\`)`],
|
|
651
663
|
["credential", session.token ? `${session.tokenKind} from ${credentialSource(session)}` : "none"],
|
|
652
664
|
["tenant", tenantText],
|
|
653
665
|
["solution", session.project ? session.project.file : "none (no cavelon.yaml here or above)"],
|
|
@@ -663,7 +675,7 @@ export const status = {
|
|
|
663
675
|
"open previews",
|
|
664
676
|
solution.open_previews.length
|
|
665
677
|
? solution.open_previews
|
|
666
|
-
.map((p) => `\n ${p.preview_id}${p.env ? ` env ${p.env}` : ""} ${p.created_at} ${p.expired ?
|
|
678
|
+
.map((p) => `\n ${p.preview_id}${p.env ? ` env ${p.env}` : ""} ${p.created_at} ${p.expired ? `expired (\`${cavelonCommand("apply", "--discard", "all")}\` removes it)` : `expires ${p.expires_at}`}`)
|
|
667
679
|
.join("")
|
|
668
680
|
: "none",
|
|
669
681
|
]);
|
|
@@ -687,7 +699,7 @@ export const status = {
|
|
|
687
699
|
data.capacity_waits = waiting;
|
|
688
700
|
const ops = data.operations;
|
|
689
701
|
const others = ops.other_solutions
|
|
690
|
-
? ` (${ops.other_solutions} operation${ops.other_solutions === 1 ? "" : "s"} of other solutions not shown;
|
|
702
|
+
? ` (${ops.other_solutions} operation${ops.other_solutions === 1 ? "" : "s"} of other solutions not shown; \`${cavelonCommand("api", "list_operations_route")}\` lists all)`
|
|
691
703
|
: "";
|
|
692
704
|
const heading = ops.scope === "solution" ? `Running operations of ${ops.harness} and the tenant's shared work${others}` : "Running operations in the tenant";
|
|
693
705
|
text += operations.length
|
package/dist/commands/setup.js
CHANGED
|
@@ -7,7 +7,7 @@ import { readJsonFile, writeFileAtomic } from "../fsutil.js";
|
|
|
7
7
|
import { configDir } from "../paths.js";
|
|
8
8
|
import { canAsk, readLine } from "../prompt.js";
|
|
9
9
|
import { probeMcpServer } from "../run-program.js";
|
|
10
|
-
import { cavelonCommand } from "../
|
|
10
|
+
import { cavelonCommand } from "../printed.js";
|
|
11
11
|
import { agentByName, applyPlan, checkAgent, findAgent, loadSkills, planAgent, removeAgent, serverCommand, setupAgents, } from "../setup-agents.js";
|
|
12
12
|
import { KIT_VERSION } from "../version.js";
|
|
13
13
|
import { login, whoami } from "./session.js";
|
|
@@ -215,7 +215,7 @@ async function runSetup(ctx, input) {
|
|
|
215
215
|
const changed = results.filter((r) => r.changes.some((c) => c.outcome === "done"));
|
|
216
216
|
const next = [];
|
|
217
217
|
if (declined)
|
|
218
|
-
next.push(
|
|
218
|
+
next.push(`Nothing was changed. Run ${cavelonCommand("setup")} again when you are ready.`);
|
|
219
219
|
else {
|
|
220
220
|
if (loginReport?.next)
|
|
221
221
|
next.push(loginReport.next);
|
|
@@ -397,6 +397,8 @@ async function runRemove(ctx, input) {
|
|
|
397
397
|
}
|
|
398
398
|
export const setup = {
|
|
399
399
|
name: "setup",
|
|
400
|
+
storesTarget: true,
|
|
401
|
+
tenantless: true,
|
|
400
402
|
summary: "Set up your coding agents for Cavelon and log in, in one guided step.",
|
|
401
403
|
description: "Finds Claude Code, Codex, Cursor, VS Code with GitHub Copilot, Gemini CLI and Kiro, shows what it will change for each, asks once\n" +
|
|
402
404
|
"and does it: Claude Code and Codex get the Cavelon plugin through their own plugin command; the others get the `cavelon` MCP\n" +
|