nightytidy 0.2.10 → 0.2.13

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.2.10",
3
+ "version": "0.2.13",
4
4
  "description": "Automated overnight codebase improvement through Claude Code",
5
5
  "license": "MIT",
6
6
  "author": "Dorian Spitz",
@@ -2,7 +2,7 @@ import { spawn } from 'node:child_process';
2
2
  import path from 'node:path';
3
3
  import { debug, warn, error as logError } from '../logger.js';
4
4
 
5
- const INIT_TIMEOUT_MS = 5 * 60_000; // 5 minutes — init should never take this long
5
+ const INIT_TIMEOUT_MS = 10 * 60_000; // 10 minutes — generous but not infinite
6
6
  const FINISH_TIMEOUT_MS = 10 * 60_000; // 10 minutes — finish includes report generation
7
7
 
8
8
  export class CliBridge {
@@ -79,6 +79,7 @@ export async function startAgent() {
79
79
  let pauseRequested = false;
80
80
  let skipCurrentStep = false;
81
81
  let runOutputBuffer = ''; // Accumulated raw output for the current run
82
+ const MAX_OUTPUT_BUFFER = 512_000; // 512 KB cap — matches web app's RAW_OUTPUT_MAX_LENGTH
82
83
 
83
84
  // Accumulated run state — survives page refreshes via get-run
84
85
  let runProgress = {
@@ -533,6 +534,8 @@ export async function startAgent() {
533
534
  ? 'Initialization timed out — Claude Code may be unavailable. Restart the agent to retry.'
534
535
  : (initResult.parsed?.error || initResult.stderr || 'Unknown init error');
535
536
  info(` ✗ Init failed: ${errorMsg}`);
537
+ if (initResult.stdout) debug(` Init stdout: ${initResult.stdout.slice(-500)}`);
538
+ if (initResult.stderr) debug(` Init stderr: ${initResult.stderr.slice(-500)}`);
536
539
  wsServer.broadcast({ type: 'run-failed', runId: run.id, error: errorMsg });
537
540
  dispatchWithQueue('run_failed', {
538
541
  project: project.name,
@@ -613,6 +616,9 @@ export async function startAgent() {
613
616
 
614
617
  const stepResult = await bridge.runStep(stepNum, (text) => {
615
618
  runOutputBuffer += text;
619
+ if (runOutputBuffer.length > MAX_OUTPUT_BUFFER * 1.2) {
620
+ runOutputBuffer = runOutputBuffer.slice(-MAX_OUTPUT_BUFFER);
621
+ }
616
622
  wsServer.broadcast({ type: 'step-output', runId: run.id, text, mode: 'raw' });
617
623
  });
618
624
 
@@ -864,6 +870,9 @@ export async function startAgent() {
864
870
 
865
871
  const stepResult = await bridge.runStep(stepNum, (text) => {
866
872
  runOutputBuffer += text;
873
+ if (runOutputBuffer.length > MAX_OUTPUT_BUFFER * 1.2) {
874
+ runOutputBuffer = runOutputBuffer.slice(-MAX_OUTPUT_BUFFER);
875
+ }
867
876
  wsServer.broadcast({ type: 'step-output', runId: interrupted.id, text, mode: 'raw' });
868
877
  });
869
878
 
package/src/checks.js CHANGED
@@ -203,18 +203,19 @@ async function checkClaudeAuthenticated() {
203
203
  async function getFreeBytesWindows(projectDir) {
204
204
  const driveLetter = projectDir.charAt(0).toUpperCase();
205
205
  // Try PowerShell first (wmic is deprecated on newer Windows)
206
+ // 10s timeout — PowerShell can hang on OneDrive/network drive systems
206
207
  const psResult = await runCommand('powershell', [
207
208
  '-NoProfile', '-Command',
208
209
  `(Get-PSDrive ${driveLetter}).Free`,
209
- ]);
210
+ ], { timeoutMs: 10_000 });
210
211
  const psMatch = psResult.stdout.trim().match(/^(\d+)$/);
211
212
  if (psResult.code === 0 && psMatch) {
212
213
  return parseInt(psMatch[1], 10);
213
214
  }
214
- // Fallback to wmic for older Windows
215
+ // Fallback to wmic for older Windows (also with timeout)
215
216
  const result = await runCommand('wmic', [
216
217
  'logicaldisk', 'where', `DeviceID='${driveLetter}:'`, 'get', 'FreeSpace',
217
- ]);
218
+ ], { timeoutMs: 10_000 });
218
219
  const match = result.stdout.match(/(\d+)/);
219
220
  return match ? parseInt(match[1], 10) : null;
220
221
  }