@vatio-ai/cli 0.97.0 → 0.98.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/lib/api-client.mjs +2 -1
- package/lib/commands/misc.mjs +5 -1
- package/package.json +1 -1
package/lib/api-client.mjs
CHANGED
|
@@ -343,9 +343,10 @@ export class CliClient extends HttpClient {
|
|
|
343
343
|
return this.get("/api/developer/v1/workspaces");
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
-
createWorkspace({ slug, name = null }) {
|
|
346
|
+
createWorkspace({ slug, name = null, organization = null }) {
|
|
347
347
|
const body = { slug };
|
|
348
348
|
if (String(name ?? "").trim() !== "") body.name = String(name).trim();
|
|
349
|
+
if (String(organization ?? "").trim() !== "") body.organization = String(organization).trim().toLowerCase();
|
|
349
350
|
return this.post("/api/developer/v1/workspaces", body);
|
|
350
351
|
}
|
|
351
352
|
|
package/lib/commands/misc.mjs
CHANGED
|
@@ -120,6 +120,7 @@ export async function init(config, args) {
|
|
|
120
120
|
// and swallowing it keeps it out of the slug below.
|
|
121
121
|
takeValue(args, "--base-url");
|
|
122
122
|
const name = takeValue(args, "--name");
|
|
123
|
+
const organization = takeValue(args, "--org");
|
|
123
124
|
|
|
124
125
|
const target = process.cwd();
|
|
125
126
|
const existing = manifestPath(target);
|
|
@@ -140,9 +141,12 @@ export async function init(config, args) {
|
|
|
140
141
|
// No login here: identity is what `push` needs, because `push` is the first
|
|
141
142
|
// thing that makes something run on a server. This writes a file.
|
|
142
143
|
const authorized = Boolean(config.resolveToken());
|
|
144
|
+
if (organization && !authorized) {
|
|
145
|
+
fail("--org adds the workspace to an organization you own, which needs your account: run `vatio login` first.");
|
|
146
|
+
}
|
|
143
147
|
if (authorized) {
|
|
144
148
|
const clients = workspacesClient(config);
|
|
145
|
-
if (!(await clients.workspaceExists(slug))) await clients.createWorkspace({ slug, name });
|
|
149
|
+
if (!(await clients.workspaceExists(slug))) await clients.createWorkspace({ slug, name, organization });
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
const manifest = join(target, MANIFEST_FILE);
|