@usenaive-sdk/cli 0.1.0
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.
- package/README.md +197 -0
- package/package.json +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# @usenaive/cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for the Naive API v2. Register, manage identity, and use all primitives directly from the terminal.
|
|
4
|
+
|
|
5
|
+
## What It Provides
|
|
6
|
+
|
|
7
|
+
- **Auth & Onboarding** — Register new accounts, login, link existing ones, manage API keys
|
|
8
|
+
- **Identity** — View agent profile, company, email inboxes, resources
|
|
9
|
+
- **Domains** — List domains, connect custom domains (BYOD), view DNS records, verify
|
|
10
|
+
- **Email** — Create/delete inboxes, send emails, read inboxes
|
|
11
|
+
- **Search** — Web search, URL extraction, deep research
|
|
12
|
+
- **Images** — Generate via fal.ai, search stock photos (dynamic pricing)
|
|
13
|
+
- **Video** — Generate via fal.ai (dynamic pricing)
|
|
14
|
+
- **Jobs** — List, inspect, and cancel async jobs
|
|
15
|
+
- **Status** — Credit balance and usage history
|
|
16
|
+
|
|
17
|
+
## Local Development
|
|
18
|
+
|
|
19
|
+
### Prerequisites
|
|
20
|
+
|
|
21
|
+
- Node.js 20+
|
|
22
|
+
- pnpm 9+
|
|
23
|
+
|
|
24
|
+
### Setup
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# From monorepo root
|
|
28
|
+
pnpm install
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Run (development)
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Run any command directly with tsx
|
|
35
|
+
pnpm --filter @usenaive/cli dev -- register --name "Test" --email test@example.com
|
|
36
|
+
|
|
37
|
+
# Or from packages/cli
|
|
38
|
+
cd packages/cli
|
|
39
|
+
pnpm dev -- search "AI frameworks"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Build
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pnpm --filter @usenaive/cli build
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Link locally (test as global binary)
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
cd packages/cli
|
|
52
|
+
pnpm link --global
|
|
53
|
+
naive --help
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
|
|
58
|
+
### Configuration
|
|
59
|
+
|
|
60
|
+
The CLI stores config at `~/.naive/config.json`:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"api_key": "nv_sk_live_...",
|
|
65
|
+
"base_url": "https://api.usenaive.ai"
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Set via registration or environment:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Auto-saved on register/login/link
|
|
73
|
+
naive register --name "My Agent" --email owner@example.com --password yourpassword
|
|
74
|
+
|
|
75
|
+
# Or set manually
|
|
76
|
+
export NAIVE_API_KEY=nv_sk_live_...
|
|
77
|
+
export NAIVE_BASE_URL=http://localhost:3100 # for local dev
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Commands
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Auth
|
|
84
|
+
naive register --name "Agent" --email user@example.com --password mypassword --company "Acme"
|
|
85
|
+
naive login --email user@example.com --password mypassword
|
|
86
|
+
naive link --email existing@example.com
|
|
87
|
+
naive whoami
|
|
88
|
+
naive companies
|
|
89
|
+
naive keys list
|
|
90
|
+
naive keys create "Production"
|
|
91
|
+
naive keys revoke <key-id>
|
|
92
|
+
|
|
93
|
+
# Identity
|
|
94
|
+
naive identity
|
|
95
|
+
naive identity emails
|
|
96
|
+
naive identity resources
|
|
97
|
+
|
|
98
|
+
# Domains
|
|
99
|
+
naive domains # List all domains
|
|
100
|
+
naive domains connect example.com # Connect a custom domain (BYOD)
|
|
101
|
+
naive domains dns-records <domain-id> # Show required DNS records
|
|
102
|
+
naive domains verify <domain-id> # Trigger domain verification
|
|
103
|
+
|
|
104
|
+
# Email
|
|
105
|
+
naive email inboxes
|
|
106
|
+
naive email create --local-part hello # Create new inbox on active domain
|
|
107
|
+
naive email delete <inbox-id> # Delete an inbox
|
|
108
|
+
naive email send --from-inbox <uuid> --to user@example.com --subject "Hi" --body "Hello"
|
|
109
|
+
naive email inbox --inbox <uuid> --limit 20
|
|
110
|
+
naive email read <email-id>
|
|
111
|
+
|
|
112
|
+
# Search
|
|
113
|
+
naive search "AI agent frameworks"
|
|
114
|
+
naive search url https://example.com --extract "Main points?"
|
|
115
|
+
naive search research "Compare React vs Astro" --depth thorough --wait
|
|
116
|
+
|
|
117
|
+
# Images
|
|
118
|
+
naive images generate "A tech logo" --model "fal-ai/flux-pro/v1.1" --wait
|
|
119
|
+
naive images generate --input '{"prompt":"...","num_images":2}' --wait
|
|
120
|
+
naive images status <job-id>
|
|
121
|
+
naive images stock "office workspace" --count 5
|
|
122
|
+
naive images models
|
|
123
|
+
|
|
124
|
+
# Video
|
|
125
|
+
naive video generate "Dog on beach" --model "fal-ai/kling-video/v3/pro/text-to-video" --duration 5 --wait
|
|
126
|
+
naive video status <job-id>
|
|
127
|
+
naive video models
|
|
128
|
+
|
|
129
|
+
# Jobs
|
|
130
|
+
naive jobs
|
|
131
|
+
naive jobs --status processing
|
|
132
|
+
naive jobs get <job-id>
|
|
133
|
+
naive jobs cancel <job-id>
|
|
134
|
+
|
|
135
|
+
# Status
|
|
136
|
+
naive status
|
|
137
|
+
naive usage --days 7
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Global Options
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
--api-key <key> Override API key (env: NAIVE_API_KEY)
|
|
144
|
+
--base-url <url> Override base URL (env: NAIVE_BASE_URL)
|
|
145
|
+
--help Show help
|
|
146
|
+
--version Show version
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Production / Publishing
|
|
150
|
+
|
|
151
|
+
### Publish to npm
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
cd packages/cli
|
|
155
|
+
pnpm build
|
|
156
|
+
npm publish --access public
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Users install with:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
npm install -g @usenaive/cli
|
|
163
|
+
naive --help
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Use without installing
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
npx @usenaive/cli register --name "My Agent" --email user@example.com
|
|
170
|
+
npx @usenaive/cli search "AI frameworks"
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Architecture
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
src/
|
|
177
|
+
├── index.ts # Entry point, commander program setup
|
|
178
|
+
├── config.ts # ~/.naive/config.json read/write
|
|
179
|
+
├── client.ts # HTTP client (fetch wrapper with auth + error handling)
|
|
180
|
+
├── output.ts # Structured agent-native JSON output (agentOutput/agentError)
|
|
181
|
+
└── commands/
|
|
182
|
+
├── register.ts # naive register
|
|
183
|
+
├── login.ts # naive login
|
|
184
|
+
├── link.ts # naive link
|
|
185
|
+
├── whoami.ts # naive whoami
|
|
186
|
+
├── companies.ts # naive companies
|
|
187
|
+
├── keys.ts # naive keys
|
|
188
|
+
├── identity.ts # naive identity
|
|
189
|
+
├── status.ts # naive status
|
|
190
|
+
├── usage.ts # naive usage
|
|
191
|
+
├── domains.ts # naive domains (list/connect/dns-records/verify)
|
|
192
|
+
├── email.ts # naive email (inboxes/create/delete/send/inbox/read)
|
|
193
|
+
├── search.ts # naive search (web/url/research)
|
|
194
|
+
├── images.ts # naive images (generate/stock/models)
|
|
195
|
+
├── video.ts # naive video (generate/models)
|
|
196
|
+
└── jobs.ts # naive jobs (list/get/cancel)
|
|
197
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@usenaive-sdk/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "CLI for Naive AI Business Primitives API",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"naive": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "tsx src/index.ts",
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"typecheck": "tsc --noEmit"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"commander": "^13.1.0",
|
|
20
|
+
"chalk": "^5.4.1"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^22.15.3",
|
|
24
|
+
"tsx": "^4.19.4",
|
|
25
|
+
"typescript": "^5.7.3"
|
|
26
|
+
}
|
|
27
|
+
}
|