aider icon indicating copy to clipboard operation
aider copied to clipboard

Repo map for YAML with custom .aider.queries not working on macOS

Open Randalix opened this issue 3 months ago • 0 comments

Hello,

I'm unable to get the repo map to recognize symbols in YAML files using a custom .aider.queries/yaml.scm file. Despite an extensive troubleshooting process, the repo map for .yaml files remains blank.

Environment:

OS: macOS (Apple Silicon)

Python: 3.12

Installation Method: Initially pipx, now a clean venv with pip. The issue persists with both.

Problem: The repo map is not populated for any .yaml files, even with a valid .aider.queries/yaml.scm file in the git root. The map works correctly for other file types like .ino (C++).

Diagnostics and Troubleshooting Steps Taken: I have confirmed the following:

Aider Version: 0.86.1

File Path: The query file is correctly located at .aider.queries/yaml.scm.

Configuration: The effective configuration has subtree_only: false.

Clean Installation: The issue persists even after completely removing pipx installations and reinstalling aider-chat in a fresh Python venv.

Dependency Checks: We've confirmed that the tree_sitter_languages library is installed in the environment, but it seems aider is not using the custom queries provided for it.

To Reproduce:

Create a git repository with Home Assistant YAML files.

Create a .aider.queries/yaml.scm file in the root.

Run aider and /map.

Log Files: Here is the output of aider --verbose from my latest attempt with a clean venv installation.

aider --verbose                        
Config files search order, if no --config:
  - /Users/joe/repos/homeassistant-config/.aider.conf.yml 
  - /Users/joe/.aider.conf.yml (exists)
──────────────────────────────────────────────────────────────────────────────────────────────
Too soon to check version: 0.9 hours
Command Line Args:   --verbose
Config File (/Users/joe/.aider.conf.yml):
  read:              ['CONVENTIONS.md', 'app/CONVENTIONS.md']
  auto-commits:      True
  auto-lint:         True
  watch-files:       True
  cache-prompts:     True
  attribute-author:  False
  attribute-co-authored-by:False
  attribute-commit-message-author:False
  attribute-commit-message-committer:False
  vim:               True
  chat-language:     eng
  check-update:      True
Defaults:
  --set-env:         []
  --api-key:         []
  --model-settings-file:.aider.model.settings.yml
  --model-metadata-file:.aider.model.metadata.json
  --cache-keepalive-pings:0
  --map-refresh:     auto
  --map-multiplier-no-files:2
  --input-history-file:/Users/joe/repos/homeassistant-config/.aider.input.history
  --chat-history-file:/Users/joe/repos/homeassistant-config/.aider.chat.history.md
  --user-input-color:#00cc00
  --tool-error-color:#FF2222
  --tool-warning-color:#FFA500
  --assistant-output-color:#0088ff
  --code-theme:      default
  --aiderignore:     /Users/joe/repos/homeassistant-config/.aiderignore
  --lint-cmd:        []
  --test-cmd:        []
  --voice-format:    wav
  --voice-language:  en
  --encoding:        utf-8
  --line-endings:    platform
  --env-file:        /Users/joe/repos/homeassistant-config/.env

