Skip to content

Support install and uninstall backend skills flow#288

Merged
tninja merged 4 commits intomainfrom
kang_feat
Apr 11, 2026
Merged

Support install and uninstall backend skills flow#288
tninja merged 4 commits intomainfrom
kang_feat

Conversation

@tninja
Copy link
Copy Markdown
Owner

@tninja tninja commented Apr 11, 2026

Summary

Backend skill management only handled install flows, which made it awkward to remove skill setups cleanly.

This branch adds an explicit install/uninstall choice to ai-code-install-backend-skills, keeps install behavior using the existing backend-specific handler when available, and routes uninstall through a dedicated fallback prompt so Codex can remove skill files and related configuration consistently.

Verification

Previously verified during implementation with targeted and full ERT runs for the touched backend flow; no tests were run as part of this PR creation request.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d202f90fa2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds explicit install vs uninstall handling to backend “skills” management so users can remove skill setups cleanly, while preserving existing install behavior where backend-specific handlers exist.

Changes:

  • Extend ai-code-install-backend-skills to prompt for an install/uninstall action and route uninstall through a dedicated fallback prompt.
  • Refactor the existing install fallback into a shared install/uninstall fallback helper with action-specific prompts.
  • Update the transient menu label and expand ERT coverage for the new action choice and uninstall path.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
ai-code-backends.el Adds install/uninstall action selection and a shared fallback prompt helper; updates backend specs.
ai-code.el Updates transient menu label to reflect (un)install capability.
test/test_ai-code-backends.el Updates existing install tests to account for the new action prompt and adds an uninstall fallback test.

Comment on lines 612 to 621
(defun ai-code-install-backend-skills ()
"Install skills for the currently selected backend.
If the backend defines an :install-skills property, use it:
- string: run as a shell command via `compile'.
- symbol: call the function.
Otherwise fall back to prompting the AI session to install from a
skills repository URL."
;; DONE: firstly ask user if it is install or uninstall, then ask for the repo URL if needed, and finally run install / uninstall using corresponding prompt.
(interactive)
(let* ((spec (ai-code--backend-spec ai-code-selected-backend)))
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ai-code-install-backend-skills now supports both install and uninstall via completing-read, but the docstring still describes install-only behavior, and the inline ;; DONE: comment reads like leftover implementation notes. Please update the docstring to reflect the new (un)install flow and remove the DONE note to keep the function documentation accurate and maintainable.

Copilot uses AI. Check for mistakes.
(defun ai-code--manage-backend-skills-fallback (label action)
"Fallback backend skills management for LABEL and ACTION.
ACTION should be the symbol `install' or `uninstall'."
(let* ((action-name (if (eq action 'uninstall) "uninstall" "install"))
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ai-code--manage-backend-skills-fallback silently treats any ACTION other than uninstall as install (via action-name defaulting to "install"). Since the docstring says ACTION should be install or uninstall, it would be safer to validate ACTION explicitly (e.g., pcase/memq) and signal a user-error for unexpected values to avoid incorrect prompts if this helper is called incorrectly in the future.

Suggested change
(let* ((action-name (if (eq action 'uninstall) "uninstall" "install"))
(let* ((action-name
(pcase action
('install "install")
('uninstall "uninstall")
(_ (user-error
"Invalid backend skills action: %S; expected `install' or `uninstall'"
action))))

Copilot uses AI. Check for mistakes.
url label))
(if (eq action 'uninstall)
(format
"Please read the README of %s and uninstall/remove the skills described there for %s. Follow the repository instructions to remove any installed skill files and cleanup related configuration."
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the uninstall fallback prompt, "cleanup related configuration" should be "clean up related configuration" (verb form). This prompt is user/AI-facing text, so tightening grammar here helps avoid ambiguity.

Suggested change
"Please read the README of %s and uninstall/remove the skills described there for %s. Follow the repository instructions to remove any installed skill files and cleanup related configuration."
"Please read the README of %s and uninstall/remove the skills described there for %s. Follow the repository instructions to remove any installed skill files and clean up related configuration."

Copilot uses AI. Check for mistakes.
@tninja tninja merged commit a91b0a4 into main Apr 11, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants