Skip to content
Vector
Esc
↑↓navigate↵open⌘Jpreview
On this page

Package and load a Vector Configuration

Build an ESM Configuration Package, expose its OpenCode Plugin Entrypoint, publish it through your existing workflow, and connect it to a project.

A Configuration Package is an ordinary ESM package. Vector supplies the configuration API, while your package toolchain owns compilation, publication, installation, and version selection.

Keep the package boundary small

Use this structure for the project-summary example:

  • packages/team-opencode/
    • src/
      • extensions/
        • project-summary.ts
      • opencode.ts
    • dist/
      • extensions/
        • project-summary.js
      • opencode.js
    • package.json

The entrypoint composes and default-exports the Vector Configuration.

import { defineVector } from '@evilkiwi/vector';

import { projectSummary } from './extensions/project-summary.js';

export default defineVector({
  id: 'team-opencode',
  build: () => ({ commands: [projectSummary] }),
});

Expose the built ESM module through an ordinary package export.

{
  "name": "@acme/team-opencode",
  "type": "module",
  "dependencies": {
    "@evilkiwi/vector": "^0.0.0"
  },
  "exports": {
    "./opencode": "./dist/opencode.js"
  }
}

Build and publish the package through the private registry, npm channel, or workspace your team already uses.

Connect a project to the package

Add a project-local entrypoint that re-exports the package’s default value.

export { default } from '@acme/team-opencode/opencode';

Point OpenCode at that local module with an absolute file URL.

{
  "plugins": ["file:///absolute/path/to/project/.opencode/team-configuration.ts"]
}

Reload OpenCode and invoke /project-summary to check the installed package. If the module fails to load or the command is missing, use Troubleshoot.

Read Lifecycle to follow the loaded entrypoint through registration.