Skip to content

feat: add install.sh for one-line agent-skills install#56

Merged
moonming merged 1 commit into
mainfrom
feat/agent-skills-install-script
Jul 13, 2026
Merged

feat: add install.sh for one-line agent-skills install#56
moonming merged 1 commit into
mainfrom
feat/agent-skills-install-script

Conversation

@moonming

@moonming moonming commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

What

Adds install.sh so the AI agent skills can be installed with a single command:

curl -fsSL https://raw.githubusercontent.com/api7/a6/main/install.sh | sh

This is the one-line install referenced from the AI Agent Skills catalog; until now the docs showed a manual git clone + cp.

Behavior

  • Downloads the repo tarball (no git required — curl/wget + tar) and copies each skills/<name>/ pack into the target directory.
  • Default target: ~/.claude/skills (Claude Code personal skills). Override with --dir <path> or SKILLS_DIR=... (e.g. .cursor/rules for Cursor, an OpenCode skills dir, etc.).
  • Idempotent (re-running overwrites each skill), POSIX sh, cleans up its temp dir on exit.

Tested

Ran end-to-end against this repo: 40 skills installed, all with SKILL.md. sh -n syntax check passes.

Follow-up

Once merged, the docs install snippet can be switched from git clone to this one-liner.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added an installation script for Apache APISIX AI agent skill packs.
    • Supports custom installation directories through an environment variable or command-line option.
    • Provides help output and validates required download tools and skill-pack content.
    • Reports installation progress and completion, including the number of installed skill packs.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@moonming, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 55 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 347c7e55-dff2-4b58-8323-0e6b70380328

📥 Commits

Reviewing files that changed from the base of the PR and between 5b95e94 and aaa4808.

📒 Files selected for processing (1)
  • install.sh
📝 Walkthrough

Walkthrough

Adds install.sh to download a GitHub skill-pack archive, locate valid packs containing SKILL.md, and install them into a configurable skills directory with command-line handling, validation, cleanup, and completion output.

Changes

Skill pack installation

Layer / File(s) Summary
Installer configuration and CLI
install.sh
Defines repository and destination defaults, supports SKILLS_DIR and --dir overrides, provides help output, and rejects unknown options.
Download and extraction
install.sh
Uses curl or wget to download the selected GitHub branch into a temporary workspace and locates the extracted skills/ directory.
Pack validation and installation
install.sh
Creates the destination, replaces matching packs, copies directories containing SKILL.md, validates that at least one pack was installed, and prints completion guidance.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant install.sh
  participant GitHub
  participant SkillsDirectory
  Operator->>install.sh: run with optional destination
  install.sh->>GitHub: download branch archive
  GitHub-->>install.sh: return skill packs
  install.sh->>SkillsDirectory: copy validated packs
  SkillsDirectory-->>install.sh: complete installation
  install.sh-->>Operator: print installed count and catalog link
Loading
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
E2e Test Quality Review ⚠️ Warning No repeatable E2E coverage was added for the installer; the PR only claims a manual sh -n/one-off run, so the download→extract→copy path and failures remain untested. Add a shell smoke/E2E test for the full install flow (success plus bad tarball, missing tool, and dir override cases) and guard SKILLS_DIR before rm -rf.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding install.sh for one-line agent-skills installation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Check ✅ Passed PASS: install.sh only downloads and copies skill packs; no secret/log/auth/DB/TLS paths found, and empty SKILLS_DIR exits at mkdir before rm -rf.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/agent-skills-install-script

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
install.sh (1)

51-51: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Consider downloading to a file before extracting to avoid pipeline error masking.

In POSIX sh, set -e only checks the exit status of the last command in a pipeline. If fetch (curl/wget) fails, tar typically also fails and set -e catches it, but downloading to a temporary file first makes the failure path explicit and avoids relying on tar's behavior with empty/truncated input.

