feat(minder): sync Cursor sessions from the Cursor stop and sessionEnd hooks

What does this MR do and why?

Adds glab govern audit sync --hook cursor, for Cursor stop and sessionEnd hooks, on top of the Codex hook in !4302 (merged). Cursor sessions are now synced after each turn, rather than only by the fallback periodic sync.

  • The session ID is taken from the transcript file name, as discovery does, so a session is not created twice.
  • The project comes from the first workspace folder, because a user-level Cursor hook runs in ~/.cursor.
  • Otherwise it works like the Codex hook: it prints nothing, never fails, syncs in the background, and syncs nothing while Cursor is not enabled with glab govern setup --agents cursor.

Installing the hooks with glab govern setup, and removing them with --uninstall, is a follow-up.

Refs https://gitlab.com/gitlab-org/gitlab/-/work_items/635603

How to set up and validate locally

  1. Run glab govern setup --agents cursor.
  2. Add stop and sessionEnd hooks to ~/.cursor/hooks.json that run glab govern audit sync --hook cursor.
  3. Run a Cursor agent session in a GitLab project, and check that the session appears in GitLab after each turn.

Merge request reports

Loading
Loading