114 lines
3.1 KiB
TypeScript
114 lines
3.1 KiB
TypeScript
/**
|
|
* @claude-flow/codex - Migrations
|
|
*
|
|
* Migration utilities for converting Claude Code configurations to Codex format
|
|
* Supports full CLAUDE.md parsing with section extraction, skill conversion,
|
|
* and proper AGENTS.md/config.toml generation.
|
|
*/
|
|
import type { MigrationOptions, MigrationResult, FeatureMapping, McpServerConfig, ApprovalPolicy, SandboxMode } from '../types.js';
|
|
/**
|
|
* Parsed CLAUDE.md structure
|
|
*/
|
|
export interface ParsedClaudeMd {
|
|
title: string;
|
|
sections: ParsedSection[];
|
|
skills: SkillReference[];
|
|
hooks: string[];
|
|
customInstructions: string[];
|
|
codeBlocks: CodeBlock[];
|
|
mcpServers: McpServerConfig[];
|
|
settings: ParsedSettings;
|
|
warnings: string[];
|
|
}
|
|
/**
|
|
* Parsed section from markdown
|
|
*/
|
|
export interface ParsedSection {
|
|
level: number;
|
|
title: string;
|
|
content: string;
|
|
startLine: number;
|
|
endLine: number;
|
|
}
|
|
/**
|
|
* Skill reference found in content
|
|
*/
|
|
export interface SkillReference {
|
|
name: string;
|
|
syntax: 'slash' | 'dollar';
|
|
context: string;
|
|
line: number;
|
|
}
|
|
/**
|
|
* Code block from markdown
|
|
*/
|
|
export interface CodeBlock {
|
|
language: string;
|
|
content: string;
|
|
line: number;
|
|
}
|
|
/**
|
|
* Parsed settings from CLAUDE.md content
|
|
*/
|
|
export interface ParsedSettings {
|
|
model?: string;
|
|
approvalPolicy?: ApprovalPolicy;
|
|
sandboxMode?: SandboxMode;
|
|
projectName?: string;
|
|
techStack?: string;
|
|
buildCommand?: string;
|
|
testCommand?: string;
|
|
devCommand?: string;
|
|
}
|
|
/**
|
|
* Feature mappings between Claude Code and Codex
|
|
*/
|
|
export declare const FEATURE_MAPPINGS: FeatureMapping[];
|
|
/**
|
|
* Parse a CLAUDE.md file completely
|
|
*/
|
|
export declare function parseClaudeMd(content: string): Promise<ParsedClaudeMd>;
|
|
/**
|
|
* Analyze a CLAUDE.md file for migration (simplified interface)
|
|
*/
|
|
export declare function analyzeClaudeMd(content: string): Promise<{
|
|
sections: string[];
|
|
skills: string[];
|
|
hooks: string[];
|
|
customInstructions: string[];
|
|
warnings: string[];
|
|
}>;
|
|
/**
|
|
* Convert skill invocation syntax from slash to dollar
|
|
*/
|
|
export declare function convertSkillSyntax(content: string): string;
|
|
/**
|
|
* Generate AGENTS.md content from parsed CLAUDE.md
|
|
*/
|
|
export declare function generateAgentsMdFromParsed(parsed: ParsedClaudeMd): string;
|
|
/**
|
|
* Convert settings.json to config.toml format
|
|
*/
|
|
export declare function convertSettingsToToml(settings: Record<string, unknown>): string;
|
|
/**
|
|
* Generate config.toml from parsed CLAUDE.md
|
|
*/
|
|
export declare function generateConfigTomlFromParsed(parsed: ParsedClaudeMd): string;
|
|
/**
|
|
* Migrate from Claude Code (CLAUDE.md) to Codex (AGENTS.md)
|
|
*/
|
|
export declare function migrateFromClaudeCode(options: MigrationOptions): Promise<MigrationResult>;
|
|
/**
|
|
* Perform full migration with content
|
|
*/
|
|
export declare function performFullMigration(claudeMdContent: string, settingsJson?: Record<string, unknown>): Promise<{
|
|
agentsMd: string;
|
|
configToml: string;
|
|
warnings: string[];
|
|
skillsToCreate: string[];
|
|
}>;
|
|
/**
|
|
* Generate migration report
|
|
*/
|
|
export declare function generateMigrationReport(result: MigrationResult): string;
|
|
//# sourceMappingURL=index.d.ts.map
|