@erdoai/cli 0.47.0 → 0.48.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/dist/index.js +24 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -246,6 +246,9 @@ var ErdoClient = class {
|
|
|
246
246
|
listOrganizations() {
|
|
247
247
|
return this.request("GET", "/v1/organizations");
|
|
248
248
|
}
|
|
249
|
+
createOrganization(input) {
|
|
250
|
+
return this.request("POST", "/v1/organizations", input);
|
|
251
|
+
}
|
|
249
252
|
// --- API tokens (user credentials; default_org is only the header-absent fallback) ---
|
|
250
253
|
createToken(input) {
|
|
251
254
|
return this.request("POST", "/v1/tokens", input);
|
|
@@ -1435,6 +1438,27 @@ org.command("use [idOrSlug]").description("Set the active org for the current ac
|
|
|
1435
1438
|
fail(e);
|
|
1436
1439
|
}
|
|
1437
1440
|
});
|
|
1441
|
+
org.command("create <name>").description("Create a new organization").option("--slug <slug>", "desired slug (generated from the name if omitted, trying numeric suffixes on collision)").option("--use", "switch the active org to the new one after creation").action(async (name, opts) => {
|
|
1442
|
+
try {
|
|
1443
|
+
const o = await new ErdoClient().createOrganization({
|
|
1444
|
+
name,
|
|
1445
|
+
slug: opts.slug,
|
|
1446
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
1447
|
+
});
|
|
1448
|
+
console.log(`Created org: ${o.name}`);
|
|
1449
|
+
console.log(`slug: ${o.slug}
|
|
1450
|
+
id: ${o.id}`);
|
|
1451
|
+
if (opts.use) {
|
|
1452
|
+
updateActiveAccount({ organizationId: o.id, organizationName: o.name });
|
|
1453
|
+
console.log(`Active org: ${o.name}`);
|
|
1454
|
+
} else {
|
|
1455
|
+
process.stderr.write(`Switch to it with: erdo org use ${o.slug}
|
|
1456
|
+
`);
|
|
1457
|
+
}
|
|
1458
|
+
} catch (e) {
|
|
1459
|
+
fail(e);
|
|
1460
|
+
}
|
|
1461
|
+
});
|
|
1438
1462
|
org.command("autonomy [mode]").description("Show or set the org's engine-autonomy mode (autopilot | propose | strict)").action(async (mode) => {
|
|
1439
1463
|
try {
|
|
1440
1464
|
const api = new ErdoClient();
|