nightytidy 0.3.3 → 0.3.5

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.3",
3
+ "version": "0.3.5",
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 = '';
@@ -1151,6 +1151,18 @@ export async function startAgent() {
1151
1151
  releaseKeepAwake();
1152
1152
  stopIdleHeartbeat();
1153
1153
  saveInterruptedState();
1154
+
1155
+ // Notify Firestore immediately so the web app shows "Offline" without waiting
1156
+ if (firebaseAuth.isAuthenticated()) {
1157
+ try {
1158
+ await webhookDispatcher.dispatch('agent_offline', {}, [{
1159
+ url: FIREBASE_WEBHOOK_URL,
1160
+ label: 'nightytidy.com',
1161
+ headers: firebaseAuth.getAuthHeader(),
1162
+ }]);
1163
+ } catch { /* best effort — don't block shutdown */ }
1164
+ }
1165
+
1154
1166
  poller.stop();
1155
1167
  scheduler.stopAll();
1156
1168
  await wsServer.stop();
@@ -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)');
@@ -176,7 +176,12 @@ export async function setupAgent() {
176
176
 
177
177
  console.log(chalk.bold('\nStep 4: Start agent'));
178
178
 
179
- spawn(process.execPath, [BIN_PATH, 'agent'], { detached: true, stdio: 'ignore' }).unref();
179
+ spawn(process.execPath, [BIN_PATH, 'agent'], {
180
+ detached: true,
181
+ stdio: 'ignore',
182
+ windowsHide: true,
183
+ shell: process.platform === 'win32',
184
+ }).unref();
180
185
  console.log(chalk.green(' Agent started'));
181
186
 
182
187
  // ── Done ──────────────────────────────────────────────────────────────────