feat: migrate application and IM guidance to affordance - #2199
Conversation
📝 WalkthroughWalkthroughThis change moves application and IM shortcut guidance from Go ChangesAffordance Guidance Migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2199 +/- ##
==========================================
+ Coverage 76.00% 76.01% +0.01%
==========================================
Files 966 966
Lines 102541 102541
==========================================
+ Hits 77933 77947 +14
+ Misses 18704 18691 -13
+ Partials 5904 5903 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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/affordance/application_source_test.go`:
- Around line 7-17: Replace the os-based filesystem access in
internal/affordance/application_source_test.go lines 7-17 with the appropriate
internal/vfs-backed source setup used by TestApplicationAffordanceExamples;
update internal/affordance/im_source_test.go lines 7-8 similarly, replacing both
os.DirFS and os.ReadFile with internal/vfs APIs while preserving the existing
test behavior.
🪄 Autofix
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 Plus
Run ID: 0a60ab57-ad21-4144-acc2-33ac5f20abd3
📒 Files selected for processing (13)
affordance/application.mdaffordance/im.mdinternal/affordance/application_source_test.gointernal/affordance/im_source_test.gointernal/schema/assembler_test.goshortcuts/application/affordance_migration_test.goshortcuts/application/slash_command_create.goshortcuts/application/slash_command_create_test.goshortcuts/application/slash_command_delete.goshortcuts/application/slash_command_list.goshortcuts/application/slash_command_update.goshortcuts/im/affordance_migration_test.goshortcuts/im/im_chat_members_list.go
💤 Files with no reviewable changes (4)
- shortcuts/application/slash_command_update.go
- shortcuts/application/slash_command_delete.go
- shortcuts/application/slash_command_list.go
- shortcuts/im/im_chat_members_list.go
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@98917d221d2b4a96e768c53c683a6b70ee51c29f🧩 Skill updatenpx skills add larksuite/cli#feat/affordance-migration -y -g |
#2194 extended `im +messages-search` to `AuthTypes: {user, bot}` but left the affordance example and the skill reference asserting user-only, so the dual-identity guard added by #2199 fails on main. sa: safe doc: affordance/im.md, skills/lark-im cfg: none test: go test -race ./cmd/... ./internal/... ./shortcuts/... ./extension/...
#2194 extended `im +messages-search` to `AuthTypes: {user, bot}` but left the affordance example and the skill reference asserting user-only, so the dual-identity guard added by #2199 fails on main. sa: safe doc: affordance/im.md, skills/lark-im cfg: none test: go test -race ./cmd/... ./internal/... ./shortcuts/... ./extension/...
Summary
Migrate Application and IM command-selection guidance from legacy Go
Tipsinto structured affordance overlays, so AI agents see source-backed examples, decision guidance, and safety prerequisites directly in leaf help and schema output. Runtime permission and recovery guidance remains owned by typed CLI errors instead of being duplicated in static help.Changes
lark-imskill sources.Tips, with contract tests that prevent guidance from drifting back into mixed sources.im images create's structured user-and-bot access-token contract without changing the IM skills, and make the reactions batch-query example a valid first-page request without a placeholder page token.Test Plan
make unit-test)lark-cli <domain> <command>flow works as expectedgo vet ./...go mod tidyleavesgo.modandgo.sumunchangedgofmt -l .produces no outputmainmake quality-gate QUALITY_GATE_CHANGED_FROM=origin/mainpasses (two existing bounded-list warnings only)No live API writes were performed; this change affects help/affordance guidance and its contracts.
Review Notes
The fetched metadata description for
im images createstill says bot-only even though its structuredaccessTokens, schema, flags, and user dry-run all support both user and bot. This mismatch is pre-existing in the generated metadata source, is not introduced by this PR, and should be corrected there separately rather than by editinglark-imor duplicating recovery text in affordance.Related Issues
Summary by CodeRabbit