Files
zclaw_openfang/.claude/hooks/arch-sync-check.js
iven f2d6a3b6b7
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
docs: add architecture awareness system — CLAUDE.md §13/§14 + ARCHITECTURE_BRIEF
- Activate CLAUDE.md with §13 architecture snapshot (auto-sync markers)
  and §14 anti-pattern warnings + scenario instructions
- Fix dead link to non-existent STABILIZATION_DIRECTIVE.md
- Update stale numbers (93→130 SaaS APIs, 171→182 Tauri commands, 13→15 admin pages)
- Create docs/ARCHITECTURE_BRIEF.md as permanent architecture reference
  covering 10 subsystems (butler, chatstream, LLM drivers, client routing,
  SaaS auth, memory pipeline, Pipeline DSL, Hands, middleware, key paths)
- Add /sync-arch skill for manual or workflow-triggered architecture sync
- Add PostToolUse hook to remind doc sync after git commit/push
- Update §8.3 completion flow to include architecture snapshot updates
- Mark memory files (system_architecture, butler_mode) as migrated to BRIEF
- Add ARCHITECTURE_BRIEF.md as top entry in MEMORY.md index
2026-04-09 14:09:26 +08:00

29 lines
1.0 KiB
JavaScript

// arch-sync-check.js
// PostToolUse hook: detects git commit/push and reminds to sync architecture docs
// Reads tool input from stdin, outputs reminder if git operation detected
const CHUNKS = [];
process.stdin.on('data', (c) => CHUNKS.push(c));
process.stdin.on('end', () => {
try {
const input = JSON.parse(Buffer.concat(CHUNKS).toString());
const toolName = input.tool_name || '';
const toolInput = input.tool_input || {};
// Only check Bash tool calls
if (toolName !== 'Bash') return;
const cmd = (toolInput.command || '').trim();
// Detect git commit or git push
const isGitCommit = cmd.startsWith('git commit') || cmd.includes('&& git commit');
const isGitPush = cmd.startsWith('git push') || cmd.includes('&& git push');
if (isGitCommit || isGitPush) {
console.log('[arch-sync] Architecture docs may need updating. Run /sync-arch or update CLAUDE.md §13 + ARCHITECTURE_BRIEF.md as part of §8.3 completion flow.');
}
} catch {
// Silently ignore parse errors
}
});