[FEATURE] Document how setup scripts should interpret droidspaces check
Problem
A Linux setup script that uses if sudo droidspaces --json check; then … can continue even when a required check fails. The CLI guide lists requirements_met, but it doesn’t explain that the command can exit successfully when that field is 0. Linux CLI guide
I reproduced this with the v7.2.0 amd64 release on Ubuntu 26.04.1 under WSL2, kernel 6.18.58.1-microsoft-standard-WSL2. I ran the same command twice. Running it as nobody deliberately exercised the required root check.
This matches the implementation. It sets requirements_met according to whether all required checks passed, writes the report, and returns 0. Check implementation
Proposed change
Add a short example to the Linux CLI guide showing how a setup script can stop when the command fails or when the report says a requirement is missing. With jq installed:
report=$(sudo droidspaces --json check) || exit 1
printf '%s\n' "$report" |
jq -es 'length == 1 and (.[0].requirements_met == 1)' >/dev/null || exit 1I tested this example with both reports above. It continued for the passing report and stopped for the failed one. It also stopped on command failure, empty output, and malformed JSON.
Alternative considered
Changing the exit status would affect existing callers that collect diagnostic reports. A guide example would give setup scripts the behavior they need using the field Droidspaces already provides. I’d be happy to submit the documentation PR.
### ProblemA Linux setup script that uses if sudo droidspaces --json check; then … can continue even when a required check fails. The CLI guide lists requirements_met, but it doesn’t explain that the command can exit successfully when that field is 0. [Linux CLI guide](https://github.com/ravindu644/Droidspaces-OSS/blob/v7.2.0/Documentation/Linux-CLI.md#L28)
I reproduced this with the v7.2.0 amd64 release on Ubuntu 26.04.1 under WSL2, kernel 6.18.58.1-microsoft-standard-WSL2. I ran the same command twice. Running it as nobody deliberately exercised the required root check.
droidspaces --json check run as |
Command exit status | JSON root |
JSON requirements_met |
|---|---|---|---|
nobody (UID 65534) |
0 | 0 | 0 |
root (UID 0) |
0 | 1 | 1 |
This matches the implementation. It sets requirements_met according to whether all required checks passed, writes the report, and returns 0. [Check implementation](https://github.com/ravindu644/Droidspaces-OSS/blob/v7.2.0/src/cli/check.c#L421-L430)
Proposed change
Add a short example to the Linux CLI guide showing how a setup script can stop when the command fails or when the report says a requirement is missing. With jq installed:
report=$(sudo droidspaces --json check) || exit 1
printf '%s\n' "$report" |
jq -es 'length == 1 and (.[0].requirements_met == 1)' >/dev/null || exit 1
I tested this example with both reports above. It continued for the passing report and stopped for the failed one. It also stopped on command failure, empty output, and malformed JSON.
Alternative considered
Changing the exit status would affect existing callers that collect diagnostic reports. A guide example would give setup scripts the behavior they need using the field Droidspaces already provides. I’d be happy to submit the documentation PR.
It's entirely up to the person who writes the setup script to detect whether the host supports Droidspaces or not. requirements_met in the JSON output tells exactly that, and the app already uses it to limit its functionality on an unsupported device.
There's nothing to fix or add here, as we don't have any setup script yet. Thanks for the detailed report though!