@rigxyz/tapd 0.6.3 → 0.6.5

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
@@ -5,6 +5,7 @@ import {
5
5
  ImportTokenScopeError,
6
6
  ImportValidationFailed,
7
7
  InvalidInviteUrlError,
8
+ MAX_FILE_BYTES,
8
9
  NotInitializedError,
9
10
  OrgForbiddenError,
10
11
  RelayClient,
@@ -15,6 +16,7 @@ import {
15
16
  findConflictSidecars,
16
17
  importStateDbPath,
17
18
  init,
19
+ isSyncPaused,
18
20
  join,
19
21
  list,
20
22
  loadIgnore,
@@ -22,11 +24,12 @@ import {
22
24
  mint,
23
25
  openStateDb,
24
26
  readBindingConfig,
27
+ readNotSynced,
25
28
  removeImport,
26
29
  revoke,
27
30
  safeResolveRigPath,
28
31
  start
29
- } from "./chunk-54AIKODH.js";
32
+ } from "./chunk-7RKYNS5V.js";
30
33
 
31
34
  // src/bin.ts
32
35
  import { join as pathJoin, resolve } from "path";
@@ -280,7 +283,7 @@ import { existsSync as existsSync4 } from "fs";
280
283
  import { join as join4 } from "path";
281
284
 
282
285
  // src/version.ts
283
- var TAPD_VERSION = "0.6.3";
286
+ var TAPD_VERSION = "0.6.5";
284
287
 
285
288
  // src/status.ts
286
289
  var STATE_KEY_LAST_APPLY_ERROR = "last_apply_error";
@@ -301,6 +304,7 @@ function statusToJson(report) {
301
304
  trackedPaths: report.trackedPaths,
302
305
  pendingApplies: report.pendingApplies,
303
306
  pendingUploads: report.pendingUploads,
307
+ notSynced: report.notSynced,
304
308
  conflicts: report.conflicts,
305
309
  lastApplyError: report.lastApplyError,
306
310
  offline: report.offline,
@@ -355,6 +359,7 @@ async function status(opts) {
355
359
  pendingPeek: [],
356
360
  pendingApplies: 0,
357
361
  pendingUploads: 0,
362
+ notSynced: [],
358
363
  conflicts: [],
359
364
  conflictCount: 0,
360
365
  lastApplyError: null,
@@ -415,6 +420,7 @@ async function status(opts) {
415
420
  pendingPeek,
416
421
  pendingApplies,
417
422
  pendingUploads,
423
+ notSynced: readNotSynced(db),
418
424
  conflicts,
419
425
  conflictCount,
420
426
  lastApplyError,
@@ -1135,6 +1141,23 @@ async function runStatus(flags2) {
1135
1141
  ` last err: ${C.red(e.reason)} ${C.dim(`(${e.op} ${e.path} @ ${e.eventId}${e.at ? `, ${e.at}` : ""})`)}`
1136
1142
  );
1137
1143
  }
1144
+ const overQuota = report.notSynced.filter((f) => f.reason === "quota_exceeded");
1145
+ const tooLarge = report.notSynced.filter((f) => f.reason === "file_too_large");
1146
+ const mb = (n) => `${Math.round(n / (1024 * 1024))} MB`;
1147
+ const plural = (n) => `${n} file${n === 1 ? "" : "s"}`;
1148
+ if (overQuota.length > 0) {
1149
+ const limit = overQuota.find((f) => f.limitBytes !== void 0)?.limitBytes;
1150
+ console.log(
1151
+ ` ${C.yellow(`${plural(overQuota.length)} not synced`)}: over the space's ${limit ? `${mb(limit)} ` : ""}storage limit`
1152
+ );
1153
+ for (const f of overQuota) console.log(C.dim(` ${f.path}`));
1154
+ }
1155
+ if (tooLarge.length > 0) {
1156
+ console.log(
1157
+ ` ${C.yellow(`${plural(tooLarge.length)} not synced`)}: over the ${mb(MAX_FILE_BYTES)} per-file limit`
1158
+ );
1159
+ for (const f of tooLarge) console.log(C.dim(` ${f.path}`));
1160
+ }
1138
1161
  } else {
1139
1162
  console.log(C.dim(" (import-only meta-rig \u2014 no primary binding)"));
1140
1163
  }
@@ -1210,6 +1233,11 @@ async function runUninit(flags2) {
1210
1233
  }
1211
1234
  async function runStart(flags2) {
1212
1235
  const rootDir = resolve(flags2.get("dir") ?? process.cwd());
1236
+ if (isSyncPaused(rootDir)) {
1237
+ console.log(kleur.dim("tapd start: sync is paused for this workspace (.rig/sync-paused.json) \u2014 not starting."));
1238
+ console.log(kleur.dim(" run `rig resume` to start syncing again."));
1239
+ process.exit(0);
1240
+ }
1213
1241
  const pollSeconds = flags2.has("poll-seconds") ? Number(flags2.get("poll-seconds")) : void 0;
1214
1242
  const pidfilePath = flags2.get("no-pidfile") === true ? null : pathJoin(rootDir, DAEMON_PIDFILE_REL3);
1215
1243
  let handle = null;
@@ -1241,7 +1269,17 @@ async function runStart(flags2) {
1241
1269
  }
1242
1270
  }
1243
1271
  try {
1244
- handle = await start({ rootDir, pollSeconds });
1272
+ handle = await start({
1273
+ rootDir,
1274
+ pollSeconds,
1275
+ // The relay says our binding is gone (410 binding_deleted). The
1276
+ // subscription + writer have already stopped and the pause flag is
1277
+ // already written (start.ts) — exit the process the same clean way
1278
+ // ctrl+c does, so the pidfile doesn't strand.
1279
+ onBindingDeleted: () => {
1280
+ void cleanup();
1281
+ }
1282
+ });
1245
1283
  } catch (err) {
1246
1284
  if (pidfilePath) release(pidfilePath);
1247
1285
  console.error(kleur.red("error:"), err.message);