mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
Copy Scrawl's `crates/capture` from kitlangton/scrawl, branch `engine/split`, commit e351ddb28be47c77481cb6821cc72d7f8fe7c769 (e351ddb), without history, keeping the package name `scrawl-capture`, and its `docs/app-handover-spec.md` as `docs/plans/capture-handover-spec.md`. Hex depends on it by path instead of the Git pin at 86d7d6c; the Nix `outputHashes."scrawl-capture-0.3.13"` entry goes. Workspace: `crates/capture` is in `[workspace] exclude`, so `cargo build`, `cargo test`, and `--workspace` never build it (Linux, Windows, and Nix included). It compiles only as the `capture` feature's macOS dependency, sharing the root Cargo.lock and target/. The root package stays a member without being listed, since listing "." defeats `exclude`. On macOS `scripts/check` and the macOS workflow name it (`-p voice-control -p scrawl-capture --features capture`) to lint and test its 257 tests. API adaptations in capture_host: - `Finished` gains `gaps` and `missing_transcript`; the host records them and `hex capture status` (human and JSON `last`) shows them. - `Engine::new` bridges the crate's log to `Host::log` when no sink is set, so Hex's own `TracingLog` sink goes and each line is logged once. - Scrawl now writes its bundle files 0600; Hex still tightens recording.mp4, the window log, and folders. - Nothing on Hex's path reads ~/.config/scrawl or writes under Application Support/scrawl: the crate does that only after `enable_scrawl_host_defaults`/`enable_file_log`, which Hex never calls. Scrubbed (synthetic values): a file:///Users/<name> path in ax.rs, the com.kitlangton.UpDown / dev.kitlangton.UpDown test bundle IDs in handoff.rs and phone.rs (now com.example.UpDown), and a personal device name in a phone.rs test. Kept: Scrawl's own product IDs (dev.kitlangton.scrawl, .helper) and its public GitHub releases URL. fmt and clippy -D warnings, no behaviour change: `cargo fmt` on five files; `chunks_exact(N)` to `as_chunks::<N>()` (19 sites); collapsed `if let` chains in capture/macos.rs and pipeline.rs and a `match` in page.rs; `type` aliases for a drag start and two ingest hooks; explicit lower bounds on two test `match` range arms in keyframes.rs; `slice::from_ref` for two one-element slices; `and_then` for `map().flatten()`; a dropped `to_owned`; `#[allow]` for one `too_many_arguments` and one `single_range_in_vec_init`.
42 lines
1.5 KiB
Shell
Executable file
42 lines
1.5 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
# The local check loop.
|
|
#
|
|
# scripts/check fmt, clippy, then every test
|
|
# scripts/check meeting::query fmt, then only the tests matching the filters
|
|
#
|
|
# Tests run through cargo-nextest (.config/nextest.toml): each test is its own
|
|
# process, and one that hangs is killed and reported by name. Exit codes:
|
|
# 10 fmt, 11 clippy, 12 tests. NEXTEST_PROFILE=ci selects CI's profile.
|
|
# Tests build with the `capture` feature, so the debug-only capture
|
|
# experiment's code (macOS) is tested too. `crates/capture` sits outside the
|
|
# workspace (Cargo.toml), so on macOS it is named to be linted and tested.
|
|
set -uo pipefail
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
|
|
|
packages=(--workspace)
|
|
if [[ "$(uname -s)" == Darwin ]]; then
|
|
packages=(-p voice-control -p scrawl-router -p scrawl-capture)
|
|
fi
|
|
|
|
stage() {
|
|
printf '\n==> %s\n' "$1"
|
|
}
|
|
|
|
stage "fmt"
|
|
cargo fmt --all --check || exit 10
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
stage "clippy"
|
|
cargo clippy --locked "${packages[@]}" --all-targets --features capture,onnx-benchmark -- -D warnings || exit 11
|
|
fi
|
|
|
|
if command -v cargo-nextest >/dev/null 2>&1; then
|
|
stage "test (nextest${1:+: $*})"
|
|
cargo nextest run --locked "${packages[@]}" --features capture --no-tests=warn "$@" || exit 12
|
|
else
|
|
stage "test (cargo test${1:+: $*})"
|
|
echo "cargo-nextest is not installed, so a hung test stalls the run without" >&2
|
|
echo "a name. Install it with: brew install cargo-nextest" >&2
|
|
cargo test --locked "${packages[@]}" --features capture -- "$@" || exit 12
|
|
fi
|