@rigxyz/tapd 0.5.3 → 0.6.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/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-GIL4KPR7.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.0";
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")}
@@ -1372,9 +1374,17 @@ async function runInit(flags2) {
1372
1374
  const relayUrl = flags2.get("relay") ?? process.env.RIG_RELAY_URL ?? DEFAULT_RELAY_URL;
1373
1375
  const rootDir = resolve(flags2.get("dir") ?? process.cwd());
1374
1376
  const deviceLabel = flags2.get("device-label");
1377
+ const orgRaw = flags2.get("org");
1378
+ if (orgRaw !== void 0 && (typeof orgRaw !== "string" || !orgRaw.trim() || orgRaw.startsWith("-"))) {
1379
+ const msg = "--org requires a slug (e.g. --org acme-labs)";
1380
+ if (json) printJsonError("invalid_flag", msg);
1381
+ else console.error(kleur.red("error:"), msg);
1382
+ process.exit(2);
1383
+ }
1384
+ const org = orgRaw;
1375
1385
  let result;
1376
1386
  try {
1377
- result = await init({ rootDir, relayUrl, accessToken, bindingName: name, deviceLabel });
1387
+ result = await init({ rootDir, relayUrl, accessToken, bindingName: name, deviceLabel, org });
1378
1388
  } catch (err) {
1379
1389
  if (err instanceof AlreadyInitializedError) {
1380
1390
  if (json) printJsonError("already_initialized", err.message);
@@ -1384,6 +1394,11 @@ async function runInit(flags2) {
1384
1394
  }
1385
1395
  process.exit(1);
1386
1396
  }
1397
+ if (err instanceof OrgForbiddenError) {
1398
+ if (json) printJsonError("org_forbidden", err.message);
1399
+ else console.error(kleur.red("error:"), err.message);
1400
+ process.exit(1);
1401
+ }
1387
1402
  throw err;
1388
1403
  }
1389
1404
  if (json) {