Skip to main content

Module doctor

Module doctor 

Source
Expand description

doctor-json: the eighteen checks behind the opencode-ctl-doctor skill (spec Skills).

The doctor COMPUTES the checks in a fixed order (ctl_home_override, binary, registration, server_info, then the rest in id order) and EMITS them in id order. registration is read before anything can start the service, so an ok_started cannot rewrite the file it reports on. server_info is the ONE place that starts a stopped service, explicitly; every other check leaves the service alone: wait_route never fetches the OpenAPI document itself (it reads the table server.info already cached) and registration never calls server.info.

Every pair decision keys on the FILE NAME’s id (pair.<id>.json), never on the id inside the record: records_by_name enumerates the files itself and overwrites the record’s inner id.

StructsΒ§

Check
DoctorCtx
ServerState πŸ”’
SourceFile
The two lines of opencode-pair.exe.source: path=<staged path> and version=<plugin semver> (spec install-launcher; split on the first =, any parse failure counts as absent).

EnumsΒ§

LinkStatus
Status

ConstantsΒ§

BINARY_NAMES πŸ”’
CHECK_IDS
The check ids, in emit order.
MESSAGES πŸ”’
Every message the doctor can print, keyed by (id, status, variant); <...> placeholders are filled by message. A check with several texts per status has one variant tag per text.
PROTECTED πŸ”’
The protected keys (spec Settings), in the order the doctor lists them.
SIDES πŸ”’

FunctionsΒ§

binary_check πŸ”’
ctl_home_override πŸ”’
default_config_file
The service config’s default location: $OPENCODE_CONFIG_DIR/service.json (packages/util/src/global.ts:79), else $XDG_CONFIG_HOME/opencode/, else ~/.config/opencode/.
default_registration_file
The registration file’s default location: $XDG_STATE_HOME/opencode/service.json, else ~/.local/state/opencode/service.json (packages/util/src/global.ts:79 roots).
doctor_json
The doctor report: {"checks":[...], "notes":[...], "settings"?}.
env_vs_user_file πŸ”’
first_line πŸ”’
hex πŸ”’
launcher_link_check πŸ”’
launcher_link_status
POSIX: the opencode-pair symlink’s target; Windows: the copy and its .source file.
link_name πŸ”’
lock_source_check πŸ”’
log_check πŸ”’
message πŸ”’
mtime_ms πŸ”’
name_status πŸ”’
Which kind of binary a staged or linked file name belongs to, relative to host.
note_json πŸ”’
opencode_password_set πŸ”’
orphaned_controllers πŸ”’
orphaned_workers πŸ”’
pairing_check πŸ”’
parse_source_file
reason_words πŸ”’
registration_check πŸ”’
resolved_settings πŸ”’
same_path πŸ”’
server_info_check πŸ”’
server_url_password πŸ”’
settings_file_hash πŸ”’
settings_notes πŸ”’
side_words πŸ”’
source_name πŸ”’
stem_of πŸ”’
A file name with the .exe suffix dropped, from either kind of separator.
version_range_check πŸ”’
wait_route_check πŸ”’
windows_link_status
The Windows rule on already-read inputs (pure, so it is tested on every platform): Stale when the .source path= differs from the running exe OR its version= differs from version.
windows_source_old_check
windows_source_old on a given platform flag (so the Windows rule is tested everywhere): the copy’s .source file must parse, and no .old leftover may remain.