feat(s1p2): add inotify-based filesystem write detection with external conflict tracking
This commit is contained in:
parent
6b239c5ce5
commit
e5d9f51df7
8 changed files with 501 additions and 7 deletions
28
v2/src/lib/adapters/fs-watcher-bridge.ts
Normal file
28
v2/src/lib/adapters/fs-watcher-bridge.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// Filesystem watcher bridge — listens for inotify-based write events from Rust
|
||||
// Part of S-1 Phase 2: real-time filesystem write detection
|
||||
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { listen, type UnlistenFn } from '@tauri-apps/api/event';
|
||||
|
||||
export interface FsWriteEvent {
|
||||
project_id: string;
|
||||
file_path: string;
|
||||
timestamp_ms: number;
|
||||
}
|
||||
|
||||
/** Start watching a project's CWD for filesystem writes */
|
||||
export function fsWatchProject(projectId: string, cwd: string): Promise<void> {
|
||||
return invoke('fs_watch_project', { projectId, cwd });
|
||||
}
|
||||
|
||||
/** Stop watching a project's CWD */
|
||||
export function fsUnwatchProject(projectId: string): Promise<void> {
|
||||
return invoke('fs_unwatch_project', { projectId });
|
||||
}
|
||||
|
||||
/** Listen for filesystem write events from all watched projects */
|
||||
export function onFsWriteDetected(
|
||||
callback: (event: FsWriteEvent) => void,
|
||||
): Promise<UnlistenFn> {
|
||||
return listen<FsWriteEvent>('fs-write-detected', (e) => callback(e.payload));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue