style: format onboarding commands
This commit is contained in:
@@ -20,10 +20,10 @@ import {
|
|||||||
import { GATEWAY_LAUNCH_AGENT_LABEL } from "../daemon/constants.js";
|
import { GATEWAY_LAUNCH_AGENT_LABEL } from "../daemon/constants.js";
|
||||||
import { resolveGatewayProgramArguments } from "../daemon/program-args.js";
|
import { resolveGatewayProgramArguments } from "../daemon/program-args.js";
|
||||||
import { resolveGatewayService } from "../daemon/service.js";
|
import { resolveGatewayService } from "../daemon/service.js";
|
||||||
import { healthCommand } from "./health.js";
|
|
||||||
import type { RuntimeEnv } from "../runtime.js";
|
import type { RuntimeEnv } from "../runtime.js";
|
||||||
import { defaultRuntime } from "../runtime.js";
|
import { defaultRuntime } from "../runtime.js";
|
||||||
import { resolveUserPath, sleep } from "../utils.js";
|
import { resolveUserPath, sleep } from "../utils.js";
|
||||||
|
import { healthCommand } from "./health.js";
|
||||||
import {
|
import {
|
||||||
applyMinimaxConfig,
|
applyMinimaxConfig,
|
||||||
setAnthropicApiKey,
|
setAnthropicApiKey,
|
||||||
@@ -66,11 +66,15 @@ export async function runInteractiveOnboarding(
|
|||||||
let baseConfig: ClawdisConfig = snapshot.valid ? snapshot.config : {};
|
let baseConfig: ClawdisConfig = snapshot.valid ? snapshot.config : {};
|
||||||
|
|
||||||
if (snapshot.exists) {
|
if (snapshot.exists) {
|
||||||
const title = snapshot.valid ? "Existing config detected" : "Invalid config";
|
const title = snapshot.valid
|
||||||
|
? "Existing config detected"
|
||||||
|
: "Invalid config";
|
||||||
note(summarizeExistingConfig(baseConfig), title);
|
note(summarizeExistingConfig(baseConfig), title);
|
||||||
if (!snapshot.valid && snapshot.issues.length > 0) {
|
if (!snapshot.valid && snapshot.issues.length > 0) {
|
||||||
note(
|
note(
|
||||||
snapshot.issues.map((iss) => `- ${iss.path}: ${iss.message}`).join("\n"),
|
snapshot.issues
|
||||||
|
.map((iss) => `- ${iss.path}: ${iss.message}`)
|
||||||
|
.join("\n"),
|
||||||
"Config issues",
|
"Config issues",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -94,7 +98,10 @@ export async function runInteractiveOnboarding(
|
|||||||
message: "Reset scope",
|
message: "Reset scope",
|
||||||
options: [
|
options: [
|
||||||
{ value: "config", label: "Config only" },
|
{ value: "config", label: "Config only" },
|
||||||
{ value: "config+creds+sessions", label: "Config + creds + sessions" },
|
{
|
||||||
|
value: "config+creds+sessions",
|
||||||
|
label: "Config + creds + sessions",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
value: "full",
|
value: "full",
|
||||||
label: "Full reset (config + creds + sessions + workspace)",
|
label: "Full reset (config + creds + sessions + workspace)",
|
||||||
@@ -285,7 +292,10 @@ export async function runInteractiveOnboarding(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tailscaleMode !== "off" && bind !== "loopback") {
|
if (tailscaleMode !== "off" && bind !== "loopback") {
|
||||||
note("Tailscale requires bind=loopback. Adjusting bind to loopback.", "Note");
|
note(
|
||||||
|
"Tailscale requires bind=loopback. Adjusting bind to loopback.",
|
||||||
|
"Note",
|
||||||
|
);
|
||||||
bind = "loopback";
|
bind = "loopback";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,7 +402,10 @@ export async function runInteractiveOnboarding(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!loaded || (loaded && (await service.isLoaded({ env: process.env })) === false)) {
|
if (
|
||||||
|
!loaded ||
|
||||||
|
(loaded && (await service.isLoaded({ env: process.env })) === false)
|
||||||
|
) {
|
||||||
const devMode =
|
const devMode =
|
||||||
process.argv[1]?.includes(`${path.sep}src${path.sep}`) &&
|
process.argv[1]?.includes(`${path.sep}src${path.sep}`) &&
|
||||||
process.argv[1]?.endsWith(".ts");
|
process.argv[1]?.endsWith(".ts");
|
||||||
@@ -402,7 +415,9 @@ export async function runInteractiveOnboarding(
|
|||||||
PATH: process.env.PATH,
|
PATH: process.env.PATH,
|
||||||
CLAWDIS_GATEWAY_TOKEN: gatewayToken,
|
CLAWDIS_GATEWAY_TOKEN: gatewayToken,
|
||||||
CLAWDIS_LAUNCHD_LABEL:
|
CLAWDIS_LAUNCHD_LABEL:
|
||||||
process.platform === "darwin" ? GATEWAY_LAUNCH_AGENT_LABEL : undefined,
|
process.platform === "darwin"
|
||||||
|
? GATEWAY_LAUNCH_AGENT_LABEL
|
||||||
|
: undefined,
|
||||||
};
|
};
|
||||||
await service.install({
|
await service.install({
|
||||||
env: process.env,
|
env: process.env,
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
type ClawdisConfig,
|
||||||
CONFIG_PATH_CLAWDIS,
|
CONFIG_PATH_CLAWDIS,
|
||||||
readConfigFileSnapshot,
|
readConfigFileSnapshot,
|
||||||
writeConfigFile,
|
writeConfigFile,
|
||||||
type ClawdisConfig,
|
|
||||||
} from "../config/config.js";
|
} from "../config/config.js";
|
||||||
import { GATEWAY_LAUNCH_AGENT_LABEL } from "../daemon/constants.js";
|
import { GATEWAY_LAUNCH_AGENT_LABEL } from "../daemon/constants.js";
|
||||||
import { resolveGatewayProgramArguments } from "../daemon/program-args.js";
|
import { resolveGatewayProgramArguments } from "../daemon/program-args.js";
|
||||||
import { resolveGatewayService } from "../daemon/service.js";
|
import { resolveGatewayService } from "../daemon/service.js";
|
||||||
import { resolveUserPath, sleep } from "../utils.js";
|
|
||||||
import type { RuntimeEnv } from "../runtime.js";
|
import type { RuntimeEnv } from "../runtime.js";
|
||||||
import { defaultRuntime } from "../runtime.js";
|
import { defaultRuntime } from "../runtime.js";
|
||||||
|
import { resolveUserPath, sleep } from "../utils.js";
|
||||||
import { healthCommand } from "./health.js";
|
import { healthCommand } from "./health.js";
|
||||||
import { applyMinimaxConfig, setAnthropicApiKey } from "./onboard-auth.js";
|
import { applyMinimaxConfig, setAnthropicApiKey } from "./onboard-auth.js";
|
||||||
import {
|
import {
|
||||||
@@ -19,7 +19,11 @@ import {
|
|||||||
ensureWorkspaceAndSessions,
|
ensureWorkspaceAndSessions,
|
||||||
randomToken,
|
randomToken,
|
||||||
} from "./onboard-helpers.js";
|
} from "./onboard-helpers.js";
|
||||||
import type { AuthChoice, OnboardMode, OnboardOptions } from "./onboard-types.js";
|
import type {
|
||||||
|
AuthChoice,
|
||||||
|
OnboardMode,
|
||||||
|
OnboardOptions,
|
||||||
|
} from "./onboard-types.js";
|
||||||
|
|
||||||
export async function runNonInteractiveOnboarding(
|
export async function runNonInteractiveOnboarding(
|
||||||
opts: OnboardOptions,
|
opts: OnboardOptions,
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ export async function setupProviders(
|
|||||||
|
|
||||||
note(
|
note(
|
||||||
[
|
[
|
||||||
"Link device with: signal-cli link -n \"Clawdis\"",
|
'Link device with: signal-cli link -n "Clawdis"',
|
||||||
"Scan QR in Signal → Linked Devices",
|
"Scan QR in Signal → Linked Devices",
|
||||||
"Then run: clawdis gateway call providers.status --params '{\"probe\":true}'",
|
"Then run: clawdis gateway call providers.status --params '{\"probe\":true}'",
|
||||||
].join("\n"),
|
].join("\n"),
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
import { confirm, multiselect, note, select, spinner, text } from "@clack/prompts";
|
import {
|
||||||
|
confirm,
|
||||||
|
multiselect,
|
||||||
|
note,
|
||||||
|
select,
|
||||||
|
spinner,
|
||||||
|
text,
|
||||||
|
} from "@clack/prompts";
|
||||||
|
|
||||||
import { installSkill } from "../agents/skills-install.js";
|
import { installSkill } from "../agents/skills-install.js";
|
||||||
import { buildWorkspaceSkillStatus } from "../agents/skills-status.js";
|
import { buildWorkspaceSkillStatus } from "../agents/skills-status.js";
|
||||||
@@ -121,8 +128,8 @@ export async function setupSkills(
|
|||||||
const apiKey = String(
|
const apiKey = String(
|
||||||
guardCancel(
|
guardCancel(
|
||||||
await text({
|
await text({
|
||||||
message: `Enter ${skill.primaryEnv}`,
|
message: `Enter ${skill.primaryEnv}`,
|
||||||
validate: (value) => (value?.trim() ? undefined : "Required"),
|
validate: (value) => (value?.trim() ? undefined : "Required"),
|
||||||
}),
|
}),
|
||||||
runtime,
|
runtime,
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user