Repository navigation
Commit 328fe57
committed
Update commit prompt matching to check file overlap for empty prompts
- > Please fix a context-leak issue in `apps/editor/src/utils/commit-message-details.ts`.
> **The Problem:**
> Unprompted Code-at-Cursor actions pass an empty string `""` as the prompt. Currently, `CommitMessageDetails.add` finds the first entry matching this empty prompt and merges all new `files` and `selected_files` into it. Over a session, this creates one massive workspace-wide entry for `""`, causing unrelated context files to bleed into the ASCII file tree when committing.
> **The Solution:**
> We still want to save context files for unprompted completions, but we need to isolate them per edited file.
> Update the `existing` lookup logic in `CommitMessageDetails.add`:
> 1. If `simplified_prompt` is NOT empty, match by `p.prompt == simplified_prompt` (current behavior).
> 2. If `simplified_prompt` IS empty `""`, only match an existing empty prompt entry if it shares at least one modified file (e.g., `p.files.some(f => files_to_add.includes(f))`).
> 3. If no matching file is found f...
└── apps
└── editor
└── src
├── commands
│ ├── apply-response-command
│ │ └── utils
│ │ └── preview-handler.ts
│ ├── code-at-cursor-command
│ │ ├── code-at-cursor-commands.ts
│ │ └── utils
│ │ └── perform-code-at-cursor.ts
│ ├── generate-commit-message-commands
│ │ └── actions
│ │ ├── get-prompt-data.ts
│ │ └── run-generate-action.ts
│ └── history-command
│ └── actions
│ └── restore-checkpoint.ts
├── services
│ └── git-discard-file-watcher.ts
└── utils
└── commit-message-details.ts1 parent 1e78bfe commit 328fe57
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
95 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
| |||
0 commit comments