coding-agents-hooks-authoring

Solid

To author, register, and test Rosetta hooks, add a SemanticKind, or debug a hook that won't fire.

AI & Automation 324 stars 60 forks Updated 2 days ago Apache-2.0

Install

View on GitHub

Quality Score: 91/100

Stars 20%
84
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

<hooks_authoring> ### Hook entry rule Only files that export `defineHook(…)` AND call `runAsCli(hook, module)` belong directly in `src/hooks/src/hooks/`. Every `.ts` at the top level of that directory becomes a standalone CJS bundle distributed to all 5 IDEs (claude, codex, copilot, cursor, windsurf). Helper/data files without `runAsCli` belong in a named subdirectory: `src/hooks/src/hooks/<feature>/`. ### Helper placement - Feature-local helpers → `src/hooks/src/hooks/<feature>/` (e.g. `src/hooks/src/hooks/dangerous-actions/patterns.ts`). - Cross-hook runtime helpers → `src/hooks/src/runtime/`. ### Build is non-recursive `src/hooks/scripts/build-bundles.mjs:24` uses `readdirSync(hooksDir).filter(f => f.endsWith('.ts'))`. There is **no `{ recursive: true }`**. Subdirectories are invisible to the bundler. Adding a top-level `.ts` without `runAsCli` produces a dead bundle for all 5 IDEs. ### Adding a SemanticKind When a hook needs a new tool category (e.g. `mcp-call`): 1. **`src/hooks/src/runtime/ide-registry.ts`** — add a row to `TOOL_KINDS` with all 5 IDE columns (`null` where the event doesn't exist). `SemanticKind = keyof typeof TOOL_KINDS` so TypeScript enforces coverage. 2. **`src/hooks/src/runtime/ide-rows/<ide>.ts`** — if the kind requires special logic (e.g. prefix-match for `mcp__.*`), add a conditional branch at the top of `lookupToolKind` in the IDE-row file before the table loop. Table-driven lookup alone cannot handle open-ended tool name patterns. 3. **H...

Details

Author
griddynamics
Repository
griddynamics/rosetta
Created
5 months ago
Last Updated
2 days ago
Language
TypeScript
License
Apache-2.0

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category