Development

AutoCode is a TypeScript OpenCode plugin/library. The plugin entry point is src/plugin.ts, which injects generated skills, loads configuration, derives external-directory permission rules, merges tier-specific agent model settings, registers managed agents, registers managed commands, and exposes runtime tools.

Rendering diagram...

The managed agent catalogue lives in src/agents/index.ts, and prompt templates live under src/agents/prompts/. Commands are registered in src/commands/index.ts, so the published package does not need separate command Markdown files. Generated skills are bundled from source during builds, and scripts/copy-skill-sources.ts copies them into dist/skills.

Runtime tools live in src/tools/. They cover concept and plan management, job lifecycle updates, criteria tracking, read-only database discovery and table reads, REST requests and cached response lookup, sandbox lifecycle operations, cross-project task execution, and session resume support. Shared tool error handling should stay aligned with src/utils/tools.ts and the agent error rules.

Generated skills

Builds copy bundled skills into dist/skills, and the plugin can install the generated output for OpenCode under ~/.agents/skills/autocode/ or the equivalent XDG configuration location. Skills are knowledge files that OpenCode loads into AI context so agents and workflows can follow project-specific instructions; users do not need to invoke these files directly.

Sandbox execution

Linux sandbox execution requires usable Bubblewrap (bwrap).

Sandbox tools include autocode_sandbox_create, autocode_sandbox_cli, autocode_sandbox_delete, autocode_sandbox_read, autocode_sandbox_glob, autocode_sandbox_grep, autocode_sandbox_edit, and autocode_sandbox_copy. Sandboxes expose /sandbox for writable work, /home for the sandbox home, and /workspace as a read-only project mount.

Unsupported hosts include macOS, Windows, Android or Termux, non-Linux systems, and Linux systems without usable bwrap or user namespace support. When sandboxing is unsupported, AutoCode disables the sandbox execution agent and force-denies sandbox create, CLI, delete, read, glob, grep, edit, and copy tools.

Local setup

Local setup is for repository development only. It is not the public npm installation flow.

  1. Install dependencies from the repository root.
    bun install
    

    Bun installs the dependencies declared in package.json.
  2. Build the plugin.
    bun run build
    

    The build removes dist, bundles src/plugin.ts, emits TypeScript declarations, and copies generated skill sources into dist/. It does not install the local shim.
  3. Install the local shim when you want OpenCode to load the repository build.
    bun run install:shim
    

    This writes the local development shim to ~/.config/opencode/plugins/autocode.js.
  4. Load the plugin in OpenCode.
    For local development in this repository, .opencode/plugin/autocode.ts re-exports the built plugin from dist/plugin.js.

Development commands

CommandPurpose
bun run buildRemoves dist, builds src/plugin.ts, emits declarations, and copies generated skills into dist/. Does not install the shim.
bun run install:shimInstalls the local development shim at ~/.config/opencode/plugins/autocode.js.
bun run watchCopies generated skills once, then watches the Bun bundle and declarations as source files change.
bun testRuns the Bun test suite under src.
bun run typecheckRuns TypeScript type checking without emitting files.
bun run verify:sandbox-onlineRuns the sandbox verification script.

There is no lint script in the current package.json.

Testing

The repository includes Bun tests for tools and generated skills under src/**/*.test.ts.

bun test

Review the Bun test summary in your terminal to confirm whether the suite passed.

Run TypeScript type checking separately.

bun run typecheck

TypeScript reports diagnostics if type checking fails, and exits successfully when no diagnostics are emitted.

Local Plugin Deployment

Build the distributable plugin only for the local source workflow in this repository, when you are building AutoCode yourself and deploying or testing it locally through the local shim. This is not the npm publish or npm install workflow.

bun run build
bun run install:shim

The build output is written to dist/, including dist/plugin.js, declarations, and copied generated skills under dist/skills, matching the main, types, and exports fields in package.json. Run bun run install:shim separately when you need the local OpenCode shim.

See Distribution Guide for more information about distributing AutoCode on public registries.