Skip to content

CI: typecheck and plugin tests; /deck reaches its hook - #1

Merged
codeclawd merged 2 commits into
mainfrom
ci/typecheck
Nov 17, 2026
Merged

codeclawd merged 2 commits into
mainfrom
ci/typecheck

Conversation

@codeclawd

Copy link
Copy Markdown
Owner

Problem

plugins/usage-deck/tsconfig.json extends ./.claude-plugin/types/tsconfig.json. That folder is gitignored, and Claude Code writes it only when it loads the mod with --plugin-dir in an interactive, signed-in session (Get type definitions for your version). A clean clone or CI has no such session, so tsc stops at the first line:

error TS5083: Cannot read file '.../plugins/usage-deck/.claude-plugin/types/tsconfig.json'.

The repo also had no CI.

Fix

  • scripts/mod-types.mjs fetches the copy Anthropic publishes (anthropics/claude-code, mods/types/claude-code.d.ts) at a pinned commit and checks its sha256. It writes the file where Claude Code would, .claude-plugin/types/claude-code/index.d.ts, with a tsconfig.json beside it that uses the compiler options from Anthropic's own mods/tsconfig.json. The original extends stays as it was. If Claude Code already wrote that folder, the script leaves it alone, so a local typecheck uses the types for the version you run.
  • I chose a pinned fetch over committing the 830 KB generated file. Claude Code overwrites that folder whenever it loads the mod, so a committed copy would show up as a diff for anyone who develops with --plugin-dir.
  • The root package.json (private) pins typescript 7.0.2 and @anthropic-ai/claude-code 2.1.322, and has a lockfile. npm run typecheck runs the script and then tsc -p plugins/usage-deck. npm test runs claude plugin test plugins/usage-deck, which per the docs needs no sign-in or network. I checked that with an empty HOME and CLAUDE_CONFIG_DIR. allowScripts lets the Claude Code package run its postinstall. That script only links the platform binary into place, and npm 12 blocks it by default.
  • .github/workflows/ci.yml runs on ubuntu-latest for pull requests and for pushes to main. It runs npm ci, the typecheck, and the tests. Both actions are pinned to commit SHAs.
  • README gets a short Develop section.

Type errors

Once tsc could run: 23 errors before, 0 after. Claude Code 2.1.326's claude plugin validate reports the same 23 as warnings, and 0 after the fix.

  • A real bug: on('command.run', { name: 'deck' }, ...) matched on a key the engine doesn't use, so /deck never reached the hook and never hid the deck. It now matches on command. A new test runs /deck twice, then another command. It fails on the old matcher ("from below" instead of "usage-deck: hidden") and passes now, on both 2.1.290 and 2.1.322.
  • noUncheckedIndexedAccess: the render hook now narrows the clip's frame rows before drawing them. If they were ever missing, the deck hands back the band instead of throwing. clipFor's idle pick falls back to 'look'.
  • Tests: the band() helper takes On from claude-code, which replaces a type that resolved to never. The band fixture gets the now-required isCollapsed prop, and indexed reads go through checked lookups. I added no any, @ts-ignore or new casts, and I removed two as never casts.

Tests

register.test.ts imports claude-code/testing, so it runs only under claude plugin test. Before: no way to run it in CI, and 10 pass / 1 fail on the current Claude Code (2.1.326). After: 12 pass / 0 fail on the pinned 2.1.322 (11 existing tests plus the new /deck test).

Needs an owner decision: the band check breaks on Claude Code 2.1.323 and later

"beside another plugin's tree the deck shrinks to one row" passes on 2.1.290 through 2.1.322 and fails on 2.1.323, 2.1.325 and 2.1.326. From 2.1.323, next(e) in the AbovePrompt hook returns { type: 'engine', ref: 1 } even when another plugin's tree sits below. isEmpty counts that as empty, so the deck never notices it is crowded. The current types describe a new band model: the engine asks AbovePrompt once per plugin (e.plugin), and a separate AbovePromptList hook stacks the rows. Making the deck step aside for other plugins probably means moving that check to an AbovePromptList hook. That changes what the plugin does, so I left it out of this PR and pinned the test runner to 2.1.322, the last version where the suite passes. Bump the pin in package.json once the band logic is fixed.

Not verified locally

  • I didn't run the workflow on GitHub Actions. I ran the same steps on Linux (Node 26, npm 12) from a clean git archive of this branch: npm ci && npm run typecheck && npm test exit 0. CI uses Node 24 and npm 11, where allowScripts is ignored and the postinstall runs by default.
  • The pinned types come from Anthropic's public copy, not from the 2.1.322 build. Anthropic doesn't publish them per release. The public copy before 2026-11-13 lacks atom, read and update, which this mod imports and which 2.1.290 already provides at runtime. So I pinned the newest commit, and it matches what 2.1.326's validator checks.

Created with Claude Opus 5.5 in Claude Code.

codeclawd and others added 2 commits November 17, 2026 01:43
tsconfig.json extends .claude-plugin/types/tsconfig.json, which Claude Code
writes only in an interactive --plugin-dir session, so tsc could not run in a
clean clone. scripts/mod-types.mjs fetches Anthropic's published mods types at
a pinned commit, checks the sha256, and lays them out where Claude Code would;
a folder Claude Code wrote is left alone. package.json pins typescript and the
Claude Code version that runs `claude plugin test`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The command.run matcher keyed on `name`, which the engine does not match on,
so /deck never toggled the deck. It keys on `command` now, with a test that
fails on the old matcher. The rest are strict-index and test-fixture fixes:
narrow possibly-missing clip frames, type the test's `on` as On, and give the
band fixture the isCollapsed prop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codeclawd
codeclawd merged commit 6b6bfa4 into main Nov 17, 2026
1 check passed
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