Plugin System

Code CLI supports plugins that extend its capabilities with custom tools, authentication flows, permission checks, and more.

Plugin Types

TypeDescriptionExample
npm packagePublished npm module@poly/codecli-plugin-jest
Local fileJavaScript/TypeScript module on disk./plugins/my-plugin.ts

Plugin Hooks

HookDescription
authCustom authentication flow for a provider
toolRegister a new tool the agent can use
internalToolInternal tools not exposed to the agent
permissionCustom permission checks

Configuration

codecli.json
json
"plugin": [
"@poly/codecli-plugin-jest",
"@poly/codecli-plugin-docker",
"./plugins/custom-tool.ts"
]

Creating a Plugin

Plugins export a factory function that receives the Code CLI API and returns an object with hook implementations:

my-plugin.ts
typescript
export default function myPlugin(api) {
return {
name: "my-plugin",
tools: [{
name: "my_tool",
description: "Does something custom",
parameters: { /* JSON Schema */ },
execute: async (params) => {
// Tool implementation
return { content: "result" };
}
}]
};
}
PreviousMainframe ModeNextSecrets Management