Vendor OpenClaw source as Adolf fork baseline
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
180
extensions/migrate-claude/provider.test.ts
Normal file
180
extensions/migrate-claude/provider.test.ts
Normal file
@@ -0,0 +1,180 @@
|
||||
// Migrate Claude tests cover provider plugin behavior.
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { redactMigrationPlan } from "openclaw/plugin-sdk/migration";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { resolveHomePath } from "./helpers.js";
|
||||
import { buildClaudeMigrationProvider } from "./provider.js";
|
||||
import {
|
||||
cleanupTempRoots,
|
||||
makeConfigRuntime,
|
||||
makeContext,
|
||||
makeTempRoot,
|
||||
writeFile,
|
||||
} from "./test/provider-helpers.js";
|
||||
|
||||
function planItemById(
|
||||
items: readonly { id: string; kind?: string; action?: string }[],
|
||||
id: string,
|
||||
) {
|
||||
const item = items.find((candidate) => candidate.id === id);
|
||||
if (!item) {
|
||||
throw new Error(`expected migration plan item ${id}`);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
describe("Claude migration provider", () => {
|
||||
afterEach(async () => {
|
||||
await cleanupTempRoots();
|
||||
});
|
||||
|
||||
it("registers a Claude migration provider", () => {
|
||||
const provider = buildClaudeMigrationProvider();
|
||||
expect(provider.id).toBe("claude");
|
||||
expect(provider.label).toBe("Claude");
|
||||
});
|
||||
|
||||
it("resolves tilde source paths against the OS home when OPENCLAW_HOME is set", () => {
|
||||
const previous = process.env.OPENCLAW_HOME;
|
||||
process.env.OPENCLAW_HOME = path.join(path.sep, "tmp", "openclaw-home");
|
||||
try {
|
||||
expect(resolveHomePath("~/.claude")).toBe(path.join(os.homedir(), ".claude"));
|
||||
} finally {
|
||||
if (previous === undefined) {
|
||||
delete process.env.OPENCLAW_HOME;
|
||||
} else {
|
||||
process.env.OPENCLAW_HOME = previous;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("rejects missing Claude sources before planning", async () => {
|
||||
const root = await makeTempRoot();
|
||||
const source = path.join(root, "missing");
|
||||
const provider = buildClaudeMigrationProvider();
|
||||
|
||||
await expect(
|
||||
provider.plan(
|
||||
makeContext({ source, stateDir: path.join(root, "state"), workspaceDir: root }),
|
||||
),
|
||||
).rejects.toThrow("Claude state was not found");
|
||||
});
|
||||
|
||||
it("plans project memory, MCP servers, commands, skills, and manual review items", async () => {
|
||||
const root = await makeTempRoot();
|
||||
const source = path.join(root, "project");
|
||||
const workspaceDir = path.join(root, "workspace");
|
||||
await writeFile(path.join(source, "CLAUDE.md"), "# Project instructions\n");
|
||||
await writeFile(path.join(source, "CLAUDE.local.md"), "local-only\n");
|
||||
await writeFile(
|
||||
path.join(source, ".mcp.json"),
|
||||
JSON.stringify({
|
||||
mcpServers: {
|
||||
filesystem: {
|
||||
command: "npx",
|
||||
args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
|
||||
env: { ANTHROPIC_API_KEY: "short-dev-key" },
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
await writeFile(
|
||||
path.join(source, ".claude", "settings.json"),
|
||||
JSON.stringify({
|
||||
hooks: { PreToolUse: [] },
|
||||
permissions: { allow: ["Bash(*)"] },
|
||||
env: { FOO: "bar" },
|
||||
}),
|
||||
);
|
||||
await writeFile(path.join(source, ".claude", "commands", "commit.md"), "Commit $ARGUMENTS\n");
|
||||
await writeFile(path.join(source, ".claude", "skills", "Review", "SKILL.md"), "# Review\n");
|
||||
await writeFile(path.join(source, ".claude", "agents", "reviewer.md"), "# Reviewer\n");
|
||||
|
||||
const provider = buildClaudeMigrationProvider();
|
||||
const plan = await provider.plan(
|
||||
makeContext({ source, stateDir: path.join(root, "state"), workspaceDir }),
|
||||
);
|
||||
|
||||
expect(plan.summary.total).toBeGreaterThan(0);
|
||||
expect(planItemById(plan.items, "workspace:CLAUDE.md").kind).toBe("workspace");
|
||||
expect(planItemById(plan.items, "config:mcp-server:project-mcp:filesystem").kind).toBe(
|
||||
"config",
|
||||
);
|
||||
expect(planItemById(plan.items, "skill:claude-command-commit").action).toBe("create");
|
||||
expect(planItemById(plan.items, "skill:review").action).toBe("copy");
|
||||
expect(planItemById(plan.items, "archive:CLAUDE.local.md").action).toBe("archive");
|
||||
expect(planItemById(plan.items, "archive:project-agents").action).toBe("archive");
|
||||
const manualHooksItem = plan.items.find((item) => item.id.startsWith("manual:hooks:"));
|
||||
expect(manualHooksItem?.kind).toBe("manual");
|
||||
|
||||
const redacted = JSON.stringify(redactMigrationPlan(plan));
|
||||
expect(redacted).not.toContain("short-dev-key");
|
||||
expect(redacted).toContain("[redacted]");
|
||||
});
|
||||
|
||||
it("applies project imports without reading global Claude state", async () => {
|
||||
const root = await makeTempRoot();
|
||||
const source = path.join(root, "project");
|
||||
const workspaceDir = path.join(root, "workspace");
|
||||
const stateDir = path.join(root, "state");
|
||||
const reportDir = path.join(root, "report");
|
||||
await writeFile(path.join(source, "CLAUDE.md"), "# Project instructions\n");
|
||||
await writeFile(path.join(workspaceDir, "AGENTS.md"), "# Existing agents\n");
|
||||
await writeFile(
|
||||
path.join(source, ".mcp.json"),
|
||||
JSON.stringify({
|
||||
mcpServers: {
|
||||
filesystem: {
|
||||
command: "npx",
|
||||
args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
await writeFile(path.join(source, ".claude", "commands", "ship.md"), "Ship $ARGUMENTS\n");
|
||||
await writeFile(path.join(source, ".claude", "skills", "Review", "SKILL.md"), "# Review\n");
|
||||
|
||||
const config = {
|
||||
agents: {
|
||||
defaults: {
|
||||
workspace: workspaceDir,
|
||||
},
|
||||
},
|
||||
} as never;
|
||||
const provider = buildClaudeMigrationProvider();
|
||||
const result = await provider.apply(
|
||||
makeContext({
|
||||
source,
|
||||
stateDir,
|
||||
workspaceDir,
|
||||
reportDir,
|
||||
runtime: makeConfigRuntime(config),
|
||||
config,
|
||||
}),
|
||||
);
|
||||
|
||||
expect(result.summary.errors).toBe(0);
|
||||
const mcpItem = result.items.find(
|
||||
(item) => item.id === "config:mcp-server:project-mcp:filesystem",
|
||||
);
|
||||
expect(mcpItem?.status).toBe("migrated");
|
||||
expect((config as { mcp?: { servers?: Record<string, unknown> } }).mcp?.servers).toEqual({
|
||||
filesystem: {
|
||||
command: "npx",
|
||||
args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
|
||||
},
|
||||
});
|
||||
expect(await fs.readFile(path.join(workspaceDir, "AGENTS.md"), "utf8")).toContain(
|
||||
"Imported from Claude: project CLAUDE.md",
|
||||
);
|
||||
await expect(
|
||||
fs.access(path.join(workspaceDir, "skills", "claude-command-ship", "SKILL.md")),
|
||||
).resolves.toBeUndefined();
|
||||
await expect(
|
||||
fs.access(path.join(workspaceDir, "skills", "review", "SKILL.md")),
|
||||
).resolves.toBeUndefined();
|
||||
await expect(fs.access(path.join(reportDir, "summary.md"))).resolves.toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user