quail-cli-core
quail-cli-core is an instrument-agnostic CLI driver kit. It provides a shared command contract, a Python runtime, an external conformance checker, and a project scaffold for wrapping an API-accessible controller or instrument as a CLI driver compatible with the Quailbot schema.
Repository: https://github.com/BB-84C/quail-cli-core
Project boundaries
These projects have separate responsibilities.
| Project | Responsibility |
|---|---|
| quail-cli-core | Defines the five-command driver contract and provides the runtime, conformance checker, and scaffold. |
| nspmctl | A concrete Nanonis driver used by Quailbot and a reference implementation of the shared five-command model. |
| Quailbot | Consumes compatible drivers as an upper-level agent harness. It owns workspace capability declarations, forced linked readback, default-deny checks for state-changing operations, and the append-only experiment log. |
A driver can use any executable name, such as nspmctl, laserctl, or scopectl, while preserving the common contract.
Core commands
Every compatible driver exposes these five commands.
capabilitiesdescribes parameters, actions, command mappings, and capability or safety metadata.get <parameter>reads one parameter.set <parameter> [<value>] [--arg key=value ...] [--interval-s <sec>] [--plan-only]writes or plans a write.ramp <parameter> <start> <end> <step> --interval-s <sec> [--plan-only]executes or plans an explicit ramp.act <action_name> [--arg key=value ...] [--plan-only]invokes or plans an instrument action.
JSON is the default output format. Drivers may also expose --text for human-readable output.
Examples:
laserctl capabilities
laserctl get wavelength_nm
laserctl set wavelength_nm 532 --plan-only
laserctl ramp power_mw 0 10 1 --interval-s 0.1 --plan-only
laserctl act Shutter_Open --plan-only
Contract and conformance
The contract reference is docs/contract-v1.md. The executable quail-cli-conformance checker is the implementation-consistency check for external drivers.
The checker currently requires the following shapes.
capabilitieshas exactly two top-level objects namedparametersandaction_commands. Each contains exactlycountanditems, and each count must match the length of its item list.- Every parameter item requires the eight core keys
name,label,readable,writable,has_ramp,get_cmd,set_cmd, andsafety. The optionalscalar_strategyandscalar_coordinatekeys are accepted as a pair of non-empty strings. Other keys remain invalid. - The
get_cmd,set_cmd, andsafetydescriptors accept an object ornull. A readable parameter requires an object-valuedget_cmd, and a writable parameter requires an object-valuedset_cmd. Object-valued descriptors retain strict field validation. - Every action item includes
name,action_cmd, andsafety_mode. The allowed safety-mode values arealwaysAllowed,guarded, andblocked. - Successful
get,set,ramp, andactcalls use the exact payload keys documented in the contract reference. - The checker exercises an invalid-parameter call and verifies its JSON error payload and matching process exit code. This check covers that tested failure path rather than every possible argument-parser or backend failure.
- The checker appends
--jsonwhenever it invokes a target driver command. A compatible driver must accept this option even when JSON is already its default output format.
The 0.2.0 checker covers the capability extensions used by nspmctl 0.3, including paired scalar metadata and nullable descriptors. quail-cli-core validates capability and safety metadata structure. It does not execute the safety policy described by that metadata.
Run the checker with real parameters and actions from the target driver. Mutation-capable checks use --plan-only. This is not an offline mode. A concrete driver may still connect to its backend, read current state, or require writes to be enabled. nspmctl has these requirements.
quail-cli-conformance `
--command "laserctl" `
--get-parameter wavelength_nm `
--set-parameter wavelength_nm `
--set-value 532 `
--ramp-parameter power_mw `
--ramp-start 0 `
--ramp-end 10 `
--ramp-step 1 `
--action-name Shutter_Open
Install quail-cli-core 0.2.0
python -m pip install quail-cli-core
quail-cli-bootstrap --help
quail-cli-conformance --help
Scaffold a driver
Generate a standalone driver project:
quail-cli-bootstrap `
--output-dir D:\drivers\laserctl `
--cli-name laserctl `
--package-name laser_driver `
--project-name laser-instrument-driver
The scaffold separates the instrument backend from the contract-facing driver. Replace its placeholder backend with calls to the real controller API, then verify the resulting project. Scaffold generation alone is not conformance evidence.
Set-Location D:\drivers\laserctl
python -m pip install -e ".[dev]"
pytest
quail-cli-conformance `
--command "laserctl" `
--get-parameter instrument_value `
--set-parameter instrument_value `
--set-arg Value=0.2 `
--ramp-parameter instrument_value `
--ramp-start 0 `
--ramp-end 0.4 `
--ramp-step 0.1 `
--action-name Instrument_Action `
--action-arg Mode=1
Included components
quail_cli_core.driverdefines the abstract interface for the five core operations.quail_cli_core.runtimeprovides the shared parser, dispatch, JSON serialization, and handled-error output paths.quail_cli_core.conformancechecks an external driver process against the implemented contract.quail_cli_core.scaffoldgenerates a starting driver project.examples/minimal_demo_driver.pyprovides a minimal implementation example.docs/contract-v1.mddocuments thecore-v1command and payload contract.
What this kit does not do
quail-cli-core does not connect to a specific instrument by itself. Each concrete driver owns its controller API integration, state handling, and execution policy.
The kit declares and validates the structure of capability and safety metadata. It does not enforce limits such as minimum values, maximum values, step limits, or cooldowns. A concrete driver must implement and verify any policy represented by that metadata.
The kit also does not provide Quailbot's workspace capability declarations, forced linked readback, default-deny checks for state-changing operations, or append-only experiment log. Those are upper-level harness responsibilities in Quailbot.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quail_cli_core-0.2.0.tar.gz.
File metadata
- Download URL: quail_cli_core-0.2.0.tar.gz
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
049c2845e00761a8ab56b7bd9dab93de8ca036f639650e48a21ac9da21e5c6bd
|
|
| MD5 |
9c8da26a1687db5fbe0991da078a9681
|
|
| BLAKE2b-256 |
8f869a7ab4a1a57e94ff68e118b8c6a91fd98f2cad0932d97e9bededf4f52280
|
File details
Details for the file quail_cli_core-0.2.0-py3-none-any.whl.
File metadata
- Download URL: quail_cli_core-0.2.0-py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d8a138c11d3cacf259cca6c208b33450d7a29df5fd04590502022e0ba35a8c7
|
|
| MD5 |
37b0e81b2b78a27ea4f03fad01739177
|
|
| BLAKE2b-256 |
dad5599a67180040730182433a147e82804f5c050dbaa80059332beb8d9f52f5
|