@igorlau/dotagents 1.0.19 → 1.0.20
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 +10 -4
- package/dist/build-info.json +1 -1
- package/package.json +1 -1
- package/plugin/agents/dot-implementer.md +2 -0
- package/plugin/agents/dot-reviewer.md +16 -4
- package/plugin/skills/dot-flow/SKILL.md +37 -7
- package/plugin/skills/dot-flow/references/fix-round.md +64 -0
- package/plugin/skills/dot-flow/references/inline.md +3 -3
- package/plugin/skills/dot-stack-review/SKILL.md +116 -0
- package/plugin/skills/dot-stack-review/agents/openai.yaml +5 -0
- package/plugin/skills/dot-stack-review/scripts/page.mjs +364 -0
package/README.md
CHANGED
|
@@ -110,13 +110,18 @@ sequenceDiagram
|
|
|
110
110
|
Main->>Main: Run the tests of the reply
|
|
111
111
|
Main->>Agents: 3. Review (dot-reviewer)
|
|
112
112
|
Agents-->>Main: Findings
|
|
113
|
-
|
|
113
|
+
loop At most 2 automatic rounds, until a stop rule fires
|
|
114
|
+
Main->>Agents: Steps 1 to 3 again for the high and medium findings
|
|
115
|
+
Agents-->>Main: Status of each finding, and new findings
|
|
116
|
+
end
|
|
117
|
+
Main-->>User: Round history and findings
|
|
114
118
|
break A blocker, or a check that differs from the reply
|
|
115
119
|
Main-->>User: Stop. The files stay as they are.
|
|
116
120
|
end
|
|
117
121
|
opt Fix
|
|
118
122
|
User->>Main: Fix these findings
|
|
119
|
-
Main->>Agents: Steps 1 to 3 again
|
|
123
|
+
Main->>Agents: Steps 1 to 3 again, or only step 1 on the light path
|
|
124
|
+
Main-->>User: Round history and findings
|
|
120
125
|
end
|
|
121
126
|
User->>Main: Accept
|
|
122
127
|
User->>Main: dot-commit
|
|
@@ -158,7 +163,7 @@ agreements, the smallest complete change from
|
|
|
158
163
|
[ponytail](https://github.com/DietrichGebert/ponytail), code comments, code
|
|
159
164
|
style, and writing.
|
|
160
165
|
|
|
161
|
-
The
|
|
166
|
+
The 15 skills in [`plugin/skills/`](plugin/skills/) load when a task needs
|
|
162
167
|
them:
|
|
163
168
|
|
|
164
169
|
| Skill | Purpose |
|
|
@@ -166,10 +171,11 @@ them:
|
|
|
166
171
|
| `dot-grilling` | Run an interview, in rounds of questions, that makes a plan clear. |
|
|
167
172
|
| `dot-plan` | Plan a change as small, verifiable steps, with requirements and entity schemas. |
|
|
168
173
|
| `dot-roadmap` | Split a plan into phases and tasks that each stand alone. |
|
|
169
|
-
| `dot-flow` | Take a roadmap task through code, tests, and review, verify each step, and stop for your decision
|
|
174
|
+
| `dot-flow` | Take a roadmap task through code, tests, and review, verify each step, fix the `high` and `medium` findings in automatic rounds, and stop for your decision. |
|
|
170
175
|
| `dot-testing` | Write tests with a makeSut factory, alone or after `dot-implement`. |
|
|
171
176
|
| `dot-implement` | Write the code of a change or roadmap task to the standards of the repository and the language. |
|
|
172
177
|
| `dot-code-review` | Review a diff for correctness bugs and maintainability problems. |
|
|
178
|
+
| `dot-stack-review` | Review the commits of a branch as an ordered stack of dependency layers. |
|
|
173
179
|
| `dot-comments` | Delete the comments in a diff that no exception protects. |
|
|
174
180
|
| `dot-commit` | Commit changes as small, logical commits. |
|
|
175
181
|
| `dot-debug` | Find the cause of a hard bug with a feedback loop. |
|
package/dist/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"commit":"
|
|
1
|
+
{"commit":"c2f6694"}
|
package/package.json
CHANGED
|
@@ -23,3 +23,5 @@ Write no tests, do not commit, and do not tick the roadmap checkbox.
|
|
|
23
23
|
## Output
|
|
24
24
|
|
|
25
25
|
End with the handoff of step 5 of `dot-implement`, and write nothing after it. The next step writes the tests.
|
|
26
|
+
|
|
27
|
+
On a run with **Findings**, end the handoff with the line `**Behavior change:** <yes | no>`. A behavior change is a change to what the code does for any input.
|
|
@@ -15,18 +15,30 @@ The prompt gives these fields:
|
|
|
15
15
|
|
|
16
16
|
- **Task**: the path of the roadmap task file. Check the change against its requirements and its "Out of scope" section. Also read the `## Requirements` section of the roadmap `README.md`. Check the change against every non-negotiable (`NN`) and against each business rule (`BR`) that the task names. Report a breached `NN` as a `high` finding.
|
|
17
17
|
- **Handoff**: the replies of the earlier steps.
|
|
18
|
-
- **
|
|
18
|
+
- **Since**: only on a delta review of a fix run, `<old-tree> <new-tree>`. Run `git diff <old-tree> <new-tree>`, and review only that diff. Still check the diff against every `NN` and each `BR` that the task names.
|
|
19
|
+
- **Earlier findings**: only on a fix run, the findings of the earlier review that the implementer fixed. Give each one a status:
|
|
20
|
+
- `fixed`: the problem is gone.
|
|
21
|
+
- `open`: the problem is still there.
|
|
22
|
+
- `regressed`: the fix made the problem worse, or moved it to other code.
|
|
23
|
+
|
|
24
|
+
Do not report an earlier finding again as a new finding.
|
|
19
25
|
|
|
20
26
|
When the task or the handoff is missing, stop and report it.
|
|
21
27
|
|
|
22
|
-
|
|
28
|
+
Without **Since**, the target is the uncommitted change: `git diff HEAD`, plus the untracked files that `git status --short` lists. Review the whole target.
|
|
29
|
+
|
|
30
|
+
Without **Earlier findings**, report every finding at every severity, so that no finding waits for a later round. With **Earlier findings**, on a full or a delta review, report only new `high` and `medium` findings.
|
|
23
31
|
|
|
24
|
-
Do not commit, and do not tick the roadmap checkbox.
|
|
32
|
+
Keep the code as it is. Delete each test that you write to prove a finding. Do not commit, and do not tick the roadmap checkbox.
|
|
25
33
|
|
|
26
34
|
## Output
|
|
27
35
|
|
|
28
|
-
Start the reply with this line,
|
|
36
|
+
Start the reply with this line. On a fix run, add the status of each earlier finding after it. Then give the report of `dot-code-review` with the new findings:
|
|
29
37
|
|
|
30
38
|
```markdown
|
|
31
39
|
**Highest severity:** <high | medium | low | none>
|
|
40
|
+
**Earlier findings:**
|
|
41
|
+
- <fixed | open | regressed>: <the summary of the finding>
|
|
32
42
|
```
|
|
43
|
+
|
|
44
|
+
The highest severity covers the new findings and the earlier findings that are `open` or `regressed`.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dot-flow
|
|
3
|
-
description: Take one roadmap task through implementation, tests, and review, and stop for your decision
|
|
3
|
+
description: Take one roadmap task through implementation, tests, and review, fix the high and medium findings in automatic rounds, and stop for your decision.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Flow
|
|
8
8
|
|
|
9
|
-
Take one task from a `dot-roadmap` roadmap through three steps: implementation, tests, and review. Each step runs in a fresh agent with one skill. You coordinate the steps, and you verify each reply with the commands that it names. The agents write the code, the tests, and the review. The user decides
|
|
9
|
+
Take one task from a `dot-roadmap` roadmap through three steps: implementation, tests, and review. Each step runs in a fresh agent with one skill. You coordinate the steps, and you verify each reply with the commands that it names. The agents write the code, the tests, and the review. The user decides at a stop.
|
|
10
10
|
|
|
11
11
|
## 1. Pin the task
|
|
12
12
|
|
|
@@ -28,7 +28,7 @@ Run the steps in this order. For each step, start a new agent of the named type,
|
|
|
28
28
|
| ---- | ----- | ------------- |
|
|
29
29
|
| 1. Implement | `dotagents:dot-implementer` | Task |
|
|
30
30
|
| 2. Test | `dotagents:dot-tester` | Task, Handoff: the reply of step 1 |
|
|
31
|
-
| 3. Review | `dotagents:dot-reviewer` | Task, Handoff: the replies of steps 1 and 2,
|
|
31
|
+
| 3. Review | `dotagents:dot-reviewer` | Task, Handoff: the replies of steps 1 and 2, Since and Earlier findings: only on a fix run |
|
|
32
32
|
|
|
33
33
|
Write the prompt as labeled fields, and leave out a field that the step does not take:
|
|
34
34
|
|
|
@@ -37,7 +37,10 @@ Write the prompt as labeled fields, and leave out a field that the step does not
|
|
|
37
37
|
**Handoff:**
|
|
38
38
|
<the replies of the earlier steps, unchanged>
|
|
39
39
|
**Findings:**
|
|
40
|
-
<the findings
|
|
40
|
+
<the findings to fix, unchanged>
|
|
41
|
+
**Since:** <old-tree> <new-tree>
|
|
42
|
+
**Earlier findings:**
|
|
43
|
+
<the findings that the round sent to fix and the light-fixed findings, unchanged>
|
|
41
44
|
```
|
|
42
45
|
|
|
43
46
|
Copy the replies and the findings unchanged, because the agents read their fields. Add no other fields or instructions, such as a list of files to review.
|
|
@@ -59,11 +62,38 @@ Stop the flow, keep the files as they are, and ask the user how to continue in t
|
|
|
59
62
|
|
|
60
63
|
Done when the review reply arrived, or the flow stopped.
|
|
61
64
|
|
|
62
|
-
## 4. Decide after
|
|
65
|
+
## 4. Decide after each review
|
|
63
66
|
|
|
64
|
-
|
|
67
|
+
When the first review reply of the task arrives, write the old tree, as the "Snapshots" section of [`references/fix-round.md`](references/fix-round.md#snapshots) gives it.
|
|
65
68
|
|
|
66
|
-
|
|
69
|
+
A **fix round** runs step 1 again in a new agent, with the findings to fix as a **Findings** field, then takes the light path or runs steps 2 and 3 again. Before the first fix round, read [`references/fix-round.md`](references/fix-round.md), for the snapshots, the light path, the review fields, and the findings to carry.
|
|
70
|
+
|
|
71
|
+
After each review, check the stop rules. When no stop rule is true, run an **automatic round**: a fix round of every `high` and `medium` finding, with no question to the user. Show one line, such as "Round 2: automatic fix of 1 `medium` finding". The task has a limit of 2 automatic rounds. Rounds that the user picks do not count, and do not reset the count. The automatic rounds also follow a review after a round that the user picked.
|
|
72
|
+
|
|
73
|
+
### Stop rules
|
|
74
|
+
|
|
75
|
+
Stop the loop and ask the user when any of these is true:
|
|
76
|
+
|
|
77
|
+
1. The highest severity is `low`, or no findings remain.
|
|
78
|
+
2. 2 automatic rounds have run.
|
|
79
|
+
3. A finding that the round sent to fix has the status `open` or `regressed`.
|
|
80
|
+
4. After a fix round, the count did not go down since the review before. The count is the `high` and `medium` findings that remain after the review, carried findings included.
|
|
81
|
+
5. A stop of step 3 fires.
|
|
82
|
+
|
|
83
|
+
At the stop, show the round history, with one row for each round:
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
| Round | Kind | Review | Fixed | Open | Regressed | New | Highest |
|
|
87
|
+
| ----- | ---- | ------ | ----- | ---- | --------- | --- | ------- |
|
|
88
|
+
| 1 | first | full | - | - | - | 4 | medium |
|
|
89
|
+
| 2 | auto | delta | 2 | 0 | 0 | 0 | low |
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Kind is `first`, `auto`, `user`, or `light`. A `light` round has `none` in the Review column. Highest is the highest severity of the findings that remain after the round.
|
|
93
|
+
|
|
94
|
+
Then show the **Highest severity** line and one line for each finding: its severity, summary, and `file:line`, and its status when it has one. Show each `high` finding with its **Fix** line. The presumed blockers of the maintainability pass are `high`. Then wait for the user to pick one:
|
|
95
|
+
|
|
96
|
+
- **Fix**: the user names the findings to fix. Run a fix round with them.
|
|
67
97
|
- **Accept**: the user accepts the findings that remain.
|
|
68
98
|
|
|
69
99
|
Done when the user accepts.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Fix round
|
|
2
|
+
|
|
3
|
+
Read this file in the [`dot-flow`](../SKILL.md) skill before the first fix round, automatic or picked by the user. Read its "Snapshots" section earlier, when the first review of the task ends. The file gives the snapshots, the light path, the choice between a full review and a delta review, and the fields of step 3 on a fix run. Both runners use it.
|
|
4
|
+
|
|
5
|
+
## Snapshots
|
|
6
|
+
|
|
7
|
+
A snapshot is a Git tree of the working tree, with the untracked files and without the ignored files. Write it with a temporary index, so that the working tree and the index stay as they are. Run these commands at the repository root:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
tmp="$(mktemp)"
|
|
11
|
+
cp "$(git rev-parse --git-path index)" "$tmp"
|
|
12
|
+
GIT_INDEX_FILE="$tmp" git add -A && GIT_INDEX_FILE="$tmp" git write-tree
|
|
13
|
+
rm -f "$tmp"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`git write-tree` prints the hash of the tree. When the commands print no hash, stop the flow and show the error to the user. Each fix round uses 2 trees:
|
|
17
|
+
|
|
18
|
+
- **Old tree**: the state that the last review read. Before the first fix round, write it when the first review reply arrives, before you show the review to the user. On a later fix round, it is the new tree of the round before.
|
|
19
|
+
- **New tree**: write it after step 2 of the fix round is verified, before step 3 starts.
|
|
20
|
+
|
|
21
|
+
Compare the 2 trees, not a tree and the working tree. `git diff <tree>` misses the new untracked files, and shows the files that were untracked at the snapshot as deleted.
|
|
22
|
+
|
|
23
|
+
Compare the paths from the repository root, as `git diff --name-only` prints them. Before a comparison, remove the repository root from each absolute path in a finding or on a **Files** line.
|
|
24
|
+
|
|
25
|
+
## Light path
|
|
26
|
+
|
|
27
|
+
The light path applies when the user picks Fix and every finding to fix is `low`. A light-fixed finding is a finding that the light path fixed since the last review. On this path, the reply of step 1 ends with the line `**Behavior change:** <yes | no>`. After step 1, write a tree as the "Snapshots" section gives it, and check these 3 conditions:
|
|
28
|
+
|
|
29
|
+
- The **Behavior change** line says `no`.
|
|
30
|
+
- `git diff --name-only <old-tree> <tree>` lists only files that the findings to fix or the light-fixed findings name.
|
|
31
|
+
- The checks of the reply and the full test command pass, with no failed test.
|
|
32
|
+
|
|
33
|
+
When all 3 are true, skip steps 2 and 3. Add a `light` row to the round history, and show the stop of `SKILL.md` step 4 again, with each fixed finding as "fixed, not reviewed". Keep the old tree, so that the next review also reads the light fix. Add the light-fixed findings to the **Earlier findings** of the next review, so that it grades them.
|
|
34
|
+
|
|
35
|
+
When a condition is false, run steps 2 and 3 as a normal fix round.
|
|
36
|
+
|
|
37
|
+
## Full or delta
|
|
38
|
+
|
|
39
|
+
Run `git diff --name-only <old-tree> <new-tree>`, and read only the file names, never the changed files. Remove from the list the files on the **Files** line of the step 2 reply of the round. The delta diff still has these test changes, so a delta review reviews them.
|
|
40
|
+
|
|
41
|
+
- When the list that remains has a file that no earlier finding names, run a full review: leave out **Since**.
|
|
42
|
+
- Otherwise, run a delta review: give step 3 the **Since** field.
|
|
43
|
+
|
|
44
|
+
## Fields of step 3
|
|
45
|
+
|
|
46
|
+
On a fix run, add these fields after **Handoff**:
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
**Since:** <old-tree> <new-tree>
|
|
50
|
+
**Earlier findings:**
|
|
51
|
+
<the findings that the round sent to fix and the light-fixed findings, unchanged>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- **Since**: only on a delta review. The reviewer runs `git diff <old-tree> <new-tree>`, and reviews only that diff. It still checks the diff against every `NN` and each `BR` that the task names. A delta review does not find an old defect that an earlier review missed. This trade-off is accepted.
|
|
55
|
+
- **Earlier findings**: on each fix run, full or delta. The reviewer does not report an earlier finding again as a new finding. It gives each earlier finding one status, and reports the statuses before the new findings:
|
|
56
|
+
- `fixed`: the problem is gone.
|
|
57
|
+
- `open`: the problem is still there.
|
|
58
|
+
- `regressed`: the fix made the problem worse, or moved it to other code.
|
|
59
|
+
|
|
60
|
+
Only the round 1 review reports `low` findings. A review with **Earlier findings**, full or delta, reports only new `high` and `medium` findings, plus the status of each earlier finding.
|
|
61
|
+
|
|
62
|
+
**Earlier findings** lists only the findings that the round sent to fix and the light-fixed findings. Keep each earlier finding that the review grades `open` or `regressed` as the last review that reported it gave it, with its `file:line` and **Fix** line. Show it again at the next decision with its status. This applies after a full review and after a delta review.
|
|
63
|
+
|
|
64
|
+
Also keep each finding that remained before the round and that is not in **Earlier findings**, unchanged, and show it again at the next decision. No reviewer grades it again. After a full review, keep only the `low` ones. The report replaces the carried `high` and `medium` findings, and a later review does not report a `low` finding again. The highest severity that you show also covers the carried findings.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Inline mode
|
|
2
2
|
|
|
3
|
-
Inline steps for the [`dot-flow`](../SKILL.md) skill, for an agent that cannot start the dotagents agents, such as Codex or Copilot. The verification, the stops
|
|
3
|
+
Inline steps for the [`dot-flow`](../SKILL.md) skill, for an agent that cannot start the dotagents agents, such as Codex or Copilot. The verification, the stops of step 3, and step 4 stay as `SKILL.md` gives them: the automatic rounds, their limit, and the stop rules. You run each step yourself, in this conversation, instead of in an agent.
|
|
4
4
|
|
|
5
|
-
1. Implement: use the `dot-implement` skill for the task, and end the step with its handoff. Write no tests in this step.
|
|
5
|
+
1. Implement: use the `dot-implement` skill for the task, and end the step with its handoff. Write no tests in this step. On a fix run, end the handoff with the line `**Behavior change:** <yes | no>`. A behavior change is a change to what the code does for any input. Then take the light path or run steps 2 and 3, as [`fix-round.md`](fix-round.md#light-path) gives it.
|
|
6
6
|
2. Test: use the `dot-testing` skill with its `references/after-implement.md` and the handoff of step 1, and end the step with the reply that the reference gives.
|
|
7
|
-
3. Review: use the `dot-code-review` skill for the task.
|
|
7
|
+
3. Review: use the `dot-code-review` skill for the task. Start the report with the line `**Highest severity:** <high | medium | low | none>`. Also read the `## Requirements` section of the roadmap `README.md`, check the change against every non-negotiable (`NN`) and each business rule (`BR`) that the task names, and report a breached `NN` as a `high` finding. On a fix run, write the new tree, pick a full or a delta review, and grade the earlier findings, as [`fix-round.md`](fix-round.md) gives it. On a delta review, the target is `git diff <old-tree> <new-tree>`. A full review has the target `git diff HEAD`, plus the untracked files that `git status --short` lists. The round 1 review reports every finding at every severity. A later review reports only new `high` and `medium` findings, plus the status of each earlier finding. Keep the code as it is. Delete each test that you write to prove a finding.
|
|
8
8
|
|
|
9
9
|
Do only the work of the current step, even when the next step looks small. After steps 1 and 2, run the commands of the reply again before you start the next step: the verification of `SKILL.md` applies to your own replies too. The steps share one context, so read only what the current step needs.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dot-stack-review
|
|
3
|
+
description: Review the commits of a branch as an ordered stack of dependency layers, and report each layer with its findings.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Stack review
|
|
8
|
+
|
|
9
|
+
Review the committed changes of a branch as a **stack**: layers of files in dependency order. A reader understands layer 1 on its own, and each later layer from the layers above it. The `dot-code-review` skill gives the review. This skill gives the layers and the report.
|
|
10
|
+
|
|
11
|
+
## 1. Pick the target
|
|
12
|
+
|
|
13
|
+
- **Head**: the branch that the user named, or the current branch.
|
|
14
|
+
- **Base**: the branch that the user named, or the default branch from `git symbolic-ref --short refs/remotes/origin/HEAD`, such as `origin/main`. Use a local branch only when the user names it. When the repository has no `origin/HEAD`, ask the user for the base.
|
|
15
|
+
- **Merge base**: `git merge-base <base> <head>`. Compare head with the merge base, never with the tip of base, so commits that base got after the fork stay out.
|
|
16
|
+
- **Diff**: `git diff <merge-base> <head>`, with `--numstat` for the line counts. It has the committed changes only.
|
|
17
|
+
- **Page**: when the arguments include `page`, run step 5 after the report, without the offer.
|
|
18
|
+
|
|
19
|
+
Read each file with `git show <head>:<path>`, and keep the current checkout. For a file that head deletes, read it with `git show <merge-base>:<path>`.
|
|
20
|
+
|
|
21
|
+
State the target in one line: `<head> vs <base> (merge base <short sha>)`.
|
|
22
|
+
|
|
23
|
+
Done when you have the merge base and the list of changed files.
|
|
24
|
+
|
|
25
|
+
## 2. Group the layers
|
|
26
|
+
|
|
27
|
+
Group the changed files into layers by dependency, such as types and contracts, core logic, callers, tests, then docs and config.
|
|
28
|
+
|
|
29
|
+
- Derive each dependency from the imports and the diff. File A depends on file B when A imports, calls, links, or names something that the diff adds or changes in B. A folder name is a hint only.
|
|
30
|
+
- A layer holds whole files. Split a file into hunks only when it holds changes for 2 layers. List the file in both layers, each with its own hunks.
|
|
31
|
+
- Order the layers in the order that a reader must understand them. Each layer depends only on layers with a lower number. Merge 2 layers that depend on each other.
|
|
32
|
+
|
|
33
|
+
Show the layer map, one line per layer: the number, the name, and the files. Then continue to step 3. The user can ask for new layers after the report.
|
|
34
|
+
|
|
35
|
+
Done when each changed hunk is in exactly one layer, and no layer depends on a layer below it.
|
|
36
|
+
|
|
37
|
+
## 3. Review
|
|
38
|
+
|
|
39
|
+
Use the `dot-code-review` skill on the diff of step 1, with its passes and its finding format. Run one review, in layer order: layer 1 first, then each next layer. Give each finding the layer of its hunk.
|
|
40
|
+
|
|
41
|
+
Done when each layer has its findings, or is clean.
|
|
42
|
+
|
|
43
|
+
## 4. Report
|
|
44
|
+
|
|
45
|
+
Fill this template. The overview stack comes first, with layer 1 at the top. Each row shows the layer number, the name, the file count, the findings by severity or `clean`, and the layers that it needs. Then each layer gets a section, in layer order. One "Make it impossible" section, in the `dot-code-review` format, ends the report.
|
|
46
|
+
|
|
47
|
+
````markdown
|
|
48
|
+
```text
|
|
49
|
+
<head> vs <base> (merge base <short sha>)
|
|
50
|
+
|
|
51
|
+
┌──────────────────────────────────────────────────────────┐
|
|
52
|
+
│ 1 Contracts 2 files high 1 │
|
|
53
|
+
├──────────────────────────────────────────────────────────┤
|
|
54
|
+
│ 2 Core logic 3 files medium 1 needs 1 │
|
|
55
|
+
├──────────────────────────────────────────────────────────┤
|
|
56
|
+
│ 3 Callers 1 file clean needs 1, 2 │
|
|
57
|
+
└──────────────────────────────────────────────────────────┘
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Layer 1: <name>
|
|
61
|
+
Purpose: <one line>
|
|
62
|
+
Depends on: <nothing | layers 1, 2>
|
|
63
|
+
|
|
64
|
+
| File | + | - |
|
|
65
|
+
| ---- | - | - |
|
|
66
|
+
| path/to/file.ts | 12 | 4 |
|
|
67
|
+
|
|
68
|
+
<each finding of the layer in the dot-code-review format, or "No findings.">
|
|
69
|
+
|
|
70
|
+
## Make it impossible
|
|
71
|
+
|
|
72
|
+
<one line for each class of finding in all layers>
|
|
73
|
+
````
|
|
74
|
+
|
|
75
|
+
For a split file, count only the lines of the hunks in that layer.
|
|
76
|
+
|
|
77
|
+
End the report with a one-line offer of the HTML page of step 5. When the user accepts, run step 5.
|
|
78
|
+
|
|
79
|
+
Done when the report has every layer of step 2 and every finding of step 3.
|
|
80
|
+
|
|
81
|
+
## 5. Page
|
|
82
|
+
|
|
83
|
+
Write a self-contained HTML page of the stack, with the diff of each file and its findings.
|
|
84
|
+
|
|
85
|
+
1. Run `git check-ignore -q .tmp` at the repository root. When it exits with a non-zero code, stop, and tell the user that Git does not ignore `.tmp`, so the page could reach a commit.
|
|
86
|
+
2. Write the layers of step 2 and the findings of step 3 to `.tmp/stack-review/<branch-slug>.json`. `<branch-slug>` is head with each character other than a letter, a digit, `.`, `_`, or `-` replaced by `-`, such as `feat-flow-fix-loop`. Sort the keys. `dependsOn` has the 1-based numbers of the layers that a layer needs.
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"base": "main",
|
|
91
|
+
"head": "feat/my-change",
|
|
92
|
+
"layers": [
|
|
93
|
+
{
|
|
94
|
+
"dependsOn": [],
|
|
95
|
+
"files": ["src/types.ts"],
|
|
96
|
+
"findings": [
|
|
97
|
+
{
|
|
98
|
+
"body": "**Scenario:** ...\n**Fix:** ...",
|
|
99
|
+
"file": "src/types.ts",
|
|
100
|
+
"kind": "correctness",
|
|
101
|
+
"line": 42,
|
|
102
|
+
"severity": "high",
|
|
103
|
+
"summary": "One-line summary"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"name": "Contracts",
|
|
107
|
+
"purpose": "One line"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
3. Run the script of this skill directory from the repository root: `node <skill directory>/scripts/page.mjs .tmp/stack-review/<branch-slug>.json`. It runs `git merge-base` and `git diff` itself, and prints the path of the page.
|
|
114
|
+
4. When the script exits with a non-zero code, fix the field that its message names, and run it again.
|
|
115
|
+
|
|
116
|
+
Done when the user has the path of the page.
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
// Usage: node page.mjs <layers.json>, from inside the repository. Writes
|
|
2
|
+
// .tmp/stack-review/<branch-slug>.html at the repository root, and prints its path.
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
|
|
7
|
+
const SEVERITIES = ["high", "medium", "low"];
|
|
8
|
+
const KINDS = ["correctness", "maintainability"];
|
|
9
|
+
const MAX_DIFF = 64 * 1024 * 1024;
|
|
10
|
+
|
|
11
|
+
const layersFile = process.argv[2];
|
|
12
|
+
if (!layersFile) fail("Usage: node page.mjs <layers.json>");
|
|
13
|
+
const stack = readStack(layersFile);
|
|
14
|
+
validate(stack);
|
|
15
|
+
|
|
16
|
+
const root = git(["rev-parse", "--show-toplevel"]);
|
|
17
|
+
const mergeBase = git(["merge-base", stack.base, stack.head]);
|
|
18
|
+
// shortcut: a file that is split between 2 layers shows its full diff in both layers, split the diff by hunk when readers need only the hunks of each layer.
|
|
19
|
+
const diffs = new Map();
|
|
20
|
+
stack.layers.forEach((layer, i) => {
|
|
21
|
+
layer.files.forEach((file, j) => {
|
|
22
|
+
if (!diffs.has(file)) diffs.set(file, git(["--literal-pathspecs", "diff", "--no-color", "--no-ext-diff", mergeBase, stack.head, "--", file], root));
|
|
23
|
+
if (!diffs.get(file)) invalid(`layers[${i}].files[${j}]`, "has no changes between the merge base and head");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const page = path.join(root, ".tmp", "stack-review", `${stack.head.replace(/[^\w.-]/g, "-")}.html`);
|
|
28
|
+
fs.mkdirSync(path.dirname(page), { recursive: true });
|
|
29
|
+
fs.writeFileSync(page, renderPage());
|
|
30
|
+
console.log(page);
|
|
31
|
+
|
|
32
|
+
function fail(message) {
|
|
33
|
+
console.error(message);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function readStack(file) {
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
40
|
+
} catch (error) {
|
|
41
|
+
fail(`Cannot read the layers file ${file}: ${error.message}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function invalid(field, rule) {
|
|
46
|
+
fail(`Invalid layers file: ${field} ${rule}.`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function isObject(value) {
|
|
50
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
51
|
+
}
|
|
52
|
+
function isText(value) {
|
|
53
|
+
return typeof value === "string" && value.trim() !== "";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function validate(stack) {
|
|
57
|
+
if (!isObject(stack)) invalid("the root", "must be an object");
|
|
58
|
+
for (const key of ["base", "head"]) {
|
|
59
|
+
if (typeof stack[key] !== "string" || !/^[^-\s]\S*$/.test(stack[key])) invalid(key, "must be a branch or commit name without spaces that does not start with -");
|
|
60
|
+
}
|
|
61
|
+
if (!Array.isArray(stack.layers) || stack.layers.length === 0) invalid("layers", "must be a non-empty array");
|
|
62
|
+
stack.layers.forEach((layer, index) => {
|
|
63
|
+
const at = `layers[${index}]`;
|
|
64
|
+
if (!isObject(layer)) invalid(at, "must be an object");
|
|
65
|
+
for (const key of ["name", "purpose"]) {
|
|
66
|
+
if (!isText(layer[key])) invalid(`${at}.${key}`, "must be a non-empty string");
|
|
67
|
+
}
|
|
68
|
+
if (!Array.isArray(layer.dependsOn) || !layer.dependsOn.every((number) => Number.isInteger(number) && number >= 1 && number <= index)) {
|
|
69
|
+
invalid(`${at}.dependsOn`, `must list only earlier layers, as 1-based numbers below ${index + 1}`);
|
|
70
|
+
}
|
|
71
|
+
if (!Array.isArray(layer.files) || layer.files.length === 0 || !layer.files.every(isText)) invalid(`${at}.files`, "must be a non-empty array of file paths");
|
|
72
|
+
if (!Array.isArray(layer.findings)) invalid(`${at}.findings`, "must be an array");
|
|
73
|
+
layer.findings.forEach((finding, findingIndex) => {
|
|
74
|
+
const findingAt = `${at}.findings[${findingIndex}]`;
|
|
75
|
+
if (!isObject(finding)) invalid(findingAt, "must be an object");
|
|
76
|
+
for (const key of ["body", "summary"]) {
|
|
77
|
+
if (!isText(finding[key])) invalid(`${findingAt}.${key}`, "must be a non-empty string");
|
|
78
|
+
}
|
|
79
|
+
if (!layer.files.includes(finding.file)) invalid(`${findingAt}.file`, `must be one of the files of ${at}`);
|
|
80
|
+
if (!Number.isInteger(finding.line) || finding.line < 1) invalid(`${findingAt}.line`, "must be a line number from 1");
|
|
81
|
+
if (!SEVERITIES.includes(finding.severity)) invalid(`${findingAt}.severity`, `must be one of ${SEVERITIES.join(", ")}`);
|
|
82
|
+
if (!KINDS.includes(finding.kind)) invalid(`${findingAt}.kind`, `must be one of ${KINDS.join(", ")}`);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function git(args, cwd) {
|
|
88
|
+
const result = spawnSync("git", args, { cwd, encoding: "utf8", maxBuffer: MAX_DIFF });
|
|
89
|
+
if (result.status !== 0) fail(`git ${args.join(" ")} failed: ${(result.stderr || result.error?.message || "").trim()}`);
|
|
90
|
+
return result.stdout.trimEnd();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function escapeHtml(text) {
|
|
94
|
+
return String(text).replace(/[&<>"']/g, (char) => `&#${char.charCodeAt(0)};`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function plural(count, word) {
|
|
98
|
+
return `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function badge(className, text) {
|
|
102
|
+
return `<span class="badge ${className}">${text}</span>`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function severityCounts(findings) {
|
|
106
|
+
const counts = SEVERITIES.map((severity) => [severity, findings.filter((finding) => finding.severity === severity).length]).filter(([, count]) => count > 0);
|
|
107
|
+
if (counts.length === 0) return badge("clean", "clean");
|
|
108
|
+
return counts.map(([severity, count]) => badge(severity, `${severity} ${count}`)).join(" ");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function dependencies(layer) {
|
|
112
|
+
if (layer.dependsOn.length === 0) return "nothing";
|
|
113
|
+
return `${layer.dependsOn.length === 1 ? "layer" : "layers"} ${layer.dependsOn.join(", ")}`;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function diffRows(diff) {
|
|
117
|
+
const rows = [];
|
|
118
|
+
let oldLine = 0;
|
|
119
|
+
let newLine = 0;
|
|
120
|
+
let inHeader = true;
|
|
121
|
+
for (const line of diff.split("\n")) {
|
|
122
|
+
const hunk = line.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);
|
|
123
|
+
if (hunk) {
|
|
124
|
+
inHeader = false;
|
|
125
|
+
oldLine = Number(hunk[1]);
|
|
126
|
+
newLine = Number(hunk[2]);
|
|
127
|
+
rows.push({ kind: "hunk", line });
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (inHeader) {
|
|
131
|
+
if (!/^(diff --git |index |--- |\+\+\+ )/.test(line)) rows.push({ kind: "meta", line });
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (line.startsWith("+")) {
|
|
135
|
+
rows.push({ kind: "add", line, newLine: newLine++ });
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (line.startsWith("-")) {
|
|
139
|
+
rows.push({ kind: "del", line, oldLine: oldLine++ });
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (line.startsWith("\\")) {
|
|
143
|
+
rows.push({ kind: "meta", line });
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
rows.push({ kind: "context", line, newLine: newLine++, oldLine: oldLine++ });
|
|
147
|
+
}
|
|
148
|
+
return rows;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function renderMarkdown(text) {
|
|
152
|
+
return escapeHtml(text).replace(/`([^`]+)`|\*\*([^*]+)\*\*/g, (_, code, strong) => (code ? `<code>${code}</code>` : `<strong>${strong}</strong>`));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function renderFinding(finding, anchor) {
|
|
156
|
+
const location = `<code>${escapeHtml(`${finding.file}:${finding.line}`)}</code>`;
|
|
157
|
+
return `<div class="finding ${finding.severity}">
|
|
158
|
+
<p class="finding-head">${badge(finding.severity, finding.severity)} <strong>${escapeHtml(finding.summary)}</strong></p>
|
|
159
|
+
<p class="finding-meta">${anchor ? `<a href="#${anchor}">${location}</a>` : location} ${badge("kind", finding.kind)}</p>
|
|
160
|
+
<div class="body">${renderMarkdown(finding.body)}</div>
|
|
161
|
+
</div>`;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function renderRow(row, flag) {
|
|
165
|
+
if (row.kind === "hunk" || row.kind === "meta") return `<tr class="${row.kind}"><td class="code" colspan="3">${escapeHtml(row.line)}</td></tr>`;
|
|
166
|
+
const attributes = flag ? ` class="${row.kind} flagged ${flag.severity}" id="${flag.anchor}"` : ` class="${row.kind}"`;
|
|
167
|
+
return `<tr${attributes}><td class="ln">${row.oldLine ?? ""}</td><td class="ln">${row.newLine ?? ""}</td><td class="code">${escapeHtml(row.line) || " "}</td></tr>`;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function renderFile(file, layer, layerIndex, fileIndex) {
|
|
171
|
+
const rows = diffRows(diffs.get(file));
|
|
172
|
+
const added = rows.filter((row) => row.kind === "add").length;
|
|
173
|
+
const deleted = rows.filter((row) => row.kind === "del").length;
|
|
174
|
+
const findings = layer.findings.filter((finding) => finding.file === file);
|
|
175
|
+
const shownLines = new Set(rows.map((row) => row.newLine).filter(Number.isInteger));
|
|
176
|
+
const anchorOf = (line) => (shownLines.has(line) ? `layer-${layerIndex + 1}-file-${fileIndex + 1}-line-${line}` : "");
|
|
177
|
+
const flags = new Map();
|
|
178
|
+
for (const severity of SEVERITIES.toReversed()) {
|
|
179
|
+
for (const finding of findings.filter((candidate) => candidate.severity === severity)) flags.set(finding.line, { anchor: anchorOf(finding.line), severity });
|
|
180
|
+
}
|
|
181
|
+
const body = rows.map((row) => renderRow(row, row.kind === "del" ? undefined : flags.get(row.newLine))).join("\n");
|
|
182
|
+
return `<details class="file" open>
|
|
183
|
+
<summary><code class="file-name">${escapeHtml(file)}</code> <span class="add-count">+${added}</span> <span class="del-count">-${deleted}</span></summary>
|
|
184
|
+
<div class="file-body">
|
|
185
|
+
${findings.map((finding) => renderFinding(finding, anchorOf(finding.line))).join("\n")}
|
|
186
|
+
<details class="diff-section">
|
|
187
|
+
<summary>Diff</summary>
|
|
188
|
+
<table class="diff"><colgroup><col class="ln"><col class="ln"><col></colgroup>
|
|
189
|
+
${body}
|
|
190
|
+
</table>
|
|
191
|
+
</details>
|
|
192
|
+
</div>
|
|
193
|
+
</details>`;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function renderLayer(layer, index) {
|
|
197
|
+
return `<details class="layer" id="layer-${index + 1}" open>
|
|
198
|
+
<summary><h2>Layer ${index + 1}: ${escapeHtml(layer.name)}</h2> ${severityCounts(layer.findings)}</summary>
|
|
199
|
+
<div class="layer-body">
|
|
200
|
+
<p class="layer-meta">Purpose: ${escapeHtml(layer.purpose)}<br>Depends on: ${dependencies(layer)}</p>
|
|
201
|
+
${layer.files.map((file, fileIndex) => renderFile(file, layer, index, fileIndex)).join("\n")}
|
|
202
|
+
</div>
|
|
203
|
+
</details>`;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function renderOverviewRow(layer, index) {
|
|
207
|
+
const needs = layer.dependsOn.length ? `<span class="needs">needs ${layer.dependsOn.join(", ")}</span>` : "";
|
|
208
|
+
return `<li><a href="#layer-${index + 1}"><span class="number">${index + 1}</span><span class="name">${escapeHtml(layer.name)}</span><span class="count">${plural(layer.files.length, "file")}</span>${severityCounts(layer.findings)}${needs}</a></li>`;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function renderPage() {
|
|
212
|
+
const title = `${stack.head} vs ${stack.base}`;
|
|
213
|
+
return `<!doctype html>
|
|
214
|
+
<html lang="en">
|
|
215
|
+
<head>
|
|
216
|
+
<meta charset="utf-8">
|
|
217
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
218
|
+
<title>${escapeHtml(title)}</title>
|
|
219
|
+
<style>
|
|
220
|
+
:root {
|
|
221
|
+
color-scheme: light dark;
|
|
222
|
+
--grouped: #f2f2f7; --card: #ffffff; --inset: #f2f2f7; --label: #1d1d1f; --secondary: rgba(60, 60, 67, 0.6); --separator: rgba(60, 60, 67, 0.16);
|
|
223
|
+
--bar: rgba(242, 242, 247, 0.72);
|
|
224
|
+
--blue: #007aff; --red: #ff3b30; --orange: #ff9500; --green: #34c759;
|
|
225
|
+
--blue-text: #0040dd; --red-text: #d70015; --orange-text: #c93400; --green-text: #248a3d;
|
|
226
|
+
--add-bg: rgba(52, 199, 89, 0.12); --add-ln: rgba(52, 199, 89, 0.22); --del-bg: rgba(255, 59, 48, 0.1); --del-ln: rgba(255, 59, 48, 0.2); --hunk-bg: rgba(0, 122, 255, 0.07);
|
|
227
|
+
--shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
|
|
228
|
+
}
|
|
229
|
+
@media (prefers-color-scheme: dark) {
|
|
230
|
+
:root {
|
|
231
|
+
--grouped: #000000; --card: #1c1c1e; --inset: #2c2c2e; --label: #f5f5f7; --secondary: rgba(235, 235, 245, 0.6); --separator: rgba(84, 84, 88, 0.55);
|
|
232
|
+
--bar: rgba(22, 22, 23, 0.72);
|
|
233
|
+
--blue: #0a84ff; --red: #ff453a; --orange: #ff9f0a; --green: #30d158;
|
|
234
|
+
--blue-text: #409cff; --red-text: #ff6961; --orange-text: #ffb340; --green-text: #30db5b;
|
|
235
|
+
--add-bg: rgba(48, 209, 88, 0.13); --add-ln: rgba(48, 209, 88, 0.24); --del-bg: rgba(255, 69, 58, 0.13); --del-ln: rgba(255, 69, 58, 0.24); --hunk-bg: rgba(10, 132, 255, 0.12);
|
|
236
|
+
--shadow: none;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
@supports selector(::details-content) {
|
|
240
|
+
:root { interpolate-size: allow-keywords; }
|
|
241
|
+
details::details-content { block-size: 0; overflow-y: clip; transition: block-size 0.25s ease, content-visibility 0.25s allow-discrete; }
|
|
242
|
+
details[open]::details-content { block-size: auto; }
|
|
243
|
+
}
|
|
244
|
+
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
|
|
245
|
+
@media (prefers-reduced-motion: reduce) {
|
|
246
|
+
html { scroll-behavior: auto; }
|
|
247
|
+
*, *::before, *::after, ::details-content { transition: none !important; }
|
|
248
|
+
}
|
|
249
|
+
* { box-sizing: border-box; }
|
|
250
|
+
body { margin: 0; background: var(--grouped); color: var(--label); font: 15px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; }
|
|
251
|
+
code, table.diff { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
|
|
252
|
+
.finding code, .hero code { padding: 1px 6px; border-radius: 6px; background: var(--inset); font-size: 12px; }
|
|
253
|
+
a { color: var(--blue); text-decoration: none; }
|
|
254
|
+
a:hover { text-decoration: underline; }
|
|
255
|
+
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 50%, transparent); outline-offset: 2px; border-radius: 6px; }
|
|
256
|
+
.bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 10px max(16px, calc((100% - 1120px) / 2 + 16px)); background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--separator); }
|
|
257
|
+
.bar-title { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
258
|
+
.bar button { border: 0; border-radius: 999px; padding: 5px 14px; font: 600 13px/1.4 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; color: var(--blue-text); background: color-mix(in srgb, var(--blue) 14%, transparent); cursor: pointer; transition: background 0.2s ease, transform 0.1s ease; }
|
|
259
|
+
.bar button:hover { background: color-mix(in srgb, var(--blue) 22%, transparent); }
|
|
260
|
+
.bar button:active { transform: scale(0.96); }
|
|
261
|
+
main { max-width: 1120px; margin: 0 auto; padding: 32px 16px 64px; }
|
|
262
|
+
.hero h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
|
|
263
|
+
.hero p { margin: 6px 0 28px; color: var(--secondary); }
|
|
264
|
+
.section-title { margin: 0 0 8px 16px; color: var(--secondary); font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.02em; }
|
|
265
|
+
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
|
|
266
|
+
.badge.high { color: var(--red-text); background: color-mix(in srgb, var(--red) 14%, transparent); }
|
|
267
|
+
.badge.medium { color: var(--orange-text); background: color-mix(in srgb, var(--orange) 16%, transparent); }
|
|
268
|
+
.badge.low { color: var(--blue-text); background: color-mix(in srgb, var(--blue) 14%, transparent); }
|
|
269
|
+
.badge.clean { color: var(--green-text); background: color-mix(in srgb, var(--green) 15%, transparent); }
|
|
270
|
+
.badge.kind { color: var(--secondary); background: var(--inset); font-weight: 500; }
|
|
271
|
+
.stack { list-style: none; margin: 0 0 36px; padding: 0; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
|
|
272
|
+
.stack li + li a { border-top: 1px solid var(--separator); }
|
|
273
|
+
.stack li { padding-left: 16px; }
|
|
274
|
+
.stack a { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 16px 12px 0; color: var(--label); transition: background 0.15s ease; }
|
|
275
|
+
.stack a:hover { text-decoration: none; }
|
|
276
|
+
.stack li:hover { background: color-mix(in srgb, var(--label) 4%, transparent); }
|
|
277
|
+
.stack a::after { content: "\\203A"; margin-left: auto; color: var(--secondary); font-size: 20px; line-height: 1; }
|
|
278
|
+
.stack .number { min-width: 1.4em; color: var(--secondary); font-variant-numeric: tabular-nums; }
|
|
279
|
+
.stack .name { min-width: 13em; font-weight: 600; }
|
|
280
|
+
.count, .needs { color: var(--secondary); }
|
|
281
|
+
summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
|
|
282
|
+
summary::-webkit-details-marker { display: none; }
|
|
283
|
+
summary::before { content: ""; flex: none; width: 7px; height: 7px; margin: 0 4px 0 2px; border-right: 2px solid var(--secondary); border-bottom: 2px solid var(--secondary); transform: rotate(-45deg); transition: transform 0.25s ease; }
|
|
284
|
+
details[open] > summary::before { transform: rotate(45deg); }
|
|
285
|
+
details.layer { margin: 0 0 20px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
|
|
286
|
+
details.layer > summary { padding: 16px 20px; }
|
|
287
|
+
h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
|
|
288
|
+
.layer-body { padding: 0 20px 20px; }
|
|
289
|
+
.layer-meta { margin: 0 0 16px; color: var(--secondary); }
|
|
290
|
+
details.file { margin: 12px 0 0; background: var(--inset); border-radius: 10px; overflow: hidden; }
|
|
291
|
+
details.file > summary { padding: 10px 14px; overflow-wrap: anywhere; }
|
|
292
|
+
.file-name { font-size: 13px; font-weight: 500; }
|
|
293
|
+
.file-body { padding: 0 12px 12px; }
|
|
294
|
+
.add-count { color: var(--green-text); font-size: 13px; font-weight: 600; }
|
|
295
|
+
.del-count { color: var(--red-text); font-size: 13px; font-weight: 600; }
|
|
296
|
+
.finding { position: relative; margin: 0 0 10px; padding: 12px 16px 12px 20px; background: var(--card); border-radius: 10px; }
|
|
297
|
+
.finding::before { content: ""; position: absolute; inset: 10px auto 10px 8px; width: 4px; border-radius: 2px; background: var(--separator); }
|
|
298
|
+
.finding.high::before { background: var(--red); }
|
|
299
|
+
.finding.medium::before { background: var(--orange); }
|
|
300
|
+
.finding.low::before { background: var(--blue); }
|
|
301
|
+
.finding p { margin: 0 0 6px; overflow-wrap: anywhere; }
|
|
302
|
+
.finding-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
303
|
+
.finding-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--secondary); font-size: 13px; }
|
|
304
|
+
.finding .body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
|
|
305
|
+
details.diff-section { background: var(--card); border-radius: 10px; overflow: hidden; }
|
|
306
|
+
details.diff-section > summary { padding: 8px 14px; color: var(--secondary); font-size: 13px; font-weight: 600; }
|
|
307
|
+
details.diff-section[open] > summary { border-bottom: 1px solid var(--separator); }
|
|
308
|
+
table.diff { width: 100%; border-collapse: collapse; table-layout: fixed; line-height: 1.6; }
|
|
309
|
+
table.diff col.ln { width: 3.8em; }
|
|
310
|
+
table.diff td { padding: 0 10px; vertical-align: top; }
|
|
311
|
+
table.diff td.ln { color: var(--secondary); text-align: right; user-select: none; font-variant-numeric: tabular-nums; opacity: 0.8; }
|
|
312
|
+
table.diff td.code { white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
313
|
+
table.diff tr.meta td, table.diff tr.hunk td { color: var(--secondary); background: var(--hunk-bg); padding: 4px 14px; }
|
|
314
|
+
table.diff tr.add td { background: var(--add-bg); }
|
|
315
|
+
table.diff tr.add td.ln { background: var(--add-ln); }
|
|
316
|
+
table.diff tr.del td { background: var(--del-bg); }
|
|
317
|
+
table.diff tr.del td.ln { background: var(--del-ln); }
|
|
318
|
+
table.diff tr.flagged.high td:first-child { box-shadow: inset 4px 0 0 var(--red); }
|
|
319
|
+
table.diff tr.flagged.medium td:first-child { box-shadow: inset 4px 0 0 var(--orange); }
|
|
320
|
+
table.diff tr.flagged.low td:first-child { box-shadow: inset 4px 0 0 var(--blue); }
|
|
321
|
+
table.diff tr:target td { background: color-mix(in srgb, var(--blue) 18%, transparent); }
|
|
322
|
+
@media (max-width: 640px) {
|
|
323
|
+
.hero h1 { font-size: 28px; }
|
|
324
|
+
.stack .name { min-width: 0; }
|
|
325
|
+
.layer-body { padding: 0 12px 12px; }
|
|
326
|
+
.file-body { padding: 0 8px 8px; }
|
|
327
|
+
}
|
|
328
|
+
</style>
|
|
329
|
+
</head>
|
|
330
|
+
<body>
|
|
331
|
+
<header class="bar">
|
|
332
|
+
<span class="bar-title">${escapeHtml(title)}</span>
|
|
333
|
+
<button type="button" data-toggle-all="open">Expand all</button>
|
|
334
|
+
<button type="button" data-toggle-all="close">Collapse all</button>
|
|
335
|
+
</header>
|
|
336
|
+
<main>
|
|
337
|
+
<div class="hero">
|
|
338
|
+
<h1>${escapeHtml(title)}</h1>
|
|
339
|
+
<p>Merge base <code>${mergeBase.slice(0, 7)}</code></p>
|
|
340
|
+
</div>
|
|
341
|
+
<h2 class="section-title">Layers</h2>
|
|
342
|
+
<ol class="stack">
|
|
343
|
+
${stack.layers.map(renderOverviewRow).join("\n")}
|
|
344
|
+
</ol>
|
|
345
|
+
${stack.layers.map(renderLayer).join("\n")}
|
|
346
|
+
</main>
|
|
347
|
+
<script>
|
|
348
|
+
for (const button of document.querySelectorAll("[data-toggle-all]")) {
|
|
349
|
+
button.addEventListener("click", () => {
|
|
350
|
+
for (const details of document.querySelectorAll("main details")) details.open = button.dataset.toggleAll === "open";
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
document.addEventListener("click", (event) => {
|
|
354
|
+
const link = event.target.closest('a[href^="#"]');
|
|
355
|
+
const target = link && document.getElementById(decodeURIComponent(link.hash.slice(1)));
|
|
356
|
+
for (let node = target?.parentElement; node; node = node.parentElement) {
|
|
357
|
+
if (node.tagName === "DETAILS") node.open = true;
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
</script>
|
|
361
|
+
</body>
|
|
362
|
+
</html>
|
|
363
|
+
`;
|
|
364
|
+
}
|