Skip to content

feat: use description and command in affordance example schema#1126

Merged
sang-neo03 merged 1 commit into
mainfrom
feat/affordance-example-command
May 27, 2026
Merged

feat: use description and command in affordance example schema#1126
sang-neo03 merged 1 commit into
mainfrom
feat/affordance-example-command

Conversation

@sang-neo03

@sang-neo03 sang-neo03 commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Affordance examples are the AI-facing usage snippets in an envelope's _meta. They previously used title plus a structured input object mirroring the inputSchema. This reshapes each example to description plus a command string holding a ready-to-run lark-cli invocation — what an agent driving the CLI actually consumes. The affordance type was only just introduced and has no data authored in the registry yet, so this is a pre-population contract change with no migration. (The internal authoring guide was updated in lockstep.)

Changes

  • Rename AffordanceCase.Title to Description (json:"title" -> json:"description") and change AffordanceCase.Input map[string]interface{} (json:"input") to Command string (json:"command") in internal/schema/types.go
  • Update the affordance fixture and assertions in internal/schema/assembler_test.go to the new keys, and add an assertion on the Command value

Test Plan

  • go test -race ./internal/schema/... passed (affected package)
  • go build ./... passed; gofmt -l and go vet ./internal/schema/... clean
  • make unit-test (full suite): hit an unrelated flaky crash in extension/transport under parallel -race; that package has zero dependency on internal/schema (go list -deps) and passes in isolation across repeated runs
  • manual end-to-end: authored an affordance on calendar.calendars.primary in registry-config.yaml, ran gen-registry.py calendar, copied the generated meta_data.json, and confirmed lark-cli schema calendar calendars primary renders _meta.affordance.examples[0] = {description, command}; lark-cli calendar calendars primary --dry-run confirmed the example command resolves to POST /open-apis/calendar/v4/calendars/primary
  • local-eval / acceptance-reviewer / skill-eval: N/A — schema-type reshape with no new command, flag, or skill behavior

Related Issues

N/A

Summary by CodeRabbit

  • Refactor
    • Restructured affordance examples to improve how actions are represented. Example metadata now emphasizes description and command information instead of title and input fields, enhancing clarity of available actions and workflows within the system.

Review Change Stack

Affordance examples previously carried a title plus a structured input
object mirroring the inputSchema. Replace that with a description plus a
command string holding a ready-to-run lark-cli invocation, which is what
an AI agent driving the CLI actually consumes.

No affordance data exists in the registry yet, so this only reshapes the
consuming AffordanceCase type and its tests; the data pipeline
(registry-config.yaml -> gen-registry.py -> meta_data.json) forwards the
new keys verbatim.
@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 34994312-6279-4aab-852d-de3bd2b5b03a

📥 Commits

Reviewing files that changed from the base of the PR and between e98471c and 4727fe0.

📒 Files selected for processing (2)
  • internal/schema/assembler_test.go
  • internal/schema/types.go

📝 Walkthrough

Walkthrough

The PR refactors the AffordanceCase type to replace structured example input metadata with a simpler, command-focused shape. The struct fields change from Title and Input (map) to Description and Command (both strings), and the test is updated to validate the new contract.

Changes

Affordance Example Type Redesign

Layer / File(s) Summary
AffordanceCase type and comment update
internal/schema/types.go
AffordanceCase struct fields are redefined from Title (string) and Input (map[string]interface{}) to Description (string) and Command (string). JSON tags and the field comment are updated to reflect the new intent: a one-line description plus a runnable command.
Test fixture and assertions
internal/schema/assembler_test.go
The TestParseAffordance_FullPopulated test input now provides description and command fields instead of title and input. Assertions validate Examples[0].Description and Examples[0].Command in place of the prior Examples[0].Title check.

🎯 2 (Simple) | ⏱️ ~8 minutes

🐰 A struct sheds its old coat,
Title and Input fade away,
Description and Command now float,
Tests rewritten, contracts align today! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Title check ✅ Passed The title clearly and specifically describes the main change: renaming affordance example schema fields from (title, input) to (description, command).
Description check ✅ Passed The description follows the template structure with all required sections (Summary, Changes, Test Plan, Related Issues) completed with sufficient detail about the schema changes and verification steps.
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.

✏️ 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 feat/affordance-example-command

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/M Single-domain feat or fix with limited business impact label May 27, 2026
@github-actions

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@4727fe025ed59eec22f5b0077f9389ae0764c063

🧩 Skill update

npx skills add larksuite/cli#feat/affordance-example-command -y -g

@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.22%. Comparing base (e98471c) to head (4727fe0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1126   +/-   ##
=======================================
  Coverage   68.22%   68.22%           
=======================================
  Files         617      617           
  Lines       57192    57192           
=======================================
  Hits        39017    39017           
  Misses      14945    14945           
  Partials     3230     3230           

☔ 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.

@sang-neo03
sang-neo03 merged commit 70081f6 into main May 27, 2026
21 checks passed
@sang-neo03
sang-neo03 deleted the feat/affordance-example-command branch May 27, 2026 08:08
tuxedomm pushed a commit to zhumiaoxin/cli that referenced this pull request Jun 6, 2026
…uite#1126)

Affordance examples previously carried a title plus a structured input
object mirroring the inputSchema. Replace that with a description plus a
command string holding a ready-to-run lark-cli invocation, which is what
an AI agent driving the CLI actually consumes.

No affordance data exists in the registry yet, so this only reshapes the
consuming AffordanceCase type and its tests; the data pipeline
(registry-config.yaml -> gen-registry.py -> meta_data.json) forwards the
new keys verbatim.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants