@karmaniverous/jeeves-watcher 0.17.11 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,6 +17,134 @@ Filesystem watcher that keeps a [Qdrant](https://qdrant.tech/) vector store in s
17
17
  - **REST API** — Fastify server for search, status, config, and management
18
18
  - **CLI** — `jeeves-watcher init`, `validate`, `start`, and more
19
19
 
20
+ ## Version Control (VCS)
21
+
22
+ The watcher supports optional git-backed version control of watched content. When enabled, every file change under a watch root is automatically committed, providing full history, diff, and revert capabilities.
23
+
24
+ ### Configuration
25
+
26
+ Add a `vcs` block to your config:
27
+
28
+ ```json
29
+ {
30
+ "vcs": {
31
+ "enabled": true,
32
+ "commitDebounceMs": 30000,
33
+ "maxBatchSize": 1000,
34
+ "commitMessage": {
35
+ "enabled": true,
36
+ "provider": "anthropic",
37
+ "model": "claude-haiku-4-0",
38
+ "apiKey": "${ANTHROPIC_API_KEY}"
39
+ },
40
+ "retention": {
41
+ "maxAgeDays": 30,
42
+ "maxVersions": 100,
43
+ "squashCron": "0 0 * * *"
44
+ },
45
+ "defaultAccessToken": "${GIT_TOKEN}"
46
+ }
47
+ }
48
+ ```
49
+
50
+ | Property | Default | Description |
51
+ |----------|---------|-------------|
52
+ | `vcs.enabled` | `false` | Enable git-backed version control globally |
53
+ | `vcs.commitDebounceMs` | `30000` | Debounce interval (ms) for batching file changes into commits. Min: 1000 |
54
+ | `vcs.maxBatchSize` | `1000` | Maximum files per commit batch. Flushes immediately when exceeded. Min: 1 |
55
+ | `vcs.commitMessage.enabled` | `true` | Enable AI-generated commit messages |
56
+ | `vcs.commitMessage.provider` | `"anthropic"` | AI provider (currently only `"anthropic"` supported) |
57
+ | `vcs.commitMessage.model` | `"claude-haiku-4-0"` | AI model for commit message generation |
58
+ | `vcs.commitMessage.apiKey` | — | API key for the commit message provider. Supports env var substitution |
59
+ | `vcs.retention.maxAgeDays` | `30` | Commits older than this are squashed into a baseline |
60
+ | `vcs.retention.maxVersions` | `100` | Maximum commits retained per root (older ones squashed) |
61
+ | `vcs.retention.squashCron` | `"0 0 * * *"` | Cron schedule for squash retention (5-field, checked every 60s) |
62
+ | `vcs.defaultAccessToken` | — | Fallback git access token for all roots. Supports env var substitution |
63
+
64
+ ### Per-Root Overrides via `watch.paths`
65
+
66
+ Watch path entries can be objects with per-root VCS overrides:
67
+
68
+ ```json
69
+ {
70
+ "watch": {
71
+ "paths": [
72
+ "J:/domains/notes/**/*.md",
73
+ {
74
+ "path": "J:/domains/jira/**/*.json",
75
+ "vcs": {
76
+ "enabled": false
77
+ }
78
+ },
79
+ {
80
+ "path": "J:/domains/email/**/*.json",
81
+ "vcs": {
82
+ "remote": "https://github.com/org/email-archive.git",
83
+ "accessToken": "${GITHUB_TOKEN}",
84
+ "retention": {
85
+ "maxAgeDays": 7,
86
+ "maxVersions": 50
87
+ }
88
+ }
89
+ }
90
+ ]
91
+ }
92
+ }
93
+ ```
94
+
95
+ Per-root properties (`remote`, `accessToken`) are only available in per-root overrides. All other `vcs.*` properties can be overridden per root.
96
+
97
+ ### Deployment Notes
98
+
99
+ - **Git dependency:** `git` must be on the system PATH. The watcher initializes a git repository in each VCS-enabled watch root automatically.
100
+ - **stateDir:** The `.jeeves-metadata/` directory (configurable via `stateDir`) is always gitignored. VCS state (git repos) lives inside the watch roots themselves, not in stateDir.
101
+ - **Filesystem constraints:** Each VCS-enabled watch path entry must resolve to a single directory root (not a glob with wildcards in directory segments).
102
+
103
+ ### Remote Push
104
+
105
+ When `remote` is set on a per-root VCS config, the watcher pushes to the remote after every commit. Configure authentication via `accessToken` (per-root) or `defaultAccessToken` (global fallback):
106
+
107
+ ```json
108
+ {
109
+ "vcs": {
110
+ "enabled": true,
111
+ "defaultAccessToken": "${GIT_TOKEN}"
112
+ },
113
+ "watch": {
114
+ "paths": [
115
+ {
116
+ "path": "J:/domains/notes",
117
+ "vcs": {
118
+ "remote": "https://github.com/org/notes-archive.git"
119
+ }
120
+ }
121
+ ]
122
+ }
123
+ }
124
+ ```
125
+
126
+ Push failures are logged and recorded in `/vcs/status` but do not block commits.
127
+
128
+ ### Squash Retention
129
+
130
+ To prevent unbounded history growth, the squash retention system periodically compresses old commits into a single baseline. Controlled by `vcs.retention`:
131
+
132
+ - **`maxAgeDays`** and **`maxVersions`** define retention boundaries. The tighter constraint wins — if `maxAgeDays: 30` would keep 200 commits but `maxVersions: 100` caps at 100, only 100 are retained.
133
+ - **`squashCron`** controls when squash runs (e.g., `"0 0 * * *"` = daily at midnight). Checked every 60 seconds.
134
+ - After squash, old commits are replaced with a single "historical baseline" commit. If a remote is configured, squash triggers a force push.
135
+
136
+ ### API Endpoints
137
+
138
+ | Endpoint | Method | Description |
139
+ |----------|--------|-------------|
140
+ | `/vcs/status` | GET | VCS state for all roots |
141
+ | `/vcs/history` | GET | Commit history for a path/glob |
142
+ | `/vcs/show` | GET | File content at a specific commit |
143
+ | `/vcs/diff` | GET | Diff between commits |
144
+ | `/vcs/revert` | POST | Restore files from a past commit |
145
+ | `/vcs/exclude` | POST | Manage gitignore exclusions |
146
+ | `/vcs/check-exclusion` | GET | Check gitignore status of a path |
147
+
20
148
  ## JsonMap Built-in Helpers
21
149
 
22
150
  The following helpers are available in every JsonMap `lib` context: