Skip to content

Warn when -e names an unsupported extension (#98) - #100

Merged
shhdwi merged 1 commit into
mainfrom
fix/warn-unsupported-extension
Aug 13, 2026
Merged

shhdwi merged 1 commit into
mainfrom
fix/warn-unsupported-extension

Conversation

@shhdwi

@shhdwi shhdwi commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Fixes #98.

Problem

graft build -e ".vue" accepts any extension, indexes zero .vue, and exits 0 with no warning — so -e (the natural way a user probes what's supported) silently answers wrong.

Fix

Validate each -e value against the actual parser set — depth EXTENSIONS (extract.ts) ∪ breadth GENERIC_LANGS exts (generic.ts) — and warn (never fail) on any with no parser, listing the supported set so -e now also answers "what is supported":

⚠ -e ".vue": no parser registered for this extension — ignoring it.
  supported: .c .cc .cjs .cpp .cs .cts .cxx .dart .ex .exs .go .h .hh .hpp .java .js .jsx .kt .kts .mjs .ml .mli .mts .php .py .pyi .rb .rs .sc .scala .sol .swift .ts .tsx .zig
  • depthExtensions() / genericExtensions() expose each tier's set; supportedExtensions() + unsupportedExtensions() (leading-dot-optional, case-insensitive) in source-files.ts.
  • Warns on both build and check; -e help text now points to the supported set.
  • Build still proceeds on the remaining supported files — it's a warning, not an error.

629 tests (+3 covering the set, the .vue repro, and normalization). Verified the exact reported command now emits the warning.

This is the standalone half of the report. .vue support is the separate feature in #97.

`graft build -e ".vue"` used to accept any extension, index zero .vue files,
and exit 0 with no signal — so -e (the natural way to probe what's supported)
answered wrong. Now the CLI validates each -e value against the parser set
(depth EXTENSIONS ∪ breadth GENERIC_LANGS) and warns on any it can't parse,
listing the full supported set so the flag also answers "what IS supported":

  ⚠ -e ".vue": no parser registered for this extension — ignoring it.
    supported: .c .cc .cjs .cpp .cs .cts ... .ts .tsx .zig

- extract.ts/generic.ts expose depthExtensions()/genericExtensions().
- source-files.ts adds supportedExtensions() + unsupportedExtensions() (leading
  dot optional, case-insensitive).
- cli.ts warns (never fails) on build AND check; -e help now points to the set.

Warning only — the build still proceeds on the remaining supported files. 629
tests (+3). Does not add .vue support itself (that's #97).
@shhdwi shhdwi mentioned this pull request Aug 13, 2026
@shhdwi
shhdwi merged commit eabe199 into main Aug 13, 2026
4 checks passed
FrancescoMerenda pushed a commit to FrancescoMerenda/Graft that referenced this pull request Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-e with an unsupported extension is silently ignored

1 participant