replicas-cli 0.3.677 → 0.3.678
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.cjs +48 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -43555,7 +43555,7 @@ var CLI_VERSION;
|
|
|
43555
43555
|
var init_cli_version = __esm({
|
|
43556
43556
|
"../shared/src/cli-version.ts"() {
|
|
43557
43557
|
"use strict";
|
|
43558
|
-
CLI_VERSION = "0.3.
|
|
43558
|
+
CLI_VERSION = "0.3.678";
|
|
43559
43559
|
}
|
|
43560
43560
|
});
|
|
43561
43561
|
|
|
@@ -44059,6 +44059,22 @@ var init_doppler = __esm({
|
|
|
44059
44059
|
});
|
|
44060
44060
|
|
|
44061
44061
|
// ../shared/src/routes/organization.ts
|
|
44062
|
+
function isOrganizationMemberRole(value) {
|
|
44063
|
+
return value === "admin" || value === "member";
|
|
44064
|
+
}
|
|
44065
|
+
function parseInviteEmails(raw) {
|
|
44066
|
+
const seen = /* @__PURE__ */ new Set();
|
|
44067
|
+
const emails = [];
|
|
44068
|
+
for (const part of raw.split(/[,;\n\r]+/)) {
|
|
44069
|
+
const email3 = part.trim();
|
|
44070
|
+
if (!email3) continue;
|
|
44071
|
+
const key2 = email3.toLowerCase();
|
|
44072
|
+
if (seen.has(key2)) continue;
|
|
44073
|
+
seen.add(key2);
|
|
44074
|
+
emails.push(email3);
|
|
44075
|
+
}
|
|
44076
|
+
return emails;
|
|
44077
|
+
}
|
|
44062
44078
|
var init_organization = __esm({
|
|
44063
44079
|
"../shared/src/routes/organization.ts"() {
|
|
44064
44080
|
"use strict";
|
|
@@ -56541,11 +56557,41 @@ async function orgMembersCommand() {
|
|
|
56541
56557
|
}
|
|
56542
56558
|
});
|
|
56543
56559
|
}
|
|
56560
|
+
async function orgInviteCommand(rawEmails, options) {
|
|
56561
|
+
if (isAgentMode() || getApiKey()) {
|
|
56562
|
+
throw new Error('Inviting members requires a logged-in admin account. Run "replicas login" first.');
|
|
56563
|
+
}
|
|
56564
|
+
if (!isAuthenticated()) throw new Error(NOT_LOGGED_IN);
|
|
56565
|
+
const role = options.role ?? "member";
|
|
56566
|
+
if (!isOrganizationMemberRole(role)) {
|
|
56567
|
+
throw new Error('Role must be "member" or "admin".');
|
|
56568
|
+
}
|
|
56569
|
+
const emails = parseInviteEmails(rawEmails.join(","));
|
|
56570
|
+
if (emails.length === 0) {
|
|
56571
|
+
throw new Error("Provide at least one email address.");
|
|
56572
|
+
}
|
|
56573
|
+
const result = await orgAuthenticatedFetch("/v1/organization/invites/bulk", {
|
|
56574
|
+
method: "POST",
|
|
56575
|
+
body: { emails, role }
|
|
56576
|
+
});
|
|
56577
|
+
output2(result, ({ invited, failed }) => {
|
|
56578
|
+
for (const invite of invited) {
|
|
56579
|
+
console.log(import_chalk14.default.green(` \u2713 Invited ${invite.email} (${invite.role})`));
|
|
56580
|
+
}
|
|
56581
|
+
for (const item of failed) {
|
|
56582
|
+
console.log(import_chalk14.default.red(` \u2717 ${item.email}: ${item.error}`));
|
|
56583
|
+
}
|
|
56584
|
+
});
|
|
56585
|
+
if (result.failed.length > 0) {
|
|
56586
|
+
process.exitCode = 1;
|
|
56587
|
+
}
|
|
56588
|
+
}
|
|
56544
56589
|
var import_chalk14, NOT_LOGGED_IN;
|
|
56545
56590
|
var init_org = __esm({
|
|
56546
56591
|
"src/commands/org.ts"() {
|
|
56547
56592
|
"use strict";
|
|
56548
56593
|
import_chalk14 = __toESM(require("chalk"));
|
|
56594
|
+
init_src();
|
|
56549
56595
|
init_api2();
|
|
56550
56596
|
init_command_utils();
|
|
56551
56597
|
init_oauth_flow_ui();
|
|
@@ -62798,6 +62844,7 @@ var init_src2 = __esm({
|
|
|
62798
62844
|
org = program.command("org").description("Manage organizations");
|
|
62799
62845
|
org.command("switch").description("Switch to a different organization").action(run(orgSwitchCommand));
|
|
62800
62846
|
org.command("members").description("List organization members and their user IDs").action(run(orgMembersCommand));
|
|
62847
|
+
org.command("invite <emails...>").description("Invite one or more people to the active organization (space or comma separated)").option("-r, --role <role>", "Role to assign (member or admin)", "member").action(run((emails, options) => orgInviteCommand(emails, options)));
|
|
62801
62848
|
org.action(run(orgCommand));
|
|
62802
62849
|
program.command("connect <workspace-name...>").description("Connect to a workspace via SSH").action(run((workspaceName) => connectCommand(workspaceName.join(" "))));
|
|
62803
62850
|
program.command("tunnel <workspace-name...>").description("Forward a workspace port to localhost").requiredOption("-p, --port <port>", "Workspace port to forward").option("-l, --local-port <port>", "Local port (defaults to the workspace port)").action(run((workspaceName, options) => tunnelCommand(workspaceName.join(" "), options)));
|