feat: M1 companion 資料層與 band 角色行

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 13:27:27 +08:00
co-authored by Claude Sonnet 5.5
parent 030c599208
commit 176bcdd23a
12 changed files with 796 additions and 23 deletions
+26
View File
@@ -0,0 +1,26 @@
import { mkdir, readdir, readFile, rename, writeFile } from 'node:fs/promises'
import { dirname } from 'node:path'
import type { Fs } from './fs'
export const nodeFs: Fs = {
async read(path) {
try {
return await readFile(path, 'utf8')
} catch {
return null
}
},
async write(path, data) {
await mkdir(dirname(path), { recursive: true })
await writeFile(path, data, 'utf8')
},
rename,
async list(dir) {
try {
return (await readdir(dir)).filter(n => !n.endsWith('.tmp')).sort()
} catch {
return []
}
},
}