@wbern/cc-ping 1.7.0 → 1.8.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.
Files changed (2) hide show
  1. package/dist/cli.js +31 -7
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1070,7 +1070,15 @@ async function runDaemon(intervalMs, options, deps) {
1070
1070
  cleanup();
1071
1071
  }
1072
1072
  if (exitReason === "upgrade") {
1073
- deps.exit(75);
1073
+ if (deps.restart) {
1074
+ try {
1075
+ deps.restart();
1076
+ } catch {
1077
+ deps.exit(75);
1078
+ }
1079
+ } else {
1080
+ deps.exit(75);
1081
+ }
1074
1082
  }
1075
1083
  }
1076
1084
  async function runDaemonWithDefaults(intervalMs, options) {
@@ -1123,7 +1131,23 @@ async function runDaemonWithDefaults(intervalMs, options) {
1123
1131
  },
1124
1132
  onSignal: (signal, handler) => process.on(signal, handler),
1125
1133
  removeSignal: (signal, handler) => process.removeListener(signal, handler),
1126
- exit: (code) => process.exit(code)
1134
+ exit: (code) => process.exit(code),
1135
+ restart: () => {
1136
+ console.log("Restarting daemon with updated binary...");
1137
+ const result = startDaemon({
1138
+ interval: `${intervalMs / 6e4}m`,
1139
+ quiet: options.quiet,
1140
+ bell: options.bell,
1141
+ notify: options.notify,
1142
+ smartSchedule: options.smartSchedule
1143
+ });
1144
+ if (result.success) {
1145
+ console.log(`Daemon restarted (PID: ${result.pid})`);
1146
+ } else {
1147
+ console.log(`Failed to restart: ${result.error}`);
1148
+ process.exit(75);
1149
+ }
1150
+ }
1127
1151
  });
1128
1152
  }
1129
1153
  var GRACEFUL_POLL_MS, GRACEFUL_POLL_ATTEMPTS, POST_KILL_DELAY_MS;
@@ -1971,7 +1995,7 @@ function getDeferredHandles() {
1971
1995
  }
1972
1996
  return deferred;
1973
1997
  }
1974
- var program = new Command().name("cc-ping").description("Ping Claude Code sessions to trigger quota windows early").version("1.7.0").option(
1998
+ var program = new Command().name("cc-ping").description("Ping Claude Code sessions to trigger quota windows early").version("1.8.0").option(
1975
1999
  "--config <path>",
1976
2000
  "Path to config directory (default: ~/.config/cc-ping, env: CC_PING_CONFIG)"
1977
2001
  ).hook("preAction", (thisCommand) => {
@@ -2198,7 +2222,7 @@ daemon.command("start").description("Start the daemon process").option(
2198
2222
  bell: opts.bell,
2199
2223
  notify: opts.notify,
2200
2224
  smartSchedule,
2201
- version: "1.7.0"
2225
+ version: "1.8.0"
2202
2226
  });
2203
2227
  if (!result.success) {
2204
2228
  console.error(result.error);
@@ -2232,7 +2256,7 @@ daemon.command("stop").description("Stop the daemon process").action(async () =>
2232
2256
  daemon.command("status").description("Show daemon status").option("--json", "Output as JSON", false).action(async (opts) => {
2233
2257
  const { getServiceStatus: getServiceStatus2 } = await Promise.resolve().then(() => (init_service(), service_exports));
2234
2258
  const svc = getServiceStatus2();
2235
- const status = getDaemonStatus({ currentVersion: "1.7.0" });
2259
+ const status = getDaemonStatus({ currentVersion: "1.8.0" });
2236
2260
  if (opts.json) {
2237
2261
  const serviceInfo = svc.installed ? {
2238
2262
  service: {
@@ -2293,7 +2317,7 @@ daemon.command("status").description("Show daemon status").option("--json", "Out
2293
2317
  if (status.versionMismatch) {
2294
2318
  console.log(
2295
2319
  yellow(
2296
- ` Warning: daemon is running v${status.daemonVersion} but v${"1.7.0"} is installed.`
2320
+ ` Warning: daemon is running v${status.daemonVersion} but v${"1.8.0"} is installed.`
2297
2321
  )
2298
2322
  );
2299
2323
  console.log(
@@ -2359,7 +2383,7 @@ daemon.command("_run", { hidden: true }).option("--interval-ms <ms>", "Ping inte
2359
2383
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
2360
2384
  intervalMs,
2361
2385
  configDir: resolveConfigDir2(),
2362
- version: "1.7.0"
2386
+ version: "1.8.0"
2363
2387
  });
2364
2388
  }
2365
2389
  await runDaemonWithDefaults(intervalMs, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wbern/cc-ping",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Ping Claude Code sessions to trigger quota windows early across multiple accounts",
5
5
  "type": "module",
6
6
  "bin": {