refactor(loaders): migrate to async-first pattern for commands and skills
- Remove all sync functions from command loader (async now default) - Remove sync load functions from skill loader (async now default) - Add resolveSymlinkAsync to file-utils.ts - Update all callers to use async versions: - config-handler.ts - index.ts - tools/slashcommand/tools.ts - tools/skill/tools.ts - hooks/auto-slash-command/executor.ts - loader.test.ts - All 607 tests pass, build succeeds Generated with assistance of 🤖 [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { lstatSync, readlinkSync } from "fs"
|
||||
import { promises as fs } from "fs"
|
||||
import { resolve } from "path"
|
||||
|
||||
export function isMarkdownFile(entry: { name: string; isFile: () => boolean }): boolean {
|
||||
@@ -24,3 +25,16 @@ export function resolveSymlink(filePath: string): string {
|
||||
return filePath
|
||||
}
|
||||
}
|
||||
|
||||
export async function resolveSymlinkAsync(filePath: string): Promise<string> {
|
||||
try {
|
||||
const stats = await fs.lstat(filePath)
|
||||
if (stats.isSymbolicLink()) {
|
||||
const linkTarget = await fs.readlink(filePath)
|
||||
return resolve(filePath, "..", linkTarget)
|
||||
}
|
||||
return filePath
|
||||
} catch {
|
||||
return filePath
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user