refactor(agent): dedupe harness and command workflows

This commit is contained in:
Peter Steinberger
2026-02-16 14:52:09 +00:00
parent 04892ee230
commit f717a13039
204 changed files with 7366 additions and 11540 deletions

View File

@@ -1,25 +1,32 @@
import { describe, expect, it, vi } from "vitest";
import { setupOnboardingShellCompletion } from "./onboarding.completion.js";
function createPrompter(confirmValue = false) {
return {
confirm: vi.fn(async () => confirmValue),
note: vi.fn(async () => {}),
};
}
function createDeps() {
return {
resolveCliName: () => "openclaw",
checkShellCompletionStatus: vi.fn(async () => ({
shell: "zsh",
profileInstalled: false,
cacheExists: false,
cachePath: "/tmp/openclaw.zsh",
usesSlowPattern: false,
})),
ensureCompletionCacheExists: vi.fn(async () => true),
installCompletion: vi.fn(async () => {}),
};
}
describe("setupOnboardingShellCompletion", () => {
it("QuickStart: installs without prompting", async () => {
const prompter = {
confirm: vi.fn(async () => false),
note: vi.fn(async () => {}),
};
const deps = {
resolveCliName: () => "openclaw",
checkShellCompletionStatus: vi.fn(async () => ({
shell: "zsh",
profileInstalled: false,
cacheExists: false,
cachePath: "/tmp/openclaw.zsh",
usesSlowPattern: false,
})),
ensureCompletionCacheExists: vi.fn(async () => true),
installCompletion: vi.fn(async () => {}),
};
const prompter = createPrompter();
const deps = createDeps();
await setupOnboardingShellCompletion({ flow: "quickstart", prompter, deps });
@@ -30,23 +37,8 @@ describe("setupOnboardingShellCompletion", () => {
});
it("Advanced: prompts; skip means no install", async () => {
const prompter = {
confirm: vi.fn(async () => false),
note: vi.fn(async () => {}),
};
const deps = {
resolveCliName: () => "openclaw",
checkShellCompletionStatus: vi.fn(async () => ({
shell: "zsh",
profileInstalled: false,
cacheExists: false,
cachePath: "/tmp/openclaw.zsh",
usesSlowPattern: false,
})),
ensureCompletionCacheExists: vi.fn(async () => true),
installCompletion: vi.fn(async () => {}),
};
const prompter = createPrompter();
const deps = createDeps();
await setupOnboardingShellCompletion({ flow: "advanced", prompter, deps });