Skip to content
Back to search

van-code

MarketplaceWorks with Claude CodeGitHub

A Claude Code plugin that guards what Claude reads, checks every edit, and makes it prove the work before saying done.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 21 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/lagemanngui/van-code with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/lagemanngui/van-code'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/lagemanngui--van-code/badge.svg)](/listings/lagemanngui--van-code)

HTML

<a href="/listings/lagemanngui--van-code"><img src="/api/listings/lagemanngui--van-code/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

From a shell:

claude plugin install van-code --marketplace lagemanngui/van-code

Or at the prompt of a Claude Code session, `/plugin install van-code --marketplace lagemanngui/van-code`. Answer `y` to add the marketplace and press Enter for the user scope. In the desktop app, where `/plugin` does not run: **+** next to the prompt box, **Plugins**, **Add marketplace** with `lagemanngui/van-code`, then **Add plugin**.

Then run this once in a session:

/van-code-setup

It installs the recommended tools: [`rtk`](https://github.com/rtk-ai/rtk) for leaner command output, language servers, and a few official plugins. The full list is in [Factory equipment](docs/features.md#factory-equipment). You'll know it worked when the flying-kick intro plays on the next start.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 5 lines
  1. {
  2. "name": "van-code",
  3. "owner": { "name": "lagemanngui" },
  4. "plugins": [{ "name": "van-code", "source": "./" }]
  5. }
README.md · README · 89 lines
  1. <img width="1334" height="502" alt="Jean-Claude Van Code: a pixel-art fighter flying-kicks Clawd, Claude Code's mascot" src="https://github.com/user-attachments/assets/d54be0a3-0f5a-4886-a5ec-bb542eae703d" />
  2. # Jean-Claude Van Code
  3. **A Claude Code plugin that guards what Claude reads, checks every edit, and makes it prove the work before saying done.**
  4. Claude Code is quick to read a whole lockfile, retry the same failing command, and say "all green" without running a test. Van Code sits in its hooks and catches those moments as they happen: it refuses the wasteful read, hands back the type error right after the edit, and holds "done" until a test or build actually ran. It does this with hooks, not a longer prompt, and every behavior has its own off switch.
  5. **Status:** early and moving fast. 0.4.x, started in November 2026 and used daily by its author. Behavior and settings may still change between minor versions. macOS and Linux.
  6. ## Install
  7. From a shell:
  8. ```sh
  9. claude plugin install van-code --marketplace lagemanngui/van-code
  10. ```
  11. Or at the prompt of a Claude Code session, `/plugin install van-code --marketplace lagemanngui/van-code`. Answer `y` to add the marketplace and press Enter for the user scope. In the desktop app, where `/plugin` does not run: **+** next to the prompt box, **Plugins**, **Add marketplace** with `lagemanngui/van-code`, then **Add plugin**.
  12. Then run this once in a session:
  13. ```
  14. /van-code-setup
  15. ```
  16. It installs the recommended tools: [`rtk`](https://github.com/rtk-ai/rtk) for leaner command output, language servers, and a few official plugins. The full list is in [Factory equipment](docs/features.md#factory-equipment). You'll know it worked when the flying-kick intro plays on the next start.
  17. ## Why use it
  18. - **No wasted reads.** Whole reads of lockfiles, `node_modules`, build output and minified files are blocked, and Claude is pointed to Grep. A file that has not changed is not re-read. A 2 MB JSON goes to `jq`, a 12-page PDF to local OCR.
  19. - **Errors caught at the edit.** `tsc`, `ruff`, `go vet`, `bash -n`, `terraform validate` and `helm lint` run on each edited file, and their errors go straight back to Claude. A clean check costs zero tokens.
  20. - **"Done" has to be earned.** If code changed and nothing ran, Claude is asked to verify, and gets the exact tests that reach the change (`affected_tests` follows the imports). A UI change gets walked in a browser with Playwright.
  21. - **A second opinion, cheaply.** Big or risky diffs (auth, money, migrations, SQL, parsing) get an adversarial review by Haiku, which must name one concrete failing case or stay quiet.
  22. - **Safety rails for live infra.** `terraform apply`, `kubectl`/`helm` changes and cloud deletes are held until a plan, diff or dry run has run.
  23. - **Your session, visible.** A band above the prompt shows the model, the 5h/7d rate limits, context, and how many minutes the prompt cache has left. `/van-code-stats` shows what the mod saved and what it spent.
  24. Also included: receipts that check the final answer's test counts and commit hashes against the tool output, assumption and target ledgers for multi-repo work, compaction that keeps your constraints, a guard against AI attribution in commits, and the [i-have-adhd](https://github.com/ayghri/i-have-adhd) output style. The [feature reference](docs/features.md) covers each one.
  25. ## When not to use it
  26. - **You want the cheapest possible session.** The mod adds about 2k tokens of instructions to each request (prompt-cached) and some Haiku calls. It buys care, not a lower bill: see [Cost](#cost).
  27. - **You don't want Claude Code's behavior changed.** The guards refuse reads and hold commands by design. Each one can be turned off in `/config`, but if you'd turn most of them off, a lighter setup will suit you better.
  28. - **Windows without WSL.** The setup relies on Homebrew or Linux installers, and that combination is untested.
  29. ## Commands
  30. | Command | What it does |
  31. |---|---|
  32. | `/van-code-setup [items]` | Installs the missing recommended tools; with names, optional ones too (`/van-code-setup playwright`) |
  33. | `/van-code-stats` | Session scoreboard: what was saved and blocked, last request's cost and cache hit rate, average cost per request |
  34. | `/van-code-scan` | Finds official AI resources (plugins, skills, `llms.txt`) for your project's dependencies. See [Stack scan](docs/features.md#stack-scan) |
  35. | `/chong-li` | Adversarial review of the latest changes: one concrete way they break, or nothing |
  36. | `/van-code-guard` | Turns the heavy-file guard off or on for this session |
  37. | `/van-code:i-have-adhd` | Turns the ADHD-friendly output style back on after a "stop adhd mode" |
  38. | `/van-code` | Replays the intro and re-checks the equipment. Hi-yah! |
  39. Every automatic behavior has a switch in `/config`, all on by default: the [full settings list](docs/features.md#settings).
  40. ## Cost
  41. Most of the mod is local code in hooks and spends no tokens. What does spend them:
  42. - Its instructions in the system prompt, about 2k tokens per request. They stay fixed for the whole conversation, so after the first request they are read from the prompt cache.
  43. - Haiku calls: Chong Li (only on big or risky changes) and reply suggestions (only when Claude Code shows none). Both show in `/van-code-stats`.
  44. The [`bench/`](bench/README.md) folder runs the same tasks with and without the mod. On its five small cases the pass rate was the same with and without it, and the median cost went from 11% cheaper to 33% more expensive. Where it should pay off is a big repo: a whole read of a 0.9 MB lockfile is about 200k tokens, a hundred times the instructions. The bench does not measure that case yet.
  45. ## Development
  46. ```sh
  47. claude plugin test . # the test suite
  48. npm install && npm run typecheck
  49. ```
  50. To run a working copy, add its folder to `CLAUDE_CODE_PLUGIN_DIRS` in the `env` block of `~/.claude/settings.json`, and do not install the marketplace copy at the same time.
  51. | File | Contents |
  52. |---|---|
  53. | `hooks/register.tsx` | The hooks: guards, checks, reviews, suggestions and the band above the prompt |
  54. | `hooks/factory.ts` | Factory equipment: checks and installs |
  55. | `hooks/checks.ts` | Post-edit checkers and the affected-tests search |
  56. | `hooks/usage.ts` | The usage header and the cache countdown |
  57. | `hooks/intro.ts` | The pixel-art intro |
  58. | `bench/` | Cost and correctness benchmark against plain Claude Code |
  59. ## License
  60. MIT. `skills/i-have-adhd` is copied unchanged from [ayghri/i-have-adhd](https://github.com/ayghri/i-have-adhd) at `1ecea19`, MIT, © 2026 Ayoub Ghriss. Its `LICENSE` sits beside it.
hooks/factory.ts · Bundled script · 365 lines · 1 finding marked
  1. import type { EngineInterface } from 'claude-code'
  2. import { KITTY_APPS, kittyConf, LINUX_DEFAULT_SCRIPT, lsAlias, macDefaultScript, OPEN_ACTIONS, type Platform } from './kitty.js'
  3. // "Factory equipment": tools the mod recommends, how to check and install each.
  4. // `none`: nothing to recommend here (no known language in this folder).
  5. export type Status = 'checking' | 'ok' | 'missing' | 'none'
  6. export const RECS = [
  7. { id: 'rtk', desc: 'trims command output to save tokens', isOptional: false },
  8. { id: 'ponytail', desc: 'lazy senior dev mode: the smallest change that works', isOptional: false },
  9. { id: 'config', desc: 'caps huge Bash and MCP outputs', isOptional: false },
  10. { id: 'lsp', desc: 'IDE-style code navigation', isOptional: false },
  11. { id: 'commit-commands', desc: '/commit e /commit-push-pr', isOptional: false },
  12. { id: 'context7', desc: 'up-to-date library docs (external service)', isOptional: true },
  13. { id: 'security-guidance', desc: 'security review; spends tokens every turn', isOptional: true },
  14. { id: 'shellcheck', desc: 'finds real bugs in shell scripts after each edit', isOptional: true },
  15. { id: 'jq', desc: 'slices big JSON instead of reading it whole', isOptional: true },
  16. { id: 'ast-grep', desc: 'searches code by its structure, not by regex', isOptional: true },
  17. { id: 'infra', desc: 'checks Terraform, Helm and Kubernetes files right after each edit', isOptional: true },
  18. { id: 'playwright', desc: 'tests web UI like a user would: Microsoft playwright-cli and its official skill', isOptional: true },
  19. { id: 'diagnosing-bugs', desc: 'a diagnosis loop for hard bugs: a failing repro first, then ranked hypotheses (Matt Pocock skill)', isOptional: true },
  20. { id: 'kitty', desc: 'terminal with clickable file links, inline images and Shift+Enter (not made the default)', isOptional: true },
  21. { id: 'indra', desc: 'PDFs and scans as text, local OCR (free for personal use and companies under US$20M)', isOptional: true },
  22. ] as const
  23. export type RecId = (typeof RECS)[number]['id']
  24. // Recommended env caps; written only where the person has none of their own.
  25. const ENV_CAPS: Record<string, string> = { BASH_MAX_OUTPUT_LENGTH: '15000', MAX_MCP_OUTPUT_TOKENS: '10000' }
  26. // Language servers by the files that mark a project; each plugin needs its binary.
  27. const LANGS = [
  28. { name: 'TypeScript', markers: ['tsconfig.json', 'package.json'], plugin: 'typescript-lsp', bin: 'typescript-language-server', setup: ['npm', 'i', '-g', 'typescript-language-server', 'typescript'] },
  29. { name: 'Python', markers: ['pyproject.toml', 'requirements.txt', 'setup.py'], plugin: 'pyright-lsp', bin: 'pyright-langserver', setup: ['npm', 'i', '-g', 'pyright'] },
  30. { name: 'Rust', markers: ['Cargo.toml'], plugin: 'rust-analyzer-lsp', bin: 'rust-analyzer', setup: ['brew', 'install', 'rust-analyzer'] },
  31. { name: 'Go', markers: ['go.mod'], plugin: 'gopls-lsp', bin: 'gopls', setup: ['brew', 'install', 'gopls'] },
  32. ]
  33. const OFFICIAL = 'claude-plugins-official'
  34. // Command-line tools: the binary is the id, Homebrew installs it.
  35. const BREW_TOOLS: readonly string[] = ['shellcheck', 'jq', 'ast-grep']
  36. export let cwd = ''
  37. export const setCwd = (dir: string) => {
  38. cwd = dir
  39. }
  40. export let langs: typeof LANGS = []
  41. // Infra checkers by the files the project tracks; `bins` is any one of them, `brew` installs the first.
  42. // Terraform left Homebrew core over its license: OpenTofu (`tofu`) stands in.
  43. const INFRA = [
  44. { name: 'Terraform', globs: ['*.tf', '*.tofu'], bins: ['terraform', 'tofu'], brew: 'opentofu' },
  45. { name: 'Helm', globs: ['*Chart.yaml'], bins: ['helm'], brew: 'helm' },
  46. { name: 'Kubernetes', globs: ['*k8s/*.yaml', '*kubernetes/*.yaml', '*manifests/*.yaml', '*k8s/*.yml'], bins: ['kubeconform'], brew: 'kubeconform' },
  47. ] as const
  48. export let infra: (typeof INFRA)[number][] = []
  49. // shortcut: only git-tracked files are seen; a folder outside git finds no infra.
  50. async function detectInfra($: EngineInterface) {
  51. const tracks = async (root: string, globs: readonly string[]) => {
  52. const r = await run($, ['git', '-C', root, 'ls-files', '--', ...globs])
  53. return r.ok && r.out.trim() !== ''
  54. }
  55. const found = await Promise.all(INFRA.map(async i => (await Promise.all(roots.map(r => tracks(r, i.globs)))).some(Boolean)))
  56. infra = INFRA.filter((_, n) => found[n])
  57. }
  58. let plugins: { id: string; enabled: boolean }[] = []
  59. // Runs a host command; a command that cannot start counts as a failure.
  60. export async function run($: EngineInterface, argv: string[], timeoutMs = 60_000) {
  61. try {
  62. const r = await $.process.run(argv, { timeoutMs })
  63. return { ok: r.exitCode === 0, out: r.stdout + r.stderr }
  64. } catch (err) {
  65. return { ok: false, out: String(err) }
  66. }
  67. }
  68. async function loadPlugins($: EngineInterface) {
  69. const r = await run($, ['claude', 'plugin', 'list', '--json'])
  70. try {
  71. plugins = r.ok ? JSON.parse(r.out) : []
  72. } catch {
  73. plugins = []
  74. }
  75. }
  76. const isEnabled = (id: string) => plugins.some(p => p.id === id && p.enabled)
  77. // Where projects live: the folder Claude runs in and, for a folder that holds several
  78. // repos side by side (not a monorepo), each repo one level down.
  79. const ROOTS_MAX = 100 // shortcut: a folder with more repos than this is scanned in part
  80. export let roots: string[] = []
  81. export async function findRoots($: EngineInterface): Promise<string[]> {
  82. const entries = await $.fs.list(cwd).catch(() => [])
  83. const subs = entries.filter(e => e.kind === 'dir' && !e.name.startsWith('.') && e.name !== 'node_modules').slice(0, ROOTS_MAX)
  84. const isRepo = await Promise.all(subs.map(e => $.fs.exists(`${cwd}/${e.name}/.git`).catch(() => false)))
  85. return [cwd, ...subs.filter((_, i) => isRepo[i]).map(e => `${cwd}/${e.name}`)]
  86. }
  87. // What the folder holds: its repos, their languages and their infra files.
  88. export async function detectProjects($: EngineInterface) {
  89. roots = await findRoots($)
  90. await Promise.all([detectLangs($), detectInfra($), detectWeb($)])
  91. }
  92. // A web frontend: a UI framework in a package.json, or an index.html at a root.
  93. const WEB_DEPS = /"(react|react-dom|vue|svelte|@sveltejs\/kit|next|nuxt|@angular\/core|solid-js|astro|@remix-run\/react|vite|preact|lit)"\s*:/
  94. export let hasWeb = false
  95. async function detectWeb($: EngineInterface) {
  96. const each = await Promise.all(
  97. roots.map(async r => WEB_DEPS.test(await $.fs.read(`${r}/package.json`).catch(() => '')) || (await $.fs.exists(`${r}/index.html`).catch(() => false))),
  98. )
  99. hasWeb = each.some(Boolean)
  100. }
  101. // playwright-cli writes its skill to <cwd>/.claude/skills/playwright-cli (read in its skillCheck.js):
  102. // installed from HOME it is the user's skill, in every project.
  103. const PW_SKILL = '.claude/skills/playwright-cli/SKILL.md'
  104. async function hasPlaywrightSkill($: EngineInterface) {
  105. const home = await $.env.get('HOME')
  106. const dirs = [home, ...roots].filter(Boolean)
  107. return (await Promise.all(dirs.map(d => $.fs.exists(`${d}/${PW_SKILL}`).catch(() => false)))).some(Boolean)
  108. }
  109. // diagnosing-bugs from mattpocock/skills (MIT), installed as the user's own skill for every project.
  110. const DIAG_SKILL = '.claude/skills/diagnosing-bugs/SKILL.md'
  111. const DIAG_INSTALL = ['npx', '-y', 'skills', 'add', 'https://github.com/mattpocock/skills', '--skill', 'diagnosing-bugs', '-g', '-y']
  112. async function hasDiagSkill($: EngineInterface) {
  113. try {
  114. const home = await $.env.get('HOME')
  115. return !!home && (await $.fs.exists(`${home}/${DIAG_SKILL}`))
  116. } catch {
  117. return false
  118. }
  119. }
  120. async function detectLangs($: EngineInterface) {
  121. const found = await Promise.all(
  122. LANGS.map(async l => {
  123. for (const root of roots)
  124. for (const m of l.markers) {
  125. try {
  126. await $.fs.stat(`${root}/${m}`)
  127. return true
  128. } catch {}
  129. }
  130. return false
  131. }),
  132. )
  133. langs = LANGS.filter((_, i) => found[i])
  134. }
  135. async function hasBin($: EngineInterface, bin: string) {
  136. return (await run($, ['which', bin])).ok
  137. }
  138. async function platformOf($: EngineInterface): Promise<Platform> {
  139. return (await $.session.info().catch(() => undefined))?.platform ?? 'unknown'
  140. }
  141. async function hasKitty($: EngineInterface) {
  142. if (await hasBin($, 'kitty')) return true
  143. const home = await $.env.get('HOME')
  144. return (await Promise.all(KITTY_APPS.map(a => $.fs.exists(a.replace('~', home ?? '~')).catch(() => false)))).some(Boolean)
  145. }
  146. async function makeKittyDefault($: EngineInterface, mac: boolean): Promise<string> {
  147. if (mac) {
  148. const r = await run($, ['osascript', '-l', 'JavaScript', '-e', macDefaultScript('net.kovidgoyal.kitty')])
  149. if (!r.ok) return `kitty: could not make it the default (${r.out.trim().split('\n').at(-1)})`
  150. const was = r.out.trim()
  151. return `kitty: now the default terminal, for shell scripts and ssh:// links (before: ${was})`
  152. }
  153. const r = await run($, ['sh', '-c', LINUX_DEFAULT_SCRIPT])
  154. if (!r.ok) return `kitty: could not make it the default (${r.out.trim().split('\n').at(-1)})`
  155. return 'kitty: set as the default terminal for xdg-terminal-exec and GNOME; on Debian or Ubuntu also run `sudo update-alternatives --config x-terminal-emulator`'
  156. }
  157. // kitty: the app, then its config only where the person has none. The shell's rc file is theirs: the ls line is shown, not written.
  158. async function installKitty($: EngineInterface): Promise<string> {
  159. const platform = await platformOf($)
  160. if (platform === 'windows' || platform === 'unknown') return 'kitty: no build for this system (macOS and Linux, WSL included)'
  161. const mac = platform === 'macos'
  162. const brew = mac && (await hasBin($, 'brew'))
  163. const out: string[] = []
  164. if (!(await hasKitty($))) {
  165. const argv = brew
  166. ? ['brew', 'install', '--cask', 'kitty']
  167. : ['sh', '-c', 'curl -fsSL https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin launch=n'] // kitty's official installer
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 188 on GitHub
  168. if (!(await run($, argv, 600_000)).ok) return `kitty: ${brew ? '`brew install --cask kitty`' : "kitty's official installer (sw.kovidgoyal.net/kitty)"} failed`
  169. // the installer leaves kitty in ~/.local/kitty.app on Linux; its docs link the commands into ~/.local/bin
  170. if (!mac) await run($, ['sh', '-c', 'mkdir -p ~/.local/bin && ln -sf ~/.local/kitty.app/bin/kitty ~/.local/kitty.app/bin/kitten ~/.local/bin/'])
  171. out.push('kitty: installed')
  172. // asked once, on a fresh install; WSL's terminal belongs to Windows
  173. if (platform !== 'wsl') {
  174. const answer = await $.ui
  175. .ask('Make kitty your default terminal?', { header: 'kitty', options: ['No, keep the current one', 'Yes, make kitty the default'] })
  176. .catch(() => '') // dismissed, or no one to ask
  177. out.push(answer.startsWith('Yes') ? await makeKittyDefault($, mac) : 'kitty: not made the default terminal')
  178. }
  179. } else out.push('kitty: already installed')
  180. if (brew) {
  181. // the config's font, and GNU ls for clickable names; failures here leave kitty working
  182. await run($, ['brew', 'install', '--cask', 'font-jetbrains-mono'], 600_000)
  183. await run($, ['brew', 'install', 'coreutils'], 600_000)
  184. }
  185. const dir = `${await $.env.get('HOME')}/.config/kitty`
  186. await run($, ['mkdir', '-p', dir])
  187. for (const [file, text] of [['kitty.conf', kittyConf(platform)], ['open-actions.conf', OPEN_ACTIONS]] as const) {
  188. if (await $.fs.exists(`${dir}/${file}`).catch(() => true)) out.push(`kitty: ${dir}/${file} exists, left as is`)
  189. else {
  190. await $.fs.write(`${dir}/${file}`, text)
  191. out.push(`kitty: wrote ${dir}/${file}`)
  192. }
  193. }
  194. out.push(`kitty: for clickable names in ls, add to your shell's rc file: ${lsAlias(platform)}`)
  195. if (mac) out.push("kitty: if it will not open from Finder or the Dock, `xattr -dr com.apple.quarantine /Applications/kitty.app` lets it (it turns macOS's Gatekeeper check off for kitty)")
  196. out.push('kitty: quit it fully and open it again, so the config takes effect')
  197. return out.join('\n')
  198. }
  199. async function check($: EngineInterface, id: RecId): Promise<Status> {
  200. const ok = (b: boolean): Status => (b ? 'ok' : 'missing')
  201. if (id === 'rtk') {
  202. const r = await run($, ['rtk', 'init', '--show'])
  203. return ok(r.ok && r.out.includes('[ok] settings.json'))
  204. }
  205. if (id === 'config') {
  206. const env = ((await $.settings.read({ key: 'env' })) ?? {}) as Record<string, string>
  207. return ok(Object.keys(ENV_CAPS).every(k => env[k] !== undefined))
  208. }
  209. if (id === 'lsp') {
  210. if (langs.length === 0) return 'none'
  211. const each = await Promise.all(langs.map(async l => isEnabled(`${l.plugin}@${OFFICIAL}`) && (await hasBin($, l.bin))))
  212. return ok(each.every(Boolean))
  213. }
  214. if (id === 'ponytail') return ok(isEnabled('ponytail@ponytail'))
  215. if (id === 'indra') return ok(await hasBin($, 'indra-ocr'))
  216. if (id === 'kitty') {
  217. const platform = await platformOf($)
  218. if (platform === 'windows' || platform === 'unknown') return 'none' // kitty has no Windows build
  219. return ok(await hasKitty($))
  220. }
  221. if (id === 'diagnosing-bugs') return ok(await hasDiagSkill($))
  222. if (id === 'playwright') {
  223. if (!hasWeb) return 'none'
  224. return ok((await hasBin($, 'playwright-cli')) && (await hasPlaywrightSkill($)))
  225. }
  226. if (id === 'infra') {
  227. if (infra.length === 0) return 'none'
  228. const each = await Promise.all(infra.map(async i => (await Promise.all(i.bins.map(b => hasBin($, b)))).some(Boolean)))
  229. return ok(each.every(Boolean))
  230. }
  231. if (BREW_TOOLS.includes(id)) return ok(await hasBin($, id))
  232. return ok(isEnabled(`${id}@${OFFICIAL}`))
  233. }
  234. // Installs or enables one plugin; adds its marketplace first when it is unknown.
  235. async function installPlugin($: EngineInterface, id: string, marketplace: string): Promise<boolean> {
  236. if (plugins.some(p => p.id === id)) return (await run($, ['claude', 'plugin', 'enable', id])).ok
  237. if ((await run($, ['claude', 'plugin', 'install', id], 180_000)).ok) return true
  238. await run($, ['claude', 'plugin', 'marketplace', 'add', marketplace], 180_000)
  239. return (await run($, ['claude', 'plugin', 'install', id], 180_000)).ok
  240. }
  241. export async function install($: EngineInterface, id: RecId): Promise<string> {
  242. if (id === 'rtk') {
  243. if (!(await hasBin($, 'rtk'))) {
  244. const brew = await run($, ['brew', 'install', 'rtk'], 600_000)
  245. if (!brew.ok) return 'rtk: `brew install rtk` failed (is Homebrew installed?)'
  246. }
  247. const init = await run($, ['rtk', 'init', '-g', '--auto-patch'])
  248. return init.ok ? 'rtk: installed and hooked' : 'rtk: `rtk init -g --auto-patch` failed'
  249. }
  250. if (id === 'config') {
  251. const path = `${await $.env.get('HOME')}/.claude/settings.json`
  252. let settings: { env?: Record<string, string> }
  253. try {
  254. settings = JSON.parse(await $.fs.read(path))
  255. } catch {
  256. return 'config: could not read ~/.claude/settings.json, nothing changed'
  257. }
  258. const env = (settings.env ??= {})
  259. for (const [k, v] of Object.entries(ENV_CAPS)) env[k] ??= v
  260. await $.fs.write(path, JSON.stringify(settings, null, 2) + '\n')
  261. return 'config: BASH_MAX_OUTPUT_LENGTH and MAX_MCP_OUTPUT_TOKENS written to settings.json'
  262. }
  263. if (id === 'lsp') {
  264. const out: string[] = []
  265. for (const l of langs) {
  266. if (!(await hasBin($, l.bin)) && !(await run($, l.setup, 600_000)).ok) {
  267. out.push(`lsp ${l.name}: \`${l.setup.join(' ')}\` failed`)
  268. continue
  269. }
  270. const isOk = await installPlugin($, `${l.plugin}@${OFFICIAL}`, `anthropics/${OFFICIAL}`)
  271. out.push(isOk ? `lsp ${l.name}: installed` : `lsp ${l.name}: installing ${l.plugin} failed`)
  272. }
  273. return out.join('\n')
  274. }
  275. if (id === 'diagnosing-bugs') {
  276. const r = await run($, DIAG_INSTALL, 300_000)
  277. return r.ok ? 'diagnosing-bugs: skill installed in ~/.claude/skills' : `diagnosing-bugs: \`${DIAG_INSTALL.join(' ')}\` failed`
  278. }
  279. if (id === 'playwright') {
  280. if (!(await hasBin($, 'playwright-cli')) && !(await run($, ['npm', 'install', '-g', '@playwright/cli@latest'], 600_000)).ok)
  281. return 'playwright: `npm install -g @playwright/cli@latest` failed (needs Node 20+)'
  282. const home = await $.env.get('HOME')
  283. try {
  284. const r = await $.process.run(['playwright-cli', 'install', '--skills'], { cwd: home, timeoutMs: 180_000 })
  285. if (r.exitCode !== 0) return 'playwright: installed, but `playwright-cli install --skills` failed'
  286. } catch {
  287. return 'playwright: installed, but `playwright-cli install --skills` failed'
  288. }
  289. return 'playwright: playwright-cli and its skill installed (it drives your installed Chrome; without one, run `playwright-cli install-browser`)'
  290. }
  291. if (id === 'infra') {
  292. const out: string[] = []
  293. for (const i of infra) {
  294. if ((await Promise.all(i.bins.map(b => hasBin($, b)))).some(Boolean)) continue
  295. const isOk = (await run($, ['brew', 'install', i.brew], 600_000)).ok
  296. out.push(isOk ? `infra ${i.name}: ${i.brew} installed` : `infra ${i.name}: \`brew install ${i.brew}\` failed (is Homebrew installed?)`)
  297. }
  298. return out.join('\n') || 'infra: nothing to install'
  299. }
  300. if (BREW_TOOLS.includes(id)) {
  301. return (await run($, ['brew', 'install', id], 600_000)).ok ? `${id}: installed` : `${id}: \`brew install ${id}\` failed (is Homebrew installed?)`
  302. }
  303. if (id === 'kitty') return installKitty($)
  304. if (id === 'indra') {
  305. // uv brings its own Python 3.10+, which indra-ocr needs; macOS ships 3.9
  306. const argv = (await hasBin($, 'uv'))
  307. ? ['uv', 'tool', 'install', '--python', '3.12', 'indra-ocr']
  308. : (await hasBin($, 'pipx'))
  309. ? ['pipx', 'install', 'indra-ocr']
  310. : undefined
  311. if (!argv) return 'indra: needs uv (`brew install uv`) or pipx'
  312. if (!(await run($, argv, 600_000)).ok) return `indra: \`${argv.join(' ')}\` failed`
  313. return (await hasBin($, 'indra-ocr'))
  314. ? 'indra: installed (the first run downloads ~76 MB of models)'
  315. : 'indra: installed, but indra-ocr is not on PATH: run `uv tool update-shell` (or `pipx ensurepath`) and restart the shell'
  316. }
  317. if (id === 'ponytail') {
  318. const isOk = await installPlugin($, 'ponytail@ponytail', 'DietrichGebert/ponytail')
  319. return isOk ? 'ponytail: installed' : 'ponytail: `claude plugin install ponytail@ponytail` failed'
  320. }
  321. const isOk = await installPlugin($, `${id}@${OFFICIAL}`, `anthropics/${OFFICIAL}`)
  322. return isOk ? `${id}: installed` : `${id}: \`claude plugin install ${id}@${OFFICIAL}\` failed`
  323. }
  324. export const status: Record<string, Status> = {}
  325. // Something the person should act on: a recommended item missing.
  326. export const isLacking = () => RECS.some(r => !r.isOptional && status[r.id] === 'missing')
  327. export async function checkAll($: EngineInterface) {
  328. for (const r of RECS) status[r.id] = 'checking'
  329. $.ui.invalidate('ui.render')
  330. await Promise.all([loadPlugins($), detectProjects($)])
  331. await Promise.all(
  332. RECS.map(async r => {
  333. status[r.id] = await check($, r.id)
  334. $.ui.invalidate('ui.render')
  335. }),
  336. )
  337. }

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.