@mousedev/harness 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +43 -0
  3. package/dist/mouse.mjs +1688 -0
  4. package/package.json +44 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pete McGrath and Mouse contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # @mousedev/harness
2
+
3
+ Mouse runs OpenCode in your repo and does not stop until the repo's own checks pass. This package is the `mouse` command: it loads `.mouse/policy.json`, detects the repository's checks, starts an OpenCode session with Mouse's configuration, and drives the completion loop from `@mousedev/harness-core` until the run is satisfied, stalled, out of budget, blocked, or aborted. The exit code encodes the outcome and a JSONL trace is written under `~/.mouse/runs/`. Nothing is written into the repository, and with the default `local` profile nothing is written under `~/.config/opencode` either.
4
+
5
+ The package ships as a single bundled file (`dist/mouse.mjs`, built with `pnpm bundle`) that runs anywhere Node 22 does; the benchmark adapters upload that same file into task containers. OpenCode itself is installed separately (`npm i -g opencode-ai`; its postinstall links the binary, so do not pass --ignore-scripts to it); 1.18.27 is the benchmarked version and 1.14.22 is also exercised in CI. Built on OpenCode; Mouse is an independent project and is not affiliated with or endorsed by the OpenCode project or Anomaly.
6
+
7
+ ## Install and run
8
+
9
+ ```bash
10
+ npm i -g --ignore-scripts @mousedev/harness
11
+ npm i -g opencode-ai@1.18.27
12
+ cd my-repo
13
+ mouse run "Add rate limiting to /api/upload and cover it with tests" --model provider/model
14
+ ```
15
+
16
+ ## Commands
17
+
18
+ ```
19
+ mouse run "task" | --instruction-file F --model provider/model [--workspace DIR]
20
+ [--profile local|bench] [--yolo] [--format text|json] [--log FILE] [--session ID]
21
+ [--max-wall-sec N] [--max-steps N] [--non-progress-rounds N] [--idle-timeout-sec N]
22
+ [--config-home DIR] [--opencode-bin PATH]
23
+ mouse config [--profile local|bench] [--model M] [--out DIR]
24
+ mouse init [--workspace DIR]
25
+ mouse doctor [--model M] [--workspace DIR] [--strict-compat]
26
+ mouse --version
27
+ ```
28
+
29
+ | Command | What it does |
30
+ |---|---|
31
+ | `run` | One OpenCode session through the completion loop. `--format text` (default with a terminal) prints Mouse's summary lines and the final reply; `--format json` (default without one) passes OpenCode's event stream through on stdout unchanged. `--yolo` passes `--dangerously-skip-permissions` to OpenCode and is implied, with a warning, when there is no terminal. |
32
+ | `config` | Print the `local` OpenCode config as JSON, or write the `bench` `opencode.json` to `--out` (default: the config home) and print the `build` agent prompt. |
33
+ | `init` | Write a `.mouse/policy.json` skeleton with the defaults spelled out and two example `bash` denies. Never overwrites. |
34
+ | `doctor` | Report the Mouse version, the `opencode` binary and version, the compat verdict, the provider key for `--model`, the git state, the detected or declared checks, and the trace directory. Exits 1 if `opencode` is missing; `--strict-compat` also exits 1 on an untested version. |
35
+ | `--version` | `mouse/<version> opencode/<version or unavailable>`. |
36
+
37
+ Exit codes: 0 satisfied, 1 error, 2 usage, 3 budget (stalled, wall clock, steps), 4 blocked, 130 aborted. In a repository with no detectable or declared checks, exit 0 means the workspace changed and the model reported every requirement done; the trace's `checksRun` field records that no check backed it.
38
+
39
+ Environment: `MOUSE_MODEL`, `MOUSE_OPENCODE_BIN`, `MOUSE_HARNESS_LOG`, `MOUSE_MAX_WALL_SEC`, `MOUSE_HOME`, and the legacy `MOUSE_TOOL_OUTPUT_PRUNE`. Full reference in [docs/config.md](../../docs/config.md); the loop in [docs/loop.md](../../docs/loop.md); the trace in [docs/trace.md](../../docs/trace.md).
40
+
41
+ Interactive permission prompts, `--auto`, `mouse serve`, and `mouse tui` are not in 0.1; see the roadmap in the [repository README](../../README.md#roadmap).
42
+
43
+ MIT.