@copass/datasource-fs is the official filesystem driver for Copass. It scans, diffs, and watches a local directory, pushing every file event through a registered data source. It’s what the CLI uses internally for copass index and copass watch.
Use this when you want filesystem-backed ingestion inside your own Node app — a background worker, a custom CLI, an Electron app, a CI hook.
Install
FileSystemDataSource.create
Idempotent factory — registers the data source the first time, reuses it thereafter.
Full index
One-shot scan of the tree. Honors.gitignore and the indexing config on the sandbox.
dryRun: true— return the discovered file list without pushing anything.onProgress: (msg) => …— progress updates suitable for a spinner or log line.maxFiles: N— cap the run.
Continuous watching
source_type (code for recognized languages, markdown / json / text otherwise).
Inspect the most recent reconcile summary:
One-shot incremental diff
Perfect for a CI job that runs every commit without holding chokidar open:<projectPath>/.olane/watch-state.json between runs so only changed files are re-pushed.
Lifecycle inheritance
FileSystemDataSource extends BaseDataSource, so it inherits the standard data-source lifecycle verbs:
Power-user exports
For callers that want to integrate at a lower level thanFileSystemDataSource:
FileSystemDataSource is built on — reach for them when you want custom watch semantics or to drive indexing from your own orchestration layer.
Service install (launchd / systemd)
Run the watcher as a user-level background service instead of a foreground process:--user unit on Linux, Task Scheduler entry on Windows) are generated and installed automatically. The CLI uses this internally for copass watch install-service.
Next steps
- SDK — build your own driver by subclassing
BaseDataSourcefrom@copass/core. - Secure Storage — the containment model this driver operates inside.
- CLI — if you just want filesystem indexing without writing code.

