@rigxyz/tapd 0.6.5 → 0.6.7

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
@@ -23,13 +23,14 @@ import {
23
23
  loadImportMounts,
24
24
  mint,
25
25
  openStateDb,
26
+ quarantineFiles,
26
27
  readBindingConfig,
27
28
  readNotSynced,
28
29
  removeImport,
29
30
  revoke,
30
31
  safeResolveRigPath,
31
32
  start
32
- } from "./chunk-7RKYNS5V.js";
33
+ } from "./chunk-32K6ANXS.js";
33
34
 
34
35
  // src/bin.ts
35
36
  import { join as pathJoin, resolve } from "path";
@@ -266,9 +267,9 @@ async function restore(opts) {
266
267
  const overwrote = existsSync3(targetAbs);
267
268
  mkdirSync2(dirname2(targetAbs), { recursive: true });
268
269
  const tmp = `${targetAbs}.tap-restore-tmp.${Date.now().toString(36)}`;
269
- const mode = writeEvent.executable ? 493 : 420;
270
- writeFileSync2(tmp, bytes, { mode });
270
+ writeFileSync2(tmp, bytes, { mode: 420 });
271
271
  renameSync(tmp, targetAbs);
272
+ await quarantineFiles([targetAbs]);
272
273
  return {
273
274
  path: opts.path,
274
275
  restoredFromCursor: writeEvent.id,
@@ -283,7 +284,7 @@ import { existsSync as existsSync4 } from "fs";
283
284
  import { join as join4 } from "path";
284
285
 
285
286
  // src/version.ts
286
- var TAPD_VERSION = "0.6.5";
287
+ var TAPD_VERSION = "0.6.7";
287
288
 
288
289
  // src/status.ts
289
290
  var STATE_KEY_LAST_APPLY_ERROR = "last_apply_error";
@@ -596,6 +597,8 @@ ${C.bold().cyan("tapd init OPTIONS")}
596
597
  ${C.dim("--relay <url>")} override (defaults to the logged-in relay)
597
598
  ${C.dim("--device-label <l>")} default 'owner'
598
599
  ${C.dim("--org <slug>")} create this binding under an org you belong to
600
+ ${C.dim("--kind <rig|space>")} create it as a space (default: rig)
601
+ ${C.dim("--defer-upload")} create the binding only; \`tapd start\` uploads the files
599
602
  ${C.dim("--dir <path>")} default cwd
600
603
 
601
604
  ${C.bold().cyan("tapd join OPTIONS")}
@@ -1158,6 +1161,20 @@ async function runStatus(flags2) {
1158
1161
  );
1159
1162
  for (const f of tooLarge) console.log(C.dim(` ${f.path}`));
1160
1163
  }
1164
+ const ownerOnly = report.notSynced.filter((f) => f.reason === "owner_only");
1165
+ if (ownerOnly.length > 0) {
1166
+ console.log(
1167
+ ` ${C.yellow(`${plural(ownerOnly.length)} not synced`)}: agent instructions only the space's owner can change`
1168
+ );
1169
+ for (const f of ownerOnly) console.log(C.dim(` ${f.path}`));
1170
+ }
1171
+ const protectedPaths = report.notSynced.filter((f) => f.reason === "protected");
1172
+ if (protectedPaths.length > 0) {
1173
+ console.log(
1174
+ ` ${C.yellow(`${plural(protectedPaths.length)} not synced`)}: protected paths never sync between members`
1175
+ );
1176
+ for (const f of protectedPaths) console.log(C.dim(` ${f.path}`));
1177
+ }
1161
1178
  } else {
1162
1179
  console.log(C.dim(" (import-only meta-rig \u2014 no primary binding)"));
1163
1180
  }
@@ -1426,9 +1443,18 @@ async function runInit(flags2) {
1426
1443
  process.exit(2);
1427
1444
  }
1428
1445
  const org = orgRaw;
1446
+ const kindRaw = flags2.get("kind");
1447
+ if (kindRaw !== void 0 && kindRaw !== "rig" && kindRaw !== "space") {
1448
+ const msg = "--kind must be rig or space";
1449
+ if (json) printJsonError("invalid_flag", msg);
1450
+ else console.error(kleur.red("error:"), msg);
1451
+ process.exit(2);
1452
+ }
1453
+ const kind = kindRaw;
1454
+ const deferUpload = flags2.get("defer-upload") === true;
1429
1455
  let result;
1430
1456
  try {
1431
- result = await init({ rootDir, relayUrl, accessToken, bindingName: name, deviceLabel, org });
1457
+ result = await init({ rootDir, relayUrl, accessToken, bindingName: name, deviceLabel, org, kind, deferUpload });
1432
1458
  } catch (err) {
1433
1459
  if (err instanceof AlreadyInitializedError) {
1434
1460
  if (json) printJsonError("already_initialized", err.message);
@@ -1450,6 +1476,8 @@ async function runInit(flags2) {
1450
1476
  protocolVersion: PROTOCOL_VERSION,
1451
1477
  bindingId: result.binding.id,
1452
1478
  bindingName: result.binding.name,
1479
+ // What the relay made (an older relay ignores `kind` and says nothing).
1480
+ kind: result.binding.kind ?? null,
1453
1481
  deviceId: result.device.id,
1454
1482
  deviceLabel: result.device.label,
1455
1483
  relayUrl,
@@ -1458,6 +1486,7 @@ async function runInit(flags2) {
1458
1486
  reusedHashes: result.reusedHashes,
1459
1487
  submittedEvents: result.submittedEvents,
1460
1488
  cursor: result.cursor,
1489
+ deferredUpload: result.deferredUpload,
1461
1490
  warnings: result.warnings
1462
1491
  });
1463
1492
  return;