- Add sync --target droid (skills to ~/.factory/skills/) - Add sync --target cursor (skills + MCP to .cursor/) - Extract expandHome/resolveTargetHome to src/utils/resolve-home.ts - Remove duplicated path helpers from convert.ts and install.ts - Bump version to 0.6.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
18 lines
474 B
TypeScript
18 lines
474 B
TypeScript
import os from "os"
|
|
import path from "path"
|
|
|
|
export function expandHome(value: string): string {
|
|
if (value === "~") return os.homedir()
|
|
if (value.startsWith(`~${path.sep}`)) {
|
|
return path.join(os.homedir(), value.slice(2))
|
|
}
|
|
return value
|
|
}
|
|
|
|
export function resolveTargetHome(value: unknown, defaultPath: string): string {
|
|
if (!value) return defaultPath
|
|
const raw = String(value).trim()
|
|
if (!raw) return defaultPath
|
|
return path.resolve(expandHome(raw))
|
|
}
|