Files
pbakaus_impeccable/crates/live/src/lib.rs
T
Paul BakausandClaude Fable 5.1 0547ed6a63 reorg C: the open Rust runtime joins this repo as one Cargo workspace
The engine no longer lives in a separate repo. `crates/` is a snapshot of the
open crates (foundation, core, common, context, live, hook, skills, comp,
comp-verbs, html, browser, detect, cli) plus `Cargo.lock`, taken as a git
archive of the engine repo at the commit that finished the boundary split.
None of that repo's history comes with it, and none of it should: the closed
half stays private.

The closed half is the rule engine. It ships as a prebuilt native archive per
target, `libimpeccable_detector.a`, published as a `detector-v<X>` GitHub
Release on this repo. `crates/core/build.rs` resolves and links it three ways:
`IMPECCABLE_DETECTOR_LIB=<dir>` for a local detector build, else the
`~/.impeccable/detector/<version>/<target>/` cache, else a download verified
against its `.sha256` sidecar. `crates/core` is a thin shim over a three-symbol
C ABI; nothing above it knows the boundary exists.

What changed versus the engine repo copy:

- Every crate manifest moves from `license-file.workspace` to
  `license.workspace` (this workspace declares Apache-2.0), and the workspace
  gains the `postcard` dependency the boundary encoding needs.
- The launcher contract test reads `skill/scripts/impeccable{,.cmd}` instead of
  a sibling `launcher/` dir, and `engine_binary` downloads from
  `github.com/pbakaus/impeccable/releases/download/engine-v<version>/` instead
  of the retired dist repo. No oracle golden carried the old URL, so no
  re-recording was owed.
- The tests that hunted for a public repo through `IMPECCABLE_PUBLIC_REPO`,
  `../impeccable-second` or a hardcoded home directory now resolve the root as
  `CARGO_MANIFEST_DIR/../..`, because they are in it. The env var stays as an
  override for an out-of-tree checkout.
- The in-page bundle (`detect-antipatterns-browser.js`, 2 MB of generated wasm
  glue) is no longer tracked. `crates/core/build.rs` resolves it beside the
  archive, hands the path to `impeccable_core::browser::IN_PAGE_BUNDLE_JS`, and
  live mode serves that. `scripts/check-detector-release.mjs` now requires it
  and its `.sha256` in a detector release.
- The live crate embeds `skill/scripts/live-browser*.js` and
  `modern-screenshot.umd.js` directly rather than through vendored copies, so
  the binary and the installed skill cannot drift.
- `crates/browser/assets/` (an unused second copy of the bundle) is gone.
- `tests/lib/engine-bin.mjs` also accepts `target/release/impeccable`, so a
  plain `cargo build --release -p impeccable` is enough to run `bun run test`.

Verified with the archive from a local detector build: `cargo test --workspace`
267 pass, oracle 795 pass / 0 fail / 0 missing, `bun run build` clean, the
default suite green, and the launcher's `engine-probe` handshake answering
through `skill/scripts/impeccable`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vau2X53xGTjjTCXWMVBoNY
2026-09-01 15:31:26 -07:00

87 lines
2.6 KiB
Rust

//! Live mode: the shared model (roots, paths, config, journal, session store,
//! framework injection, gitignore block, preflight) and the verbs `live`,
//! `live-target`, `live-status`, `live-resume`, `live-complete`,
//! `live-inject`. Parts 2/3 add wrap/insert/accept and the server/poll verbs
//! on top of these modules.
pub mod accept_css;
pub mod accept_verify;
pub mod browser_assets;
pub mod config;
pub mod copy_edit_agent;
pub mod design_md;
pub mod event_validation;
pub mod gitignore;
pub mod inject;
pub mod instructions;
pub mod journal;
pub mod json_error;
pub mod live_http;
pub mod manifests;
pub mod manual_edits;
pub mod paths;
pub mod pending_edits;
pub mod preflight;
pub mod project_ignores;
pub mod random;
pub mod roots;
pub mod server;
pub mod server_state;
pub mod session;
pub mod source_lock;
pub mod source_search;
pub mod svelte_ast;
pub mod svelte_bridge;
pub mod svelte_component;
pub mod svelte_sessions;
pub mod util;
pub mod vocabulary;
pub mod wrap_common;
pub mod live_accept;
pub mod live_boot;
pub mod live_commit_manual_edits;
pub mod live_complete;
pub mod live_discard_manual_edits;
pub mod live_inject;
pub mod live_insert;
pub mod live_poll;
pub mod live_resume;
pub mod live_server;
pub mod live_status;
pub mod live_target;
pub mod live_wrap;
use impeccable_common::Io;
/// Verb dispatcher for every `live*` verb. Unknown live verbs (parts 2/3
/// until they land) report `not implemented` with exit 70.
pub fn run(verb: &str, args: &[String], io: &mut Io) -> i32 {
match verb {
"live" => live_boot::run(args, io),
"live-target" => live_target::run(args, io),
"live-status" | "status" => live_status::run(args, io),
"live-resume" | "resume" => live_resume::run(args, io),
"live-complete" | "complete" => live_complete::run(args, io),
"live-inject" | "inject" => live_inject::run(args, io),
"live-wrap" | "wrap" => live_wrap::run(args, io),
"live-insert" | "insert" => live_insert::run(args, io),
"live-accept" | "accept" => live_accept::run(args, io),
"live-server" => live_server::run(args, io),
"live-poll" | "poll" => live_poll::run(args, io),
"live-commit-manual-edits" | "commit-manual-edits" => {
live_commit_manual_edits::run(args, io)
}
"live-discard-manual-edits" | "discard-manual-edits" => {
live_discard_manual_edits::run(args, io)
}
other => {
io.err(&format!(
"impeccable: verb '{}' is not implemented yet\n",
other
));
70
}
}
}