feat(security): C1 broaden token markers + scan untracked; C3 resolveVault util
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
d2b208b867
commit
aa87a85d9b
@@ -0,0 +1,20 @@
|
||||
import fsSync from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import os from 'node:os'
|
||||
|
||||
// Single source of truth for the live knowledge vault.
|
||||
// Canon (per personal constitution structure.md): ~/Мозг.
|
||||
// Override with --vault <path> or MNEMAZINE_VAULT. Fail loud when the resolved
|
||||
// directory does not exist — silently writing into a missing/wrong tree loses data.
|
||||
export const DEFAULT_VAULT = path.join(os.homedir(), 'Мозг')
|
||||
|
||||
export function resolveVault({ cli, env = process.env.MNEMAZINE_VAULT, requireExists = true } = {}) {
|
||||
const vault = path.resolve(cli || env || DEFAULT_VAULT)
|
||||
if (requireExists && !fsSync.existsSync(vault)) {
|
||||
throw new Error(
|
||||
`Vault not found: ${vault}\n` +
|
||||
`Set MNEMAZINE_VAULT or pass --vault <path>. Canon default is ~/Мозг.`,
|
||||
)
|
||||
}
|
||||
return vault
|
||||
}
|
||||
Reference in New Issue
Block a user