mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 04:50:44 +00:00
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.
31 lines
973 B
TypeScript
31 lines
973 B
TypeScript
import path from "node:path";
|
|
import {
|
|
resolveAgentConfig,
|
|
resolveAgentWorkspaceDir,
|
|
resolveDefaultAgentId,
|
|
} from "openclaw/plugin-sdk/agent-runtime";
|
|
import type { MigrationProviderContext } from "openclaw/plugin-sdk/plugin-entry";
|
|
import { resolveHomePath } from "./helpers.js";
|
|
|
|
export type PlannedTargets = {
|
|
workspaceDir: string;
|
|
stateDir: string;
|
|
agentDir: string;
|
|
};
|
|
|
|
export function resolveTargets(ctx: MigrationProviderContext): PlannedTargets {
|
|
const cfg = ctx.config;
|
|
const agentId = resolveDefaultAgentId(cfg);
|
|
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);
|
|
const configuredAgentDir = resolveAgentConfig(cfg, agentId)?.agentDir?.trim();
|
|
const agentDir =
|
|
ctx.runtime?.agent?.resolveAgentDir(cfg, agentId) ??
|
|
(configuredAgentDir ? resolveHomePath(configuredAgentDir) : undefined) ??
|
|
path.join(ctx.stateDir, "agents", agentId, "agent");
|
|
return {
|
|
workspaceDir,
|
|
stateDir: ctx.stateDir,
|
|
agentDir,
|
|
};
|
|
}
|