@usenaive-sdk/cli 0.12.2 → 0.13.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 +76 -5
- package/dist/client.d.ts +74 -1
- package/dist/client.js +351 -17
- package/dist/client.js.map +1 -1
- package/dist/commands/aeo.js +69 -27
- package/dist/commands/aeo.js.map +1 -1
- package/dist/commands/app-data.js +29 -11
- package/dist/commands/app-data.js.map +1 -1
- package/dist/commands/apps.d.ts +7 -0
- package/dist/commands/apps.js +255 -18
- package/dist/commands/apps.js.map +1 -1
- package/dist/commands/audio.d.ts +9 -0
- package/dist/commands/audio.js +391 -0
- package/dist/commands/audio.js.map +1 -0
- package/dist/commands/auth.d.ts +31 -0
- package/dist/commands/auth.js +403 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/billing.js +12 -12
- package/dist/commands/billing.js.map +1 -1
- package/dist/commands/brain.d.ts +2 -0
- package/dist/commands/brain.js +1255 -0
- package/dist/commands/brain.js.map +1 -0
- package/dist/commands/browser.js +35 -8
- package/dist/commands/browser.js.map +1 -1
- package/dist/commands/business.js +117 -16
- package/dist/commands/business.js.map +1 -1
- package/dist/commands/clone.d.ts +2 -0
- package/dist/commands/clone.js +203 -0
- package/dist/commands/clone.js.map +1 -0
- package/dist/commands/companies.d.ts +8 -0
- package/dist/commands/companies.js +137 -47
- package/dist/commands/companies.js.map +1 -1
- package/dist/commands/company-data.d.ts +2 -0
- package/dist/commands/company-data.js +168 -0
- package/dist/commands/company-data.js.map +1 -0
- package/dist/commands/compute.js +10 -3
- package/dist/commands/compute.js.map +1 -1
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +36 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/connections.d.ts +6 -0
- package/dist/commands/connections.js +29 -1
- package/dist/commands/connections.js.map +1 -1
- package/dist/commands/domains.js +1 -1
- package/dist/commands/ecommerce.js +19 -9
- package/dist/commands/ecommerce.js.map +1 -1
- package/dist/commands/email.js +56 -9
- package/dist/commands/email.js.map +1 -1
- package/dist/commands/env.d.ts +3 -3
- package/dist/commands/env.js +68 -4
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/formation.js +3 -3
- package/dist/commands/identity.js +4 -3
- package/dist/commands/identity.js.map +1 -1
- package/dist/commands/images.js +87 -13
- package/dist/commands/images.js.map +1 -1
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.js +39 -36
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/jobs.js +1 -0
- package/dist/commands/jobs.js.map +1 -1
- package/dist/commands/keys.js +26 -3
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/legacy-auth.d.ts +27 -0
- package/dist/commands/legacy-auth.js +64 -0
- package/dist/commands/legacy-auth.js.map +1 -0
- package/dist/commands/llm.js +13 -0
- package/dist/commands/llm.js.map +1 -1
- package/dist/commands/login.js +2 -0
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/loops.d.ts +2 -0
- package/dist/commands/loops.js +260 -0
- package/dist/commands/loops.js.map +1 -0
- package/dist/commands/media.js +3 -3
- package/dist/commands/media.js.map +1 -1
- package/dist/commands/mobile.d.ts +4 -0
- package/dist/commands/mobile.js +382 -0
- package/dist/commands/mobile.js.map +1 -0
- package/dist/commands/payments.d.ts +2 -0
- package/dist/commands/payments.js +131 -0
- package/dist/commands/payments.js.map +1 -0
- package/dist/commands/people.d.ts +2 -0
- package/dist/commands/people.js +193 -0
- package/dist/commands/people.js.map +1 -0
- package/dist/commands/phone.js +3 -3
- package/dist/commands/phone.js.map +1 -1
- package/dist/commands/projects.d.ts +13 -0
- package/dist/commands/projects.js +220 -0
- package/dist/commands/projects.js.map +1 -0
- package/dist/commands/register.js +16 -8
- package/dist/commands/register.js.map +1 -1
- package/dist/commands/sandbox.d.ts +2 -0
- package/dist/commands/sandbox.js +245 -0
- package/dist/commands/sandbox.js.map +1 -0
- package/dist/commands/search.js +26 -12
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/seo.js +16 -8
- package/dist/commands/seo.js.map +1 -1
- package/dist/commands/sessions.d.ts +6 -0
- package/dist/commands/sessions.js +109 -0
- package/dist/commands/sessions.js.map +1 -0
- package/dist/commands/social-data.d.ts +2 -0
- package/dist/commands/social-data.js +244 -0
- package/dist/commands/social-data.js.map +1 -0
- package/dist/commands/social.js +8 -6
- package/dist/commands/social.js.map +1 -1
- package/dist/commands/teams.d.ts +69 -0
- package/dist/commands/teams.js +503 -0
- package/dist/commands/teams.js.map +1 -0
- package/dist/commands/up.d.ts +150 -0
- package/dist/commands/up.js +415 -15
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/usage.js +15 -4
- package/dist/commands/usage.js.map +1 -1
- package/dist/commands/use.d.ts +9 -0
- package/dist/commands/use.js +76 -11
- package/dist/commands/use.js.map +1 -1
- package/dist/commands/users.d.ts +8 -0
- package/dist/commands/users.js +28 -9
- package/dist/commands/users.js.map +1 -1
- package/dist/commands/vault.js +28 -1
- package/dist/commands/vault.js.map +1 -1
- package/dist/commands/video.js +190 -270
- package/dist/commands/video.js.map +1 -1
- package/dist/commands/voice.d.ts +2 -0
- package/dist/commands/voice.js +516 -0
- package/dist/commands/voice.js.map +1 -0
- package/dist/commands/wallet.d.ts +2 -0
- package/dist/commands/wallet.js +244 -0
- package/dist/commands/wallet.js.map +1 -0
- package/dist/commands/whoami.js +17 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/config.d.ts +24 -1
- package/dist/config.js +36 -7
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +290 -20
- package/dist/index.js.map +1 -1
- package/dist/lib/brain-select.d.ts +193 -0
- package/dist/lib/brain-select.js +403 -0
- package/dist/lib/brain-select.js.map +1 -0
- package/dist/lib/cli-validation.d.ts +12 -0
- package/dist/lib/cli-validation.js +46 -0
- package/dist/lib/cli-validation.js.map +1 -0
- package/dist/lib/deprecation.d.ts +158 -0
- package/dist/lib/deprecation.js +140 -0
- package/dist/lib/deprecation.js.map +1 -0
- package/dist/lib/duration.d.ts +8 -0
- package/dist/lib/duration.js +11 -0
- package/dist/lib/duration.js.map +1 -0
- package/dist/lib/http-response.d.ts +11 -0
- package/dist/lib/http-response.js +96 -0
- package/dist/lib/http-response.js.map +1 -0
- package/dist/lib/pricing.d.ts +132 -0
- package/dist/lib/pricing.js +148 -0
- package/dist/lib/pricing.js.map +1 -0
- package/dist/lib/stream-frames.d.ts +114 -0
- package/dist/lib/stream-frames.js +169 -0
- package/dist/lib/stream-frames.js.map +1 -0
- package/dist/lib/teams-catalog.d.ts +141 -0
- package/dist/lib/teams-catalog.js +765 -0
- package/dist/lib/teams-catalog.js.map +1 -0
- package/dist/lib/unknown-command.d.ts +57 -0
- package/dist/lib/unknown-command.js +93 -0
- package/dist/lib/unknown-command.js.map +1 -0
- package/dist/lib/version-check.d.ts +26 -0
- package/dist/lib/version-check.js +21 -0
- package/dist/lib/version-check.js.map +1 -0
- package/dist/output.d.ts +119 -10
- package/dist/output.js +309 -15
- package/dist/output.js.map +1 -1
- package/dist/prompt.d.ts +17 -0
- package/dist/prompt.js +70 -0
- package/dist/prompt.js.map +1 -0
- package/package.json +11 -6
- package/dist/commands/billing-client.d.ts +0 -2
- package/dist/commands/billing-client.js +0 -271
- package/dist/commands/billing-client.js.map +0 -1
- package/dist/commands/crm-app.d.ts +0 -2
- package/dist/commands/crm-app.js +0 -306
- package/dist/commands/crm-app.js.map +0 -1
- package/dist/commands/crm.d.ts +0 -2
- package/dist/commands/crm.js +0 -319
- package/dist/commands/crm.js.map +0 -1
- package/dist/commands/integrations.d.ts +0 -2
- package/dist/commands/integrations.js +0 -199
- package/dist/commands/integrations.js.map +0 -1
- package/dist/commands/link.d.ts +0 -3
- package/dist/commands/link.js +0 -91
- package/dist/commands/link.js.map +0 -1
- package/dist/commands/operators.d.ts +0 -11
- package/dist/commands/operators.js +0 -120
- package/dist/commands/operators.js.map +0 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { Command, Option } from "commander";
|
|
2
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
3
|
+
import { basename } from "node:path";
|
|
4
|
+
import { apiRequest, handleApiError, parseJsonOrUpstreamError } from "../client.js";
|
|
5
|
+
import { loadConfig, getApiKey } from "../config.js";
|
|
6
|
+
import { agentOutput, formatApiError } from "../output.js";
|
|
7
|
+
// naive clone generate — one-shot digital-twin video (reference image + a saved cloned
|
|
8
|
+
// voice + a script + an optional scene -> a lip-synced talking video). Mirrors
|
|
9
|
+
// `naive video generate`: submit (async, returns a job id), optional --wait poll.
|
|
10
|
+
// If --image is a LOCAL path, it is uploaded via `media upload` first to get a public URL.
|
|
11
|
+
export const cloneCmd = new Command("clone")
|
|
12
|
+
.description("Generate a lip-synced talking video of a real person from a reference image + a saved cloned voice + a script")
|
|
13
|
+
.addHelpText("after", `
|
|
14
|
+
Subcommands:
|
|
15
|
+
naive clone generate Generate a talking video (image + voice + script -> video)
|
|
16
|
+
naive clone status Check a clone generation job
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
$ naive clone generate --voice <voice_id> --image ./frame.png --text "Hey, welcome." --i-affirm
|
|
20
|
+
$ naive clone generate --voice <voice_id> --image https://example.com/frame.jpg \\
|
|
21
|
+
--text "Walking the pool deck" --scene "cliffside mansion pool deck at golden hour" --i-affirm --wait
|
|
22
|
+
|
|
23
|
+
Cost:
|
|
24
|
+
- Image edit (only with --scene) + animate, billed on completion. The voice synth is
|
|
25
|
+
billed on its own meter. Credits deducted only on successful completion.
|
|
26
|
+
`);
|
|
27
|
+
cloneCmd
|
|
28
|
+
.command("generate")
|
|
29
|
+
.description("Generate a talking video (async — returns a job ID)")
|
|
30
|
+
.requiredOption("--voice <id>", "An existing cloned voice profile id (the subject's voice + consent)")
|
|
31
|
+
.requiredOption("--image <path|url>", "Reference image — a local file path or a public https URL")
|
|
32
|
+
.requiredOption("--text <script>", "The script the cloned voice should speak")
|
|
33
|
+
.option("--scene <description>", "Optional scene/relight, e.g. 'cliffside pool deck at golden hour'")
|
|
34
|
+
.addOption(new Option("--quality <tier>", "Animate model: 'max' (OmniHuman, best lip-sync, default) or 'fast' (Kling, ~27% cheaper, stabler background)").choices(["max", "fast"]))
|
|
35
|
+
.option("--i-affirm", "Affirm the depicted person consented to this likeness animation (required)")
|
|
36
|
+
.option("--wait", "Wait for the job to complete (polls until done)")
|
|
37
|
+
.addHelpText("after", `
|
|
38
|
+
What this does:
|
|
39
|
+
1. (If --image is a local file) uploads it to get a public URL
|
|
40
|
+
2. Submits a clone generation job (image + voice + script [+ scene])
|
|
41
|
+
3. Returns a job ID (async, typically 1-3 minutes)
|
|
42
|
+
4. Use --wait to block until done, or check with 'naive clone status'
|
|
43
|
+
|
|
44
|
+
Consent:
|
|
45
|
+
--i-affirm is required: you attest the depicted person consented to this likeness
|
|
46
|
+
animation. The voice must be a saved cloned-voice profile with self or verified
|
|
47
|
+
third-party consent (you are animating that subject's likeness), AND that consent
|
|
48
|
+
must authorize the clone_generate use. Clone the voice with that use enabled:
|
|
49
|
+
naive voice clone <file> --consent-type self --i-affirm \\
|
|
50
|
+
--authorized-uses voice_synthesis,clone_generate ...
|
|
51
|
+
A voice cloned without clone_generate in --authorized-uses will be rejected.
|
|
52
|
+
`)
|
|
53
|
+
.action(async (opts) => {
|
|
54
|
+
if (!opts.iAffirm) {
|
|
55
|
+
console.error(JSON.stringify({
|
|
56
|
+
success: false,
|
|
57
|
+
action: "clone.generate",
|
|
58
|
+
error: {
|
|
59
|
+
code: "missing_argument",
|
|
60
|
+
message: "--i-affirm is required: affirm the depicted person consented to this likeness animation",
|
|
61
|
+
},
|
|
62
|
+
recovery_steps: [
|
|
63
|
+
{
|
|
64
|
+
command: 'naive clone generate --voice <id> --image <path|url> --text "..." --i-affirm',
|
|
65
|
+
description: "Re-run with the consent affirmation",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
}, null, 2));
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
// Resolve --image to a public URL. A local path is uploaded first (the S3 bucket
|
|
72
|
+
// returns a presigned URL fal can GET); an http(s) URL is passed through unchanged.
|
|
73
|
+
let imageUrl = opts.image;
|
|
74
|
+
if (!/^https?:\/\//i.test(opts.image)) {
|
|
75
|
+
if (!existsSync(opts.image)) {
|
|
76
|
+
console.error(JSON.stringify({
|
|
77
|
+
success: false,
|
|
78
|
+
action: "clone.generate",
|
|
79
|
+
error: { code: "invalid_input", message: `Image file not found: ${opts.image}` },
|
|
80
|
+
}, null, 2));
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
imageUrl = await uploadLocalImage(opts.image);
|
|
84
|
+
}
|
|
85
|
+
const resp = await apiRequest("POST", "/v1/clone/generate", {
|
|
86
|
+
voice_id: opts.voice,
|
|
87
|
+
image_url: imageUrl,
|
|
88
|
+
text: opts.text,
|
|
89
|
+
...(opts.scene ? { scene: opts.scene } : {}),
|
|
90
|
+
...(opts.quality ? { quality: opts.quality } : {}),
|
|
91
|
+
i_affirm: true,
|
|
92
|
+
});
|
|
93
|
+
handleApiError("clone.generate", resp);
|
|
94
|
+
const data = resp.data;
|
|
95
|
+
if (opts.wait) {
|
|
96
|
+
agentOutput({
|
|
97
|
+
action: "clone.generate.submitted",
|
|
98
|
+
result: { job_id: data.job_id, status: "polling" },
|
|
99
|
+
next_steps: [],
|
|
100
|
+
hints: ["Waiting for clone generation to complete (typically 1-3 minutes)..."],
|
|
101
|
+
});
|
|
102
|
+
await pollJob(data.job_id);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
agentOutput({
|
|
106
|
+
action: "clone.generate.submitted",
|
|
107
|
+
result: { job_id: data.job_id, status: "queued" },
|
|
108
|
+
next_steps: [
|
|
109
|
+
{ command: `naive clone status ${data.job_id}`, description: "Check clone generation progress" },
|
|
110
|
+
{ command: `naive jobs get ${data.job_id}`, description: "Get full job details" },
|
|
111
|
+
],
|
|
112
|
+
hints: [
|
|
113
|
+
"Clone generation submitted",
|
|
114
|
+
"Credits deducted only on successful completion",
|
|
115
|
+
"Typical time: 1-3 minutes",
|
|
116
|
+
],
|
|
117
|
+
related_commands: ["naive clone status", "naive jobs"],
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
cloneCmd
|
|
122
|
+
.command("status <job_id>")
|
|
123
|
+
.description("Check the status of a clone generation job")
|
|
124
|
+
.addHelpText("after", `
|
|
125
|
+
Examples:
|
|
126
|
+
$ naive clone status 550e8400-e29b-41d4-a716-446655440000
|
|
127
|
+
|
|
128
|
+
When completed, the result includes the talking-video URL (result.url).
|
|
129
|
+
`)
|
|
130
|
+
.action(async (jobId) => {
|
|
131
|
+
const resp = await apiRequest("GET", `/v1/clone/${jobId}`);
|
|
132
|
+
handleApiError("clone.status", resp);
|
|
133
|
+
const data = resp.data;
|
|
134
|
+
agentOutput({
|
|
135
|
+
action: "clone.status",
|
|
136
|
+
result: resp.data,
|
|
137
|
+
next_steps: [
|
|
138
|
+
...(data.status === "completed" && data.result?.url
|
|
139
|
+
? [{ command: `# Download: curl -o clone.mp4 "${data.result.url}"`, description: "Download the talking video" }]
|
|
140
|
+
: []),
|
|
141
|
+
...(data.status === "queued" || data.status === "processing"
|
|
142
|
+
? [{ command: `naive clone status ${jobId}`, description: "Check again in 10-30 seconds" }]
|
|
143
|
+
: []),
|
|
144
|
+
],
|
|
145
|
+
hints: [`Job status: ${data.status}`],
|
|
146
|
+
related_commands: ["naive clone generate", "naive jobs"],
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
// Upload a local image and return its presigned public URL (so fal can GET it). Mirrors
|
|
150
|
+
// the local-file branch of `media upload` (multipart to /v1/media/upload/file).
|
|
151
|
+
async function uploadLocalImage(filePath) {
|
|
152
|
+
const fileBuffer = readFileSync(filePath);
|
|
153
|
+
const filename = basename(filePath);
|
|
154
|
+
const config = loadConfig();
|
|
155
|
+
const url = `${config.base_url}/v1/media/upload/file`;
|
|
156
|
+
const formData = new FormData();
|
|
157
|
+
formData.append("file", new Blob([fileBuffer]), filename);
|
|
158
|
+
const resp = await fetch(url, {
|
|
159
|
+
method: "POST",
|
|
160
|
+
headers: { Authorization: `Bearer ${getApiKey()}` },
|
|
161
|
+
body: formData,
|
|
162
|
+
});
|
|
163
|
+
// parseJsonOrUpstreamError never throws on a non-JSON gateway page; a non-JSON
|
|
164
|
+
// body comes back as { error: { code: "upstream_error", … } }, so the guard below
|
|
165
|
+
// routes it through formatApiError like any other failure.
|
|
166
|
+
const data = (await parseJsonOrUpstreamError(resp));
|
|
167
|
+
if (resp.status >= 400 || !data.url) {
|
|
168
|
+
formatApiError("clone.generate", data);
|
|
169
|
+
process.exit(1);
|
|
170
|
+
}
|
|
171
|
+
return data.url;
|
|
172
|
+
}
|
|
173
|
+
// Polls a clone job to completion for `clone generate --wait`. Mirrors video.ts's pollJob.
|
|
174
|
+
async function pollJob(jobId) {
|
|
175
|
+
while (true) {
|
|
176
|
+
await new Promise((r) => setTimeout(r, 3000));
|
|
177
|
+
const resp = await apiRequest("GET", `/v1/jobs/${jobId}`);
|
|
178
|
+
handleApiError("clone.generate.poll", resp);
|
|
179
|
+
const data = resp.data;
|
|
180
|
+
if (data.status === "completed" || data.status === "failed") {
|
|
181
|
+
const videoUrl = data.result?.url;
|
|
182
|
+
agentOutput({
|
|
183
|
+
action: "clone.generate.completed",
|
|
184
|
+
result: resp.data,
|
|
185
|
+
// On success surface a download command; on failure point at the full job details.
|
|
186
|
+
next_steps: data.status === "completed" && videoUrl
|
|
187
|
+
? [{ command: `curl -L -o clone.mp4 "${videoUrl}"`, description: "Download the talking video" }]
|
|
188
|
+
: [{ command: `naive jobs get ${jobId}`, description: "Get full job details" }],
|
|
189
|
+
hints: [
|
|
190
|
+
data.status === "completed"
|
|
191
|
+
? videoUrl
|
|
192
|
+
? `Clone generation complete — video: ${videoUrl}`
|
|
193
|
+
: "Clone generation complete"
|
|
194
|
+
: `Generation failed: ${data.error ?? "see job details"} (no credits deducted)`,
|
|
195
|
+
],
|
|
196
|
+
related_commands: ["naive clone generate", "naive clone status", "naive jobs"],
|
|
197
|
+
});
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
process.stderr.write(` Progress: ${data.progress ?? 0}% (${data.status})\n`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=clone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone.js","sourceRoot":"","sources":["../../src/commands/clone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE3D,uFAAuF;AACvF,+EAA+E;AAC/E,kFAAkF;AAClF,2FAA2F;AAC3F,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KACzC,WAAW,CAAC,+GAA+G,CAAC;KAC5H,WAAW,CAAC,OAAO,EAAE;;;;;;;;;;;;;CAavB,CAAC,CAAC;AAEH,QAAQ;KACL,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,qDAAqD,CAAC;KAClE,cAAc,CAAC,cAAc,EAAE,qEAAqE,CAAC;KACrG,cAAc,CAAC,oBAAoB,EAAE,2DAA2D,CAAC;KACjG,cAAc,CAAC,iBAAiB,EAAE,0CAA0C,CAAC;KAC7E,MAAM,CAAC,uBAAuB,EAAE,mEAAmE,CAAC;KACpG,SAAS,CAAC,IAAI,MAAM,CAAC,kBAAkB,EAAE,8GAA8G,CAAC,CAAC,O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@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* `naive companies` — the ORGANIZATION.
|
|
4
|
+
*
|
|
5
|
+
* `organization` is the product noun and the alias below is what the docs and
|
|
6
|
+
* help text use; `companies` stays as the command name, the route
|
|
7
|
+
* (`/v1/company`) and the config key, because every script and agent profile in
|
|
8
|
+
* the wild already types it.
|
|
9
|
+
*/
|
|
2
10
|
export declare const companiesCmd: Command;
|
|
@@ -2,51 +2,132 @@ import { Command } from "commander";
|
|
|
2
2
|
import { apiRequest, handleApiError } from "../client.js";
|
|
3
3
|
import { saveConfig } from "../config.js";
|
|
4
4
|
import { agentOutput } from "../output.js";
|
|
5
|
+
async function listCompanies() {
|
|
6
|
+
const resp = await apiRequest("GET", "/v1/auth/companies");
|
|
7
|
+
handleApiError("companies.list", resp);
|
|
8
|
+
const data = resp.data;
|
|
9
|
+
agentOutput({
|
|
10
|
+
action: "companies.list",
|
|
11
|
+
result: data,
|
|
12
|
+
next_steps: [
|
|
13
|
+
{ command: "naive organization select <company_id>", description: "Switch to a different organization context", when: "You want to operate under a different organization" },
|
|
14
|
+
{ command: "naive status", description: "See full status for current organization" },
|
|
15
|
+
],
|
|
16
|
+
hints: [
|
|
17
|
+
`Found ${data.companies?.length ?? 0} accessible organizations`,
|
|
18
|
+
"Use 'naive organization select <id>' to switch. A new API key will be issued for that organization.",
|
|
19
|
+
],
|
|
20
|
+
related_commands: ["naive organization select", "naive whoami", "naive status"],
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* `naive companies` — the ORGANIZATION.
|
|
25
|
+
*
|
|
26
|
+
* `organization` is the product noun and the alias below is what the docs and
|
|
27
|
+
* help text use; `companies` stays as the command name, the route
|
|
28
|
+
* (`/v1/company`) and the config key, because every script and agent profile in
|
|
29
|
+
* the wild already types it.
|
|
30
|
+
*/
|
|
5
31
|
export const companiesCmd = new Command("companies")
|
|
6
|
-
.
|
|
32
|
+
.alias("organization")
|
|
33
|
+
.alias("org")
|
|
34
|
+
.description("List/create/switch organizations accessible to the current agent")
|
|
7
35
|
.addHelpText("after", `
|
|
8
36
|
Examples:
|
|
9
|
-
$ naive companies
|
|
37
|
+
$ naive organization (alias of: naive companies)
|
|
38
|
+
$ naive companies list
|
|
39
|
+
$ naive companies create --name "ProbeCo"
|
|
40
|
+
$ naive organization select <company_id>
|
|
10
41
|
|
|
11
42
|
What this does:
|
|
12
|
-
Lists every
|
|
13
|
-
-
|
|
14
|
-
-
|
|
43
|
+
Lists every organization your agent/account has access to, showing:
|
|
44
|
+
- Organization ID (UUID)
|
|
45
|
+
- Organization name
|
|
15
46
|
- Current credit balance
|
|
16
47
|
- Billing tier (free, pro, enterprise)
|
|
17
48
|
|
|
18
49
|
Use this to:
|
|
19
50
|
- See which workspaces you can operate in
|
|
20
|
-
- Find
|
|
21
|
-
- Check credit balances across
|
|
51
|
+
- Find an organization ID to switch context with 'naive organization select'
|
|
52
|
+
- Check credit balances across organizations
|
|
53
|
+
- Create an additional workspace with 'naive companies create --name …'
|
|
22
54
|
`)
|
|
23
55
|
.action(async () => {
|
|
24
|
-
|
|
25
|
-
|
|
56
|
+
await listCompanies();
|
|
57
|
+
});
|
|
58
|
+
companiesCmd
|
|
59
|
+
.command("create")
|
|
60
|
+
.description("Create an additional company and switch the CLI to it")
|
|
61
|
+
.requiredOption("--name <name>", "Company / project name")
|
|
62
|
+
.addHelpText("after", `
|
|
63
|
+
Examples:
|
|
64
|
+
$ naive companies create --name "ProbeCo"
|
|
65
|
+
$ naive companies create --name "Acme Staging"
|
|
66
|
+
|
|
67
|
+
What this does:
|
|
68
|
+
1. Creates a new company owned by, and billed to, your current company's owner
|
|
69
|
+
2. Issues a fresh API key scoped to that company (sealed to its default user)
|
|
70
|
+
3. Overwrites ~/.naive/config.json with that key — same as 'companies select'
|
|
71
|
+
|
|
72
|
+
Notes:
|
|
73
|
+
- register already creates your first company; use this for extra workspaces
|
|
74
|
+
- Capped at 5 companies per owner, 3 creates per hour
|
|
75
|
+
- The owner is charged for the new company whichever key in your company runs
|
|
76
|
+
this. Read /docs/api-reference/auth/companies before wiring it into a loop.
|
|
77
|
+
`)
|
|
78
|
+
.action(async (opts) => {
|
|
79
|
+
const resp = await apiRequest("POST", "/v1/auth/companies", { name: opts.name });
|
|
80
|
+
handleApiError("companies.create", resp);
|
|
26
81
|
const data = resp.data;
|
|
82
|
+
saveConfig({
|
|
83
|
+
api_key: data.api_key,
|
|
84
|
+
agent_id: data.agent_id,
|
|
85
|
+
company_id: data.company_id,
|
|
86
|
+
company_name: data.company_name,
|
|
87
|
+
});
|
|
27
88
|
agentOutput({
|
|
28
|
-
action: "companies.
|
|
29
|
-
result:
|
|
89
|
+
action: "companies.create",
|
|
90
|
+
result: {
|
|
91
|
+
company_id: data.company_id,
|
|
92
|
+
company_name: data.company_name,
|
|
93
|
+
agent_id: data.agent_id,
|
|
94
|
+
credits: data.credits,
|
|
95
|
+
new_key_issued: true,
|
|
96
|
+
},
|
|
30
97
|
next_steps: [
|
|
31
|
-
{ command: "naive
|
|
32
|
-
{ command: "naive status", description: "See
|
|
98
|
+
{ command: "naive whoami", description: "Confirm the new organization context" },
|
|
99
|
+
{ command: "naive status", description: "See credits and API status" },
|
|
100
|
+
{ command: "naive apps create --name <name>", description: "Create an app in this organization" },
|
|
33
101
|
],
|
|
34
102
|
hints: [
|
|
35
|
-
`
|
|
36
|
-
"
|
|
103
|
+
`Created "${data.company_name}" and switched CLI context. New API key saved.`,
|
|
104
|
+
"The previous organization's key is no longer in ~/.naive/config.json — use 'naive organization select <id>' to go back.",
|
|
37
105
|
],
|
|
38
|
-
related_commands: ["naive companies select", "naive whoami", "naive status"],
|
|
106
|
+
related_commands: ["naive companies list", "naive organization select", "naive whoami", "naive status"],
|
|
39
107
|
});
|
|
40
108
|
});
|
|
109
|
+
// `naive companies list` — the bare `naive companies` used to reject any extra
|
|
110
|
+
// argument, so an agent that spelled the verb out got a usage error.
|
|
111
|
+
companiesCmd
|
|
112
|
+
.command("list")
|
|
113
|
+
.description("List all companies accessible to the current agent")
|
|
114
|
+
.addHelpText("after", `
|
|
115
|
+
Examples:
|
|
116
|
+
$ naive companies list
|
|
117
|
+
$ naive companies
|
|
118
|
+
`)
|
|
119
|
+
.action(async () => {
|
|
120
|
+
await listCompanies();
|
|
121
|
+
});
|
|
41
122
|
companiesCmd
|
|
42
123
|
.command("show")
|
|
43
124
|
.description("Show details of the current company")
|
|
44
125
|
.addHelpText("after", `
|
|
45
126
|
Examples:
|
|
46
|
-
$ naive
|
|
127
|
+
$ naive organization show
|
|
47
128
|
|
|
48
129
|
What this does:
|
|
49
|
-
Returns detailed information about the
|
|
130
|
+
Returns detailed information about the organization your agent is
|
|
50
131
|
currently operating under, including:
|
|
51
132
|
- Name and slug
|
|
52
133
|
- Description
|
|
@@ -55,8 +136,8 @@ What this does:
|
|
|
55
136
|
- Creation date
|
|
56
137
|
|
|
57
138
|
Use this to:
|
|
58
|
-
- Check the current
|
|
59
|
-
- See
|
|
139
|
+
- Check the current organization name
|
|
140
|
+
- See organization metadata before making changes
|
|
60
141
|
`)
|
|
61
142
|
.action(async () => {
|
|
62
143
|
const resp = await apiRequest("GET", "/v1/company");
|
|
@@ -65,14 +146,14 @@ Use this to:
|
|
|
65
146
|
action: "companies.show",
|
|
66
147
|
result: resp.data,
|
|
67
148
|
next_steps: [
|
|
68
|
-
{ command: "naive
|
|
69
|
-
{ command: "naive
|
|
149
|
+
{ command: "naive organization rename \"New Name\"", description: "Change the organization name", when: "The name needs updating" },
|
|
150
|
+
{ command: "naive organization update --description \"...\"", description: "Update the organization description" },
|
|
70
151
|
{ command: "naive status", description: "See credits and API status" },
|
|
71
152
|
],
|
|
72
153
|
hints: [
|
|
73
|
-
"Use 'naive
|
|
154
|
+
"Use 'naive organization rename' to change the organization name",
|
|
74
155
|
],
|
|
75
|
-
related_commands: ["naive
|
|
156
|
+
related_commands: ["naive organization rename", "naive organization update", "naive status"],
|
|
76
157
|
});
|
|
77
158
|
});
|
|
78
159
|
companiesCmd
|
|
@@ -80,16 +161,16 @@ companiesCmd
|
|
|
80
161
|
.description("Rename the current company")
|
|
81
162
|
.addHelpText("after", `
|
|
82
163
|
Examples:
|
|
83
|
-
$ naive
|
|
84
|
-
$ naive
|
|
164
|
+
$ naive organization rename "Acme Corp"
|
|
165
|
+
$ naive organization rename "My Startup Inc"
|
|
85
166
|
|
|
86
167
|
What this does:
|
|
87
|
-
Changes the display name of the
|
|
168
|
+
Changes the display name of the organization your agent currently
|
|
88
169
|
operates under. The slug and other identifiers remain unchanged.
|
|
89
170
|
|
|
90
171
|
Notes:
|
|
91
172
|
- The name must be a non-empty string
|
|
92
|
-
- This does not change the
|
|
173
|
+
- This does not change the organization slug or issue prefix
|
|
93
174
|
- The change takes effect immediately across the platform
|
|
94
175
|
`)
|
|
95
176
|
.action(async (name) => {
|
|
@@ -100,24 +181,24 @@ Notes:
|
|
|
100
181
|
action: "companies.rename",
|
|
101
182
|
result: data,
|
|
102
183
|
next_steps: [
|
|
103
|
-
{ command: "naive
|
|
184
|
+
{ command: "naive organization show", description: "Verify the updated organization details" },
|
|
104
185
|
{ command: "naive status", description: "See full status" },
|
|
105
186
|
],
|
|
106
187
|
hints: [
|
|
107
|
-
`
|
|
188
|
+
`Organization renamed to "${data.name}"`,
|
|
108
189
|
],
|
|
109
|
-
related_commands: ["naive
|
|
190
|
+
related_commands: ["naive organization show", "naive organization update", "naive status"],
|
|
110
191
|
});
|
|
111
192
|
});
|
|
112
193
|
companiesCmd
|
|
113
194
|
.command("update")
|
|
114
|
-
.description("Update
|
|
115
|
-
.option("--name <name>", "New
|
|
195
|
+
.description("Update organization details (name, description)")
|
|
196
|
+
.option("--name <name>", "New organization name")
|
|
116
197
|
.option("--description <description>", "Company description")
|
|
117
198
|
.addHelpText("after", `
|
|
118
199
|
Examples:
|
|
119
|
-
$ naive
|
|
120
|
-
$ naive
|
|
200
|
+
$ naive organization update --name "Acme Corp" --description "Building the future"
|
|
201
|
+
$ naive organization update --description "An AI-native startup"
|
|
121
202
|
|
|
122
203
|
What this does:
|
|
123
204
|
Updates one or more fields on the current company. At least one
|
|
@@ -135,31 +216,31 @@ What this does:
|
|
|
135
216
|
action: "companies.update",
|
|
136
217
|
result: resp.data,
|
|
137
218
|
next_steps: [
|
|
138
|
-
{ command: "naive
|
|
219
|
+
{ command: "naive organization show", description: "Verify the updated organization details" },
|
|
139
220
|
],
|
|
140
221
|
hints: [
|
|
141
222
|
"Company details updated successfully",
|
|
142
223
|
],
|
|
143
|
-
related_commands: ["naive
|
|
224
|
+
related_commands: ["naive organization show", "naive organization rename", "naive status"],
|
|
144
225
|
});
|
|
145
226
|
});
|
|
146
227
|
companiesCmd
|
|
147
228
|
.command("select <company_id>")
|
|
148
|
-
.description("Switch active
|
|
229
|
+
.description("Switch active organization context (issues a new API key for that organization)")
|
|
149
230
|
.addHelpText("after", `
|
|
150
231
|
Examples:
|
|
151
|
-
$ naive
|
|
232
|
+
$ naive organization select 550e8400-e29b-41d4-a716-446655440000
|
|
152
233
|
|
|
153
234
|
What this does:
|
|
154
|
-
1. Verifies you have access to the specified
|
|
155
|
-
2. Issues a new API key scoped to that
|
|
235
|
+
1. Verifies you have access to the specified organization
|
|
236
|
+
2. Issues a new API key scoped to that organization
|
|
156
237
|
3. Saves the new key to ~/.naive/config.json
|
|
157
|
-
4. All future commands operate under the new
|
|
238
|
+
4. All future commands operate under the new organization
|
|
158
239
|
|
|
159
240
|
Notes:
|
|
160
|
-
- Your old key for the previous
|
|
161
|
-
- Use 'naive
|
|
162
|
-
- The new key has access only to the selected
|
|
241
|
+
- Your old key for the previous organization remains valid
|
|
242
|
+
- Use 'naive organization' first to get the organization ID
|
|
243
|
+
- The new key has access only to the selected organization's resources
|
|
163
244
|
`)
|
|
164
245
|
.action(async (id) => {
|
|
165
246
|
const resp = await apiRequest("POST", "/v1/auth/select-company", { company_id: id });
|
|
@@ -170,6 +251,15 @@ Notes:
|
|
|
170
251
|
agent_id: data.agent_id,
|
|
171
252
|
company_id: data.company_id,
|
|
172
253
|
company_name: data.company_name,
|
|
254
|
+
// A project belongs to ONE organization, so a project selected in the old
|
|
255
|
+
// one is meaningless — and worse than meaningless: it would be sent as
|
|
256
|
+
// `X-Naive-Project-Id` against the new organization and 404 every command
|
|
257
|
+
// until the operator guessed why. Same for the child project inside it,
|
|
258
|
+
// which is why the organization switch also invalidates any prior
|
|
259
|
+
// `naive use` subject.
|
|
260
|
+
active_project_id: undefined,
|
|
261
|
+
active_project_name: undefined,
|
|
262
|
+
active_user_id: undefined,
|
|
173
263
|
});
|
|
174
264
|
agentOutput({
|
|
175
265
|
action: "companies.select",
|
|
@@ -179,13 +269,13 @@ Notes:
|
|
|
179
269
|
new_key_issued: true,
|
|
180
270
|
},
|
|
181
271
|
next_steps: [
|
|
182
|
-
{ command: "naive identity", description: "View resources available in the new
|
|
272
|
+
{ command: "naive identity", description: "View resources available in the new organization context" },
|
|
183
273
|
{ command: "naive email inboxes", description: "Check email addresses for this company" },
|
|
184
274
|
{ command: "naive status", description: "See credits and status for this company" },
|
|
185
275
|
],
|
|
186
276
|
hints: [
|
|
187
277
|
`Now operating under "${data.company_name}". New API key saved.`,
|
|
188
|
-
"All subsequent commands use the new
|
|
278
|
+
"All subsequent commands use the new organization context.",
|
|
189
279
|
],
|
|
190
280
|
related_commands: ["naive whoami", "naive identity", "naive status"],
|
|
191
281
|
});
|
|
@@ -1 +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,CA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