chore: format sources and update protocol outputs
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
import { resolveAgentDir, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agents/agent-scope.js";
|
||||
import {
|
||||
resolveAgentDir,
|
||||
resolveAgentWorkspaceDir,
|
||||
resolveDefaultAgentId,
|
||||
} from "../agents/agent-scope.js";
|
||||
import { ensureAuthProfileStore } from "../agents/auth-profiles.js";
|
||||
import { resolveAuthStorePath } from "../agents/auth-profiles/paths.js";
|
||||
import { CONFIG_PATH_CLAWDBOT, writeConfigFile } from "../config/config.js";
|
||||
@@ -223,9 +227,12 @@ export async function agentsAddCommand(
|
||||
const sourceAuthPath = resolveAuthStorePath(resolveAgentDir(cfg, defaultAgentId));
|
||||
const destAuthPath = resolveAuthStorePath(agentDir);
|
||||
const sameAuthPath =
|
||||
path.resolve(sourceAuthPath).toLowerCase() ===
|
||||
path.resolve(destAuthPath).toLowerCase();
|
||||
if (!sameAuthPath && (await fileExists(sourceAuthPath)) && !(await fileExists(destAuthPath))) {
|
||||
path.resolve(sourceAuthPath).toLowerCase() === path.resolve(destAuthPath).toLowerCase();
|
||||
if (
|
||||
!sameAuthPath &&
|
||||
(await fileExists(sourceAuthPath)) &&
|
||||
!(await fileExists(destAuthPath))
|
||||
) {
|
||||
const shouldCopy = await prompter.confirm({
|
||||
message: `Copy auth profiles from "${defaultAgentId}"?`,
|
||||
initialValue: false,
|
||||
|
||||
@@ -140,9 +140,7 @@ export async function setupChannels(
|
||||
quickstartScore: 0,
|
||||
}));
|
||||
const combinedStatuses = [...statusEntries, ...catalogStatuses];
|
||||
const statusByChannel = new Map(
|
||||
combinedStatuses.map((entry) => [entry.channel, entry]),
|
||||
);
|
||||
const statusByChannel = new Map(combinedStatuses.map((entry) => [entry.channel, entry]));
|
||||
const statusLines = combinedStatuses.flatMap((entry) => entry.statusLines);
|
||||
if (statusLines.length > 0) {
|
||||
await prompter.note(statusLines.join("\n"), "Channel status");
|
||||
@@ -216,9 +214,7 @@ export async function setupChannels(
|
||||
})) as ChannelChoice[];
|
||||
}
|
||||
|
||||
const catalogById = new Map(
|
||||
catalogEntries.map((entry) => [entry.id as ChannelChoice, entry]),
|
||||
);
|
||||
const catalogById = new Map(catalogEntries.map((entry) => [entry.id as ChannelChoice, entry]));
|
||||
if (selection.some((channel) => catalogById.has(channel))) {
|
||||
const workspaceDir = resolveAgentWorkspaceDir(next, resolveDefaultAgentId(next));
|
||||
for (const channel of selection) {
|
||||
@@ -248,16 +244,10 @@ export async function setupChannels(
|
||||
|
||||
const selectionNotes = new Map<string, string>();
|
||||
for (const plugin of installedPlugins) {
|
||||
selectionNotes.set(
|
||||
plugin.id,
|
||||
formatChannelSelectionLine(plugin.meta, formatDocsLink),
|
||||
);
|
||||
selectionNotes.set(plugin.id, formatChannelSelectionLine(plugin.meta, formatDocsLink));
|
||||
}
|
||||
for (const entry of catalogEntries) {
|
||||
selectionNotes.set(
|
||||
entry.id,
|
||||
formatChannelSelectionLine(entry.meta, formatDocsLink),
|
||||
);
|
||||
selectionNotes.set(entry.id, formatChannelSelectionLine(entry.meta, formatDocsLink));
|
||||
}
|
||||
const selectedLines = selection
|
||||
.map((channel) => selectionNotes.get(channel))
|
||||
|
||||
@@ -12,9 +12,7 @@ export const makeRuntime = (overrides: Partial<RuntimeEnv> = {}): RuntimeEnv =>
|
||||
...overrides,
|
||||
});
|
||||
|
||||
export const makePrompter = (
|
||||
overrides: Partial<WizardPrompter> = {},
|
||||
): WizardPrompter => ({
|
||||
export const makePrompter = (overrides: Partial<WizardPrompter> = {}): WizardPrompter => ({
|
||||
intro: vi.fn(async () => {}),
|
||||
outro: vi.fn(async () => {}),
|
||||
note: vi.fn(async () => {}),
|
||||
|
||||
@@ -170,8 +170,7 @@ export function reloadOnboardingPluginRegistry(params: {
|
||||
workspaceDir?: string;
|
||||
}): void {
|
||||
const workspaceDir =
|
||||
params.workspaceDir ??
|
||||
resolveAgentWorkspaceDir(params.cfg, resolveDefaultAgentId(params.cfg));
|
||||
params.workspaceDir ?? resolveAgentWorkspaceDir(params.cfg, resolveDefaultAgentId(params.cfg));
|
||||
const log = createSubsystemLogger("plugins");
|
||||
loadClawdbotPlugins({
|
||||
config: params.cfg,
|
||||
|
||||
Reference in New Issue
Block a user