Skip to content

feat(linter): Auto detect agents from CLI and transition to the agent output format#22068

Merged
camchenry merged 3 commits into
oxc-project:mainfrom
JoviDeCroock:feat/auto-detect-agent
May 17, 2026
Merged

feat(linter): Auto detect agents from CLI and transition to the agent output format#22068
camchenry merged 3 commits into
oxc-project:mainfrom
JoviDeCroock:feat/auto-detect-agent

Conversation

@JoviDeCroock

@JoviDeCroock JoviDeCroock commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

We start auto-detecting agents running the linter through environment variables, when we see an agent is running the linter we transition to using the agent output format to save tokens.

The logic is mirrored from https://github.com/unjs/std-env/blob/main/src/agents.ts which is used by vitest and others.

Follow up to #21955

@JoviDeCroock JoviDeCroock requested a review from camc314 as a code owner May 2, 2026 05:09
@JoviDeCroock JoviDeCroock force-pushed the feat/auto-detect-agent branch from 5d674ef to 62af337 Compare May 2, 2026 05:11
@camc314 camc314 added the A-linter Area - Linter label May 2, 2026
@JoviDeCroock JoviDeCroock force-pushed the feat/auto-detect-agent branch from 627683c to 98b7474 Compare May 4, 2026 15:41
@JoviDeCroock JoviDeCroock force-pushed the feat/auto-detect-agent branch from 98b7474 to 28bf0a3 Compare May 4, 2026 17:18
@JoviDeCroock JoviDeCroock force-pushed the feat/auto-detect-agent branch from 28bf0a3 to fd83449 Compare May 7, 2026 17:13
@JoviDeCroock JoviDeCroock changed the title feat(llinter): Auto detect agents from CLI and transition to the agent output format feat(linter): Auto detect agents from CLI and transition to the agent output format May 8, 2026
@JoviDeCroock JoviDeCroock force-pushed the feat/auto-detect-agent branch 2 times, most recently from 4bd9d0f to e3f9690 Compare May 12, 2026 16:11
@camchenry camchenry self-assigned this May 12, 2026
@JoviDeCroock JoviDeCroock force-pushed the feat/auto-detect-agent branch from e3f9690 to 93a3750 Compare May 15, 2026 07:46
JoviDeCroock and others added 2 commits May 16, 2026 08:38
I also removed two of the unverified agents from the original unjs source, Auggie, and Goose. We'll still with the verified ones for now.

Also added a Copilot detection.

@camchenry camchenry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

I did some testing and this doesn't seem to add any significant performance overhead to oxlint, so I feel good about merging this and iterating on it.

cc @camc314 just FYI I'm merging this now so it'll be in the next release, unless we want to hold off.

@camchenry camchenry merged commit d3a3c1d into oxc-project:main May 17, 2026
25 checks passed
camc314 pushed a commit that referenced this pull request May 18, 2026
# Oxlint
### 🚀 Features

- 1ae291e linter/no-underscore-dangle: Add `allowInUsingDeclarations`
option (#22483) (吴杨帆)
- 0440b0f linter/eslint: Implement `id-match` rule (#22379) (Vladislav
Sayapin)
- 65bf119 linter: Implement react no-object-type-as-default-prop
(#22481) (uhyo)
- 2a6ddce linter/eslint: Implement `no-implied-eval` rule (#22391)
(Vladislav Sayapin)
- d3a3c1d linter: Auto detect agents from CLI and transition to the
agent output format (#22068) (Jovi De Croock)
- 625758a linter/vitest: Implement padding-around-after-all-blocks rule
(#21788) (kapobajza)
- 37680b0 linter: Implement react no-unstable-nested-components (#22248)
(Jovi De Croock)
- d8d9c74 linter: Implement import/newline-after-import rule (#19142)
(Ryuya Yanagi)

### 🐛 Bug Fixes

- 3f59e03 linter: Only call rayon/miette/tracing inits once (#21899)
(Matiss Janis Aboltins)
- 602dfd6 linter/promise/no-return-wrap: Detect Promise calls in all
branches (#22474) (zennnnnnn11)
- e182aee linter: Allow dialogs and popovers for no_autofocus (#22289)
(mehm8128)
- 7ffb710 linter/jest/vitest: Jest/no-standalone-expect ignores
additionalTestBlockFunctions option for jest/vitest hooks (#22477)
(kapobajza)
- c6f2d3f linter: Add more expression support for iframe-has-title
(#22460) (mehm8128)
- 5747ff1 linter: Avoid enabling jest with vitest plugin (#22499)
(camc314)
- 863984f linter/no-find-dom-node: Run on all files (#22479) (bab)

### ⚡ Performance

- 2afef79 linter: Optimize `no-loop-func` (#22491) (camchenry)
- 4c9ca72 oxlint: Align walker thread count with rayon pool (#22494)
(Boshen)

### 📚 Documentation

- f7967c7 linter/id-match: Clarify `onlyDeclarations` config docs
(#22523) (camc314)
- 1e0c97f linter: Fix closing code block in documentation for
`padding-around-after-all-blocks` rule. (#22513) (connorshea)
- a9049fd linter: Exclude directly provide autoFocus to dialog pattern
(#22510) (mehm8128)
# Oxfmt
### 🐛 Bug Fixes

- 8ee946f formatter/sort_imports: Use label to classify lines (#22512)
(leaysgur)
- 8c1da44 formatter: Normalize destructuring keys in DCR (#22478)
(camc314)
@rmacklin

Copy link
Copy Markdown

After upgrading from oxlint 1.64.0 to oxlint 1.66.0, my agent got tripped up - it was expecting to see the "Finished in Xms on Y files with Z rules using W threads." message that it was used to, so it thought things were broken and kept going in circles. I found this from the changelog and shared it with the agent which put an end to the spiral.

However, what was a bit surprising was that later the agent was trying to execute pnpm oxlint --rules and even that command was producing no output for the agent, which tripped it up again:

Snippet from agent session

Let me verify and migrate it from the JS plugin to native.

$ pnpm exec oxlint --rules 2>&1 | grep "newline-after-import"

(no output)

Hmm, no output. Let me check the format the rules listing uses:

$ pnpm exec oxlint --rules 2>&1 | grep -i "newline" | head -5

(no output)
$ pnpm exec oxlint --rules > /dev/null 2>&1; echo "exit: $?"

exit: 0
$ pnpm exec oxlint --rules 2>&1 | head -5

(no output)

Output is empty in non-TTY again (the same "agent" auto-detection we hit before). Let me bypass:

$ pnpm exec oxlint --rules --format default 2>&1 | grep -i "newline-after-import" 2>&1

| newline-after-import                 | import     |         |          | 🛠️        |

import/newline-after-import is now natively in oxlint.

@JoviDeCroock @camchenry Is it expected behavior that even oxlint --rules would now be empty for agents?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants