Skip to content

Generate suggestion category completions from the accepted registry #5235

Description

@Widthdom

Summary

Runtime validation accepts newer suggestion categories, but generated Bash, zsh, fish, and PowerShell completions still advertise only the older category set.

Accepted but omitted values include:

  • security
  • performance
  • bug
  • cleanup
  • documentation
  • feature_request

Reproduced with locally built cdidx v1.45.1 at 81861a14c9396cd74190edc91392ab11abfa86f8.

Reproduction

dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll suggestions add \
  "dogfood" --category security --db <db> --json

dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll help suggestions add
dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll completions bash

The add command and detailed help recognize 14 categories. Generated completions expose the older eight.

Expected behavior

Parser validation, help/schema introspection, MCP metadata, and all generated shells expose the same authoritative category set and stable order.

Existing issue relationship

This is a regression/follow-up to:

Root-cause pointers

  • src/CodeIndex/Models/SuggestionRecord.cs:175-190 contains the canonical accepted set.
  • src/CodeIndex/Cli/CliFlagSchema.cs:644 contains a stale hard-coded subset.
  • src/CodeIndex/Mcp/McpToolCatalog.cs:831-832 already consumes the canonical set.

PR scope and implementation guidance

  • Define the public category domain once and share it across validation, help, CLI schema, MCP metadata, and shell renderers.
  • Avoid a per-shell patch or another copied list.
  • Preserve stable serialized spellings, especially feature_request.
  • Add a contract test proving every advertised category is accepted and every accepted public category is advertised.
  • Keep stored suggestions and export/import compatibility unchanged.

Acceptance criteria

  • Runtime, root/command help, schema metadata, MCP, and all four generated shells expose the same category set and order.
  • Every suggested category succeeds in suggestions add.
  • Invalid categories remain rejected with bounded guidance.
  • Existing persisted records and exports remain compatible.

Tests, documentation, and changelog

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .NET codebugSomething isn't workingdocumentationImprovements or additions to documentationtests

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions