@rigxyz/tapd 0.5.3 → 0.6.1

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/bin.js CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  ImportValidationFailed,
7
7
  InvalidInviteUrlError,
8
8
  NotInitializedError,
9
+ OrgForbiddenError,
9
10
  RelayClient,
10
11
  STATE_KEY_CONFLICT_COUNT,
11
12
  addImport,
@@ -25,7 +26,7 @@ import {
25
26
  revoke,
26
27
  safeResolveRigPath,
27
28
  start
28
- } from "./chunk-QZHSLNCO.js";
29
+ } from "./chunk-RKOWUM3D.js";
29
30
 
30
31
  // src/bin.ts
31
32
  import { join as pathJoin, resolve } from "path";
@@ -279,7 +280,7 @@ import { existsSync as existsSync4 } from "fs";
279
280
  import { join as join4 } from "path";
280
281
 
281
282
  // src/version.ts
282
- var TAPD_VERSION = "0.5.3";
283
+ var TAPD_VERSION = "0.6.1";
283
284
 
284
285
  // src/status.ts
285
286
  var STATE_KEY_LAST_APPLY_ERROR = "last_apply_error";
@@ -588,6 +589,7 @@ ${C.bold().cyan("tapd init OPTIONS")}
588
589
  ${C.dim("--name <n>")} binding display name (required)
589
590
  ${C.dim("--relay <url>")} override (defaults to the logged-in relay)
590
591
  ${C.dim("--device-label <l>")} default 'owner'
592
+ ${C.dim("--org <slug>")} create this binding under an org you belong to
591
593
  ${C.dim("--dir <path>")} default cwd
592
594
 
593
595
  ${C.bold().cyan("tapd join OPTIONS")}
@@ -790,7 +792,8 @@ async function runInvite(positional2, flags2) {
790
792
  printJson({
791
793
  protocolVersion: PROTOCOL_VERSION,
792
794
  invite: result.invite,
793
- url: result.url
795
+ url: result.url,
796
+ email: result.email
794
797
  });
795
798
  return;
796
799
  }
@@ -812,6 +815,11 @@ async function runInvite(positional2, flags2) {
812
815
  );
813
816
  if (result.invite.emailConstraint) {
814
817
  console.log(` email: ${result.invite.emailConstraint}`);
818
+ console.log(
819
+ ` ${C.dim(
820
+ result.email.sent ? "\u21B3 notification sent" : `\u21B3 notification not sent (${result.email.reason})`
821
+ )}`
822
+ );
815
823
  }
816
824
  if (result.invite.label) {
817
825
  console.log(` label: ${result.invite.label}`);
@@ -1372,9 +1380,17 @@ async function runInit(flags2) {
1372
1380
  const relayUrl = flags2.get("relay") ?? process.env.RIG_RELAY_URL ?? DEFAULT_RELAY_URL;
1373
1381
  const rootDir = resolve(flags2.get("dir") ?? process.cwd());
1374
1382
  const deviceLabel = flags2.get("device-label");
1383
+ const orgRaw = flags2.get("org");
1384
+ if (orgRaw !== void 0 && (typeof orgRaw !== "string" || !orgRaw.trim() || orgRaw.startsWith("-"))) {
1385
+ const msg = "--org requires a slug (e.g. --org acme-labs)";
1386
+ if (json) printJsonError("invalid_flag", msg);
1387
+ else console.error(kleur.red("error:"), msg);
1388
+ process.exit(2);
1389
+ }
1390
+ const org = orgRaw;
1375
1391
  let result;
1376
1392
  try {
1377
- result = await init({ rootDir, relayUrl, accessToken, bindingName: name, deviceLabel });
1393
+ result = await init({ rootDir, relayUrl, accessToken, bindingName: name, deviceLabel, org });
1378
1394
  } catch (err) {
1379
1395
  if (err instanceof AlreadyInitializedError) {
1380
1396
  if (json) printJsonError("already_initialized", err.message);
@@ -1384,6 +1400,11 @@ async function runInit(flags2) {
1384
1400
  }
1385
1401
  process.exit(1);
1386
1402
  }
1403
+ if (err instanceof OrgForbiddenError) {
1404
+ if (json) printJsonError("org_forbidden", err.message);
1405
+ else console.error(kleur.red("error:"), err.message);
1406
+ process.exit(1);
1407
+ }
1387
1408
  throw err;
1388
1409
  }
1389
1410
  if (json) {