@lo1/sdk
v0.2.3
Published
Plugin SDK for lo1 — types, config schemas, and utilities for plugin authors
Readme
@lo1/sdk
Plugin SDK for lo1 — types, configuration schemas, and utilities for plugin authors.
Installation
bun add @lo1/sdkUsage
Plugin authoring
import type { PluginFactory } from "@lo1/sdk";
const createPlugin: PluginFactory = (context) => {
return {
name: "my-plugin",
async contributeCompose(input) {
// Return Docker Compose service definitions for shared infrastructure
},
async provisionInfra(input) {
// Create infrastructure resources (tables, buckets, schemas)
},
async seedData(input) {
// Apply seed data to provisioned infrastructure
},
};
};
export default createPlugin;Configuration validation
import { workspaceSchema } from "@lo1/sdk";
const result = workspaceSchema.safeParse(rawConfig);
if (!result.success) {
console.error(result.error.issues);
}JSON Schema
A generated JSON Schema is available for IDE autocompletion:
{
"$schema": "https://lo1.dev/schemas/lo1.v1.schema.json"
}Or reference the published schema file:
import "@lo1/sdk/schemas/lo1.v1.schema.json";Exports
- Plugin types —
Plugin,PluginFactory,PluginContext,Logger - Lifecycle types —
ComposeInput,ComposeContribution,ProvisionInput,ProvisionResult,SeedInput,SeedResult,ContainerInput,ContainerConfig,WatchInput,RestartSignal - Config schemas (Zod) —
workspaceSchema,serviceConfigSchema,proxyConfigSchema,tlsConfigSchema,serviceHooksSchema,workspaceHooksSchema - Config types —
WorkspaceConfig,ServiceConfig,ProxyConfig,TlsConfig,ServiceHooks,WorkspaceHooks
