clocktopus 1.6.5 → 1.6.7

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
@@ -1,7 +1,7 @@
1
1
  # Clocktopus
2
2
 
3
3
  <p align="center">
4
- <img src="assets/logo.png" alt="Clocktopus Logo" width="300px" />
4
+ <img src="https://raw.githubusercontent.com/sajxraj/clocktopus/main/assets/logo.png" alt="Clocktopus Logo" width="300px" />
5
5
  </p>
6
6
 
7
7
  CLI-based time-tracking automation for Clockify with idle monitoring, Jira integration, Google Calendar sync, and a web dashboard.
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import * as fs from 'fs';
7
7
  import * as path from 'path';
8
8
  import { fileURLToPath } from 'url';
9
9
  import { createRequire } from 'module';
10
+ import { execSync } from 'child_process';
10
11
  import { completeLatestSession, getLatestSession } from './lib/db.js';
11
12
  import { stopJiraTimer } from './lib/jira.js';
12
13
  import { startDashboard } from './dashboard/server.js';
@@ -291,6 +292,15 @@ const isDev = __dirname.includes('/Projects/') || __dirname.includes('/src/');
291
292
  const MONITOR_PM2_NAME = isDev ? 'clocktopus-monitor-dev' : 'clocktopus-monitor';
292
293
  const DASH_PM2_NAME = isDev ? 'clocktopus-dash-dev' : 'clocktopus-dash';
293
294
  const pm2Bin = path.join(path.dirname(createRequire(import.meta.url).resolve('pm2')), 'bin', 'pm2');
295
+ const bunBin = (() => {
296
+ try {
297
+ return execSync('which bun', { encoding: 'utf-8' }).trim();
298
+ }
299
+ catch {
300
+ return 'bun';
301
+ }
302
+ })();
303
+ const pm2Cmd = `${bunBin} ${pm2Bin}`;
294
304
  program
295
305
  .command('monitor')
296
306
  .description('Start idle monitor as a background daemon.')
@@ -301,10 +311,10 @@ program
301
311
  const scriptPath = path.join(__dirname, 'index.js');
302
312
  try {
303
313
  try {
304
- execSync(`${pm2Bin} delete ${MONITOR_PM2_NAME}`, { stdio: 'ignore' });
314
+ execSync(`${pm2Cmd} delete ${MONITOR_PM2_NAME}`, { stdio: 'ignore' });
305
315
  }
306
316
  catch { }
307
- execSync(`${pm2Bin} start ${scriptPath} --name ${MONITOR_PM2_NAME} --interpreter ${bunPath} -- monitor:run`, {
317
+ execSync(`${pm2Cmd} start ${scriptPath} --name ${MONITOR_PM2_NAME} --interpreter ${bunPath} -- monitor:run`, {
308
318
  stdio: 'inherit',
309
319
  });
310
320
  console.log(chalk.green('Idle monitor started in background.'));
@@ -321,7 +331,7 @@ program
321
331
  .action(async () => {
322
332
  const { execSync } = await import('child_process');
323
333
  try {
324
- execSync(`${pm2Bin} stop ${MONITOR_PM2_NAME}`, { stdio: 'inherit' });
334
+ execSync(`${pm2Cmd} stop ${MONITOR_PM2_NAME}`, { stdio: 'inherit' });
325
335
  }
326
336
  catch {
327
337
  console.log(chalk.yellow('Monitor is not running.'));
@@ -333,7 +343,7 @@ program
333
343
  .action(async () => {
334
344
  const { execSync } = await import('child_process');
335
345
  try {
336
- execSync(`${pm2Bin} logs ${MONITOR_PM2_NAME} --lines 50`, { stdio: 'inherit' });
346
+ execSync(`${pm2Cmd} logs ${MONITOR_PM2_NAME} --lines 50`, { stdio: 'inherit' });
337
347
  }
338
348
  catch {
339
349
  console.log(chalk.yellow('Monitor is not running.'));
@@ -348,10 +358,10 @@ program
348
358
  const scriptPath = path.join(__dirname, 'index.js');
349
359
  try {
350
360
  try {
351
- execSync(`${pm2Bin} delete ${DASH_PM2_NAME}`, { stdio: 'ignore' });
361
+ execSync(`${pm2Cmd} delete ${DASH_PM2_NAME}`, { stdio: 'ignore' });
352
362
  }
353
363
  catch { }
354
- execSync(`${pm2Bin} start ${scriptPath} --name ${DASH_PM2_NAME} --interpreter ${bunPath} -- dash`, {
364
+ execSync(`${pm2Cmd} start ${scriptPath} --name ${DASH_PM2_NAME} --interpreter ${bunPath} -- dash`, {
355
365
  stdio: 'inherit',
356
366
  });
357
367
  console.log(chalk.green(`Dashboard running at ${DASHBOARD_URL}`));
@@ -368,7 +378,7 @@ program
368
378
  .action(async () => {
369
379
  const { execSync } = await import('child_process');
370
380
  try {
371
- execSync(`${pm2Bin} stop ${DASH_PM2_NAME}`, { stdio: 'inherit' });
381
+ execSync(`${pm2Cmd} stop ${DASH_PM2_NAME}`, { stdio: 'inherit' });
372
382
  }
373
383
  catch {
374
384
  console.log(chalk.yellow('Dashboard is not running.'));
@@ -380,7 +390,7 @@ program
380
390
  .action(async () => {
381
391
  const { execSync } = await import('child_process');
382
392
  try {
383
- execSync(`${pm2Bin} logs ${DASH_PM2_NAME} --lines 50`, { stdio: 'inherit' });
393
+ execSync(`${pm2Cmd} logs ${DASH_PM2_NAME} --lines 50`, { stdio: 'inherit' });
384
394
  }
385
395
  catch {
386
396
  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.6.5",
3
+ "version": "1.6.7",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -42,6 +42,7 @@
42
42
  "hono": "^4.12.3",
43
43
  "inquirer": "^8.2.4",
44
44
  "macos-notification-state": "^3.0.0",
45
+ "node-gyp": "^11.2.0",
45
46
  "node-notifier": "^10.0.1",
46
47
  "pm2": "^6.0.8",
47
48
  "uuid": "^11.1.0",