Skip to content

fix(lint): show help before loading the compiler - #1605

Merged
Lorenzobattistela merged 2 commits into
bendlang:mainfrom
vicmcorrea:fix/lint-help-startup
Oct 16, 2026
Merged

Lorenzobattistela merged 2 commits into
bendlang:mainfrom
vicmcorrea:fix/lint-help-startup

Conversation

@vicmcorrea

Copy link
Copy Markdown
Contributor

Problem and fix

bend-lint --help and -h currently load and self-check Bend before printing usage. An unavailable or drifted compiler therefore makes help exit 2 without showing usage.

Retain the parsed startup options and route help through the existing cli() handler before load(). This reuses its strict argument validation and usage text; ordinary commands and library imports still load and check Bend as before.

Blast radius

Two tool-owned files: six added/two removed source lines in tools/bend-lint/src/lint.ts, plus one regression in src/lint.test.ts. Tests remain in the tool's suite, following the #1389 guidance.

No public rule/API change. Normal linting, compiler selection and drift checks retain their behavior. Help-related argument errors still exit 2, now before compiler initialization.

Regression evidence

The added subprocess test supplies a nonexistent compiler, covers both help spellings and explicit --bend, and checks exit 0, usage stdout and empty stderr. It fails against unchanged baseline source with exit 2/no usage, and passes on this branch. An unknown-option control prevents help from bypassing strict parsing.

Additional CLI controls preserve help-looking option values, real -- delimiters, explicit compiler priority, ordinary linting, drift failures and library imports.

Checks

  • Complete bend-lint suite: 128 passed, 0 failed, 845 assertions.
  • Baseline-sensitive regression and focused CLI controls pass their expected before/after assertions.
  • git diff --check passes.
  • Tool typecheck reports the same two existing protected bend.ts errors at lines 2040 and 3771; diagnostics are byte-identical to baseline. This is not a clean typecheck.
  • Repository gate: 53/54, solely unchanged comp.ts at 64,092/64,000 ttok, also present on main's #1600 check. This PR leaves compiler source and caps untouched.

Validation limits

Local checks used macOS arm64 and Bun 1.3.11 through the README-supported direct invocation. Installed-global-bin, editor integration, real release-download fallback, other operating systems and cluster checks were not exercised. The inherited compiler-cap failure prevents a green repository gate.

@Lorenzobattistela
Lorenzobattistela merged commit 7c1d936 into bendlang:main Oct 16, 2026
1 of 2 checks passed
@Lorenzobattistela Lorenzobattistela mentioned this pull request Oct 20, 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.

2 participants