♻️ Proposed refactor
-fetch "https://codeload.github.com/${REPO}/tar.gz/refs/heads/${BRANCH}" | tar -xz -C "$TMP"
+fetch "https://codeload.github.com/${REPO}/tar.gz/refs/heads/${BRANCH}" > "$TMP/repo.tar.gz"
+tar -xz -C "$TMP" < "$TMP/repo.tar.gz"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@install.sh` at line 51, Update the install flow around fetch to download the
archive into a temporary file under $TMP first, then extract that file with tar.
Ensure fetch failure stops execution explicitly before extraction, and preserve
the existing extraction destination and archive contents.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@install.sh`:
- Line 64: Update the rm command in the skills cleanup flow to require a
non-empty SKILLS_DIR before expansion, using the shell’s explicit parameter
guard so an empty value aborts instead of targeting a root-level path. Preserve
the existing name-based removal behavior when SKILLS_DIR is set.

---

Nitpick comments:
In `@install.sh`:
- Line 51: Update the install flow around fetch to download the archive into a
temporary file under $TMP first, then extract that file with tar. Ensure fetch
failure stops execution explicitly before extraction, and preserve the existing
extraction destination and archive contents.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 649e3b52-2fca-46dd-a908-25d944d85293

📥 Commits

Reviewing files that changed from the base of the PR and between ff2e027 and 5b95e94.

📒 Files selected for processing (1)
  • install.sh

Comment thread install.sh
for dir in "$SRC"/*/; do
[ -f "${dir}SKILL.md" ] || continue
name="$(basename "$dir")"
rm -rf "${SKILLS_DIR}/${name}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Guard against empty SKILLS_DIR in rm -rf to prevent accidental root deletion.

If SKILLS_DIR is set to an empty string (e.g., --dir= or SKILLS_DIR=""), this line expands to rm -rf "/${name}", deleting a top-level directory. While mkdir -p "" on line 59 would likely fail and exit first under set -eu, adding an explicit :? guard is a low-cost safety net.

🛡️ Proposed fix
-  rm -rf "${SKILLS_DIR}/${name}"
+  rm -rf "${SKILLS_DIR:?}/${name}"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
rm -rf "${SKILLS_DIR}/${name}"
rm -rf "${SKILLS_DIR:?}/${name}"
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 64-64: Use "${var:?}" to ensure this never expands to / .

(SC2115)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@install.sh` at line 64, Update the rm command in the skills cleanup flow to
require a non-empty SKILLS_DIR before expansion, using the shell’s explicit
parameter guard so an empty value aborts instead of targeting a root-level path.
Preserve the existing name-based removal behavior when SKILLS_DIR is set.

Source: Linters/SAST tools

curl -fsSL https://raw.githubusercontent.com/api7/a6/main/install.sh | sh

Downloads the repo tarball (no git required) and copies each skills/<name>
pack into ~/.claude/skills (override with --dir / SKILLS_DIR). POSIX sh,
idempotent. Tested: installs all 40 skills.
@moonming moonming force-pushed the feat/agent-skills-install-script branch from 5b95e94 to aaa4808 Compare July 13, 2026 01:48
@moonming

Copy link
Copy Markdown
Collaborator Author

Independent audit — resolved

A fresh review agent audited this script. No HIGH findings. Verified: correct repo/branch (no a6/a7 mixup), rm -rf blast radius bounded (name is always a single non-empty path component from the trusted tarball; $HOME-unset and --dir '' both fail safe before any removal), POSIX-sound (set -eu, command -v, cp -R, trap, arg parser), HTTPS-only fetches, graceful empty/zero-skill handling. Two MEDIUM hardening items applied:

  • --dir= (empty value) was unguarded (only incidentally caught by mkdir). Now explicitly rejected: [ -n "$SKILLS_DIR" ] || { …; exit 1; }.
  • Download failure was only caught when tar choked on empty input (no pipefail in sh). Now staged: fetch … >"$TMP/repo.tgz" || { echo "download failed"; exit 1; } then tar -xzf, so a 404/network error aborts with a clear message.

Re-tested after the change: sh -n clean, --dir= errors as expected, and a real run still installs all 40 skills.

@moonming moonming merged commit e017085 into main Jul 13, 2026
6 checks passed
@moonming moonming deleted the feat/agent-skills-install-script branch July 13, 2026 06:48
@moonming

Copy link
Copy Markdown
Collaborator Author

Addressed in follow-up #57: rm -rf "${SKILLS_DIR:?}/${name}" (SC2115 defense-in-depth). The empty case was already blocked upstream, but the :? guard makes it impossible by construction.

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