@wspc/cli 0.1.12 → 0.1.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/cli.js CHANGED
@@ -1520,9 +1520,9 @@ function createConsistencyFetch(opts) {
1520
1520
  }
1521
1521
 
1522
1522
  // src/version.ts
1523
- var VERSION = "0.1.12";
1523
+ var VERSION = "0.1.14";
1524
1524
  var SPEC_SHA = "bec760cd";
1525
- var SPEC_FETCHED_AT = "2026-07-08T02:10:53.728Z";
1525
+ var SPEC_FETCHED_AT = "2026-07-08T06:11:14.456Z";
1526
1526
  var API_BASE = "https://api.wspc.ai";
1527
1527
 
1528
1528
  // src/index.ts
@@ -5843,7 +5843,10 @@ function emptySummary() {
5843
5843
  paths: []
5844
5844
  };
5845
5845
  }
5846
- async function runDriveSyncOnce(root, api, clock = systemDriveClock) {
5846
+ function isActionableAction(action) {
5847
+ return action.type !== "unchanged" && action.type !== "state_only" && action.type !== "remove_state";
5848
+ }
5849
+ async function runDriveSyncOnce(root, api, clock = systemDriveClock, onProgress) {
5847
5850
  return withDriveLock(root, async () => {
5848
5851
  let state = await readDriveState(root);
5849
5852
  const syncApi = api ?? await createDriveApi();
@@ -5858,11 +5861,20 @@ async function runDriveSyncOnce(root, api, clock = systemDriveClock) {
5858
5861
  const paths = Array.from(
5859
5862
  /* @__PURE__ */ new Set([...Object.keys(localFiles), ...Object.keys(remoteFiles), ...Object.keys(state.entries)])
5860
5863
  ).filter((path) => !blockedPaths.has(path)).sort((left, right) => left.localeCompare(right));
5864
+ const total = paths.filter(
5865
+ (path) => isActionableAction(decideDriveAction(state.entries[path], localFiles[path], remoteFiles[path]))
5866
+ ).length;
5867
+ let processed = 0;
5868
+ onProgress?.(processed, total);
5861
5869
  for (const path of paths) {
5862
5870
  const remote = remoteFiles[path];
5863
5871
  const action = decideDriveAction(state.entries[path], localFiles[path], remote);
5864
5872
  const result = await processPath({ root, state, api: syncApi, path, action, remote, local: localFiles[path], summary, clock });
5865
5873
  state = result.state;
5874
+ if (isActionableAction(action)) {
5875
+ processed += 1;
5876
+ onProgress?.(processed, total);
5877
+ }
5866
5878
  if (result.stop) break;
5867
5879
  }
5868
5880
  recordUnresolvedConflicts(summary, state);
@@ -6624,10 +6636,17 @@ function webSocketError(event) {
6624
6636
 
6625
6637
  // src/handwritten/commands/drive/watch.ts
6626
6638
  async function runDriveWatch(root, options = {}) {
6627
- const runSync = options.runSync ?? runDriveSyncOnce;
6639
+ const runSync = options.runSync ?? ((syncRoot, onProgress) => runDriveSyncOnce(syncRoot, void 0, void 0, onProgress));
6628
6640
  const debounceMs = options.debounceMs ?? 500;
6629
6641
  const remoteDebounceMs = options.remoteDebounceMs ?? 2e3;
6630
- const emit = options.onEvent ?? ((event) => render({ kind: "drive_watch", display: { shape: "object" } }, event));
6642
+ const emit = options.onEvent ?? ((event) => {
6643
+ if (shouldOutputJson()) {
6644
+ process.stdout.write(`${JSON.stringify(event)}
6645
+ `);
6646
+ return;
6647
+ }
6648
+ render({ kind: "drive_watch", display: { shape: "object" } }, event);
6649
+ });
6631
6650
  let debounceTimer;
6632
6651
  let debounceDeadlineMs;
6633
6652
  let retryTimer;
@@ -6652,7 +6671,9 @@ async function runDriveWatch(root, options = {}) {
6652
6671
  rerunRequested = false;
6653
6672
  try {
6654
6673
  emit({ kind: "drive_sync_start" });
6655
- const summary = await runSync(root);
6674
+ const summary = await runSync(root, (processed, total) => {
6675
+ emit({ kind: "drive_sync_progress", processed, total });
6676
+ });
6656
6677
  emit({ kind: "drive_sync_once", ...summary });
6657
6678
  backoffMs = 1e3;
6658
6679
  } catch (error) {