Skip to content

mods-types: a gate that typechecks every plugin's function-hook mods (board #103) - #287

Merged
SSFSKIM merged 4 commits into
mainfrom
mods-types-103
Oct 20, 2026
Merged

SSFSKIM merged 4 commits into
mainfrom
mods-types-103

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Board #103: a gate that typechecks every plugin's function-hook mods.

What

  • mods-types gate (.github/ci-kit.yml) runs tests/mods/typecheck.sh --lay: tsc through each plugin's hooks/mods/tsconfig.json (doperpowers, sminos, to-human, devcloud; each covers the mods and their tests), failing on any error.
  • Types come from the engine under test, not the repo. The engine's hook declarations are not committed: the repository is public, and the engine writes a .gitignore into the folder it lays them in. With --lay, the gate loads all four plugins once, headless (claude -p with CLAUDE_CODE_PLUGIN_DIR_WATCH=1, which makes a --plugin-dir folder eligible for the engine's type-root writer outside an interactive session). The load sends one request with a key that cannot authenticate, so it fails and spends nothing. The installed engine then lays .claude-plugin/types/{claude-code,claude-code-tools,claude-code-mcp} in each plugin, and sminos's contract in to-human's. Each tsconfig now reads its own plugin's .claude-plugin/types/ in place of the repo-root .claude/types/claude-code.d.ts, which a /plugin-types command used to write; the engine no longer has that command. to-human gets a tsconfig.
  • The fixes that make main pass. No mod's behaviour changes, so there is no version bump.

The errors main had (engine 2.1.304)

Where Error What it was
hooks/mods/appeal.tsx $.tool.call({ tool: block.tool, ... }): no overload Typing gap: the blocked tool's name is known only at run time. Cast to ToolCallArgs, with a one-line reason.
hooks/mods/appeal-judge.tsx .deny on readonly SessionMessage[] | { deny } TS limitation: Array.isArray does not narrow a readonly array out of a union. Now 'deny' in, which behaves the same.
sminos/hooks/mods/ask.tsx (2) 're-entry' compared with 'throw' | 'timeout' Engine drift: HookFailure had a 're-entry' kind in the 2.1.292 and 2.1.300 declarations. 2.1.302 removed it, and the engine now leaves a plugin's hooks out of its own raise. The checks are dead on current engines and still right on older ones; kept behind a cast, with the reason.
sminos/hooks/mods/bridge.tsx place === 'off' where TS narrowed place to 'safe' | undefined False positive: the earlier check's narrowing outlives two awaits, during which the place can move. The place is now read anew into a local.
tests/mods/appeal.test.ts fallback on the hook entry Test typing
sminos/tests/mods/ask.test.ts (7) input: unknown vs ToolUseSummary Test typing
sminos/tests/mods/bridge.test.ts a non-async way in a Promise tuple Test typing
to-human/tests/mods/to-human.test.ts setTimeout not found The kit runs tests with a timer that the hooks' declarations leave out. Declared narrowly in the test.

None of them was a runtime bug.

Docs

CLAUDE.md (the repo map's mods tests line, tests/, and Testing & validation), the Developing sections of hooks/mods/README.md, sminos/hooks/mods/README.md and devcloud/README.md, and .gitignore: the plugin-root tsconfig.json files the engine creates on a load.

Review

One review (reviewer-medium, run on opus) returned "correct": the four mod edits are type-only. Its one finding (P3) was that --lay on a person's machine kept their settings, whose gateway token outranks the dummy key. Fixed in c73a880: the load now runs in a throwaway HOME with the auth variables unset.

Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)

…board #103)

Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
…clarations (board #103)

Each plugin's hooks/mods/tsconfig.json now reads the plugin's own
.claude-plugin/types/, the root the engine lays as it loads the plugin
from a watched folder; to-human gets one. The gate loads the four plugins
once headless so the installed engine lays them, then runs tsc per plugin.

Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
None of the errors was a runtime bug. Typing gaps, annotated where they are:
- appeal: the blocked call's tool is a name known only at run time, so
  $.tool.call takes it as ToolCallArgs; the judge's prompt tells the
  agent's unread conversation by 'deny' in it (Array.isArray does not
  narrow a readonly array out of a union).
- sminos ask: 're-entry' left HookFailure's kinds in 2.1.302, when the
  engine began leaving a plugin's hooks out of its own raise; the checks
  stay for the engines that still send it.
- sminos bridge: the place is read anew after the awaits, which TS's
  narrowing from before them cannot see.
Test typings: appeal's hook entries, the ask test's tool-use rows, the
bridge test's compaction ways, and the timer the kit has and the hooks'
declarations leave out (to-human).

The READMEs said /plugin-types writes .claude/types/claude-code.d.ts; the
engine has no such command now and lays .claude-plugin/types/ per plugin.

Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
On a person's machine the load kept their settings, whose gateway token
and base URL outrank the unauthenticating key, so it could run a real
turn with their hooks and plugins. It now runs with a scratch HOME and
SMINOS_HOME and the auth variables unset.

Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
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