branchout 0.1.0

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 (42) hide show
  1. checksums.yaml +7 -0
  2. data/AGENTS.md +38 -0
  3. data/LICENSE +21 -0
  4. data/README.ja.md +903 -0
  5. data/README.md +586 -0
  6. data/bin/branchout +15 -0
  7. data/examples/arithmetic.rb +24 -0
  8. data/examples/hidden_bug.rb +17 -0
  9. data/examples/inputs/arithmetic.json +10 -0
  10. data/examples/inputs/arithmetic.seed.json +5 -0
  11. data/examples/inputs/hidden_bug.json +9 -0
  12. data/examples/inputs/hidden_bug.seed.json +5 -0
  13. data/examples/inputs/magic_value.json +7 -0
  14. data/examples/inputs/magic_value.seed.json +5 -0
  15. data/examples/inputs/version_parser.json +11 -0
  16. data/examples/inputs/version_parser.seed.json +5 -0
  17. data/examples/magic_value.rb +11 -0
  18. data/examples/version_parser.rb +29 -0
  19. data/lib/branchout/canon.rb +59 -0
  20. data/lib/branchout/cli.rb +302 -0
  21. data/lib/branchout/coverage.rb +9 -0
  22. data/lib/branchout/coverage_session.rb +49 -0
  23. data/lib/branchout/emitters/minitest.rb +92 -0
  24. data/lib/branchout/emitters/rspec.rb +532 -0
  25. data/lib/branchout/emitters/support.rb +1248 -0
  26. data/lib/branchout/emitters.rb +101 -0
  27. data/lib/branchout/engine.rb +303 -0
  28. data/lib/branchout/explore.rb +124 -0
  29. data/lib/branchout/input.rb +215 -0
  30. data/lib/branchout/input_file.rb +125 -0
  31. data/lib/branchout/mutator.rb +124 -0
  32. data/lib/branchout/prism_choice.rb +25 -0
  33. data/lib/branchout/report.rb +449 -0
  34. data/lib/branchout/rng.rb +31 -0
  35. data/lib/branchout/runner.rb +591 -0
  36. data/lib/branchout/sampler.rb +70 -0
  37. data/lib/branchout/target.rb +696 -0
  38. data/lib/branchout/version.rb +8 -0
  39. data/lib/branchout.rb +31 -0
  40. data/skills/branchout/SKILL.md +230 -0
  41. data/skills/branchout/inputs.example.json +10 -0
  42. metadata +114 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8562cdf0b59fc28be9b1c811b63727f18fab5b7d2bd54cd24825886ef359eefe
4
+ data.tar.gz: d31f8699dba5f5541b217e7a80a634d1b13980e95da99976e74fbefd48233dbf
5
+ SHA512:
6
+ metadata.gz: d258d697f2f20e02c160d6998c0f6ce8ee5221b0e2b4aeea89a74a3b6289fe3881d185c4be7f2b8a999a9ac0f0b10a83eb9eae45e9b8b89f4b3a8ac870e69d9d
7
+ data.tar.gz: 37c6415b5be529624d65a394d9a676b77ec74dcd5018f0ee6112e0ff6ebf1fdc66eee12df77c9605d5d8a179c9c0d12877fe712e65dde6de70f285a701b3f422
data/AGENTS.md ADDED
@@ -0,0 +1,38 @@
1
+ # Developing branchout
2
+
3
+ The usage loop for a coding agent that is driving branchout lives in [skills/branchout/SKILL.md](skills/branchout/SKILL.md). Copy or symlink that directory into the agent's skills folder when using the tool from another project (see the README). This file is for changing this repository.
4
+
5
+ ## Setup
6
+
7
+ Ruby 3.3 or newer. `explore` uses the standard library. Development gems are minitest, rspec, and hegeltest. hegeltest needs Ruby 3.4 or newer, so on Ruby 3.3 leave its group out:
8
+
9
+ ```sh
10
+ bundle install
11
+ BUNDLE_WITHOUT=property bundle install # Ruby 3.3
12
+ ```
13
+
14
+ ## Tests
15
+
16
+ ```sh
17
+ ruby test/run_all.rb
18
+ bundle exec rspec spec/generated
19
+ ```
20
+
21
+ In a checkout whose gems live only in the bundle, as in CI, run both under `bundle exec`. On Ruby 4.0 set `BUNDLE_VERSION=system` for `bundle install` and `bundle exec`. Otherwise bundler switches to the 2.6.9 that `Gemfile.lock` names, that bundler warns about Ruby 4.0's RubyGems constants in every Ruby the tests start, and the CLI tests that require an empty stderr fail. `.github/workflows/ci.yml` runs both on Ruby 3.3 (without the property group) and 4.0, and on 4.0 runs `CLITest` once more with `BRANCHOUT_TEST_SPAWN=1`.
22
+
23
+ `test/run_all.rb` loads `test/test_*.rb` and `test/generated/*_test.rb`. Coverage is process-global, so each CLI test runs branchout in a process of its own: `test/support/cli.rb` forks it from a server that loaded branchout before any test ran, which saves the Ruby and prism boot of each run. Where fork does not exist, or with `BRANCHOUT_TEST_SPAWN=1`, each run spawns `bin/branchout` instead. `test/test_properties.rb` holds the hegeltest properties of the pure parts and of report determinism. On Ruby 3.3 it reports one skip.
24
+
25
+ `test/generated/` and `spec/generated/` are checked-in characterization tests for `examples/`. Regenerate one by re-running `explore` with `--strategy inputs --random 0 --seed 1` and `--emit-tests` pointed at `test/generated/<name>_test.rb` (`--format minitest`) or `spec/generated/<name>_spec.rb` (`--format rspec`). `test/test_examples.rb` checks `reports/<name>.*`, `test/generated/`, and `spec/generated/` against a fresh run of each example. Regenerate them together when output changes.
26
+
27
+ `test/test_readme.rb` runs the `sh` blocks of the README's "Try it without an app" in one empty folder and compares each with the output block after it. It runs the Rails Quick start only when `BRANCHOUT_README_RAILS_APP` names a Rails app with RSpec, factory_bot, and the Quick start's `Loan#approve`, its gems installed and branchout not in its Gemfile: it copies the app, adds the Gemfile lines with this checkout as the gem's path, writes each spec file block when the steps reach it, and runs each `sh` block. The sample app the Quick start quotes holds `Borrower` and `Loan` models, a factory for each, `spec/rails_helper.rb`, and `spec/models/loan_spec.rb`, on activerecord, railties, sqlite3, factory_bot_rails, and rspec-rails. When the report or an emitted spec changes, rerun those steps and paste their output into both READMEs.
28
+
29
+ ## Invariants
30
+
31
+ - Do not add an LLM client, an API key, or an external command. The agent stays outside the process.
32
+ - The same inputs, flags, and CRuby must produce the same stdout. No timestamps. Paths are relative to the working directory.
33
+ - The tool does not rewrite an inputs file.
34
+ - Do not put secrets in inputs, fixtures, or reports.
35
+
36
+ ## Releasing
37
+
38
+ A release, a gem push, and a change of the repository's visibility are the owner's to run. A commit that changes `lib/branchout/version.rb` and lands on `main` starts `.github/workflows/release.yml`, and [docs/releasing.md](docs/releasing.md) has the steps. Every change that a gem user can notice adds a line under `## [Unreleased]` in `CHANGELOG.md`.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 meganemura
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.