feat: fetch official skills index#1301
Conversation
|
Looking for one thing? Review this PR in Change Stack to search files, summaries, diffs, and code without losing your place. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
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 (11)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds HTTP retrieval and JSON parsing of an official skills index, extends the SkillsRunner interface, refactors sync to prefer index-first discovery with fallback to the existing list parsing flow, updates cmd/update test wiring, and removes Feed Group shortcuts/docs while updating related tests and metadata. ChangesOfficial Skills Index Discovery
IM shortcuts and documentation cleanup
Sequence DiagramsequenceDiagram
participant SyncSkills
participant listOfficialSkills
participant ListOfficialSkillsIndex
participant ParseOfficialSkillsIndexJSON
participant ListOfficialSkills
participant ParseSkillsList
SyncSkills->>listOfficialSkills: request official skills
listOfficialSkills->>ListOfficialSkillsIndex: attempt index fetch
alt index fetch succeeds
ListOfficialSkillsIndex-->>listOfficialSkills: index stdout
listOfficialSkills->>ParseOfficialSkillsIndexJSON: parse index JSON
alt index parse succeeds & non-empty
ParseOfficialSkillsIndexJSON-->>listOfficialSkills: skills list
listOfficialSkills-->>SyncSkills: (skills, ok=true)
else parse fails or empty
listOfficialSkills->>ListOfficialSkills: fall back to list
ListOfficialSkills-->>listOfficialSkills: list stdout
listOfficialSkills->>ParseSkillsList: parse list
ParseSkillsList-->>listOfficialSkills: skills or empty
listOfficialSkills-->>SyncSkills: (skills, reason, ok)
end
else index fetch fails
ListOfficialSkillsIndex-->>listOfficialSkills: error
listOfficialSkills->>ListOfficialSkills: fall back to list
ListOfficialSkills-->>listOfficialSkills: list stdout/error
listOfficialSkills->>ParseSkillsList: parse list
ParseSkillsList-->>listOfficialSkills: skills or error
listOfficialSkills-->>SyncSkills: (skills, reason, ok)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 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 #1301 +/- ##
==========================================
+ Coverage 70.95% 71.01% +0.05%
==========================================
Files 685 681 -4
Lines 65702 65435 -267
==========================================
- Hits 46622 46470 -152
+ Misses 15401 15320 -81
+ Partials 3679 3645 -34 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@d2af44d6fe7310150468ee24d11ebb65bfaf592c🧩 Skill updatenpx skills add larksuite/cli#feat/update-skills-index-json -y -g |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/selfupdate/updater_test.go (1)
292-312: 💤 Low valueConsider verifying the specific timeout error.
The test checks
result.Err == nilbut doesn't verify the error is actually a timeout error. While the controlled environment (200ms sleep vs 50ms timeout) makes a false positive unlikely, explicitly checking for timeout-related error messages would make the test more robust.🔍 Optional enhancement
result := New().ListOfficialSkillsIndex() - if result.Err == nil { - t.Fatal("ListOfficialSkillsIndex() err = nil, want timeout error") + if result.Err == nil || !strings.Contains(result.Err.Error(), "context deadline exceeded") { + t.Fatalf("ListOfficialSkillsIndex() err = %v, want context deadline exceeded", result.Err) }🤖 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_test.go` around lines 292 - 312, Update TestListOfficialSkillsIndexTimeout to assert that the error returned by New().ListOfficialSkillsIndex() is a timeout error rather than just non-nil: after calling result := New().ListOfficialSkillsIndex(), check either errors.Is(result.Err, context.DeadlineExceeded) or, if the error may be a net error, type-assert to net.Error and assert Timeout() == true; reference the test function TestListOfficialSkillsIndexTimeout and the call sites New() and ListOfficialSkillsIndex to locate where to add this explicit timeout assertion instead of only checking result.Err == nil.
🤖 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.
Nitpick comments:
In `@internal/selfupdate/updater_test.go`:
- Around line 292-312: Update TestListOfficialSkillsIndexTimeout to assert that
the error returned by New().ListOfficialSkillsIndex() is a timeout error rather
than just non-nil: after calling result := New().ListOfficialSkillsIndex(),
check either errors.Is(result.Err, context.DeadlineExceeded) or, if the error
may be a net error, type-assert to net.Error and assert Timeout() == true;
reference the test function TestListOfficialSkillsIndexTimeout and the call
sites New() and ListOfficialSkillsIndex to locate where to add this explicit
timeout assertion instead of only checking result.Err == nil.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 53bc579b-8e4a-4cab-864b-30be4aee3fbe
📒 Files selected for processing (5)
cmd/update/update_test.gointernal/selfupdate/updater.gointernal/selfupdate/updater_test.gointernal/skillscheck/sync.gointernal/skillscheck/sync_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
- internal/selfupdate/updater.go
- internal/skillscheck/sync.go
- internal/skillscheck/sync_test.go
lark-cli update currently discovers official skills by parsing unstable human-oriented `skills add --list` output. This prefers the stable official JSON index for skills discovery, while preserving the existing CLI-list fallback and full-install fallback for resilience. Changes: - Add official skills index JSON parsing in `internal/skillscheck/sync.go` - Prefer JSON index discovery before existing CLI list parsing in `internal/skillscheck/sync.go` - Add reason-chain details when both discovery layers fall back to `fallbackFullInstall` - Add bounded HTTPS fetch for `https://open.feishu.cn/.well-known/skills/index.json` in `internal/selfupdate/updater.go` - Add unit tests for parser behavior, discovery fallback order, and fallback detail reasons in `internal/skillscheck/sync_test.go`
ed97eea to
d2af44d
Compare
lark-cli update currently discovers official skills by parsing unstable human-oriented `skills add --list` output. This prefers the stable official JSON index for skills discovery, while preserving the existing CLI-list fallback and full-install fallback for resilience. Changes: - Add official skills index JSON parsing in `internal/skillscheck/sync.go` - Prefer JSON index discovery before existing CLI list parsing in `internal/skillscheck/sync.go` - Add reason-chain details when both discovery layers fall back to `fallbackFullInstall` - Add bounded HTTPS fetch for `https://open.feishu.cn/.well-known/skills/index.json` in `internal/selfupdate/updater.go` - Add unit tests for parser behavior, discovery fallback order, and fallback detail reasons in `internal/skillscheck/sync_test.go` Co-authored-by: zhaoyukun.yk <zhaoyukun.yk@bytedance.com>
Summary
lark-cli updatecurrently discovers official skills by parsing unstable human-orientedskills add --listoutput. This PR prefers the stable official JSON index for skills discovery, while preserving the existing CLI-list fallback and full-install fallback for resilience.Changes
internal/skillscheck/sync.gointernal/skillscheck/sync.gofallbackFullInstallhttps://open.feishu.cn/.well-known/skills/index.jsonininternal/selfupdate/updater.gointernal/skillscheck/sync_test.goTest Plan
make unit-testwas not run separately; validate ran the harness build/vet/unit/integration suitedocs/superpowers/verify_results/validate.json)go test ./internal/selfupdate ./internal/skillscheck ./cmd/updatehttps://open.feishu.cn/.well-known/skills/index.jsonreturned root object with 26lark-skillsRelated Issues
N/A
Summary by CodeRabbit
New Features
Behavior
Documentation
Tests