@wervt/cli 0.2.12 → 0.2.14

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.mjs CHANGED
@@ -421,7 +421,7 @@ const toList = (value) => (Array.isArray(value) ? value : value === void 0 ? []
421
421
  const access = defineCommand({
422
422
  meta: {
423
423
  name: "access",
424
- description: "Show or change who can open an app (private apps need a login)"
424
+ description: "Show or change who can open an app (private and invite-only apps need a login); --remove takes back invites too"
425
425
  },
426
426
  args: {
427
427
  app: {
@@ -437,6 +437,10 @@ const access = defineCommand({
437
437
  type: "boolean",
438
438
  description: "Make the app private"
439
439
  },
440
+ invite: {
441
+ type: "boolean",
442
+ description: "Make the app private, and let people with access invite others in the app"
443
+ },
440
444
  add: {
441
445
  type: "string",
442
446
  description: "Allow emails or *@domain (comma separated)"
@@ -451,6 +455,7 @@ const access = defineCommand({
451
455
  const change = {};
452
456
  if (args.public) change.visibility = "public";
453
457
  if (args.private) change.visibility = "private";
458
+ if (args.invite) change.visibility = "invite";
454
459
  if (args.add) change.add = toList(args.add);
455
460
  if (args.remove) change.remove = toList(args.remove);
456
461
  const result = await (Object.keys(change).length ? await api(`/v1/apps/${args.app}/access`, args, {
@@ -459,8 +464,14 @@ const access = defineCommand({
459
464
  body: JSON.stringify(change)
460
465
  }) : await api(`/v1/apps/${args.app}/access`, args)).json();
461
466
  if (args.app === "auth") return console.log("auth is the login app and always public");
462
- console.log(`${args.app} is ${result.visibility}`);
463
- if (result.visibility === "private") console.log(result.allow.length ? `allowed: ${result.allow.join(", ")}` : "allowed: admins only");
467
+ console.log(`${args.app} is ${result.visibility === "invite" ? "invite-only" : result.visibility}`);
468
+ if (result.visibility === "public") return;
469
+ console.log(result.allow.length ? `allowed: ${result.allow.join(", ")}` : "allowed: admins only");
470
+ if (result.visibility === "invite") {
471
+ const invited = result.invited ?? [];
472
+ console.log(invited.length ? "invited:" : "invited: nobody yet");
473
+ for (const invite of invited) console.log(` ${invite.email} (by ${invite.by}, ${invite.at.slice(0, 10)})`);
474
+ }
464
475
  }
465
476
  });
466
477
  const members = defineCommand({
@@ -543,6 +554,48 @@ const env = defineCommand({
543
554
  if (Object.keys(set).length || unset.length) console.log("Applies from the next request.");
544
555
  }
545
556
  });
557
+ const accounts = defineCommand({
558
+ meta: {
559
+ name: "accounts",
560
+ description: "Admins: list accounts and their app limits, or set one"
561
+ },
562
+ args: {
563
+ email: {
564
+ type: "positional",
565
+ required: false,
566
+ description: "Account to change"
567
+ },
568
+ apps: {
569
+ type: "string",
570
+ description: "Apps the account may own: a number, \"none\" for no limit, \"default\""
571
+ },
572
+ ...connection
573
+ },
574
+ async run({ args }) {
575
+ if (args.email) {
576
+ if (!args.apps) throw new Error("Pass --apps <n|none|default> to change the limit");
577
+ const apps = args.apps === "none" ? null : args.apps === "default" ? "default" : Number(args.apps);
578
+ const result = await (await api(`/v1/accounts/${encodeURIComponent(args.email)}`, args, {
579
+ method: "PATCH",
580
+ headers: { "content-type": "application/json" },
581
+ body: JSON.stringify({ apps })
582
+ })).json();
583
+ return console.log(`${result.email}: ${result.limits.apps ?? "no limit"} apps`);
584
+ }
585
+ const result = await (await api("/v1/accounts", args)).json();
586
+ console.log(`default: ${result.defaults.apps ?? "no limit"} apps per account`);
587
+ for (const account of result.accounts) {
588
+ const list = account.apps.length ? ` ${account.apps.join(", ")}` : "";
589
+ if (account.admin) {
590
+ console.log(`${account.email} ${account.apps.length} apps (admin)${list}`);
591
+ continue;
592
+ }
593
+ const limit = account.limits.apps ?? "no limit";
594
+ const own = "apps" in account.custom ? "" : " (default)";
595
+ console.log(`${account.email} ${account.apps.length}/${limit}${own}${list}`);
596
+ }
597
+ }
598
+ });
546
599
  const tokens = defineCommand({
547
600
  meta: {
548
601
  name: "tokens",
@@ -983,6 +1036,7 @@ runMain(defineCommand({
983
1036
  reprovision,
984
1037
  access,
985
1038
  members,
1039
+ accounts,
986
1040
  env,
987
1041
  tokens,
988
1042
  tasks,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wervt/cli",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "Deploy and manage apps on wervt.",
5
5
  "keywords": [
6
6
  "agents",
package/skill/SKILL.md CHANGED
@@ -65,6 +65,7 @@ existing app, work in its repository instead.
65
65
  pnpm exec wervt deploy # build, upload, migrate, activate
66
66
  pnpm exec wervt access <name> --public # new apps are private (owner, members, admins)
67
67
  pnpm exec wervt access <name> --add a@x.com,*@company.com # or let specific people in
68
+ pnpm exec wervt access <name> --invite # private, and people with access invite others (useWervtAccess)
68
69
  pnpm exec wervt members <name> --add a@x.com # who may deploy and manage it (the first deploy owns it)
69
70
  pnpm exec wervt env <name> --set KEY=value # server env vars, applied from the next request
70
71
  ```