Skip to content

feat(lang): add user-defined extra extension→language mappings via config file - #60

Closed
halindrome wants to merge 4 commits into
DeusData:mainfrom
halindrome:feat/user-extension-config
Closed

halindrome wants to merge 4 commits into
DeusData:mainfrom
halindrome:feat/user-extension-config

Conversation

@halindrome

Copy link
Copy Markdown
Contributor

Summary

Adds support for user-defined file extension → language mappings via:

  • Global config: $XDG_CONFIG_HOME/codebase-memory-mcp/config.json (Linux/macOS: ~/.config/…, Windows: %AppData%\…)
  • Project config: {repo_root}/.codebase-memory.json

Project config overlays global config; project keys win on collision. User mappings always override built-in registry entries.

Config format

```json
{
"extra_extensions": {
".blade.php": "php",
".mjs": "javascript",
".pyx": "python"
}
}
```

Behavior

  • Missing config file → no extra mappings, no error.
  • Malformed JSON → warning logged, file skipped.
  • Unknown language value → warning logged, key skipped.
  • Auto-detected at repo root — no new MCP tool parameters.

Changes

  • internal/userconfig/: new package — Load() merges global + project configs.
  • internal/lang/lang.go: add RegisterExtension(ext, language) helper.
  • internal/pipeline/pipeline.go: call userconfig.Load before discover/walk phase.
  • Tests for all new code paths.

Test plan

  • go test ./... -count=1 -timeout 400s passes
  • golangci-lint run ./... passes
  • TestLoad_Cascade verifies project config overrides global
  • TestPipeline_UserExtension_FullMode verifies .blade.php indexed as PHP
  • TestRegisterExtension_KnownLanguage, TestRegisterExtension_UnknownLanguage, TestRegisterExtension_OverridesBuiltin

🤖 Generated with Claude Code

@halindrome

Copy link
Copy Markdown
Contributor Author

Superseded by #73 — C port of the same feature.

@halindrome halindrome closed this Mar 19, 2026
ngallodev added a commit to ngallodev/codebase-memory-cli that referenced this pull request Oct 4, 2026
…ng, output budget

Brings the Jenkins-green step-2 line (release-tooling DeusData#60, 904ae6b) into the
fully merged step-4 tree:
- 12 step-2 tests aligned with the CLI-only fork (cc9f002)
- feat/legacy-mcp-block-warning: install and uninstall warn about leftover
  codebase-memory-mcp instruction blocks and leave them in place
- feat/output-token-budget: max_output_tokens for search_code, trace_path
  and detect_changes, plus match_limit, source_max_lines and directory
  paging
- lint fixes and memory-core baseline notes (904ae6b)

Conflicts:
- tests/test_daemon_application.c, over-budget passthrough. Kept step 2's
  binary-safe app_test_response_contains instead of strstr on a binary
  frame. Searches the whole frame and accepts either error-flag spelling:
  is_error from the operation result wire on this tree, isError from a
  passed-through body.
- scripts/memory-core-baseline.txt regenerated for the merged tree. These
  are counts the fork already had, not new raw allocations.

Validated locally:
- `scripts/build-dev.sh` and the test-runner compile are clean with
  -Werror.
- `scripts/lint.sh --ci` passes.
- Vendored checksums verify.
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