Skip to content

feat: agent CLI contract, JSON errors, and describe/doctor - #4

Merged
cursor[bot] merged 1 commit into
mainfrom
cursor/agent-cli-contract-727e
Sep 15, 2026
Merged

cursor[bot] merged 1 commit into
mainfrom
cursor/agent-cli-contract-727e

Conversation

@D-sudoasd

Copy link
Copy Markdown
Owner

LamellarSAXS2D is now safer for an agent (or any non-interactive operator) to drive without guessing CLI shape or treating solver success as science.

What changed

  • bsaxs describe (also the default for a bare bsaxs) prints a machine-readable catalog: commands, exit codes 0/1/2, recommended Identify→Evaluate flags, and invariants (success=True is not acceptance; pixel-q is not a period; no overwrite without --force).
  • bsaxs doctor is the same as bsaxs-doctor. Doctor JSON now includes the package version.
  • JSON error envelopes (lamellarsaxs2d.cli_error.v1) on stdout for usage/input/config failures; the human 错误: line stays on stderr so existing tests and operators still work.
  • inspect / analyze / batch / synthetic / project summaries add schema_version, tool, and an agent object with next steps. They do not claim lamellarsaxs2d.result.v1 (that remains preflight-only).
  • Lazy scientific imports in cli.py so --help, describe, and doctor do not need NumPy. PipelineError moved to butterfly_saxs.errors.
  • AGENTS.md documents the operator contract. Version 0.4.1.

Verification

  • ruff check src tests scripts
  • Full suite: 907 passed, 7 skipped (Qt Quick 3D / unmounted fixtures), matching prior skip reasons
  • Smoke: bsaxs describe, bsaxs doctor --json, bsaxs inspect missing-input JSON error

Scientific analysis behavior is unchanged: default ridge method remains radial_peak; the catalog recommends butterfly_curvature instead of silently changing the measurement.

Open in Web Open in Cursor 

Give agents a single, fail-closed way to operate LamellarSAXS2D: `bsaxs`
with no subcommand prints a JSON catalog, `bsaxs doctor` matches
bsaxs-doctor, inspect/analyze/batch carry schema and operator guidance,
and failures emit a JSON envelope on stdout while keeping the human
stderr line. Scientific imports are lazy so describe/doctor/help do not
need NumPy. PipelineError lives in a stdlib module. Version 0.4.1.

Co-authored-by: Alen <dlgong17s@imr.ac.cn>
@cursor
cursor Bot merged commit 004a627 into main Sep 15, 2026
14 checks passed
@cursor
cursor Bot deleted the cursor/agent-cli-contract-727e branch September 15, 2026 14:42
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.

2 participants