fix: improve api legacy invoke guidance#4
Open
hehanlin1996 wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Aiden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improve the generic
apicommand error surface for AI-hallucinated / legacyapi +invoke --api ...syntax observed in the 2026-05-15 C5 Skill/Agent Runtime evidence (BASE-20260515-002). Instead of Cobra's bareunknown flag: --apiplus usage dump, return a structured validation error with the supported raw OpenAPI and schema-driven invocation paths.Changes
lark-cli api +invoke --api ...flag parsing failures and convert them tooutput.ErrWithHint.lark-cli api +invoke <alias>misuse before dry-run/API execution.Test Plan
go test ./cmd/api -run 'TestApiCmd_LegacyInvoke' -count=1failed before implementation withunknown flag: --api/ no error for+invokedry-run.go test ./cmd/api -count=1go test ./cmd/... -count=1go vet ./cmd/apigo test ./tests/cli_e2e -run 'TestCLIStdinRegression_(SuccessCases|ErrorCases)' -count=1go build -buildvcs=false -o /tmp/lark-cli-skill-runtime . && /tmp/lark-cli-skill-runtime api +invoke --api knowledge_base.kpoint_search_v1 --data '{"query":"secboot"}' --dry-runexits 2 and emits structured JSON on stderr.make unit-test: blocked by a pre-existing unrelatedshortcuts/basefailure in this environment (TestBaseRecordExecuteReadCreateDelete/upload_attachment_uses_multipart_for_large_fileexpects.binasapplication/octet-stream, but Go/system MIME returnsapplication/x-sega-cd-rom). Reproduced onorigin/mainat 898e0ee with the same command.Related Issues