Skip to content

symbols/definition do not accept a --visibility filter even though visibility is stored in the DB #1412

Description

@Widthdom

Summary

cdidx symbols and cdidx definition accept --kind (function/class/etc.) but do not accept --visibility (public/internal/protected/private). Audit workflows like "list public API surface" or "find internal helpers that should be private" have to re-derive visibility from cdidx unused output (which prints [private]/[internal]/[public] markers).

The DB already stores s.visibility (e.g. used in src/CodeIndex/Database/DbReader.CSharpResolution.cs:923), so a --visibility filter is a one-line query-builder change.

Use cases

  • "List the C# public surface of this assembly": cdidx symbols --lang csharp --visibility public
  • "Find internal helpers that should be made private": cdidx symbols --lang csharp --visibility internal --max-references 3
  • "Show all private test helpers": cdidx symbols --lang csharp --visibility private --path tests/**

Proposed direction

Add a --visibility flag to symbols, definition, unused, and hotspots, with values public | protected | internal | private (multi-value comma-separated). Add a corresponding --exclude-visibility for negation. Reuse the same parsing as --kind.

Repro env

  • Branch: main @ 2ee912d (release v1.21.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions