@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
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { apiRequest, handleApiError } from "../client.js";
|
|
3
|
+
import { agentOutput } from "../output.js";
|
|
4
|
+
export const socialCmd = new Command("social")
|
|
5
|
+
.description("Social media — connect accounts, create posts, view analytics (via bundle.social)")
|
|
6
|
+
.addHelpText("after", `
|
|
7
|
+
Subcommands:
|
|
8
|
+
naive social status Check activation + connected accounts
|
|
9
|
+
naive social activate Activate social media for your company
|
|
10
|
+
naive social connect Get OAuth URL for a platform
|
|
11
|
+
naive social portal Get multi-platform portal URL
|
|
12
|
+
naive social accounts List connected accounts
|
|
13
|
+
naive social label <id> --label ... Set a label on an account
|
|
14
|
+
naive social disconnect <id> Disconnect an account
|
|
15
|
+
naive social sync Sync accounts from bundle.social
|
|
16
|
+
naive social upload --url <url> Upload media from URL
|
|
17
|
+
naive social posts List posts
|
|
18
|
+
naive social post <content> Create a post (draft by default)
|
|
19
|
+
naive social get <id> Get post details
|
|
20
|
+
naive social edit <id> Edit a draft post
|
|
21
|
+
naive social delete <id> Delete a post
|
|
22
|
+
naive social publish <id> Publish a draft
|
|
23
|
+
naive social analytics <id> Get post analytics
|
|
24
|
+
naive social comments <id> Get post comments
|
|
25
|
+
naive social account-analytics <id> Get account analytics
|
|
26
|
+
|
|
27
|
+
Supported Platforms:
|
|
28
|
+
TWITTER, LINKEDIN, INSTAGRAM, FACEBOOK, TIKTOK, YOUTUBE,
|
|
29
|
+
THREADS, PINTEREST, REDDIT, BLUESKY
|
|
30
|
+
|
|
31
|
+
Platform Tips:
|
|
32
|
+
YouTube: --youtube-type SHORT (vertical, <3min) or VIDEO (landscape)
|
|
33
|
+
TikTok: privacy auto-set to PUBLIC_TO_EVERYONE
|
|
34
|
+
Instagram: defaults to Reel type for video posts
|
|
35
|
+
Twitter: auto-truncated to 280 chars
|
|
36
|
+
Reddit: pass --platform-data '{"REDDIT":{"sr":"subreddit"}}' for subreddit
|
|
37
|
+
|
|
38
|
+
Cost:
|
|
39
|
+
- Publishing a post: 1 credit
|
|
40
|
+
- Drafts, analytics, account management: free
|
|
41
|
+
`);
|
|
42
|
+
socialCmd
|
|
43
|
+
.command("status")
|
|
44
|
+
.description("Check social media activation status and connected accounts")
|
|
45
|
+
.action(async () => {
|
|
46
|
+
const resp = await apiRequest("GET", "/v1/social/status");
|
|
47
|
+
handleApiError("social.status", resp);
|
|
48
|
+
agentOutput({
|
|
49
|
+
action: "social.status",
|
|
50
|
+
result: resp.data,
|
|
51
|
+
next_steps: [
|
|
52
|
+
...(resp.data.activated
|
|
53
|
+
? [{ command: "naive social accounts", description: "List connected accounts" }]
|
|
54
|
+
: [{ command: "naive social activate", description: "Activate social media" }]),
|
|
55
|
+
],
|
|
56
|
+
hints: [resp.data.activated ? "Social media is active" : "Social media is not yet activated"],
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
socialCmd
|
|
60
|
+
.command("activate")
|
|
61
|
+
.description("Activate social media integration for your company")
|
|
62
|
+
.action(async () => {
|
|
63
|
+
const resp = await apiRequest("POST", "/v1/social/activate");
|
|
64
|
+
handleApiError("social.activate", resp);
|
|
65
|
+
agentOutput({
|
|
66
|
+
action: "social.activate",
|
|
67
|
+
result: resp.data,
|
|
68
|
+
next_steps: [
|
|
69
|
+
{ command: 'naive social connect --platform twitter --redirect-url https://example.com', description: "Connect a social account" },
|
|
70
|
+
{ command: "naive social portal --redirect-url https://example.com", description: "Open multi-platform connect portal" },
|
|
71
|
+
],
|
|
72
|
+
hints: ["Social media activated. Connect accounts to start posting."],
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
socialCmd
|
|
76
|
+
.command("connect")
|
|
77
|
+
.description("Get OAuth URL to connect a social media account")
|
|
78
|
+
.requiredOption("--platform <platform>", "Platform: TWITTER, LINKEDIN, INSTAGRAM, FACEBOOK, TIKTOK, YOUTUBE, THREADS, PINTEREST, REDDIT, BLUESKY")
|
|
79
|
+
.option("--redirect-url <url>", "URL to redirect after connection", "https://usenaive.ai/developers")
|
|
80
|
+
.action(async (opts) => {
|
|
81
|
+
const resp = await apiRequest("POST", "/v1/social/connect", {
|
|
82
|
+
platform: opts.platform.toUpperCase(),
|
|
83
|
+
redirect_url: opts.redirectUrl,
|
|
84
|
+
});
|
|
85
|
+
handleApiError("social.connect", resp);
|
|
86
|
+
agentOutput({
|
|
87
|
+
action: "social.connect",
|
|
88
|
+
result: resp.data,
|
|
89
|
+
next_steps: [
|
|
90
|
+
{ command: "naive social sync", description: "Sync accounts after connecting" },
|
|
91
|
+
{ command: "naive social accounts", description: "List connected accounts" },
|
|
92
|
+
],
|
|
93
|
+
hints: [
|
|
94
|
+
`Open this URL to connect your ${opts.platform.toUpperCase()} account:`,
|
|
95
|
+
resp.data.url,
|
|
96
|
+
"After connecting, run 'naive social sync' to refresh accounts.",
|
|
97
|
+
],
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
socialCmd
|
|
101
|
+
.command("portal")
|
|
102
|
+
.description("Get a portal URL to connect multiple social media platforms at once")
|
|
103
|
+
.option("--redirect-url <url>", "URL to redirect after connection", "https://usenaive.ai/developers")
|
|
104
|
+
.option("--platforms <list>", "Comma-separated platform list to show")
|
|
105
|
+
.action(async (opts) => {
|
|
106
|
+
const body = { redirect_url: opts.redirectUrl };
|
|
107
|
+
if (opts.platforms)
|
|
108
|
+
body.platforms = opts.platforms.split(",").map((p) => p.trim().toUpperCase());
|
|
109
|
+
const resp = await apiRequest("POST", "/v1/social/portal", body);
|
|
110
|
+
handleApiError("social.portal", resp);
|
|
111
|
+
agentOutput({
|
|
112
|
+
action: "social.portal",
|
|
113
|
+
result: resp.data,
|
|
114
|
+
next_steps: [
|
|
115
|
+
{ command: "naive social sync", description: "Sync accounts after connecting" },
|
|
116
|
+
],
|
|
117
|
+
hints: [
|
|
118
|
+
"Open this URL to connect multiple social accounts:",
|
|
119
|
+
resp.data.url,
|
|
120
|
+
],
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
socialCmd
|
|
124
|
+
.command("accounts")
|
|
125
|
+
.description("List connected social media accounts")
|
|
126
|
+
.action(async () => {
|
|
127
|
+
const resp = await apiRequest("GET", "/v1/social/accounts");
|
|
128
|
+
handleApiError("social.accounts", resp);
|
|
129
|
+
agentOutput({
|
|
130
|
+
action: "social.accounts",
|
|
131
|
+
result: resp.data,
|
|
132
|
+
next_steps: [
|
|
133
|
+
{ command: 'naive social post "Hello!" --platforms twitter', description: "Create a post" },
|
|
134
|
+
{ command: 'naive social connect --platform <platform> --redirect-url <url>', description: "Connect more accounts" },
|
|
135
|
+
],
|
|
136
|
+
hints: [`${(resp.data.accounts ?? []).length} connected account(s)`],
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
socialCmd
|
|
140
|
+
.command("label <account-id>")
|
|
141
|
+
.description("Set a label on a social media account")
|
|
142
|
+
.requiredOption("--label <label>", "Label text to set")
|
|
143
|
+
.action(async (accountId, opts) => {
|
|
144
|
+
const resp = await apiRequest("POST", `/v1/social/accounts/${accountId}/label`, { label: opts.label });
|
|
145
|
+
handleApiError("social.label", resp);
|
|
146
|
+
agentOutput({
|
|
147
|
+
action: "social.label",
|
|
148
|
+
result: resp.data,
|
|
149
|
+
next_steps: [
|
|
150
|
+
{ command: "naive social accounts", description: "List accounts" },
|
|
151
|
+
],
|
|
152
|
+
hints: [`Label set to "${opts.label}"`],
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
socialCmd
|
|
156
|
+
.command("disconnect <account-id>")
|
|
157
|
+
.description("Disconnect a social media account")
|
|
158
|
+
.action(async (accountId) => {
|
|
159
|
+
const resp = await apiRequest("DELETE", `/v1/social/accounts/${accountId}`);
|
|
160
|
+
handleApiError("social.disconnect", resp);
|
|
161
|
+
agentOutput({
|
|
162
|
+
action: "social.disconnect",
|
|
163
|
+
result: resp.data,
|
|
164
|
+
next_steps: [
|
|
165
|
+
{ command: "naive social accounts", description: "List remaining accounts" },
|
|
166
|
+
],
|
|
167
|
+
hints: ["Account disconnected"],
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
socialCmd
|
|
171
|
+
.command("sync")
|
|
172
|
+
.description("Sync social accounts from bundle.social")
|
|
173
|
+
.action(async () => {
|
|
174
|
+
const resp = await apiRequest("POST", "/v1/social/sync");
|
|
175
|
+
handleApiError("social.sync", resp);
|
|
176
|
+
agentOutput({
|
|
177
|
+
action: "social.sync",
|
|
178
|
+
result: resp.data,
|
|
179
|
+
next_steps: [
|
|
180
|
+
{ command: "naive social accounts", description: "View synced accounts" },
|
|
181
|
+
],
|
|
182
|
+
hints: [`Synced ${resp.data.synced ?? 0} account(s)`],
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
socialCmd
|
|
186
|
+
.command("upload")
|
|
187
|
+
.description("Upload media from a URL for use in social posts")
|
|
188
|
+
.requiredOption("--url <url>", "Public URL of the media file")
|
|
189
|
+
.action(async (opts) => {
|
|
190
|
+
const resp = await apiRequest("POST", "/v1/social/upload", { url: opts.url });
|
|
191
|
+
handleApiError("social.upload", resp);
|
|
192
|
+
agentOutput({
|
|
193
|
+
action: "social.upload",
|
|
194
|
+
result: resp.data,
|
|
195
|
+
next_steps: [
|
|
196
|
+
{ command: 'naive social post "content" --platforms youtube --media-url <url>', description: "Create a post with media" },
|
|
197
|
+
],
|
|
198
|
+
hints: ["Media uploaded. Use the upload ID or pass media_urls when creating posts (auto-upload)."],
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
socialCmd
|
|
202
|
+
.command("posts")
|
|
203
|
+
.description("List social media posts")
|
|
204
|
+
.option("--status <status>", "Filter by status: draft, scheduled, published, failed")
|
|
205
|
+
.option("--limit <n>", "Max results", "50")
|
|
206
|
+
.option("--offset <n>", "Pagination offset", "0")
|
|
207
|
+
.action(async (opts) => {
|
|
208
|
+
const params = new URLSearchParams();
|
|
209
|
+
if (opts.status)
|
|
210
|
+
params.set("status", opts.status);
|
|
211
|
+
params.set("limit", opts.limit);
|
|
212
|
+
params.set("offset", opts.offset);
|
|
213
|
+
const resp = await apiRequest("GET", `/v1/social/posts?${params}`);
|
|
214
|
+
handleApiError("social.posts", resp);
|
|
215
|
+
agentOutput({
|
|
216
|
+
action: "social.posts",
|
|
217
|
+
result: resp.data,
|
|
218
|
+
next_steps: [
|
|
219
|
+
{ command: 'naive social post "content" --platforms twitter', description: "Create a new post" },
|
|
220
|
+
],
|
|
221
|
+
hints: [`${resp.data.count ?? 0} post(s) returned`],
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
socialCmd
|
|
225
|
+
.command("post [content]")
|
|
226
|
+
.description("Create a social media post (draft by default, use --publish to publish immediately)")
|
|
227
|
+
.requiredOption("--platforms <list>", "Comma-separated platforms: twitter,linkedin,youtube,...")
|
|
228
|
+
.option("--publish", "Publish immediately (default: create as draft)")
|
|
229
|
+
.option("--media-url <url>", "Media URL (auto-uploaded for video/image platforms)")
|
|
230
|
+
.option("--youtube-type <type>", "YouTube type: SHORT (vertical, <3min) or VIDEO (landscape)")
|
|
231
|
+
.option("--platform-data <json>", "Per-platform overrides as JSON")
|
|
232
|
+
.option("--title <title>", "Post title (auto-generated from content if omitted)")
|
|
233
|
+
.option("--account-ids <ids>", "Comma-separated account UUIDs to post from")
|
|
234
|
+
.option("--schedule-at <datetime>", "ISO 8601 datetime to schedule the post")
|
|
235
|
+
.action(async (content, opts) => {
|
|
236
|
+
if (!content) {
|
|
237
|
+
console.error(JSON.stringify({
|
|
238
|
+
success: false,
|
|
239
|
+
action: "social.post",
|
|
240
|
+
error: { code: "missing_argument", message: "Provide the post content as a positional argument" },
|
|
241
|
+
recovery_steps: [
|
|
242
|
+
{ command: 'naive social post "Your content here" --platforms twitter,linkedin --publish', description: "Create and publish a post" },
|
|
243
|
+
{ command: 'naive social post "Your content here" --platforms twitter,linkedin', description: "Create a draft" },
|
|
244
|
+
],
|
|
245
|
+
}, null, 2));
|
|
246
|
+
process.exit(1);
|
|
247
|
+
}
|
|
248
|
+
const body = {
|
|
249
|
+
content,
|
|
250
|
+
platforms: opts.platforms.split(",").map((p) => p.trim().toUpperCase()),
|
|
251
|
+
publish_now: !!(opts.publish || opts.scheduleAt),
|
|
252
|
+
};
|
|
253
|
+
if (opts.title)
|
|
254
|
+
body.title = opts.title;
|
|
255
|
+
if (opts.mediaUrl)
|
|
256
|
+
body.media_urls = [opts.mediaUrl];
|
|
257
|
+
if (opts.youtubeType)
|
|
258
|
+
body.youtube_type = opts.youtubeType.toUpperCase();
|
|
259
|
+
if (opts.platformData)
|
|
260
|
+
body.platform_data = JSON.parse(opts.platformData);
|
|
261
|
+
if (opts.accountIds)
|
|
262
|
+
body.account_ids = opts.accountIds.split(",").map((id) => id.trim());
|
|
263
|
+
if (opts.scheduleAt)
|
|
264
|
+
body.scheduled_at = opts.scheduleAt;
|
|
265
|
+
const resp = await apiRequest("POST", "/v1/social/posts", body);
|
|
266
|
+
handleApiError("social.post", resp);
|
|
267
|
+
const data = resp.data;
|
|
268
|
+
agentOutput({
|
|
269
|
+
action: "social.post",
|
|
270
|
+
result: resp.data,
|
|
271
|
+
next_steps: [
|
|
272
|
+
...(data.status === "draft"
|
|
273
|
+
? [{ command: `naive social publish ${data.id}`, description: "Publish this draft" }]
|
|
274
|
+
: [{ command: `naive social get ${data.id}`, description: "Check post status" }]),
|
|
275
|
+
{ command: `naive social analytics ${data.id}`, description: "View post analytics (after publishing)" },
|
|
276
|
+
],
|
|
277
|
+
hints: [
|
|
278
|
+
data.status === "draft"
|
|
279
|
+
? "Draft created. Use 'naive social publish' to publish, or re-run with --publish."
|
|
280
|
+
: `Post ${data.status === "publishing" ? "queued for publishing" : "scheduled"}. 1 credit deducted.`,
|
|
281
|
+
],
|
|
282
|
+
related_commands: ["naive social posts", "naive social analytics"],
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
socialCmd
|
|
286
|
+
.command("get <post-id>")
|
|
287
|
+
.description("Get details of a social media post")
|
|
288
|
+
.action(async (postId) => {
|
|
289
|
+
const resp = await apiRequest("GET", `/v1/social/posts/${postId}`);
|
|
290
|
+
handleApiError("social.get", resp);
|
|
291
|
+
agentOutput({
|
|
292
|
+
action: "social.get",
|
|
293
|
+
result: resp.data,
|
|
294
|
+
next_steps: [
|
|
295
|
+
{ command: `naive social analytics ${postId}`, description: "View analytics" },
|
|
296
|
+
{ command: `naive social comments ${postId}`, description: "View comments" },
|
|
297
|
+
],
|
|
298
|
+
hints: [`Post status: ${resp.data.status}`],
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
socialCmd
|
|
302
|
+
.command("edit <post-id>")
|
|
303
|
+
.description("Edit a draft social media post")
|
|
304
|
+
.option("--content <text>", "Updated content")
|
|
305
|
+
.option("--platforms <list>", "Updated comma-separated platform list")
|
|
306
|
+
.option("--platform-data <json>", "Updated per-platform overrides as JSON")
|
|
307
|
+
.action(async (postId, opts) => {
|
|
308
|
+
const body = {};
|
|
309
|
+
if (opts.content)
|
|
310
|
+
body.content = opts.content;
|
|
311
|
+
if (opts.platforms)
|
|
312
|
+
body.platforms = opts.platforms.split(",").map((p) => p.trim().toUpperCase());
|
|
313
|
+
if (opts.platformData)
|
|
314
|
+
body.platform_data = JSON.parse(opts.platformData);
|
|
315
|
+
const resp = await apiRequest("PATCH", `/v1/social/posts/${postId}`, body);
|
|
316
|
+
handleApiError("social.edit", resp);
|
|
317
|
+
agentOutput({
|
|
318
|
+
action: "social.edit",
|
|
319
|
+
result: resp.data,
|
|
320
|
+
next_steps: [
|
|
321
|
+
{ command: `naive social publish ${postId}`, description: "Publish the updated draft" },
|
|
322
|
+
],
|
|
323
|
+
hints: ["Draft updated"],
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
socialCmd
|
|
327
|
+
.command("delete <post-id>")
|
|
328
|
+
.description("Delete a social media post")
|
|
329
|
+
.action(async (postId) => {
|
|
330
|
+
const resp = await apiRequest("DELETE", `/v1/social/posts/${postId}`);
|
|
331
|
+
handleApiError("social.delete", resp);
|
|
332
|
+
agentOutput({
|
|
333
|
+
action: "social.delete",
|
|
334
|
+
result: resp.data,
|
|
335
|
+
next_steps: [
|
|
336
|
+
{ command: "naive social posts", description: "View remaining posts" },
|
|
337
|
+
],
|
|
338
|
+
hints: ["Post deleted"],
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
socialCmd
|
|
342
|
+
.command("publish <post-id>")
|
|
343
|
+
.description("Publish a draft social media post (costs 1 credit)")
|
|
344
|
+
.action(async (postId) => {
|
|
345
|
+
const resp = await apiRequest("POST", `/v1/social/posts/${postId}/publish`);
|
|
346
|
+
handleApiError("social.publish", resp);
|
|
347
|
+
agentOutput({
|
|
348
|
+
action: "social.publish",
|
|
349
|
+
result: resp.data,
|
|
350
|
+
next_steps: [
|
|
351
|
+
{ command: `naive social get ${postId}`, description: "Check post status" },
|
|
352
|
+
{ command: `naive social analytics ${postId}`, description: "View analytics" },
|
|
353
|
+
],
|
|
354
|
+
hints: ["Post published (1 credit deducted)"],
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
socialCmd
|
|
358
|
+
.command("analytics <post-id>")
|
|
359
|
+
.description("Get analytics for a published social media post")
|
|
360
|
+
.action(async (postId) => {
|
|
361
|
+
const resp = await apiRequest("GET", `/v1/social/posts/${postId}/analytics`);
|
|
362
|
+
handleApiError("social.analytics", resp);
|
|
363
|
+
agentOutput({
|
|
364
|
+
action: "social.analytics",
|
|
365
|
+
result: resp.data,
|
|
366
|
+
next_steps: [
|
|
367
|
+
{ command: `naive social comments ${postId}`, description: "View comments" },
|
|
368
|
+
],
|
|
369
|
+
hints: ["Post analytics retrieved"],
|
|
370
|
+
});
|
|
371
|
+
});
|
|
372
|
+
socialCmd
|
|
373
|
+
.command("comments <post-id>")
|
|
374
|
+
.description("Get comments on a published social media post")
|
|
375
|
+
.action(async (postId) => {
|
|
376
|
+
const resp = await apiRequest("GET", `/v1/social/posts/${postId}/comments`);
|
|
377
|
+
handleApiError("social.comments", resp);
|
|
378
|
+
agentOutput({
|
|
379
|
+
action: "social.comments",
|
|
380
|
+
result: resp.data,
|
|
381
|
+
next_steps: [
|
|
382
|
+
{ command: `naive social analytics ${postId}`, description: "View analytics" },
|
|
383
|
+
],
|
|
384
|
+
hints: ["Post comments retrieved"],
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
socialCmd
|
|
388
|
+
.command("account-analytics <account-id>")
|
|
389
|
+
.description("Get analytics for a connected social media account")
|
|
390
|
+
.action(async (accountId) => {
|
|
391
|
+
const resp = await apiRequest("GET", `/v1/social/accounts/${accountId}/analytics`);
|
|
392
|
+
handleApiError("social.account-analytics", resp);
|
|
393
|
+
agentOutput({
|
|
394
|
+
action: "social.account-analytics",
|
|
395
|
+
result: resp.data,
|
|
396
|
+
next_steps: [
|
|
397
|
+
{ command: "naive social accounts", description: "List all accounts" },
|
|
398
|
+
],
|
|
399
|
+
hints: ["Account analytics retrieved"],
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
//# sourceMappingURL=social.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"social.js","sourceRoot":"","sources":["../../src/commands/social.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,EA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CAAC,KAAK,EAAE,MAAc,EAAE,EAAE;IAC/B,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,oBAAoB,MAAM,WAAW,CAAC,CAAC;IAC5E,cAAc,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;IACxC,WAAW,CAAC;QACV,MAAM,EAAE,iBAAiB;QACzB,MAAM,EAAE,IAAI,CAAC,IAAI;QACjB,UAAU,EAAE;YACV,EAAE,OAAO,EAAE,0BAA0B,MAAM,EAAE,EAAE,WAAW,EAAE,gBAAgB,EAAE;SAC/E;QACD,KAAK,EAAE,CAAC,yBAAyB,CAAC;KACnC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,SAAS;KACN,OAAO,CAAC,gCAAgC,CAAC;KACzC,WAAW,CAAC,oDAAoD,CAAC;KACjE,MAAM,CAAC,KAAK,EAAE,SAAiB,EAAE,EAAE;IAClC,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,uBAAuB,SAAS,YAAY,CAAC,CAAC;IACnF,cAAc,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAC;IACjD,WAAW,CAAC;QACV,MAAM,EAAE,0BAA0B;QAClC,MAAM,EAAE,IAAI,CAAC,IAAI;QACjB,UAAU,EAAE;YACV,EAAE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,mBAAmB,EAAE;SACvE;QACD,KAAK,EAAE,CAAC,6BAA6B,CAAC;KACvC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { apiRequest, handleApiError } from "../client.js";
|
|
3
|
+
import { agentOutput } from "../output.js";
|
|
4
|
+
export const statusCmd = new Command("status")
|
|
5
|
+
.description("Show full agent status: identity, credits, tier, and resource summary")
|
|
6
|
+
.addHelpText("after", `
|
|
7
|
+
Examples:
|
|
8
|
+
$ naive status
|
|
9
|
+
|
|
10
|
+
What this does:
|
|
11
|
+
Returns a comprehensive status overview:
|
|
12
|
+
- Agent identity (name, ID)
|
|
13
|
+
- Company context (name, ID)
|
|
14
|
+
- Credit balance and billing tier
|
|
15
|
+
- Resource counts (inboxes, active jobs, etc.)
|
|
16
|
+
- API connectivity confirmation
|
|
17
|
+
|
|
18
|
+
Use this to:
|
|
19
|
+
- Verify the CLI is properly configured and authenticated
|
|
20
|
+
- Check remaining credits before starting a task
|
|
21
|
+
- Get a quick overview of available resources
|
|
22
|
+
- Confirm which company you're operating under
|
|
23
|
+
`)
|
|
24
|
+
.action(async () => {
|
|
25
|
+
const resp = await apiRequest("GET", "/v1/status");
|
|
26
|
+
handleApiError("status", resp);
|
|
27
|
+
const data = resp.data;
|
|
28
|
+
const lowCredits = data.credits?.balance < 10;
|
|
29
|
+
agentOutput({
|
|
30
|
+
action: "status",
|
|
31
|
+
result: resp.data,
|
|
32
|
+
next_steps: [
|
|
33
|
+
...(lowCredits
|
|
34
|
+
? [{ command: "# Add credits at https://usenaive.ai/billing", description: "Your credit balance is low", when: "Balance below 10 credits" }]
|
|
35
|
+
: []),
|
|
36
|
+
{ command: "naive usage", description: "See detailed credit usage history" },
|
|
37
|
+
{ command: "naive identity", description: "View full resource details" },
|
|
38
|
+
{ command: "naive jobs --status processing", description: "Check active async jobs" },
|
|
39
|
+
],
|
|
40
|
+
hints: [
|
|
41
|
+
`Balance: ${data.credits?.balance ?? "?"} credits (${data.credits?.tier ?? "free"} tier)`,
|
|
42
|
+
...(lowCredits ? ["WARNING: Low credit balance. Some operations may fail."] : []),
|
|
43
|
+
],
|
|
44
|
+
related_commands: ["naive whoami", "naive usage", "naive identity", "naive jobs"],
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,C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,EAAE,CAAC;SAClF;QACD,gBAAgB,EAAE,CAAC,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,CAAC;KAClF,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { apiRequest, handleApiError } from "../client.js";
|
|
3
|
+
import { agentOutput } from "../output.js";
|
|
4
|
+
export const usageCmd = new Command("usage")
|
|
5
|
+
.description("Show credit usage history with transaction details")
|
|
6
|
+
.option("--days <n>", "Number of days to look back (default: 30)", "30")
|
|
7
|
+
.option("--limit <n>", "Maximum number of transactions to return (default: 50)", "50")
|
|
8
|
+
.addHelpText("after", `
|
|
9
|
+
Examples:
|
|
10
|
+
$ naive usage
|
|
11
|
+
$ naive usage --days 7
|
|
12
|
+
$ naive usage --days 1 --limit 100
|
|
13
|
+
|
|
14
|
+
What this does:
|
|
15
|
+
Returns a list of credit transactions showing:
|
|
16
|
+
- Transaction type (deduction, addition, refund)
|
|
17
|
+
- Amount and running balance
|
|
18
|
+
- Operation that triggered it (e.g., "image_generation", "email_send")
|
|
19
|
+
- Timestamp
|
|
20
|
+
- Reference ID (for idempotency/audit)
|
|
21
|
+
|
|
22
|
+
Use this to:
|
|
23
|
+
- Audit what's consuming credits
|
|
24
|
+
- Identify expensive operations
|
|
25
|
+
- Verify credits were deducted correctly after async job completion
|
|
26
|
+
- Check if a refund was issued for a failed job
|
|
27
|
+
|
|
28
|
+
Credit costs reference:
|
|
29
|
+
Fixed-price operations:
|
|
30
|
+
- Web search: 0.01 credits
|
|
31
|
+
- URL extraction: 0.02 credits
|
|
32
|
+
- Email send: 1.0 credits
|
|
33
|
+
- Stock photo search: free (0 credits)
|
|
34
|
+
- Deep research: 1.0–5.0 credits (depth-dependent)
|
|
35
|
+
|
|
36
|
+
Dynamic-price operations (fal.ai — model-dependent):
|
|
37
|
+
- Image generation: varies (GET /v1/images/pricing to preview)
|
|
38
|
+
- Video generation: varies (GET /v1/video/pricing to preview)
|
|
39
|
+
- Pricing: based on fal.ai model costs, at $0.50 per credit
|
|
40
|
+
`)
|
|
41
|
+
.action(async (opts) => {
|
|
42
|
+
const resp = await apiRequest("GET", `/v1/usage?days=${opts.days}&limit=${opts.limit}`);
|
|
43
|
+
handleApiError("usage", resp);
|
|
44
|
+
const data = resp.data;
|
|
45
|
+
const count = data.transactions?.length ?? 0;
|
|
46
|
+
agentOutput({
|
|
47
|
+
action: "usage",
|
|
48
|
+
result: resp.data,
|
|
49
|
+
next_steps: [
|
|
50
|
+
{ command: "naive status", description: "See current balance summary" },
|
|
51
|
+
{ command: "naive usage --days 1", description: "Narrow to today's usage only" },
|
|
52
|
+
{ command: "naive jobs", description: "Check pending jobs (credits deducted on completion)" },
|
|
53
|
+
],
|
|
54
|
+
hints: [
|
|
55
|
+
`Showing ${count} transactions from the last ${opts.days} days`,
|
|
56
|
+
"Async jobs (image/video generation) deduct credits only on completion, not at submission",
|
|
57
|
+
"Failed async jobs do not deduct credits",
|
|
58
|
+
],
|
|
59
|
+
related_commands: ["naive status", "naive jobs"],
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/commands/usage.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,QAAQ,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KACzC,WAAW,CAAC,oDAAoD,CAAC;KACjE,MAAM,CAAC,YAAY,EAAE,2CAA2C,EAAE,IAAI,CAAC;KACvE,MAAM,CAAC,aAAa,EAAE,wDAAwD,EAAE,IAAI,CAAC;KACrF,WAAW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