@octalmesh/seagull-core
v0.1.1
Published
The Seagull engine.
Readme
Published independently for anyone who wants just this piece - e.g. scripting
against loadConfig() without pulling in the CLI's commander dependency or
the docs bundle. Most people should install @octalmesh/seagull
instead, which bundles this package (and -cli/-docs) into one.
| Path | What it is |
|--------------------|-----------------------------------------------------------------------------------------------------------------------------------|
| config/ | The seagull.yaml zod schema, loader, {...} template engine, paths.specFormat helpers, and publishing-conventions resolution |
| generator/ | The Generator abstract primitive and the GeneratorRegistry every concrete generator plugs into |
| generators/ | The built-in openapi-generator-cli and openapi-typescript generator implementations |
| readme/ | README rendering for generated SDK artifacts (custom template or built-in default, per language/kind) |
| redocly/ | Keeps redocly.yaml in sync with seagull.yaml |
| version/ | hashSpec/resolveVersion - content hashing and info.version extraction from a bundled spec |
| git/, process/ | Small git/process utilities (run, resolveBinPath, assertSafeRefName, ...) used by the pipeline commands |
flowchart LR
A["seagull.yaml<br/>generators.*.tool"] --> B{{"GeneratorRegistry.resolve(tool)"}}
B -->|"openapi-generator"| C["OpenApiGeneratorCli"]
B -->|"openapi-typescript"| D["OpenApiTypescriptGenerator"]
C --> E(["generate(ctx) -> dist/sdk/<contract>/<artifact>"])
D --> E
classDef node fill:#363636,stroke:#666,color:#fff,rx:6,ry:6
classDef result fill:#1f6feb,stroke:#1f6feb,color:#fff,rx:20,ry:20
class A,B,C,D node
class E resultGeneratorRegistry looks up one Generator instance per tool (SdkTool,
currently "openapi-generator" | "openapi-typescript" - a closed union, not an
open plugin-name string) - one instance per underlying tool, not per language,
since a single openapi-generator-cli -g java/-g go invocation already covers
every language that tool supports.
import { Generator, GeneratorRegistry } from "@octalmesh/seagull-core";
import type { GenerateContext } from "@octalmesh/seagull-core";
class MyOpenApiGeneratorCli extends Generator {
readonly tool = "openapi-generator"; // must be an existing SdkTool value
async generate(ctx: GenerateContext): Promise<void> {
// your own openapi-generator-cli invocation, patching, etc.
}
}
const registry = new GeneratorRegistry().register(new MyOpenApiGeneratorCli());tool is typed SdkTool, so this is swapping the implementation behind an
existing tool name (useful if you want different generator behavior than the
built-in OpenApiGeneratorCli/OpenApiTypescriptGenerator, in your own script
built on loadConfig() + a custom GeneratorRegistry) - it's not a way to add
a brand-new third tool name to generators.*.tool in seagull.yaml itself,
since the CLI's own registry and the config schema both only know about the two
built-in values today.
