docs(skills): clarify that skill update replaces directory contents and discards local files by rajpreetcodes · Pull Request #14689 · cli/cli · GitHub
Skip to content

docs(skills): clarify that skill update replaces directory contents and discards local files - #14689

Open
rajpreetcodes wants to merge 1 commit into
cli:trunkfrom
rajpreetcodes:fix/skill-update-help-extra-files
Open

rajpreetcodes wants to merge 1 commit into
cli:trunkfrom
rajpreetcodes:fix/skill-update-help-extra-files

Conversation

@rajpreetcodes

Copy link
Copy Markdown

Fixes #14647

Description

gh skill update --help previously stated that --force "does not remove extra files added locally."
However, swapDirectoryContents replaces the installed directory wholesale with the staged upstream skill contents for both --force and standard version updates, so any extra locally-added files in the skill directory are discarded whenever an update is applied (as asserted by the update tests in pkg/cmd/skills/update/update_test.go:L778-L780).

This updates cmd.Long and the --force --all example description to accurately state that applying an update replaces the installed directory's contents with the upstream skill, discarding local modifications and additional files. It also clarifies that --force specifically re-downloads and replaces skills when the remote version matches the local tree SHA.

How did you test this change?

I ran go test -v -run TestNewCmdUpdate_Help ./pkg/cmd/skills/update with the updated assertions and verified it passed cleanly.

I then ran go run ./cmd/gh skill update --help with the built binary and confirmed the rendered help text:

Applying an update replaces the installed skill directory's contents
with the upstream skill, discarding local modifications and additional files.

With `--force`, re-downloads and replaces skills even when the
remote version matches the local tree SHA.

and the updated example line:

  # Re-download all skills even if up to date (discarding local modifications)
  $ gh skill update --force --all

Key points

  • Help text correction only: The underlying update behavior is intentional and relied upon to clean stale files during updates. Only the documentation was incorrect.
  • Clear separation: Explains the directory replacement rule for all updates generally, and restricts the --force description to what the flag actually controls (updating even when the remote tree SHA has not changed).

Notes for reviewers

The change is in pkg/cmd/skills/update/update.go with corresponding assertions added in TestNewCmdUpdate_Help in pkg/cmd/skills/update/update_test.go.

Authorship and follow-up

Who wrote this:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @rajpreetcodes will read and reply directly. Name the account.
  • An agent will draft replies and @rajpreetcodes will read them before they are posted.
  • Nobody has explicitly committed to replying.

…nd discards local files

gh skill update --help previously claimed that --force 'does not remove extra files added locally'. In reality, swapDirectoryContents replaces the installed directory wholesale with the staged upstream contents during any update, discarding locally added files as well as local modifications.

Update cmd.Long and example documentation to accurately explain that updates replace the installed directory's contents, and clarify that --force specifically triggers re-downloading and replacement even when the remote tree SHA has not changed. Add assertions in TestNewCmdUpdate_Help.

Fixes cli#14647
@rajpreetcodes
rajpreetcodes requested review from a team as code owners October 14, 2026 14:31
@rajpreetcodes
rajpreetcodes requested a review from niik October 14, 2026 14:31
@github-actions github-actions Bot added external pull request originating outside of the CLI core team needs-triage needs to be reviewed ready-for-review and removed needs-triage needs to be reviewed labels Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team ready-for-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh skill update help incorrectly promises to preserve locally added files

1 participant