getaimeter 0.7.1 → 0.7.2

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 (3) hide show
  1. package/cli.js +2 -0
  2. package/package.json +1 -1
  3. package/service.js +54 -1
package/cli.js CHANGED
@@ -129,6 +129,8 @@ async function runSetup() {
129
129
  console.log(` ✓ Installed at: ${result.path}`);
130
130
  if (result.platform === 'windows') {
131
131
  console.log(' ✓ Will auto-start on login (Windows Startup folder)');
132
+ console.log(' ✓ Desktop shortcut created (double-click "AIMeter" to start)');
133
+ console.log(' ✓ Start Menu shortcut created');
132
134
  } else if (result.platform === 'macos') {
133
135
  console.log(' ✓ Will auto-start on login (launchd)');
134
136
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getaimeter",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Track AI coding costs across Claude, Cursor, Codex, and Gemini. Optimization recommendations that cut costs by 30%.",
5
5
  "bin": {
6
6
  "aimeter": "cli.js"
package/service.js CHANGED
@@ -86,12 +86,65 @@ WshShell.Run """${nodePath}"" ""${script}"" watch", 0, False
86
86
 
87
87
  fs.mkdirSync(path.dirname(vbsPath), { recursive: true });
88
88
  fs.writeFileSync(vbsPath, vbs, 'utf8');
89
+
90
+ // Create Desktop and Start Menu shortcuts so users can launch without a terminal
91
+ createWindowsShortcuts(nodePath, script);
92
+
89
93
  return vbsPath;
90
94
  }
91
95
 
96
+ /**
97
+ * Create .lnk shortcuts on Desktop and Start Menu via PowerShell COM.
98
+ * These are proper Windows shortcuts with icon and description.
99
+ */
100
+ function createWindowsShortcuts(nodePath, script) {
101
+ const iconPath = path.join(__dirname, 'icon.ico').replace(/\\/g, '\\\\');
102
+ const locations = [
103
+ { name: 'Desktop', dir: path.join(os.homedir(), 'Desktop') },
104
+ { name: 'Start Menu', dir: path.join(os.homedir(), 'AppData', 'Roaming', 'Microsoft', 'Windows', 'Start Menu', 'Programs') },
105
+ ];
106
+
107
+ for (const loc of locations) {
108
+ const lnkPath = path.join(loc.dir, 'AIMeter.lnk');
109
+ // PowerShell script to create a .lnk shortcut
110
+ const ps = `
111
+ $ws = New-Object -ComObject WScript.Shell
112
+ $s = $ws.CreateShortcut('${lnkPath.replace(/'/g, "''")}')
113
+ $s.TargetPath = '${nodePath.replace(/\\\\/g, '\\').replace(/'/g, "''")}'
114
+ $s.Arguments = '"${script.replace(/\\\\/g, '\\').replace(/'/g, "''")}" start'
115
+ $s.WorkingDirectory = '${os.homedir().replace(/'/g, "''")}'
116
+ $s.Description = 'AIMeter - AI coding cost optimizer'
117
+ $s.WindowStyle = 7
118
+ $iconFile = '${iconPath.replace(/\\\\/g, '\\').replace(/'/g, "''")}'
119
+ if (Test-Path $iconFile) { $s.IconLocation = $iconFile }
120
+ $s.Save()
121
+ `.trim();
122
+
123
+ try {
124
+ require('child_process').execSync(
125
+ `powershell -NoProfile -ExecutionPolicy Bypass -Command "${ps.replace(/"/g, '\\"')}"`,
126
+ { stdio: 'ignore', timeout: 10000 }
127
+ );
128
+ } catch {
129
+ // Non-critical — shortcuts are convenience, not required
130
+ }
131
+ }
132
+ }
133
+
92
134
  function uninstallWindows() {
93
135
  const vbsPath = getWindowsVbsPath();
94
- try { fs.unlinkSync(vbsPath); return true; } catch { return false; }
136
+ try { fs.unlinkSync(vbsPath); } catch {}
137
+
138
+ // Remove Desktop and Start Menu shortcuts
139
+ const shortcuts = [
140
+ path.join(os.homedir(), 'Desktop', 'AIMeter.lnk'),
141
+ path.join(os.homedir(), 'AppData', 'Roaming', 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'AIMeter.lnk'),
142
+ ];
143
+ for (const lnk of shortcuts) {
144
+ try { fs.unlinkSync(lnk); } catch {}
145
+ }
146
+
147
+ return true;
95
148
  }
96
149
 
97
150
  function isInstalledWindows() {