Skip to content

fix(cua-driver-rs)(skills): strip nested cua-driver/cua-driver-rs/ wrapper from skill tarball - #1684

Merged
f-trycua merged 1 commit into
mainfrom
fix-skills-tarball-nesting
May 24, 2026
Merged

fix(cua-driver-rs)(skills): strip nested cua-driver/cua-driver-rs/ wrapper from skill tarball#1684
f-trycua merged 1 commit into
mainfrom
fix-skills-tarball-nesting

Conversation

@f-trycua

@f-trycua f-trycua commented May 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

User reported `~/.claude/skills/cua-driver/cua-driver-rs/SKILL.md` after running `cua-driver skills install` — a redundant `cua-driver-rs/` dir nested inside the pack root.

Root cause: tarball-shape mismatch. The CD workflow historically staged files under `/cua-driver-rs/` (and briefly `/cua-driver/` after #1677) — two wrapping dirs. The extractor only stripped one. So files landed at `dest/cua-driver{-rs}/` instead of `dest/`.

Fix

1. `extract_tar_gz` strips a second wrapper iff named `cua-driver` or `cua-driver-rs`:

```rust
let mut peek = components.clone();
if let Some(next) = peek.next() {
if next.as_os_str() == "cua-driver" || next.as_os_str() == "cua-driver-rs" {
components.next();
}
}
```

Covers three tarball shapes:

Released Shape Stripped
v0.2.18 and earlier `/cua-driver-rs/` both wrappers
v0.2.19 (briefly) `/cua-driver/` both wrappers
v0.2.20+ (this PR) `/` (flat) just outer

Stripping is name-gated so a future skill pack with a real subdir (e.g. `examples/`) doesn't accidentally get flattened.

2. CD workflow flattens the staging dir — no more inner `cua-driver/` between the version-stamped outer dir and the .md files.

Tests

4 new unit tests in `skills::tests` cover the three legacy shapes + a "preserve real subdir" guard. All pass.

End-to-end on the user's machine

After this lands + the user runs `cua-driver skills install --force`:

  • `fetch_into` wipes the current `~/.cua-driver/skills/cua-driver/` (which contains the nested `cua-driver-rs/` dir)
  • Re-fetches the v0.2.18 tarball from GitHub Releases (still has the legacy double-wrap shape on disk; this won't change until the next release ships)
  • New extractor strips both wrappers → `SKILL.md`, `WINDOWS.md`, etc. land directly in `~/.cua-driver/skills/cua-driver/` with no nesting

Test plan

  • Build clean (`cargo build --release` — 0 warnings)
  • 4 unit tests for extractor — all pass
  • 49/49 existing tests still green
  • Reviewer: `cua-driver skills install --force` against the live v0.2.18 release tarball — verify no nested `cua-driver-rs/` after extraction
  • Reviewer: trigger the CD workflow + re-publish, verify the new tarball has the flat shape

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Fixed skill pack tarball extraction to correctly handle multiple directory structure formats and prevent unintended nested wrapper directories.
  • Tests

    • Added comprehensive unit tests for tarball extraction, verifying proper path handling across various skill pack layouts.
  • Chores

    • Updated release workflow staging configuration for skill pack file organization.

Review Change Stack

…apper from skill tarball

User reported `~/.claude/skills/cua-driver/cua-driver-rs/SKILL.md` after
`skills install` on Windows — a nested `cua-driver-rs/` dir inside the
pack root.

Root cause: tarball-shape mismatch with the extractor. The CD workflow
historically staged files at `<outer>/cua-driver-rs/` (and after #1677,
`<outer>/cua-driver/`) — TWO wrapping dirs. The extractor only stripped
ONE. So files landed at `dest/cua-driver{-rs}/<file>` instead of
`dest/<file>`.

Two pieces:

1. **`extract_tar_gz` now strips a second wrapper IF named
   `cua-driver` or `cua-driver-rs`**. This covers three historical
   tarball shapes:
     - v0.2.18 and earlier: `…-skills/cua-driver-rs/<file>`
     - v0.2.19 (briefly):   `…-skills/cua-driver/<file>`
     - v0.2.20+ (post-fix): `…-skills/<file>`   (flat — CD workflow now)

   Stripping is name-gated so a future skill pack with a real subdir
   (e.g. `examples/`) doesn't get accidentally flattened.

2. **CD workflow flattens the staging dir** — no more redundant inner
   `cua-driver/` between `<outer>` and the .md files. New tarballs are
   single-wrap.

Four unit tests cover the three legacy shapes + a "preserve real
subdir" guard.

End-to-end fix: on the user's machine, the live v0.2.18 release
tarball still has the legacy double-wrap shape, so the binary needs
to keep extracting it correctly via the smart extractor — which it
now does. `skills update` will sweep the nested `cua-driver-rs/` dir
out (`fetch_into` wipes dest first) and re-extract flat.
@vercel

vercel Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored May 24, 2026 1:37pm

Request Review

@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3f53db3f-06bd-46ea-8ec3-4b6a231d08c0

📥 Commits

Reviewing files that changed from the base of the PR and between f474a3e and 56fd82a.

📒 Files selected for processing (2)
  • .github/workflows/cd-rust-cua-driver.yml
  • libs/cua-driver/rust/crates/cua-driver/src/skills.rs

📝 Walkthrough

Walkthrough

This PR normalizes skill-pack tarball layouts by restructuring the CI staging process to remove nested directories and updating the extraction logic to intelligently handle both current and legacy tarball formats across multiple historical versions.

Changes

Tarball Layout Standardization

Layer / File(s) Summary
Tarball staging restructure
.github/workflows/cd-rust-cua-driver.yml
CI workflow's "Stage release files" step is updated to copy skill-pack contents directly into the staging directory, removing the extra nested cua-driver/ subdirectory and changing the tarball's top-level structure.
Tarball extraction with version-aware directory flattening
libs/cua-driver/rust/crates/cua-driver/src/skills.rs
extract_tar_gz now detects and removes both the outer staging directory and conditionally strips a second wrapper directory when named cua-driver or cua-driver-rs, allowing it to handle legacy double-wrap, v0.2.19 inner-wrapper, and v0.2.20+ single-wrapper tarball layouts.
Extraction validation tests
libs/cua-driver/rust/crates/cua-driver/src/skills.rs
Test module with helpers to generate gzipped tarballs and multiple test cases verifying that extract_tar_gz correctly flattens wrapper directories for all upstream tarball shapes while preserving legitimate internal subdirectories.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • trycua/cua#1677: The main PR's updates to extract_tar_gz and the cd-rust-cua-driver.yml "Stage release files" step both directly address skill-pack tar staging/extraction layout around cua-driver vs legacy cua-driver-rs wrapper directories, aligning with the retrieved PR's rename-and-legacy-handling changes.

Suggested reviewers

  • ddupont808

Poem

🐰 A tarball wrapped in layers deep,
Now flattens out, no more to keep,
Old formats dance with new in sync,
Our extraction tests won't let us blink,
Nested no more—just skill, so sleek! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-skills-tarball-nesting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@f-trycua
f-trycua merged commit 89fd8e9 into main May 24, 2026
5 of 7 checks passed
@f-trycua
f-trycua deleted the fix-skills-tarball-nesting branch May 24, 2026 13:40
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.

1 participant