Implementation:23blocks OS Ai maestro Plugin Builder Service
| Knowledge Sources | |
|---|---|
| Domains | Plugin_Management, Services |
| Last Updated | 2026-10-26 18:00 GMT |
Overview
Concrete tool for the visual plugin builder — building, scanning repos, pushing to GitHub, and tracking build status with SSRF protection, provided by AI Maestro's `services/plugin-builder-service.ts`.
Description
The plugin-builder-service is a pure-logic service covering the visual plugin builder. `buildPlugin` runs `plugin/build-plugin.sh` via `execFile` (argv only) with a `PluginBuildConfig`, tracks build status in an in-memory map with TTL eviction (1 hour, max 50 results), and limits concurrent operations to 3. `scanRepo` scans a repository for skills and scripts, reading frontmatter via `safeMatter`. `pushToGitHub` pushes a built plugin to a Git host with SSRF protection (only `github.com`, `gitlab.com`, `bitbucket.org`, `codeberg.org` allowed, HTTPS only, internal network addresses blocked). All inputs are validated (plugin name, git ref, semver, path segments).
Usage
Call `buildPlugin` from a POST route to start a build, `getBuildStatus` to poll, `scanRepo` to discover skills in a repo, `pushToGitHub` to publish.
Code Reference
Source Location
- Repository: ai-maestro
- File: services/plugin-builder-service.ts
- Lines: L1-L740
Signature
export async function buildPlugin(config: PluginBuildConfig): Promise<ServiceResult<PluginBuildResult>>
export function getBuildStatus(buildId: string): ServiceResult<PluginBuildResult>
export async function scanRepo(repoUrl: string, ref?: string): Promise<ServiceResult<RepoScanResult>>
export async function pushToGitHub(config: PluginPushConfig): Promise<ServiceResult<PluginPushResult>>
Import
import { buildPlugin, getBuildStatus, scanRepo, pushToGitHub } from '@/services/plugin-builder-service'
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| config | PluginBuildConfig | Yes (build) | Plugin manifest sources, skill selection, output path |
| buildId | string | Yes (status) | Build ID to poll |
| repoUrl | string | Yes (scan) | HTTPS git URL (SSRF-validated) |
| config | PluginPushConfig | Yes (push) | Git remote, branch, token |
Outputs
| Name | Type | Description |
|---|---|---|
| PluginBuildResult | object | buildId, status, output path, log |
| RepoScanResult | object | Discovered skills and scripts |
| PluginPushResult | object | Push status, remote URL |
Usage Examples
Build and poll
import { buildPlugin, getBuildStatus } from '@/services/plugin-builder-service'
const { data } = await buildPlugin({
manifest: { name: 'my-plugin', version: '1.0.0', sources: [...] },
skills: [{ id: 'code-review', enabled: true }],
})
// Poll until done
const status = getBuildStatus(data.buildId)