Option settings:
  - 35turbo: False
  - 4: False
  - 4_turbo: False
  - 4o: False
  - add_gitignore_files: False
  - aiderignore: /Users/joe/repos/homeassistant-config/.aiderignore
  - alias: None
  - analytics: None
  - analytics_disable: False
  - analytics_log: None
  - analytics_posthog_host: None
  - analytics_posthog_project_api_key: None
  - anthropic_api_key: None
  - api_key: []
  - apply: None
  - apply_clipboard_edits: False
  - assistant_output_color: #0088ff
  - attribute_author: False
  - attribute_co_authored_by: False
  - attribute_commit_message_author: False
  - attribute_commit_message_committer: False
  - attribute_committer: None
  - auto_accept_architect: True
  - auto_commits: True
  - auto_lint: True
  - auto_test: False
  - cache_keepalive_pings: 0
  - cache_prompts: True
  - chat_history_file: /Users/joe/repos/homeassistant-config/.aider.chat.history.md
  - chat_language: eng
  - check_model_accepts_settings: True
  - check_update: True
  - code_theme: default
  - commit: False
  - commit_language: None
  - commit_prompt: None
  - completion_menu_bg_color: None
  - completion_menu_color: None
  - completion_menu_current_bg_color: None
  - completion_menu_current_color: None
  - config: None
  - copy_paste: False
  - dark_mode: False
  - deepseek: False
  - detect_urls: True
  - dirty_commits: True
  - disable_playwright: False
  - dry_run: False
  - edit_format: None
  - editor: None
  - editor_edit_format: None
  - editor_model: None
  - encoding: utf-8
  - env_file: /Users/joe/repos/homeassistant-config/.env
  - exit: False
  - fancy_input: True
  - file: None
  - files: []
  - git: True
  - git_commit_verify: False
  - gitignore: True
  - gui: False
  - haiku: False
  - input_history_file: /Users/joe/repos/homeassistant-config/.aider.input.history
  - install_main_branch: False
  - just_check_update: False
  - light_mode: False
  - line_endings: platform
  - lint: False
  - lint_cmd: []
  - list_models: None
  - llm_history_file: None
  - load: None
  - map_multiplier_no_files: 2
  - map_refresh: auto
  - map_tokens: None
  - max_chat_history_tokens: None
  - message: None
  - message_file: None
  - mini: False
  - model: None
  - model_metadata_file: .aider.model.metadata.json
  - model_settings_file: .aider.model.settings.yml
  - multiline: False
  - notifications: False
  - notifications_command: None
  - o1_mini: False
  - o1_preview: False
  - openai_api_base: None
  - openai_api_deployment_id: None
  - openai_api_key: None
  - openai_api_type: None
  - openai_api_version: None
  - openai_organization_id: None
  - opus: False
  - pretty: True
  - read: ['CONVENTIONS.md', 'app/CONVENTIONS.md']
  - reasoning_effort: None
  - restore_chat_history: False
  - set_env: []
  - shell_completions: None
  - show_diffs: False
  - show_model_warnings: True
  - show_prompts: False
  - show_release_notes: None
  - show_repo_map: False
  - skip_sanity_check_repo: False
  - sonnet: False
  - stream: True
  - subtree_only: False
  - suggest_shell_commands: True
  - test: False
  - test_cmd: []
  - thinking_tokens: None
  - timeout: None
  - tool_error_color: #FF2222
  - tool_output_color: None
  - tool_warning_color: #FFA500
  - upgrade: False
  - user_input_color: #00cc00
  - verbose: True
  - verify_ssl: True
  - vim: True
  - voice_format: wav
  - voice_input_device: None
  - voice_language: en
  - watch_files: True
  - weak_model: None
  - yes_always: None

Checking imports for version 0.86.1 and executable 
/Users/joe/.local/share/uv/tools/aider-chat/bin/python
Installs file: /Users/joe/.aider/installs.json
Installs file exists and loaded
Not first run, loading imports in background thread
No model settings files loaded
Searched for model settings files:
  - /Users/joe/.aider.model.settings.yml
  - /Users/joe/repos/homeassistant-config/.aider.model.settings.yml
Loaded model metadata from:
  - 
/Users/joe/.local/share/uv/tools/aider-chat/lib/python3.12/site-packages/aider/resources/model
-metadata.json
Using openrouter/anthropic/claude-sonnet-4 model with API key from environment.
Model metadata:
{
    "input_cost_per_image": 0.0048,
    "input_cost_per_token": 3e-06,
    "input_cost_per_token_above_200k_tokens": 6e-06,
    "output_cost_per_token_above_200k_tokens": 2.25e-05,
    "litellm_provider": "openrouter",
    "max_input_tokens": 1000000,
    "max_output_tokens": 64000,
    "max_tokens": 64000,
    "mode": "chat",
    "output_cost_per_token": 1.5e-05,
    "supports_assistant_prefill": true,
    "supports_computer_use": true,
    "supports_function_calling": true,
    "supports_reasoning": true,
    "supports_tool_choice": true,
    "supports_vision": true,
    "tool_use_system_prompt_tokens": 159
}
Model settings:
accepts_settings: [
    "thinking_tokens",
    "reasoning_effort"
]
cache_control: true
caches_by_default: false
edit_format: "diff"
editor_edit_format: "editor-diff"
editor_model_name: "openrouter/anthropic/claude-sonnet-4"
examples_as_sys_msg: false
extra_params: {
    "extra_headers": {
        "anthropic-beta": "prompt-caching-2024-07-31,pdfs-2024-09-25,output-128k-2025-02-19"
    },
    "max_tokens": 64000
}
lazy: false
name: "openrouter/anthropic/claude-sonnet-4"
overeager: false
reasoning_tag: null
reminder: "user"
remove_reasoning: null
send_undo_reply: false
streaming: true
system_prompt_prefix: null
use_repo_map: true
use_system_prompt: true
use_temperature: true
weak_model_name: "openrouter/anthropic/claude-3-5-haiku"
Error: Read-only file /Users/joe/repos/homeassistant-config/CONVENTIONS.md does not exist. 
Skipping.
Error: Read-only file /Users/joe/repos/homeassistant-config/app/CONVENTIONS.md does not exist.
Skipping.
RepoMap initialized with map_mul_no_files: 2
Aider v0.86.1
Main model: openrouter/anthropic/claude-sonnet-4 with diff edit format, prompt cache, infinite
output
Weak model: openrouter/anthropic/claude-3-5-haiku
Git repo: .git with 14 files
Repo-map: using 4096 tokens, files refresh
Cost estimates may be inaccurate when using streaming and caching.
──────────────────────────────────────────────────────────────────────────────────────────────
> /map-refresh                                                                                

