@redue/cli 0.1.0-alpha.3 → 0.1.0-alpha.30
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.
- package/CHANGELOG.md +806 -0
- package/README.md +157 -99
- package/bin/redue.mjs +267 -61
- package/docs/README.md +3 -1
- package/docs/user/agents.md +333 -15
- package/docs/user/configuration.md +28 -2
- package/docs/user/direct-typescript.md +219 -0
- package/docs/user/getting-started.md +49 -7
- package/docs/user/json.md +4 -2
- package/docs/user/node-script.md +177 -0
- package/docs/user/npm-launcher-notice.md +42 -0
- package/docs/user/pilot.md +146 -0
- package/docs/user/sandbox.md +312 -0
- package/docs/user/shell.md +3 -3
- package/docs/user/supported-projects.md +69 -23
- package/docs/user/tests-direct.md +143 -0
- package/package.json +4 -3
- package/src/agent-integration.mjs +467 -0
- package/src/agent-policy.md +28 -0
- package/src/cached-state.mjs +24 -1
- package/src/claude-hook.mjs +616 -0
- package/src/cli.mjs +449 -54
- package/src/daemon.mjs +442 -93
- package/src/decision-profile.mjs +15 -1
- package/src/decision-validation.mjs +12 -1
- package/src/declared-plan.mjs +38 -6
- package/src/direct-run-certificate.mjs +254 -0
- package/src/direct-typescript-probe.mjs +27 -0
- package/src/direct-typescript.mjs +205 -0
- package/src/glob.mjs +8 -0
- package/src/history-worker.mjs +21 -13
- package/src/index.mjs +108 -21
- package/src/installed-inputs.mjs +7 -1
- package/src/installed-observation.mjs +23 -0
- package/src/landlock.py +527 -0
- package/src/linux-inotify.py +39 -10
- package/src/node-onboarding.mjs +203 -54
- package/src/node-script.mjs +406 -0
- package/src/npm-integrity.mjs +124 -0
- package/src/npm-typecheck-environment.mjs +36 -0
- package/src/npmrc.mjs +16 -0
- package/src/observation.mjs +34 -12
- package/src/path-identity.mjs +8 -0
- package/src/plan-worker.mjs +17 -17
- package/src/pnpm-inputs.mjs +122 -57
- package/src/pnpm-shim-templates.json +180 -0
- package/src/pnpm-shims.mjs +54 -0
- package/src/pnpm-typecheck-probe.mjs +11 -6
- package/src/presentation.mjs +13 -4
- package/src/probe-deadline.mjs +37 -0
- package/src/probe-result.mjs +7 -3
- package/src/project-location.mjs +34 -0
- package/src/python-onboarding.mjs +89 -0
- package/src/run-recorder.cjs +91 -0
- package/src/sandbox.mjs +653 -0
- package/src/setup.mjs +205 -0
- package/src/stats.mjs +72 -0
- package/src/test-direct.mjs +608 -0
- package/src/test-recorder.cjs +435 -0
- package/src/typescript-contract-probe.mjs +4 -187
- package/src/typescript-input-facts.mjs +92 -0
- package/src/typescript-invocation.mjs +92 -0
- package/src/typescript-list.mjs +118 -13
- package/src/typescript-qualification.mjs +29 -49
- package/src/workspace-manifests.mjs +24 -0
- package/src/yarn-workspace-inputs.mjs +3 -0
- package/src/yarn-workspace-typecheck-probe.mjs +2 -1
package/README.md
CHANGED
|
@@ -1,127 +1,185 @@
|
|
|
1
1
|
# REDUE
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[receipt-selection correction and interim guidance](docs/user/receipt-selection-notice.md).
|
|
3
|
+
**Know which checks still hold. Redo what's due.**
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
You or your coding agent ran the typecheck, the linter or the tests. Then the
|
|
6
|
+
code changed, or a new agent session started with no memory of it. REDUE
|
|
7
|
+
records each check's result with the exact inputs it ran on, and tells you and
|
|
8
|
+
your agent whether that result still applies to the code you have now, so a
|
|
9
|
+
check that still holds is not run again and one that is stale is.
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
conversation history. Which results can you still use?
|
|
11
|
+
## Quickstart (about 5 minutes)
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
You need macOS or Linux, Node 22 or 24, Git, Claude Code, and either a
|
|
14
|
+
JavaScript or TypeScript project with its dependencies installed
|
|
15
|
+
(`npm install`, `pnpm install` or `yarn`), or a Python project with a `.venv`
|
|
16
|
+
in its root (`uv sync`, or Poetry with in-project virtualenvs). On Linux, also
|
|
17
|
+
Python 3.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm install --global @redue/cli@alpha
|
|
21
|
+
cd your-project
|
|
22
|
+
redue setup claude
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`setup` shows what it will do and asks once (`--yes` skips the question). It
|
|
26
|
+
stops before writing anything if the dependencies are not installed. It:
|
|
27
|
+
|
|
28
|
+
- finds your typecheck, lint and test scripts and writes `redue.config.json`
|
|
29
|
+
(it never changes your scripts, source or dependencies). In a Python
|
|
30
|
+
project it finds these tools in `.venv/bin`, with the arguments your CI
|
|
31
|
+
workflows, Makefile, justfile, tox, nox or scripts give them: mypy,
|
|
32
|
+
pyright and ty (typecheck), ruff (lint) and pytest (test). It says which
|
|
33
|
+
checks it left out and why, and which it can only record, not reuse;
|
|
34
|
+
- connects Claude Code: a short section in `CLAUDE.md`, a skill, and two hooks
|
|
35
|
+
in `.claude/settings.local.json`;
|
|
36
|
+
- starts REDUE's file observer, waits while it indexes the project (a minute
|
|
37
|
+
or more in a large one), then runs each check that can qualify once, so
|
|
38
|
+
there is a first result to reuse, and prints one line per run (the run's
|
|
39
|
+
own output only when it fails);
|
|
40
|
+
- prints every file it writes. Running it again changes nothing.
|
|
41
|
+
|
|
42
|
+
Then start a new Claude Code session in the project and work as usual. When
|
|
43
|
+
the agent is about to rerun a check whose last pass still applies, the hook
|
|
44
|
+
skips it and tells the agent why. After an edit, the hook runs the check
|
|
45
|
+
through REDUE so the new result is recorded.
|
|
46
|
+
|
|
47
|
+
To look yourself:
|
|
14
48
|
|
|
15
49
|
```text
|
|
16
|
-
$ redue status
|
|
50
|
+
$ redue status
|
|
17
51
|
✓ typecheck CURRENT / PASS
|
|
18
|
-
|
|
19
|
-
Recording-only: test runtime, transforms and cache inputs need review
|
|
52
|
+
✓ lint CURRENT / PASS
|
|
20
53
|
|
|
21
|
-
#
|
|
54
|
+
# after editing src/main.ts
|
|
22
55
|
$ redue explain typecheck
|
|
23
56
|
typecheck: STALE / PASS
|
|
24
57
|
src/main.ts changed
|
|
25
|
-
Relevant inputs changed:
|
|
26
|
-
src/main.ts
|
|
27
58
|
Due again when verification is needed: redue run "typecheck"
|
|
28
59
|
```
|
|
29
60
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
`redue status` checks the files and your environment before it answers, as
|
|
62
|
+
the agent's hook does. `redue status --cached` gives the last answer the
|
|
63
|
+
observer published without checking; it can say UNVERIFIED ("cannot confirm
|
|
64
|
+
your execution context") where `redue status` would say CURRENT.
|
|
65
|
+
|
|
66
|
+
`redue stats` shows, per check, the reruns the hook skipped, the time saved,
|
|
67
|
+
the recorded runs and the top reasons a check was UNVERIFIED, from a log kept
|
|
68
|
+
on your machine.
|
|
69
|
+
|
|
70
|
+
To undo everything setup did: `redue remove`.
|
|
71
|
+
|
|
72
|
+
## Still CURRENT after your build and tests
|
|
73
|
+
|
|
74
|
+
Running the project's build or tests writes files (`dist/`, `.next/`,
|
|
75
|
+
coverage). REDUE leaves those out when the files are git-ignored, so a
|
|
76
|
+
typecheck or lint that passed stays CURRENT. In the census, after each
|
|
77
|
+
project's own build, tests, typecheck and lint ran, the share of sandboxed
|
|
78
|
+
checks still CURRENT:
|
|
79
|
+
|
|
80
|
+
| | alpha.26 | alpha.27 |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| TypeScript, Linux | 5 of 43 | 31 of 37 |
|
|
83
|
+
| TypeScript, macOS | 5 of 38 | 24 of 34 |
|
|
84
|
+
| Python, Linux | 24 of 37 | 31 of 38 |
|
|
85
|
+
| Python, macOS | 20 of 33 | 28 of 34 |
|
|
86
|
+
|
|
87
|
+
The rest changed for real: the build rewrote a tracked file (a sitemap, a
|
|
88
|
+
feed, a generated source), added a file git doesn't ignore, or installed
|
|
89
|
+
packages.
|
|
90
|
+
|
|
91
|
+
## What it covers today
|
|
92
|
+
|
|
93
|
+
In a census of 120 active public TypeScript repositories (November 2026, REDUE
|
|
94
|
+
at commit 8cb32d6, before 0.1.0-alpha.29), each installed as its users would,
|
|
95
|
+
with dependencies' install scripts on, 89 installed cleanly on a macOS runner.
|
|
96
|
+
A check counts when two recorded runs on the same code both came out CURRENT
|
|
97
|
+
on the same inputs. 34 repositories had at least one such check:
|
|
98
|
+
|
|
99
|
+
| Check | Repositories | How |
|
|
100
|
+
|---|---|---|
|
|
101
|
+
| Typecheck | 20 | 13 by running the project's script in an OS sandbox ([sandboxed recipe](docs/user/sandbox.md)), 12 of them with the files git ignores and the documentation hidden; 5 by running the local `tsc` directly ([direct recipe](docs/user/direct-typescript.md)); 2 by running the script with every Node process recorded ([general recipe](docs/user/node-script.md)) |
|
|
102
|
+
| Lint | 20 | 16 sandboxed recipe (14 with ignored files and documentation hidden, 1 with ignored files hidden), 4 general recipe |
|
|
103
|
+
| Tests | 11 | 9 sandboxed recipe with no network (6 with ignored files and documentation hidden, 3 with ignored files hidden); 2 Vitest run directly ([direct test recipe](docs/user/tests-direct.md)) |
|
|
104
|
+
|
|
105
|
+
alpha.28 found 38 repositories on macOS. Test runs there no longer get
|
|
106
|
+
loopback, which cost 1 test suite (it starts a server on 127.0.0.1). Of the
|
|
107
|
+
other 3, one lint check was lost to a documentation-hiding bug fixed before
|
|
108
|
+
this release, one checkout now installs with pnpm in a way REDUE does not
|
|
109
|
+
take, and one `init` did not answer within the census's 10 minutes. On
|
|
110
|
+
Linux, where tests keep loopback, 10 test suites qualified.
|
|
111
|
+
|
|
112
|
+
In a census of 120 Python repositories, 74 installed on a Linux runner
|
|
113
|
+
and 31 had a qualifying check: typecheck (mypy, pyright, ty) 15, lint (ruff)
|
|
114
|
+
22, tests (pytest) 17, all through the sandboxed recipe (15, 22 and 12 of
|
|
115
|
+
them with ignored files and documentation hidden). On Linux, every sandboxed
|
|
116
|
+
run was traced with strace: each file it read in the checkout was a recorded
|
|
117
|
+
input, a cache or its own output.
|
|
118
|
+
|
|
119
|
+
Everything else stays UNVERIFIED, with a reason you can read in
|
|
120
|
+
`redue explain`. The usual ones: a script starts a program REDUE cannot see
|
|
121
|
+
into and the sandbox can't run (inside Claude Code's macOS sandbox, on
|
|
122
|
+
Windows), the project uses Bun, or a check writes into its own inputs.
|
|
123
|
+
[Supported projects](docs/user/supported-projects.md) has the details.
|
|
124
|
+
|
|
125
|
+
## Measured with Claude Code
|
|
126
|
+
|
|
127
|
+
Headless Claude Code sessions (Sonnet 5.5, CI Linux runner) on the same tasks
|
|
128
|
+
with and without REDUE, three sessions per task. Session time, medians per
|
|
129
|
+
task summed over the projects:
|
|
130
|
+
|
|
131
|
+
- **Typecheck** (twilio-node, semiotic, Ultra-Card, SwitchHosts; four tasks;
|
|
132
|
+
96 sessions; 0.1.0-alpha.12 code): 464 s without, 330 s with. REDUE skipped
|
|
133
|
+
33 typechecks. Each was checked afterwards with plain `tsc` on the exact tree
|
|
134
|
+
it was skipped on, and all 33 agreed.
|
|
135
|
+
- **Unit tests** (cheerio with Vitest 4, SwitchHosts with Vitest 5, twilio-node
|
|
136
|
+
with Jest 29; four tasks; 72 sessions; 0.1.0-alpha.14 code): 515 s without,
|
|
137
|
+
295 s with. REDUE skipped 21 test runs. Each was rerun plainly three times on
|
|
138
|
+
the exact tree, and all passed every time.
|
|
139
|
+
|
|
140
|
+
API cost was the same in both arms. The savings come only when an earlier
|
|
141
|
+
pass still applies: a task that changes source code saves nothing. A handful
|
|
142
|
+
of projects and three runs per task show direction, not a general rate. The
|
|
143
|
+
harness, tasks and raw results are in [`eval/`](eval/README.md).
|
|
144
|
+
|
|
145
|
+
## What REDUE won't do
|
|
146
|
+
|
|
147
|
+
- **Prove your code is correct.** CURRENT means the inputs of the recorded
|
|
148
|
+
run are unchanged, not that the code works. A failure stays a failure.
|
|
149
|
+
- **Run checks for you.** Nothing runs in the background; checks run when you
|
|
150
|
+
or the agent run them.
|
|
151
|
+
- **Trust what it cannot see.** A program it cannot account for, a file it
|
|
152
|
+
does not observe, or a gap in observation makes the result UNVERIFIED and
|
|
153
|
+
says why. It never turns that into CURRENT by guessing.
|
|
154
|
+
- **Support yet:** TypeScript 7's native compiler, Bun, per-package checks in
|
|
155
|
+
large monorepos, results shared across machines, and the general recipe on
|
|
156
|
+
Windows (Windows has the strict recipes only).
|
|
69
157
|
|
|
70
158
|
## What the states mean
|
|
71
159
|
|
|
72
|
-
| State | Meaning |
|
|
160
|
+
| State | Meaning | Next step |
|
|
73
161
|
| --- | --- | --- |
|
|
74
|
-
| CURRENT | The recorded result applies to the
|
|
75
|
-
| STALE |
|
|
76
|
-
| UNVERIFIED |
|
|
77
|
-
| FAILED | The
|
|
78
|
-
|
|
79
|
-
A historical PASS remains PASS when stale or unverified. A historical failure
|
|
80
|
-
never becomes a successful check. CURRENT does not mean every product behavior
|
|
81
|
-
has been verified.
|
|
82
|
-
|
|
83
|
-
## Supported alpha path
|
|
84
|
-
|
|
85
|
-
- macOS, Linux, and Windows on supported local filesystems; Node 22+.
|
|
86
|
-
- Linux also requires Python 3 for observation. No WSL or Git Bash needed on Windows.
|
|
87
|
-
- npm, pinned Yarn `node-modules`, and pinned pnpm 12 isolated/hoisted layouts.
|
|
88
|
-
- Automatic qualification for supported TypeScript invocations; workspace
|
|
89
|
-
boundaries follow the files actually consumed, including built declarations.
|
|
90
|
-
- Existing test/lint/build and arbitrary commands can record results while
|
|
91
|
-
their applicability remains unqualified.
|
|
92
|
-
|
|
93
|
-
The [supported-project boundary](docs/user/supported-projects.md) is deliberately
|
|
94
|
-
narrow. A script named `test` is not automatically a complete test contract.
|
|
95
|
-
|
|
96
|
-
## Alpha limitations
|
|
97
|
-
|
|
98
|
-
- REDUE records evidence; it does not prove correctness.
|
|
99
|
-
- Direct commands outside `redue run` do not create receipts.
|
|
100
|
-
- Some tests, lints, and builds remain UNVERIFIED/PASS because their input contract is incomplete.
|
|
101
|
-
- Synchronized applicability has nontrivial cost and can lose to an inexpensive rerun.
|
|
102
|
-
- Unsupported/exotic install layouts and filesystems remain conservative; they do not become green through guesses.
|
|
103
|
-
- No cloud/team synchronization, IDE extension, or automatic background check execution.
|
|
104
|
-
- Alpha configuration and APIs may evolve. Neither cached nor synchronized status is an atomic snapshot against concurrent edits.
|
|
162
|
+
| CURRENT | The recorded result applies to the code as it is now. | Reuse a pass; no need to rerun. |
|
|
163
|
+
| STALE | An input changed since the recorded result. | Rerun when you need the answer. |
|
|
164
|
+
| UNVERIFIED | REDUE cannot tell: no result yet, an input it cannot see, or observation not ready. | Read the reason; rerun if it matters. |
|
|
165
|
+
| FAILED | The last run failed: the check ran and reported a failure, or could not run. | Fix and rerun. |
|
|
105
166
|
|
|
106
|
-
##
|
|
167
|
+
## Without Claude Code, or step by step
|
|
107
168
|
|
|
108
169
|
```sh
|
|
109
|
-
redue
|
|
110
|
-
redue
|
|
111
|
-
redue
|
|
112
|
-
redue status
|
|
113
|
-
redue stop # retains historical receipts
|
|
114
|
-
redue remove-state # removes only this config's owned local state
|
|
170
|
+
redue init # write redue.config.json from your scripts
|
|
171
|
+
redue start # start the file observer
|
|
172
|
+
redue run typecheck # run a check through REDUE and record the result
|
|
173
|
+
redue status # what still holds
|
|
115
174
|
```
|
|
116
175
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
synchronized work in a prompt.
|
|
176
|
+
Codex is supported too (`redue agent setup codex --apply`); see
|
|
177
|
+
[agents](docs/user/agents.md). Agents should read
|
|
178
|
+
[the JSON interface](docs/user/json.md), not the terminal text.
|
|
121
179
|
|
|
122
|
-
[
|
|
123
|
-
[
|
|
180
|
+
[Getting started](docs/user/getting-started.md) · [User docs](docs/README.md) ·
|
|
181
|
+
[Contributing](CONTRIBUTING.md) · [Architecture](docs/contributor/architecture.md)
|
|
124
182
|
|
|
125
183
|
## License
|
|
126
184
|
|
|
127
|
-
REDUE is licensed under [Apache-2.0](LICENSE). Dependencies
|
|
185
|
+
REDUE is licensed under [Apache-2.0](LICENSE). Dependencies keep their own licenses.
|