nightytidy 0.3.0 → 0.3.1

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.0",
3
+ "version": "0.3.1",
4
4
  "description": "Automated overnight codebase improvement through Claude Code",
5
5
  "license": "MIT",
6
6
  "author": "Dorian Spitz",
@@ -87,7 +87,30 @@ export function unregisterService() {
87
87
 
88
88
  // --- Platform implementations ---
89
89
 
90
+ /**
91
+ * Windows: Use the Startup folder (no admin needed).
92
+ * Writes a .vbs wrapper script that launches the agent hidden (no console window).
93
+ * Falls back to schtasks if Startup folder isn't writable.
94
+ */
95
+ const STARTUP_DIR = process.platform === 'win32'
96
+ ? path.join(os.homedir(), 'AppData', 'Roaming', 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup')
97
+ : '';
98
+ const STARTUP_VBS = path.join(STARTUP_DIR, 'NightyTidy Agent.vbs');
99
+
90
100
  function _registerWindows(cmd) {
101
+ // Primary: Startup folder (no admin required)
102
+ try {
103
+ // VBS wrapper runs the agent without showing a console window
104
+ const vbs = `' NightyTidy Agent — auto-start on login\r\nSet ws = CreateObject("WScript.Shell")\r\nws.Run ${JSON.stringify(cmd)}, 0, False\r\n`;
105
+ fs.mkdirSync(STARTUP_DIR, { recursive: true });
106
+ fs.writeFileSync(STARTUP_VBS, vbs, 'utf-8');
107
+ debug('Registered via Windows Startup folder');
108
+ return;
109
+ } catch (err) {
110
+ debug(`Startup folder failed: ${err.message}, trying schtasks`);
111
+ }
112
+
113
+ // Fallback: Task Scheduler (needs admin on some systems)
91
114
  execSync(
92
115
  `schtasks /create /tn "${SERVICE_NAME}" /tr "${cmd}" /sc onlogon /rl LIMITED /f`,
93
116
  { stdio: 'pipe' },
@@ -95,7 +118,19 @@ function _registerWindows(cmd) {
95
118
  }
96
119
 
97
120
  function _unregisterWindows() {
98
- execSync(`schtasks /delete /tn "${SERVICE_NAME}" /f`, { stdio: 'pipe' });
121
+ // Remove Startup folder entry
122
+ try {
123
+ if (fs.existsSync(STARTUP_VBS)) {
124
+ fs.unlinkSync(STARTUP_VBS);
125
+ debug('Removed Startup folder entry');
126
+ }
127
+ } catch { /* ignore */ }
128
+
129
+ // Also try removing schtasks entry (may not exist)
130
+ try {
131
+ execSync(`schtasks /delete /tn "${SERVICE_NAME}" /f`, { stdio: 'pipe' });
132
+ debug('Removed Task Scheduler entry');
133
+ } catch { /* ignore — may not have been registered via schtasks */ }
99
134
  }
100
135
 
101
136
  function _registerMacOS(cmd) {