Skip to content

fix: simplify skills sync to stamp-based approach#1007

Closed
MaxHuang22 wants to merge 1 commit into
mainfrom
fix/revert-incremental-skills-sync
Closed

fix: simplify skills sync to stamp-based approach#1007
MaxHuang22 wants to merge 1 commit into
mainfrom
fix/revert-incremental-skills-sync

Conversation

@MaxHuang22
Copy link
Copy Markdown
Collaborator

@MaxHuang22 MaxHuang22 commented May 21, 2026

Summary

Remove the incremental skills sync mechanism and restore the simpler stamp-based approach. The incremental sync added complexity (state.json, per-skill install, plan/diff logic) without sufficient benefit over the straightforward full sync via npx skills add.

Changes

  • Restore internal/skillscheck/stamp.go — simple version stamp read/write
  • Remove internal/skillscheck/state.go, sync.go and their tests — incremental sync logic
  • Simplify internal/skillscheck/check.go to use stamp-based drift detection
  • Revert cmd/update/update.go to use runSkillsAndStamp instead of runSkillsAndState
  • Remove per-skill install methods from internal/selfupdate/updater.go
  • Simplify scripts/install-wizard.js to full sync instead of incremental plan

Test Plan

  • skipped: CI will validate

Related Issues

N/A

Change-Id: Ic95e8a74a0d6fc7f89782dccde867fd794cfcf46
@MaxHuang22 MaxHuang22 added the bug Something isn't working label May 21, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

📝 Walkthrough

Walkthrough

This PR replaces the complex SkillsState JSON persistence and sync orchestration with a lightweight stamp-based version tracker. The Updater skills surface is simplified from multiple commands to just RunSkillsUpdate, and the update command is refactored to deduplicate and report skills sync using persisted version stamps.

Changes

Skills sync stamp-based refactoring

Layer / File(s) Summary
Stamp persistence layer
internal/skillscheck/stamp.go, internal/skillscheck/stamp_test.go, internal/skillscheck/check.go, internal/skillscheck/check_test.go, internal/skillscheck/notice.go
Adds ReadStamp() and WriteStamp() functions for managing a skills.stamp version file. Refactors Init() to read and compare stamps instead of synced version state. Updates tests and documentation to reflect stamp-based drift detection.
Updater surface simplification
internal/selfupdate/updater.go, internal/selfupdate/updater_test.go
Removes SkillsCommandOverride hook and ListOfficialSkills, ListGlobalSkills, InstallSkill methods. Simplifies to single RunSkillsUpdate method backed by internal runSkillsAdd helper that runs npx skills add with timeout.
Update command stamp-based sync
cmd/update/update.go
Introduces runSkillsAndStamp() helper that deduplicates via persisted stamp, runs skills update only when versions differ (unless --force), writes stamp on success, and warns non-fatally on stamp write failure. Refactors skills reporting from SyncResult to NpmResult with new skills_action/skills_detail fields.
Update command test refactoring
cmd/update/update_test.go
Switches from SkillsCommandOverride to SkillsUpdateOverride. Replaces state-based assertions with stamp dedup/write/failure unit tests. Isolates stamp writes using temporary config directory to prevent test cross-contamination. Updates skills output assertions for new field names.
Setup notices integration test updates
cmd/root_integration_test.go
Updates test fixtures to call skillscheck.WriteStamp() instead of writing SkillsState. Preserves drift and cold-start assertions while adapting to stamp-based persistence.

Install wizard simplification

Layer / File(s) Summary
Install wizard refactoring
scripts/install-wizard.js
Removes CONFIG_DIR and SKILLS_STATE_FILE constants. Changes stepInstallGlobally() to return boolean instead of version. Adds skillsAlreadyInstalled() helper to detect pre-existing global skills. Removes CLI version argument from step invocations, simplifying control flow.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • larksuite/cli#965: Directly overlapping refactor of skills-sync persistence in cmd/update/update.go, cmd/root_integration_test.go, and internal/skillscheck/ (state vs. stamp mechanism swap).
  • larksuite/cli#723: Related stamp-based startup notices refactor using Init(), ReadStamp(), WriteStamp() and updating cmd/update/update.go skills dedup/reporting.
  • larksuite/cli#858: Related update command test isolation for stamp writes via LARKSUITE_CLI_CONFIG_DIR, directly supporting the new runSkillsAndStamp behavior.

Suggested labels

size/L

Suggested reviewers

  • liangshuo-1
  • sang-neo03

Poem

A rabbit hops through version stamps so bright,
No JSON state to lose or store in flight.
Each skill now deduped with a simple check,
The updater's simpler—refactoring deck.
From complex syncs to stamps so lean,
The CLI's cleanest it's ever been! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.85% 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
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.
Title check ✅ Passed The title clearly summarizes the main change: reverting to a stamp-based skills sync approach instead of incremental sync.
Description check ✅ Passed The description covers Summary, Changes, and Test Plan sections from the template. However, the Test Plan section is marked as skipped rather than showing completed verification steps.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/revert-incremental-skills-sync

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.

@github-actions github-actions Bot added the size/L Large or sensitive change across domains or core paths label May 21, 2026
@MaxHuang22 MaxHuang22 changed the title fix: revert incremental skills sync fix: simplify skills sync to stamp-based approach May 21, 2026
@MaxHuang22 MaxHuang22 closed this May 21, 2026
@MaxHuang22 MaxHuang22 deleted the fix/revert-incremental-skills-sync branch May 21, 2026 03:47
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 98.03922% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 67.62%. Comparing base (e19e090) to head (35bcd4a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/selfupdate/updater.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1007      +/-   ##
==========================================
- Coverage   67.68%   67.62%   -0.07%     
==========================================
  Files         576      575       -1     
  Lines       54548    54337     -211     
==========================================
- Hits        36919    36743     -176     
+ Misses      14568    14550      -18     
+ Partials     3061     3044      -17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@35bcd4a25eea7393c55242ecef42b76357957c17

🧩 Skill update

npx skills add larksuite/cli#fix/revert-incremental-skills-sync -y -g

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

Labels

bug Something isn't working size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant