Skip to content

gh skill update help incorrectly promises to preserve locally added files #14647

Agent suggestions

Public preview

Description

@liby

Describe the bug

gh skill update --help says that --force refreshes locally modified skill files but “does not remove extra files added locally.” On 2.102.0, applying an update replaces all contents of the installed skill directory, deleting locally added files. This also happens during a version update without --force.

A user relying on that sentence can lose notes or scripts they added to a skill directory. The documented --force --all example describes restoring modified files without explaining that additional files are discarded.

Affected version

gh version 2.102.0 (2026-09-30)
https://github.com/cli/cli/releases/tag/v2.102.0

Steps to reproduce the behavior

dir=$(mktemp -d)
gh skill install cli/cli gh --dir "$dir"
echo notes > "$dir/gh/LOCAL-NOTES.md"
gh skill update gh --dir "$dir" --force --all
ls "$dir/gh"

A version update reproduces this without --force: install gh with --pin v2.100.0, add LOCAL-NOTES.md, then run gh skill update gh --dir "$dir" --unpin --all.

Expected vs actual behavior

Expected from the help: LOCAL-NOTES.md remains alongside the refreshed SKILL.md.

Actual: LOCAL-NOTES.md is deleted; only SKILL.md remains in this reproduction.

#13449 explicitly made stale-file removal part of an in-place update, and the update test requires a locally planted file to disappear. However, the help still promises to keep extra local files.

Please correct the help to explain that applying any update replaces the installed directory's contents with the upstream skill, discarding local modifications and additional files. The --force description should separately explain that it also applies this replacement when the upstream version has not changed.

Logs

$ gh skill update gh --dir "$dir" --force --all
1 update(s) available:
  • gh (cli/cli) a4791f98 (reinstall) [v2.102.0]

Updated gh
$ ls "$dir/gh"
SKILL.md

Activity

  1. cli-triage commented on Oct 12, 2026

    @cli-triage

    I'm suggesting bug, priority-3, and gh-skill for maintainer review. This looks like a genuine documentation defect rather than a code regression: gh skill update --help says --force "does not remove extra files added locally," but swapDirectoryContents in update.go#L468-L506 always moves every existing entry in the skill directory aside and replaces it wholesale with the freshly staged contents, for both --force updates and normal version updates — so any extra locally-added file in the skill directory is discarded regardless of --force. The fix is updating the help text (not the behavior, which an existing test asserts is intentional) to accurately describe that any update replaces the installed directory's contents, and that --force specifically means this replacement also happens when the remote version hasn't changed. I didn't find an exact duplicate; related but distinct issues are #14190, #13542, and #13370 (also about gh skill update/install but not this specific help-text inaccuracy).

    Generated by Issue Triage (skills-driven) for #14647 · copilot · auto · 41.8 AIC · ⌖ 2.19 AIC · ⊞ 11K · ◷

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions