Add droid and cursor sync targets, extract shared path helpers
- 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>
This commit is contained in:
17
src/utils/resolve-home.ts
Normal file
17
src/utils/resolve-home.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
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))
|
||||
}
|
||||
Reference in New Issue
Block a user