Skip to content

fix(skills): install agent skills by copy#1635

Open
xu91102 wants to merge 3 commits into
larksuite:mainfrom
xu91102:fix/skills-claude-copy-install
Open

fix(skills): install agent skills by copy#1635
xu91102 wants to merge 3 commits into
larksuite:mainfrom
xu91102:fix/skills-claude-copy-install

Conversation

@xu91102

@xu91102 xu91102 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Install lark-cli agent skills with skills add --copy so Claude Code receives real skill directories instead of symlinked entries it may fail to load.

Changes

  • Add --copy to full and incremental skills sync commands used by lark-cli update.
  • Update install wizard and manual install/update hints to recommend npx skills add larksuite/cli -y -g --copy.
  • Extend selfupdate command-argument coverage for full and incremental skills installs.

Test Plan

  • GOCACHE=$PWD/.cache/go-build GOPROXY=https://goproxy.cn,direct go test ./internal/selfupdate -run TestSkillsCommandsUseExpectedArgs -count=1
  • GOCACHE=$PWD/.cache/go-build GOPROXY=https://goproxy.cn,direct go test ./cmd/update -run 'TestUpdateNpmVerifyFail_JSON_NoRestoreHintWhenBackupUnavailable|TestUpdate.*Skills|TestUpdate.*Manual' -count=1\n- [x] GOCACHE=$PWD/.cache/go-build GOPROXY=https://goproxy.cn,direct go test ./internal/skillscheck -count=1\n- [x] git diff --check\n- [ ] GOCACHE=$PWD/.cache/go-build GOPROXY=https://goproxy.cn,direct go test ./internal/selfupdate ./internal/skillscheck -count=1 (sandbox cannot bind httptest listener: operation not permitted; targeted selfupdate tests above passed)\n\n## Related Issues\n- Fixes cluade code skills中的lark-cli skills不要用软连接 #1491

Summary by CodeRabbit

  • Bug Fixes

    • Updated installation and recovery command suggestions to include the correct --copy option, including scenarios for failed automatic updates and fallback reinstalls.
    • Ensured the install-wizard messages show consistent npx/pnpm guidance with --copy.
  • Documentation

    • Refreshed the English and Chinese README install commands to match the new npx skills add ... --copy format.
    • Updated user-facing failure instructions shown during setup to include --copy.

@xu91102
xu91102 requested a review from liangshuo-1 as a code owner June 29, 2026 05:44
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2131ed73-01ab-457d-9890-2e69dd33867e

📥 Commits

Reviewing files that changed from the base of the PR and between b0332b0 and 68ddc6f.

📒 Files selected for processing (7)
  • README.md
  • README.zh.md
  • cmd/update/update.go
  • cmd/update/update_test.go
  • internal/selfupdate/updater.go
  • internal/selfupdate/updater_test.go
  • scripts/install-wizard.js
✅ Files skipped from review due to trivial changes (4)
  • README.md
  • cmd/update/update.go
  • README.zh.md
  • internal/selfupdate/updater_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • cmd/update/update_test.go
  • scripts/install-wizard.js

📝 Walkthrough

Walkthrough

Adds the --copy flag to npx skills add larksuite/cli invocations in runtime update flows, install wizard commands, update guidance messages, and the README install examples.

Changes

Add --copy flag to skills add

Layer / File(s) Summary
Runtime skills add invocations and tests
internal/selfupdate/updater.go, cmd/update/update.go, internal/selfupdate/updater_test.go, cmd/update/update_test.go
runSkillsAdd and runSkillsInstall append --copy; update guidance strings for manual reinstall and rollback-unavailable cases include --copy; tests expect the updated command text.
Install wizard script
scripts/install-wizard.js
Primary and fallback npx skills add calls include --copy; Chinese and English failure messages show the updated command.
README documentation
README.md, README.zh.md
The Quick Start install command examples include --copy.

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

Possibly related PRs

  • larksuite/cli#464: Introduced scripts/install-wizard.js with the original npx skills add invocation that this PR updates.
  • larksuite/cli#884: Modified the same npm-reinstall hint in cmd/update/update.go and cmd/update/update_test.go that this PR further updates.
  • larksuite/cli#1008: Refactored the same skills add invocation paths in internal/selfupdate/updater.go and cmd/update/update.go.

Suggested labels: bug

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Clear title matches the main behavior change: installing skills by copy instead of symlink.
Description check ✅ Passed Template sections are present and filled with a summary, changes, tests, and related issue.
Linked Issues check ✅ Passed The PR adds --copy to skills installs and update hints, matching the no-symlink requirement in #1491.
Out of Scope Changes check ✅ Passed The changes stay focused on skills installation behavior, docs, and tests with no obvious unrelated additions.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added the size/L Large or sensitive change across domains or core paths label Jun 29, 2026

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/selfupdate/updater.go (1)

376-389: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Use typed errs.* errors for launcher lookup and timeout failures.

runSkillsCommand also surfaces these failures to the CLI, but it returns bare fmt.Errorf for both LookPath and timeout paths. Please switch these to the repo’s typed errs.* wrappers so the update flow preserves the expected error classification. As per coding guidelines, command-facing failures must use typed errs.* errors, never bare fmt.Errorf.

🤖 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 `@internal/selfupdate/updater.go` around lines 376 - 389, In runSkillsCommand,
the launcher lookup and timeout paths currently return bare fmt.Errorf values
instead of the repo’s typed errs.* wrappers. Update the error handling around
exec.LookPath and the context deadline check so both failures are wrapped with
the appropriate errs.* error type, preserving classification for the CLI while
keeping the existing context from launcher and skillsUpdateTimeout.

