Files
openclaw/extensions/migrate-claude/provider.ts
Peter Steinberger 4319ddbe8c feat(control-ui): import Codex and Claude Code memory (#106406)
* feat(control-ui): import coding assistant memory

* test(migrate): clean memory import temp dirs

* chore: move memory import note to PR body

* build: refresh memory import generated artifacts

* fix(control-ui): complete memory import checks

* build(control-ui): localize memory recovery labels

* fix(control-ui): harden memory import recovery

* refactor(migrate): keep memory import surfaces bounded

* fix(control-ui): use canonical agent row type

* fix(codex): drop dead migration type exports

* fix(migrate): restrict imported memory permissions

* fix(control-ui): preserve memory import recovery state

* fix(control-ui): retain memory import results

* build(control-ui): preserve translation memory history

* fix(control-ui): bind memory import state to agent

* fix(control-ui): unlock memory import after refresh

* test(gateway): preserve memory method suffix

* fix(migrate): bind reviewed memory imports

* fix(migrate): make memory imports retry-safe

* perf(ui): keep memory import lazy

* build: refresh generated artifacts after rebase

* chore: keep migration runtime within LOC guard

* build: refresh Swift protocol model
2026-07-13 15:30:06 -07:00

39 lines
1.3 KiB
TypeScript

// Migrate Claude provider module implements model/runtime integration.
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 auto-memory, instructions, MCP servers, and skills.",
supportedItemKinds: ["memory"],
async detect(ctx) {
const source = await discoverClaudeSource(ctx.source);
const memoryOnly = ctx.itemKinds?.length === 1 && ctx.itemKinds[0] === "memory";
const found = memoryOnly ? source.autoMemorySources.length > 0 : 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 });
},
};
}