38 Commits
Author SHA1 Message Date
Boshen 5be8456195 docs(repo): open source (#28433)
Add a reuse acknowledgment notice for AI agents. AI-assisted.
2026-10-30 01:21:48 +08:00
Boshen 0058f7ed8d docs(react_compiler): add agent guide 2026-10-29 15:21:32 +08:00
Dunqing 0e6498f7e2 perf(tasks): build the coverage profile without cross-crate LTO (#28007)
> AI disclosure: this PR, the measurements behind it, and this description were produced with Claude Code at a maintainer's request. It should get human review before it leaves draft.

## Summary

This PR does three things:
- **`Cargo.toml`:** `[profile.coverage]` changes from `lto = "thin"` to `lto = false`.
- **`AGENTS.md`:** adds an opt-in note on incremental compilation for this profile, with its measured cost.
- **`AGENTS.md`:** the `cargo coverage -- <tool>` examples become `cargo coverage <tool>`; the old form runs every suite.

## Why

With `lto = "thin"`, the library crates are compiled to bitcode only (`-C linker-plugin-lto`). The final binary (`-C lto=thin`) then re-optimizes and re-codegens the whole program on every rebuild. After a one-line `oxc_minifier` edit, `cargo build --timings` showed where the time went:

| | `oxc_minifier` lib | `oxc_minsize` lib | `oxc_minsize` bin |
|---|---|---|---|
| `lto = "thin"` | 5.2s | 1.9s | **19.4s** (whole-program ThinLTO) |
| `lto = false` | 7.2s | 2.3s | **0.7s** (plain link) |

Every binary built with this profile pays that step separately. That covers the harnesses (`oxc_minsize`, `oxc_track_memory_allocations`, `oxc_coverage`) and the NAPI test builds (`pnpm build-test`). The profile's own comment says `lto = "thin"` was chosen for "faster compile time", and turning LTO off is faster still. The profile exists to run the harnesses with debug assertions, which doesn't need cross-crate LTO.

## Evidence: replaying 11 real `main` commits

Setup:
- **Commits:** the 11 picked from the rust 1.99.1 window. They cover minifier, ecmascript, codegen, parser, transformer and formatter, plus two `oxc_ast`/`oxc_str` refactors that rebuild 66 crates. Four of them change `allocs_*.yaml`, and one also changes `minsize.snap`.
- **Per commit and config:**
  1. Build at the commit's parent (untimed).
  2. Check out the commit.
  3. Time `cargo minsize`, `cargo allocs` and `cargo coverage`, with build and run timed separately.
- **Machine:** 4-core Linux VM; each config used its own target dir.

| config | total edit→result | per commit | harness run (median) | target dir after 11 commits |
|---|---|---|---|---|
| `lto = "thin"` (before) | 1580s | 110–174s | 16.0s | 2.1 GB |
| **`lto = false` (this PR)** | **923s (1.7×)** | 36–140s (1.2× deep → 3.8× leaf) | **16.0s** | **1.8 GB** |
| `lto = false` + `CARGO_PROFILE_COVERAGE_INCREMENTAL=true` | 463s (3.4×) | 23–83s | 16.9s (+6%) | 12 GB (9.9 GB of it the incremental cache) |

**Correctness:** all 33 runs (3 configs × 11 commits) produced outputs byte-identical to the snapshots committed at each commit. That includes the commits whose snapshots changed.

## CI

PR CI on `c6014a89` passed. Several jobs that build with this profile are path-filtered or Windows-only on PRs. So I also triggered `ci.yml` manually on this branch ([run 39706156660](https://github.com/oxc-project/oxc/actions/runs/39706156660)), which runs them regardless of what changed. All 21 jobs that ran passed. The coverage-profile ones:

| job | how it uses the profile | result |
|---|---|---|
| Conformance, Minification Size, Allocations, Linter changes | `cargo coverage` / `minsize` / `allocs` / `lint-timings` | ✅ snapshots unchanged |
| Lexer (generic, AVX2, Neon) | lexer conformance via `oxc_coverage` | ✅ snapshots unchanged |
| Test NAPI Compiler, Test NAPI Oxlint, Test NAPI Oxfmt, Test Codegen | `pnpm build-test` | ✅ |
| Test NAPI Compiler (windows) | `cargo build --profile coverage` of the NAPI crates | ✅ |

**Not run before merge:** Test NAPI Oxlint (windows) and Test NAPI Oxfmt (windows). Their condition is `github.ref_name == 'main'`, with no manual trigger. The risk is low:
- Their Linux versions, which run the same `build-test` scripts, passed.
- Building NAPI libraries with this profile on Windows passed in Test NAPI Compiler (windows).

**Not affected:** the lexer benchmark uses the `bench` profile.

## Incremental: documented as opt-in only

Incremental roughly halves edit→result again, but its cache grew to ~10 GB over 11 commits and harness runs got ~6% slower. So `AGENTS.md` documents it as an opt-in env var with those costs, and it stays out of the profile.

## `cargo coverage -- <tool>` examples

The `coverage` alias already ends in `--`, so `cargo coverage -- parser` passes `-- parser` to the binary. `pico_args::subcommand()` then returns `None`, and the binary runs `run_all()`:

| command | suites run | time |
|---|---|---|
| `cargo coverage parser` | 4 | 5.0s |
| `cargo coverage -- parser` | 28 | 15.3s |

**Not included (possible follow-ups):**
- `just conformance <tool>` has the same problem.
- `oxc_coverage` could skip a leading `--`, so both forms work.

## Verification
- `typos` and the repo's pinned `oxfmt@0.74.0 --check` pass on `AGENTS.md` and `Cargo.toml`.
- `pnpm install` failed in the sandbox with a proxy 403 on a GitHub tarball, so I ran oxfmt directly.
- Before pushing, I also ran the harnesses, lexer conformance (generic and AVX2) and the NAPI crate build locally with LTO off. All matched HEAD.

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

https://claude.ai/code/session_01GZu5GvJLQYkfYHTAoH2yac
2026-10-23 03:06:26 +00:00
Dunqing 335ce792fa docs(agents): scope verification for local and stacked work (#27299)
Running `just ready` after every commit repeats expensive workspace checks for small edits and successive PRs in a stack.

Keep the core rules in `AGENTS.md` and move the detailed workflow to `.agents/verification.md`, with an explicit instruction to read it before selecting checks. Scope verification to changed code and affected consumers, reuse results while inputs stay unchanged, and keep Cargo build settings consistent to avoid unnecessary rebuilds. For stacks, use each PR's diff against its parent and reserve broad integration checks for a stable tip.

This reduces repeated work during local and stacked development while retaining required subsystem checks and CI for each mergeable PR. It uses existing commands, with no additional verification scripts to maintain.

Exercised on local changes and a ten-PR stack; a fresh agent checked discovery and verification decisions after the split.

AI-assisted with Codex.
2026-10-04 10:29:30 +00:00
camc314 279c64d652 chore(rust): bump MSRV to 1.97.0 (#27265)
Bump the MSRV from Rust 1.96.0 to 1.97.0 under the N−2 policy after #27257 updated the toolchain to Rust 1.99.0. Update the prerequisite documentation and use the now-stable `isolate_lowest_one()` in the AST layout tool.

Iterate over the linter's underlying array with `&mut *self.by_type`, since boxed-array `IntoIterator` requires Rust 1.99 and fails on the new MSRV. This also satisfies Clippy's `explicit_iter_loop` lint.
2026-10-01 16:01:57 +00:00
leaysgur fc175b09d3 docs(formatter_core): clarify idempotency test infra (#26069) 2026-08-25 01:24:54 +00:00
leaysgur 343e1aa80c docs(formatter): add note for idempotency checks (#26040) 2026-08-24 06:51:46 +00:00
camc314 c0f71564c3 chore(deps): bump MSRV to 1.96.0 (#25946)
## Summary

- bump the workspace MSRV from 1.95.0 to 1.96.0 under the N-2 policy after #25945
- retain an MSRV-compatible layout calculation while suppressing the Rust 1.98 Clippy suggestion
2026-08-20 18:23:40 +00:00
leaysgur b297fb1cb8 refactor(formatter,formatter_tests): fix up (#25478)
Cleaning up after the series of migrations.

- Docs clean up
- More strict `jsdoc` option handling in fixture tests
2026-08-12 00:48:33 +00:00
leaysgur 0fa91283fd refactor(formatter,formatter_tests): move out prettier JS,TS,JSDoc conformance from tasks/ (#25477)
Migration from tasks/prettier_conformance to each crate test using oxc_formatter_tests, for JS/TS and JSDoc.
2026-08-12 00:48:32 +00:00
leaysgur 6ef3984410 refactor(ci): self-provision prettier suite in oxc_formatter_tests (#25467)
Remove the Prettier related stuff from the conformance, which is purely aimed at JS/TS.

Instead, `oxc_formatter_tests` manage Prettier's test fixtures along with Oxfmt.
2026-08-12 00:40:59 +00:00
leaysgur 9323be7d32 docs(agents): update outdated AGENTS.md (#25359) 2026-08-07 05:46:00 +00:00
leaysgur eaa7c692d2 docs(formatter_core): extract FORMATTER_POLICY (#25233) 2026-08-03 05:56:42 +00:00
camc314 7da0bb18a3 chore(deps): bump MSRV to 1.95.0 (#24359)
Bump MSRV to 1.95.0, following our +2 MSRV policy.
2026-07-10 14:30:07 +00:00
camchenry d38b208436 docs(agent): add lint-timings command (#24165)
Ensure agents are aware of the new command and nudging towards ensuring these get run proactively.
2026-07-04 19:35:45 +00:00
overlookmotel 494c04343c docs(tasks): correct commands for running tests (#22891)
`pnpm run build-test` is the correct command for building NAPI packages for running tests, not `pnpm build-dev`. Correct the docs accordingly. Also clarify the commands for running e2e tests.
2026-06-01 13:27:50 +00:00
Boshen e12c84e3d2 docs(agents): mention scoped PR title requirement (#21808)
## Summary
- document that `.github/workflows/pr.yml` requires scoped Conventional Commit PR titles
- add an example title to the contributor setup notes in `AGENTS.md`

## Testing
- not run; documentation-only change

## AI Usage
- Codex assisted with drafting the documentation change and PR description
2026-04-27 02:43:21 +00:00
9e5224f0e4 docs(CONTRIBUTING.md): add ban policy for repeated slop PRs (#21202)
## Summary
- Document that contributors who repeatedly submit low-quality ("slop")
AI PRs will be banned without prior warning
- Note that unbans can be requested via Discord
- Apply to both AGENTS.md and CONTRIBUTING.md

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-09 11:56:37 +08:00
Connor Shea 6ca61d3953 chore(all): Minor updates for AGENTS.md. (#18965)
Add a link for humans
2026-02-05 12:00:37 +08:00
connorshea 8166f80b41 chore(linter): Misc improvements to help prevent merge conflicts for generated files in oxlint (#18813)
- The header on rules_enum.rs was being stripped by accident, which was confusing for users. So I fixed that.
- Mark the generated files as generated in `.gitattributes`, for GitHub to understand the diffs are mostly pointless and can be collapsed by default (the CI job enforces that these files be up to date anyway).
- Mark the generated rule files as `merge=ours`. See https://git-scm.com/book/ms/v2/Customizing-Git-Git-Attributes for more info on what that means, but it should make the merge conflicts less problematic.
- Updated `just ready` to include the lintgen command.
- Added `cargo lintgen` to the AGENTS.md file.

AI Disclosure: Used Claude to find the reason for the lack of header comment because I had no idea why it was happening.
2026-02-01 20:18:39 +00:00
Boshen d61a024dbf docs(AGENTS.md): add test suite search paths for AI assistants (#18170)
## Summary
- Add a "Searching Test Suites" section documenting the pre-cloned test suite paths
- Helps AI assistants know where to search for test cases (test262, babel, typescript, prettier)

## Test plan
- Documentation only change

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-01-18 07:30:16 +00:00
leaysgur 36c285329d chore(oxfmt): Add AGENTS.md for apps/oxfmt (#17034)
While it was possible to load it with `@` in the root's `AGENTS.md`, but it's fine to do only when necessary.

Will merge after CI.
2025-12-18 01:44:20 +00:00
Boshen 6fca2f7f60 chore(infra): use oxfmt for all files, remove dprint (#16599)
Toml formatting is missing but there's only a few toml files, can wait
for oxfmt plugins.

- [x] Something is slow, can't figure out why, need #16607
2025-12-15 12:06:24 +00:00
Boshen 3f6387dd3b ci(workflows): add workflow_call support to update_submodules.yml (#16431)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
2025-12-03 19:47:57 +08:00
Boshen a8068a61c0 docs(CONTRIBUTING.md): add AI usage policy (#16433)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
2025-12-03 10:17:22 +00:00
Connor Shea 5104fc5f28 chore(docs): Update AGENTS.md with new/updated information. (#16148)
Just a few minor tweaks to ensure it's up to date.
2025-11-26 16:40:42 +08:00
Arsh 272a145571 chore(AGENTS.md): update with oxc_language_server (#14910)
Also updates currently used rust toolchain version.
2025-10-24 09:32:32 +08:00
Boshen b14bd8e0d3 ai: add ast-grep (#13539) 2025-09-04 14:18:38 +08:00
Dunqingandautofix-ci[bot] 93b7e8a2cf docs(AI): make AI know how to test better (#13326)
Add critical information on how we test in each crate. Additionally, add
CLAUDE.md to fix the issue that Claude code doesn't read AGENTS.md
automatically.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-27 21:50:46 +08:00
camchenry 5af9cc7f89 docs(AI): add minsize and allocs to commands to run (#13096) 2025-08-15 17:38:19 +00:00
Boshen 451bc071c2 refactor(minifier): change AST in-place instead of returning Option<Expression> (#12969) 2025-08-10 17:03:38 +00:00
Copilot 9b5af3ee59 docs(AGENTS.md): Make AGENTS.md concise for AI assistants with setup notes - reduce token usage by 70% (#12968) 2025-08-11 00:11:08 +08:00
Copilot 363c269dfb docs(AGENTS.md): Add comprehensive example applications documentation to AGENTS.md (#12967) 2025-08-10 23:35:05 +08:00
Boshen 33fc52caf7 chore(ai): provide instruction for running just ready 2025-08-02 21:21:58 +08:00
camc314 c6bfb8af05 test(linter): add rule configuration consistency test (#12744)
fixes #12720
2025-08-02 09:02:06 +00:00
Boshen 308a105fbc chore(ai): improve AI instructions 2025-08-02 11:59:16 +08:00
Copilot a47cbbca9d ci: add GitHub Copilot agent environment setup workflow (#12700) 2025-08-01 10:58:36 +08:00
Copilot 534ec6341d docs: Add AGENTS.md to guide AI assistants working with the Oxc codebase (#12695) 2025-08-01 10:21:19 +08:00