@richjava/req0 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 (70) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -0
  3. package/cockpit/android-chrome-192x192.png +0 -0
  4. package/cockpit/android-chrome-512x512.png +0 -0
  5. package/cockpit/app.js +1710 -0
  6. package/cockpit/apple-touch-icon.png +0 -0
  7. package/cockpit/favicon-16x16.png +0 -0
  8. package/cockpit/favicon-32x32.png +0 -0
  9. package/cockpit/favicon.ico +0 -0
  10. package/cockpit/index.html +180 -0
  11. package/cockpit/markdown-editor.js +93 -0
  12. package/cockpit/req0-logo-horiz.png +0 -0
  13. package/cockpit/req0-logo-stacked.png +0 -0
  14. package/cockpit/site.webmanifest +19 -0
  15. package/cockpit/styles.css +1710 -0
  16. package/cockpit/tokens.css +118 -0
  17. package/dist/adapter.d.ts +5 -0
  18. package/dist/adapter.js +16 -0
  19. package/dist/browser.d.ts +33 -0
  20. package/dist/browser.js +524 -0
  21. package/dist/cli.d.ts +2 -0
  22. package/dist/cli.js +265 -0
  23. package/dist/compile.d.ts +5 -0
  24. package/dist/compile.js +456 -0
  25. package/dist/diff.d.ts +15 -0
  26. package/dist/diff.js +114 -0
  27. package/dist/fix-from-proof.d.ts +13 -0
  28. package/dist/fix-from-proof.js +61 -0
  29. package/dist/gates.d.ts +7 -0
  30. package/dist/gates.js +7 -0
  31. package/dist/implement-brief.d.ts +9 -0
  32. package/dist/implement-brief.js +142 -0
  33. package/dist/implement.d.ts +70 -0
  34. package/dist/implement.js +615 -0
  35. package/dist/improve-log.d.ts +11 -0
  36. package/dist/improve-log.js +38 -0
  37. package/dist/improve-review.d.ts +45 -0
  38. package/dist/improve-review.js +182 -0
  39. package/dist/improve.d.ts +16 -0
  40. package/dist/improve.js +127 -0
  41. package/dist/jev-pack.d.ts +2 -0
  42. package/dist/jev-pack.js +114 -0
  43. package/dist/jev.d.ts +23 -0
  44. package/dist/jev.js +142 -0
  45. package/dist/pack.d.ts +101 -0
  46. package/dist/pack.js +609 -0
  47. package/dist/personas.d.ts +13 -0
  48. package/dist/personas.js +88 -0
  49. package/dist/proof-report.d.ts +8 -0
  50. package/dist/proof-report.js +82 -0
  51. package/dist/proof.d.ts +45 -0
  52. package/dist/proof.js +394 -0
  53. package/dist/qa-plan.d.ts +6 -0
  54. package/dist/qa-plan.js +58 -0
  55. package/dist/ready.d.ts +29 -0
  56. package/dist/ready.js +317 -0
  57. package/dist/runtime.d.ts +25 -0
  58. package/dist/runtime.js +125 -0
  59. package/dist/server.d.ts +15 -0
  60. package/dist/server.js +588 -0
  61. package/dist/stack.d.ts +35 -0
  62. package/dist/stack.js +220 -0
  63. package/dist/stages.d.ts +15 -0
  64. package/dist/stages.js +345 -0
  65. package/dist/template.d.ts +5 -0
  66. package/dist/template.js +55 -0
  67. package/dist/types.d.ts +282 -0
  68. package/dist/types.js +12 -0
  69. package/docs/requirement-template.md +341 -0
  70. package/package.json +81 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Richard Lovell
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,117 @@
1
+ <div align="center">
2
+
3
+ <img src="docs/brand/req0-logo-horiz.png" alt="Req0" width="100%" />
4
+
5
+ </div>
6
+
7
+ # Req0
8
+
9
+ Req0 is a **requirement operating system** for a product git repo. You write a structured requirement pack. The same pack drives definition, implementation, and proof — not a parallel ticket or test script.
10
+
11
+ A local **cockpit** shows health and the next action. A deterministic compiler checks the grammar. **Jev** (TypeSafe System One) judges whether the spec is ready to implement. Coding agents (Cursor or Copilot) implement; the browser proves the app.
12
+
13
+ Req0 is a CLI plus a thin HTML cockpit. It is not a hosted SaaS.
14
+
15
+ ## Install
16
+
17
+ Node.js **22.15** or newer.
18
+
19
+ ```bash
20
+ npm install -g @richjava/req0
21
+ ```
22
+
23
+ Or run without a global install:
24
+
25
+ ```bash
26
+ npx @richjava/req0 start
27
+ ```
28
+
29
+ You can open the cockpit and compile a spec with that alone. **Judgment, Implement, and Prove need Jev:** set `TYPESAFE_API_KEY` in the product repo’s `.env` (TypeSafe System One). Without the key, Check fails closed and Ready stays Not yet.
30
+
31
+ ## Quick start
32
+
33
+ From the **product** repo (the app you are specifying), not from inside this package:
34
+
35
+ ```bash
36
+ cd /path/to/your-product
37
+ req0 start
38
+ ```
39
+
40
+ The cockpit opens at `http://127.0.0.1:4370` (or the next free port). From the requirement list, create a pack with a kebab-case id such as `001`. That writes `docs/requirements/<id>/` using the starter template.
41
+
42
+ Edit `requirement.md` on **Define**. Save compiles. Spec Valid means the [grammar](https://github.com/richjava/req0/blob/main/docs/grammar.md) parsed — it does not mean the spec is ready to implement.
43
+
44
+ ## Commands
45
+
46
+ | Command | What it does |
47
+ | --- | --- |
48
+ | `req0 start` | Local cockpit |
49
+ | `req0 create <id>` | Create a pack folder (kebab-case) |
50
+ | `req0 compile` | Compile the pack; exit 2 on grammar errors |
51
+ | `req0 check` | Ask Jev to judge the spec. Needs `TYPESAFE_API_KEY`. Exit 3 if the key is missing; exit 2 if Ready is blocked |
52
+ | `req0 implement` | Launch the recorded coding agent after Ready. `--adapter=cursor\|copilot\|manual`. `--stack=nextjs-default\|amplify-gen2` on an empty repo |
53
+ | `req0 prove` | Run compiled browser QA after Ready (and Build, unless Implement is off) |
54
+
55
+ `req0 compile`, `check`, `implement`, and `prove` resolve a pack from the current directory (a pack folder, or the only pack under `docs/requirements/`). The cockpit does not auto-open a pack from the product root — you pick one from the list.
56
+
57
+ ## Setup
58
+
59
+ ### In the product repo
60
+
61
+ Packs live at `docs/requirements/<kebab-id>/`:
62
+
63
+ ```text
64
+ docs/requirements/invoice-approval/
65
+ requirement.md
66
+ fixtures/personas.yaml # test users, never production credentials
67
+ fixtures/runtime.yaml # app URL and login selectors for Prove
68
+ derived/ # generated; do not hand-edit
69
+ ```
70
+
71
+ First run in an empty product repo asks how code should be written (**I’ll write the code**, **Cursor**, or **Copilot**) and, if an agent will implement, which stack. That writes `req0.json`. Set `"implement": false` when Req0 should not own Implement.
72
+
73
+ Copy names-only env vars into `.env` as needed. Do not put secrets in `.env.example`.
74
+
75
+ | Variable | Used for |
76
+ | --- | --- |
77
+ | `TYPESAFE_API_KEY` | Judgment **Check** (Jev / TypeSafe System One) |
78
+ | `AWS_REGION` / `AWS_PROFILE` | Amplify Gen 2 implement only. `ampx` does not read `.env` — export the vars or run `npx ampx configure profile` |
79
+
80
+ ### Prove
81
+
82
+ ```bash
83
+ npx playwright install chromium
84
+ ```
85
+
86
+ `fixtures/runtime.yaml` must parse (`baseUrl`, login selectors). Personas supply test emails and passwords.
87
+
88
+ ### Implement
89
+
90
+ Install the agent CLI you recorded: [Cursor](https://cursor.com) agent, or GitHub Copilot CLI. `--adapter=manual` skips launch.
91
+
92
+ ## Grammar (short)
93
+
94
+ `requirement.md` needs one `#` title and these `##` sections: **Business Rules**, **Use Cases**, **Roles & Permissions**. Rules use `Id: BR-001` with Statement and Observable. Use cases use `Id: UC-001` with Actor, numbered Steps, and Outcome. The roles table cells are only `allow` or `deny`. Full rules: [docs/grammar.md](https://github.com/richjava/req0/blob/main/docs/grammar.md).
95
+
96
+ ## Docs
97
+
98
+ - [What Req0 is](https://github.com/richjava/req0/blob/main/docs/product.md)
99
+ - [Cockpit](https://github.com/richjava/req0/blob/main/docs/cockpit.md)
100
+ - [Architecture and CLI](https://github.com/richjava/req0/blob/main/docs/architecture.md)
101
+ - [Glossary](https://github.com/richjava/req0/blob/main/docs/glossary.md)
102
+
103
+ ## This git repository
104
+
105
+ Clone if you are changing Req0 itself:
106
+
107
+ ```bash
108
+ git clone https://github.com/richjava/req0.git
109
+ cd req0
110
+ npm install
111
+ npm test
112
+ npm start
113
+ ```
114
+
115
+ `npm start` is `req0 start` via `tsx`. `npm run build` compiles the CLI to `dist/` (what npm publishes).
116
+
117
+ This repo also contains a sample Invoice Desk app (Amplify Gen 2 + Next.js) and the golden `invoice-approval` pack. That app is **not** part of the published npm package. To run it from a clone: copy `.env.example` to `.env`, then `npm run sandbox`, `npm run db:seed`, and `npm run dev`. Personas: `docs/requirements/invoice-approval/fixtures/personas.yaml`.