@usenaive-sdk/cli 0.2.0 → 0.2.2
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 +25 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.js +25 -0
- package/dist/client.js.map +1 -0
- package/dist/commands/billing.d.ts +2 -0
- package/dist/commands/billing.js +204 -0
- package/dist/commands/billing.js.map +1 -0
- package/dist/commands/companies.d.ts +2 -0
- package/dist/commands/companies.js +88 -0
- package/dist/commands/companies.js.map +1 -0
- package/dist/commands/domains.d.ts +2 -0
- package/dist/commands/domains.js +252 -0
- package/dist/commands/domains.js.map +1 -0
- package/dist/commands/email.d.ts +2 -0
- package/dist/commands/email.js +289 -0
- package/dist/commands/email.js.map +1 -0
- package/dist/commands/identity.d.ts +2 -0
- package/dist/commands/identity.js +109 -0
- package/dist/commands/identity.js.map +1 -0
- package/dist/commands/images.d.ts +2 -0
- package/dist/commands/images.js +291 -0
- package/dist/commands/images.js.map +1 -0
- package/dist/commands/jobs.d.ts +2 -0
- package/dist/commands/jobs.js +143 -0
- package/dist/commands/jobs.js.map +1 -0
- package/dist/commands/keys.d.ts +2 -0
- package/dist/commands/keys.js +133 -0
- package/dist/commands/keys.js.map +1 -0
- package/dist/commands/link.d.ts +3 -0
- package/dist/commands/link.js +91 -0
- package/dist/commands/link.js.map +1 -0
- package/dist/commands/login.d.ts +2 -0
- package/dist/commands/login.js +63 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/register.d.ts +2 -0
- package/dist/commands/register.js +68 -0
- package/dist/commands/register.js.map +1 -0
- package/dist/commands/search.d.ts +2 -0
- package/dist/commands/search.js +209 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/social.d.ts +2 -0
- package/dist/commands/social.js +402 -0
- package/dist/commands/social.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +47 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/usage.d.ts +2 -0
- package/dist/commands/usage.js +62 -0
- package/dist/commands/usage.js.map +1 -0
- package/dist/commands/video.d.ts +2 -0
- package/dist/commands/video.js +243 -0
- package/dist/commands/video.js.map +1 -0
- package/dist/commands/whoami.d.ts +2 -0
- package/dist/commands/whoami.js +37 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.js +40 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +83 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +37 -0
- package/dist/output.js +84 -0
- package/dist/output.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ Command-line interface for the Naive API v2. Register, manage identity, and use
|
|
|
12
12
|
- **Search** — Web search, URL extraction, deep research
|
|
13
13
|
- **Images** — Generate via fal.ai, search stock photos (dynamic pricing)
|
|
14
14
|
- **Video** — Generate via fal.ai (dynamic pricing)
|
|
15
|
+
- **Social** — Connect accounts, create posts, schedule, analytics (via bundle.social)
|
|
15
16
|
- **Jobs** — List, inspect, and cancel async jobs
|
|
16
17
|
- **Status** — Credit balance and usage history
|
|
17
18
|
|
|
@@ -138,6 +139,29 @@ naive video generate "Dog on beach" --model "fal-ai/kling-video/v3/pro/text-to-v
|
|
|
138
139
|
naive video status <job-id>
|
|
139
140
|
naive video models
|
|
140
141
|
|
|
142
|
+
# Social
|
|
143
|
+
naive social status # Check activation + accounts
|
|
144
|
+
naive social activate # Activate social media
|
|
145
|
+
naive social connect --platform twitter --redirect-url https://example.com # OAuth URL
|
|
146
|
+
naive social portal --redirect-url https://example.com # Multi-platform portal
|
|
147
|
+
naive social accounts # List connected accounts
|
|
148
|
+
naive social label <account-id> --label "Main" # Label an account
|
|
149
|
+
naive social disconnect <account-id> # Disconnect account
|
|
150
|
+
naive social sync # Sync from bundle.social
|
|
151
|
+
naive social upload --url https://example.com/video.mp4 # Upload media
|
|
152
|
+
naive social posts # List posts
|
|
153
|
+
naive social posts --status draft # Filter by status
|
|
154
|
+
naive social post "Hello world!" --platforms twitter,linkedin --publish # Create + publish (1 credit)
|
|
155
|
+
naive social post "Draft" --platforms twitter # Create draft (free)
|
|
156
|
+
naive social post "Demo" --platforms youtube --media-url https://example.com/video.mp4 --youtube-type SHORT --publish
|
|
157
|
+
naive social get <post-id> # Get post details
|
|
158
|
+
naive social edit <post-id> --content "Updated" # Edit draft
|
|
159
|
+
naive social delete <post-id> # Delete post
|
|
160
|
+
naive social publish <post-id> # Publish draft (1 credit)
|
|
161
|
+
naive social analytics <post-id> # Post analytics
|
|
162
|
+
naive social comments <post-id> # Post comments
|
|
163
|
+
naive social account-analytics <account-id> # Account analytics
|
|
164
|
+
|
|
141
165
|
# Jobs
|
|
142
166
|
naive jobs
|
|
143
167
|
naive jobs --status processing
|
|
@@ -206,5 +230,6 @@ src/
|
|
|
206
230
|
├── search.ts # naive search (web/url/research)
|
|
207
231
|
├── images.ts # naive images (generate/stock/models)
|
|
208
232
|
├── video.ts # naive video (generate/models)
|
|
233
|
+
├── social.ts # naive social (status/activate/connect/portal/accounts/label/disconnect/sync/upload/posts/post/get/edit/delete/publish/analytics/comments/account-analytics)
|
|
209
234
|
└── jobs.ts # naive jobs (list/get/cancel)
|
|
210
235
|
```
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function apiRequest(method: string, path: string, body?: Record<string, unknown>, opts?: {
|
|
2
|
+
noAuth?: boolean;
|
|
3
|
+
}): Promise<{
|
|
4
|
+
status: number;
|
|
5
|
+
data: unknown;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function handleApiError(action: string, resp: {
|
|
8
|
+
status: number;
|
|
9
|
+
data: unknown;
|
|
10
|
+
}): void;
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { loadConfig, getApiKey } from "./config.js";
|
|
2
|
+
import { formatApiError } from "./output.js";
|
|
3
|
+
export async function apiRequest(method, path, body, opts) {
|
|
4
|
+
const config = loadConfig();
|
|
5
|
+
const url = `${config.base_url}${path}`;
|
|
6
|
+
const headers = {
|
|
7
|
+
"Content-Type": "application/json",
|
|
8
|
+
};
|
|
9
|
+
if (!opts?.noAuth) {
|
|
10
|
+
headers["Authorization"] = `Bearer ${getApiKey()}`;
|
|
11
|
+
}
|
|
12
|
+
const resp = await fetch(url, {
|
|
13
|
+
method,
|
|
14
|
+
headers,
|
|
15
|
+
...(body && { body: JSON.stringify(body) }),
|
|
16
|
+
});
|
|
17
|
+
const data = await resp.json();
|
|
18
|
+
return { status: resp.status, data };
|
|
19
|
+
}
|
|
20
|
+
export function handleApiError(action, resp) {
|
|
21
|
+
if (resp.status >= 400) {
|
|
22
|
+
formatApiError(action, resp.data);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAc,EACd,IAAY,EACZ,IAA8B,EAC9B,IAA2B;IAE3B,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,QAAQ,GAAG,IAAI,EAAE,CAAC;IAExC,MAAM,OAAO,GAA2B;QACtC,cAAc,EAAE,kBAAkB;KACnC,CAAC;IAEF,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,SAAS,EAAE,EAAE,CAAC;IACrD,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC5B,MAAM;QACN,OAAO;QACP,GAAG,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;KAC5C,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,IAAuC;IACpF,IAAI,IAAI,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;QACvB,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { apiRequest, handleApiError } from "../client.js";
|
|
3
|
+
import { agentOutput } from "../output.js";
|
|
4
|
+
export const billingCmd = new Command("billing")
|
|
5
|
+
.description("Manage billing — plans, subscriptions, credit packs, upgrades")
|
|
6
|
+
.addHelpText("after", `
|
|
7
|
+
Subcommands:
|
|
8
|
+
naive billing plans List available subscription plans
|
|
9
|
+
naive billing subscribe Subscribe to a plan (returns checkout URL)
|
|
10
|
+
naive billing upgrade Upgrade to a higher plan
|
|
11
|
+
naive billing status Check subscription, credits, and billing state
|
|
12
|
+
naive billing portal Get billing management URL (Stripe portal)
|
|
13
|
+
naive billing packs List credit top-up packs with prices
|
|
14
|
+
naive billing topup Buy a credit pack (returns checkout URL)
|
|
15
|
+
|
|
16
|
+
Plans:
|
|
17
|
+
Starter $49/mo 50 credits/month All primitives, system email domain
|
|
18
|
+
Pro $149/mo 200 credits/month All primitives, custom domains, priority support
|
|
19
|
+
|
|
20
|
+
Credit Packs (one-time purchase):
|
|
21
|
+
small 20 credits $10
|
|
22
|
+
medium 50 credits $23 (Popular)
|
|
23
|
+
large 100 credits $44 (Best Value)
|
|
24
|
+
xl 250 credits $100
|
|
25
|
+
|
|
26
|
+
First-time subscribers get a 7-day free trial with 20 credits.
|
|
27
|
+
|
|
28
|
+
Examples:
|
|
29
|
+
$ naive billing plans
|
|
30
|
+
$ naive billing subscribe --plan starter
|
|
31
|
+
$ naive billing upgrade --plan pro
|
|
32
|
+
$ naive billing status
|
|
33
|
+
$ naive billing packs
|
|
34
|
+
$ naive billing topup --pack medium
|
|
35
|
+
$ naive billing portal
|
|
36
|
+
`);
|
|
37
|
+
billingCmd
|
|
38
|
+
.command("plans")
|
|
39
|
+
.description("List available subscription plans with pricing and trial info")
|
|
40
|
+
.action(async () => {
|
|
41
|
+
const resp = await apiRequest("GET", "/v1/billing/plans");
|
|
42
|
+
handleApiError("billing.plans", resp);
|
|
43
|
+
const data = resp.data;
|
|
44
|
+
const nextSteps = [];
|
|
45
|
+
if (data.trial_eligible) {
|
|
46
|
+
nextSteps.push({ command: "naive billing subscribe --plan starter", description: "Start with Starter (7-day free trial)" });
|
|
47
|
+
}
|
|
48
|
+
if (data.can_upgrade) {
|
|
49
|
+
nextSteps.push({ command: "naive billing upgrade --plan pro", description: "Upgrade to Pro" });
|
|
50
|
+
}
|
|
51
|
+
nextSteps.push({ command: "naive billing packs", description: "See credit top-up packs" });
|
|
52
|
+
agentOutput({
|
|
53
|
+
action: "billing.plans",
|
|
54
|
+
result: resp.data,
|
|
55
|
+
next_steps: nextSteps,
|
|
56
|
+
hints: [
|
|
57
|
+
`Current plan: ${data.current_plan}`,
|
|
58
|
+
...(data.trial_eligible ? ["First-time subscribers get a 7-day free trial with 20 credits"] : []),
|
|
59
|
+
],
|
|
60
|
+
related_commands: ["naive billing subscribe", "naive billing upgrade", "naive billing packs", "naive billing status"],
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
billingCmd
|
|
64
|
+
.command("subscribe")
|
|
65
|
+
.description("Subscribe to a plan — returns a Stripe checkout URL")
|
|
66
|
+
.requiredOption("--plan <plan>", "Plan to subscribe to (starter or pro)")
|
|
67
|
+
.action(async (opts) => {
|
|
68
|
+
const resp = await apiRequest("POST", "/v1/billing/subscribe", { plan: opts.plan });
|
|
69
|
+
handleApiError("billing.subscribe", resp);
|
|
70
|
+
const data = resp.data;
|
|
71
|
+
agentOutput({
|
|
72
|
+
action: "billing.subscribe",
|
|
73
|
+
result: resp.data,
|
|
74
|
+
next_steps: [
|
|
75
|
+
{ command: "naive billing status", description: "Check if payment completed" },
|
|
76
|
+
],
|
|
77
|
+
hints: [
|
|
78
|
+
`Open this URL to complete payment: ${data.checkout_url}`,
|
|
79
|
+
"After payment, check status with 'naive billing status'",
|
|
80
|
+
],
|
|
81
|
+
related_commands: ["naive billing status", "naive billing plans"],
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
billingCmd
|
|
85
|
+
.command("upgrade")
|
|
86
|
+
.description("Upgrade to a higher plan")
|
|
87
|
+
.requiredOption("--plan <plan>", "Plan to upgrade to (starter or pro)")
|
|
88
|
+
.action(async (opts) => {
|
|
89
|
+
const resp = await apiRequest("POST", "/v1/billing/upgrade", { plan: opts.plan });
|
|
90
|
+
handleApiError("billing.upgrade", resp);
|
|
91
|
+
const data = resp.data;
|
|
92
|
+
const url = data.portal_url ?? data.checkout_url;
|
|
93
|
+
agentOutput({
|
|
94
|
+
action: "billing.upgrade",
|
|
95
|
+
result: resp.data,
|
|
96
|
+
next_steps: [
|
|
97
|
+
{ command: "naive billing status", description: "Check updated plan" },
|
|
98
|
+
],
|
|
99
|
+
hints: [
|
|
100
|
+
`Open this URL to ${data.portal_url ? "manage your plan" : "complete payment"}: ${url}`,
|
|
101
|
+
],
|
|
102
|
+
related_commands: ["naive billing status", "naive billing plans"],
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
billingCmd
|
|
106
|
+
.command("status")
|
|
107
|
+
.description("Check subscription, credit balance, and billing state")
|
|
108
|
+
.action(async () => {
|
|
109
|
+
const resp = await apiRequest("GET", "/v1/billing/status");
|
|
110
|
+
handleApiError("billing.status", resp);
|
|
111
|
+
const data = resp.data;
|
|
112
|
+
const sub = data.subscription;
|
|
113
|
+
const billing = data.billing;
|
|
114
|
+
const nextSteps = [...data.next_steps];
|
|
115
|
+
nextSteps.push({ command: "naive usage", description: "View credit transaction history" });
|
|
116
|
+
const hints = [
|
|
117
|
+
`Plan: ${sub.plan} (${sub.status})`,
|
|
118
|
+
`Credits remaining: ${sub.credits_remaining}`,
|
|
119
|
+
];
|
|
120
|
+
if (billing.blocked && billing.block_reason) {
|
|
121
|
+
hints.push(`Billing blocked: ${billing.block_reason.replace(/_/g, " ")}`);
|
|
122
|
+
}
|
|
123
|
+
if (billing.is_trialing && billing.trial_days_remaining !== null) {
|
|
124
|
+
hints.push(`Trial: ${billing.trial_days_remaining} days remaining`);
|
|
125
|
+
}
|
|
126
|
+
if (billing.trial_expired) {
|
|
127
|
+
hints.push("Trial has expired — subscribe to continue");
|
|
128
|
+
}
|
|
129
|
+
if (sub.current_period_end) {
|
|
130
|
+
hints.push(`Period ends: ${sub.current_period_end}`);
|
|
131
|
+
}
|
|
132
|
+
agentOutput({
|
|
133
|
+
action: "billing.status",
|
|
134
|
+
result: resp.data,
|
|
135
|
+
next_steps: nextSteps,
|
|
136
|
+
hints,
|
|
137
|
+
related_commands: ["naive billing plans", "naive billing packs", "naive billing topup", "naive usage"],
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
billingCmd
|
|
141
|
+
.command("portal")
|
|
142
|
+
.description("Get a Stripe billing portal URL to manage subscription")
|
|
143
|
+
.action(async () => {
|
|
144
|
+
const resp = await apiRequest("POST", "/v1/billing/portal");
|
|
145
|
+
handleApiError("billing.portal", resp);
|
|
146
|
+
const data = resp.data;
|
|
147
|
+
agentOutput({
|
|
148
|
+
action: "billing.portal",
|
|
149
|
+
result: resp.data,
|
|
150
|
+
next_steps: [
|
|
151
|
+
{ command: "naive billing status", description: "Check updated billing state" },
|
|
152
|
+
],
|
|
153
|
+
hints: [
|
|
154
|
+
`Open this URL to manage your subscription: ${data.portal_url}`,
|
|
155
|
+
"From the portal you can update payment method, change plan, or cancel",
|
|
156
|
+
],
|
|
157
|
+
related_commands: ["naive billing status", "naive billing plans"],
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
billingCmd
|
|
161
|
+
.command("packs")
|
|
162
|
+
.description("List credit top-up packs with prices")
|
|
163
|
+
.action(async () => {
|
|
164
|
+
const resp = await apiRequest("GET", "/v1/billing/packs");
|
|
165
|
+
handleApiError("billing.packs", resp);
|
|
166
|
+
const data = resp.data;
|
|
167
|
+
agentOutput({
|
|
168
|
+
action: "billing.packs",
|
|
169
|
+
result: resp.data,
|
|
170
|
+
next_steps: [
|
|
171
|
+
{ command: "naive billing topup --pack medium", description: "Buy 50 credits for $23 (Popular)" },
|
|
172
|
+
{ command: "naive billing topup --pack large", description: "Buy 100 credits for $44 (Best Value)" },
|
|
173
|
+
],
|
|
174
|
+
hints: [
|
|
175
|
+
`Credits remaining: ${data.credits_remaining}`,
|
|
176
|
+
"Larger packs are more cost-effective",
|
|
177
|
+
"Credits never expire",
|
|
178
|
+
],
|
|
179
|
+
related_commands: ["naive billing topup", "naive billing status", "naive billing plans"],
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
billingCmd
|
|
183
|
+
.command("topup")
|
|
184
|
+
.description("Purchase a credit pack — returns a Stripe checkout URL")
|
|
185
|
+
.requiredOption("--pack <pack_id>", "Pack ID: small (20/$10), medium (50/$23), large (100/$44), xl (250/$100)")
|
|
186
|
+
.action(async (opts) => {
|
|
187
|
+
const resp = await apiRequest("POST", "/v1/billing/topup", { pack_id: opts.pack });
|
|
188
|
+
handleApiError("billing.topup", resp);
|
|
189
|
+
const data = resp.data;
|
|
190
|
+
agentOutput({
|
|
191
|
+
action: "billing.topup",
|
|
192
|
+
result: resp.data,
|
|
193
|
+
next_steps: [
|
|
194
|
+
{ command: "naive billing status", description: "Check updated credit balance after payment" },
|
|
195
|
+
],
|
|
196
|
+
hints: [
|
|
197
|
+
`Open this URL to complete payment: ${data.checkout_url}`,
|
|
198
|
+
`Purchasing ${data.pack.credits} credits for ${data.pack.price}`,
|
|
199
|
+
"Credits are added immediately after payment",
|
|
200
|
+
],
|
|
201
|
+
related_commands: ["naive billing status", "naive billing packs"],
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
//# sourceMappingURL=billing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/commands/billing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;KAC7C,WAAW,CAAC,+DAA+D,CAAC;KAC5E,WAAW,CAAC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BvB,CAAC,CAAC;AAEH,UAAU;KACP,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,+DAA+D,CAAC;KAC5E,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;IAC1D,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;IAEtC,MAAM,IAAI,GAAG,IAAI,CAAC,IAKjB,CAAC;IAEF,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,wCAAwC,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC,CAAC;IAC9H,CAAC;IACD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,kCAAkC,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC,CA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CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,UAAU;KACP,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,wDAAwD,CAAC;KACrE,cAAc,CAAC,kBAAkB,EAAE,0EAA0E,CAAC;KAC9G,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrB,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACnF,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;IAEtC,MAAM,IAAI,GAAG,IAAI,CAAC,IAA0E,CAAC;IAE7F,WAAW,CAAC;QACV,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,IAAI,CAAC,IAAI;QACjB,UAAU,EAAE;YACV,EAAE,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,4CAA4C,EAAE;SAC/F;QACD,KAAK,EAAE;YACL,sCAAsC,IAAI,CAAC,YAAY,EAAE;YACzD,cAAc,IAAI,CAAC,IAAI,CAAC,OAAO,gBAAgB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YAChE,6CAA6C;SAC9C;QACD,gBAAgB,EAAE,CAAC,sBAAsB,EAAE,qBAAqB,CAAC;KAClE,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { apiRequest, handleApiError } from "../client.js";
|
|
3
|
+
import { saveConfig } from "../config.js";
|
|
4
|
+
import { agentOutput } from "../output.js";
|
|
5
|
+
export const companiesCmd = new Command("companies")
|
|
6
|
+
.description("List all companies accessible to the current agent")
|
|
7
|
+
.addHelpText("after", `
|
|
8
|
+
Examples:
|
|
9
|
+
$ naive companies
|
|
10
|
+
|
|
11
|
+
What this does:
|
|
12
|
+
Lists every company your agent/account has access to, showing:
|
|
13
|
+
- Company ID (UUID)
|
|
14
|
+
- Company name
|
|
15
|
+
- Current credit balance
|
|
16
|
+
- Billing tier (free, pro, enterprise)
|
|
17
|
+
|
|
18
|
+
Use this to:
|
|
19
|
+
- See which workspaces you can operate in
|
|
20
|
+
- Find a company ID to switch context with 'naive companies select'
|
|
21
|
+
- Check credit balances across companies
|
|
22
|
+
`)
|
|
23
|
+
.action(async () => {
|
|
24
|
+
const resp = await apiRequest("GET", "/v1/auth/companies");
|
|
25
|
+
handleApiError("companies.list", resp);
|
|
26
|
+
const data = resp.data;
|
|
27
|
+
agentOutput({
|
|
28
|
+
action: "companies.list",
|
|
29
|
+
result: data,
|
|
30
|
+
next_steps: [
|
|
31
|
+
{ command: "naive companies select <company_id>", description: "Switch to a different company context", when: "You want to operate under a different company" },
|
|
32
|
+
{ command: "naive status", description: "See full status for current company" },
|
|
33
|
+
],
|
|
34
|
+
hints: [
|
|
35
|
+
`Found ${data.companies?.length ?? 0} accessible companies`,
|
|
36
|
+
"Use 'naive companies select <id>' to switch. A new API key will be issued for that company.",
|
|
37
|
+
],
|
|
38
|
+
related_commands: ["naive companies select", "naive whoami", "naive status"],
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
companiesCmd
|
|
42
|
+
.command("select <company_id>")
|
|
43
|
+
.description("Switch active company context (issues a new API key for that company)")
|
|
44
|
+
.addHelpText("after", `
|
|
45
|
+
Examples:
|
|
46
|
+
$ naive companies select 550e8400-e29b-41d4-a716-446655440000
|
|
47
|
+
|
|
48
|
+
What this does:
|
|
49
|
+
1. Verifies you have access to the specified company
|
|
50
|
+
2. Issues a new API key scoped to that company
|
|
51
|
+
3. Saves the new key to ~/.naive/config.json
|
|
52
|
+
4. All future commands operate under the new company
|
|
53
|
+
|
|
54
|
+
Notes:
|
|
55
|
+
- Your old key for the previous company remains valid
|
|
56
|
+
- Use 'naive companies' first to get the company ID
|
|
57
|
+
- The new key has access only to the selected company's resources
|
|
58
|
+
`)
|
|
59
|
+
.action(async (id) => {
|
|
60
|
+
const resp = await apiRequest("POST", "/v1/auth/select-company", { company_id: id });
|
|
61
|
+
handleApiError("companies.select", resp);
|
|
62
|
+
const data = resp.data;
|
|
63
|
+
saveConfig({
|
|
64
|
+
api_key: data.api_key,
|
|
65
|
+
agent_id: data.agent_id,
|
|
66
|
+
company_id: data.company_id,
|
|
67
|
+
company_name: data.company_name,
|
|
68
|
+
});
|
|
69
|
+
agentOutput({
|
|
70
|
+
action: "companies.select",
|
|
71
|
+
result: {
|
|
72
|
+
company_id: data.company_id,
|
|
73
|
+
company_name: data.company_name,
|
|
74
|
+
new_key_issued: true,
|
|
75
|
+
},
|
|
76
|
+
next_steps: [
|
|
77
|
+
{ command: "naive identity", description: "View resources available in the new company context" },
|
|
78
|
+
{ command: "naive email inboxes", description: "Check email addresses for this company" },
|
|
79
|
+
{ command: "naive status", description: "See credits and status for this company" },
|
|
80
|
+
],
|
|
81
|
+
hints: [
|
|
82
|
+
`Now operating under "${data.company_name}". New API key saved.`,
|
|
83
|
+
"All subsequent commands use the new company context.",
|
|
84
|
+
],
|
|
85
|
+
related_commands: ["naive whoami", "naive identity", "naive status"],
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=companies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companies.js","sourceRoot":"","sources":["../../src/commands/companies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;KACjD,WAAW,CAAC,oDAAoD,CAAC;KACjE,WAAW,CAAC,OAAO,EAAE;;;;;;;;;;;;;;;CAevB,CAAC;KACC,MAAM,CAAC,KAA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AAW,CAAC;QACV,MAAM,EAAE,kBAAkB;QAC1B,MAAM,EAAE;YACN,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,cAAc,EAAE,IAAI;SACrB;QACD,UAAU,EAAE;YACV,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,qDAAqD,EAAE;YACjG,EAAE,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,wCAAwC,EAAE;YACzF,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,yCAAyC,EAAE;SACpF;QACD,KAAK,EAAE;YACL,wBAAwB,IAAI,CAAC,YAAY,uBAAuB;YAChE,sDAAsD;SACvD;QACD,gBAAgB,EAAE,CAAC,cAAc,EAAE,gBAAgB,EAAE,cAAc,CAAC;KACrE,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { apiRequest, handleApiError } from "../client.js";
|
|
3
|
+
import { agentOutput } from "../output.js";
|
|
4
|
+
export const domainsCmd = new Command("domains")
|
|
5
|
+
.description("Manage email domains — list, connect, verify, search, purchase")
|
|
6
|
+
.addHelpText("after", `
|
|
7
|
+
Subcommands:
|
|
8
|
+
naive domains List all domains for your company
|
|
9
|
+
naive domains connect Connect a custom domain (BYOD)
|
|
10
|
+
naive domains dns-records Show DNS records needed for a domain
|
|
11
|
+
naive domains verify Trigger DNS verification for a domain
|
|
12
|
+
naive domains search Check if a domain is available for purchase
|
|
13
|
+
naive domains purchase Purchase a domain via Stripe checkout
|
|
14
|
+
|
|
15
|
+
Domain types:
|
|
16
|
+
System domain Auto-provisioned on registration ({slug}.usenaive.ai)
|
|
17
|
+
Custom domain Your own domain connected via 'domains connect'
|
|
18
|
+
Purchased domain Bought through Naive via Vercel registrar
|
|
19
|
+
|
|
20
|
+
Workflow for custom domains:
|
|
21
|
+
1. naive domains connect --domain mycompany.com → get DNS records
|
|
22
|
+
2. Add DNS records at your registrar (e.g., Cloudflare, Namecheap)
|
|
23
|
+
3. naive domains verify <domain_id> → verify DNS propagation
|
|
24
|
+
4. naive email create --local-part support → create inboxes
|
|
25
|
+
|
|
26
|
+
Workflow for purchasing a new domain:
|
|
27
|
+
1. naive domains search example.com → check availability + price
|
|
28
|
+
2. naive domains purchase example.com → get checkout URL
|
|
29
|
+
3. Complete payment at checkout URL
|
|
30
|
+
4. naive domains → verify domain is active
|
|
31
|
+
|
|
32
|
+
System domains are auto-provisioned on registration but may start as 'pending_dns'
|
|
33
|
+
until DNS verification completes. Use 'naive domains' to check status, and
|
|
34
|
+
'naive domains verify <id>' if needed.
|
|
35
|
+
|
|
36
|
+
Examples:
|
|
37
|
+
$ naive domains
|
|
38
|
+
$ naive domains connect --domain mycompany.com
|
|
39
|
+
$ naive domains dns-records <domain-uuid>
|
|
40
|
+
$ naive domains verify <domain-uuid>
|
|
41
|
+
$ naive domains search coolstartup.ai
|
|
42
|
+
$ naive domains purchase coolstartup.ai
|
|
43
|
+
`);
|
|
44
|
+
domainsCmd
|
|
45
|
+
.command("list", { isDefault: true })
|
|
46
|
+
.description("List all domains for your company")
|
|
47
|
+
.action(async () => {
|
|
48
|
+
const resp = await apiRequest("GET", "/v1/domains");
|
|
49
|
+
handleApiError("domains.list", resp);
|
|
50
|
+
const data = resp.data;
|
|
51
|
+
const count = data.domains?.length ?? 0;
|
|
52
|
+
const active = data.domains?.filter((d) => d.status === "active").length ?? 0;
|
|
53
|
+
const pending = data.domains?.filter((d) => d.status === "pending_dns").length ?? 0;
|
|
54
|
+
agentOutput({
|
|
55
|
+
action: "domains.list",
|
|
56
|
+
result: resp.data,
|
|
57
|
+
next_steps: [
|
|
58
|
+
...(pending > 0
|
|
59
|
+
? [{ command: "naive domains dns-records <domain_id>", description: "View DNS records to add for pending domains" }]
|
|
60
|
+
: []),
|
|
61
|
+
{ command: "naive domains connect --domain <your-domain.com>", description: "Connect a custom domain" },
|
|
62
|
+
...(active > 0
|
|
63
|
+
? [{ command: "naive email create --local-part <name>", description: "Create an inbox on an active domain" }]
|
|
64
|
+
: []),
|
|
65
|
+
],
|
|
66
|
+
hints: [
|
|
67
|
+
`${count} domain${count !== 1 ? "s" : ""} total (${active} active, ${pending} pending DNS)`,
|
|
68
|
+
"System domains ({slug}.usenaive.ai) are auto-provisioned on registration",
|
|
69
|
+
"Custom domains require DNS record setup before they can be used",
|
|
70
|
+
],
|
|
71
|
+
related_commands: ["naive domains connect", "naive domains verify", "naive email inboxes", "naive email create"],
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
domainsCmd
|
|
75
|
+
.command("connect")
|
|
76
|
+
.description("Connect a custom domain (BYOD) to your company for email")
|
|
77
|
+
.requiredOption("--domain <domain>", "Domain to connect (e.g., 'mycompany.com')")
|
|
78
|
+
.addHelpText("after", `
|
|
79
|
+
Examples:
|
|
80
|
+
$ naive domains connect --domain mycompany.com
|
|
81
|
+
$ naive domains connect --domain mail.mycompany.com
|
|
82
|
+
|
|
83
|
+
What this does:
|
|
84
|
+
1. Registers the domain with the email provider (Resend)
|
|
85
|
+
2. Returns DNS records (MX, TXT, CNAME) you must add at your registrar
|
|
86
|
+
3. Sets domain status to 'pending_dns' until verified
|
|
87
|
+
|
|
88
|
+
After connecting:
|
|
89
|
+
1. Add the returned DNS records at your domain registrar
|
|
90
|
+
2. Wait for DNS propagation (usually 5-60 minutes)
|
|
91
|
+
3. Run 'naive domains verify <domain_id>' to check
|
|
92
|
+
4. Once verified, create inboxes with 'naive email create'
|
|
93
|
+
`)
|
|
94
|
+
.action(async (opts) => {
|
|
95
|
+
const resp = await apiRequest("POST", "/v1/domains/connect", { domain: opts.domain });
|
|
96
|
+
handleApiError("domains.connect", resp);
|
|
97
|
+
const data = resp.data;
|
|
98
|
+
agentOutput({
|
|
99
|
+
action: "domains.connect",
|
|
100
|
+
result: resp.data,
|
|
101
|
+
next_steps: [
|
|
102
|
+
{ command: `naive domains dns-records ${data.id}`, description: "View DNS records to add (in case you need them again)" },
|
|
103
|
+
{ command: `naive domains verify ${data.id}`, description: "Verify DNS after adding records", when: "After adding DNS records at your registrar" },
|
|
104
|
+
],
|
|
105
|
+
hints: [
|
|
106
|
+
`Domain '${data.domain}' registered — add the DNS records shown above at your registrar`,
|
|
107
|
+
`${data.dns_records?.length ?? 0} DNS record(s) to add`,
|
|
108
|
+
"DNS propagation typically takes 5-60 minutes",
|
|
109
|
+
`Domain ID: ${data.id}`,
|
|
110
|
+
],
|
|
111
|
+
related_commands: ["naive domains dns-records", "naive domains verify", "naive domains"],
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
domainsCmd
|
|
115
|
+
.command("dns-records <domain_id>")
|
|
116
|
+
.description("Show the DNS records required for a domain")
|
|
117
|
+
.addHelpText("after", `
|
|
118
|
+
Examples:
|
|
119
|
+
$ naive domains dns-records 550e8400-e29b-41d4-a716-446655440000
|
|
120
|
+
|
|
121
|
+
Returns the DNS records you need to add at your domain registrar:
|
|
122
|
+
- MX records for email receiving
|
|
123
|
+
- TXT records for SPF verification
|
|
124
|
+
- CNAME records for DKIM signing
|
|
125
|
+
|
|
126
|
+
Each record includes its current verification status.
|
|
127
|
+
`)
|
|
128
|
+
.action(async (domainId) => {
|
|
129
|
+
const resp = await apiRequest("GET", `/v1/domains/${domainId}/dns-records`);
|
|
130
|
+
handleApiError("domains.dns-records", resp);
|
|
131
|
+
const data = resp.data;
|
|
132
|
+
const verified = data.records?.filter((r) => r.status === "verified").length ?? 0;
|
|
133
|
+
const total = data.records?.length ?? 0;
|
|
134
|
+
agentOutput({
|
|
135
|
+
action: "domains.dns-records",
|
|
136
|
+
result: resp.data,
|
|
137
|
+
next_steps: [
|
|
138
|
+
...(verified < total
|
|
139
|
+
? [
|
|
140
|
+
{ command: `naive domains verify ${data.domain_id}`, description: "Trigger verification after adding records" },
|
|
141
|
+
]
|
|
142
|
+
: [
|
|
143
|
+
{ command: `naive email create --local-part support --domain-id ${data.domain_id}`, description: "Create an inbox on this domain" },
|
|
144
|
+
]),
|
|
145
|
+
],
|
|
146
|
+
hints: [
|
|
147
|
+
`${verified}/${total} records verified for ${data.domain}`,
|
|
148
|
+
...(verified < total ? ["Add the unverified records at your DNS registrar, then run verify"] : ["All records verified — domain is ready for email"]),
|
|
149
|
+
],
|
|
150
|
+
related_commands: ["naive domains verify", "naive domains", "naive email create"],
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
domainsCmd
|
|
154
|
+
.command("verify <domain_id>")
|
|
155
|
+
.description("Trigger DNS verification for a custom domain")
|
|
156
|
+
.addHelpText("after", `
|
|
157
|
+
Examples:
|
|
158
|
+
$ naive domains verify 550e8400-e29b-41d4-a716-446655440000
|
|
159
|
+
|
|
160
|
+
What this does:
|
|
161
|
+
1. Asks the email provider to re-check your DNS records
|
|
162
|
+
2. Returns current verification status for each record
|
|
163
|
+
3. If all records verify, the domain status changes to 'active'
|
|
164
|
+
4. Active domains can be used to create email inboxes
|
|
165
|
+
|
|
166
|
+
Note: DNS propagation can take 5-60 minutes after adding records.
|
|
167
|
+
If verification fails, wait and try again.
|
|
168
|
+
`)
|
|
169
|
+
.action(async (domainId) => {
|
|
170
|
+
const resp = await apiRequest("POST", `/v1/domains/${domainId}/verify`);
|
|
171
|
+
handleApiError("domains.verify", resp);
|
|
172
|
+
const data = resp.data;
|
|
173
|
+
agentOutput({
|
|
174
|
+
action: "domains.verify",
|
|
175
|
+
result: resp.data,
|
|
176
|
+
next_steps: data.verified
|
|
177
|
+
? [
|
|
178
|
+
{ command: `naive email create --local-part support --domain-id ${data.domain_id}`, description: "Create an inbox on this domain" },
|
|
179
|
+
{ command: "naive email inboxes", description: "List all inboxes" },
|
|
180
|
+
]
|
|
181
|
+
: [
|
|
182
|
+
{ command: `naive domains dns-records ${data.domain_id}`, description: "Check which records still need to be added" },
|
|
183
|
+
{ command: `naive domains verify ${data.domain_id}`, description: "Try again after DNS propagation", when: "Wait 5-10 minutes" },
|
|
184
|
+
],
|
|
185
|
+
hints: data.verified
|
|
186
|
+
? [`Domain '${data.domain}' is now verified and active!`, "You can create email inboxes on this domain"]
|
|
187
|
+
: [`Domain '${data.domain}' is not yet verified`, "Ensure all DNS records are added and allow time for propagation"],
|
|
188
|
+
related_commands: ["naive domains dns-records", "naive domains", "naive email create"],
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
domainsCmd
|
|
192
|
+
.command("search <domain>")
|
|
193
|
+
.description("Check if a domain is available for purchase and get its price")
|
|
194
|
+
.addHelpText("after", `
|
|
195
|
+
Examples:
|
|
196
|
+
$ naive domains search coolstartup.ai
|
|
197
|
+
$ naive domains search mybrand.com
|
|
198
|
+
|
|
199
|
+
Returns availability status and price (if available).
|
|
200
|
+
If available, use 'naive domains purchase <domain>' to buy.
|
|
201
|
+
`)
|
|
202
|
+
.action(async (domain) => {
|
|
203
|
+
const resp = await apiRequest("GET", `/v1/domains/search?domain=${encodeURIComponent(domain)}`);
|
|
204
|
+
handleApiError("domains.search", resp);
|
|
205
|
+
const data = resp.data;
|
|
206
|
+
agentOutput({
|
|
207
|
+
action: "domains.search",
|
|
208
|
+
result: resp.data,
|
|
209
|
+
next_steps: data.available
|
|
210
|
+
? [{ command: `naive domains purchase ${data.domain}`, description: `Purchase for $${data.price}` }]
|
|
211
|
+
: [{ command: `naive domains search <other-domain>`, description: "Try a different domain" }],
|
|
212
|
+
hints: data.available
|
|
213
|
+
? [`${data.domain} is available for $${data.price}!`]
|
|
214
|
+
: [`${data.domain} is not available for purchase`],
|
|
215
|
+
related_commands: ["naive domains purchase", "naive domains"],
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
domainsCmd
|
|
219
|
+
.command("purchase <domain>")
|
|
220
|
+
.description("Purchase a domain via Stripe checkout")
|
|
221
|
+
.addHelpText("after", `
|
|
222
|
+
Examples:
|
|
223
|
+
$ naive domains purchase coolstartup.ai
|
|
224
|
+
|
|
225
|
+
What this does:
|
|
226
|
+
1. Checks domain availability and price
|
|
227
|
+
2. Creates a Stripe checkout session
|
|
228
|
+
3. Returns a URL to complete payment
|
|
229
|
+
4. After payment, the domain is registered automatically
|
|
230
|
+
|
|
231
|
+
Limits:
|
|
232
|
+
Maximum 3 purchased domains per company.
|
|
233
|
+
`)
|
|
234
|
+
.action(async (domain) => {
|
|
235
|
+
const resp = await apiRequest("POST", "/v1/domains/purchase", { domain });
|
|
236
|
+
handleApiError("domains.purchase", resp);
|
|
237
|
+
const data = resp.data;
|
|
238
|
+
agentOutput({
|
|
239
|
+
action: "domains.purchase",
|
|
240
|
+
result: resp.data,
|
|
241
|
+
next_steps: [
|
|
242
|
+
{ command: "naive domains", description: "Check domain status after payment" },
|
|
243
|
+
],
|
|
244
|
+
hints: [
|
|
245
|
+
`Open this URL to complete payment: ${data.checkout_url}`,
|
|
246
|
+
`Domain: ${data.domain} — Price: ${data.price}`,
|
|
247
|
+
"After payment, the domain will be registered and DNS provisioned automatically",
|
|
248
|
+
],
|
|
249
|
+
related_commands: ["naive domains", "naive domains search"],
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
//# sourceMappingURL=domains.js.map
|