@rqml/schema 0.1.0 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rqml/schema",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Canonical RQML XSD schemas (the single source of truth), example documents, and the AGENTS.md template, with a typed version resolver. Schema text is inlined for offline, bundler-friendly consumption.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -11,7 +11,7 @@
11
11
 
12
12
  ---
13
13
 
14
- This project uses **RQML** as the single source of truth for system intent. Familiarize yourself with the documentation at https://rqml.org/docs/user-guide/
14
+ This project uses **RQML** as the single source of truth for system intent. Familiarize yourself with the documentation at https://rqml.org/docs/user-guide/ and the development process at https://rqml.org/docs/development-process/
15
15
 
16
16
  **Specification file:** Specification lives in a single .rqml file in the root of the project - convention is `requirements.rqml`. Multiple .rqml files may be employed in multirepo projects, in such cases a .rqml spec applies to everything that is higher in the project tree, unless overridden by another .rqml file.
17
17
 
@@ -20,33 +20,70 @@ The RQML XSD schema is at https://rqml.org/schema/rqml-2.1.0.xsd (insert correct
20
20
 
21
21
  ---
22
22
 
23
- ## Core Principle: Spec-First Development
23
+ ## Toolchain
24
24
 
25
+ The spec-first loop is enforced by the `rqml` CLI (npm: `@rqml/cli`; the `@rqml/mcp` server exposes the same engine as agent tools):
26
+
27
+ ```bash
28
+ rqml check # deterministic gate: validation + coverage + drift (exit 0 = pass)
29
+ rqml status # re-anchor: spec, coverage, and drift state
30
+ rqml show <REQ-ID> # one requirement: statement, acceptance criteria, trace neighborhood
31
+ rqml impact <ID> # what is affected, transitively, if this artifact changes
32
+ rqml matrix # traceability matrix: status, goals, code, tests, coverage gaps
33
+ rqml link <REQ-ID> <path> # record an implements edge + drift baseline (--type verifiedBy for tests)
34
+ rqml skeleton <kind> # schema-valid snippet: req | edge | testCase | stateMachine
25
35
  ```
