Skip to content

Commit 03a867f

Browse files
artparclaude
andcommitted
Update README with full command reference and install instructions
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 95e1c9e commit 03a867f

1 file changed

Lines changed: 230 additions & 12 deletions

File tree

README.md

Lines changed: 230 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,251 @@
11
# Daptin CLI
22

3-
CLI for talking to [Daptin server](https://github.com/daptin/daptin)
3+
CLI client for [Daptin](https://github.com/daptin/daptin) — the headless CMS and API server.
4+
5+
All Daptin entities are accessed uniformly via CRUD commands. All Daptin actions (signin, signup, upload, export, etc.) are executed uniformly via `execute`. No special-case commands.
6+
7+
## Install
8+
9+
Download a binary from the [latest release](https://github.com/daptin/daptin-cli/releases/latest):
10+
11+
```bash
12+
# macOS (Apple Silicon)
13+
curl -L https://github.com/daptin/daptin-cli/releases/latest/download/daptin-cli-darwin-arm64 -o daptin-cli
14+
chmod +x daptin-cli
15+
16+
# macOS (Intel)
17+
curl -L https://github.com/daptin/daptin-cli/releases/latest/download/daptin-cli-darwin-amd64 -o daptin-cli
18+
chmod +x daptin-cli
19+
20+
# Linux (amd64)
21+
curl -L https://github.com/daptin/daptin-cli/releases/latest/download/daptin-cli-linux-amd64 -o daptin-cli
22+
chmod +x daptin-cli
23+
24+
# Linux (arm64)
25+
curl -L https://github.com/daptin/daptin-cli/releases/latest/download/daptin-cli-linux-arm64 -o daptin-cli
26+
chmod +x daptin-cli
27+
```
28+
29+
Or build from source:
30+
31+
```bash
32+
go install github.com/daptin/daptin-cli@latest
33+
```
34+
35+
## Quick Start
36+
37+
```bash
38+
# Point to your Daptin server
39+
daptin-cli context add myserver http://localhost:6336
40+
daptin-cli context set myserver
41+
42+
# Sign in (signin is just an action like any other)
43+
daptin-cli execute user_account signin email=admin@example.com password=secret
44+
45+
# List tables
46+
daptin-cli list --columns table_name,is_top_level world
47+
48+
# List rows
49+
daptin-cli list --columns name,email --page-size 20 user_account
50+
```
51+
52+
## Context Management
53+
54+
Contexts store server endpoints and auth tokens in `~/.daptin/config.yaml`.
55+
56+
```bash
57+
daptin-cli context add prod https://api.example.com
58+
daptin-cli context add local http://localhost:6336
59+
daptin-cli context set prod
60+
daptin-cli context list
61+
```
62+
63+
Override per-command with `--endpoint`:
64+
65+
```bash
66+
daptin-cli --endpoint http://localhost:6336 list world
67+
```
68+
69+
## CRUD
70+
71+
### List rows
72+
73+
```bash
74+
daptin-cli list <entity> [flags]
75+
```
76+
77+
Flags: `--columns`, `--page-size`, `--page`, `--sort`, `--filter`, `--include`
78+
79+
```bash
80+
# List with column selection and pagination
81+
daptin-cli list --columns table_name,reference_id --page-size 50 world
82+
83+
# Sort descending by created_at
84+
daptin-cli list --sort -created_at --page-size 10 document
85+
86+
# Filter
87+
daptin-cli list --filter "status is active" task
88+
daptin-cli list --filter "table_name like %doc%" world
89+
daptin-cli list --filter "name is admin;email contains example" user_account
90+
91+
# Include relations
92+
daptin-cli list --include user_account_id document
93+
```
94+
95+
### Get a single row
96+
97+
```bash
98+
daptin-cli get <entity> <reference_id> [--columns col1,col2]
99+
```
100+
101+
```bash
102+
daptin-cli get world 019228bb-a7cd-773b-a465-c92d7c54d956
103+
daptin-cli get --columns table_name,is_top_level world 019228bb-a7cd-773b-a465-c92d7c54d956
104+
```
105+
106+
### Create, Update, Delete
107+
108+
```bash
109+
# Create with key=value pairs
110+
daptin-cli create document document_name=report.pdf document_extension=pdf
111+
112+
# Create with JSON
113+
daptin-cli create document '{"document_name":"report.pdf","document_extension":"pdf"}'
114+
115+
# Update
116+
daptin-cli update document <reference_id> document_name=updated.pdf
117+
118+
# Delete
119+
daptin-cli delete document <reference_id>
120+
```
121+
122+
### Traverse relationships
123+
124+
```bash
125+
daptin-cli related <entity> <reference_id> <relation_column>
126+
daptin-cli related document <ref_id> user_account_id
127+
```
128+
129+
## Actions
130+
131+
All Daptin actions — built-in or custom — are executed with `execute`. There are no special commands for signin, signup, upload, etc.
132+
133+
```bash
134+
daptin-cli execute <entity> <action_name> [key=val ...]
135+
```
136+
137+
### Authentication
138+
139+
```bash
140+
# Sign in
141+
daptin-cli execute user_account signin email=admin@example.com password=secret
142+
143+
# Sign up
144+
daptin-cli execute user_account signup name=Alice email=alice@example.com password=secret passwordConfirm=secret
145+
146+
# Sign in with 2FA
147+
daptin-cli execute user_account verify_otp email=admin@example.com mobile_number=+1234567890 otp=123456
148+
```
149+
150+
On successful signin, the token is automatically saved to the active context.
151+
152+
### Other actions
153+
154+
```bash
155+
# Generate random data
156+
daptin-cli execute world generate_random_data table_name=products count=100
157+
158+
# Export data
159+
daptin-cli execute world export_data table_name=document format=json
160+
161+
# Upload file to cloud store
162+
daptin-cli execute cloud_store upload_file --reference-id <store_id> path=/uploads
163+
164+
# Download system schema
165+
daptin-cli execute world download_system_schema
166+
```
167+
168+
### Interactive mode
169+
170+
Prompt for fields based on the action's InFields schema:
171+
172+
```bash
173+
daptin-cli execute user_account signin --interactive
174+
# > Email: admin@example.com
175+
# > Password: ****
176+
```
177+
178+
Password fields are automatically masked.
179+
180+
### Instance actions
181+
182+
For actions that require an entity instance, pass `--reference-id`:
183+
184+
```bash
185+
daptin-cli execute cloud_store upload_file --reference-id <cloud_store_id> path=/docs
186+
```
187+
188+
## Describe
189+
190+
### Table schema
4191

5192
```bash
6-
go get github.com/daptin/daptin-cli
7-
go install github.com/daptin/daptin-cli
8-
go build -o daptin-cli
193+
daptin-cli describe table document
9194
```
10195

196+
Shows columns (name + type) and available actions.
197+
198+
### Action schema
11199

12-
Describe a table schema
13200
```bash
14-
./daptin-cli --output table describe table world
201+
daptin-cli describe action document createDocument
15202
```
16203

17-
List items of a table
204+
Shows the action's InFields (the parameters it accepts).
205+
206+
## Output
18207

19-
./daptin-cli list --pageSize 50 --columns <col1>,<col2> <tableName>
208+
Table (default) or JSON:
20209

21210
```bash
22-
./daptin-cli list --pageSize 50 --columns reference_id,table_name world
211+
daptin-cli --output table list world
212+
daptin-cli --output json list world
23213
```
24214

215+
## Filter Syntax
25216

26-
Get one row by reference_id
217+
Filters are semicolon-separated `<column> <operator> <value>` expressions:
27218

28-
./daptin-cli get-by-id --columns reference_id,table_name <table_name> <reference_id>
219+
```bash
220+
--filter "name is alice"
221+
--filter "status is active;role is admin"
222+
--filter "name like %ali%"
223+
--filter "count more than 5"
224+
--filter "active is true"
225+
--filter "notes is empty"
226+
```
227+
228+
Operators: `is`, `like`, `ilike`, `contains`, `neq`, `gt`, `lt`, `more than`, `less than`, `begins with`, `ends with`, `in`, `is true`, `is false`, `is empty`, `is not`, `fuzzy`
229+
230+
Use `%` wildcards with `like` for partial matching. Raw JSON is also accepted:
29231

30232
```bash
31-
./daptin-cli get-by-id --columns reference_id,table_name,is_top_level world 019228bb-a7cd-773b-a465-c92d7c54d956
233+
--filter '[{"column":"name","operator":"like","value":"%ali%"}]'
32234
```
33235

236+
## Global Flags
237+
238+
```
239+
--config FILE, -c Config file (default: ~/.daptin/config.yaml)
240+
--output, -o Output format: table or json (default: table)
241+
--endpoint Server endpoint (default: http://localhost:6336)
242+
--debug Enable debug output
243+
```
244+
245+
## Environment Variables
246+
247+
```
248+
DAPTIN_CLI_CONFIG Config file path
249+
DAPTIN_ENDPOINT Server endpoint
250+
DAPTIN_CLI_OUTPUT Output format
251+
```

0 commit comments

Comments
 (0)