Skip to content

feat(ai): AST support for C#, C, C++, shell and Markdown - #570

Merged
dan-petty merged 2 commits into
release/v0.2.23from
feat/506-ast-languages
Sep 25, 2026
Merged

dan-petty merged 2 commits into
release/v0.2.23from
feat/506-ast-languages

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Summary

C#, C, C++, shell and Markdown files yielded no symbols, so repomaps, context packing and review grounding saw nothing in them.

  • Grammars (tree-sitter and tree-sitter-grammars organisations):
    • tree-sitter-c-sharp 0.23.5
    • tree-sitter-c 0.24.2
    • tree-sitter-cpp 0.23.4 (official; last released 2024-11)
    • tree-sitter-bash 0.25.1
    • tree-sitter-markdown 0.5.1, block grammar
  • Extensions .cs, .c/.h, .cc/.cpp/.cxx/.c++/.hh/.hpp/.hxx, .sh/.bash/.envsh, .md/.markdown, plus the aliases shell, sh, c#, cs, c++, md.
  • .h headers are C++ when they contain a namespace, a template, a class body or ::, and C otherwise. fmt's headers are C++.
  • C/C++:
    • names come through the declarator chain (*f, Class::f, operator++, ~T);
    • class-body and qualified definitions are methods;
    • file-scope prototypes count through include guards, extern "C" (and so behind CJSON_PUBLIC(...) export macros), namespaces and templates;
    • types count only where defined;
    • typedefs, using aliases and function-like macros also count.
  • C#: namespaces (block and file-scoped), classes, records, structs, interfaces, enums, delegates, methods and constructors.
  • Shell: both function forms.
  • Markdown: ATX and setext headings as a new heading kind, skipping front matter and fenced # lines.
  • Regex fallbacks for each language.

On the pinned samples

Sample Files With symbols Symbols
serilog (C#) 216 209 1,997
cJSON (C) 99 97 2,034
fmt (C++) 74 70 7,279
nvm (shell) 6 6 170
kind docs (Markdown) 47 33 274

Files without symbols declare none, for example docs pages with only front matter and prose.

Tests

tests/test_ast_more_languages.py uses snippets following each sample. It covers:

  • each language's symbols and scopes;
  • C export macros, guards and linkage;
  • C++ members and qualified definitions;
  • Markdown front matter and fences;
  • extensions and aliases;
  • header detection;
  • every fallback, including one-line bodies.

Updated tests:

  • README.md now maps to Markdown;
  • shell outlines report bash;
  • the sample report's unsupported-type check now uses .yaml.

uv run devops ci --force: 13/13 gates pass.

Closes #506

C#, C, C++, shell and Markdown files yielded no symbols, so repomaps,
context packing and review grounding saw nothing in them.

The tree-sitter grammars for C#, C, C++, bash and Markdown (block) are
mapped to their extensions, and a .h header is parsed as C++ when its
content is. C and C++ names come through the declarator chain, so
pointer-returning, qualified and macro-wrapped definitions are named,
and a header's prototypes count through include guards, extern "C",
namespaces and templates. C# namespaces, types and members, shell
functions and Markdown headings (a new heading kind) are extracted, and
regex fallbacks cover each language. Checked on the pinned serilog,
cJSON, fmt, nvm and kind docs samples.

Closes #506
@dan-petty dan-petty added this to the v0.2.23 milestone Sep 25, 2026
@dan-petty dan-petty added type/feature Type feature: a new function scope/ai AI review pipeline, personas, prompts, LLM client, or RAG priority/p2-medium Priority P2: standard work labels Sep 25, 2026
@dan-petty
dan-petty enabled auto-merge (squash) September 25, 2026 02:12
@dan-petty
dan-petty merged commit ae5f89d into release/v0.2.23 Sep 25, 2026
7 checks passed
@dan-petty
dan-petty deleted the feat/506-ast-languages branch September 25, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p2-medium Priority P2: standard work scope/ai AI review pipeline, personas, prompts, LLM client, or RAG type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant