clocktopus 1.1.3 → 1.1.4

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/README.md CHANGED
@@ -150,6 +150,22 @@ Go to **System Settings > Notifications** and ensure **terminal-notifier** has n
150
150
 
151
151
  Enable **Require password immediately** in System Settings > Lock Screen.
152
152
 
153
+ ### Bun installs an old version
154
+
155
+ Bun caches registry data aggressively. Clear the cache and reinstall:
156
+
157
+ ```bash
158
+ bun pm cache rm && bun i -g clocktopus@latest
159
+ ```
160
+
161
+ ### Native addons not built (untrusted postinstall)
162
+
163
+ If `bun install -g` skips the postinstall script, the monitor will auto-build native addons on first run (requires Node.js for `npx`). Alternatively, trust the package and reinstall:
164
+
165
+ ```bash
166
+ bun pm trust clocktopus && bun i -g clocktopus
167
+ ```
168
+
153
169
  ### Linux
154
170
 
155
171
  ```bash
@@ -7,6 +7,7 @@ const __dirname = path.dirname(__filename);
7
7
  const SCRIPT_PATH = path.resolve(__dirname, '../../index.js');
8
8
  const isDev = SCRIPT_PATH.includes('/Projects/') || SCRIPT_PATH.includes('/src/');
9
9
  const PM2_NAME = isDev ? 'clocktopus-monitor-dev' : 'clocktopus-monitor';
10
+ const pm2Bin = path.resolve(__dirname, '../../node_modules/.bin/pm2');
10
11
  const monitorRoutes = new Hono();
11
12
  function pm2Exec(command) {
12
13
  try {
@@ -20,7 +21,7 @@ function pm2Exec(command) {
20
21
  }
21
22
  monitorRoutes.get('/monitor/status', (c) => {
22
23
  try {
23
- const output = execSync('bunx pm2 jlist', { encoding: 'utf-8', timeout: 10000 });
24
+ const output = execSync('${pm2Bin} jlist', { encoding: 'utf-8', timeout: 10000 });
24
25
  const processes = JSON.parse(output);
25
26
  const proc = processes.find((p) => p.name === PM2_NAME);
26
27
  if (!proc) {
@@ -41,18 +42,18 @@ monitorRoutes.post('/monitor/start', (c) => {
41
42
  const bunPath = execSync('which bun', { encoding: 'utf-8' }).trim();
42
43
  // Delete any existing process to avoid duplicates
43
44
  try {
44
- execSync(`bunx pm2 delete ${PM2_NAME}`, { stdio: 'ignore' });
45
+ execSync(`${pm2Bin} delete ${PM2_NAME}`, { stdio: 'ignore' });
45
46
  }
46
47
  catch { }
47
- const result = pm2Exec(`bunx pm2 start ${SCRIPT_PATH} --name ${PM2_NAME} --interpreter ${bunPath} -- monitor:run`);
48
+ const result = pm2Exec(`${pm2Bin} start ${SCRIPT_PATH} --name ${PM2_NAME} --interpreter ${bunPath} -- monitor:run`);
48
49
  return c.json(result);
49
50
  });
50
51
  monitorRoutes.post('/monitor/stop', (c) => {
51
- const result = pm2Exec(`bunx pm2 stop ${PM2_NAME}`);
52
+ const result = pm2Exec(`${pm2Bin} stop ${PM2_NAME}`);
52
53
  return c.json(result);
53
54
  });
54
55
  monitorRoutes.post('/monitor/restart', (c) => {
55
- const result = pm2Exec(`bunx pm2 restart ${PM2_NAME}`);
56
+ const result = pm2Exec(`${pm2Bin} restart ${PM2_NAME}`);
56
57
  return c.json(result);
57
58
  });
58
59
  export default monitorRoutes;
package/dist/index.js CHANGED
@@ -287,6 +287,7 @@ program
287
287
  const isDev = __dirname.includes('/Projects/') || __dirname.includes('/src/');
288
288
  const MONITOR_PM2_NAME = isDev ? 'clocktopus-monitor-dev' : 'clocktopus-monitor';
289
289
  const DASH_PM2_NAME = isDev ? 'clocktopus-dash-dev' : 'clocktopus-dash';
290
+ const pm2Bin = path.join(__dirname, '..', 'node_modules', '.bin', 'pm2');
290
291
  program
291
292
  .command('monitor')
292
293
  .description('Start idle monitor as a background daemon.')
@@ -297,10 +298,10 @@ program
297
298
  const scriptPath = path.join(__dirname, 'index.js');
298
299
  try {
299
300
  try {
300
- execSync(`bunx pm2 delete ${MONITOR_PM2_NAME}`, { stdio: 'ignore' });
301
+ execSync(`${pm2Bin} delete ${MONITOR_PM2_NAME}`, { stdio: 'ignore' });
301
302
  }
302
303
  catch { }
303
- execSync(`bunx pm2 start ${scriptPath} --name ${MONITOR_PM2_NAME} --interpreter ${bunPath} -- monitor:run`, {
304
+ execSync(`${pm2Bin} start ${scriptPath} --name ${MONITOR_PM2_NAME} --interpreter ${bunPath} -- monitor:run`, {
304
305
  stdio: 'inherit',
305
306
  });
306
307
  console.log(chalk.green('Idle monitor started in background.'));
@@ -317,7 +318,7 @@ program
317
318
  .action(async () => {
318
319
  const { execSync } = await import('child_process');
319
320
  try {
320
- execSync(`bunx pm2 stop ${MONITOR_PM2_NAME}`, { stdio: 'inherit' });
321
+ execSync(`${pm2Bin} stop ${MONITOR_PM2_NAME}`, { stdio: 'inherit' });
321
322
  }
322
323
  catch {
323
324
  console.log(chalk.yellow('Monitor is not running.'));
@@ -329,7 +330,7 @@ program
329
330
  .action(async () => {
330
331
  const { execSync } = await import('child_process');
331
332
  try {
332
- execSync(`bunx pm2 logs ${MONITOR_PM2_NAME} --lines 50`, { stdio: 'inherit' });
333
+ execSync(`${pm2Bin} logs ${MONITOR_PM2_NAME} --lines 50`, { stdio: 'inherit' });
333
334
  }
334
335
  catch {
335
336
  console.log(chalk.yellow('Monitor is not running.'));
@@ -344,10 +345,10 @@ program
344
345
  const scriptPath = path.join(__dirname, 'index.js');
345
346
  try {
346
347
  try {
347
- execSync(`bunx pm2 delete ${DASH_PM2_NAME}`, { stdio: 'ignore' });
348
+ execSync(`${pm2Bin} delete ${DASH_PM2_NAME}`, { stdio: 'ignore' });
348
349
  }
349
350
  catch { }
350
- execSync(`bunx pm2 start ${scriptPath} --name ${DASH_PM2_NAME} --interpreter ${bunPath} -- dash`, {
351
+ execSync(`${pm2Bin} start ${scriptPath} --name ${DASH_PM2_NAME} --interpreter ${bunPath} -- dash`, {
351
352
  stdio: 'inherit',
352
353
  });
353
354
  console.log(chalk.green('Dashboard running at http://localhost:4001'));
@@ -364,7 +365,7 @@ program
364
365
  .action(async () => {
365
366
  const { execSync } = await import('child_process');
366
367
  try {
367
- execSync(`bunx pm2 stop ${DASH_PM2_NAME}`, { stdio: 'inherit' });
368
+ execSync(`${pm2Bin} stop ${DASH_PM2_NAME}`, { stdio: 'inherit' });
368
369
  }
369
370
  catch {
370
371
  console.log(chalk.yellow('Dashboard is not running.'));
@@ -376,7 +377,7 @@ program
376
377
  .action(async () => {
377
378
  const { execSync } = await import('child_process');
378
379
  try {
379
- execSync(`bunx pm2 logs ${DASH_PM2_NAME} --lines 50`, { stdio: 'inherit' });
380
+ execSync(`${pm2Bin} logs ${DASH_PM2_NAME} --lines 50`, { stdio: 'inherit' });
380
381
  }
381
382
  catch {
382
383
  console.log(chalk.yellow('Dashboard is not running.'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clocktopus",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -21,9 +21,9 @@
21
21
  "clock": "bun dist/index.js",
22
22
  "monitor": "bun dist/index.js monitor",
23
23
  "monitor:stop": "bun dist/index.js monitor:stop",
24
- "monitor:restart": "bunx pm2 restart clocktopus-monitor-dev",
24
+ "monitor:restart": "node_modules/.bin/pm2 restart clocktopus-monitor-dev",
25
25
  "monitor:logs": "bun dist/index.js monitor:logs",
26
- "monitor:status": "bunx pm2 status clocktopus-monitor-dev",
26
+ "monitor:status": "node_modules/.bin/pm2 status clocktopus-monitor-dev",
27
27
  "prepare": "husky",
28
28
  "dashboard": "bun -e \"import('./dist/dashboard/server.js').then(m => m.startDashboard())\"",
29
29
  "db:cleanup": "bun dist/scripts/db-cleanup.js",