Skip to content

fix: improve api legacy invoke guidance#4

Open
hehanlin1996 wants to merge 1 commit into
mainfrom
ai-fix-20260515-skill-runtime
Open

fix: improve api legacy invoke guidance#4
hehanlin1996 wants to merge 1 commit into
mainfrom
ai-fix-20260515-skill-runtime

Conversation

@hehanlin1996
Copy link
Copy Markdown
Owner

@hehanlin1996 hehanlin1996 commented May 17, 2026

Summary

Improve the generic api command error surface for AI-hallucinated / legacy api +invoke --api ... syntax observed in the 2026-05-15 C5 Skill/Agent Runtime evidence (BASE-20260515-002). Instead of Cobra's bare unknown flag: --api plus usage dump, return a structured validation error with the supported raw OpenAPI and schema-driven invocation paths.

Changes

  • Detect lark-cli api +invoke --api ... flag parsing failures and convert them to output.ErrWithHint.
  • Detect positional lark-cli api +invoke <alias> misuse before dry-run/API execution.
  • Suppress the API command usage banner on this validation error so stderr stays machine-readable for agents.
  • Add regression tests for both legacy misuse shapes.

Test Plan

  • TDD red: go test ./cmd/api -run 'TestApiCmd_LegacyInvoke' -count=1 failed before implementation with unknown flag: --api / no error for +invoke dry-run.
  • Unit: go test ./cmd/api -count=1
  • Unit: go test ./cmd/... -count=1
  • Vet: go vet ./cmd/api
  • Related CLI E2E/dry-run regression: go test ./tests/cli_e2e -run 'TestCLIStdinRegression_(SuccessCases|ErrorCases)' -count=1
  • Manual dry-run/error surface: go 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-run exits 2 and emits structured JSON on stderr.
  • Full make unit-test: blocked by a pre-existing unrelated shortcuts/base failure in this environment (TestBaseRecordExecuteReadCreateDelete/upload_attachment_uses_multipart_for_large_file expects .bin as application/octet-stream, but Go/system MIME returns application/x-sega-cd-rom). Reproduced on origin/main at 898e0ee with the same command.

Related Issues

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant