@shiyuphan/follow-me 0.1.0 → 0.2.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 +128 -56
- package/dist/src/anthropic.js +41 -9
- package/dist/src/cli.js +836 -82
- package/dist/src/comments.js +300 -0
- package/dist/src/git.js +103 -24
- package/dist/src/harness.js +74 -0
- package/dist/src/host.js +379 -0
- package/dist/src/install.js +131 -0
- package/dist/src/naive.js +26 -0
- package/dist/src/plan.js +281 -25
- package/dist/src/prompt.js +391 -82
- package/dist/src/server.js +710 -160
- package/dist/src/session.js +311 -104
- package/dist/src/syntax.js +199 -0
- package/dist/src/types.js +5 -2
- package/dist/ui/app.js +1703 -272
- package/dist/ui/concerns.js +165 -0
- package/dist/ui/highlight.js +221 -0
- package/dist/ui/index.html +62 -7
- package/dist/ui/live.js +184 -0
- package/dist/ui/playback.js +480 -76
- package/dist/ui/questions.js +189 -0
- package/dist/ui/style.css +975 -75
- package/dist/ui/summary.js +45 -0
- package/package.json +4 -2
- package/skills/follow-me/SKILL.md +34 -16
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// Pure wording for the end of a review: what the reviewer is about to hand over.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {{ anchor: { kind: string, commit?: number }, kind?: string }} SummaryComment
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** @param {number} n @param {string} word */
|
|
9
|
+
function count(n, word) {
|
|
10
|
+
return `${n} ${word}${n === 1 ? "" : "s"}`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* "2 comments on 2 commits and 1 on the whole plan, 1 question for the agent, 2 kept concerns",
|
|
15
|
+
* or "No comments". Questions count apart from change requests, since the agent answers them
|
|
16
|
+
* instead of changing the plan.
|
|
17
|
+
* @param {{ comments: readonly SummaryComment[], kept: number, unresolved: number,
|
|
18
|
+
* walk: boolean }} input
|
|
19
|
+
*/
|
|
20
|
+
export function endSummary({ comments, kept, unresolved, walk }) {
|
|
21
|
+
const questions = comments.filter((c) => c.kind === "question");
|
|
22
|
+
const changes = comments.filter((c) => c.kind !== "question");
|
|
23
|
+
const onCommits = changes.filter((c) => c.anchor.kind !== "plan");
|
|
24
|
+
const general = changes.length - onCommits.length;
|
|
25
|
+
const commits = new Set(onCommits.map((c) => c.anchor.commit)).size;
|
|
26
|
+
/** @type {string[]} */
|
|
27
|
+
const parts = [];
|
|
28
|
+
if (onCommits.length > 0) {
|
|
29
|
+
parts.push(`${count(onCommits.length, "comment")} on ${count(commits, "commit")}`);
|
|
30
|
+
}
|
|
31
|
+
if (general > 0) parts.push(`${general} on the whole ${walk ? "branch" : "plan"}`);
|
|
32
|
+
const sentence = [parts.join(" and ")].filter(Boolean);
|
|
33
|
+
if (questions.length > 0) sentence.push(`${count(questions.length, "question")} for the agent`);
|
|
34
|
+
if (kept > 0) sentence.push(`${count(kept, "kept concern")}`);
|
|
35
|
+
if (unresolved > 0) sentence.push(`${count(unresolved, "answer")} not marked resolved`);
|
|
36
|
+
return sentence.length === 0 ? "No comments" : sentence.join(", ");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Where the report is saved, beside the review file.
|
|
41
|
+
* @param {string} saved path of reviews/vN.json
|
|
42
|
+
*/
|
|
43
|
+
export function reportPath(saved) {
|
|
44
|
+
return saved.replace(/\.json$/, ".md");
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shiyuphan/follow-me",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Split a branch's final changes into fine, ordered commits that read like the author's thought process, review them hunk by hunk, and hand the review back to a coding agent.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,7 +44,9 @@
|
|
|
44
44
|
"build": "rm -rf dist && tsc -p tsconfig.build.json && cp -R ui dist/ui"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@anthropic-ai/sdk": "0.135.0"
|
|
47
|
+
"@anthropic-ai/sdk": "0.135.0",
|
|
48
|
+
"mermaid": "12.2.0",
|
|
49
|
+
"prismjs": "1.30.0"
|
|
48
50
|
},
|
|
49
51
|
"devDependencies": {
|
|
50
52
|
"@biomejs/biome": "^2.5.15",
|
|
@@ -8,7 +8,7 @@ description: Split the current branch's net change into fine, story-ordered comm
|
|
|
8
8
|
follow-me rewrites a branch as small commits ordered so a reader follows your thinking. It never
|
|
9
9
|
touches your working tree or index. It writes a new branch and keeps state in `.follow-me/<slug>/`.
|
|
10
10
|
|
|
11
|
-
Run every command from the repo root. If `follow-me` is not on PATH, ask the user how
|
|
11
|
+
Run every command from the repo root. If `follow-me` is not on PATH, ask the user how to run it.
|
|
12
12
|
|
|
13
13
|
## First pass
|
|
14
14
|
|
|
@@ -23,7 +23,9 @@ Run every command from the repo root. If `follow-me` is not on PATH, ask the use
|
|
|
23
23
|
lines are real mistakes.
|
|
24
24
|
5. `follow-me apply` freezes the plan as the next version and writes the branch.
|
|
25
25
|
6. Tell the user to run `follow-me review`. It opens a local page where they comment on messages,
|
|
26
|
-
positions, hunks and single lines.
|
|
26
|
+
positions, hunks and single lines. If you start it yourself, use `follow-me review --wait --no-open`,
|
|
27
|
+
which prints the page URL to give the user and returns once they end the review, so you can go
|
|
28
|
+
straight on to `follow-me feedback`; one server hosts every session the user has open.
|
|
27
29
|
|
|
28
30
|
## After a review
|
|
29
31
|
|
|
@@ -39,18 +41,24 @@ When the user says they finished reviewing:
|
|
|
39
41
|
## As a reviewer
|
|
40
42
|
|
|
41
43
|
`follow-me walk` is for someone reading a branch they did not write. It plays the branch back
|
|
42
|
-
commit by commit in the browser,
|
|
43
|
-
reviewer comments on the code. Nothing is applied and no branch is written.
|
|
44
|
+
commit by commit in the browser, one chunk of change at a time: it reads your narration aloud,
|
|
45
|
+
then shows the lines it explains. The reviewer comments on the code. Nothing is applied and no branch is written.
|
|
44
46
|
|
|
45
47
|
1. `follow-me walk [--branch <name>]` opens the session. If there is no plan yet and no API key, it
|
|
46
48
|
prints two commands and stops. Run the first, `follow-me prompt --walk`, and read all of it.
|
|
47
49
|
2. Write the draft it names. The order rules are the same, and every commit also gets a
|
|
48
50
|
`narration`: what the author is thinking while writing it, first person, present tense, two or
|
|
49
51
|
three sentences, no markdown. Give a unit narration as `{ "unit": "h_x:0-3", "narration": "..." }`
|
|
50
|
-
when the why of that hunk is not obvious from the commit's narration.
|
|
52
|
+
when the why of that hunk is not obvious from the commit's narration. Narration is spoken, so
|
|
53
|
+
it names no symbols the listener has to see spelled out and never describes a picture.
|
|
54
|
+
Optionally add a `diagram`, Mermaid source drawn beside the code, to a commit or a unit
|
|
55
|
+
(`{ "unit": "h_x", "diagram": "flowchart LR\n a --> b" }`). Use one only for what prose
|
|
56
|
+
carries badly: data flow between modules, a state machine, a call graph, or the before and
|
|
57
|
+
after shape of a structure. Most commits need none. Its first line must name the diagram type,
|
|
58
|
+
such as `flowchart`, `sequenceDiagram` or `stateDiagram-v2`; `follow-me check` rejects others.
|
|
51
59
|
3. `follow-me check` until green, then tell the user to run `follow-me walk` again. Do not apply.
|
|
52
60
|
|
|
53
|
-
When you are the author's agent and `follow-me feedback`
|
|
61
|
+
When you are the author's agent and `follow-me feedback --walk` prints a `# Code review`, the review
|
|
54
62
|
came from a walk. It quotes each commented line as a diff excerpt with its line number on the
|
|
55
63
|
branch. Address every item in the code on the branch itself, then tell the user what you changed
|
|
56
64
|
and what you declined and why. Do not write a follow-me draft or `responses` for it; those answer
|
|
@@ -63,13 +71,23 @@ plan reviews only.
|
|
|
63
71
|
A bare `h_x` takes whatever lines no other commit claimed.
|
|
64
72
|
- `f_` and `m_` units are whole; they never take line lists.
|
|
65
73
|
|
|
66
|
-
##
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
## Interactive loop
|
|
75
|
+
|
|
76
|
+
While the review page is open the reviewer comments and asks questions live, and you answer without
|
|
77
|
+
closing the page. Everything goes through the review server.
|
|
78
|
+
|
|
79
|
+
1. `follow-me watch [--since <seq>] [--timeout <seconds>]` blocks until the reviewer does something and
|
|
80
|
+
prints it (`--json` for one JSON object per line, `--follow` to stream until the review ends). It
|
|
81
|
+
exits 0 with news, 2 when nothing happened, and prints the `--since` to use next. Run it again in a
|
|
82
|
+
loop; stop when it reports that the review ended.
|
|
83
|
+
2. Answer a question or comment in place with `follow-me reply <commentId> --body "..."`, adding
|
|
84
|
+
`--diagram <file>` with Mermaid source when a picture explains it. This needs no new plan.
|
|
85
|
+
3. When the plan itself should change, write a new draft whose `responses` answer the comments
|
|
86
|
+
(`"status": "answered"` with `"at"` for questions), `follow-me check`, then `follow-me apply`. While the
|
|
87
|
+
page is open, apply swaps it to the new version at the same URL and keeps the old comments.
|
|
88
|
+
4. At the end, `follow-me report` prints one consolidated report of the issues you and the reviewer
|
|
89
|
+
raised, by file and line, with questions and answers last. It is also saved as
|
|
90
|
+
`.follow-me/<slug>/reviews/vN.md`. Give it to the author.
|
|
91
|
+
|
|
92
|
+
In a walk you may also raise `concerns` (see `follow-me prompt --walk`); the reviewer keeps or dismisses
|
|
93
|
+
each, and only kept ones reach the report.
|