cursor updates & path extraction utility#77
Merged
Conversation
Cursor now supports project-level hooks at `.cursor/hooks.json` in addition to user-level hooks at `~/.cursor/hooks.json`. Changes: - Update CursorHarness::settings_path() to respect global parameter - Project init creates .cursor/hooks.json (project-level) - Global init creates ~/.cursor/hooks.json (user-level) - Update example scripts to use project-level hooks - Fix check_appointment_time.py to handle patient_name lookups - Add tests for cursor init hook locations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…tion New lifecycle events (fire-and-forget): - afterShellExecution: command, output, duration - afterMCPExecution: tool_name, tool_input, result_json, duration - afterAgentResponse: text - afterAgentThought: text, duration_ms Schema updates: - Common fields: model, cursor_version, user_email (all optional) - Response fields: snake_case (user_message, agent_message) - beforeSubmitPrompt: user_message on block - stop: loop_count input field Stop hook agent looping: - Block decision returns followup_message - Cursor submits as next user message (max 5 auto-followups) - Mirrors Claude Code's block+reason pattern 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates Cupcake to align with Cursor's latest hooks documentation and removes the incomplete cupcake-onboard application. The changes focus on implementing new Cursor event types, improving protected path detection, and correcting the hooks configuration approach.
- Updated Cursor hooks to support project-level configuration (
.cursor/hooks.json) in addition to global (~/.cursor/hooks.json) - Implemented new Cursor lifecycle events:
afterShellExecution,afterMCPExecution,afterAgentResponse,afterAgentThought - Enhanced
stophook to support agent loop continuation viafollowup_messagewith automatic loop prevention - Added command path extraction to detect parent directories affected by shell commands, enabling better protection for paths like
.cupcake/ - Removed incomplete
cupcake-onboardTUI application (to be replaced with a skill-based approach) - Changed PostgreSQL demo port from 5432 to 15432 to avoid conflicts
Reviewed changes
Copilot reviewed 59 out of 63 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
cupcake-core/src/preprocessing/command_path_extractor.rs |
New module to extract target paths from shell commands for parent directory protection |
cupcake-core/src/preprocessing/mod.rs |
Integration of path extraction with preprocessing pipeline and enriched input capture |
cupcake-core/src/harness/events/cursor/*.rs |
Added 5 new Cursor event types with proper field definitions |
cupcake-core/src/harness/response/cursor/*.rs |
Implemented response builders for new events using snake_case fields |
docs/docs/reference/harnesses/cursor.md |
Comprehensive documentation update for all Cursor hooks and events |
fixtures/*/builtins/protected_paths.rego |
Enhanced policies to protect parent directories from destructive commands |
examples/cursor/0_Welcome/setup.sh |
Updated to create project-level hooks at .cursor/hooks.json |
examples/cursor/0_Welcome/mcp_setup.sh |
Changed PostgreSQL port to 15432 and improved setup flow |
cupcake-cli/src/harness_config.rs |
Fixed to properly support project vs global Cursor hooks |
cupcake-onboard/* |
Removed entire incomplete onboarding application |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
captjt
approved these changes
Dec 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
updates per cursor hooks docs
also introduced a parent path extraction utility
removal of unfinished onboard app (we will support a skill instead)