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

Add per-installation Runtime Configuration

Validate global and project JSON with a Configuration Author-owned Standard Schema and use its typed output in Context.

Runtime Configuration changes one installation without creating another Vector Configuration. The Vector Configuration owns the Standard Schema that interprets those JSON values.

This guide extends the project-summary example with a configurable audience.

Install a Standard Schema library

Add Zod for the schema used in this example. Vector does not install it for the Configuration Package.

pnpm add zod

Declare Runtime Configuration

Pass runtimeConfig to createVectorBuilder() and use that builder for the Vector Configuration and its extensions.

import { createVectorBuilder } from '@evilkiwi/vector';
import * as z from 'zod';

const RuntimeConfig = z.object({
  audience: z.string().default('the team'),
});

const vector = createVectorBuilder({
  runtimeConfig: {
    slug: 'project-tools',
    schema: RuntimeConfig,
  },
});

const projectSummary = vector.defineCommand({
  name: 'project-summary',
  build: (context) => ({
    template: `Summarize ${context.project.canonical} for ${context.runtimeConfig.audience}`,
  }),
});

export default vector.defineVector({
  id: 'project-tools',
  build: () => ({ commands: [projectSummary] }),
});

The schema output determines context.runtimeConfig for every helper returned by this builder. Extension helpers do not need a Runtime Configuration generic.

Add a project value

Create the project-level JSON file for the project-tools slug.

{
  "audience": "new contributors"
}

Reload OpenCode and invoke /project-summary. The assembled prompt ends with for new contributors.

If activation names a read, JSON, or schema failure, correct the named file or schema and reload OpenCode. See Runtime Configuration for paths, merge behavior, slug constraints, and failure boundaries.

Next, add derived installation data with Computed context.