# seam-cli
SeamJS command-line tool for building HTML skeleton templates, generating typed TypeScript clients from procedure manifests, and orchestrating dev servers.
## Crate Structure
The CLI is split into three crates:
- `seam-skeleton` (`src/cli/skeleton/`) — HTML skeleton extraction pipeline (slot, extract, document, CTR check)
- `seam-codegen` (`src/cli/codegen/`) — TypeScript codegen, manifest types, RPC hash map
- `seam-cli` (`src/cli/core/`) — Build orchestration, dev servers, CLI entry point (this crate)
## Modules
- `src/main.rs` — CLI entry point (clap), dispatches subcommands
- `src/config/` — Parses config files (`seam.config.ts` > `.mjs` > `.toml`), walks up directory tree to find config
- `src/pull.rs` — Fetches `/_seam/manifest.json` from a running server
- `src/build/` — Build pipeline orchestration (route processing, asset packaging, derive source validation, derive registry codegen)
- `src/dev/` — Starts backend + frontend dev servers
- `src/ui.rs` — Terminal output formatting
## Commands
| `seam pull` | Fetch procedure manifest from a running server |
| `seam generate` | Generate typed client from a manifest file; supports `--url` flag or `generate.manifestUrl` config to fetch from remote server |
| `seam build` | Extract HTML skeletons, run full build pipeline with per-page splitting |
| `seam dev` | Start backend and frontend dev servers; fullstack mode: unified proxy server (single port) |
| `seam clean` | Remove build artifacts (`.seam/` directory) |
| `seam --version` | Print CLI version |
## Development
- Build: `cargo build -p seam-cli`
- Test: `cargo test -p seam-cli`
- Run: `cargo run -p seam-cli -- <command>`
## Notes
- The crate name is `seam-cli`, but the binary name is `seam`
- Config file lookup walks up the directory tree until it finds `seam.config.ts`, `seam.config.mjs`, or `seam.toml`
- Skeleton logic lives in `seam-skeleton`, codegen in `seam-codegen`
- Command config fields (`devCommand`, `backendBuildCommand`, etc.) accept `string | { command, cwd }` for monorepo setups; `cwd` resolves relative to config file location
- `seam dev` in fullstack mode runs an embedded proxy server: `/_seam/*` and non-GET → backend; HTML navigation → backend; JS/CSS/assets → Vite HMR; WebSocket → routed by path prefix