nightytidy 0.3.4 → 0.3.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nightytidy",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Automated overnight codebase improvement through Claude Code",
5
5
  "license": "MIT",
6
6
  "author": "Dorian Spitz",
@@ -78,11 +78,17 @@ export class CliBridge {
78
78
  _run(args, onOutput, opts = {}) {
79
79
  return new Promise((resolve) => {
80
80
  const binPath = path.resolve(import.meta.dirname, '../../bin/nightytidy.js');
81
- const proc = spawn('node', [binPath, ...args], {
81
+ const spawnOpts = {
82
82
  cwd: this.projectDir,
83
83
  stdio: ['pipe', 'pipe', 'pipe'],
84
84
  windowsHide: true,
85
- });
85
+ };
86
+ // On Windows, use shell mode to prevent a visible console window.
87
+ // cmd.exe inherits the parent's hidden console instead of creating a new one.
88
+ if (process.platform === 'win32') {
89
+ spawnOpts.shell = true;
90
+ }
91
+ const proc = spawn('node', [binPath, ...args], spawnOpts);
86
92
  this.activeProcess = proc;
87
93
 
88
94
  let stdout = '';
@@ -25,7 +25,7 @@ export function acquireKeepAwake() {
25
25
  keepAwakeProcess = spawn('powershell', [
26
26
  '-NoProfile', '-WindowStyle', 'Hidden', '-Command',
27
27
  `Add-Type -TypeDefinition 'using System; using System.Runtime.InteropServices; public class SleepPreventer { [DllImport("kernel32.dll")] public static extern uint SetThreadExecutionState(uint esFlags); }'; [SleepPreventer]::SetThreadExecutionState(0x80000001); while($true) { Start-Sleep -Seconds 3600 }`,
28
- ], { stdio: 'ignore', detached: false });
28
+ ], { stdio: 'ignore', detached: false, windowsHide: true });
29
29
  keepAwakeProcess.unref();
30
30
  keepAwakeProcess.on('error', () => { keepAwakeProcess = null; });
31
31
  debug('Sleep prevention acquired (Windows SetThreadExecutionState)');
@@ -12,6 +12,7 @@ import { createServer } from 'node:http';
12
12
  import { spawn } from 'node:child_process';
13
13
  import { fileURLToPath } from 'node:url';
14
14
  import path from 'node:path';
15
+ import os from 'node:os';
15
16
  import chalk from 'chalk';
16
17
  import { getConfigDir, ensureConfigDir } from './config.js';
17
18
  import { registerService } from './service.js';
@@ -176,7 +177,21 @@ export async function setupAgent() {
176
177
 
177
178
  console.log(chalk.bold('\nStep 4: Start agent'));
178
179
 
179
- spawn(process.execPath, [BIN_PATH, 'agent'], { detached: true, stdio: 'ignore' }).unref();
180
+ if (process.platform === 'win32' && serviceResult.success) {
181
+ // On Windows, launch via the VBS script we just registered — this is the
182
+ // only way to start a Node.js process with NO visible console window.
183
+ const vbsPath = path.join(
184
+ os.homedir(), 'AppData', 'Roaming', 'Microsoft', 'Windows',
185
+ 'Start Menu', 'Programs', 'Startup', 'NightyTidy Agent.vbs',
186
+ );
187
+ spawn('wscript', [vbsPath], { detached: true, stdio: 'ignore' }).unref();
188
+ } else {
189
+ // Unix or fallback: spawn directly (no console window issue on Unix)
190
+ spawn(process.execPath, [BIN_PATH, 'agent'], {
191
+ detached: true,
192
+ stdio: 'ignore',
193
+ }).unref();
194
+ }
180
195
  console.log(chalk.green(' Agent started'));
181
196
 
182
197
  // ── Done ──────────────────────────────────────────────────────────────────