Skip to content

Commit 03af83c

Browse files
authored
UX: Add onboarding quickstart and menu integration (#281)
* Document a minimal onboarding flow for first-run usability This spec captures a one-time quickstart buffer attached to the main menu so new users can start a session and use the three core commands without hunting through the full feature surface. Constraint: Must improve discoverability without adding a second workflow system Rejected: Multi-step setup wizard | too interruptive for Emacs-native users Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep onboarding focused on first-minute actions; do not let it expand into general help docs Tested: Spec self-review against brainstorming reviewer checklist Not-tested: Live Emacs UI behavior and implementation details * Add onboarding quickstart and menu integration * add missing files. add design doc * add screenshot * Add GitHub CI checks review mode and tests * turn off approval suggestion * Request author voice in PR description prompt * Persist onboarding seen state and restore context * fix test * update HISTORY
1 parent 241f289 commit 03af83c

16 files changed

Lines changed: 1315 additions & 39 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ GPATH
88
__pycache__/
99
*.elc
1010
.ai-behaviors/
11+
.omx/
12+
flycheck_*

HISTORY.org

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Release history
33

44
** Main branch change
5+
- UX: Add onboarding quickstart and menu integration
6+
- Also improve the Github PR action feature. It can look into CI checks status and provide analysis
57
- Feat: Add diagnostics mcp support with Flycheck and Flymake
68
- Fix: Add SPDX header and commentary tests for autoloads
79
- Also added unit-test CI workflow

README.org

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ First 60 seconds:
7272
- `C-c a q`: Ask question only (no code change)
7373
- `C-c a z`: Jump back to AI session buffer
7474

75+
The first time you open `C-c a`, AI Code also shows a small quickstart buffer
76+
with these core actions. You can reopen it later from `C-c a h`
77+
(`Help / Quick Start`).
78+
7579
** Installation
7680

7781
Enable installation of packages from MELPA by adding an entry to package-archives after (require 'package) and before the call to package-initialize in your init.el or .emacs file:
@@ -306,6 +310,10 @@ With the built-in =get_diagnostics= MCP tool, the loop can move further left:
306310
- treat completion as /no new diagnostics/ on the touched files relative to the baseline, instead of requiring the entire project to be clean
307311
- use tests as the next sensor in the loop, not the first one
308312

313+
Screenshot:
314+
315+
[[file:./emacs_mcp_tool_diagnosis.png]]
316+
309317
The benefit is practical:
310318

311319
- faster feedback after each AI code change
@@ -315,6 +323,12 @@ The benefit is practical:
315323

316324
This is why features such as `ai-code-auto-test-type` and `ai-code-tdd-cycle` fit the idea of harness engineering: they turn testing and follow-up into part of the system, not an afterthought in each prompt.
317325

326+
Nit: During using auto test feature, I prefer to turn off the approval request from AI, it will make the whole process more smooth. Eg. for Codex CLI, it is
327+
328+
#+begin_src emacs-lisp
329+
(setq ai-code-codex-cli-program-switches '("-a" "never"))
330+
#+end_src
331+
318332
- Relevant article: [[https://martinfowler.com/articles/exploring-gen-ai/harness-engineering.html][Harness Engineering]]
319333

320334
*** Desktop Notifications (Experimental)

ai-code-autoloads.el

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,21 @@ Navigate using the clickable symbol clicked by mouse EVENT.
912912
913913
(fn EVENT)" t)
914914
(register-definition-prefixes "ai-code-session-link" '("ai-code-"))
915+
916+
917+
;;; Generated autoloads from ai-code-onboarding.el
918+
919+
(defvar ai-code-onboarding-auto-show t "\
920+
When non-nil, show the quickstart automatically for first-run usage.")
921+
(custom-autoload 'ai-code-onboarding-auto-show "ai-code-onboarding" t)
922+
(defvar ai-code-onboarding-seen nil "\
923+
Whether the user has already seen the onboarding quickstart.")
924+
(custom-autoload 'ai-code-onboarding-seen "ai-code-onboarding" t)
925+
(autoload 'ai-code-onboarding-open-quickstart "ai-code-onboarding" "\
926+
Open the onboarding quickstart buffer." t)
927+
(autoload 'ai-code-onboarding-disable-auto-show "ai-code-onboarding" "\
928+
Disable future auto-display of the onboarding quickstart." t)
929+
(register-definition-prefixes "ai-code-onboarding" '("ai-code-onboarding-"))
915930

916931
;;; End of scraped data
917932

ai-code-backends.el

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
(require 'seq)
1313

14-
(require 'ai-code-git)
14+
(require 'ai-code-git)
1515

1616
(defvar ai-code-cli)
1717
(defvar claude-code-terminal-backend)
@@ -20,6 +20,7 @@
2020
(declare-function claude-code--term-send-string "claude-code" (backend string))
2121
(declare-function ai-code--validate-git-repository "ai-code-git" ())
2222
(declare-function ai-code--git-root "ai-code-file" (&optional dir))
23+
(declare-function ai-code-onboarding-show-backend-switch-hint "ai-code-onboarding" ())
2324
(declare-function ai-code-read-string "ai-code-input" (prompt &optional initial-input candidate-list))
2425

2526
(defvar ai-code--cli-start-fn #'ai-code--unsupported-start)
@@ -450,13 +451,13 @@ Sets backend dispatch functions and updates `ai-code-cli'."
450451
;; inform user to install it.
451452
(when (and feature (not (featurep feature)))
452453
(user-error
453-
"Backend '%s' is not available. Please install the package providing '%s' and try again"
454+
"Backend '%s' is not available. Please install the package providing '%s' and try again"
454455
label (symbol-name feature)))
455456
(let ((missing-fns (seq-filter (lambda (fn) (not (fboundp fn)))
456457
(list start switch send))))
457458
(when missing-fns
458459
(user-error
459-
"Backend '%s' is not available (missing functions: %s). Please install the package providing '%s'"
460+
"Backend '%s' is not available (missing functions: %s). Please install the package providing '%s'"
460461
label
461462
(mapconcat #'symbol-name missing-fns ", ")
462463
(symbol-name feature))))
@@ -511,7 +512,9 @@ invoke `ai-code-cli-resume'; otherwise call `ai-code-cli-start'."
511512
(mapcar #'car ordered-choices)
512513
nil t nil nil current-label))
513514
(key (cdr (assoc choice ordered-choices))))
514-
(ai-code-set-backend key)))
515+
(ai-code-set-backend key)
516+
(when (fboundp 'ai-code-onboarding-show-backend-switch-hint)
517+
(ai-code-onboarding-show-backend-switch-hint))))
515518

516519
;;;###autoload
517520
(defun ai-code-open-backend-config ()

ai-code-git.el

Lines changed: 55 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Issue Investigation Steps:
106106
"Build PR description prompt for REVIEW-SOURCE with PR-URL."
107107
(let ((source-instruction
108108
(ai-code--pull-or-review-source-instruction review-source)))
109+
;; DONE: Update the prompt to make the description sound like it's written by the author/maintainer, and keep it concise.
109110
(format "Prepare a pull request description for: %s
110111
111112
%s
@@ -114,24 +115,49 @@ PR Description Steps:
114115
1. Add a summary of the problem and the approach taken in the PR.
115116
2. Highlight the most important code changes and user-visible impact.
116117
3. Add a testing section with relevant verification details.
117-
4. Format the result as a concise PR description ready to share with reviewers."
118+
4. Format the result as a concise PR description ready to share with reviewers,
119+
written in the voice of the author or maintainer."
120+
pr-url source-instruction)))
121+
122+
(defun ai-code--build-pr-ci-check-init-prompt (review-source pr-url)
123+
"Build CI checks review prompt for REVIEW-SOURCE with PR-URL."
124+
(let ((source-instruction
125+
(ai-code--pull-or-review-source-instruction review-source 'review-ci-checks)))
126+
(format "Review GitHub CI checks for pull request: %s
127+
128+
%s
129+
130+
CI Checks Review Steps:
131+
1. Review the GitHub CI checks for this pull request.
132+
2. If there is a failing or error state, inspect the failing checks and relevant details.
133+
3. Analyze the likely root cause of each failure.
134+
4. No need to make code change. Provide analysis only."
118135
pr-url source-instruction)))
119136

120137
(defun ai-code--pull-or-review-source-instruction (review-source &optional review-mode)
121138
"Return source instruction string for REVIEW-SOURCE and REVIEW-MODE."
122-
(if (eq review-mode 'investigate-issue)
123-
(pcase review-source
124-
('github-mcp
125-
"Use GitHub MCP server to inspect the GitHub issue and relevant repository context.")
126-
('gh-cli
127-
"Use gh CLI tool to inspect the GitHub issue and relevant repository context.")
128-
(_ "Investigate this GitHub issue using the repository as context."))
129-
(pcase review-source
130-
('github-mcp
131-
"Use GitHub MCP server to fetch pull request details and review comments.")
132-
('gh-cli
133-
"Use gh CLI tool to fetch pull request details and review comments.")
134-
(_ "Review this pull request."))))
139+
(pcase review-mode
140+
('investigate-issue
141+
(pcase review-source
142+
('github-mcp
143+
"Use GitHub MCP server to inspect the GitHub issue and relevant repository context.")
144+
('gh-cli
145+
"Use gh CLI tool to inspect the GitHub issue and relevant repository context.")
146+
(_ "Investigate this GitHub issue using the repository as context.")))
147+
('review-ci-checks
148+
(pcase review-source
149+
('github-mcp
150+
"Use GitHub MCP server to fetch pull request details and CI checks.")
151+
('gh-cli
152+
"Use gh CLI tool to fetch pull request details and CI checks.")
153+
(_ "Review the GitHub CI checks for this pull request.")))
154+
(_
155+
(pcase review-source
156+
('github-mcp
157+
"Use GitHub MCP server to fetch pull request details and review comments.")
158+
('gh-cli
159+
"Use gh CLI tool to fetch pull request details and review comments.")
160+
(_ "Review this pull request.")))))
135161

136162
(defun ai-code--pull-or-review-url-prompt (review-mode)
137163
"Return the URL prompt string for REVIEW-MODE."
@@ -153,6 +179,7 @@ PR Description Steps:
153179
(let* ((review-mode-alist '(("Review the PR" . review-pr)
154180
("Check unresolved feedback" . check-feedback)
155181
("Investigate issue" . investigate-issue)
182+
("Review GitHub CI checks" . review-ci-checks)
156183
("Prepare PR description" . prepare-pr-description)))
157184
(review-mode (completing-read "Select analysis mode (PR or issue): "
158185
review-mode-alist
@@ -162,15 +189,18 @@ PR Description Steps:
162189

163190
(defun ai-code--build-pr-init-prompt (review-source target-url review-mode)
164191
"Build initial prompt for REVIEW-SOURCE, TARGET-URL and REVIEW-MODE."
192+
;; DONE: add an option here: review github CI checks. If there is error, look into them and figure out root cause. Only provide analysis, no need to change code.
165193
(pcase review-mode
166-
('investigate-issue
167-
(ai-code--build-issue-investigation-init-prompt review-source target-url))
168-
('check-feedback
169-
(ai-code--build-pr-feedback-check-init-prompt review-source target-url))
170-
('prepare-pr-description
171-
(ai-code--build-pr-description-init-prompt review-source target-url))
172-
(_
173-
(ai-code--build-pr-review-init-prompt review-source target-url))))
194+
('investigate-issue
195+
(ai-code--build-issue-investigation-init-prompt review-source target-url))
196+
('check-feedback
197+
(ai-code--build-pr-feedback-check-init-prompt review-source target-url))
198+
('review-ci-checks
199+
(ai-code--build-pr-ci-check-init-prompt review-source target-url))
200+
('prepare-pr-description
201+
(ai-code--build-pr-description-init-prompt review-source target-url))
202+
(_
203+
(ai-code--build-pr-review-init-prompt review-source target-url))))
174204

175205
;;;###autoload
176206
(defun ai-code-pull-or-review-diff-file ()
@@ -724,7 +754,9 @@ If not inside a Git repository, do nothing."
724754
"GTAGS"
725755
"GRTAGS"
726756
"GPATH"
727-
"__pycache__/"))
757+
"__pycache__/"
758+
"*.elc"
759+
"flycheck_*"))
728760
(gitignore-content (when (file-exists-p gitignore-path)
729761
(with-temp-buffer
730762
(insert-file-contents gitignore-path)

0 commit comments

Comments
 (0)