Commit 1bd8cbf
* feat(db): add 020_git_sync_prune migration
Adds disabled_at column to workflow_definitions and git_repo_workflows
join table to support prune behavior for GitOps sync (issue #16).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(audit): add git.sync.pruned and git.push.received
* feat(workflow): add Disable/Reenable for GitOps prune
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(repo/sync): add git_repo_workflows helpers
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(repo/sync): wire prune into SyncRepo
Add Pruned field to Report, call RecordSeen+Reenable per file, and
drive Disable+audit+RemoveSeenRecords for stale workflows when Prune
is set. Use DB clock for syncStart to avoid Go/Postgres time skew.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(repo/sync): sanitize URLs in audit metadata
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(server): add /hooks/git/<id> webhook receiver
Registers POST /hooks/git/<repo-id>: HMAC-SHA256 verifies against
webhook_secret, emits git.push.received audit event, fires SyncRepo
in a goroutine for immediate 202 response. Adds Store.GetByID
(no team_id filter) and wires RepoStore/GitDriver into Server.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(repo): clean up cloned working tree on Delete
Adds a cloneBasePath parameter to Store.Delete so the CLI removes the
on-disk clone directory (filepath.Join(cloneBasePath, repoID)) after the
DB transaction commits. Filesystem failures are logged via slog.Warn but
never fail the call — an orphan directory is preferable to an orphan row.
The CLI resolves the path from cfg.Storage.Path (same fallback as serve).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(cli): add mantle repos update
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat: add mantle repos plan and apply for manual flow
Adds PlanRepo (dry-run: pull + discover + classify without any DB writes
or audit events), and exposes it via `mantle repos plan <name>`. Also adds
`mantle repos apply <name>` as an explicit manual-sync alias for operators
using auto_apply:false repos. Refactors newReposSyncCommand to share
buildSyncDriver so all three commands use identical driver-selection logic.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: document Plan C commands and webhook endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: address pre-push reviewer feedback for Plan C
- Add --webhook-secret flag to repos add and repos update (blocker)
- Remove stray fmt.Println from webhook test
- Clarify plan/apply/update help text, mention commands in repos Long
- Sanitize last_sync_error for pull/discover failure paths
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(server): use request context in webhook handler to resolve G118
gosec G118 (CWE-400) flags goroutines that use context.Background()
when a request-scoped context is available. Two fixes:
- emitGitAudit: called synchronously while the request is still in
flight, so r.Context() is correct and preserves trace/deadline info.
- background SyncRepo goroutine: context.WithoutCancel(r.Context())
propagates request values (e.g. trace IDs) without tying the
goroutine's lifetime to the HTTP request, so it survives after the
202 response is sent.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: compile errors and govulncheck exclusions on feat/git-sync-complete
- Add WebhookSecret field to Repo struct (was dropped during rebase)
- Restore reposCtx to return (context.Context, *config.Config); Plan C
tests call store.Get with a real context — the 1-return form was wrong
- Update govulncheck exclusions to include go-git transitive dep vulns
(matching feat/git-sync-engine) and refactor with KNOWN variable
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(db): add migration 021 for webhook_secret column on git_repos
Migration 019 intentionally deferred this column to Plan C. The column
is required by store.Create and store.Update which pass webhook_secret
as parameter $10 in the INSERT/UPDATE statements.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(repo): include webhook_secret in store.Get query
store.Get selected 15 columns but did not include webhook_secret, so
the field always read back as empty string. Added it to the SELECT and
Scan alongside the other nullable fields, matching store.GetByID.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Michael McNees <mmcnees@Michaels-MacBook-Pro.local>
1 parent 7d76ee8 commit 1bd8cbf
21 files changed
Lines changed: 1333 additions & 101 deletions
File tree
- packages/engine/internal
- audit
- cli
- db/migrations
- repo
- sync
- server
- workflow
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| |||
115 | 118 | | |
116 | 119 | | |
117 | 120 | | |
118 | | - | |
| 121 | + | |
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| 38 | + | |
| 39 | + | |
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| |||
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
54 | | - | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
| |||
94 | 100 | | |
95 | 101 | | |
96 | 102 | | |
| 103 | + | |
| 104 | + | |
97 | 105 | | |
98 | 106 | | |
99 | 107 | | |
| |||
168 | 176 | | |
169 | 177 | | |
170 | 178 | | |
171 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
172 | 189 | | |
173 | 190 | | |
174 | 191 | | |
| |||
219 | 236 | | |
220 | 237 | | |
221 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
222 | 284 | | |
223 | 285 | | |
224 | 286 | | |
| |||
240 | 302 | | |
241 | 303 | | |
242 | 304 | | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 305 | + | |
262 | 306 | | |
263 | 307 | | |
264 | 308 | | |
| |||
276 | 320 | | |
277 | 321 | | |
278 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
0 commit comments