Skip to content

feat(plugins): add auto_install option and auto-install gopls, rust-analyzer, ocaml-lsp, biome, oxlint - #154

Merged
amondnet merged 4 commits into
mainfrom
amondnet/plugin-config-auto-install
Nov 22, 2026
Merged

amondnet merged 4 commits into
mainfrom
amondnet/plugin-config-auto-install

Conversation

@amondnet

@amondnet amondnet commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

LSP plugins that already ran a SessionStart npm install into ${CLAUDE_PLUGIN_DATA} had no way to opt out, and several others (gopls, rust-analyzer, ocaml-lsp, biome, oxlint) required a manually installed binary. This PR adds an auto_install option to the plugins that install at session start and extends auto-install to those five.

What changed

  • 25 LSP plugins (including code-intelligence-lsp) declare userConfig.auto_install (boolean, default true). The hook is wrapped in case "${CLAUDE_PLUGIN_OPTION_AUTO_INSTALL:-true}" in false|0|no|off) ;; *) <existing> ;; esac, so turning it off in /config skips session-start installs and updates.
  • New auto-install, gated by the same option:
    • gopls-lsp: go install golang.org/x/tools/gopls@latest into the data dir when gopls is missing and Go is on PATH. New scripts/lsp.sh prefers PATH gopls, then the data-dir copy.
    • rust-analyzer-lsp: rustup component add rust-analyzer when it cannot run and rustup exists.
    • ocaml-lsp: opam install -y ocaml-lsp-server when ocamllsp is missing and opam exists.
    • biome-lsp / oxlint-lsp: new package.json (@biomejs/biome 2.6.2, same pin as packages/lsp BIOME_VERSION; oxlint 1.94.0). lsp.sh falls back to the data-dir binary after project-local and PATH.
  • README install note and ARCHITECTURE.md plugins/ section updated, including the stale plugin count (33 LSP plugin dirs, 27 with package.json).

Scope

  • deno, gleam and sourcekit-lsp ship with their toolchains, so they get no auto-install and no option.
  • Runtime downloads done by code lsp-server (clangd, kotlin, dart, ...) are not gated by this option. That needs a packages/lsp change and a release.

Tradeoffs and risks

  • For npm-based plugins, turning the option off stops installs and updates, but the server still runs from the data dir. It does not fall back to PATH.
  • A first-time opam build can take minutes and block session start (timeout 600s; gopls and rustup use 300s).
  • The exact string Claude Code exports for a boolean option is unconfirmed; the gate accepts false/0/no/off.

Verification

  • claude plugin validate passes for all 34 plugin directories.
  • Option off: biome hook left the data dir empty. Option unset or true: biome 2.6.2 and oxlint 1.94.0 installed into a temp data dir.
  • gopls with Go 1.27.3 only on PATH: hook installed gopls v0.24.0 in about 28s.
  • No Go on PATH, rust-analyzer already runnable, or no opam: hooks exit 0 without installing.
  • Wrapper fallbacks proven with stub binaries (biome lsp-proxy, oxlint --lsp, gopls serve).
  • Not run: real rustup component add and opam install (avoided mutating local toolchains; opam not installed).

Related issue

No linked issue.

Checklist

  • PR title follows Conventional Commits
  • Tests added or updated, and the suite passes (bun run test) — no test covers plugin manifests; none added
  • Lint/format pass (bun run lint) — not run
  • Documentation updated if behavior changed
  • No breaking change, or a BREAKING CHANGE: note is included

Summary by cubic

Adds an auto_install option so LSP plugin users can turn off session-start installs, and extends auto-install to gopls, rust-analyzer, ocaml-lsp, biome, and oxlint.

Changes

  • All 25 npm-based plugins gate their SessionStart install/update hook on auto_install (default true), read as CLAUDE_PLUGIN_OPTION_AUTO_INSTALL; false/no/off/0 opt out case-insensitively, and hooks skip when CLAUDE_PLUGIN_DATA is unset.
  • gopls, rust-analyzer, and ocaml-lsp install themselves when missing via their toolchains (go install, rustup component add, opam install). The gopls and ocaml-lsp wrappers prefer a PATH binary, then fall back to the data-dir copy or opam exec -- ocamllsp.
  • biome and oxlint gained pinned package.json deps (@biomejs/biome 2.6.2, oxlint 1.94.0). Their hooks reinstall when the binary is missing, and the wrappers fall back to the data-dir binary after project-local and PATH.
  • deno, gleam, and sourcekit-lsp ship with their toolchains and get no option; code lsp-server runtime downloads (clangd, kotlin, dart) are not gated.

Notes

  • With the option off, the server still runs from the data dir; it does not fall back to PATH.
  • A first-time opam build can take minutes and blocks session start (opam timeout 600s; gopls and rustup 300s).

Written for commit 42cfa68. Summary will update on new commits.

Turn on auto-fix

Each plugin declares userConfig.auto_install (boolean, default true)
and gates its npm SessionStart install hook on it.
@amondnet
amondnet marked this pull request as ready for review November 22, 2026 03:12
@codecov

codecov Bot commented Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gitar has auto-approved this PR (configure)

@gitar-bot gitar-bot Bot added the gitar-approved Added by Gitar label Nov 22, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a configurable 'Auto-install language server' option (auto_install) across various LSP server plugins, allowing users to disable session-start installations and updates. The feedback highlights critical correctness and robustness issues: the auto-installed ocamllsp will fail to run without a wrapper script or opam exec because it is not added to the system PATH, and the environment variable check for CLAUDE_PLUGIN_OPTION_AUTO_INSTALL should be case-insensitive. Additionally, several shell scripts and hooks contain unsafe path checks that could resolve to root-level directories if CLAUDE_PLUGIN_DATA is empty or unset, which should be guarded with non-empty checks.

Comment thread plugins/gopls-lsp/scripts/lsp.sh Resolved
Comment thread plugins/biome-lsp/scripts/lsp.sh Resolved
Comment thread plugins/oxlint-lsp/scripts/lsp.sh Resolved
@greptile-apps

greptile-apps Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous OCaml launch issue is fixed, and no new actionable issues were found.

Summary

Adds an auto_install option and automatic installs for five more language servers.

  • Npm-based LSP plugins let users turn off session-start installs and updates.
  • Go, rustup, and opam can install gopls, rust-analyzer, and ocamllsp when they are missing.
  • Biome and oxlint plugins can install pinned servers and use them as a fallback.

Reviews (2) · Last reviewed commit: "chore(plugins): apply AI code review sug..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 37 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="ARCHITECTURE.md">

<violation number="1" location="ARCHITECTURE.md:202">
P2: This blanket data-directory claim is inaccurate for rust-analyzer and ocamllsp: their hooks install into the active Rust toolchain and opam switch, not `$CLAUDE_PLUGIN_DATA`. Limit the data-directory statement to npm-based plugins and describe the other servers as toolchain installs.</violation>
</file>
Architecture diagram
sequenceDiagram
    participant User as Claude Code User
    participant CC as Claude Code
    participant Plugin as LSP Plugin
    participant Hook as SessionStart Hook
    participant Data as Plugin Data Dir
    participant PM as Package Manager (npm/go/rustup/opam)

    Note over User,PM: LSP Plugin Session-Start Auto-Install Flow

    User->>CC: Start session
    CC->>Plugin: Load plugin manifest
    Plugin->>Plugin: Check auto_install option

    alt auto_install = true (default)
        Note over Plugin: accept true or any value except false|0|no|off
        Plugin->>Hook: Run SessionStart hook
        Hook->>Data: Check existing install state
        alt npm-based server
            Hook->>PM: npm install into CLAUDE_PLUGIN_DATA
            PM-->>Hook: Dependencies installed
        else go install (gopls)
            Hook->>PM: GOBIN=... go install golang.org/x/tools/gopls@latest
            PM-->>Hook: gopls binary installed
        else rustup component add (rust-analyzer)
            Hook->>PM: rustup component add rust-analyzer
            PM-->>Hook: Component installed
        else opam install (ocaml-lsp)
            Hook->>PM: opam install -y ocaml-lsp-server
            PM-->>Hook: ocamllsp installed
        end
        Hook-->>Data: Update package/data
    else auto_install = false|0|no|off
        Note over Plugin: Skip install entirely
        Plugin-->>CC: Server runs from data dir only
    end

    CC->>Plugin: Start LSP server (per file type)
    alt gopls via wrapper script
        Plugin->>PM: Check PATH for gopls
        alt gopls on PATH
            PM-->>Plugin: Use PATH gopls
        else gopls in data dir
            Plugin->>Data: Use $CLAUDE_PLUGIN_DATA/bin/gopls
        end
    else biome/oxlint via wrapper
        Plugin->>PM: Check project-local node_modules
        alt project-local found
            PM-->>Plugin: Use project binary
        else check PATH
            Plugin->>PM: Check PATH binary
            alt PATH found
                PM-->>Plugin: Use PATH binary
            else fallback to data dir
                Plugin->>Data: Use $CLAUDE_PLUGIN_DATA/node_modules/.bin/binary
            end
        end
    else direct server command
        Plugin-->>CC: Launch server directly (rust-analyzer, ocamllsp)
    end

    Plugin-->>CC: LSP server ready
Loading

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread ARCHITECTURE.md Resolved
Comment thread ARCHITECTURE.md Resolved
- Launch ocaml-lsp through scripts/lsp.sh with an `opam exec --` fallback,
  and skip the install when the switch already provides ocamllsp
- Match the auto_install opt-out case-insensitively
- Reinstall biome/oxlint when the manifest matches but the binary is gone
- Guard every install hook and wrapper against an empty CLAUDE_PLUGIN_DATA
- Correct where toolchain-based servers install in ARCHITECTURE.md
@amondnet

Copy link
Copy Markdown
Contributor Author

/gemini review

@sonarqubecloud

Copy link
Copy Markdown

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gitar has auto-approved this PR (configure)

@gitar-bot

gitar-bot Bot commented Nov 22, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

New session-start hooks install language servers through Go, rustup, opam, and npm, changing local toolchains and plugin data and potentially delaying startup.

Adds an auto_install option to LSP plugins so session-start installs can be turned off, and extends auto-install to gopls, rust-analyzer, ocaml-lsp, biome, and oxlint. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Approved

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Important

Your trial ends in 5 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more.

Was this helpful? React with 👍 / 👎 | Gitar

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a configurable auto-installation mechanism for LSP server plugins. It adds an auto_install user configuration option (defaulting to true) across all plugin configurations (plugin.json), allowing users to disable automatic session-start installations. The installation hooks in the plugins are updated to respect this setting. Additionally, specific toolchain-based auto-installations are implemented: gopls via go install, rust-analyzer via rustup component add, and ocaml-lsp via opam install. Dedicated fallback installations and wrapper scripts (lsp.sh) are also introduced for biome-lsp and oxlint-lsp. Documentation in README.md and ARCHITECTURE.md has been updated to reflect these changes. There are no review comments to assess, and we have no further feedback to provide.

@amondnet
amondnet merged commit 908b05f into main Nov 22, 2026
11 checks passed
@amondnet
amondnet deleted the amondnet/plugin-config-auto-install branch November 22, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gitar-approved Added by Gitar

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant