@tduyng/pi-review 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,11 +4,11 @@ A `/review` command that works out what to review and sends one focused review p
4
4
 
5
5
  ## The incremental loop
6
6
 
7
- Every `/review` snapshots the whole worktree (tracked and untracked) as a dangling git commit. No ref, no stash change, no branch commit. The snapshot sha sits in the session as a custom entry that never enters model context.
7
+ Every bare `/review` snapshots the whole worktree (tracked and untracked) as a dangling git commit. No ref, no stash change, no branch commit. The snapshot sha sits in the session as a custom entry that never enters model context.
8
8
 
9
9
  Run `/review` and the agent reviews what moved since the last run. The delta is a tree-to-tree diff, so it covers edits to files that were untracked at checkpoint time and deletions of tracked files. When nothing moved, the command says so and sends nothing.
10
10
 
11
- Every review refreshes the snapshot, whichever target you named, so the next bare `/review` starts from that point. Git prunes the snapshot objects after roughly two weeks, and a pruned snapshot falls back to the default below. In an ephemeral `--no-session` run the snapshot lasts only for that process.
11
+ The checkpoint moves only after a review has read that work. `--staged` and a described target leave it alone, so their unstaged work is still waiting for the next bare `/review`. A branch review records HEAD, not the worktree, so uncommitted edits stay in the next delta. Git prunes the snapshot objects after roughly two weeks, and a pruned snapshot falls back to the default below. In an ephemeral `--no-session` run the snapshot lasts only for that process.
12
12
 
13
13
  ## Targets
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tduyng/pi-review",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "/review resolves a target from git, collects project ground truth, and sends a structured review prompt inline or through a subagent.",
5
5
  "keywords": [
6
6
  "pi",
package/src/index.ts CHANGED
@@ -50,16 +50,17 @@ export default function reviewExtension(pi: ExtensionAPI): void {
50
50
  return
51
51
  }
52
52
 
53
- const boundary = target.kind === 'since' ? target.nowSha : await git.snapshotWorktree()
53
+ const boundary =
54
+ target.kind === 'since'
55
+ ? target.nowSha
56
+ : target.kind === 'uncommitted' && !target.staged
57
+ ? await git.snapshotWorktree()
58
+ : null
54
59
  const diff = await reviewDiff(git, target, boundary)
55
60
  if (diff !== null && diff.total === 0) {
56
61
  ctx.ui.notify('Nothing to review.', 'info')
57
62
  return
58
63
  }
59
- // A request target has no refs to diff, so the reviewer resolves it itself; every
60
- // other target that could not produce a diff must not advance the checkpoint, or
61
- // the next bare /review would skip the changes that were never reviewed.
62
- if (boundary !== null && (diff !== null || target.kind === 'request')) saveCheckpoint(pi, boundary)
63
64
 
64
65
  ctx.ui.notify('Reviewing ' + describeTarget(target), 'info')
65
66
  pi.sendUserMessage(
@@ -68,8 +69,20 @@ export default function reviewExtension(pi: ExtensionAPI): void {
68
69
  diff,
69
70
  flags: parsed.flags,
70
71
  subagentAvailable: pi.getActiveTools().includes('subagent')
71
- })
72
+ }),
73
+ ctx.isIdle() ? undefined : { deliverAs: 'followUp' }
72
74
  )
75
+
76
+ // The checkpoint is the tree the reviewer actually read. A staged or described review
77
+ // leaves the unstaged work untouched, so advancing it would make the next bare /review
78
+ // skip changes that no review has seen.
79
+ if (diff !== null) {
80
+ if (boundary !== null) saveCheckpoint(pi, boundary)
81
+ else if (target.kind === 'base') {
82
+ const head = await git.revParse('HEAD')
83
+ if (head !== null) saveCheckpoint(pi, head)
84
+ }
85
+ }
73
86
  }
74
87
  })
75
88
  }