mirror of
https://github.com/kochetkov-ma/claude-brewcode.git
synced 2026-09-14 20:16:41 +08:00
ea944a32fe
- New /brewdoc:docsync skill: user-run generator installs project-local hooks (track/watch/gate) + config; tracks stale docs by last_updated date; modes init/status/sync/reread/frontmatter/uninstall; confirm-before-sync gate - Removed auto-sync skill, bd-auto-sync-processor agent, auto-sync:* frontmatter tags (~44 files), and skill-creator template injection - Docs updated at all levels (README, MDX, navigation, guide catalog, CLAUDE.md)
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
import fs from 'node:fs';
|
|
import os from 'node:os';
|
|
import path from 'node:path';
|
|
|
|
const MODES = new Set(['full', 'planmode', 'architect', 'review-regression', 'review-double']);
|
|
|
|
function readText(file) {
|
|
try { return fs.readFileSync(file, 'utf8').trim(); } catch { return ''; }
|
|
}
|
|
|
|
function readJson(file) {
|
|
try {
|
|
const value = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
} catch { return {}; }
|
|
}
|
|
|
|
export function state(cwd) {
|
|
const value = readJson(path.join(cwd, '.codex', 'brewtools', 'manager', 'state.json'));
|
|
return {
|
|
hard: value.hard === true,
|
|
level: value.level === 'strict' ? 'strict' : 'balanced'
|
|
};
|
|
}
|
|
|
|
export function prompt(mode, cwd, pluginRoot) {
|
|
if (!MODES.has(mode)) return '';
|
|
const candidates = [
|
|
path.join(cwd, '.codex', 'brewtools', 'manager', 'prompts', `${mode}.md`),
|
|
path.join(os.homedir(), '.codex', 'manager', 'prompts', `${mode}.md`),
|
|
path.join(pluginRoot || '', 'skills', 'manager', 'references', `${mode}.md`),
|
|
path.join(pluginRoot || '', '.codex', 'skills', 'manager', 'references', `${mode}.md`)
|
|
];
|
|
for (const candidate of candidates) {
|
|
const value = readText(candidate);
|
|
if (value) return value;
|
|
}
|
|
return '';
|
|
}
|