@aidex/cli
v1.0.1
Published
Aidex CLI — a command-dispatch class (CLI) built on @aidex/sdk, proving the SDK can be consumed end to end via named commands. A library, not a terminal executable. No AI logic; delegates everything to the SDK.
Readme
@aidex/cli
Installation
pnpm add @aidex/clinpm install @aidex/cliThe command-dispatch interface to Aidex — the first real application built
on @aidex/sdk, proving the SDK can be consumed end to end. CLI is a
class you instantiate and call, not a terminal binary — there is no bin
entry or shell command. It contains no AI logic. Every command is a
one-line delegation to the SDK; the CLI itself never builds a prompt, never
touches a provider, and never makes a decision about what to ask a model.
Contents
CLI— holds exactly oneAIinstance, registers commands, and executes them by name. At construction it auto-registers the two built-in commands,"text"and"version", sonew CLI(ai, version)is immediately usable:const cli = new CLI(ai, '1.0.0'); await cli.execute('text', 'hello'); // → delegates to ai.text('hello') await cli.execute('version'); // → '1.0.0'cli.register(command)also accepts additional custom commands — any object matching{ name: string; execute(ai, input): Promise<string> }— for extensibility beyond the two built-ins.commands/TextCommand—execute(ai, input)returnsawait ai.text(input). Nothing more.commands/VersionCommand— returns a version string injected at construction (new VersionCommand('1.0.0')). No filesystem orpackage.jsonlookup of any kind.
Both commands, and the Command interface they implement, are internal to
this package — the public API is CLI alone.
Rules this package follows
- No AI logic.
CLInever callsai.text()/ai.execute()itself — only a registeredCommanddoes, once dispatched to by name. - No provider, kernel, strategy, or plugin imports. The only import
anywhere in
src/(excluding tests) isimport type { AI } from '@aidex/sdk'. - Composition only.
CLIholds anAIinstance and aMapof commands; commands are plain classes implementing an interface, never extending a base class. No inheritance anywhere in this package. - No singleton, no global mutable state — every
CLIinstance owns its own command registry.
Dependency direction
@aidex/cli depends on @aidex/sdk only. @aidex/providers is a
devDependency used solely by this package's tests (StubProvider, to build
a real AI via AIBuilder).
