Repository navigation
mods-types: a gate that typechecks every plugin's function-hook mods (board #103) - #287
Merged
Merged
Conversation
…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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Board #103: a gate that typechecks every plugin's function-hook mods.
What
mods-typesgate (.github/ci-kit.yml) runstests/mods/typecheck.sh --lay:tscthrough each plugin'shooks/mods/tsconfig.json(doperpowers, sminos, to-human, devcloud; each covers the mods and their tests), failing on any error..gitignoreinto the folder it lays them in. With--lay, the gate loads all four plugins once, headless (claude -pwithCLAUDE_CODE_PLUGIN_DIR_WATCH=1, which makes a--plugin-dirfolder 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-typescommand used to write; the engine no longer has that command. to-human gets a tsconfig.The errors main had (engine 2.1.304)
hooks/mods/appeal.tsx$.tool.call({ tool: block.tool, ... }): no overloadToolCallArgs, with a one-line reason.hooks/mods/appeal-judge.tsx.denyonreadonly SessionMessage[] | { deny }Array.isArraydoes 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'HookFailurehad 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.tsxplace === 'off'where TS narrowedplaceto'safe' | undefinedtests/mods/appeal.test.tsfallbackon the hook entrysminos/tests/mods/ask.test.ts(7)input: unknownvsToolUseSummarysminos/tests/mods/bridge.test.tsPromisetupleto-human/tests/mods/to-human.test.tssetTimeoutnot foundNone of them was a runtime bug.
Docs
CLAUDE.md (the repo map's mods tests line,
tests/, and Testing & validation), the Developing sections ofhooks/mods/README.md,sminos/hooks/mods/README.mdanddevcloud/README.md, and.gitignore: the plugin-roottsconfig.jsonfiles 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
--layon 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)