thrust-cli 1.0.7 → 1.0.8

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/index.js +9 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4,7 +4,6 @@ import { Command } from 'commander';
4
4
  import fs from 'fs';
5
5
  import path from 'path';
6
6
  import os from 'os';
7
- import { exec } from 'child_process';
8
7
  import { fileURLToPath } from 'url';
9
8
  import { startDaemon } from './utils/daemon.js';
10
9
  import { getConfig, saveConfig } from './utils/config.js';
@@ -67,15 +66,14 @@ async function setupNativeStartup() {
67
66
  return;
68
67
  }
69
68
 
70
- // 2. Windows
69
+ // 2. Windows - Clean, direct global execution
71
70
  if (process.platform === 'win32') {
72
71
  try {
73
- // Cleanup ghost registry key from old auto-launch package
74
- exec('reg delete "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run" /v "ThrustAgent" /f', () => {});
75
-
76
72
  const startupFolder = path.join(os.homedir(), 'AppData', 'Roaming', 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup');
77
73
  const batFilePath = path.join(startupFolder, 'thrust-agent.bat');
78
- const batContent = `@echo off\ntitle Thrust Local Agent\necho Starting Thrust...\ntimeout /t 3 /nobreak > NUL\n"${process.execPath}" "${__filename}"\npause`;
74
+
75
+ // Clean batch script that simply calls the global `thrust` command
76
+ const batContent = `@echo off\ntitle Thrust Local Agent\necho Starting Thrust...\ntimeout /t 2 /nobreak > NUL\nthrust\npause`;
79
77
 
80
78
  if (!fs.existsSync(startupFolder)) fs.mkdirSync(startupFolder, { recursive: true });
81
79
  fs.writeFileSync(batFilePath, batContent, 'utf8');
@@ -85,13 +83,12 @@ async function setupNativeStartup() {
85
83
  }
86
84
  }
87
85
 
88
- // 3. macOS
86
+ // 3. macOS - Requires absolute paths due to empty launchd $PATH
89
87
  else if (process.platform === 'darwin') {
90
88
  try {
91
89
  const launchAgentsDir = path.join(os.homedir(), 'Library', 'LaunchAgents');
92
90
  const plistPath = path.join(launchAgentsDir, 'com.thrust.agent.plist');
93
91
 
94
- // Native Mac LaunchDaemon XML Configuration
95
92
  const plistContent = `<?xml version="1.0" encoding="UTF-8"?>
96
93
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
97
94
  <plist version="1.0">
@@ -113,15 +110,16 @@ async function setupNativeStartup() {
113
110
  if (!fs.existsSync(launchAgentsDir)) fs.mkdirSync(launchAgentsDir, { recursive: true });
114
111
  fs.writeFileSync(plistPath, plistContent, 'utf8');
115
112
 
116
- // Register it quietly with the Mac OS
117
- exec(`launchctl load -w "${plistPath}"`, () => {});
113
+ import('child_process').then(({ exec }) => {
114
+ exec(`launchctl load -w "${plistPath}"`, () => {});
115
+ });
118
116
  console.log('⚙️ macOS LaunchAgent active (Will run silently in background on boot).');
119
117
  } catch (err) {
120
118
  console.log(`⚠️ Failed to create macOS LaunchAgent: ${err.message}`);
121
119
  }
122
120
  }
123
121
 
124
- // 4. Linux (Ubuntu, Debian, Fedora, Mint, etc.)
122
+ // 4. Linux - Requires absolute paths for FreeDesktop compliance
125
123
  else if (process.platform === 'linux') {
126
124
  try {
127
125
  if (!process.env.DISPLAY) {
@@ -132,7 +130,6 @@ async function setupNativeStartup() {
132
130
  const autostartDir = path.join(os.homedir(), '.config', 'autostart');
133
131
  const desktopPath = path.join(autostartDir, 'thrust-agent.desktop');
134
132
 
135
- // Native Linux XDG Autostart File
136
133
  const desktopContent = `[Desktop Entry]
137
134
  Type=Application
138
135
  Exec="${process.execPath}" "${__filename}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thrust-cli",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "The local agent for Thrust AI Director",
5
5
  "type": "module",
6
6
  "homepage": "https://thrust.web.app",