Pular para conteúdo

AUR-559: prompt and skills without language names in Go

Design

  • grammar.Provider gains IsComment(lang, line) (isComment, ok bool). The runtime adapter (internal/grammar/comment.go) parses the line with the named grammar and reports a comment when a node whose type contains comment (tree-sitter vocabulary shared by every grammar) starts at the first non-blank byte and reaches the end of the line. ok == false means the runtime has no such grammar.
  • internal/grammar/catalog/aliases.yml (embedded, version + aliases section) maps selector spellings to the runtime's canonical grammar names. Canonical names are never listed: they come from Provider.Languages(). LoadAliases(provider, policyRoot) is strict (unknown keys, or an alias whose target is not a grammar of the runtime, are load errors). A central policy overrides with .aurumcode/grammar/aliases.yml; its aliases section replaces the embedded one.
  • internal/prompt/commentfilter.go: isCommentLine(provider, line, language) has no language knowledge. A language without grammar is never a comment (no filter) and CommentFilterNotice appends a declared notice to the change-scope paragraph (ChangeScopeWith, used by ReviewChangeScope). HasSubstantiveCodeChange keeps its signature and delegates to HasSubstantiveCodeChangeWith(diff, provider).
  • internal/context/skills/languages.go: Languages resolves the file's language through Provider.Detect and selector names through the alias catalog. Set.SelectWith returns Selection{Skills, Warnings}; an unknown language in a selector produces a warning that Provider.Provide renders as a ### Skill selection warnings block. Set.Select keeps its signature.

Compatibility

  • Behavior change (intended): the old fallback "//, /*, */ is a comment" is gone. A line is a comment only if the grammar parses it as one, so a bare block-comment continuation line (* text) in a multi-line hunk is no longer filtered (a single line cannot be classified without its block context). Files without grammar get no filter, plus the notice.
  • Selector spellings that were accepted as raw file extensions now work only when listed in the alias catalog (the shipped catalog covers the common ones); anything else is declared as unknown instead of ignored. shell is an alias of the runtime's bash.
  • analyzer's language_catalog.yml is untouched.

Acceptance

bash tests/acceptance/AUR-559.sh all: AC-001 (go/ast scan with the forbidden name list kept in the script), AC-002..AC-004 (tests), AC-003-MUT-001. Unknown selector exits 64.

Limits

Single-line classification only; no new grammars.