Files
Vincent Koc 600df95c8c feat(migrate): add Claude importer
Add a bundled Claude migration provider for Claude Code and Claude Desktop imports.\n\nIncludes source discovery, preview/apply behavior for instructions, MCP servers, skills and command prompts, archive/manual handling for unsafe Claude state, docs, labeler, and tests.
2026-04-27 02:35:44 -07:00

36 lines
1.1 KiB
TypeScript

import type {
MigrationPlan,
MigrationProviderContext,
MigrationProviderPlugin,
} from "openclaw/plugin-sdk/plugin-entry";
import { applyClaudePlan } from "./apply.js";
import { buildClaudePlan } from "./plan.js";
import { discoverClaudeSource, hasClaudeSource } from "./source.js";
export function buildClaudeMigrationProvider(
params: {
runtime?: MigrationProviderContext["runtime"];
} = {},
): MigrationProviderPlugin {
return {
id: "claude",
label: "Claude",
description: "Import Claude Code and Claude Desktop instructions, MCP servers, and skills.",
async detect(ctx) {
const source = await discoverClaudeSource(ctx.source);
const found = hasClaudeSource(source);
return {
found,
source: source.root,
label: "Claude",
confidence: found ? source.confidence : "low",
message: found ? "Claude state found." : "Claude state not found.",
};
},
plan: buildClaudePlan,
async apply(ctx, plan?: MigrationPlan) {
return await applyClaudePlan({ ctx, plan, runtime: params.runtime });
},
};
}