@liche/product
v0.8.2
Published
Product schema authoring, generated CLI surfaces, and conformance for Liche.
Readme
@liche/product
Product schema authoring, generated surfaces, and conformance for Liche CLIs.
This package is published as Bun-only TypeScript source. Use Bun >= 1.3.0; the current package format does not ship dist or declaration artifacts.
Use @liche/product when one product catalog should drive CLI source, OpenAPI, command manifests, MCP tools, agent docs, user docs, config schema, catalog/discovery artifacts, compile entrypoints, auth/session commands, local diagnostics, telemetry status, and conformance checks.
Generated CLIs still run on @liche/core, so generated commands inherit the shared parser, structured result envelope, and transport behavior used by handwritten commands.
import { Auth, Command, Field, Http, Schema, ValueSource, defineProduct } from "@liche/product";
export default defineProduct({
id: "workers",
name: "Workers",
version: "1.0.0",
auth: Auth.none(),
remote: { baseUrl: ValueSource.env("WORKERS_API_BASE_URL") },
commands: {
deploy: Command.http({
path: ["deploy"],
summary: "Deploy a Worker",
input: Schema.object({ name: Field.string("Worker name") }),
output: Schema.object({ id: Field.string("Deployment ID") }),
http: Http.post("/deployments", { bind: Http.bind({ body: true }) }),
}),
},
});Generate
liche-product generate ./product.ts --out ./generated
liche-product generate ./product.ts --out ./generated --check --jsonGenerated artifacts include:
liche.generated.tsliche.generated.openapi.jsonliche.generated.commands.jsonliche.generated.mcp.jsonliche.generated.agent.mdliche.generated.docs.mdliche.generated.config.schema.jsonliche.generated.catalog.jsonliche.generated.discovery.jsonliche.compile-entry.tsliche.generated.manifest.json
Opt-in ops.release metadata is embedded into generated docs, discovery JSON, doctor --json, and a local release --json command. It is static by design: install commands, channel, latest known version, packages, and yanked versions are available to users and agents without a hosted update service.
Conformance
Run conformance against an owned fixture server or local server:
liche-product conform ./product.ts --base-url http://localhost:8787 --report .liche/conformance.json --jsonConformance reports redact auth material and keep destructive capabilities opt-in.
Generated CLIs use @liche/core for runtime behavior, config, auth/session state, config-owned diagnostics, opt-in telemetry sinks, validation envelopes, and HTTP transport. Catalog-generated surfaces remain canonical for Product command manifests, MCP tools, agent docs, and reference docs.
