Repository navigation
feat: agent CLI contract, JSON errors, and describe/doctor - #4
Merged
Merged
Conversation
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>
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.
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 barebsaxs) prints a machine-readable catalog: commands, exit codes0/1/2, recommended Identify→Evaluate flags, and invariants (success=Trueis not acceptance; pixel-q is not a period; no overwrite without--force).bsaxs doctoris the same asbsaxs-doctor. Doctor JSON now includes the package version.lamellarsaxs2d.cli_error.v1) on stdout for usage/input/config failures; the human错误:line stays on stderr so existing tests and operators still work.schema_version,tool, and anagentobject with next steps. They do not claimlamellarsaxs2d.result.v1(that remains preflight-only).cli.pyso--help,describe, anddoctordo not need NumPy.PipelineErrormoved tobutterfly_saxs.errors.Verification
ruff check src tests scriptsbsaxs describe,bsaxs doctor --json,bsaxs inspectmissing-input JSON errorScientific analysis behavior is unchanged: default ridge method remains
radial_peak; the catalog recommendsbutterfly_curvatureinstead of silently changing the measurement.