Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore(deps): setup aspect-gazelle for BUILD file generation#6195

Merged
longlho merged 4 commits into
mainfrom
chore/setup-gazelle
Mar 28, 2026
Merged

chore(deps): setup aspect-gazelle for BUILD file generation#6195
longlho merged 4 commits into
mainfrom
chore/setup-gazelle

Conversation

@longlho
Copy link
Copy Markdown
Member

@longlho longlho commented Mar 28, 2026

Summary

  • Add aspect-gazelle as a prebuilt binary via rules_multitool — scaffolding only, all generation disabled by default
  • Only the js language extension is loaded (via ENABLE_LANGUAGES), but # gazelle:js disabled at the root prevents any BUILD file modifications
  • Add gazelle lefthook pre-commit step so BUILD files stay in sync once generation is enabled per-package
  • To enable for a specific package, add # gazelle:js enabled in that package's BUILD.bazel

Changes

  • MODULE.bazel: Add gazelle 0.48.0, rules_multitool 1.11.1, and multitool extension
  • multitool.lock.json: New file with prebuilt aspect-gazelle binary (2026.12.17) for darwin_arm64, linux_amd64, linux_arm64
  • BUILD.bazel: Add gazelle() target with JS disabled globally and ENABLE_LANGUAGES=js to skip starlark/go/proto/python extensions
  • lefthook.yml: Add gazelle pre-commit command

Usage

# Preview changes (currently no-op since JS is disabled)
bazel run //:gazelle -- -mode diff

# Apply changes
bazel run //:gazelle

# Enable for a specific package by adding to its BUILD.bazel:
# gazelle:js enabled

Test plan

  • bazel run //:gazelle -- -mode diff exits 0 (no drift)
  • Lefthook pre-commit hook runs gazelle successfully (0 BUILD files updated)
  • CI tests pass (bazel test //...)

🤖 Generated with Claude Code

longlho and others added 2 commits March 28, 2026 09:18
Add aspect-gazelle as a prebuilt binary via rules_multitool to automatically
generate and maintain BUILD.bazel files for JS/TS packages. Includes lefthook
pre-commit integration to keep BUILD files in sync on every commit.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add aspect-gazelle as a prebuilt binary via rules_multitool. All language
extensions are disabled by default (JS disabled via directive, others via
ENABLE_LANGUAGES env). Includes lefthook pre-commit integration. Gazelle
is scaffolded and ready to be enabled per-package as needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@longlho longlho enabled auto-merge (squash) March 28, 2026 13:26
longlho and others added 2 commits March 28, 2026 09:33
Remove bzl_library rules that were accidentally left by the starlark
gazelle extension in tools/, intl-datetimeformat, and intl-segmenter.
These referenced @bazel_skylib which is not a direct dependency.
Add knowledge-base/gazelle-migration.md documenting the plan to
decompose custom macros into stock rules gazelle can manage.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@longlho longlho merged commit 301e123 into main Mar 28, 2026
5 checks passed
@longlho longlho deleted the chore/setup-gazelle branch March 28, 2026 13:36
longlho added a commit that referenced this pull request Mar 30, 2026
## Summary

Revert the BUILD file changes from the gazelle migration (phases 1-3)
while keeping the scaffolding and documentation.

### Reverted
- Phase 1: `ts_binary` → `js_binary` inlining (#6197)
- Phase 2: `ts_compile` macro decomposition (#6198)
- Phase 3+4: `vitest` decomposition + gazelle JS enablement (#6199)

### Kept
- Gazelle scaffolding: aspect-gazelle setup, multitool, lefthook
integration (#6195)
- Knowledge-base documentation (#6196)

### Why

The `map_kind` + `copy_to_bin` approach caused conflicting actions —
both `copy_to_bin(name = "srcs")` and gazelle's direct file lists
produce the same output files through `ts_project`. A different approach
is needed that either eliminates `copy_to_bin` or uses a custom gazelle
extension.

## Test plan
- [x] 495 tests pass
- [ ] CI passes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
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.

1 participant