cli-config-persistence
暂无简介
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 13
- Forks
- 2
03 SKILL.md 正文
/cli-config-persistence
When to Use
- Store persistent settings for yamtam CLI tools (session defaults, feature flags)
- Config that survives between terminal sessions in Codespaces
- Encrypted storage for API keys in CLI tools (avoid plain .env files)
- Typed config with JSON Schema validation at read/write time
Do NOT use for
- Runtime session state (use in-memory or [[state-persistence-gateway]])
- Config shared across network (use CouchDB/PouchDB)
Basic Conf setup
import Conf from 'conf'
interface YanaConfig {
version: string
sandboxEnabled: boolean
defaultTier: 'fast' | 'power'
maxAgents: number
apiBaseUrl: string
}
const config = new Conf<YanaConfig>({
projectName: 'yana-ai',
projectVersion: '1.3.48',
schema: {
version: { type: 'string' },
sandboxEnabled: { type: 'boolean', default: true },
defaultTier: { type: 'string', default: 'fast', enum: ['fast', 'power'] },
maxAgents: { type: 'number', default: 87, minimum: 1, maximum: 500 },
apiBaseUrl: { type: 'string', default: 'https://api.anthropic.com' },
},
// Config path: ~/.config/yana-ai/config.json (XDG)
})
// Read
const tier = config.get('defaultTier') // 'fast'
// Write
config.set('sandboxEnabled', true)
config.set({ defaultTier: 'power', maxAgents: 100 })
// Delete
config.delete('apiBaseUrl')
// Reset to defaults
config.clear()
Encrypted secrets store
import Conf from 'conf'
import crypto from 'crypto'
const secrets = new Conf({
projectName: 'yamtam-secrets',
encryptionKey: process.env.YAMTAM_CONFIG_KEY ?? crypto.randomBytes(32).toString('hex'),
// → file on disk is AES-256-CBC encrypted — unreadable without key
})
secrets.set('anthropic.apiKey', process.env.ANTHROPIC_API_KEY)
const key = secrets.get('anthropic.apiKey') as string
Config migration
const config = new Conf({
projectName: 'yana-ai',
migrations: {
'1.3.47': (store) => {
// Rename old key
if (store.has('enableSandbox')) {
store.set('sandboxEnabled', store.get('enableSandbox'))
store.delete('enableSandbox')
}
},
'1.3.48': (store) => {
// Add new key with default if missing
if (!store.has('maxAgents')) store.set('maxAgents', 87)
},
},
})
Config file path
# Linux: ~/.config/yana-ai/config.json
# macOS: ~/Library/Preferences/yana-ai/config.json
# Windows: %APPDATA%/yana-ai/config.json
# Print config location
node -e "const Conf=require('conf'); const c=new Conf({projectName:'yana-ai'}); console.log(c.path)"
Anti-Fake-Pass Checklist
❌ No schema → config stores any type, validation errors discovered late
❌ encryptionKey hardcoded in source → secrets visible in git history
❌ encryptionKey not persisted → every process restart uses new key, can't decrypt
❌ No migration → config from old version causes schema validation failure
❌ Concurrent writes from multiple processes → file corruption (no locking)
❌ config.clear() in test → clears real user config on disk if projectName matches
04 同仓库更多 Skills
openai--sentry--sentry
Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.
ito-basket-compare
Compare Itô prediction-market baskets against a user's knowledge base, portfolio notes, financial context, watchlist, or research thesis. Use for read-only basket comparison and gap analysis without investment advice or live trading.
implementing-network-traffic-baselining
Build network traffic baselines from NetFlow/IPFIX data using Python pandas for statistical analysis, z-score anomaly detection, and hourly/daily traffic pattern profiling
detecting-evasion-techniques-in-endpoint-logs
Detects defense evasion techniques used by adversaries in endpoint logs including log tampering, timestomping, process injection, and security tool disabling. Use when investigating suspicious endpoint behavior, building detection rules for evasion tactics, or conducting threat hunting for stealthy adversary activity. Activates for requests involving evasion detection, defense evasion analysis, log tampering detection, or MITRE ATT&CK TA0005.
implementing-microsegmentation-with-guardicore
Implementing microsegmentation using Akamai Guardicore Segmentation to map application dependencies, create granular network policies, visualize east-west traffic flows, and enforce least-privilege communication between workloads across data centers and cloud.
ramdisk-tmpfs-patterns
暂无简介