Use this skill when adding a new NodeBridge handler to src/nodeBridge.ts, including updating types in src/nodeBridge.types.ts and optionally testing with scripts/test-nodebridge.ts
This skill guides the process of adding a new message handler to the NodeBridge system, which enables communication between the UI layer and the Node.js backend.
src/nodeBridge.tsLocate the registerHandlers() method in the NodeHandlerRegistry class and add your handler:
this.messageBus.registerHandler('category.handlerName', async (data) => {
const { cwd, ...otherParams } = data;
const context = await this.getContext(cwd);
// Implementation logic here
return {
success: true,
data: {
// Return data
},
};
});
Handler Naming Convention:
category.action (e.g., git.status, session.send, utils.getPaths)config, git, mcp, models, outputStyles, project, projects, providers, session, sessions, slashCommand, status, utilsCommon Patterns:
await this.getContext(cwd){ success: true, data: {...} } for success{ success: false, error: 'message' } for errorssrc/nodeBridge.types.tsAdd input and output types near the relevant section:
// ============================================================================
// Category Handlers
// ============================================================================
type CategoryHandlerNameInput = {
cwd: string;
// other required params
optionalParam?: string;
};
type CategoryHandlerNameOutput = {
success: boolean;
error?: string;
data?: {
// return data shape
};
};
Then add to the HandlerMap type:
export type HandlerMap = {
// ... existing handlers
// Category handlers
'category.handlerName': {
input: CategoryHandlerNameInput;
output: CategoryHandlerNameOutput;
};
};
Update scripts/test-nodebridge.ts HANDLERS object if the handler should be easily testable:
const HANDLERS: Record<string, string> = {
// ... existing handlers
'category.handlerName': 'Description of what this handler does',
};
Run the test script:
bun scripts/test-nodebridge.ts category.handlerName --cwd=/path/to/dir --param=value
Or with JSON data:
bun scripts/test-nodebridge.ts category.handlerName --data='{"cwd":"/path","param":"value"}'
this.messageBus.registerHandler('utils.example', async (data) => {
const { cwd, name } = data;
try {
const context = await this.getContext(cwd);
// Do something with context and params
const result = await someOperation(name);
return {
success: true,
data: {
result,
},
};
} catch (error: any) {
return {
success: false,
error: error.message || 'Failed to execute example',
};
}
});
type UtilsExampleInput = {
cwd: string;
name: string;
};
type UtilsExampleOutput = {
success: boolean;
error?: string;
data?: {
result: string;
};
};
// In HandlerMap:
'utils.example': {
input: UtilsExampleInput;
output: UtilsExampleOutput;
};
data parameterthis.getContext(cwd) to get the Context instance (cached per cwd)config, paths, mcpManager, productName, version, etc.git.clone pattern)this.messageBus.emitEvent() (see git.commit.output pattern)npx skills add neovateai/add-nodebridge-handler下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer