mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
refactor(fs): use mkdirSafe recursive and align test mocks
Replace try/access/mkdir pattern with single mkdirSafe call in ssh-key-manager; drop unused mkdir mocks from stt/tts/repo tests and mock fs-safe's mkdirSafe instead; add zod peer dep extension to pnpm workspace; note EACCES-tolerant startup in troubleshooting doc.
This commit is contained in:
1 parent
f20d8ffb71
commit
376bd67f1b
7 files changed
+49
-22
No files matched your search
@@ -9,11 +9,7 @@ import { mkdirSafe } from './fs-safe'
|
||||
const SSH_KEYS_DIR = join(getWorkspacePath(), '.ssh-keys')
|
||||
|
||||
async function ensureSSHKeysDir(): Promise<void> {
|
||||
try {
|
||||
await fs.access(SSH_KEYS_DIR)
|
||||
} catch {
|
||||
await mkdirSafe(SSH_KEYS_DIR, { mode: 0o700 })
|
||||
}
|
||||
await mkdirSafe(SSH_KEYS_DIR, { mode: 0o700 })
|
||||
}
|
||||
|
||||
async function validateSSHKey(keyPath: string): Promise<boolean> {
|
||||
@@ -167,11 +163,7 @@ export function generateSSHConfig(entries: SSHConfigEntry[]): string {
|
||||
|
||||
export async function writeSSHConfig(configPath: string, configContent: string): Promise<void> {
|
||||
const dir = join(getWorkspacePath(), 'config')
|
||||
try {
|
||||
await fs.access(dir)
|
||||
} catch {
|
||||
await mkdirSafe(dir, { mode: 0o700 })
|
||||
}
|
||||
await mkdirSafe(dir, { mode: 0o700 })
|
||||
|
||||
await fs.writeFile(configPath, configContent, { mode: 0o600 })
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user