11#!/usr/bin/env node
22
3- import { existsSync , readFileSync , writeFileSync , appendFileSync , rmSync } from 'fs'
3+ import { existsSync , readFileSync , writeFileSync , appendFileSync , rmSync , statSync } from 'fs'
44import { join , resolve , dirname } from 'path'
55import { parseArgs } from 'util'
66import { importAll , importAgent , exportToAgent , exportAll , exportToCopilot , exportToCursor , exportToCline , exportToWindsurf , exportToZed , exportToCodex , exportToAider , exportToClaudeCode , exportToGemini , exportToQodo , importRoo , exportToRoo , exportToJunie , importOpenCode , exportToOpenCode } from './index.js'
@@ -107,6 +107,7 @@ async function main() {
107107 '.rules' ,
108108 'AGENTS.md' ,
109109 'CLAUDE.md' ,
110+ '.claude/rules/*.md' ,
110111 'GEMINI.md' ,
111112 'best_practices.md'
112113 ] ) )
@@ -190,7 +191,7 @@ async function main() {
190191 { name : 'Zed (.rules)' , value : 'zed' } ,
191192 { name : 'OpenAI Codex (AGENTS.md)' , value : 'codex' } ,
192193 { name : 'Aider (CONVENTIONS.md)' , value : 'aider' } ,
193- { name : 'Claude Code (CLAUDE.md)' , value : 'claude' } ,
194+ { name : 'Claude Code (CLAUDE.md + .claude/rules/ )' , value : 'claude' } ,
194195 { name : 'Gemini CLI (GEMINI.md)' , value : 'gemini' } ,
195196 { name : 'Qodo Merge (best_practices.md)' , value : 'qodo' } ,
196197 { name : 'Roo Code (.roo/rules/)' , value : 'roo' } ,
@@ -246,6 +247,7 @@ async function main() {
246247 'AGENTS.md' ,
247248 'CONVENTIONS.md' ,
248249 'CLAUDE.md' ,
250+ '.claude/rules/' ,
249251 'GEMINI.md' ,
250252 'best_practices.md'
251253 )
@@ -290,9 +292,9 @@ async function main() {
290292 exportedPaths . push ( 'CONVENTIONS.md' )
291293 break
292294 case 'claude' :
293- exportPath = join ( outputDir , 'CLAUDE.md' )
294- if ( ! isDryRun ) exportToClaudeCode ( rules , exportPath , options )
295- exportedPaths . push ( 'CLAUDE.md' )
295+ if ( ! isDryRun ) exportToClaudeCode ( rules , outputDir , options )
296+ exportPath = join ( outputDir , '.claude/rules/' )
297+ exportedPaths . push ( 'CLAUDE.md' , '.claude/rules/' )
296298 break
297299 case 'gemini' :
298300 exportPath = join ( outputDir , 'GEMINI.md' )
@@ -382,7 +384,7 @@ async function main() {
382384 else if ( inputPath . includes ( '.windsurfrules' ) ) format = 'windsurf'
383385 else if ( inputPath . endsWith ( '.rules' ) ) format = 'zed'
384386 else if ( inputPath . endsWith ( 'AGENTS.md' ) ) format = 'codex'
385- else if ( inputPath . endsWith ( 'CLAUDE.md' ) ) format = 'claude'
387+ else if ( inputPath . endsWith ( 'CLAUDE.md' ) || inputPath . includes ( '.claude/rules' ) ) format = 'claude'
386388 else if ( inputPath . endsWith ( 'GEMINI.md' ) ) format = 'gemini'
387389 else if ( inputPath . endsWith ( 'CONVENTIONS.md' ) ) format = 'aider'
388390 else if ( inputPath . endsWith ( 'best_practices.md' ) ) format = 'qodo'
@@ -398,7 +400,7 @@ async function main() {
398400 console . log ( `Input: ${ color . path ( inputPath ) } ` )
399401
400402 // Import using appropriate importer
401- const { importCopilot, importCursor, importCline, importWindsurf, importZed, importCodex, importAider, importClaudeCode, importGemini, importQodo } = await import ( './importers.js' )
403+ const { importCopilot, importCursor, importCline, importWindsurf, importZed, importCodex, importAider, importClaudeCode, importClaudeCodeRules , importGemini, importQodo } = await import ( './importers.js' )
402404
403405 let result
404406 switch ( format ) {
@@ -424,7 +426,9 @@ async function main() {
424426 result = importAider ( inputPath )
425427 break
426428 case 'claude' :
427- result = importClaudeCode ( inputPath )
429+ result = statSync ( inputPath ) . isDirectory ( )
430+ ? importClaudeCodeRules ( inputPath )
431+ : importClaudeCode ( inputPath )
428432 break
429433 case 'opencode' :
430434 result = importOpenCode ( inputPath )
0 commit comments