···11# @slices/cli
2233-A command-line interface for managing AT Protocol lexicons and authentication with Slices.
33+A command-line interface for managing slice instances and AT Protocol lexicons
44+on https://slices.network.
4556## Features
6777-- ๐ **Device Code Authentication** - Secure OAuth 2.0 device flow login
88-- ๐ **Lexicon Management** - Import, list, and validate lexicon files
99-- ๐งฌ **Code Generation** - Generate TypeScript clients from lexicons
1010-- โ๏ธ **Project Configuration** - Optional `slices.json` config file support
1111-- โ **Validation** - Built-in lexicon validation using `@slices/lexicon`
1212-- ๐ง **Configuration Management** - Persistent authentication and settings
1313-- ๐ **Progress Tracking** - Real-time progress for batch operations
88+- **Lexicon Management** - Push, pull, and list lexicon files in your slices
99+- **Code Generation** - Generate TypeScript clients from lexicons
1010+- **Project Scaffolding** - Initialize new Deno SSR projects with OAuth
1111+- **Project Configuration** - Optional `slices.json` config file support
14121513## Installation
16141715```bash
1818-# Install from JSR
1919-deno install -g -A jsr:@slices/cli
1616+# Install globally from JSR
1717+deno install -g -A jsr:@slices/cli --name slices
20182119# Or run directly
2220deno run -A jsr:@slices/cli [command]
···2927 slices login
3028 ```
31293232-2. **Create a project config (optional)**
3030+2. **Initialize a new project**
3331 ```bash
3434- echo '{"slice": "at://did:plc:example/slice"}' > slices.json
3232+ slices init my-project
3533 ```
36343737-3. **Import lexicon files**
3535+3. **Push lexicon files to your slice**
3836 ```bash
3939- slices lexicon import
3737+ slices lexicon push
4038 ```
41394240## Commands
43414442### `slices login`
45434646-Authenticate with Slices using OAuth 2.0 device code flow.
4444+Authenticate with Slices.
47454846```bash
4947slices login [OPTIONS]
···5755```
58565957**Example:**
5858+6059```bash
6160# Basic login
6261slices login
···6867slices login --aip-url https://custom-aip.example.com
6968```
70697171-### `slices lexicon import`
7070+### `slices lexicon push`
72717373-Import lexicon files to your slice with automatic validation.
7272+Push lexicon files to your slice with automatic validation.
74737574```bash
7676-slices lexicon import [OPTIONS]
7575+slices lexicon push [OPTIONS]
77767877OPTIONS:
7978 --path <PATH> Directory containing lexicon files (default: ./lexicons or from slices.json)
8079 --slice <SLICE_URI> Target slice URI (required, or from slices.json)
8080+ --exclude-from-sync Exclude these lexicons from sync (sets excludedFromSync: true)
8181 --validate-only Only validate files, don't upload
8282- --dry-run Show what would be imported without uploading
8282+ --dry-run Show what would be pushed without uploading
8383+ --api-url <URL> Slices API base URL (default: https://api.slices.network or from slices.json)
8484+ -h, --help Show help
8585+```
8686+8787+### `slices lexicon pull`
8888+8989+Pull lexicon files from your slice.
9090+9191+```bash
9292+slices lexicon pull [OPTIONS]
9393+9494+OPTIONS:
9595+ --path <PATH> Directory to save lexicon files (default: ./lexicons or from slices.json)
9696+ --slice <SLICE_URI> Source slice URI (required, or from slices.json)
9797+ --nsid <PATTERN> Filter lexicons by NSID pattern (supports wildcards with *)
8398 --api-url <URL> Slices API base URL (default: https://api.slices.network or from slices.json)
8499 -h, --help Show help
85100```
···97112 -h, --help Show help
98113```
99114115115+### `slices init`
116116+117117+Initialize a new Deno SSR project with OAuth authentication.
118118+119119+```bash
120120+slices init <project-name>
121121+slices init --name <project-name>
122122+123123+OPTIONS:
124124+ -n, --name <name> Project name
125125+ -h, --help Show help
126126+```
127127+128128+### `slices status`
129129+130130+Show authentication and configuration status.
131131+132132+```bash
133133+slices status [OPTIONS]
134134+135135+OPTIONS:
136136+ -h, --help Show help
137137+```
138138+139139+### `slices logs`
140140+141141+View Jetstream logs for a slice.
142142+143143+```bash
144144+slices logs [OPTIONS]
145145+146146+OPTIONS:
147147+ --slice <SLICE_URI> Target slice URI (optional, or from slices.json)
148148+ --limit <NUMBER> Maximum number of log entries to return (default: 100, max: 1000)
149149+ --api-url <URL> Slices API base URL (default: https://api.slices.network or from slices.json)
150150+ -h, --help Show help
151151+```
152152+100153### `slices codegen`
101154102155Generate TypeScript client from lexicon files.
···113166```
114167115168**Examples:**
169169+116170```bash
117117-# Import all lexicons from ./lexicons (using slices.json config)
118118-slices lexicon import
171171+# Push all lexicons from ./lexicons (using slices.json config)
172172+slices lexicon push
119173120120-# Import from custom directory
121121-slices lexicon import --path ./my-lexicons --slice at://did:plc:example/slice
174174+# Push from custom directory
175175+slices lexicon push --path ./my-lexicons --slice at://did:plc:example/slice
122176123177# Validate only (no upload)
124124-slices lexicon import --validate-only --path ./lexicons
178178+slices lexicon push --validate-only --path ./lexicons
179179+180180+# Dry run (see what would be pushed)
181181+slices lexicon push --dry-run
125182126126-# Dry run (see what would be imported)
127127-slices lexicon import --dry-run
183183+# Pull lexicons from slice
184184+slices lexicon pull
128185129186# List lexicons in slice
130187slices lexicon list
131188132189# Generate TypeScript client
133190slices codegen
191191+192192+# Initialize new project
193193+slices init my-project
194194+195195+# View slice logs
196196+slices logs --slice at://did:plc:example/slice
134197```
135198136199## Global Options
···141204142205## Configuration
143206144144-### Authentication Config
207207+### CLI Configuration
145208146146-The CLI stores authentication and configuration in `~/.config/slices/config.json`.
209209+The CLI stores configuration in `~/.config/slices/config.json`.
147210148148-**Authentication config structure:**
211211+**Config structure:**
212212+149213```json
150214{
151215 "auth": {
···160224161225### Project Config
162226163163-Create a `slices.json` file in your project root to avoid passing common options every time:
227227+Create a `slices.json` file in your project root to avoid passing common options
228228+every time:
164229165230```json
166231{
···172237```
173238174239**Config options:**
175175-- `slice` - Your slice URI (used by `lexicon import`, `lexicon list`, `codegen`)
240240+241241+- `slice` - Your slice URI (used by `lexicon push`, `lexicon pull`,
242242+ `lexicon list`, `codegen`)
176243- `lexiconPath` - Directory containing lexicon files (default: `./lexicons`)
177177-- `clientOutputPath` - Output path for generated TypeScript client (default: `./generated_client.ts`)
244244+- `clientOutputPath` - Output path for generated TypeScript client (default:
245245+ `./generated_client.ts`)
178246- `apiUrl` - Slices API base URL (default: `https://api.slices.network`)
179247180180-The CLI will search for `slices.json` starting from the current directory and walking up the directory tree. Command line arguments always take precedence over config file values.
248248+The CLI will search for `slices.json` starting from the current directory and
249249+walking up the directory tree. Command line arguments always take precedence
250250+over config file values.
181251182252## Lexicon File Requirements
183253184184-Lexicon files must be valid JSON files with the following structure:
254254+Lexicon files must be valid JSON files with the following structure. For the
255255+full specification, see https://atproto.com/specs/lexicon.
185256186257```json
187258{
···200271```
201272202273The CLI will:
274274+2032751. Scan the specified directory for `.json` files
2042762. Validate each file using `@slices/lexicon`
2052773. Report validation errors with specific feedback
···222294223295The CLI provides detailed error messages and suggestions:
224296225225-- **Authentication errors** - Prompts to run `slices login`
297297+- **Login errors** - Prompts to run `slices login`
226298- **Validation errors** - Shows specific issues with lexicon files
227299- **Network errors** - Displays connection and API errors
228300- **File errors** - Reports missing files or invalid JSON
···235307# 1. Authenticate
236308slices login
237309238238-# 2. Set up project config
239239-echo '{"slice": "at://did:plc:user123/awesome-slice"}' > slices.json
310310+# 2. Initialize project
311311+slices init awesome-slice
240312241313# 3. Validate lexicons first
242242-slices lexicon import --validate-only
314314+slices lexicon push --validate-only
243315244244-# 4. Import to slice
245245-slices lexicon import
316316+# 4. Push to slice
317317+slices lexicon push
246318247319# 5. Generate TypeScript client
248320slices codegen
249321250250-# 6. List imported lexicons
322322+# 6. List lexicons
251323slices lexicon list
252324```
253325254254-### Working Without Config File
255255-256256-```bash
257257-# Import multiple lexicon directories
258258-for dir in ./lexicons/*/; do
259259- slices lexicon import --slice at://did:plc:user123/slice --path "$dir"
260260-done
261261-```
262262-263326## License
264327265265-MIT328328+MIT