create-lathe 0.0.0-stage → 0.4.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 (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +168 -2
  3. package/bin/create-lathe.js +88 -0
  4. package/dist/framework.lock +115 -0
  5. package/dist/package/crates/instrument/Cargo.lock +415 -0
  6. package/dist/package/crates/instrument/Cargo.toml +27 -0
  7. package/dist/package/crates/instrument/examples/instrument.rs +73 -0
  8. package/dist/package/crates/instrument/src/client.rs +128 -0
  9. package/dist/package/crates/instrument/src/lib.rs +32 -0
  10. package/dist/package/crates/instrument/src/logging.rs +109 -0
  11. package/dist/package/crates/instrument/src/protocol.rs +49 -0
  12. package/dist/package/crates/instrument/src/registry.rs +166 -0
  13. package/dist/package/crates/instrument/src/selftest.rs +375 -0
  14. package/dist/package/crates/instrument/src/server.rs +363 -0
  15. package/dist/package/crates/instrument/tests/command_log.rs +60 -0
  16. package/dist/package/crates/instrument/tests/erreurs.rs +167 -0
  17. package/dist/package/crates/instrument/tests/round_trip.rs +230 -0
  18. package/dist/package/crates/instrument/tests/selftest_fail.rs +25 -0
  19. package/dist/package/crates/instrument/tests/selftest_pass.rs +24 -0
  20. package/dist/package/crates/instrument/tests/selftest_temps.rs +43 -0
  21. package/dist/package/crates/instrument/tests/support/mod.rs +58 -0
  22. package/dist/package/pi/context/journal-de-lot.md +24 -0
  23. package/dist/package/pi/context/tech-skill.md +19 -0
  24. package/dist/package/pi/context/ticket-closed.md +18 -0
  25. package/dist/package/scripts/framework.py +1384 -0
  26. package/dist/package/scripts/gates.py +1158 -0
  27. package/dist/package/scripts/setup.py +251 -0
  28. package/dist/package/skills/bootstrap/SKILL.md +110 -0
  29. package/dist/package/skills/documentation/SKILL.md +110 -0
  30. package/dist/package/skills/documentation/references/agents-md.md +70 -0
  31. package/dist/package/skills/documentation/references/corpus.md +112 -0
  32. package/dist/package/skills/journal/SKILL.md +81 -0
  33. package/dist/package/skills/journal/references/entry.md +172 -0
  34. package/dist/package/skills/lathe/SKILL.md +185 -0
  35. package/dist/package/skills/lathe/evals/routing.md +231 -0
  36. package/dist/package/skills/lathe/references/install.md +161 -0
  37. package/dist/package/skills/lathe/references/invariants.md +31 -0
  38. package/dist/package/skills/mutants/SKILL.md +88 -0
  39. package/dist/package/skills/mutants/references/cargo-mutants.md +176 -0
  40. package/dist/package/skills/mutants/references/triage.md +88 -0
  41. package/dist/package/skills/optimize/SKILL.md +87 -0
  42. package/dist/package/skills/optimize/references/codspeed.md +126 -0
  43. package/dist/package/skills/probe/SKILL.md +82 -0
  44. package/dist/package/skills/probe/references/wait-and-read.md +53 -0
  45. package/dist/package/skills/replicate-ui/SKILL.md +64 -0
  46. package/dist/package/skills/rust/SKILL.md +147 -0
  47. package/dist/package/skills/rust/references/errors.md +63 -0
  48. package/dist/package/skills/rust/references/unsafe.md +65 -0
  49. package/dist/package/skills/scaffold/SKILL.md +78 -0
  50. package/dist/package/skills/scaffold/profiles/rust-cli/.cargo/config.toml +2 -0
  51. package/dist/package/skills/scaffold/profiles/rust-cli/AGENTS.md +22 -0
  52. package/dist/package/skills/scaffold/profiles/rust-cli/Cargo.lock +7 -0
  53. package/dist/package/skills/scaffold/profiles/rust-cli/Cargo.toml +17 -0
  54. package/dist/package/skills/scaffold/profiles/rust-cli/README.md +15 -0
  55. package/dist/package/skills/scaffold/profiles/rust-cli/deny.toml +14 -0
  56. package/dist/package/skills/scaffold/profiles/rust-cli/rustfmt.toml +2 -0
  57. package/dist/package/skills/scaffold/profiles/rust-cli/src/main.rs +38 -0
  58. package/dist/package/skills/scaffold/profiles/rust-cli/tests/cli.rs +27 -0
  59. package/dist/package/skills/scaffold/profiles/rust-library/.cargo/config.toml +2 -0
  60. package/dist/package/skills/scaffold/profiles/rust-library/AGENTS.md +21 -0
  61. package/dist/package/skills/scaffold/profiles/rust-library/Cargo.lock +7 -0
  62. package/dist/package/skills/scaffold/profiles/rust-library/Cargo.toml +18 -0
  63. package/dist/package/skills/scaffold/profiles/rust-library/README.md +15 -0
  64. package/dist/package/skills/scaffold/profiles/rust-library/deny.toml +14 -0
  65. package/dist/package/skills/scaffold/profiles/rust-library/rustfmt.toml +2 -0
  66. package/dist/package/skills/scaffold/profiles/rust-library/src/lib.rs +25 -0
  67. package/dist/package/skills/scaffold/profiles/rust-native-desktop/.cargo/config.toml +2 -0
  68. package/dist/package/skills/scaffold/profiles/rust-native-desktop/AGENTS.md +23 -0
  69. package/dist/package/skills/scaffold/profiles/rust-native-desktop/Cargo.lock +9252 -0
  70. package/dist/package/skills/scaffold/profiles/rust-native-desktop/Cargo.toml +24 -0
  71. package/dist/package/skills/scaffold/profiles/rust-native-desktop/README.md +15 -0
  72. package/dist/package/skills/scaffold/profiles/rust-native-desktop/deny.toml +35 -0
  73. package/dist/package/skills/scaffold/profiles/rust-native-desktop/rustfmt.toml +2 -0
  74. package/dist/package/skills/scaffold/profiles/rust-native-desktop/src/main.rs +74 -0
  75. package/dist/package/skills/scaffold/references/gates.md +29 -0
  76. package/dist/package/skills/scaffold/references/profiles.md +36 -0
  77. package/dist/package/skills/update/SKILL.md +115 -0
  78. package/dist/package/skills/verify-visual/SKILL.md +82 -0
  79. package/dist/package/skills/verify-visual/references/baseline.md +46 -0
  80. package/dist/package/skills/visual-loop/SKILL.md +72 -0
  81. package/dist/package/workflows/batch-to-review.md +41 -0
  82. package/dist/package/workflows/framework-improvement.md +38 -0
  83. package/dist/package/workflows/hard-bug.md +37 -0
  84. package/dist/package/workflows/new-rust-cli.md +33 -0
  85. package/dist/package/workflows/new-rust-desktop-app.md +41 -0
  86. package/dist/package/workflows/new-rust-library.md +34 -0
  87. package/dist/package/workflows/performance-work.md +41 -0
  88. package/dist/package/workflows/ui-change.md +40 -0
  89. package/package.json +33 -4
@@ -0,0 +1,37 @@
1
+ # Hard bug
2
+
3
+ **Trigger:** a reported failure with no reproduction — intermittent, environment-dependent, or
4
+ described only by its symptom ("it loses the row", "it hangs after a paste").
5
+
6
+ **Preconditions:** the code exists and builds, so lathe rung 4 is behind you. A profile is not
7
+ needed to diagnose: `diagnosing-bugs` and `tdd` read code, not screens. Only `probe` needs it.
8
+ No fix is written in this parcours until a failing check exists.
9
+
10
+ **Steps**
11
+
12
+ 1. `diagnosing-bugs` — the diagnosis loop: reduce the report to a minimal reproduction and name the
13
+ cause. Its "Done when" is a reproduction, not a theory.
14
+ 2. `probe` — desktop profiles only: drive the running app and read a state back (a label, a bounds
15
+ rectangle, a store row) when the failure only appears once launched.
16
+ 3. `tdd` — turn the reproduction into a red test in the repository, then green.
17
+ 4. `implement` — the fix, one ticket, `- [ ]` criteria as the checklist.
18
+ 5. `mutants` — every ticket checked and `.lathe/mutants/verdict` does not name `HEAD` (rung 8)
19
+ 6. `code-review` — tree dirty, every ticket checked (rung 9).
20
+ 7. `retro` — every ticket checked and the tree clean (rung 12): what let the bug through.
21
+
22
+ **Gates**
23
+
24
+ - `cargo test <test_name>` — the reproduction fails before the fix and passes after; both runs are
25
+ quoted, not summarised.
26
+ - `python3 .agents/scripts/gates.py fast --project <dir>` — `fmt`, `clippy`, `doctests`.
27
+ - `python3 .agents/scripts/gates.py verify --project <dir>` — the whole suite, so the fix has not moved the
28
+ failure elsewhere.
29
+ - `python3 .agents/scripts/gates.py mutants --project <dir>` — when the bug was a missing branch: a
30
+ surviving mutant on the fixed line is the same bug. It needs a recorded base, so it is a batch gate,
31
+ not a per-ticket one; run `--start` first if this path is taken alone.
32
+
33
+ **Stop condition:** a test committed in the same change fails on the pre-fix tree and passes on the
34
+ post-fix tree, `gates.py verify` exits 0, and `diagnosing-bugs` named a cause rather than a symptom.
35
+
36
+ **Optional:** `research` when the cause is suspected in a dependency or the standard library;
37
+ `prototype` when the fix is a design question; `grill-with-docs` when the fix changes a domain term.
@@ -0,0 +1,33 @@
1
+ # New Rust CLI
2
+
3
+ **Trigger:** the user wants a new command-line tool — one binary, arguments, exit codes.
4
+
5
+ **Preconditions:** an empty or near-empty target directory; no `Cargo.toml` in it (lathe rung 4).
6
+
7
+ **Steps**
8
+
9
+ 1. `grill-with-docs` — the command surface is a design decision; it is settled here, with a glossary.
10
+ 2. `to-spec` — `.scratch/<feature>/spec.md` records the arguments, the exit codes and the output.
11
+ 3. `to-tickets` — `.scratch/<feature>/issues/*.md`, one file per flag group or behaviour.
12
+ 4. `scaffold` — copy `profiles/rust-cli/` byte for byte: `Cargo.toml`, `src/main.rs`,
13
+ `tests/cli.rs`, `deny.toml`, `rustfmt.toml`, `AGENTS.md`. It must say `Profile: rust-cli`.
14
+ 5. `rust` — settle error types, `main`'s exit path and ownership before writing bodies. Not on the
15
+ lathe ladder: call it directly, after the scaffold and before `implement`.
16
+ 6. `implement` — one ticket at a time, `- [ ]` criteria as the checklist.
17
+ 7. `mutants` — every ticket checked and `.lathe/mutants/verdict` does not name `HEAD` (rung 8)
18
+ 8. `code-review` — every ticket checked, tree dirty (rung 9).
19
+ 9. `retro` — every ticket checked, tree clean (rung 12).
20
+
21
+ **Gates**
22
+
23
+ - `python3 .agents/scripts/gates.py fast --project <dir>` — `fmt`, `clippy`, `doctests`.
24
+ - `python3 .agents/scripts/gates.py verify --project <dir>` — `nextest` runs `tests/cli.rs` against the real
25
+ binary, plus `doc`. `deny` and `semver-checks` are skipped: binary profile.
26
+ - `cargo test` — the same integration tests when nextest is not installed.
27
+ - `python3 .agents/scripts/gates.py mutants --project <dir>` — `mutants`, offline, never in a commit.
28
+
29
+ **Stop condition:** `gates.py verify` exits 0, every ticket criterion is `- [x]`, and each documented
30
+ exit code appears in a test rather than in a paragraph.
31
+
32
+ **Optional:** `research` for an existing crate that already parses this surface; `tdd` when the
33
+ ticket is one behaviour; `probe` does not apply — it drives a desktop window, not a binary.
@@ -0,0 +1,41 @@
1
+ # New Rust desktop app
2
+
3
+ **Trigger:** the user wants a native windowed application, not a library and not a CLI.
4
+
5
+ **Preconditions:** an empty or near-empty target directory; no `Cargo.toml` in it (lathe rung 4).
6
+ `gpui-kit` is the toolkit assumed by the `rust-native-desktop` profile.
7
+
8
+ **Steps**
9
+
10
+ 1. `grill-with-docs` — what the window shows, what a "screen" means here; writes the glossary.
11
+ 2. `to-spec` — `.scratch/<feature>/spec.md`.
12
+ 3. `to-tickets` — one tracer bullet per screen or per interaction.
13
+ 4. `scaffold` — copy `profiles/rust-native-desktop/`; `AGENTS.md` must say
14
+ `Profile: rust-native-desktop`.
15
+ 5. `rust` — app-state ownership and error types before any view is written; not on Lathe
16
+ ladder, so call it directly.
17
+ 6. `[missing: gpui-kit-design-guides]` — Lathe cites it as an upstream skill and it is installed
18
+ nowhere. It must deliver the normative rules for spacing, hierarchy, component states and motion
19
+ before a screen is laid out; without it a layout decision has no authority behind it.
20
+ 7. `visual-loop` — two or more unblocked tickets (rung 5): one at a time, each proven visually.
21
+ 8. `implement` — otherwise (rung 6), one ticket at a time.
22
+ 9. `verify-visual` — a ticket fully checked with no capture (rung 7): `docs/shots/<ticket>-<variant>.png`
23
+ plus the layout dump.
24
+ 10. `mutants` — every ticket checked and `.lathe/mutants/verdict` does not name `HEAD` (rung 8)
25
+ 11. `code-review` — every ticket checked, tree dirty (rung 9).
26
+ 12. `retro` — every ticket checked, tree clean (rung 12).
27
+
28
+ **Gates**
29
+
30
+ - `python3 .agents/scripts/gates.py fast --project <dir>` — `fmt`, `clippy`, `doctests`. Green on this
31
+ profile on macOS arm64.
32
+ - `python3 .agents/scripts/gates.py verify --project <dir>` — `nextest` runs the headless window test.
33
+ - `python3 .agents/scripts/gates.py mutants --project <dir>` — `mutants`, offline.
34
+ - The capture itself is the gate of `verify-visual`; it has no command-line equivalent.
35
+
36
+ **Stop condition:** `gates.py verify` exits 0, every ticket is `- [x]`, and `docs/shots/` holds one
37
+ PNG and one layout dump per requested variant.
38
+
39
+ **Optional:** `replicate-ui` when captures of another app are the reference; `probe` when the
40
+ question is what the app did, not what it looks like; `diagnosing-bugs` behind a difference that
41
+ `verify-visual` measured but cannot explain.
@@ -0,0 +1,34 @@
1
+ # New Rust library
2
+
3
+ **Trigger:** the user wants a new Rust library — a published API and no binary.
4
+
5
+ **Preconditions:** an empty or near-empty target directory; no `Cargo.toml` in it (lathe rung 4).
6
+ Rungs 1 to 3 do not need a profile, so this parcours starts before one exists.
7
+
8
+ **Steps**
9
+
10
+ 1. `grill-with-docs` — sharpen the idea; writes `docs/GLOSSARY.md` and an ADR per decision.
11
+ 2. `to-spec` — synthesis of that conversation into `.scratch/<feature>/spec.md`. No new interview.
12
+ 3. `to-tickets` — `.scratch/<feature>/issues/*.md`, one tracer bullet per file, blocking edges as text.
13
+ 4. `scaffold` — copy `profiles/rust-library/` byte for byte; `AGENTS.md` must then say
14
+ `Profile: rust-library`.
15
+ 5. `rust` — decide the public API, ownership and error types before any body is written.
16
+ Lathe never selects this step: call it directly, after the scaffold and before `implement`.
17
+ 6. `implement` — one ticket at a time, driven by its `- [ ]` criteria.
18
+ 7. `mutants` — every ticket checked and `.lathe/mutants/verdict` does not name `HEAD` (rung 8)
19
+ 8. `code-review` — only when every ticket is checked and the tree is dirty (rung 9).
20
+ 9. `retro` — when every ticket is checked and the tree is clean (rung 12).
21
+
22
+ **Gates**
23
+
24
+ - `python3 .agents/scripts/gates.py fast --project <dir>` — `fmt`, `clippy`, `doctests`. After each edit loop.
25
+ - `python3 .agents/scripts/gates.py verify --project <dir>` — adds `nextest`, `doc`, and for this profile
26
+ `deny` and `semver-checks`. Before each commit: the API is the product, so a doc warning counts.
27
+ - `python3 .agents/scripts/gates.py mutants --project <dir>` — `mutants`, offline, never in a commit.
28
+
29
+ **Stop condition:** `gates.py verify` exits 0 on the final tree, every ticket criterion is `- [x]`,
30
+ and `code-review` has reported on both axes.
31
+
32
+ **Optional:** `research` when prior art may already solve the problem; `prototype` when a state
33
+ model needs evidence before it is committed to; `tdd` instead of `implement` when the ticket is
34
+ itself a behaviour to pin down.
@@ -0,0 +1,41 @@
1
+ # Performance work
2
+
3
+ ## Trigger
4
+ the user says "it is slow", asks to reduce latency, CPU or allocations, a figure regressed,
5
+ or asks where the time actually goes.
6
+
7
+ ## Preconditions
8
+ the code exists; a benchmark suite can be built and run twice on the same machine with
9
+ the same toolchain; `codspeed status` reports an authenticated session. No number is compared across
10
+ machines, toolchains or modes.
11
+
12
+ ## Steps
13
+
14
+ 1. `optimize` — the step that owns this workflow. It checks what can be measured here, refuses to proceed
15
+ on a guess, and runs the loop: harness, baseline, profile, one change, gates, compare, decide.
16
+ 2. `codspeed-setup-harness` (upstream) — when there is no `[[bench]]` target yet. Divan is the recommended
17
+ harness; the compat crate is renamed over it, so no `use` line changes.
18
+ 3. `codspeed-write-benchmarks` (upstream) — validates the harness before any number is trusted: only the
19
+ code under test is measured, the result is kept alive, input sizes are realistic.
20
+ 4. `codspeed-optimize` (upstream) — the measurement loop itself: flamegraph, one change at a time,
21
+ `compare_runs`, stop at diminishing returns.
22
+ 5. `tdd` — when the bottleneck's correct behaviour is not pinned: express it as a test first, so the
23
+ optimisation cannot silently change what the code does.
24
+ 6. `code-review` — once the numbers are in and every ticket is checked.
25
+
26
+ ## Gates
27
+
28
+ - `python3 .agents/scripts/gates.py fast --project <dir>` — after **each** change.
29
+ - `python3 .agents/scripts/gates.py verify --project <dir>` — before the review.
30
+ - `mutants` — the batch's campaign still runs: a hot path rewritten for speed is exactly where an
31
+ untested branch appears, and a speed-up bought with deleted tests is a regression.
32
+
33
+ ## Evidence
34
+
35
+ `.lathe/perf/<lot>.md`: the harness command, the mode, the baseline and final run ids, one line per
36
+ change with its verdict. A number cited in a journal, a commit or a review names its run id. Walltime
37
+ numbers measured locally are labelled `local-walltime` and never compared to CodSpeed runs.
38
+
39
+ ## Stop condition
40
+ the last change's verdict is written, every kept change is its own commit with its
41
+ gain, `.lathe/perf/<lot>.md` is complete, and `gates.py verify` exits 0.
@@ -0,0 +1,40 @@
1
+ # UI change
2
+
3
+ **Trigger:** a change to what a desktop screen looks like — layout, spacing, colours, component
4
+ state — or a request to make a screen look like another application.
5
+
6
+ **Preconditions:** `Profile: rust-native-desktop` in `AGENTS.md` and a `gpui-kit` dependency. In a
7
+ `rust-library` or `rust-cli` profile this parcours does not exist: Lathe says so in one
8
+ sentence and routes by the ladder as if the request had not been made.
9
+
10
+ **Steps**
11
+
12
+ 1. `[missing: gpui-kit-design-guides]` — Lathe cites it as an upstream skill; it is installed
13
+ nowhere. It must give the normative rules for hierarchy, spacing, colour, states, overlays and
14
+ motion. Without it, "how should this look" is answered by taste, and `code-review` has nothing
15
+ to cite.
16
+ 2. `replicate-ui` — captures of another app are the reference: rebuild one screen from them.
17
+ 3. `implement` — the change itself, one ticket, `- [ ]` criteria as the checklist; `visual-loop`
18
+ instead when two or more unblocked tickets exist (rung 5).
19
+ 4. `probe` — when the question is what the app did rather than what it looks like: read a label, a
20
+ bounds rectangle or a store row back from the running app.
21
+ 5. `verify-visual` — a ticket fully checked with no capture (rung 7): one PNG and one layout dump per
22
+ variant under `docs/shots/`, compared with the versioned baseline.
23
+ 6. `mutants` — every ticket checked and `.lathe/mutants/verdict` does not name `HEAD` (rung 8)
24
+ 7. `code-review` — tree dirty, every ticket checked (rung 9).
25
+
26
+ **Gates**
27
+
28
+ - `python3 .agents/scripts/gates.py fast --project <dir>` — `fmt`, `clippy`, `doctests`.
29
+ - `python3 .agents/scripts/gates.py verify --project <dir>` — `nextest` runs the headless window test.
30
+ - The capture comparison of `verify-visual` is the gate of this parcours, and it has no
31
+ command-line equivalent. A difference leaves a `.new` file; only a human accepts it as a baseline.
32
+ It renders on macOS and Linux only: no capture is ever compared on Windows.
33
+ - `python3 .agents/scripts/gates.py mutants --project <dir>` — `mutants`, offline, never in a commit.
34
+
35
+ **Stop condition:** `docs/shots/<ticket>-<variant>.png` exists for every requested variant and its
36
+ difference is under the threshold, or a `.new` file is left awaiting a human acceptance, and
37
+ `gates.py verify` exits 0.
38
+
39
+ **Optional:** `diagnosing-bugs` when a measured difference has a cause that is not the change;
40
+ `probe` before a capture when what failed was an interaction, not a layout.
package/package.json CHANGED
@@ -1,6 +1,35 @@
1
1
  {
2
2
  "name": "create-lathe",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.1",
4
+ "description": "Install Lathe \u2014 an agent-first engineering workflow for Rust \u2014 into one project, in one command.",
5
+ "bin": {
6
+ "create-lathe": "bin/create-lathe.js"
7
+ },
8
+ "files": [
9
+ "bin",
10
+ "dist",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "scripts": {
15
+ "prepack": "python3 ../scripts/build_npm.py --quiet"
16
+ },
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "keywords": [
21
+ "rust",
22
+ "agent",
23
+ "workflow",
24
+ "skills",
25
+ "pi",
26
+ "mutation-testing",
27
+ "coding-agent",
28
+ "tdd"
29
+ ],
30
+ "author": "Theophile Baudouin",
31
+ "license": "MIT",
32
+ "publishConfig": {
33
+ "access": "public"
34
+ }
35
+ }