feat: add incremental skills sync#965
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis PR replaces stamp-based skills version tracking with structured JSON state, adds parsing and sync orchestration, extends Updater with skills methods and an override hook, refactors the update command and reporting to use state-based flows, integrates state into skills checks, migrates the install wizard, and removes stamp artifacts. ChangesSkills Version Tracking: Stamp→State Migration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #965 +/- ##
==========================================
+ Coverage 65.92% 67.46% +1.54%
==========================================
Files 523 573 +50
Lines 49692 53866 +4174
==========================================
+ Hits 32758 36340 +3582
- Misses 14134 14501 +367
- Partials 2800 3025 +225 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@9c3a12f431c608de7a36ed49bb3f0b2100f7c7b3🧩 Skill updatenpx skills add larksuite/cli#feat/incremental-skills-update -y -g |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@cmd/update/update.go`:
- Around line 397-403: The summary map in skillsSummary mixes a numeric count
("official") with slice values ("updated", "added", "skipped_deleted"); change
those slice entries to numeric counters by replacing r.Updated, r.Added, and
r.SkippedDeleted with their lengths (e.g., len(r.Updated), len(r.Added),
len(r.SkippedDeleted)) so all fields are consistently numbers in the returned
map.
In `@internal/skillscheck/check.go`:
- Around line 22-23: The comparison in internal/skillscheck/check.go currently
does raw string equality on version and currentVersion (the snippet with "if
version == currentVersion { return }"); normalize both values by trimming any
leading "v" or "V" before comparing (e.g., use strings.TrimPrefix on both
version and currentVersion) and ensure the strings package is imported, so
"v1.0.21" and "1.0.21" are treated as equal when performing the drift check.
🪄 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: 9ff33895-a0d7-4569-8a06-f121badebce4
📒 Files selected for processing (15)
cmd/root_integration_test.gocmd/update/update.gocmd/update/update_test.gointernal/selfupdate/updater.gointernal/selfupdate/updater_test.gointernal/skillscheck/check.gointernal/skillscheck/check_test.gointernal/skillscheck/notice.gointernal/skillscheck/stamp.gointernal/skillscheck/stamp_test.gointernal/skillscheck/state.gointernal/skillscheck/state_test.gointernal/skillscheck/sync.gointernal/skillscheck/sync_test.goscripts/install-wizard.js
💤 Files with no reviewable changes (2)
- internal/skillscheck/stamp_test.go
- internal/skillscheck/stamp.go
Summary
This PR adds incremental official skills sync for
lark-cli updateand the install wizard. It replaces the legacy stamp-only flow withskills-state.json, preserving user-deleted official skills during normal updates while still auto-installing newly official skills.Changes
internal/skillscheck/state.goforskills-state.jsonread/write and version status lookup.internal/skillscheck/sync.gofor official/local skills parsing, incremental sync planning, and best-effort sync orchestration.internal/selfupdate/updater.gofor listing official/global skills and installing selected skills.cmd/update/update.goto report skills sync/status in JSON and human output, support--forcerestore semantics, and keep--checkskills-sync side-effect free.scripts/install-wizard.jsto use runtime official skills discovery and writeskills-state.json.internal/skillscheck/stamp.goflow and update related tests.Test Plan
go test ./internal/selfupdate ./internal/skillscheck ./cmd/update ./cmd -run 'Test(Init|ReadState|WriteState|ReadSyncedVersion|SyncSkills|Plan|ParseSkillsList|SkillsCommands|ListOfficialSkills|RunSkillsAndState|UpdateRun|UpdateNpm_Skills|UpdateAlready|UpdateManual|UpdateNpm_JSON|UpdateNpm_Human|UpdateForce|SetupNotices)' -count=1node --check scripts/install-wizard.js3/3update scenarios passed; full built-in E2E suites were blocked by unrelated sandbox scopes unsupported by the test app/user4/4caseslark-cli update --check --jsonwith isolated config dirs confirmed missing/valid/corrupt skills state behavior and no skills-state/stamp writesRelated Issues
N/A
Summary by CodeRabbit
New Features
Refactor
Tests