Skip to content

apps cli

bondiano edited this page Nov 12, 2026 · 1 revision

Command-line application

Active contributors: Vassiliy Kuzenkov (also recorded as bondiano).

sych is the binary of sych-app. Its clap command tree dispatches once through a shared error boundary; local analysis, saved-result readers and operator actions have distinct side effects.

Dispatch and command families

crates/sych-app/bin/sych.rs parses Cli, then calls run_command around the selected implementation. Arguments are in crates/sych-app/src/args.rs and crates/sych-app/src/args/tour.rs.

Family Commands Boundary
Review and facts review, semantic Pinned comparison; local review never publishes
Saved readers show, explain Read an existing run, never reanalyze
Guided reading tour, tour show/reveal/complete/dismiss, ask, handoff Generation/questions can spend; stored reading and handoff do not
Configuration config init, config validate Authoring checks, not acceptance of proposed head policy
Diagnostics/auth doctor, auth chatgpt Explicit probe/smoke/sign-in boundaries
Storage db migrate, db import-sqlite, cache prune Explicit schema/import/retention operations
Evaluation eval run/validate/measure/compare/judge Harness, labelled quality and saved-report scoring
Server roles serve, api, worker Combined or split long-running process
Operator actions publish, cancel, rerun, reconcile Durable server operations and audited decisions

review requires --models fake|roles|PROFILE and either local --base or --change github:CONNECTION:OWNER/REPO:NUMBER. Local defaults are --repo ., --head HEAD, merge-base comparison, semantic collection on, JSON output and operational exit policy. --diff-base chooses an explicit comparison. --policy-ref explicitly changes the trusted policy revision and records it; head policy is otherwise only a proposed change.

--ci-facts, --ci-manifest and repeatable --check PROFILE[:PARAM=VALUE,...] add facts or approved execution. They do not grant arbitrary repository execution. See Facts; the Review page owns analysis internals.

Configuration and doctor

sych config init --personal --output sych.yaml
sych config validate --config sych.yaml --repo .
sych db migrate --config sych.yaml
sych doctor --config sych.yaml --repo .

config init writes the personal example without overwriting an existing file. Validation combines server configuration/defaults with working-tree .sych/ for authoring, showing effective configuration, hashes and provenance with redaction. Reviews instead read trusted policy from pinned target tip unless explicitly overridden.

Doctor checks configuration, Git access, referenced environment-variable presence, artifact directory, price catalog, profile resolution and database schema availability. Warnings can coexist with exit 0; doctor is not a live-provider or deployment certification.

  • --probe-model PROFILE explicitly sends one small accounted structured request and reports route/attempt details.
  • --scm-smoke CONNECTION --pr NUMBER explicitly creates, reads, updates, finds and deletes a marked GitHub comment through the connection's first configured repository.
  • auth chatgpt --config ... --provider ... performs official sign-in/token storage and model listing, not inference.

Field-level rules are in Configuration.

Storage and evaluation

Without a config, local storage is .sych-data/sych.db plus .sych-data/artifacts relative to the command's working directory, not --repo. With config, SQLite/artifact paths resolve relative to that file; PostgreSQL URLs pass to the driver.

db migrate explicitly applies migrations; opening storage never migrates implicitly. db import-sqlite --source SNAPSHOT --config ... requires a stopped, consistent SQLite/artifact snapshot and an empty migrated PostgreSQL target. cache prune --dry-run previews artifact, expired-record and unused-mirror deletion while retention/active-run protections remain in force.

Eval command Calls models? Purpose
run --suite ... --models fake No Deterministic fixture expectations
validate --suite ... No Label completeness, evidence coordinates and syntax shapes
measure --suite ... --config ... --models ... Yes Budgeted labelled-suite reviews, repeats or candidate replay
compare REPORT REPORT ... No Side-by-side compatible reports
judge REPORT --judgments ... No Owner-provided meaning/location rescoring

Measure variants are C (normal), B (no high-risk search), A (single diff reviewer without semantic facts/risk audit/verifier). They are evaluation baselines, not configuration switches for hiding production findings. See Testing.

Server actions

publish --run ... --as CLIENT queues advisory publication for the server to send. cancel affects active work, not an already committed result's assessment. rerun --change ID --profile economical|deep --as CLIENT creates a new generation from current provider state.

reconcile lists unknown publication outcomes; --allow-create ID --actor CLIENT --reason ... records a writer's audited duplicate-risk decision. These are not alternate local review verdicts. Server covers authorization, queues and publication.

Output and errors

Local review saves its result before rendering, so show --run RUN can recover it after an output failure. Shared Output defaults to pretty JSON, accepts Markdown, writes stdout or --output, and creates output parent directories.

Not every command uses that renderer: doctor/prune print human-readable lines, semantic emits JSON, and the current provider-change review path emits result JSON directly even if --format markdown is supplied. Its file write also does not use shared parent-directory creation. Treat output behavior as command-specific.

Logs go to stderr, configured by SYCH_LOG, with ANSI only for a terminal. Command failures print the full contextual chain line-by-line as sych <command>: ...; typed causes determine exits.

Exit Meaning
0 Operational success; not necessarily complete coverage or no findings
1 Evaluation/validation expectation failure; also unsuccessful SCM smoke
2 Invalid arguments, refs, paths or configuration
3 No result/answer or unclassified operation failure
4 Missing credentials/access or permission refusal
10 Strict review recommendation is ATTENTION_REQUIRED
11 Strict review has incomplete coverage, when exit 10 does not take priority
130 Cancellation

Key source files

Source Change entry point
crates/sych-app/bin/sych.rs Dispatch and tracing setup
crates/sych-app/src/args.rs Flags/defaults and command families
crates/sych-app/src/commands/review.rs Local/provider-change entry paths
crates/sych-app/src/config.rs Authoring config loading
crates/sych-app/src/commands/doctor.rs Diagnostic/probe/smoke gating
crates/sych-app/src/storage.rs Storage paths and saved readers
crates/sych-app/src/output.rs Shared output writer
crates/sych-app/src/errors.rs Typed failure exits

Scope and tests

39 source files, 3 test files; ratio 0.077; 1 unique human author. Method: application measurements. Scope: crates/sych-app/bin/; app args.rs, args/, commands/, command.rs, config.rs, errors.rs, output.rs, render.rs, storage.rs, eval.rs, quality/; integration tests cli.rs, cli_server.rs. The third test file is under the quality implementation; inline tests remain source.

Add a command through args, binary dispatch and commands/, then test actual subprocess output/exits. Keep stdout contracts separate from stderr logs. Reader-specific changes belong with Tours and handoff, not a second implementation inside command dispatch.

Clone this wiki locally