Source: Coding guidelines

🤖 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 `@internal/selfupdate/updater.go`:
- Around line 235-249: RunPnpmInstall is returning plain fmt.Errorf values for
command-facing failures; switch those to the appropriate typed errs.* errors
instead. Update the missing pnpm branch and the timeout branch in RunPnpmInstall
so they construct the matching errs.* error types while preserving the
underlying error/context, and keep the command execution flow unchanged.

---

Outside diff comments:
In `@internal/selfupdate/updater.go`:
- Around line 376-389: In runSkillsCommand, the launcher lookup and timeout
paths currently return bare fmt.Errorf values instead of the repo’s typed errs.*
wrappers. Update the error handling around exec.LookPath and the context
deadline check so both failures are wrapped with the appropriate errs.* error
type, preserving classification for the CLI while keeping the existing context
from launcher and skillsUpdateTimeout.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2131ed73-01ab-457d-9890-2e69dd33867e

📥 Commits

Reviewing files that changed from the base of the PR and between b0332b0 and 68ddc6f.

📒 Files selected for processing (7)
  • README.md
  • README.zh.md
  • cmd/update/update.go
  • cmd/update/update_test.go
  • internal/selfupdate/updater.go
  • internal/selfupdate/updater_test.go
  • scripts/install-wizard.js
✅ Files skipped from review due to trivial changes (4)
  • README.md
  • cmd/update/update.go
  • README.zh.md
  • internal/selfupdate/updater_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • cmd/update/update_test.go
  • scripts/install-wizard.js

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/selfupdate/updater.go (1)

376-389: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Use typed errs.* errors for launcher lookup and timeout failures.

runSkillsCommand also surfaces these failures to the CLI, but it returns bare fmt.Errorf for both LookPath and timeout paths. Please switch these to the repo’s typed errs.* wrappers so the update flow preserves the expected error classification. As per coding guidelines, command-facing failures must use typed errs.* errors, never bare fmt.Errorf.

🤖 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 `@internal/selfupdate/updater.go` around lines 376 - 389, In runSkillsCommand,
the launcher lookup and timeout paths currently return bare fmt.Errorf values
instead of the repo’s typed errs.* wrappers. Update the error handling around
exec.LookPath and the context deadline check so both failures are wrapped with
the appropriate errs.* error type, preserving classification for the CLI while
keeping the existing context from launcher and skillsUpdateTimeout.

Source: Coding guidelines

🤖 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 `@internal/selfupdate/updater.go`:
- Around line 235-249: RunPnpmInstall is returning plain fmt.Errorf values for
command-facing failures; switch those to the appropriate typed errs.* errors
instead. Update the missing pnpm branch and the timeout branch in RunPnpmInstall
so they construct the matching errs.* error types while preserving the
underlying error/context, and keep the command execution flow unchanged.

---

Outside diff comments:
In `@internal/selfupdate/updater.go`:
- Around line 376-389: In runSkillsCommand, the launcher lookup and timeout
paths currently return bare fmt.Errorf values instead of the repo’s typed errs.*
wrappers. Update the error handling around exec.LookPath and the context
deadline check so both failures are wrapped with the appropriate errs.* error
type, preserving classification for the CLI while keeping the existing context
from launcher and skillsUpdateTimeout.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2131ed73-01ab-457d-9890-2e69dd33867e

📥 Commits

Reviewing files that changed from the base of the PR and between b0332b0 and 68ddc6f.

📒 Files selected for processing (7)
  • README.md
  • README.zh.md
  • cmd/update/update.go
  • cmd/update/update_test.go
  • internal/selfupdate/updater.go
  • internal/selfupdate/updater_test.go
  • scripts/install-wizard.js
✅ Files skipped from review due to trivial changes (4)
  • README.md
  • cmd/update/update.go
  • README.zh.md
  • internal/selfupdate/updater_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • cmd/update/update_test.go
  • scripts/install-wizard.js
🛑 Comments failed to post (1)
internal/selfupdate/updater.go (1)

235-249: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Use typed errs.* errors for install failures.

RunPnpmInstall is part of the update command path, but it still returns raw fmt.Errorf values for missing pnpm and timeouts. As per coding guidelines, command-facing failures must use typed errs.* errors instead of bare fmt.Errorf.

🧰 Tools
🪛 ast-grep (0.44.1)

[error] 241-241: An argument passed to exec.Command/exec.CommandContext is built by concatenating a string literal with dynamic input. If that input is attacker-controlled (and especially when the command is a shell such as sh -c/bash -c), this enables OS command injection. Pass untrusted data as separate, fixed arguments instead of interpolating it into a command string, avoid invoking a shell, and validate/escape the input where a shell is unavoidable.
Context: exec.CommandContext(ctx, pnpmPath, "add", "-g", NpmPackage+"@"+version)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(command-injection-exec-concat-arg-go)

🤖 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 `@internal/selfupdate/updater.go` around lines 235 - 249, RunPnpmInstall is
returning plain fmt.Errorf values for command-facing failures; switch those to
the appropriate typed errs.* errors instead. Update the missing pnpm branch and
the timeout branch in RunPnpmInstall so they construct the matching errs.* error
types while preserving the underlying error/context, and keep the command
execution flow unchanged.

Source: Coding guidelines

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

Labels

size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cluade code skills中的lark-cli skills不要用软连接

1 participant