Skip to content

feat: update init-hooks.ts to write YAML config (GIT-91)#62

Merged
TonyCasey merged 3 commits intomainfrom
git-91
Feb 14, 2026
Merged

feat: update init-hooks.ts to write YAML config (GIT-91)#62
TonyCasey merged 3 commits intomainfrom
git-91

Conversation

@TonyCasey
Copy link
Copy Markdown
Owner

@TonyCasey TonyCasey commented Feb 14, 2026

Summary

  • Create .git-mem/ directory if it doesn't exist
  • Write config as YAML to .git-mem/.git-mem.yaml
  • Update path references and console messages
  • Remove entire .git-mem/ directory in remove mode
  • Parse existing config as YAML when merging

Closes GIT-91

Test plan

  • npm run pre-commit passes (type-check + lint)
  • All 529 tests pass (438 unit + 91 integration)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor

    • Configuration storage moved to a YAML file inside the tool's config directory; install now ensures the config directory exists and safely merges existing settings into defaults. Removal cleans up the entire config directory and updates install/remove messaging to reference the new YAML path.
  • Bug Fixes

    • Configuration loader returns defaults when the config is missing or unparseable, preventing errors.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 14, 2026

📝 Walkthrough

Walkthrough

Replaces per-repo hook config file .git-mem.json with a YAML file at .git-mem/.git-mem.yaml. Updates init/remove flows and loader docs to read/write YAML, ensure/remove the .git-mem/ directory, and deep-merge defaults with existing YAML config; adjusts messaging accordingly.

Changes

Cohort / File(s) Summary
Hook Configuration Migration
src/commands/init-hooks.ts
Switches hook config storage to YAML at .git-mem/.git-mem.yaml: adds YAML parse/stringify imports, uses getConfigDir/getConfigPath, ensures .git-mem/ directory creation, reads existing YAML, deep-merges defaults, writes YAML, and removes the directory on uninstall (rmSync). Updates log messages and next-step hints to the new path.
Loader docs update
src/infrastructure/services/HookConfigLoader.ts
Updates header/docstring to state configs are read from .git-mem/.git-mem.yaml and that loader returns defaults when the file is missing or parsing fails; implementation unchanged.
Doc comment update
src/domain/interfaces/IHookConfig.ts
Updates top-level documentation to reference .git-mem/.git-mem.yaml instead of .git-mem.json; no interface/type changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating init-hooks.ts to use YAML configuration instead of JSON. It is specific, concise, and clearly communicates the primary objective of the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch git-91

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@src/commands/init-hooks.ts`:
- Around line 12-17: The file HookConfigLoader.ts contains stale doc comments
mentioning the old JSON filename; update those comment lines to reference the
current YAML filename and behavior—replace occurrences of ".git-mem.json" with
".git-mem.yaml" and adjust any mention of JSON parsing to indicate YAML parsing
(e.g., reference parseYaml or YAML migration). Ensure comments near the
HookConfigLoader class and its CONFIG_FILE constant (and any doc text around
methods that describe returning defaults on parse errors) reflect the YAML
migration and the non-throwing error handling semantics.
- Around line 273-283: parseYaml can return null, so coercion is needed before
passing parsed YAML into deepMergeGitMemConfig: update the existingGitMemConfig
assignment (the block that calls parseYaml and sets existingGitMemConfig) to
treat null or non-object results as an empty object (e.g., if parseYaml(...)
returns null or a non-plain-object, set existingGitMemConfig = {}); ensure this
change references the symbols parseYaml, existingGitMemConfig,
deepMergeGitMemConfig, buildGitMemConfig and writeFileSync in
src/commands/init-hooks.ts, and apply the identical guard in the analogous code
in src/commands/init.ts.

Comment thread src/commands/init-hooks.ts
Comment thread src/commands/init-hooks.ts
Base automatically changed from git-90 to main February 14, 2026 22:46
TonyCasey and others added 3 commits February 14, 2026 22:46
- Create .git-mem/ directory if it doesn't exist
- Write config as YAML to .git-mem/.git-mem.yaml
- Update path references and console messages
- Remove entire .git-mem/ directory in remove mode
- Parse existing config as YAML when merging

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: update init-hooks.ts to write YAML config (GIT-91). - Create .git-mem/ directory if it doesn't exist
AI-Confidence: medium
AI-Tags: commands, typescript
AI-Lifecycle: project
AI-Memory-Id: eeee468d
AI-Source: heuristic
- Add type guard to coerce null/non-object parseYaml results
- Update HookConfigLoader.ts documentation to reference YAML

Addresses CodeRabbit review feedback.

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-Gotcha: guard YAML parsing against null values + update docs. - Add type guard to coerce null/non-object parseYaml results
AI-Confidence: medium
AI-Tags: commands, infrastructure, services
AI-Lifecycle: project
AI-Memory-Id: 842957db
AI-Source: heuristic
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-Convention: Hook configuration files are now located in a .git-mem directory rather than being a single file at the root level.
AI-Confidence: verified
AI-Tags: configuration, file-format, hooks, yaml, json, file-structure, directory-organization
AI-Lifecycle: project
AI-Memory-Id: 11b7de7b
AI-Source: llm-enrichment
@TonyCasey TonyCasey merged commit 64289f6 into main Feb 14, 2026
2 of 3 checks passed
@TonyCasey TonyCasey deleted the git-91 branch February 14, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant