fix: paginated JSON output, regenerate API client, add JSON Schema support#93
Merged
fix: paginated JSON output, regenerate API client, add JSON Schema support#93
Conversation
Add a new `-o schema` output format that generates JSON Schema for command output types. This enables AI agents and automation tools to programmatically discover the structure of CLI command outputs without needing to execute commands or maintain external documentation. Changes: - Add pkg/cli/schema package with reflection-based schema generation - Add `schema` output format option to all commands - Update help text to document the new output format Usage: escape-cli <command> -o schema 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add exhaustive case handling for all reflect.Kind values to satisfy the exhaustive linter. Cases already handled above the switch (Pointer, Slice, Array, Map) are included for completeness.
Add support for AI agents to discover input JSON Schema for commands that accept stdin input. This complements the existing -o schema flag which shows output schemas. Changes: - Add --input-schema global flag to root command - Add InputSchema function to out package - Update create/update commands to support --input-schema: - profiles create-rest, create-webapp, create-graphql - custom-rules create, update - assets create - Document AI agent integration flags in help text
Paginated list commands were calling out.Table() once per page, emitting multiple JSON arrays to stdout (e.g. [...]\n[...]\n[...]). This broke any JSON parser consuming -o json output. Now all pages are collected into a single slice before printing, producing one valid JSON array regardless of pagination. Affected commands: scans list, issues list, assets list, profiles list, audit list, events list, locations list, problems list.
added 2 commits
March 27, 2026 00:27
- Regenerate pkg/api/v3/ from latest public.escape.tech/v3/openapi.json - Fix PRIVATE enum deserialization error that broke assets list, issues list, and profiles list --all - Fix convert.py to handle null values in enum arrays from updated spec - Update wrapper layer (pkg/api/escape/) for renamed response types (ScanDetailed1 → StartScan200Response, ProfileDetailed → GetProfile200Response, etc.)
Merge schema output and input-schema features, resolving conflicts with pagination fixes and regenerated API types.
events list with no --levels flag was silently defaulting to ERROR only, hiding all INFO/WARNING/DEBUG events. Now returns all levels by default.
- `profiles update` - update metadata (name, description, cron) via flags or stdin JSON - `profiles update-configuration` - update scan config (auth, scope, frontend_dast) via stdin JSON Closes the feature gap that required the web UI or direct API calls to modify profile configuration.
Allows replacing the API schema (OpenAPI, Postman, GraphQL) attached to a profile. Works with the existing upload schema command: 1. escape-cli upload schema < spec.json 2. escape-cli profiles update-schema <profile-id> <schema-id>
Adds a comprehensive E2E test infrastructure using go-internal/testscript with 10 test suites covering auth, CRUD lifecycles (tags, assets, profiles, scans), output formats, error paths, and read-only endpoints. Tests run against the live Escape API behind the e2e build tag and require E2E_API_KEY to be set. CI job added to pr.yaml (runs after unit tests).
Use exec.CommandContext, suppress os.RemoveAll error, rename unused parameters to _ (required by testscript function signature).
Use errors.New for static error strings, suppress magic number lint for cobra.ExactArgs(2).
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
scans,issues,assets,profiles,audit,events,locations,problems) were emitting one JSON array per page. Now accumulates all pages before printing, producing valid JSON.PRIVATEenum deserialization error that brokeassets list,issues list, andprofiles list --all. Updates 763 generated files.convert.py— Handlenullvalues in enum arrays from the updated spec.-o schema) — New output format for AI agent integration that returns the JSON Schema of command output.--input-schemaflag — Shows expected stdin JSON Schema for create/update commands.pkg/cli/schema/with comprehensive tests.Test plan
scans listwith 268 results (3 pages) emits single valid JSON arrayassets listreturns 239 items (previously crashed on PRIVATE enum)issues listreturns 1721 items (previously crashed on PRIVATE enum)profiles list --allreturns 243 items (previously crashed)audit list,events list,locations list,problemsall return valid JSONgo test ./...passesgo build ./...clean-o schemaoutput on list/get commands--input-schemaon create commands