Repository navigation
Feat: Quick prompts - #367
Merged
Merged
Conversation
added 9 commits
May 21, 2026 11:54
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a “quick prompts” shortcut for sending frequently reused prompts to the active AI session, while refactoring shared path/context helpers into a new utility module and tightening some backend-infra behaviors (terminal dispatch + session naming).
Changes:
- Introduce
ai-code-quick-prompts+ai-code-send-quick-promptand wire it into the transient menu. - Refactor shared helpers (git root, project root, clipboard/window context, repo context formatting) into new
ai-code-utils.eland update call sites. - Improve backend infra: generic terminal operation dispatch, working-directory resolution via shared helper, and default instance-name preferring current git branch.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| ai-code.el | Adds quick prompts customization/command; refactors checkpoint/debug prompt sending to reuse confirm/send helper; updates menu. |
| ai-code-utils.el | New shared utilities module (git/project roots, clipboard + context files, repo context formatting, task files dir). |
| ai-code-input.el | Requires new utils module and introduces ai-code--confirm-and-send helper for “edit then send” flows. |
| ai-code-prompt-mode.el | Switches to utils-provided helpers/constants; removes duplicated task-dir helpers. |
| ai-code-file.el | Uses shared helpers and ai-code--confirm-and-send for lint/build/test prompt flows; removes duplicated repo-context formatting. |
| ai-code-discussion.el | Replaces repeated read/edit/send patterns with ai-code--confirm-and-send; updates declarations to utils. |
| ai-code-github.el | Uses ai-code--confirm-and-send for review/PR prompt editing flow. |
| ai-code-backends-infra.el | Adds terminal operation dispatcher, uses shared session-root logic, and prefers branch name for default instance names. |
| ai-code-backends.el | Updates ai-code--git-root declaration to point at utils module. |
| ai-code-change.el | Updates clipboard/git-root/repo-context declarations to utils module. |
| ai-code-agile.el | Updates context-files/git-root declarations to utils module. |
| ai-code-behaviors.el | Updates clipboard/git-root declarations to utils module. |
| ai-code-gptel-agent.el | Updates git-root declaration to utils module. |
| ai-code-git.el | Updates ensure-files-directory/git-root declarations to utils module. |
| ai-code-harness.el | Updates ensure-files-directory/git-root declarations to utils module. |
| test/test_00-bootstrap.el | Makes packaged-library selection robust by filtering to directories. |
| test/test_ai-code.el | Updates checkpoint test to assert prompt insertion (vs direct CLI send/switch). |
| test/test_ai-code-utils.el | New test coverage for extracted utils helpers. |
| test/test_ai-code-file.el | Updates tests to stub ai-code-plain-read-string; adds session-project-root tests. |
| test/test_ai-code-prompt-mode.el | Adjusts note-search tests to assert inserted prompt; normalizes temp external dir via truename. |
| test/test_ai-code-onboarding.el | Makes packaged-transient selection robust by filtering to directories. |
| test/test_ai-code-backends-infra.el | Adds coverage for new default instance naming, session working dir delegation, and terminal dispatch routing. |
Comment on lines
18
to
33
| @@ -27,6 +26,10 @@ | |||
| (require 'ai-code-backends-infra-ghostel) | |||
|
|
|||
| (declare-function ai-code--session-handle-at-input "ai-code-input" ()) | |||
| (declare-function ai-code--session-project-root "ai-code-utils" ()) | |||
|
|
|||
| ;; DONE: In previous PR: https://github.com/tninja/ai-code-interface.el/pull/349, it set default new AI session instance names from prompt buffer filenames | |||
| ;; But now we want to set the default new AI session instance names as current branch name. If this name has been used for an existing session, then we can fallback to using the prompt buffer filename as the default new AI session instance name. | |||
|
|
|||
Comment on lines
+223
to
+232
| ;;;###autoload | ||
| (defun ai-code-send-quick-prompt () | ||
| "Select and send a pre-defined prompt from `ai-code-quick-prompts`." | ||
| ;; DONE: use ai-code-read-string to allow user to modify the prompt before sending | ||
| (interactive) | ||
| (unless ai-code-quick-prompts | ||
| (user-error "No quick prompts configured; customize `ai-code-quick-prompts' first")) | ||
| (let ((selected (completing-read "Quick prompt: " ai-code-quick-prompts nil t))) | ||
| (ai-code--confirm-and-send "Edit quick prompt: " selected))) | ||
|
|
| ((symbol-function 'ai-code-read-string) | ||
| (lambda (prompt &optional initial-input &rest _args) | ||
| ((symbol-function 'ai-code-plain-read-string) | ||
| (lambda (prompt &optional initial-input) |
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.
We might want to send out same prompt every couple of days or weeks. Eg. Summarise the recent AI coding related news. But we might not want to manually type or find the prompt. This feature is to make this thing easier.
Also do couple of code refactoring / improvement.