@neat.is/core 0.10.2 → 0.10.3-dev.20260930

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.cjs CHANGED
@@ -19403,14 +19403,12 @@ async function readLockPid(lockPath) {
19403
19403
  async function classifyLockHolder(lockPath, probe = defaultLockHolderProbe) {
19404
19404
  const lockPid = await readLockPid(lockPath);
19405
19405
  const daemonPid = await probe.daemonPidFromFile();
19406
- if (daemonPid !== void 0 && daemonPid !== process.pid && probe.isPidAlive(daemonPid) && // The lock already names the daemon, or the daemon answers on its port.
19407
- // Either confirms a live daemon is in the picture (the second guards
19408
- // against a stale pidfile whose PID got reused).
19409
- (daemonPid === lockPid || await probe.daemonResponds())) {
19410
- return { kind: "daemon", pid: daemonPid };
19411
- }
19412
19406
  if (lockPid !== void 0 && lockPid !== process.pid && probe.isPidAlive(lockPid)) {
19413
- return { kind: "command", pid: lockPid };
19407
+ return { kind: lockPid === daemonPid ? "daemon" : "command", pid: lockPid };
19408
+ }
19409
+ if (daemonPid !== void 0 && daemonPid !== process.pid && probe.isPidAlive(daemonPid) && // Guards against a stale pidfile whose PID got reused.
19410
+ await probe.daemonResponds()) {
19411
+ return { kind: "daemon", pid: daemonPid };
19414
19412
  }
19415
19413
  return { kind: "stale" };
19416
19414
  }
@@ -29364,9 +29362,15 @@ async function snapshotProjectStatus(restPort, project, body) {
29364
29362
  }
29365
29363
  return [{ name: project, status: await probeProjectHealth(restPort, project) }];
29366
29364
  }
29367
- async function waitForDaemonReady(restPort, project, timeoutMs) {
29368
- const deadline = Date.now() + timeoutMs;
29369
- let lastBootstrapping = [];
29365
+ var STILL_WAITING_INTERVAL_MS = 1e4;
29366
+ function daemonProgressLine(project, event) {
29367
+ if (event.kind === "starting") return `starting the daemon for ${project}\u2026`;
29368
+ return `still waiting for ${project}'s daemon (${Math.round(event.elapsedMs / 1e3)}s)`;
29369
+ }
29370
+ async function waitForDaemonReady(restPort, project, timeoutMs, onProgress, reminderIntervalMs = STILL_WAITING_INTERVAL_MS) {
29371
+ const startedAt = Date.now();
29372
+ const deadline = startedAt + timeoutMs;
29373
+ let nextReminderAt = startedAt + reminderIntervalMs;
29370
29374
  while (Date.now() < deadline) {
29371
29375
  const body = await fetchDaemonHealth(restPort);
29372
29376
  if (body !== null) {
@@ -29376,15 +29380,10 @@ async function waitForDaemonReady(restPort, project, timeoutMs) {
29376
29380
  if (bootstrapping.length === 0) {
29377
29381
  return { ready: true, brokenProjects: broken, stillBootstrapping: [] };
29378
29382
  }
29379
- const key = bootstrapping.slice().sort().join(",");
29380
- const prevKey = lastBootstrapping.slice().sort().join(",");
29381
- if (key !== prevKey) {
29382
- const plural = bootstrapping.length === 1 ? "" : "s";
29383
- console.log(
29384
- `neat: waiting on ${bootstrapping.length} project${plural}: ${bootstrapping.join(", ")}`
29385
- );
29386
- lastBootstrapping = bootstrapping;
29387
- }
29383
+ }
29384
+ if (Date.now() >= nextReminderAt) {
29385
+ onProgress?.({ kind: "waiting", elapsedMs: Date.now() - startedAt });
29386
+ nextReminderAt += reminderIntervalMs;
29388
29387
  }
29389
29388
  await new Promise((r) => setTimeout(r, PROBE_INTERVAL_MS));
29390
29389
  }
@@ -29596,7 +29595,8 @@ async function ensureProjectDaemon(opts) {
29596
29595
  projectPath: opts.projectPath,
29597
29596
  ports: allocated
29598
29597
  });
29599
- const ready = await waitForDaemonReady(allocated.rest, opts.project, timeoutMs);
29598
+ opts.onProgress?.({ kind: "starting" });
29599
+ const ready = await waitForDaemonReady(allocated.rest, opts.project, timeoutMs, opts.onProgress);
29600
29600
  if (!ready.ready) {
29601
29601
  return {
29602
29602
  status: "timed-out",
@@ -29742,7 +29742,8 @@ async function runOrchestrator(opts) {
29742
29742
  const outcome = await ensureProjectDaemon({
29743
29743
  project: currentProjectName,
29744
29744
  projectPath: opts.scanPath,
29745
- timeoutMs
29745
+ timeoutMs,
29746
+ onProgress: (event) => console.log(`neat: ${daemonProgressLine(currentProjectName, event)}`)
29746
29747
  });
29747
29748
  const allocated = "ports" in outcome ? outcome.ports : null;
29748
29749
  switch (outcome.status) {
@@ -31811,7 +31812,13 @@ async function runUpCommand(argv, deps) {
31811
31812
  err("neat up: that daemon doesn't run on this machine, so it isn't yours to start.");
31812
31813
  return 2;
31813
31814
  }
31814
- const outcome = await ensure({ project: entry2.name, projectPath: entry2.path });
31815
+ const project = entry2.name;
31816
+ const outcome = await ensure({
31817
+ project,
31818
+ projectPath: entry2.path,
31819
+ // `--json` prints one object and nothing else, so progress stays quiet there.
31820
+ ...args.json ? {} : { onProgress: (event) => out(`neat up: ${daemonProgressLine(project, event)}`) }
31821
+ });
31815
31822
  const log = daemonLogPath(entry2.path);
31816
31823
  if (args.json) {
31817
31824
  const ports = "ports" in outcome ? outcome.ports : void 0;