fix: use json skills list during update - #1251
Conversation
📝 WalkthroughWalkthroughThe PR implements JSON-based global skills listing as the preferred path in the skills sync flow. It adds ChangesGlobal Skills JSON Listing and Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@8c6fffff28bf99fa2fd1ef7b65e9104487fcfaac🧩 Skill updatenpx skills add larksuite/cli#fix/update-skills-json-list -y -g |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/skillscheck/sync.go`:
- Around line 330-345: The listLocalSkills function currently treats a
parsed-but-empty skills list as failure because it only returns success when
len(local) > 0; update it so that a successfully parsed empty list is considered
success. Specifically, in listLocalSkills replace the len(local) > 0 guards with
checks that parsing succeeded (i.e.,
ParseGlobalSkillsJSON(jsonResult.Stdout.String()) and
ParseSkillsList(textResult.Stdout.String()) returned a non-nil slice or parsing
indicator) and return local, true immediately when parsing completed without
error (jsonResult != nil && jsonResult.Err == nil or textResult != nil &&
textResult.Err == nil), even if len(local) == 0; keep falling through only when
the runner call failed or parsing returned an error.
🪄 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: 5dd1aeb6-85ea-4cf6-b4f6-66b75a126ffa
📒 Files selected for processing (5)
cmd/update/update_test.gointernal/selfupdate/updater.gointernal/selfupdate/updater_test.gointernal/skillscheck/sync.gointernal/skillscheck/sync_test.go
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1251 +/- ##
==========================================
+ Coverage 69.22% 69.33% +0.11%
==========================================
Files 639 645 +6
Lines 59798 59994 +196
==========================================
+ Hits 41395 41598 +203
+ Misses 15058 15041 -17
- Partials 3345 3355 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
* fix: use json skills list during update * fix: preserve versioned skill names
Summary
lark-cli updatepreviously parsed the human-readableskills ls -goutput to determine locally installed skills. This PR switches that lookup to the structuredskills ls -g --jsonoutput first, while preserving text fallback and full-install fallback behavior.Changes
ListGlobalSkillsJSON()ininternal/selfupdate/updater.goto runnpx -y skills ls -g --json.ParseGlobalSkillsJSONand JSON-first local skills lookup ininternal/skillscheck/sync.go.internal/skillscheck/sync_test.go,internal/selfupdate/updater_test.go, andcmd/update/update_test.go.Test Plan
make unit-testpassedgo vet ./...passedgofmt -l .produced no outputgo mod tidydid not changego.modorgo.sumgo run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6 run --new-from-rev=origin/mainpassedgo test ./internal/skillscheck ./internal/selfupdate ./cmd/updateRelated Issues
N/A