Files
wehub-resource-sync 979fb22d7c
CI / test (20, macos-latest) (push) Has been cancelled
CI / test (20, ubuntu-latest) (push) Has been cancelled
CI / test (22, macos-latest) (push) Has been cancelled
CI / test (22, ubuntu-latest) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:01:18 +08:00

29 lines
801 B
JavaScript
Executable File

#!/usr/bin/env node
import { FilesystemWatcher, configFromEnv } from "./watcher.mjs";
const cliArgs = process.argv.slice(2);
const envCfg = configFromEnv(process.env);
const roots = cliArgs.length > 0 ? cliArgs : envCfg.roots;
if (!roots || roots.length === 0) {
process.stderr.write(
"agentmemory-fs-watcher: no directories to watch.\n" +
"Usage: agentmemory-fs-watcher <dir> [<dir>...]\n" +
"Or set AGENTMEMORY_FS_WATCH_DIRS=path1,path2\n",
);
process.exit(2);
}
const watcher = new FilesystemWatcher({ ...envCfg, roots });
watcher.start();
process.stderr.write(
`[fs-watcher] emitting to ${envCfg.baseUrl || "http://localhost:3111"}\n`,
);
const shutdown = () => {
watcher.stop();
process.exit(0);
};
process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown);