Commit Graph

12 Commits

Author SHA1 Message Date
teernisse
75d9344b44 CLI: sync fingerprint enrichment, fetch hash-after-resolution, diff gate ordering
sync: endpoint_fingerprint now includes security_schemes, security_required,
tags, and operation_id — catches changes that previously went undetected.
Method comparison uppercased for consistency. New details field in
SyncOutput carries full ChangeDetails alongside the summary. Removed
unused _skipped_from_resume binding. normalize_to_json callers updated
for new (bytes, Value) return type. allow_private_host forwarded to
sync --all HTTP client builder.

fetch: content hash now computed from post-resolution json_bytes instead
of raw_bytes — when --resolve-external-refs is used, the stored content
differs from the original fetch, so the hash must match what is actually
written to the cache.

diff: --fail-on=breaking check moved before any output to avoid the
contradictory pattern of emitting success JSON then returning an error
exit code. Robot mode now emits a proper robot_error envelope on
breaking-change failure.
2026-02-12 16:56:57 -05:00
teernisse
a36997982a CLI: list --sort by method/tag, show merges path-level parameters
list: new --sort flag accepts path (default), method, or tag. All sort
modes maintain alias-first grouping for cross-alias queries. method sort
orders GET/POST/PUT/PATCH/DELETE/etc. tag sort uses first tag as primary
key with path and method as tiebreakers.

show: merge path-item-level parameters into operation parameters per
OpenAPI 3.x spec. Path-level params apply to all operations unless
overridden by an operation-level param with the same (name, in) pair.
Uses the operation_ptr to derive the parent path-item pointer and
resolve_json_pointer to access the raw spec.
2026-02-12 16:56:41 -05:00
teernisse
8455bca71b Robot mode: TTY auto-detect, env var, --no-robot flag, robot-docs command
Robot mode resolution is now a 4-tier cascade:
  1. --no-robot (explicit off, conflicts_with robot)
  2. --robot / --json (explicit on)
  3. SWAGGER_CLI_ROBOT=1|true env var
  4. TTY auto-detection (non-TTY stdout -> robot mode)

Pre-scan updated to match the same resolution logic so parse errors
get the correct output format before clap finishes parsing.

New robot-docs subcommand (alias: docs) provides machine-readable
self-documentation for AI agents: guide, commands, exit-codes, and
workflows topics. Designed for LLM consumption — structured JSON
with all flags, aliases, and usage patterns in one call.

robot_success_pretty added for --pretty support on robot-docs output.

Visible aliases added to commands: list->ls, show->info, search->find.
2026-02-12 16:56:28 -05:00
teernisse
cc04772792 Core: eliminate double-parse in normalize_to_json, harden SSRF, optimize search
normalize_to_json now returns (Vec<u8>, serde_json::Value) — callers get
the parsed Value for free instead of re-parsing the bytes they just
produced. Eliminates a redundant serde_json::from_slice on every fetch,
sync, and external-ref resolution path.

Format detection switches from trial JSON parse to first-byte inspection
({/[ = JSON, else YAML) — roughly 300x faster for the common case.

SSRF protection expanded: block CGNAT range 100.64.0.0/10 (RFC 6598,
common cloud-internal SSRF target) and IPv6 unique-local fc00::/7.

Alias validation simplified: the regex ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$
already rejects path separators, traversal, and leading dots — remove
redundant explicit checks.

Search performance: pre-lowercase query terms once and pre-lowercase each
field once per endpoint (not once per term x field). Removes the
contains_term helper entirely. safe_snippet rewritten with char-based
search to avoid byte-position mismatches on multi-byte Unicode characters
(e.g. U+0130 which expands during lowercasing).
2026-02-12 16:56:12 -05:00
teernisse
4ac8659ebd Wave 7: Phase 2 features - sync --all, external refs, cross-alias discovery, CI/CD, reliability tests (bd-1ky, bd-1bp, bd-1rk, bd-1lj, bd-gvr, bd-1x5)
- Sync --all with async concurrency, per-host throttling, failure budgets, resumable execution
- External ref bundling at fetch time with origin tracking
- Cross-alias discovery (--all-aliases) for list and search commands
- CI/CD pipeline (.gitlab-ci.yml), cargo-deny config, Dockerfile, install script
- Reliability test suite: crash consistency (8 tests), lock contention (3 tests), property-based (4 tests)
- Criterion performance benchmarks (5 benchmarks)
- Bug fix: doctor --fix now repairs missing index.json when raw.json exists
- Bug fix: shared $ref references no longer incorrectly flagged as circular (refs.rs)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 15:56:42 -05:00
teernisse
398311ca4c Wave 6: Integration tests, golden tests, index invariant tests, diff command (bd-rex, bd-2gp, bd-1ck) 2026-02-12 15:06:49 -05:00
teernisse
346fef9135 Wave 5: Schemas command, sync command, network policy, test fixtures (bd-x15, bd-3f4, bd-1cv, bd-lx6)
- Implement schemas command with list/show modes, regex filtering, ref expansion
- Implement sync command with conditional fetch, content hash diffing, dry-run
- Add NetworkPolicy enum (Auto/Offline/OnlineOnly) with env var + CLI flag resolution
- Integrate network policy into AsyncHttpClient and fetch command
- Create test fixtures (petstore.json/yaml, minimal.json) and integration test helpers
- Fix clippy lints: derivable_impls, len_zero, borrow-after-move, deprecated API
- 192 tests passing (179 unit + 13 integration), all quality gates green
2026-02-12 14:37:14 -05:00
teernisse
faa6281790 Wave 4: Full CLI command implementations - fetch, list, show, search, tags, aliases, doctor, cache lifecycle (bd-16o, bd-3km, bd-1dj, bd-acf, bd-3bl, bd-30a, bd-2s6, bd-1d4) 2026-02-12 14:25:30 -05:00
teernisse
9b29490f5f Wave 3: Cache read path with integrity validation, async HTTP client with SSRF protection (bd-3ea, bd-3b6) 2026-02-12 12:47:10 -05:00
teernisse
deb2794136 Wave 2: CLI skeleton, cache write, config system, spec indexer (bd-3d2, bd-1ie, bd-1sb, bd-189) 2026-02-12 12:41:18 -05:00
teernisse
8289d3b89f bd-ilo: Implement error types and core data models 2026-02-12 12:37:08 -05:00
teernisse
24739cb270 bd-a7e: Bootstrap Rust project and directory structure 2026-02-12 12:33:05 -05:00