26
- [Elicit] → [Specify] → [Implement] → [Verify] → [Trace]
27
- ↑____________________←______________________|
28
- ```
36
+
37
+ Run `rqml status` when you start a session to re-anchor on the spec. Run `rqml check` before finishing any task — it must exit 0.
38
+
39
+ ---
40
+
41
+ ## Core Principle: Spec-First Development
29
42
 
30
43
  Code follows specification, not the reverse. If code and spec diverge, the spec is authoritative—update the code or negotiate a spec change with the developer.
31
44
 
45
+ RQML organizes work into a **five-stage process** (https://rqml.org/docs/development-process/). Each stage produces a durable artifact in version control; verification feeds back to the spec, so it is a loop:
46
+
47
+ | Stage | Task | Output |
48
+ |-------|------|--------|
49
+ | **Spec** | Capture intent as requirements | `requirements.rqml` |
50
+ | **Design** | Decide architecture, record decisions | ADRs in `.rqml/adr/` |
51
+ | **Plan** | Break work into agent-sized stages | `.rqml/plan.md` |
52
+ | **Code** | Implement specified behavior, keep traces current | code + tests |
53
+ | **Verify** | Prove coverage and catch drift | trace graph + `rqml check` |
54
+
55
+ Never skip ahead: do not implement behavior that is not specified, and do not make a significant architectural choice without recording it as an ADR.
56
+
32
57
  ---
33
58
 
34
59
  ## Workflow
35
60
 
36
- ### 1. Elicit
37
- Ask clarifying questions until you understand the goal, scope, acceptance criteria, and constraints. Don't assume—capture assumptions as `<notes>` or `<issue>` elements.
38
-
39
- ### 2. Specify
40
- **Never implement unspecified behavior.** Update the `.rqml` file before coding:
61
+ ### 1. Spec
62
+ Ask clarifying questions until you understand the goal, scope, acceptance criteria, and constraints. Don't assume—capture assumptions as `<notes>` or `<issue>` elements. **Never implement unspecified behavior.** Update the `.rqml` file before coding:
41
63
  - Add a `<req>` with statement and acceptance criteria
42
64
  - Set appropriate `type`, `priority`, and `status="draft"`
43
- - Get developer confirmation before proceeding
65
+ - Get developer confirmation; only `status="approved"` requirements drive implementation
66
+
67
+ ### 2. Design
68
+ Before building, decide *how*. Record each significant architectural decision as an **Architecture Decision Record (ADR)** in `.rqml/adr/`, following the canonical format (https://rqml.org/docs/development-process/design): `NNNN-kebab-case-slug.md`, with Status, Classification, Context, Options considered, Decision, and Consequences. A decision is ADR-worthy when there are real alternatives or the choice constrains future work; skip ADRs for low-level implementation details. ADRs are immutable once accepted—supersede, don't edit.
69
+
70
+ ### 3. Plan
71
+ Break approved requirements into a staged implementation plan at `.rqml/plan.md`, framed for coding agents: each stage names its goal, the requirement IDs it addresses, the files it touches, and how to verify it.
44
72
 
45
- ### 3. Implement
46
- Reference requirement IDs in code comments. If you discover missing requirements, stop and add them to the spec first.
73
+ ### 4. Code (Implement)
74
+ Read the requirement first: `rqml show REQ-XXX`. Check blast radius before changing existing artifacts: `rqml impact REQ-XXX`. Honor the ADRs. If you discover missing requirements, stop and add them to the spec first. After implementing, record the trace link:
75
+
76
+ ```bash
77
+ rqml link REQ-XXX src/path/to/implementation.ts
78
+ ```
47
79
 
48
- ### 4. Verify
49
- Add tests that reference requirement IDs. Update `<trace>` section with verification links.
80
+ ### 5. Verify
81
+ Add tests that reference requirement IDs, then record verification and run the gate:
82
+
83
+ ```bash
84
+ rqml link REQ-XXX test/path/to/test.ts --type verifiedBy
85
+ rqml check # must exit 0 before you are done
86
+ ```
50
87
 
51
88
  ---
52
89
 
@@ -64,10 +101,12 @@ Add tests that reference requirement IDs. Update `<trace>` section with verifica
64
101
 
65
102
  | Aspect | relaxed | standard | strict | certified |
66
103
  |--------|---------|----------|--------|-----------|
67
- | Elicitation | Major features | Testable reqs | Edge cases | Formal |
104
+ | Spec (elicitation) | Major features | Testable reqs | Edge cases | Formal |
68
105
  | Spec-first | Recommended | Required | Required | Approved first |
106
+ | Design (ADRs) | Optional | Significant choices | All architectural choices | With approval |
107
+ | Plan | Optional | For multi-stage work | Required | Required |
69
108
  | Code traces | Optional | New features | All changes | With metadata |
70
- | Test traces | Optional | New reqs | All reqs | Full matrix |
109
+ | Verify (test traces) | Optional | New reqs | All reqs | Full matrix |
71
110
  | Ghost features | Allowed | Blocked | Blocked | Blocked |
72
111
 
73
112
  ---
@@ -80,6 +119,7 @@ For PRs and commits:
80
119
  ## RQML Trace Summary
81
120
 
82
121
  **Requirements:** REQ-xxx (added/modified/implemented)
122
+ **Design:** ADR-xxxx — decision recorded (if any)
83
123
  **Implementation:** `path/to/file` — what changed
84
124
  **Verification:** `path/to/test` — what it verifies
85
125
  **Open items:** gaps, assumptions, follow-ups
@@ -91,15 +131,14 @@ For PRs and commits:
91
131
 
92
132
  The `.rqml` file must remain valid XML conforming to the version of RQML referenced in the version attribute in the spec document.
93
133
 
94
- **To validate:** Try xmllint first (pre-installed on macOS/Linux):
134
+ **To validate:** Use the toolchain it validates offline against the bundled schema and also checks referential integrity the XSD alone cannot enforce:
95
135
  ```bash
96
- xmllint --schema https://rqml.org/schema/rqml-2.1.0.xsd <rqml-file-name> --noout
136
+ rqml validate
97
137
  ```
98
138
 
99
- If xmllint is unavailable, use Python with lxml:
139
+ If the `rqml` CLI is not installed, `npx @rqml/cli validate` works without installation. As a last resort, xmllint (pre-installed on macOS/Linux) checks XSD validity only:
100
140
  ```bash
101
- pip install lxml
102
- python -c "from lxml import etree; s=etree.XMLSchema(etree.parse('https://rqml.org/schema/rqml-2.1.0.xsd')); print('Valid' if s.validate(etree.parse('<rqml-file-name>')) else s.error_log)"
141
+ xmllint --schema https://rqml.org/schema/rqml-2.1.0.xsd <rqml-file-name> --noout
103
142
  ```
104
143
 
105
144
  **IDE validation:** If the `.rqml` file includes `xsi:schemaLocation`, XML-aware editors (VS Code with XML extension, IntelliJ) validate automatically.