@kampus/pipeline-cli
v0.1.0
Published
pipeline-cli — the single subcommand-router home all pipeline tooling folds into; `pipeline-cli <tool> …` dispatches to a registered tool (epic #994)
Downloads
116
Readme
@kampus/pipeline-cli
The single subcommand-router home all pipeline tooling folds into (epic
#994). pipeline-cli <tool> …
dispatches to a registered tool; the tools themselves move in over Phase 2
(#997–#1002).
This is the Phase-1 scaffold (#996): the package shell, the registry
extension seam, the pure router core, and one tracer tool (version) wired end to
end. No existing tool's logic is moved in yet.
Shape
Per the repo's mechanical-tooling idiom (decisions-index / epic-ledger /
leak-guard): a pure, unit-tested core + a thin Effect CLI bin.
src/registry.ts— the extension seam.registeredToolsis the array ofeffect/unstable/cliCommands the router exposes. A Phase-2 child folds its tool in by appending oneCommandhere — and nothing else. The router and bin consume this array opaquely.src/router.ts— the pure router core.dispatch(registry, argv)resolves the first argv token to a registered tool (Ok({ tool, rest })), or fails with a clearUnknownToolError(unknown token) /NoToolError(no token). It owns no Effect runtime, so the dispatch contract is unit-testable directly (ADR 0040 T0/T1) — the mirror of the runtime dispatchCommand.withSubcommandsdoes.src/version.ts— theversiontracer tool, a normal registered tool.src/bin.ts— theeffect/unstable/clibin:Command.withSubcommands(registeredTools), run viaNodeRuntime.runMain.
The extension seam
A later child registers its moved tool without touching the router core:
// src/registry.ts
import {myToolCommand} from "./my-tool.ts";
export const registeredTools: ReadonlyArray<RegisteredTool> = [versionCommand, myToolCommand];That single append is the entire registration step. router.ts and bin.ts
never change — the router is closed for modification, the registry is open for
extension.
Usage
# list the registered tools
node packages/pipeline-cli/src/bin.ts --help
# the Phase-1 tracer tool
node packages/pipeline-cli/src/bin.ts version
# dispatch to a registered tool (Phase-2 children)
node packages/pipeline-cli/src/bin.ts <tool> …pnpm --filter @kampus/pipeline-cli typecheck
pnpm --filter @kampus/pipeline-cli test
pnpm --filter @kampus/pipeline-cli build # src → dist ESM