AeThex-OS/temp-forge-extract/aethex-forge-main/services/watcher.js
MrPiglr b3c308b2c8 Add functional marketplace modules, bottom nav bar, root terminal, arcade games
- ModuleManager: Central tracking for installed marketplace modules
- DataAnalyzerWidget: Real-time CPU/RAM/Battery/Storage widget (unlocked by Data Analyzer module)
- BottomNavBar: Navigation bar for Projects/Chat/Marketplace/Settings
- RootShell: Real root command execution utility
- TerminalActivity: Full root shell with neofetch, sysinfo, real Linux commands
- Terminal Pro module: Adds aliases (ll, la, h), command history
- ArcadeActivity + SnakeGame: Pixel Arcade module unlocks retro games
- fade_in/fade_out animations for smooth transitions
2026-02-18 22:03:50 -07:00

36 lines
916 B
JavaScript

import chokidar from "chokidar";
import fs from "node:fs";
import path from "node:path";
import { scrubPII } from "./pii-scrub.js";
let watcher = null;
export async function startWatcher(dir) {
if (watcher) await watcher.close();
watcher = chokidar.watch(["**/*.lua", "**/*.cs", "**/*.ts", "**/*.tsx"], {
cwd: dir,
ignoreInitial: true,
});
watcher.on("change", (filePath) => {
const full = path.join(dir, filePath);
try {
const content = fs.readFileSync(full, "utf-8");
const safe = scrubPII(content);
console.log(`[watcher] ${filePath} changed`);
// TODO: route safe content to renderer or local analysis pipeline
console.log(safe.slice(0, 400));
} catch (err) {
console.error("watcher read error", err);
}
});
return true;
}
export async function stopWatcher() {
if (watcher) await watcher.close();
watcher = null;
return true;
}