@vibesdotdev/cli 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +12 -31
  2. package/package.json +23 -24
  3. package/SPEC.md +0 -97
package/README.md CHANGED
@@ -1,41 +1,22 @@
1
1
  # @vibesdotdev/cli
2
2
 
3
- The CLI surface for **vibes**. This is a library, not a binary — host apps (`apps/cli-bin`) compose it to produce the `vibes` executable.
3
+ Descriptor-driven CLI framework for composing Vibes command groups and commands.
4
4
 
5
- ## What it is
5
+ This package is part of the public Vibes framework package set. The source repository is private while the public repository split is being prepared, so package documentation is published on the Vibes docs site.
6
6
 
7
- `packages/cli` turns runtime descriptors into a Commander.js command tree. Feature packages register `cli/group` and `cli/command` descriptors against the runtime; this package walks those descriptors, applies scope filters, and renders them as commands, help text, and shell completions.
7
+ ## Install
8
8
 
9
- It does **not** own:
10
-
11
- - The compiled binary or startup glue → `apps/cli-bin`.
12
- - The published npm wrapper → `packages/cli-bin`.
13
- - Any specific command's behavior — domain logic lives in the feature package that registered it.
14
-
15
- ## How it's consumed
16
-
17
- ```ts
18
- import { CLISurface } from '@vibesdotdev/cli';
19
- import { cliPlugin } from '@vibesdotdev/cli/plugin';
20
-
21
- // Register the CLI plugin with the runtime, then build the surface
22
- // against the runtime's resolved descriptor tree.
23
- const surface = new CLISurface({ runtime, scope });
24
- await surface.run(process.argv);
9
+ ```sh
10
+ bun add @vibesdotdev/cli
11
+ # or
12
+ npm install @vibesdotdev/cli
25
13
  ```
26
14
 
27
- Hosts also commonly import:
28
-
29
- - `@vibesdotdev/cli/plugin` — the runtime plugin that registers `cli/group` and `cli/command` kinds.
30
- - `@vibesdotdev/cli/config` — `defineConfig` and config types for user `vibes.config.*` files.
31
-
32
- Shell completions for the live descriptor tree are emitted via `vibes completion bash|zsh|fish|fig`, implemented inside this package.
33
-
34
- ## Known issues
15
+ ## Documentation
35
16
 
36
- - The **dev binary currently crashes during runtime bootstrap** with a descriptor collision (`Global ID collision for 'ai/context.ui:chat-messages.form'`). Tracked under the FIRST-LAUNCH P0 cleanup — see [docs/dx/FIRST-LAUNCH-2026-05.md](../../docs/dx/FIRST-LAUNCH-2026-05.md). Until that lands, `vibes --help` will not print help.
37
- - The package re-exports a wide subdirectory tree via wildcard `exports`; prefer the documented top-level entry points (`.`, `./plugin`, `./config`) when consuming from another package.
17
+ - Package guide: https://docs.vibes.dev/packages/cli
18
+ - Vibes docs: https://docs.vibes.dev
38
19
 
39
- ## Authoritative spec
20
+ ## License
40
21
 
41
- For ownership boundaries, runtime contract, and non-goals, see [SPEC.md](./SPEC.md).
22
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibesdotdev/cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "vibes": "./bin/vibes.ts"
@@ -121,34 +121,29 @@
121
121
  "registry": "https://registry.npmjs.org",
122
122
  "access": "public"
123
123
  },
124
- "repository": {
125
- "type": "git",
126
- "url": "git+https://github.com/vibesdotdev/monorepo.git",
127
- "directory": "packages/cli"
128
- },
129
124
  "peerDependencies": {
130
- "@vibesdotdev/config": "0.0.1",
131
- "@vibesdotdev/localdb": "0.0.1",
132
- "@vibesdotdev/runtime": "0.0.1",
133
- "@vibesdotdev/logging": "0.0.1",
134
- "@vibesdotdev/runtime-surface-cli": "0.0.1",
135
- "@vibesdotdev/storage": "0.0.1",
136
- "@vibesdotdev/tui": "0.0.1"
125
+ "@vibesdotdev/config": "0.0.2",
126
+ "@vibesdotdev/localdb": "0.0.2",
127
+ "@vibesdotdev/runtime": "0.0.2",
128
+ "@vibesdotdev/logging": "0.0.2",
129
+ "@vibesdotdev/runtime-surface-cli": "0.0.2",
130
+ "@vibesdotdev/storage": "0.0.2",
131
+ "@vibesdotdev/tui": "0.0.2"
137
132
  },
138
133
  "dependencies": {
139
- "@vibesdotdev/client": "0.1.0",
140
- "@vibesdotdev/config": "0.0.1",
141
- "@vibesdotdev/localdb": "0.0.1",
142
- "@vibesdotdev/logging": "0.0.1",
143
- "@vibesdotdev/runtime": "0.0.1",
144
- "@vibesdotdev/runtime-bun": "0.0.0",
145
- "@vibesdotdev/runtime-environment-bun": "0.0.0",
146
- "@vibesdotdev/storage": "0.0.1",
147
- "@vibesdotdev/tui": "0.0.1",
134
+ "@vibesdotdev/client": "0.1.1",
135
+ "@vibesdotdev/config": "0.0.2",
136
+ "@vibesdotdev/localdb": "0.0.2",
137
+ "@vibesdotdev/logging": "0.0.2",
138
+ "@vibesdotdev/runtime": "0.0.2",
139
+ "@vibesdotdev/runtime-bun": "0.0.1",
140
+ "@vibesdotdev/runtime-environment-bun": "0.0.1",
141
+ "@vibesdotdev/storage": "0.0.2",
142
+ "@vibesdotdev/tui": "0.0.2",
148
143
  "commander": "^14.0.3",
149
144
  "yaml": "^2.9.0",
150
145
  "zod": "^4.3.6",
151
- "@vibesdotdev/runtime-surface-cli": "0.0.1"
146
+ "@vibesdotdev/runtime-surface-cli": "0.0.2"
152
147
  },
153
148
  "scripts": {
154
149
  "test": "bun test",
@@ -161,7 +156,6 @@
161
156
  "src",
162
157
  "bin",
163
158
  "README.md",
164
- "SPEC.md",
165
159
  "LICENSE",
166
160
  "!src/**/__tests__/**",
167
161
  "!src/**/__stubs__/**",
@@ -182,5 +176,10 @@
182
176
  ],
183
177
  "vibes": {
184
178
  "visibility": "public-framework"
179
+ },
180
+ "description": "Descriptor-driven CLI framework for composing Vibes command groups and commands.",
181
+ "homepage": "https://docs.vibes.dev/packages/cli",
182
+ "bugs": {
183
+ "url": "https://docs.vibes.dev/packages/cli#support"
185
184
  }
186
185
  }
package/SPEC.md DELETED
@@ -1,97 +0,0 @@
1
- # @vibesdotdev/cli
2
-
3
- Command-surface substrate: turns runtime `cli/group` and `cli/command` descriptors into a Commander.js CLI tree. Registers the CLI kinds, discovers and renders commands from the live descriptor graph, provides pattern-based command generation (CRUD, config-namespace, tool-wrapper, log-viewer, process-manager), shell completion, and CLI-scoped context providers (UI, logger, app, output-format). Does not own domain behavior — every command's logic lives in the owning feature package; cli only adapts and renders it.
4
-
5
- ## Owns
6
-
7
- - **Bootstrap composition** (`./bootstrap`): `createVibesCliApp({ loader, defaultPlugins, ... })` — composes the runtime loader, core plugins, project-config plugin overrides, and the CLISurface. Accepts a statically-imported `defaultPlugins` set so `bun build --compile` can satisfy the Bundle Selection Rule.
8
- - **Binary entrypoint** (`./bin/vibes.ts`): `#!/usr/bin/env bun` wrapper calling `createVibesCliApp({ defaultPlugins })`; used by `bunx @vibesdotdev/cli` and the compiled binary wrapper at `apps/cli-bin/src/bin/vibes.ts`.
9
- - **Runtime kinds:** `cli/group`, `cli/command`
10
- - **Plugin descriptors:** `cli.plugin` registers the two CLI kinds + the built-in `completion` (`cli/command`) descriptor; depends on `context` kind
11
- - **CLISurface** (`./surface`): Commander.js program lifecycle — initialize (register providers → resolve patterns → discover groups → discover commands), run (parse argv, dispatch, handle errors)
12
- - `register-groups.ts` — depth-first group sorting, parent-chain resolution, pattern delegation
13
- - `register-commands.ts` — argument/option mapping, pattern detection, TUI bridging, implementation resolution via `runtime.query().resolve()`
14
- - `build-context.ts` — assembles `CommandContext` (runtime + ui + logger + app + config) with fallback lookups
15
- - `attach-tui-action.ts` — dynamic import bridge for commands with `tuiAppId`
16
- - `command-group-policy.ts` — allowed root-fallback groups; orphan detection
17
- - **Pattern system** (`./patterns`): declarative command generation from descriptors
18
- - `resolver.ts` — `PatternResolver` registry + factory wiring all 5 built-in patterns
19
- - `crud.ts` — list/get/create/update/delete against any storage kind
20
- - `config-namespace.ts` — get/set/reset/list for a config namespace
21
- - `tool-wrapper.ts` — wraps a `tools/tool` asset as a CLI command
22
- - `log-viewer.ts` — tail/search/levels for log streaming
23
- - `process-manager.ts` — start/stop/restart/status/logs for daemon processes
24
- - `schemas.ts` — Zod schemas + type guards for all 5 pattern variants
25
- - **Descriptor schemas** (`./schemas`): Zod schemas for `cli/group`, `cli/command`; TypeScript module augmentation for the runtime registry; `CLISurfaceOptions`, `CommandContext`
26
- - **CLI context providers** (`./providers`): registers 5 context loaders with the runtime — `cli/ui` (terminal output), `cli/logger` (cli-namespaced logging), `cli/app` (app-level state), `cli/invocation` (invocation metadata), `cli/output-format` (json/yaml/text detection); also exports `detectOutputFormat()`, `requestCLIExit()`, `shouldKeepAlive()`, `resetKeepAlive()`, `CLIExitSignal`
27
- - **Error types** (`./errors`): `CLIError` hierarchy — `CommandNotFound`, `InvalidArgument`, `MissingArgument`, `AuthRequired`, `PermissionDenied`, `NotFound`, `Config`, `Network`, `Timeout`, `UserCancelled`
28
- - **Shell completion** (`./commands/completion`): bash, zsh (including widget), fish, Fig spec generators — rendered from the live descriptor tree
29
- - **UI toolkit** (`./support/ui-toolkit`): `VibesUIToolkit` — terminal formatting (json/yaml/table/markdown), interactive prompts (prompt/confirm/select/multiselect), progress reporting
30
- - **Binary path resolution** (`./bin`): monorepo-aware `vibes` binary discovery + worker invocation command builder
31
- - **Config facade** (`./config`): re-exports `VibesAppConfig`/`PluginsConfig` from `@vibesdotdev/runtime/config` and provides `defineConfig()` typed for project-level `vibes.config.ts`. The CLI does not own the config schema — that lives in `runtime/config`; the facade exists so projects don't need to import from `runtime` directly.
32
- - **Logging shim** (`./logging`): `'cli'`-namespaced logger singleton wrapping `@vibesdotdev/logging`
33
- - **Open utility** (`./utils/open`): cross-platform `open(url)`
34
- - **CLI-startup logger descriptor** (`./logging/cli-startup.logger.descriptor.ts`): registers `'cli-startup'` logger under `'cli:startup'`
35
- - **UI context descriptor** (`./ui.context.descriptor.ts`): declares `cli/ui` as consumer-hardware-only
36
-
37
- ## Does not own
38
-
39
- - Domain business logic, data access layers, storage engines, encryption, or CRUD services → owning feature packages (e.g., config domain → [`config`](../config/SPEC.md), auth → [`auth-system`](../auth-system/SPEC.md)). CLI is a rendering adapter only.
40
- - Binary compilation/distribution → [`cli-bin`](../cli-bin/SPEC.md) (wraps `packages/cli/bin/vibes.ts`).
41
- - Runtime loader implementation → [`runtime-bun`](../runtime-bun/SPEC.md) (Bun), [`runtime`](../runtime/SPEC.md) (interface).
42
- - TUI substrate (gateway, dispatcher, kinds, React hosting) → [`tui`](../tui/SPEC.md). CLI bridges to TUI via `attach-tui-action.ts` but does not own it.
43
- - Runtime plugin infrastructure, kind registration protocol, resolver chain → [`runtime`](../runtime/SPEC.md). CLI consumes kinds; it does not define the plugin contract.
44
- - Workspace data model, project state, active-project tracking → [`workspace`](../workspace/SPEC.md).
45
- - Auth credentials, session tokens, login flows → [`auth-system`](../auth-system/SPEC.md).
46
- - HTTP client construction, API connection testing, session refresh → [`client`](../client/SPEC.md). CLI may consume a resolved client; it must not build one.
47
- - Config storage backends (LocalDB, JSON file, encryption) → [`config`](../config/SPEC.md) + [`storage`](../storage/SPEC.md).
48
- - MCP protocol, transport, server lifecycle → [`mcp`](../mcp/SPEC.md).
49
- - Process manager engine, daemon lifecycle, resource registry → [`pm`](../pm/SPEC.md). CLI wraps PM via the `process-manager` pattern only.
50
-
51
- ## Hard rules
52
-
53
- - **CLI is a descriptor rendering layer, not a domain owner.** Every command's execute path must resolve to an implementation owned by a feature package. CLI code must not contain business logic, validation rules, data transformations, or state mutations that belong in a domain package.
54
- - **All commands register through the descriptor surface.** Imperative `parent.command(...)` calls outside of `patterns/*` and `commands/completion/` are forbidden. Feature packages export `cli/command` descriptors; CLISurface discovers and renders them.
55
- - **No upstream package may import domain code from CLI.** `packages/cli` is a leaf/consumer package. New imports into `src/app/`, `src/api/`, or `src/core/` from any non-CLI package are blocked.
56
- - **No direct storage / database access.** CLI code must not import `@vibesdotdev/localdb`, run raw SQL, construct database connections, or manage migration scripts. All data access flows through runtime-resolved assets or context-provided services.
57
- - **No mutable global singletons.** The `getContext()/setContext()` pattern in `core/runtime/context.ts` is banned for new code. All context flows through the runtime's context injection system.
58
- - **Patterns are pure CLI translation layers.** Pattern implementations must only map descriptors to Commander.js arguments/options and delegate execution to the resolved implementation. No business logic beyond CLI input coercion.
59
- - **Completion is derived from the live descriptor tree.** Shell completion output reflects the current registered descriptors without changes to the completion module when new commands are added.
60
- - **Error types map to deterministic exit codes.** Every `CLIError` subclass has a deterministic exit code. Domain errors are wrapped, not raw. CLI layer formats user-facing errors; it must not expose internal stack traces in normal operation.
61
- - **Tolerant surface, strict audit.** `strictCommandGroups` and `strictGroupParents` default to off — a config-driven plugin set will routinely produce orphaned descriptors and the surface drops them quietly (warns under `--verbose`). Strict mode is opt-in via the bootstrap `strict` option or `VIBES_CLI_STRICT=1` and is reserved for CI / descriptor audits.
62
-
63
- ## Migration debt (not yet executed)
64
-
65
- - **`src/app/config/` (~40 files)** — full config domain module: SQLite-backed `ConfigStorageService` (raw SQL, migrations), AES-256-GCM encryption service, config business logic monolith (`executeConfig*`), config loader facade, entity config service, imperative Commander.js command registrations. Belongs in [`config`](../config/SPEC.md). **Blocked on:** config package stabilization + migration of all importers off the CLI-internal loader.
66
- - **`src/api/`** — HTTP client factory + API test/debug service. Belongs in [`client`](../client/SPEC.md).
67
- - **`src/core/`** — legacy compatibility shims: mutable global `_context` singleton, file-based JSON namespace registry, legacy plugin/hook types.
68
- - **`src/commands/runtime/`** — imperative codegen command registration. Should be a `cli/command` descriptor owned by [`tools`](../tools/SPEC.md).
69
- - **Wildcard exports** in `package.json` — `./*`, `./*/*`, `./*/*/*`, `./*/*/*/*` must be replaced with explicit named entrypoints after migration debt clears.
70
-
71
- ## Public entrypoints
72
-
73
- Canonical (stable):
74
- - `.` — `createVibesCliApp`, `VibesCliAppOptions`, `VibesCliApp`, `CliPluginLoader`, `CLISurface`, `CLISurfaceOptions`, `CommandContext`, `cliPlugin`, pattern types/errors/providers/bin utilities
75
- - `./bootstrap` — `createVibesCliApp`, types (also re-exported from `.`)
76
- - `./plugin` — default export: `cliPlugin`
77
- - `./config` — `VibesAppConfig`, `PluginsConfig`, `VibesConfig`, `defineConfig()`
78
-
79
- Migration-era (do not normalize new code against):
80
- - `./app/config/loader*` — domain leak; target home is [`config`](../config/SPEC.md)
81
- - `./core` — legacy shim; do not import in new code
82
- - Wildcard `./*` paths — will be replaced after migration debt clears
83
-
84
- ## Verification
85
-
86
- `bun test` from package root. Covers descriptor schema validation, pattern resolution (all 5 built-in patterns), group registration ordering, command scope filtering, completion generation (bash/zsh/fish/fig), error-type exit-code mapping, context provider registration.
87
-
88
- ## Links
89
-
90
- - [runtime/SPEC.md](../runtime/SPEC.md)
91
- - [config/SPEC.md](../config/SPEC.md)
92
- - [tui/SPEC.md](../tui/SPEC.md)
93
- - [tools/SPEC.md](../tools/SPEC.md)
94
- - [cli-bin/SPEC.md](../cli-bin/SPEC.md)
95
- - [storage/SPEC.md](../storage/SPEC.md)
96
- - [SPEC-AUDIT.md](../../docs/architecture/SPEC-AUDIT.md)
97
- - [RUNTIME-FIRST-MODULES.md](../../docs/architecture/RUNTIME-FIRST-MODULES.md)