add language hook

AI Community

Skill notes

Step 1: Check if the language directory exists

Look in chunker/hooks/ for an existing <language>/ directory. Exists — you're adding a new hook to an existing language. Read <language>/index.ts to see the current hook chain. Doesn't exist — you're adding hooks for a new language. Create <language>/ directory.

Step 2: Understand the hook interface

Read chunker/hooks/types.ts. Every hook implements: HookContext provides: Read-only: containerNode, validChildren, code, codeLines, config Mutable: excludedRows, methodPrefixes, methodStartLines, bodyChunks

Step 3: Create the hook file

Create hooks/<language>/<hook-name>.ts. Follow existing patterns: comment-capture.ts — extracts doc comments, marks rows as excluded class-body-chunker.ts — splits large class bodies into method-level chunks Name the exported hook: <language><Purpose>Hook (e.g., rubyCommentCaptureHook, typescriptBodyChunkingHook).

Step 4: Create or update the barrel

hooks/<language>/index.ts exports the ordered hook array:

Step 5: Register in language config

Edit chunker/config.ts. Find the language entry in LANGUAGE_DEFINITIONS and add the hooks property: If the language doesn't exist in LANGUAGE_DEFINITIONS, add the full entry with loadModule, extractLanguage, chunkableTypes, and hooks.

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
AI
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
88 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@tomevault-io · no license declared
Token usage
Lean
Setup complexity
Plug-and-play
External API key
Not required
Operating systems
macOS · Linux · Windows
Runtime requirements
No explicit requirements detected
Detected file/system behavior
  • Read-only
  • Write / modify
Network behavior
Local-only
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

01
Step 1: Check if the language directory exists

Look in `chunker/hooks/` for an existing `<language>/` directory. Exists — you're adding a new hook to an existing language. Read `<language>/index.ts` to see the current hook chain. Doesn't exist — you're adding hooks for a new language. Create `<language>/` directory.

02
Step 2: Understand the hook interface

Read `chunker/hooks/types.ts`. Every hook implements: `HookContext` provides: Read-only: `containerNode`, `validChildren`, `code`, `codeLines`, `config` Mutable: `excludedRows`, `methodPrefixes`, `methodStartLines`, `bodyChunks`

03
Step 3: Create the hook file

Create `hooks/<language>/<hook-name>.ts`. Follow existing patterns: `comment-capture.ts` — extracts doc comments, marks rows as excluded `class-body-chunker.ts` — splits large class bodies into method-level chunks Name the exported hook: `<language><Purpose>Hook` (e.g., `rubyCommentCaptureHook`, `typescriptBodyChunkingHook`).

04
Step 4: Create or update the barrel

`hooks/<language>/index.ts` exports the ordered hook array:

05
Step 5: Register in language config

Edit `chunker/config.ts`. Find the language entry in `LANGUAGE_DEFINITIONS` and add the `hooks` property: If the language doesn't exist in `LANGUAGE_DEFINITIONS`, add the full entry with `loadModule`, `extractLanguage`, `chunkableTypes`, and `hooks`.

06
Step 6: Write tests

Tests go in `tests/core/domains/ingest/pipeline/chunker/hooks/<language>/`. Follow existing test patterns in `typescript/` or `ruby/` directories. Each hook should have its own test file testing the `process()` function with a real `HookContext` (use `createHookContext()` from `types.ts`).

07
Step 7: Verify

Source: artk0de/TeaRAGs-MCP — distributed by TomeVault.

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.