Processing /Users/joe/repos/homeassistant-config/.gitignore
Processing /Users/joe/repos/homeassistant-config/arduino/rf_send.ino
Processing /Users/joe/repos/homeassistant-config/automations.yaml
Processing /Users/joe/repos/homeassistant-config/automations/rooms/kueche.yaml
Processing 
/Users/joe/repos/homeassistant-config/blueprints/automation/homeassistant/motion_light.yaml
Processing 
/Users/joe/repos/homeassistant-config/blueprints/automation/homeassistant/notify_leaving_zone.
yaml
Processing 
/Users/joe/repos/homeassistant-config/blueprints/script/homeassistant/confirmable_notification
.yaml
Processing /Users/joe/repos/homeassistant-config/compose.yml
Processing /Users/joe/repos/homeassistant-config/configuration.yaml
Processing /Users/joe/repos/homeassistant-config/packages/heating_system.yaml
Processing /Users/joe/repos/homeassistant-config/packages/heating_system_bath.yaml
Processing /Users/joe/repos/homeassistant-config/scenes.yaml
Processing /Users/joe/repos/homeassistant-config/scripts.yaml
Processing /Users/joe/repos/homeassistant-config/secrets.yaml
Repo-map: 0.8 k-tokens
The repo map has been refreshed, use /map to view it.
──────────────────────────────────────────────────────────────────────────────────────────────
> /map                                                                                        

Repo-map: 0.8 k-tokens
Here are summaries of some files present in my git repository.
Do not propose changes to these files, treat them as *read-only*.
If you need to edit any of these files, ask me to *add them to the chat* first.

.gitignore

arduino/rf_send.ino:
⋮
│PubSubClient client(espClient);
│
⋮
│void setup_wifi() {
│  delay(10);
│  Serial.println();
│  Serial.print("Connecting to ");
│  Serial.println(ssid);
│
…
⋮

automations.yaml

automations/rooms/kueche.yaml

blueprints/automation/homeassistant/motion_light.yaml

blueprints/automation/homeassistant/notify_leaving_zone.yaml

blueprints/script/homeassistant/confirmable_notification.yaml

compose.yml

configuration.yaml

packages/heating_system.yaml

packages/heating_system_bath.yaml

scenes.yaml

scripts.yaml

secrets.yaml

──────────────────────────────────────────────────────────────────────────────────────────────
>  

Query File Content: This is the content of my .aider.queries/yaml.scm:

# Queries for simple key: { entity_name: ... } style definitions
(block_mapping_pair
  key: (flow_scalar) @key
  (
    (#match? @key "input_boolean|input_text|input_datetime|input_button|zone|person")
  )
  value: (block_mapping
    (block_mapping_pair
      key: (flow_scalar) @definition.entity
    )
  )
)

# Query for list-style definitions that have a `name:` key, like MQTT switches
(block_mapping_pair
  key: (flow_scalar) @key
  (
    (#match? @key "switch|sensor")
  )
  value: (block_sequence
    (block_mapping
      (block_mapping_pair
        key: (flow_scalar) @name_key
        (#eq? @name_key "name")
        value: (flow_scalar) @definition.named_entity
      )
    )
  )
)

# Query specifically for template sensors, which are nested deeper
(block_mapping_pair
  key: (flow_scalar) @key
  (#eq? @key "template")
  value: (block_sequence
    (block_mapping
      (block_mapping_pair
        key: (flow_scalar) @sensor_key
        (#eq? @sensor_key "sensor")
        value: (block_sequence
          (block_mapping
            (block_mapping_pair
              key: (flow_scalar) @name_key
              (#eq? @name_key "name")
              value: (flow_scalar) @definition.template_sensor
            )
          )
        )
      )
    )
  )
)

# Query for automations and scripts, capturing their `alias`
(block_sequence_item
  (block_mapping
    (block_mapping_pair
      key: (flow_scalar) @key
      (#eq? @key "alias")
      value: (flow_scalar) @definition.automation
    )
  )
)

Thank you for your help!

Randalix avatar Oct 06 '25 14:10 Randalix