Conversation
- Update config.ts to read from .git-mem/.git-mem.yaml - Export getConfigPath() and getConfigDir() helpers - Export CONFIG_DIR and CONFIG_FILE constants - Update integration test helpers to write YAML config - Update all unit and integration tests This also completes GIT-93 (update integration test helpers). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> AI-Agent: Claude-Code/2.1.42 AI-Model: claude-opus-4-5-20251101 AI-Decision: migrate config from JSON to YAML (GIT-89). - Update config.ts to read from .git-mem/.git-mem.yaml AI-Confidence: medium AI-Tags: hooks, utils, tests, integration, unit AI-Lifecycle: project AI-Memory-Id: ea93b196 AI-Source: heuristic
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughConfiguration loading migrated from JSON file (.git-mem.json) to YAML format (.git-mem/.git-mem.yaml) in a dedicated directory. New utility exports added for path resolution: getConfigPath() and getConfigDir(). Tests updated to use YAML parsing and new config constants throughout. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/hooks/utils/config.ts (1)
59-99:⚠️ Potential issue | 🟠 MajorAdd legacy
.git-mem.jsonfallback (avoid silent behavior change).Existing repos initialized with
.git-mem.json(at root) will silently fall back to defaults when hooks try to load config, sinceloadHookConfig()now only looks for.git-mem/.git-mem.yaml. This is a breaking change because init commands (src/commands/init.ts,src/commands/init-hooks.ts) still create.git-mem.jsonat the root.Consider a backward-compat fallback to check
.git-mem.json(legacy, root-level) after checking.git-mem/.git-mem.yaml(new location).Suggested backward-compat fallback
export function loadHookConfig(cwd?: string): IHookConfig { + const dir = cwd ?? process.cwd(); const configPath = getConfigPath(cwd); + const legacyPath = join(dir, '.git-mem.json'); - if (!existsSync(configPath)) { - return DEFAULTS; - } + const hasYaml = existsSync(configPath); + const hasLegacy = existsSync(legacyPath); + if (!hasYaml && !hasLegacy) { + return DEFAULTS; + } try { - const raw = parseYaml(readFileSync(configPath, 'utf8')) as Record<string, unknown>; + const contents = readFileSync(hasYaml ? configPath : legacyPath, 'utf8'); + const raw = (hasYaml ? parseYaml(contents) : JSON.parse(contents)) as Record<string, unknown>; const rawHooks = (raw.hooks ?? {}) as Partial<IHooksConfig>;
Summary
config.tsto read from.git-mem/.git-mem.yamlinstead of.git-mem.jsonyamlpackagegetConfigPath(),getConfigDir(),CONFIG_DIR,CONFIG_FILEfor reuseThis also completes GIT-93 (update integration test helpers).
Closes GIT-89
Closes GIT-93
Test plan
npm run pre-commitpasses (type-check + lint)🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
.git-memdirectory structureTests