You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+
## Build & Run Commands
6
+
7
+
```bash
8
+
make run ARGS="<command>"# Run CLI locally (e.g. ARGS="whoami")
9
+
make staging-run ARGS="<command>"# Run against staging environment
10
+
make build # Build single-platform binary
11
+
make build-all # Build all platform binaries
12
+
make codeclean # Format with prettier
13
+
```
14
+
15
+
The runtime is **Bun** (>=1.3). No test framework is configured.
16
+
17
+
## Architecture
18
+
19
+
This is the **Crystallize CLI** (`@crystallize/cli`), a Bun-compiled TypeScript CLI using React (Ink) for terminal UI.
20
+
21
+
### Key Patterns
22
+
23
+
-**CQRS**: CommandBus (mutations) and QueryBus (reads) via `missive.js`. Handlers are registered in `src/core/di.ts`.
24
+
-**Dependency Injection**: Awilix container configured in `src/core/di.ts` — all services are singletons. Command factories receive their dependencies from the container.
25
+
-**Commander.js**: CLI commands are created as factory functions returning `Command` instances, organized by namespace (root, boilerplate, mass-operation, tenant, token, image, file).
26
+
-**Interactive UI**: React components via Ink with Jotai atoms for state. Most commands support `--no-interactive` for CI/CD.
27
+
28
+
### Source Layout
29
+
30
+
-`src/index.ts` — Entry point
31
+
-`src/command/` — CLI command definitions (each exports a factory function)
32
+
-`src/domain/use-cases/` — Business logic handlers (CQRS)
1. Create a factory in `src/command/<group>/` returning a `Command`
42
+
2. Define any use-case handlers in `src/domain/use-cases/`
43
+
3. Register in `src/core/di.ts` under the appropriate command group
44
+
45
+
### File System & Process Execution
46
+
47
+
File I/O uses a `FlySystem` abstraction (`src/domain/contracts/fly-system.ts`, implemented via Bun APIs). Subprocesses use `Bun.spawn` wrapped in `src/core/create-runner.ts`.
48
+
49
+
### Credentials
50
+
51
+
Resolved in priority order: env vars (`CRYSTALLIZE_ACCESS_TOKEN_ID`/`SECRET`) → CLI flags (`--token_id`/`--token_secret`) → stored file (`~/.crystallize/credentials.json`).
0 commit comments