From e510e99e1956759a2bad6fec4f876c639b2ea3bc Mon Sep 17 00:00:00 2001 From: Fabro Date: Sun, 15 Mar 2026 12:58:13 -0400 Subject: [PATCH] init run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ⚒️ Generated with [Fabro](https://fabro.sh) --- graph.fabro | 34 ++++++++++++++++++++++++++++++++++ manifest.json | 12 ++++++++++++ sandbox.json | 5 +++++ 3 files changed, 51 insertions(+) create mode 100644 graph.fabro create mode 100644 manifest.json create mode 100644 sandbox.json diff --git a/graph.fabro b/graph.fabro new file mode 100644 index 000000000..4ab945c04 --- /dev/null +++ b/graph.fabro @@ -0,0 +1,34 @@ +digraph ImplementAndSimplify { + graph [ + goal="Implement and simplify", + model_stylesheet=" + * { backend: api; model: claude-opus-4-6;} + " + ] + rankdir=LR + + start [shape=Mdiamond, label="Start"] + exit [shape=Msquare, label="Exit"] + + toolchain [label="Toolchain", shape=parallelogram, script="command -v cargo >/dev/null || { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && sudo ln -sf $HOME/.cargo/bin/* /usr/local/bin/; }; cargo --version 2>&1", max_retries=0] + preflight_compile [label="Preflight Compile", shape=parallelogram, script="cargo check 2>&1", max_retries=0] + preflight_lint [label="Preflight Lint", shape=parallelogram, script="cargo clippy -- -D warnings 2>&1", max_retries=0] + fix_lints [label="Fix Lints", prompt="The preflight lint step failed. Read the build output from context and fix all clippy lint warnings.", max_visits=3] + implement [label="Implement", prompt="Read the plan file referenced in the goal and implement every step. Make all the code changes described in the plan."] + simplify [label="Simplify", prompt="@prompts/simplify.md"] + verify [label="Verify", shape=parallelogram, script="cargo clippy -- -D warnings 2>&1 && cargo test 2>&1", goal_gate=true, retry_target="fixup"] + fixup [label="Fixup", prompt="The verify step failed. Read the build output from context and fix all clippy lint warnings and test failures.", max_visits=3] + + start -> toolchain + toolchain -> preflight_compile [condition="outcome=success"] + toolchain -> exit + preflight_compile -> preflight_lint [condition="outcome=success"] + preflight_compile -> exit + preflight_lint -> implement [condition="outcome=success"] + preflight_lint -> fix_lints + fix_lints -> preflight_lint + implement -> simplify -> verify + verify -> exit [condition="outcome=success"] + verify -> fixup + fixup -> verify +} diff --git a/manifest.json b/manifest.json new file mode 100644 index 000000000..de783ade9 --- /dev/null +++ b/manifest.json @@ -0,0 +1,12 @@ +{ + "run_id": "01KKS6XZ71N7148WNFMPME6ZSS", + "workflow_name": "ImplementAndSimplify", + "goal": "# Plan: Add `prevent_idle_sleep` to fabro via `fabro-beastie`\n\n## Context\n\nLong-running `fabro run` and `fabro exec` commands can be killed by OS idle sleep. We want a compile-time Cargo feature `sleep_inhibitor` on `fabro-cli` (disabled by default) that, when compiled in, reads a `prevent_idle_sleep` flag from `cli.toml` to prevent idle system sleep while fabro is working. Named after Beastie Boys — No Sleep Till Brooklyn.\n\n## TDD Approach\n\nRed-green for each step: write a failing test first, then make it pass, then move to the next piece.\n\n## Steps\n\n### Step 1: Create `lib/crates/fabro-beastie/` crate\n\n#### 1a. Dummy backend + public API (red-green)\n\nCreate crate with `Cargo.toml`, `src/lib.rs`, `src/dummy.rs`.\n\n**Test first (red):** unit test that `guard(true)` returns `Some` and `guard(false)` returns `None`.\n\n**`Cargo.toml`:**\n```toml\n[package]\nname = \"fabro-beastie\"\nedition.workspace = true\nversion.workspace = true\nlicense.workspace = true\ndescription = \"Cross-platform idle sleep prevention (No Sleep Till Brooklyn)\"\n\n[lib]\ndoctest = false\n\n[dependencies]\ntracing.workspace = true\n\n[target.'cfg(target_os = \"macos\")'.dependencies]\ncore-foundation = \"0.9\"\n\n[target.'cfg(target_os = \"linux\")'.dependencies]\nlibc.workspace = true\n```\n\n**Public API (`src/lib.rs`):**\n```rust\npub fn guard(enabled: bool) -> Option { ... }\n```\n`SleepInhibitorGuard` acquires on creation, releases on `Drop`.\n\nPlatform dispatch via `cfg(target_os)` to `macos`, `linux`, or `dummy` modules.\n\n**Green:** implement with dummy backend first so tests pass on all platforms.\n\nAdd to workspace `Cargo.toml` members list.\n\n#### 1b. macOS backend (red-green)\n\nCreate `src/macos.rs` + `src/iokit_bindings.rs`.\n\n**Test (red):** `guard(true)` returns `Some`, drop doesn't panic. (Same logical test as 1a, but now exercises real IOKit path on macOS.)\n\n**Green:** IOKit `IOPMAssertionCreateWithName(\"PreventUserIdleSystemSleep\")` on acquire, `IOPMAssertionRelease` on drop. Idempotent acquire (early return if already held). Warn on failure, don't panic.\n\n#### 1c. Linux backend (red-green)\n\nCreate `src/linux.rs`.\n\n**Test (red):** same pattern — create guard, drop without panic.\n\n**Green:** Spawn `systemd-inhibit --what=idle --mode=block` (fallback `gnome-session-inhibit`). Kill child on drop. Use `PR_SET_PDEATHSIG` for safety.\n\n### Step 2: Config — add `prevent_idle_sleep` to `CliConfig`\n\n**File:** `lib/crates/fabro-config/src/cli.rs`\n\n**Test (red):** parse `prevent_idle_sleep = true` from TOML, assert field is `true`. Parse empty TOML, assert field is `false`.\n\n**Green:** Add `#[serde(default)] pub prevent_idle_sleep: bool` to `CliConfig`.\n\n### Step 3: Wire into `fabro-cli` behind `sleep_inhibitor` feature\n\n**Files:**\n- `lib/crates/fabro-cli/Cargo.toml` — add feature `sleep_inhibitor = [\"dep:fabro-beastie\"]` and optional dep\n- `lib/crates/fabro-cli/src/main.rs` — guard both `fabro run` and `fabro exec` paths\n\n**`fabro exec` path (~line 437-496):**\n```rust\n#[cfg(feature = \"sleep_inhibitor\")]\nlet _sleep_guard = fabro_beastie::guard(cli_config.prevent_idle_sleep);\n```\nPlace before the `run_with_args` / `run_with_args_and_client` calls.\n\n**`fabro run` path (~line 498-517):**\nPass `cli_config.prevent_idle_sleep` to `run_command`. Inside `run_command` (~line 1184):\n```rust\n#[cfg(feature = \"sleep_inhibitor\")]\nlet _sleep_guard = fabro_beastie::guard(prevent_idle_sleep);\n```\n\nFor the `run` path, `fabro-workflows` also needs the optional dep:\n- `lib/crates/fabro-workflows/Cargo.toml` — add `sleep_inhibitor = [\"dep:fabro-beastie\"]` feature + optional dep\n- `lib/crates/fabro-cli/Cargo.toml` — update `sleep_inhibitor` feature to forward: `sleep_inhibitor = [\"dep:fabro-beastie\", \"fabro-workflows/sleep_inhibitor\"]`\n\n## Files to create/modify\n\n| File | Action |\n|------|--------|\n| `lib/crates/fabro-beastie/Cargo.toml` | Create |\n| `lib/crates/fabro-beastie/src/lib.rs` | Create |\n| `lib/crates/fabro-beastie/src/macos.rs` | Create |\n| `lib/crates/fabro-beastie/src/iokit_bindings.rs` | Create |\n| `lib/crates/fabro-beastie/src/linux.rs` | Create |\n| `lib/crates/fabro-beastie/src/dummy.rs` | Create |\n| `Cargo.toml` (workspace root) | Add member |\n| `lib/crates/fabro-config/src/cli.rs` | Add field + test |\n| `lib/crates/fabro-cli/Cargo.toml` | Add feature + optional dep |\n| `lib/crates/fabro-cli/src/main.rs` | `cfg`-guarded guards for exec |\n| `lib/crates/fabro-workflows/Cargo.toml` | Add feature + optional dep |\n| `lib/crates/fabro-workflows/src/cli/run.rs` | Accept flag, `cfg`-guarded guard |\n\n## Verification\n\n1. `cargo test -p fabro-beastie` — unit tests pass\n2. `cargo test -p fabro-config` — config parsing tests pass\n3. `cargo build --workspace` — compiles without the feature (no fabro-beastie pulled in)\n4. `cargo build --workspace --features fabro-cli/sleep_inhibitor` — compiles with the feature\n5. `cargo clippy --workspace -- -D warnings` + `cargo fmt --check --all`\n6. Manual: enable feature, set `prevent_idle_sleep = true` in `~/.fabro/cli.toml`, run `fabro exec`, confirm machine stays awake\n", + "start_time": "2026-03-15T16:58:13.525467Z", + "node_count": 10, + "edge_count": 13, + "run_branch": "fabro/run/01KKS6XZ71N7148WNFMPME6ZSS", + "base_sha": "891a6db29bf35007d664b08e511dc52fc62fa879", + "base_branch": "main", + "workflow_slug": "implement" +} \ No newline at end of file diff --git a/sandbox.json b/sandbox.json new file mode 100644 index 000000000..db027809d --- /dev/null +++ b/sandbox.json @@ -0,0 +1,5 @@ +{ + "provider": "daytona", + "working_directory": "/home/daytona/workspace", + "identifier": "fabro-01KKS6XZ71N7148WNFMPME6ZSS" +} \ No newline at end of file