thurview 0.7.0 → 0.8.1

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": "thurview",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "description": "Guided, evidence-anchored reviews of agent-written code. A coding agent authors the review; you read, ask, comment and decide in the browser.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,12 +1,24 @@
1
1
  ---
2
2
  name: thurview
3
- description: Author and publish a thurview review - a guided, evidence-anchored explanation of a branch, pull request or commit range that the reader opens in the browser, annotates, asks questions about, and approves or sends back. Use when the user asks to review a branch or PR, to explain or walk through a change, "review my branch against main", to explain how a codebase or subsystem works, or invokes /thurview. Not for a pass/fail bug hunt.
3
+ description: Author and publish a thurview document - a guided, evidence-anchored explanation the reader opens in the browser, annotates, asks questions about, and approves or sends back. Two kinds: a review of a branch, pull request or commit range, and a code explainer of a whole codebase or one subsystem at a pinned commit. Use when the user asks to review a branch or PR, to explain or walk through a change, "review my branch against main", to explain how a codebase or subsystem works or where its design problems might be, or invokes /thurview. Not for a pass/fail bug hunt.
4
4
  user-invocable: true
5
- argument-hint: "[<pr-number|pr-url> | --base <ref> --head <ref> | <architecture topic>]"
5
+ argument-hint: "[<pr-number|pr-url> | --base <ref> --head <ref> | explain [<path>]]"
6
6
  ---
7
7
 
8
8
  # thurview
9
9
 
10
+ There are two kinds of document, and the first decision is which one the
11
+ request asks for.
12
+
13
+ - A **review** explains a CHANGE: a branch, a pull request, a commit range. It
14
+ has a diff, commits and an interface delta, and the reader approves it or
15
+ sends it back. Everything below describes it.
16
+ - A **code explainer** explains a CODEBASE, or one subsystem, at a single
17
+ pinned commit, so the reader can see the architecture well enough to spot
18
+ design problems themselves. It has no diff and nothing to approve, and it
19
+ states what it did not examine. Read
20
+ [Code explainer](references/code-explainer.md) and follow that instead.
21
+
10
22
  The agent studies the change and writes a short document in which every claim
11
23
  about code is anchored to an exact file and line range at a pinned commit.
12
24
  thurview validates those anchors, seals a revision, and serves it in the
@@ -41,9 +53,11 @@ directory; `thurview <command> --help` shows flags and examples.
41
53
 
42
54
  $ARGUMENTS
43
55
 
44
- Empty: the current branch against its up-to-date trunk. A PR number or URL:
45
- that pull request. `--base`/`--head`: that range. Anything else: an
46
- architecture review of that topic in the current repository.
56
+ Empty: a review of the current branch against its up-to-date trunk. A PR
57
+ number or URL: that pull request. `--base`/`--head`: that range. `explain`, or
58
+ a request to explain the codebase, a subsystem or its architecture rather than
59
+ a change: a code explainer, per
60
+ [Code explainer](references/code-explainer.md).
47
61
 
48
62
  ## Before authoring
49
63
 
@@ -60,7 +74,8 @@ Read [Components](references/components.md) before you edit `data.yaml` or add
60
74
  a fenced component. Read [Lifecycle](references/lifecycle.md) for statuses,
61
75
  storage and thread rules. Read [Software map](references/software-map.md)
62
76
  before you author `map.yaml`. Read [Theme](references/theme.md) before you
63
- write `theme.yaml`.
77
+ write `theme.yaml`. Read [Code explainer](references/code-explainer.md) when
78
+ the request is a codebase rather than a change.
64
79
 
65
80
  ## Workflow
66
81
 
@@ -281,12 +296,17 @@ Then publish again (step 7), tell the user what changed since the previous
281
296
  revision in a line or two, and wait again (step 9). A republish requires zero
282
297
  open submitted comment threads; questions do not block.
283
298
 
284
- ## Architecture reviews
299
+ ## Explaining a codebase rather than a change
300
+
301
+ Do not pin the same commit as base and head to fake it. That leaves a review
302
+ whose Files, Commits and interface-delta surfaces all describe a change that
303
+ does not exist, which is a claim, not a gap.
285
304
 
286
- Pin the same commit as base and head: `thurview scaffold --base HEAD --head
287
- HEAD`. Choose sections that describe the system (data flows, state, storage,
288
- module boundaries) and skip diff-specific ones. Scope to one subsystem. All
289
- other steps are the same; the Files tab shows any file at head on request.
305
+ Run `thurview explain [<path>]` instead and follow
306
+ [Code explainer](references/code-explainer.md). It is the same loop - pin,
307
+ author, publish, wait, answer - over a document kind whose unit is a codebase:
308
+ no diff, no commits, no interface delta, and a Coverage tab stating what the
309
+ document reached and what it did not.
290
310
 
291
311
  ## Completion criteria
292
312
 
@@ -0,0 +1,166 @@
1
+ # Code explainer
2
+
3
+ A **review** explains a change. An **explainer** explains a codebase, or one
4
+ subsystem of it, at a single pinned commit, so the reader can see the
5
+ architecture well enough to spot design problems themselves.
6
+
7
+ Same engine, different unit. It shares anchors, peeks, the map, threads,
8
+ revisions and the publish → wait → answer loop. It has no diff, no commits and
9
+ no interface delta, because those are claims about a change and there is no
10
+ change. Where a review shows the interface delta, an explainer shows
11
+ **coverage**: what it examined at that commit, and what it did not.
12
+
13
+ | Tab | Review | Explainer |
14
+ | ------------- | ---------------------------------- | --------------------------------------------- |
15
+ | Review | the walkthrough, with the delta | **Explainer**: the document, with coverage |
16
+ | Files | split diff of the changed files | absent |
17
+ | Commits | base..head | absent |
18
+ | Map | parts, marked added/changed/removed | parts at the pinned commit |
19
+ | Coverage | absent | **what the document reached, and what it did not** |
20
+ | Threads | ask, comment, decide | same, and the decision reads *Done reading* / *Send it back* |
21
+
22
+ ## When to write one
23
+
24
+ Write an explainer when the request is about the code as it stands: "explain
25
+ this codebase", "how does the server work", "walk me through `src/graph`",
26
+ "I want to see the architecture". Write a review when the request is about a
27
+ change: a branch, a pull request, a range.
28
+
29
+ If the request is a change, do not reach for an explainer because the change is
30
+ large. A large change is still a change.
31
+
32
+ ## The document kind, in one command
33
+
34
+ ```sh
35
+ thurview explain # the whole repository at HEAD
36
+ thurview explain src/server # one subsystem
37
+ thurview explain --commit v1.2.0 # a released commit rather than HEAD
38
+ ```
39
+
40
+ The positional argument is a path or a glob; a bare path means that directory
41
+ and everything under it. It is the **scope**, and everything else obeys it:
42
+ `graph architecture` reports the clusters inside it, and coverage accounts for
43
+ every file inside it. A scope that matches no file at that commit is refused.
44
+
45
+ Record `explainer.id`, `explainer.dir`, `explainer.commit`, `explainer.scope`
46
+ and `scale.filesInScope` from the output. Everywhere else the id is passed as
47
+ `--review <id>`; that flag names a document, whichever kind it is.
48
+
49
+ ## Keeping it short without lying about it
50
+
51
+ A review is bounded by its diff. A codebase is not, and this is the hard part:
52
+ evidence-anchored prose over a whole repository either runs unreadably long or
53
+ quietly leaves most of the system out. Prose that leaves things out silently is
54
+ misleading about architecture, which is the one thing an explainer must not be.
55
+
56
+ So work in three layers, and let each carry what it is good at.
57
+
58
+ 1. **System — the map carries breadth.** Author `map.yaml` first, seeded from
59
+ `thurview graph architecture --review <id>`: communities become nodes, their
60
+ files become the node's `files` globs, and the edges between communities
61
+ become edges. Every part of the scope should appear here, including the parts
62
+ the prose will not reach. See [Software map](software-map.md) for the shape.
63
+ 2. **Subsystem — the prose carries depth.** Pick the parts that carry the most
64
+ structure and the most traffic, and explain those. Three to six sections.
65
+ Everything else stays on the map.
66
+ 3. **File and symbol — anchors carry the proof.** Every claim gets an anchor.
67
+ The reader opens code where they want it and nowhere else.
68
+
69
+ **Select by structure, not by taste, and say what you selected on.** The graph
70
+ gives you the basis: cluster size in files and symbols, the hub symbols of each
71
+ cluster (most referenced), and the reference counts on the edges between
72
+ clusters. Say in the document which parts you took and why they were the ones -
73
+ "the two clusters with the most traffic between them" is a reason a reader can
74
+ check. "The interesting bits" is not.
75
+
76
+ ## Coverage is derived, not claimed
77
+
78
+ `thurview publish` accounts for every file in scope at the pinned commit and
79
+ puts one of three states on it:
80
+
81
+ - **explained** - an anchor in the document points into the file.
82
+ - **placed** - a map node's `files` globs match it, and no anchor does. The
83
+ reader is told where it sits, not what it does.
84
+ - **not examined** - neither.
85
+
86
+ The counts go above the document and onto the Coverage tab, and `publish`
87
+ prints them with the files it did not examine. You cannot forget to state
88
+ coverage, and you cannot overstate it: to move a file out of *not examined* you
89
+ have to actually anchor it or actually place it on the map.
90
+
91
+ Two consequences worth planning for:
92
+
93
+ - **An explainer without a map counts everything the prose does not anchor as
94
+ not examined.** `publish` warns when there is no map. That is a true
95
+ statement, and usually not the one you want to make: author the map.
96
+ - **A broad glob is visible.** The Coverage tab lists each map node with the
97
+ globs it owns and how many files they match, so `**/*` on one node inflates
98
+ nothing quietly.
99
+
100
+ Coverage also states what the code graph could not read: files in languages it
101
+ does not parse (`thurview graph` covers TypeScript, JavaScript, Python, Go,
102
+ Rust and Java), and whether its file list was capped. Those files are absent
103
+ from the structure, not empty. If a large part of the scope is outside the
104
+ graph, say so in the document rather than letting the map imply the system is
105
+ smaller than it is.
106
+
107
+ ## Surface structure; do not grade it
108
+
109
+ thurview's thesis holds here: *it does not review the code for you; it helps
110
+ you understand it fast enough to review it yourself.* An explainer exists so
111
+ the reader can **detect** design problems. That is only consistent with the
112
+ thesis if you surface structure and leave the conclusion to them.
113
+
114
+ The test: **every fact in an explainer is a count, or a list of named things,
115
+ at the pinned commit, that the reader could re-derive with `thurview graph`.**
116
+
117
+ Observation - write these:
118
+
119
+ - "`src/server` is referenced from four other parts; it references one."
120
+ - "`Store` is defined in `src/db.ts` and `src/cache.ts`."
121
+ - "The API layer reaches the database layer in 14 places and the model layer in
122
+ 2; the model layer reaches the API layer in 6."
123
+ - "Nothing in the scope references `legacy/` at this commit."
124
+ - "No test file reaches this cluster." (a count of zero, stated as one)
125
+
126
+ Judgement - never write these:
127
+
128
+ - "This violates separation of concerns."
129
+ - "The god object here should be split."
130
+ - severities, scores, "issues found", "critical", "smell", a ranked list of
131
+ problems, or a recommendation section.
132
+
133
+ The difference is not tone. "A module with 14 inbound dependencies" is
134
+ something the reader acts on; "an over-coupled module" is a verdict they cannot
135
+ check. When you are unsure, write the count and stop. If a structure genuinely
136
+ worries you, the honest move is a question in the document - "the two stores
137
+ both define `Session`; whether that is one concept or two is not visible from
138
+ the code" - not a finding.
139
+
140
+ ## Workflow
141
+
142
+ 1. `thurview explain [<scope>]`. Note the id, the commit and the scope.
143
+ 2. `thurview graph architecture --review <id>`. This is the structure at the
144
+ pinned commit; do not re-derive it by reading directories.
145
+ `thurview graph callers <name>` and `tests-for <name>` answer the follow-ups.
146
+ `graph interfaces` and `graph impact` compare two commits and are refused.
147
+ 3. Author `map.yaml` from the architecture output, covering the whole scope.
148
+ Dispatch a sub-agent for it if you have one, exactly as a review does.
149
+ 4. Author `review.md` and `data.yaml` per [Document authoring](document-authoring.md),
150
+ minus the interface-delta section: an explainer has none, and declaring
151
+ `interfaces` in `data.yaml` is an error. So is `graph: base` on an anchor -
152
+ there is one commit.
153
+ 5. `theme.yaml` as usual - see [Theme](theme.md).
154
+ 6. `thurview publish --review <id>`. Read `coverage` and `notExamined`. If the
155
+ split is not the one you meant, anchor or place more and publish again.
156
+ 7. `thurview open --review <id>`, then `thurview wait --review <id>`. The loop,
157
+ the statuses and the thread rules are identical to a review; see
158
+ [Lifecycle](lifecycle.md).
159
+
160
+ ## Hand over
161
+
162
+ In a few lines: the url, the scope and the commit, the coverage line in its own
163
+ words (including how many files were not examined), which parts you chose to
164
+ explain and on what basis, and that you are waiting for their questions. Do not
165
+ list the design problems you think you saw. The document is built so the reader
166
+ finds them.