thurview 0.17.1 → 0.18.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.
- package/README.md +43 -43
- package/dist/cli.js +23 -222
- package/dist/cli.js.map +1 -1
- package/dist/coverage.js +53 -148
- package/dist/coverage.js.map +1 -1
- package/dist/document/compile.js +51 -43
- package/dist/document/compile.js.map +1 -1
- package/dist/document/schema.js +25 -13
- package/dist/document/schema.js.map +1 -1
- package/dist/git.js +29 -0
- package/dist/git.js.map +1 -1
- package/dist/interfaces.js +7 -244
- package/dist/interfaces.js.map +1 -1
- package/dist/ui/app.css +29 -10
- package/dist/ui/app.js +169 -192
- package/dist/ui/app.js.map +3 -3
- package/package.json +1 -12
- package/skills/thurview/SKILL.md +32 -34
- package/skills/thurview/references/components.md +45 -22
- package/skills/thurview/references/document-authoring.md +22 -26
- package/skills/thurview/references/searching.md +74 -0
- package/skills/thurview-design/SKILL.md +17 -14
- package/skills/thurview-design/references/anchors-and-proposals.md +11 -9
- package/skills/thurview-explain/SKILL.md +44 -31
- package/skills/thurview-fix/SKILL.md +47 -42
- package/dist/graph.js +0 -568
- package/dist/graph.js.map +0 -1
|
@@ -62,10 +62,11 @@ Read the guidance files that exist, in this order; the second wins on conflict.
|
|
|
62
62
|
`thurview explain` lists the ones it found under `guidance`.
|
|
63
63
|
|
|
64
64
|
The `thurview` skill ships the references this one shares - document authoring,
|
|
65
|
-
components, software map, theme, lifecycle. `thurview skill` prints the path of
|
|
65
|
+
components, software map, searching the code, theme, lifecycle. `thurview skill` prints the path of
|
|
66
66
|
every bundled SKILL.md; the references sit beside each one. Read **Document
|
|
67
67
|
authoring** before you write `review.md`, **Components** before you edit
|
|
68
|
-
`data.yaml`, **Software map** before you author `map.yaml`, **
|
|
68
|
+
`data.yaml`, **Software map** before you author `map.yaml`, **Searching the
|
|
69
|
+
code** before you look for callers, tests or importers, **Theme** before you
|
|
69
70
|
write `theme.yaml`, and **Lifecycle** for statuses, storage and thread rules -
|
|
70
71
|
they are identical for all three kinds.
|
|
71
72
|
|
|
@@ -86,8 +87,7 @@ thurview explain --commit v1.2.0 # a released commit rather than HEAD
|
|
|
86
87
|
|
|
87
88
|
The positional argument is a path or a glob; a bare path means that directory
|
|
88
89
|
and everything under it. It is the **scope**, and everything else obeys it:
|
|
89
|
-
|
|
90
|
-
every file inside it. A scope that matches no file at that commit is refused.
|
|
90
|
+
your searches stay inside it, and coverage accounts for every file inside it. A scope that matches no file at that commit is refused.
|
|
91
91
|
|
|
92
92
|
Record `explainer.id`, `explainer.dir`, `explainer.commit`, `explainer.scope`
|
|
93
93
|
and `scale.filesInScope` from the output. Everywhere else the id is passed as
|
|
@@ -103,10 +103,12 @@ misleading about architecture, which is the one thing an explainer must not be.
|
|
|
103
103
|
So work in three layers, and let each carry what it is good at.
|
|
104
104
|
|
|
105
105
|
1. **System — the map carries breadth.** Author `map.yaml` first, seeded from
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
the code: the directories in scope become candidate nodes and their files
|
|
107
|
+
the node's `files` globs, and what imports what between them becomes the
|
|
108
|
+
edges. `git ls-tree -d -r --name-only <commit> -- <scope>` lists the
|
|
109
|
+
directories; the `thurview` skill's Searching the code reference has the
|
|
110
|
+
import recipes. Every part of the scope should appear here, including the
|
|
111
|
+
parts the prose will not reach. See the `thurview` skill's Software map
|
|
110
112
|
reference for the shape.
|
|
111
113
|
2. **Subsystem — the prose carries depth.** Pick the parts that carry the most
|
|
112
114
|
structure and the most traffic, and explain those. Three to six sections.
|
|
@@ -114,27 +116,37 @@ So work in three layers, and let each carry what it is good at.
|
|
|
114
116
|
3. **File and symbol — anchors carry the proof.** Every claim gets an anchor.
|
|
115
117
|
The reader opens code where they want it and nowhere else.
|
|
116
118
|
|
|
117
|
-
**Select by structure, not by taste, and say what you selected on.**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
"the two
|
|
122
|
-
|
|
119
|
+
**Select by structure, not by taste, and say what you selected on.** Your
|
|
120
|
+
searches give you the basis: how many files a part holds, which of its names
|
|
121
|
+
the rest of the scope references most, and how many places one part imports
|
|
122
|
+
another. Say in the document which parts you took and why they were the ones -
|
|
123
|
+
"the two parts that import each other most" is a reason a reader can check,
|
|
124
|
+
with the searches that counted it in `searches`. "The interesting bits" is not.
|
|
123
125
|
|
|
124
126
|
## Coverage is derived, not claimed
|
|
125
127
|
|
|
126
128
|
`thurview publish` accounts for every file in scope at the pinned commit and
|
|
127
|
-
puts one of
|
|
129
|
+
puts one of four states on it, from what you did that it can check:
|
|
128
130
|
|
|
129
131
|
- **explained** - an anchor in the document points into the file.
|
|
130
132
|
- **placed** - a map node's `files` globs match it, and no anchor does. The
|
|
131
133
|
reader is told where it sits, not what it does.
|
|
132
|
-
- **
|
|
134
|
+
- **searched** - a search you recorded under `searches` in `data.yaml` matched
|
|
135
|
+
it, and nothing above did. You saw lines of it; the document says nothing
|
|
136
|
+
about it.
|
|
137
|
+
- **not examined** - none of the above.
|
|
138
|
+
|
|
139
|
+
Record the searches you ran - for callers, tests, importers - under `searches`,
|
|
140
|
+
each with its `pattern`, optional `paths` and a `why`. `publish` re-runs every
|
|
141
|
+
one with `git grep -E` at the pinned commit, so what it counts is what the
|
|
142
|
+
commit holds, not what you remember, and a search that matched nothing is shown
|
|
143
|
+
as the zero it is. The shape is in the `thurview` skill's Components reference,
|
|
144
|
+
the recipes in its Searching the code reference.
|
|
133
145
|
|
|
134
146
|
The counts go above the document and onto the Coverage tab, and `publish`
|
|
135
147
|
prints them with the files it did not examine. You cannot forget to state
|
|
136
148
|
coverage, and you cannot overstate it: to move a file out of _not examined_ you
|
|
137
|
-
have to actually anchor it
|
|
149
|
+
have to actually anchor it, place it on the map, or search it.
|
|
138
150
|
|
|
139
151
|
Two consequences worth planning for:
|
|
140
152
|
|
|
@@ -145,12 +157,9 @@ Two consequences worth planning for:
|
|
|
145
157
|
globs it owns and how many files they match, so `**/*` on one node inflates
|
|
146
158
|
nothing quietly.
|
|
147
159
|
|
|
148
|
-
Coverage
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
from the structure, not empty. If a large part of the scope is outside the
|
|
152
|
-
graph, say so in the document rather than letting the map imply the system is
|
|
153
|
-
smaller than it is.
|
|
160
|
+
Coverage is the same for every language: it counts files at the commit, so a
|
|
161
|
+
config file, a stylesheet or a language nothing parses is accounted for like
|
|
162
|
+
any other.
|
|
154
163
|
|
|
155
164
|
## Surface structure; do not grade it
|
|
156
165
|
|
|
@@ -160,7 +169,8 @@ the reader can **detect** design problems. That is only consistent with the
|
|
|
160
169
|
thesis if you surface structure and leave the conclusion to them.
|
|
161
170
|
|
|
162
171
|
The test: **every fact in an explainer is a count, or a list of named things,
|
|
163
|
-
at the pinned commit, that the reader could re-derive with `
|
|
172
|
+
at the pinned commit, that the reader could re-derive with `git grep` or
|
|
173
|
+
`git ls-tree`.**
|
|
164
174
|
|
|
165
175
|
Observation - write these:
|
|
166
176
|
|
|
@@ -169,7 +179,8 @@ Observation - write these:
|
|
|
169
179
|
- "The API layer reaches the database layer in 14 places and the model layer in
|
|
170
180
|
2; the model layer reaches the API layer in 6."
|
|
171
181
|
- "Nothing in the scope references `legacy/` at this commit."
|
|
172
|
-
- "No test file
|
|
182
|
+
- "No test file names anything in `src/store`." (a count of zero, stated as
|
|
183
|
+
one, with the search that found it)
|
|
173
184
|
|
|
174
185
|
Judgement - never write these:
|
|
175
186
|
|
|
@@ -188,11 +199,12 @@ the code" - not a finding.
|
|
|
188
199
|
## Workflow
|
|
189
200
|
|
|
190
201
|
1. `thurview explain [<scope>]`. Note the id, the commit and the scope.
|
|
191
|
-
2.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
202
|
+
2. Survey the scope at the pinned commit: its directories and files
|
|
203
|
+
(`git ls-tree`), then what imports what between them and who calls the
|
|
204
|
+
names that recur, with the `git grep` recipes in the `thurview` skill's
|
|
205
|
+
Searching the code reference. Record each search that shapes what you write
|
|
206
|
+
under `searches` in `data.yaml`.
|
|
207
|
+
3. Author `map.yaml` from that survey, covering the whole scope.
|
|
196
208
|
Dispatch a sub-agent for it if you have one, exactly as the `thurview`
|
|
197
209
|
skill's review does.
|
|
198
210
|
4. Author `review.md` and `data.yaml` per **Document authoring**, minus the
|
|
@@ -202,7 +214,8 @@ the code" - not a finding.
|
|
|
202
214
|
`graph: base` on an anchor - there is one commit.
|
|
203
215
|
5. `theme.yaml` as usual - see **Theme**.
|
|
204
216
|
6. `thurview publish --review <id>`. Read `coverage` and `notExamined`. If the
|
|
205
|
-
split is not the one you meant, anchor or
|
|
217
|
+
split is not the one you meant, anchor, place or search more and publish
|
|
218
|
+
again.
|
|
206
219
|
7. `thurview open --review <id>`, then `thurview wait --review <id>`. The loop,
|
|
207
220
|
the statuses and the thread rules are identical to a review; see
|
|
208
221
|
**Lifecycle**.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: thurview-fix
|
|
3
|
-
description: Review a change and fix what the review finds - bugs, regressions for callers, missing or broken tests, security issues - with
|
|
3
|
+
description: Review a change and fix what the review finds - bugs, regressions for callers, missing or broken tests, security issues - with a search of the callers and tests a diff does not show. Commits only the fixes that pass the repository's own tests and lint, and reports the rest. Use when the user asks to review and fix a branch, a commit range or a pull or merge request, to find and fix bugs in a change, or invokes /thurview-fix.
|
|
4
4
|
user-invocable: true
|
|
5
5
|
argument-hint: "[<branch> | <base>..<head> | <PR or MR number or URL>] [--post]"
|
|
6
6
|
---
|
|
@@ -8,12 +8,12 @@ argument-hint: "[<branch> | <base>..<head> | <PR or MR number or URL>] [--post]"
|
|
|
8
8
|
# thurview-fix
|
|
9
9
|
|
|
10
10
|
Review a change, fix what you are sure of, report the rest. The diff shows what
|
|
11
|
-
changed;
|
|
12
|
-
change breaks code the diff never shows.
|
|
11
|
+
changed; a search of the code around it shows what depends on it, which is
|
|
12
|
+
where a change breaks code the diff never shows.
|
|
13
13
|
|
|
14
14
|
```mermaid
|
|
15
15
|
flowchart LR
|
|
16
|
-
A[Scope: pin base and head] --> B[
|
|
16
|
+
A[Scope: pin base and head] --> B[Search: who reaches the change]
|
|
17
17
|
B --> C[Findings]
|
|
18
18
|
C --> D[Fix, then the repo's tests and lint]
|
|
19
19
|
D -->|green| E[One fix commit]
|
|
@@ -42,49 +42,53 @@ $ARGUMENTS
|
|
|
42
42
|
## 1. Scope
|
|
43
43
|
|
|
44
44
|
Start from a clean tree (`git status --porcelain` prints nothing), otherwise
|
|
45
|
-
ask: the fixes get committed. Check out the head, then pin both commits
|
|
46
|
-
one graph call:
|
|
45
|
+
ask: the fixes get committed. Check out the head, then pin both commits:
|
|
47
46
|
|
|
48
|
-
| Request | Check out |
|
|
49
|
-
| ------------------ | ---------------------------------------------- |
|
|
50
|
-
| empty | the current branch | `
|
|
51
|
-
| a branch | `git switch <branch>` | `
|
|
52
|
-
| `<base>..<head>` | the branch at `<head>` | `
|
|
53
|
-
| a PR or MR ref/URL | `gh pr checkout <n>` or `glab mr checkout <n>` | `
|
|
47
|
+
| Request | Check out | Base |
|
|
48
|
+
| ------------------ | ---------------------------------------------- | ------------------------------------- |
|
|
49
|
+
| empty | the current branch | `git merge-base origin/HEAD HEAD` |
|
|
50
|
+
| a branch | `git switch <branch>` | `git merge-base origin/HEAD HEAD` |
|
|
51
|
+
| `<base>..<head>` | the branch at `<head>` | `git rev-parse <base>` |
|
|
52
|
+
| a PR or MR ref/URL | `gh pr checkout <n>` or `glab mr checkout <n>` | `git merge-base origin/<target> HEAD` |
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
`change.baseBranch
|
|
54
|
+
Head is `git rev-parse HEAD`, taken now. For a change request,
|
|
55
|
+
`thurview forge status --change <ref>` names `<target>` as
|
|
56
|
+
`change.baseBranch`; when `origin/HEAD` is unset, use the trunk branch by name.
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
not move what you are reviewing.
|
|
58
|
+
Write both full shas down and use them, not `HEAD`, in every later command, so
|
|
59
|
+
your fix commit does not move what you are reviewing.
|
|
62
60
|
|
|
63
|
-
## 2.
|
|
61
|
+
## 2. Search what the change reaches
|
|
62
|
+
|
|
63
|
+
List what changed, then find what the diff does not show, at the pins, with
|
|
64
|
+
the recipes in the `thurview` skill's Searching the code reference
|
|
65
|
+
(`thurview skill` prints its path):
|
|
64
66
|
|
|
65
67
|
```sh
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
git diff --stat <base> <head> # the files
|
|
69
|
+
git diff <base> <head> # the change
|
|
70
|
+
git grep -n -E -e '\bname *\(' <head> -- # who calls a changed symbol now
|
|
71
|
+
git grep -n -E -e '\bname *\(' <base> -- # who called it before; a removed one's callers are only here
|
|
72
|
+
git grep -n -E -e '\bname\b' <head> -- '*test*' '*spec*' # which tests name it
|
|
70
73
|
```
|
|
71
74
|
|
|
72
|
-
What to
|
|
75
|
+
What to look for:
|
|
73
76
|
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
- **Callers the change left alone.** For every function, method, type or
|
|
78
|
+
export whose signature or behaviour the diff changed, search its callers at
|
|
79
|
+
head and drop the ones the diff itself touched. What is left is what the
|
|
80
|
+
author may have forgotten: read each call site against the new behaviour.
|
|
81
|
+
This is the finding a diff cannot give you.
|
|
82
|
+
- **Removed or renamed interfaces.** Search the old name at head: any hit is
|
|
83
|
+
a caller the change broke.
|
|
84
|
+
- **Untested reach.** A changed symbol, or a caller of one, that no test names
|
|
85
|
+
has nothing to catch a break there.
|
|
86
|
+
- **What a search misses.** A text search finds names, not meaning: a call
|
|
87
|
+
through a variable, a re-export or a string-built name escapes it. "No
|
|
88
|
+
callers" is only as true as the forms you searched; say which when a finding
|
|
89
|
+
rests on it.
|
|
86
90
|
|
|
87
|
-
Then read
|
|
91
|
+
Then read every call site the searches name.
|
|
88
92
|
|
|
89
93
|
## 3. Findings
|
|
90
94
|
|
|
@@ -95,8 +99,9 @@ For each one, record:
|
|
|
95
99
|
`medium` (a likely bug, or a risky path no test reaches), `low` (real but
|
|
96
100
|
narrow)
|
|
97
101
|
- why, in one line
|
|
98
|
-
- the
|
|
99
|
-
`
|
|
102
|
+
- the search evidence when there is some: the search and the hit, e.g.
|
|
103
|
+
`git grep -n -E -e '\bdiscount *\(' <head>` → `src/cart.js:5`, no test names
|
|
104
|
+
it
|
|
100
105
|
|
|
101
106
|
Security means input crossing a trust boundary: a shell command, query or path
|
|
102
107
|
built from it, a secret reaching a log, an authorization check the change
|
|
@@ -133,9 +138,9 @@ git commit -m "fix: address review findings" -m "<one line per fix: file:line -
|
|
|
133
138
|
|
|
134
139
|
## 5. Report
|
|
135
140
|
|
|
136
|
-
One table - severity, `file:line`, the finding, its
|
|
137
|
-
commit or why it is unfixed - then the tests and lint after the commit, and
|
|
138
|
-
what the
|
|
141
|
+
One table - severity, `file:line`, the finding, its search evidence, and the
|
|
142
|
+
fix commit or why it is unfixed - then the tests and lint after the commit, and
|
|
143
|
+
what the searches could not see. Do not push; offer to.
|
|
139
144
|
|
|
140
145
|
## 6. Post, with `--post` only
|
|
141
146
|
|