Skip to content

feat(config): custom config path#26

Open
lexasub wants to merge 1 commit intomainfrom
feat/custom-config-path
Open

feat(config): custom config path#26
lexasub wants to merge 1 commit intomainfrom
feat/custom-config-path

Conversation

@lexasub
Copy link
Owner

@lexasub lexasub commented Mar 10, 2026

Description

Add config path

@r0h1tb I'm not sure if we need this for debugging purposes in the main branch, what do you think?

Copy link

@r0h1tb r0h1tb left a comment

Choose a reason for hiding this comment

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

hey @lexasub — good question, here's my honest take:

the env var (AST_RAG_CONFIG) is worth keeping — right now if you run ast-rag from a directory that doesn't have

ast_rag_config.json
, it silently falls back to defaults with no indication. env var is the standard fix for this (KUBECONFIG, AWS_CONFIG_FILE etc all follow this pattern).

the script-dir fallback (Path(file).parent) i'm less sure about — if someone ships a default config inside the package and a user runs from /tmp/, they'd silently pick up the package-level config instead of their own. unusual precedence that could cause surprise. most tools go: flag → env var → CWD → defaults. i'd drop the script-dir step.

the logging — logger.info on every config load is noisy (fires on every MCP tool call since _get_api() is called per-request). logger.debug for successful loads, logger.warning for the "no config found" case would be cleaner.

bigger concern: the config logic is now duplicated in cli.py and ast_rag_mcp.py with slightly different implementations. services/config.py has a third path (ServiceConfig.from_json()) that doesn't get any of these fallbacks. a shared load_config(config_path=None) → ProjectConfig helper in config.py that everyone calls would be the right fix.

happy to take a crack at that refactor in a follow-up PR if you want to merge the env var piece first, or we can do it all in one shot here.

@lexasub
Copy link
Owner Author

lexasub commented Mar 14, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants