aiwg
Version:
Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo
58 lines • 2.19 kB
TypeScript
/**
* Artifact Index Watcher
*
* Filesystem watcher daemon that triggers incremental index rebuilds when
* `.aiwg/` files change. Uses chokidar for cross-platform compatibility
* (inotify on Linux, FSEvents on macOS, fs.watch on Windows).
*
* Features:
* - Debounced updates (batch rapid bursts into a single rebuild)
* - Incremental only — relies on the checksum manifest (#794) for fast change detection
* - Scope filtering — watches `.aiwg/` by default, configurable via config
* - PID file for conflict detection (prevents duplicate watchers on the same project)
* - Graceful shutdown on SIGINT/SIGTERM
*
* @implements #795
* @source @src/artifacts/checksum-manifest.ts
*/
import { type BuildOptions } from './index-builder.js';
export interface WatchOptions {
/** Paths to watch (default: .aiwg/) */
paths?: string[];
/** Debounce window in ms (default: 500) */
debounceMs?: number;
/** Verbose logging */
verbose?: boolean;
/** Working directory (default: cwd) */
cwd?: string;
/** Graph to rebuild (default: project) */
graph?: BuildOptions['graph'];
}
/**
* PID file location for the watcher daemon.
* One watcher per project — the PID file prevents conflicts.
*/
export declare function getPidFilePath(cwd: string): string;
/**
* Check if a watcher is already running for this project.
* Returns the PID if running, null otherwise.
*/
export declare function getRunningPid(cwd: string): number | null;
/**
* Stop a running watcher by sending SIGTERM to its PID.
* Returns true if a watcher was stopped, false if none was running.
*/
export declare function stopWatcher(cwd: string): boolean;
/**
* Start the watcher daemon. Returns a function to stop it.
*/
export declare function startWatcher(options?: WatchOptions): () => Promise<void>;
/**
* Check whether the index is stale (older than `maxAgeMs`)
*/
export declare function isIndexStale(cwd: string, maxAgeMs: number, graph?: BuildOptions['graph']): boolean;
/**
* Parse a human-readable duration (e.g. "5m", "30s", "1h") to milliseconds.
*/
export declare function parseDuration(s: string): number | null;
//# sourceMappingURL=watcher.d.ts.map