asljs-rq-cli 0.0.0-stage → 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/LICENSE.md +51 -0
- package/README.md +224 -2
- package/bin/rq.js +12 -0
- package/dist/cli.d.ts +38 -0
- package/dist/cli.js +315 -0
- package/dist/config.d.ts +63 -0
- package/dist/config.js +78 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/docs/Changing the graph.md +108 -0
- package/docs/Querying the graph.md +71 -0
- package/docs/rq agents.md +29 -0
- package/docs/rq check.md +32 -0
- package/docs/rq config.md +60 -0
- package/docs/rq coverage.md +80 -0
- package/docs/rq test.md +124 -0
- package/package.json +71 -4
- package/skills/requirements-authoring.md +82 -0
- package/skills/requirements-change.md +51 -0
- package/skills/requirements-coverage.md +48 -0
package/package.json
CHANGED
|
@@ -1,6 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asljs-rq-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "The rq command line over asljs-rq: query, change, check, test and view requirements.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"asljs": {
|
|
7
|
+
"type": "app"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist/**",
|
|
19
|
+
"bin/**",
|
|
20
|
+
"docs/**",
|
|
21
|
+
"skills/*.md",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE.md"
|
|
24
|
+
],
|
|
25
|
+
"bin": {
|
|
26
|
+
"rq": "bin/rq.js"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"flint": "toolkit flint",
|
|
30
|
+
"clean": "toolkit clean",
|
|
31
|
+
"build": "npm run codegen --if-present && tsc -p tsconfig.build.json",
|
|
32
|
+
"build:dist": "npm run codegen --if-present && tsc -p tsconfig.dist.json",
|
|
33
|
+
"typecheck": "npm run codegen --if-present && tsc -p tsconfig.build.json --noEmit",
|
|
34
|
+
"guard:clean-git": "toolkit ensure-clean-working-directory",
|
|
35
|
+
"prepack": "npm run clean && npm run build:dist && npm run build && npm run test && npm run guard:clean-git",
|
|
36
|
+
"postpublish": "toolkit tag-release-revision",
|
|
37
|
+
"test": "node --test --enable-source-maps \"build/**/*.test.js\"",
|
|
38
|
+
"test:watch": "node --watch --test \"build/**/*.test.js\"",
|
|
39
|
+
"release:patch": "toolkit release-patch",
|
|
40
|
+
"all": "npm run clean && npm run build:dist && npm run flint && npm run typecheck && npm run build && npm run test"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"requirements",
|
|
44
|
+
"traceability",
|
|
45
|
+
"test",
|
|
46
|
+
"markdown",
|
|
47
|
+
"ai",
|
|
48
|
+
"cli"
|
|
49
|
+
],
|
|
50
|
+
"homepage": "https://github.com/AlexandriteSoftware/asljs#readme",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/AlexandriteSoftware/asljs/issues"
|
|
53
|
+
},
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "git+https://github.com/AlexandriteSoftware/asljs.git"
|
|
57
|
+
},
|
|
58
|
+
"author": "\"Alex Netkachov\" <alex.netkachov@gmail.com>",
|
|
59
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"asljs-agents": "^0.1.0",
|
|
62
|
+
"asljs-logging": "^0.1.2",
|
|
63
|
+
"asljs-mdcli": "^0.1.3",
|
|
64
|
+
"asljs-rq": "^0.1.6",
|
|
65
|
+
"asljs-rq-srv": "^0.1.1",
|
|
66
|
+
"commander": "^15.0.0"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"asljs-testing": "^0.1.0",
|
|
70
|
+
"asljs-tmpdir": "^0.1.13",
|
|
71
|
+
"asljs-toolkit": "^0.1.0"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# requirements-authoring
|
|
2
|
+
|
|
3
|
+
Use when: writing a requirement, decomposing one into smaller requirements, or
|
|
4
|
+
writing the test that shows a requirement holds.
|
|
5
|
+
|
|
6
|
+
The formats and the rules every change keeps are in [Requirement files][RF], and
|
|
7
|
+
what `rq` does with them in [Requirements][RM]. Requirements (`R<n> <name>.md`)
|
|
8
|
+
and tests (`T<n> <name>.md`) are the nodes of one graph, and the links in each
|
|
9
|
+
requirement's `## Implementation` list are its edges. A requirement nothing
|
|
10
|
+
links to is a root; every other requirement is linked from exactly one
|
|
11
|
+
requirement, and every test from at least one. Other documents, and links in a
|
|
12
|
+
statement, are references the graph ignores.
|
|
13
|
+
|
|
14
|
+
## Text and structure
|
|
15
|
+
|
|
16
|
+
- Edit text directly: the statement of a requirement, the description and the
|
|
17
|
+
`## Steps` of a test, and any section the commands do not own.
|
|
18
|
+
- Change the structure only with the [commands][CG]: `rq add requirement`, `rq
|
|
19
|
+
add test`, `rq link`, `rq unlink`, `rq move`, `rq remove` and `rq log`. Do not
|
|
20
|
+
add, change or remove links to requirements or tests, files, `##
|
|
21
|
+
Implementation` items, results or `## Status` sections by editing the text.
|
|
22
|
+
- Read the structure with `rq links`, `rq backlinks`, `rq list` and `rq tojson`
|
|
23
|
+
rather than by searching the text; `--json` gives a stable shape.
|
|
24
|
+
|
|
25
|
+
## Writing a requirement
|
|
26
|
+
|
|
27
|
+
1. State what must be true of the system, not how it is built. One idea per
|
|
28
|
+
statement, each one checkable.
|
|
29
|
+
2. Create it under the requirement it helps implement: `rq add requirement
|
|
30
|
+
<parent> "<name>" --statement "<statement>"`. The command picks the id, names
|
|
31
|
+
the file, and links it from the parent.
|
|
32
|
+
3. Refine the statement by editing the text when it needs more than a line.
|
|
33
|
+
|
|
34
|
+
## Decomposing
|
|
35
|
+
|
|
36
|
+
A requirement is too big for a test when no single, short set of commands can
|
|
37
|
+
show that it holds.
|
|
38
|
+
|
|
39
|
+
1. List its statements.
|
|
40
|
+
2. Group them into smaller requirements, each with a narrower scope; a statement
|
|
41
|
+
may also be covered directly by a test.
|
|
42
|
+
3. Create each with `rq add requirement` or `rq add test`, or link an existing
|
|
43
|
+
one with `rq link`.
|
|
44
|
+
4. Check coverage: every statement is implemented by at least one link. Unlink
|
|
45
|
+
what implements no statement with `rq unlink`.
|
|
46
|
+
5. `rq link` refuses a link back up the graph, and a second parent for a
|
|
47
|
+
requirement: link an existing requirement only when it has no parent yet. A
|
|
48
|
+
test may be linked from every requirement it checks. Links in a test are not
|
|
49
|
+
edges, so a test may refer to what it checks, but does not have to.
|
|
50
|
+
|
|
51
|
+
## Writing a test
|
|
52
|
+
|
|
53
|
+
1. Create it: `rq add test <requirement> "<name>" --description "<what it
|
|
54
|
+
shows>" --step "<command>"`, one `shell` step per `--step`.
|
|
55
|
+
2. Each step is a `###` heading under `## Steps`. Edit the text to use another
|
|
56
|
+
type: `- Type: javascript` with `- File:` and `- Test:`, `- Type: dotnet`
|
|
57
|
+
with `- Project:` and `- Filter:`, or plain text for an instruction an AI
|
|
58
|
+
agent carries out. Prefer the typed steps; an instruction is for what no
|
|
59
|
+
command can check.
|
|
60
|
+
3. Steps run in the test's folder, so use paths relative to it, or `cd` within a
|
|
61
|
+
shell line.
|
|
62
|
+
4. Make the steps deterministic and reproducible: no network services, clocks or
|
|
63
|
+
random data the steps do not control, and no manual actions. Prefer running
|
|
64
|
+
an existing test filtered to the behavior, e.g. `npm test --
|
|
65
|
+
--test-name-pattern="..."`.
|
|
66
|
+
5. `rq test <test>` runs it and records the result in `.rq/E<n> <slug>.md`.
|
|
67
|
+
Record a result established another way with `rq log <test> --result
|
|
68
|
+
PASS|FAIL --note "<how>"`.
|
|
69
|
+
|
|
70
|
+
## Checking
|
|
71
|
+
|
|
72
|
+
Run `rq check <path>` after every change, then `rq test <id> --recurse` on the
|
|
73
|
+
changed subtree, and `rq coverage <id> --recurse` when the decomposition
|
|
74
|
+
changed, so that an agent checks coverage. Fix what they report before
|
|
75
|
+
finishing; [requirements-coverage][RC] says how to act on the `## Coverage`
|
|
76
|
+
analysis of an incomplete requirement.
|
|
77
|
+
|
|
78
|
+
[RC]: requirements-coverage.md
|
|
79
|
+
|
|
80
|
+
[CG]: <../docs/Changing the graph.md>
|
|
81
|
+
[RF]: <../../rq/docs/Requirement files.md>
|
|
82
|
+
[RM]: ../../rq/docs/Requirements.md
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# requirements-change
|
|
2
|
+
|
|
3
|
+
Use when: a requirement was added, changed or removed, or the behavior a test
|
|
4
|
+
shows changed, and the related requirements must be brought in line.
|
|
5
|
+
|
|
6
|
+
The formats and the rules every change keeps are in [Requirement files][RF], and
|
|
7
|
+
what `rq` does with them in [Requirements][RM]; how to write the documents, and
|
|
8
|
+
which changes go through the commands, is in [requirements-authoring][RA].
|
|
9
|
+
|
|
10
|
+
## Find the related nodes
|
|
11
|
+
|
|
12
|
+
For the changed requirement:
|
|
13
|
+
|
|
14
|
+
- parents - `rq backlinks <file> --json`;
|
|
15
|
+
- children - `rq links <file> --json`;
|
|
16
|
+
- siblings - `rq links` of each parent: the other children, which may now
|
|
17
|
+
overlap with it or leave a gap.
|
|
18
|
+
|
|
19
|
+
## Update them
|
|
20
|
+
|
|
21
|
+
1. Parents: check that their statements are still fully covered. When the change
|
|
22
|
+
narrowed the requirement, cover the rest with another requirement or test
|
|
23
|
+
(`rq add requirement`, `rq add test`, `rq link`); when it widened it, narrow
|
|
24
|
+
the text of the parent or a sibling so that no statement is implemented twice
|
|
25
|
+
in contradicting ways.
|
|
26
|
+
2. Children: check that each still implements a statement of the changed
|
|
27
|
+
requirement. Edit the text of the ones that implement an old statement, `rq
|
|
28
|
+
unlink` the ones that implement none, and add requirements or tests for
|
|
29
|
+
statements nothing covers.
|
|
30
|
+
3. Test: when the behavior changed, edit the steps so that they show the new
|
|
31
|
+
behavior. Leave the results to `rq test` and `rq log`.
|
|
32
|
+
4. Repeat for every node that changed, until a pass changes nothing.
|
|
33
|
+
5. A removed requirement: `rq remove <file>`, with `--recursive` to remove what
|
|
34
|
+
only it links to, then check its former parents as in step 1.
|
|
35
|
+
6. A renamed or moved requirement: `rq move <file> <destination>`, which
|
|
36
|
+
rewrites the links to it.
|
|
37
|
+
|
|
38
|
+
## Verify
|
|
39
|
+
|
|
40
|
+
Run `rq check`, then `rq test <path>` and `rq coverage <path>` on the roots, or
|
|
41
|
+
`rq test <id> --recurse` and `rq coverage <id> --recurse` on the highest
|
|
42
|
+
requirement that changed. Every structure error, failed test and uncovered
|
|
43
|
+
statement is a remaining inconsistency; fix it or report it with the reason. For
|
|
44
|
+
an incomplete coverage, follow [requirements-coverage][RC], which works from the
|
|
45
|
+
analysis in the requirement's `## Coverage` section.
|
|
46
|
+
|
|
47
|
+
[RC]: requirements-coverage.md
|
|
48
|
+
|
|
49
|
+
[RA]: requirements-authoring.md
|
|
50
|
+
[RF]: <../../rq/docs/Requirement files.md>
|
|
51
|
+
[RM]: ../../rq/docs/Requirements.md
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# requirements-coverage
|
|
2
|
+
|
|
3
|
+
Use when: checking whether requirements are fully covered, or closing the gaps
|
|
4
|
+
`rq coverage` reports - a requirement whose `Coverage` is `INCOMPLETE`.
|
|
5
|
+
|
|
6
|
+
The formats and the rules every change keeps are in [Requirement files][RF], and
|
|
7
|
+
what `rq` does with them in [Requirements][RM]; how to write requirements and
|
|
8
|
+
tests, and which changes go through the commands, is in
|
|
9
|
+
[requirements-authoring][RA].
|
|
10
|
+
|
|
11
|
+
## Check
|
|
12
|
+
|
|
13
|
+
1. Run `rq coverage <id> --recurse` on the highest requirement that changed, or
|
|
14
|
+
`rq coverage <folder>` for all. An agent judges each requirement and records
|
|
15
|
+
the verdict in `- Coverage:` of its `## Status`, and the reasons in its `##
|
|
16
|
+
Coverage` section. It costs one agent call per requirement, so check what
|
|
17
|
+
changed rather than everything.
|
|
18
|
+
2. List what is left: `rq list <folder> --json`, the requirements whose
|
|
19
|
+
`coverage` is `INCOMPLETE` or `null` (never checked).
|
|
20
|
+
|
|
21
|
+
## Close a gap
|
|
22
|
+
|
|
23
|
+
For each incomplete requirement, read its `## Coverage` section: it names each
|
|
24
|
+
statement nothing covers and what would cover it. Then, as it suggests:
|
|
25
|
+
|
|
26
|
+
- a missing test - `rq add test <requirement> "<name>" --description "<what it
|
|
27
|
+
shows>"` with steps that check exactly the uncovered statement, then `rq test
|
|
28
|
+
<test>`;
|
|
29
|
+
- a missing sub-requirement - `rq add requirement <requirement> "<name>"
|
|
30
|
+
--statement "<statement>"`, then cover the new requirement in turn;
|
|
31
|
+
- an existing requirement or test that covers it but is not linked - `rq link
|
|
32
|
+
<requirement> <node>`, keeping one parent per requirement;
|
|
33
|
+
- a statement no one should implement, or one stated twice - edit the
|
|
34
|
+
requirement's text so that it says what is meant.
|
|
35
|
+
|
|
36
|
+
Do not edit `## Coverage` or `## Status` by hand: `rq coverage` rewrites both.
|
|
37
|
+
Re-run `rq coverage <id>` on the requirement, and `rq test <id> --recurse` when
|
|
38
|
+
tests were added, until it is `COMPLETE`.
|
|
39
|
+
|
|
40
|
+
## Read a complete verdict
|
|
41
|
+
|
|
42
|
+
A `COMPLETE` requirement's `## Coverage` says which link covers each statement.
|
|
43
|
+
Use it to review the decomposition: a link that covers no statement can be
|
|
44
|
+
unlinked, and a statement covered only by a vague test deserves a sharper one.
|
|
45
|
+
|
|
46
|
+
[RA]: requirements-authoring.md
|
|
47
|
+
[RF]: <../../rq/docs/Requirement files.md>
|
|
48
|
+
[RM]: ../../rq/docs/Requirements.md
|