Skip to content

Automatically create -repo alias when indexing repositories #130

@kapral18

Description

@kapral18

Problem

Currently, when indexing a repository, the indexer creates the main index and _settings index, but does not create a -repo alias. This requires users to manually create aliases for the MCP server to discover indices, which is a poor user experience.

Solution

Automatically create a <indexName>-repo alias pointing to the main index when:

  1. A new index is created
  2. An existing index is used (for backward compatibility with already-indexed repos)

Implementation

  • Add createRepoAlias() function that:

    • Creates alias with pattern <indexName>-repo
    • Checks if alias already exists (idempotent)
    • Verifies index exists before creating alias
    • Handles errors gracefully (non-blocking)
  • Integrate into createIndex():

    • Call createRepoAlias() after successful index creation
    • Also call for existing indices to ensure aliases are created retroactively

Benefits

✅ Works seamlessly with MCP server's alias-based discovery (primary strategy)
✅ No manual steps required for users
✅ Backward compatible (creates aliases for existing indices)
✅ Non-blocking (alias creation failures don't break indexing)
✅ Complements the MCP server's _settings fallback strategy

Related

This complements the MCP server improvement in:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions