claude-code-session-manager 0.37.1 → 0.38.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.
Files changed (60) hide show
  1. package/bin/cli.cjs +12 -1
  2. package/dist/assets/{TiptapBody-DXQDiOUx.js → TiptapBody-GMk5LS9Y.js} +1 -1
  3. package/dist/assets/index-CD_LuJZF.css +32 -0
  4. package/dist/assets/{index--a8m5_ET.js → index-CQqSHpIq.js} +444 -436
  5. package/dist/index.html +2 -2
  6. package/package.json +1 -1
  7. package/plugins/session-manager-dev/skills/develop/SKILL.md +134 -36
  8. package/plugins/session-manager-dev/skills/develop/standards.md +25 -0
  9. package/plugins/session-manager-dev/skills/issue-address/0-select/0-fetch-pool/SKILL.md +38 -0
  10. package/plugins/session-manager-dev/skills/issue-address/0-select/1-reject-fixed/SKILL.md +64 -0
  11. package/plugins/session-manager-dev/skills/issue-address/0-select/2-reject-claimed/SKILL.md +71 -0
  12. package/plugins/session-manager-dev/skills/issue-address/0-select/3-rank-impact/SKILL.md +39 -0
  13. package/plugins/session-manager-dev/skills/issue-address/0-select/SKILL.md +75 -0
  14. package/plugins/session-manager-dev/skills/issue-address/1-confirm-open/SKILL.md +39 -0
  15. package/plugins/session-manager-dev/skills/issue-address/2-claim/SKILL.md +57 -0
  16. package/plugins/session-manager-dev/skills/issue-address/3-reproduce/SKILL.md +40 -0
  17. package/plugins/session-manager-dev/skills/issue-address/4-fix/SKILL.md +33 -0
  18. package/plugins/session-manager-dev/skills/issue-address/5-verify/SKILL.md +40 -0
  19. package/plugins/session-manager-dev/skills/issue-address/SKILL.md +120 -0
  20. package/plugins/session-manager-dev/skills/pr-review-sweep/0-fetch/SKILL.md +41 -0
  21. package/plugins/session-manager-dev/skills/pr-review-sweep/1-classify/SKILL.md +45 -0
  22. package/plugins/session-manager-dev/skills/pr-review-sweep/2-check-fixed/SKILL.md +49 -0
  23. package/plugins/session-manager-dev/skills/pr-review-sweep/3-queue/SKILL.md +50 -0
  24. package/plugins/session-manager-dev/skills/pr-review-sweep/4-land-and-resolve/SKILL.md +60 -0
  25. package/plugins/session-manager-dev/skills/pr-review-sweep/SKILL.md +124 -0
  26. package/plugins/session-manager-dev/skills/pr-signal/SKILL.md +67 -0
  27. package/plugins/session-manager-dev/skills/requesting-code-review/SKILL.md +20 -17
  28. package/scripts/lib/watchdogHelpers.cjs +296 -166
  29. package/src/main/__tests__/chat-cancel-terminal.test.cjs +31 -0
  30. package/src/main/__tests__/chat-exit-close-race.test.cjs +140 -0
  31. package/src/main/__tests__/classifyTranscriptLine.test.cjs +90 -0
  32. package/src/main/__tests__/docEdit.test.cjs +164 -2
  33. package/src/main/__tests__/prdCreate.test.cjs +265 -25
  34. package/src/main/__tests__/scheduler-admin-routes.test.cjs +150 -0
  35. package/src/main/__tests__/scheduler-boot-orphans.test.cjs +172 -0
  36. package/src/main/__tests__/scheduler-committed-in-window.test.cjs +64 -0
  37. package/src/main/browserAgentServer.cjs +11 -10
  38. package/src/main/chatRunner.cjs +58 -14
  39. package/src/main/docEdit.cjs +125 -5
  40. package/src/main/health.cjs +15 -0
  41. package/src/main/index.cjs +12 -6
  42. package/src/main/ipcSchemas.cjs +16 -3
  43. package/src/main/lib/__tests__/localAdminHttp.test.cjs +120 -0
  44. package/src/main/lib/classifyTranscriptLine.cjs +89 -0
  45. package/src/main/lib/localAdminHttp.cjs +157 -0
  46. package/src/main/lib/personaImportHealth.cjs +161 -0
  47. package/src/main/lib/prdCreate.cjs +107 -17
  48. package/src/main/lib/rcaFeedbackHook.cjs +2 -2
  49. package/src/main/lib/singleInstanceGuard.cjs +20 -0
  50. package/src/main/scheduler.cjs +223 -56
  51. package/src/main/sessionsStore.cjs +4 -5
  52. package/src/main/templates/PRD_AUTHORING.md +4 -4
  53. package/src/main/transcripts.cjs +1 -85
  54. package/src/main/webRemote.cjs +3 -3
  55. package/src/preload/api.d.ts +16 -6
  56. package/src/preload/index.cjs +9 -2
  57. package/dist/assets/index-CTTjT08J.css +0 -32
  58. package/plugins/session-manager-dev/skills/security-review/SKILL.md +0 -105
  59. package/src/main/__tests__/adminServer.test.cjs +0 -380
  60. package/src/main/adminServer.cjs +0 -242
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: pr-review-sweep
3
+ description: Sweep one or more of the current project's PRs' unresolved review comments end-to-end — fetch (paginated), classify by disposition AND bug-vs-feature type, check-if-already-fixed, queue a scheduler PRD per (PR, type), then land-and-resolve once it completes. Orchestrates 5 nested sub-skills (pr-review-sweep:fetch, :classify, :check-fixed, :queue, :land-and-resolve). Never fixes inline, never contacts reviewers. Use when a PR has open review feedback that needs triaging and landing.
4
+ ---
5
+
6
+ # pr-review-sweep (orchestrator)
7
+
8
+ Global, project-agnostic PR-review-clearing pipeline — works against whatever repo the
9
+ current project's `gh` remote points to. Run this per-PR whenever `/project-status` (or a
10
+ manual check) surfaces unresolved review threads. Codified from the process used to clear
11
+ review rounds on `midt-bg/sigma` PRs; a project's own `AGENTS.md`/`CLAUDE.local.md` may add
12
+ repo-specific policy notes (e.g. which threads are auto-accept vs. needs-decision, house
13
+ style for reply text) that this skill should read and respect if present.
14
+
15
+ **Naming convention (see a project's own `AGENTS.md` if it documents one; otherwise this
16
+ convention still applies as the plugin's own standard):** sub-skill directories are prefixed
17
+ `0-`, `1-`, ... in execution order, so a plain directory listing sorts in DAG order without
18
+ opening any file. The invocable `name:` field stays a clean colon-scoped identifier
19
+ (`pr-review-sweep:fetch`) without the numeric prefix.
20
+
21
+ **Always via the scheduler.** Every genuinely-unfixed thread is fixed by a `/develop` PRD,
22
+ never inline in this session — no "fast path" for small mechanical fixes. The scheduler is
23
+ the one place real code changes happen (global CLAUDE.md model-economics rule: interactive
24
+ sessions run an expensive planner-tier model; execution belongs on the cheap executor
25
+ tier). If a fast lane for small review fixes turns out to be worth having, that's a
26
+ scheduler-level feature (a priority/fast queue lane) to build later — not a reason for this
27
+ skill to bypass the scheduler now.
28
+
29
+ ## Pipeline DAG
30
+
31
+ ```
32
+ PR number(s)
33
+
34
+
35
+ ┌───────────────────────────┐
36
+ │ 0. pr-review-sweep:fetch │ paginated GraphQL, reviewThreads.isResolved ground truth
37
+ └───────────────────────────┘
38
+ │ every unresolved thread, full text + location
39
+
40
+ ┌───────────────────────────┐
41
+ │ 1. pr-review-sweep:classify │ disposition (accept/policy-override/needs-decision)
42
+ └───────────────────────────┘ × type (bug/feature) — two independent axes
43
+ │ per thread: {disposition, type}, needs-decision threads set aside
44
+
45
+ ┌───────────────────────────┐
46
+ │ 2. pr-review-sweep:check-fixed │ MANDATORY for every survivor — triage into 3 outcomes
47
+ └───────────────────────────┘ before queuing or replying to anything
48
+ │ │ │
49
+ │ already-fixed│ reply-only │ survives (genuinely needs new code)
50
+ ▼ ▼ ▼
51
+ └──────┬───────┘ ┌───────────────────────────┐
52
+ │ │ 3. pr-review-sweep:queue │ one /develop PRD per
53
+ │ └───────────────────────────┘ (PR, type) bundle,
54
+ │ │ queued PRD id, or duplicate-guarded
55
+ │ │ "already queued"
56
+ │ ▼
57
+ │ ... async, on scheduler ...
58
+ │ │
59
+ ▼ ▼
60
+ ┌───────────────────────────────────┐
61
+ │ 4. pr-review-sweep:land-and-resolve │ cite SHA (already-fixed/PRD) or
62
+ └───────────────────────────────────┘ reasoning (reply-only); reply; resolve
63
+
64
+
65
+ thread resolved, or reported stuck (failed/needs_review PRD)
66
+ ```
67
+
68
+ | Step | Input | Output | On failure/empty |
69
+ |---|---|---|---|
70
+ | 0. `pr-review-sweep:fetch` | one or more PR numbers | every unresolved review thread, verified-complete (paginated) | n/a — loops its own fetch until `totalCount` matches nodes paged |
71
+ | 1. `pr-review-sweep:classify` | unresolved threads | each thread tagged `{disposition, type}` | needs-decision threads are set aside, surfaced to the user, never guessed |
72
+ | 2. `pr-review-sweep:check-fixed` | accept/policy-override threads — **every one, no shortcuts** | `already-fixed` (w/ commit) + `reply-only` (w/ reasoning) + `survives` | never skip this because a thread's disposition "obviously" needs no code check — see the incident documented in that step's own file |
73
+ | 3. `pr-review-sweep:queue` | `survives` only, grouped by (PR, type) | one queued `/develop` PRD id per bundle | if a PRD for that (PR, type) is already queued/in-flight, skip and report its id — never double-queue |
74
+ | 4. `pr-review-sweep:land-and-resolve` | already-fixed / reply-only (immediate) or a PRD reported `completed` by the scheduler | thread replied (SHA or reasoning) + resolved | `failed`/`needs_review`/stuck PRDs are reported, never silently retried |
75
+
76
+ ## Why two independent classification axes (step 1)
77
+
78
+ **Disposition** (accept-as-is / policy-override / needs-my-decision) answers "should this
79
+ be done at all, and does it need a human." **Type** (bug / feature) answers "what shape of
80
+ change is this, once we've decided to do it" — and drives which PRD template/acceptance
81
+ criteria `pr-review-sweep:queue` writes:
82
+
83
+ - **Bug** — the reviewer flagged something objectively broken (wrong output, crash,
84
+ security issue, off-by-one, missed edge case). The PRD's ACs require: a reproduction of
85
+ the defect, a regression test that fails before the fix and passes after, then the fix
86
+ itself.
87
+ - **Feature** — the reviewer asked for additional behavior, a refactor, or a
88
+ consistency/style improvement that isn't fixing broken behavior. The PRD's ACs require
89
+ scoping tightly to exactly what was asked (no piggybacked scope creep) and consistency
90
+ with existing patterns in the touched file; a regression test is only required if the ask
91
+ itself adds testable behavior.
92
+
93
+ Splitting by type — rather than one undifferentiated "fix it" PRD per PR — is what lets each
94
+ bundle get acceptance criteria actually suited to the kind of work it is, and is the reason
95
+ this classification exists as its own step rather than being folded into disposition.
96
+
97
+ ## Hard constants across all five steps
98
+
99
+ - **Ground truth for "unresolved" is GraphQL `reviewThreads.isResolved`**, fully paginated
100
+ (`first: 100` — smaller page sizes have silently truncated on real PRs; always compare
101
+ `totalCount` to nodes actually paged through). Never a last-reply/last-push heuristic.
102
+ - **Never contact a reviewer** — no request, re-request, or nudge, at any point in this
103
+ process. Reviewer contact is `pr-signal`'s job alone, gated behind the user's explicit,
104
+ per-PR, freshly-given approval every time. A prior approval never carries forward.
105
+ - **Never fix inline.** Every genuinely-unfixed thread goes through `/develop`, no
106
+ exceptions — see the scheduler note above.
107
+ - **Idempotent re-runs.** One queued/in-flight PRD per (PR, type) bundle; replies aren't
108
+ re-posted; resolving an already-resolved thread is a no-op.
109
+
110
+ ## Why nested skills instead of one inline sequence
111
+
112
+ Each step is its own file so it shows up as its own invocation in whatever surface tracks
113
+ skill/tool calls, and so a step can be changed (a new PRD template for a third `type`
114
+ bucket, a different fetch page size) without touching the others. `classify` is the step
115
+ most likely to grow — if a third type axis value earns its own PRD template later (e.g.
116
+ `docs`, `perf`), or `queue` needs different bundling logic per type, decompose that step
117
+ further the same way `issue-address:select` was, rather than growing this file.
118
+
119
+ ## What this skill is not
120
+
121
+ - Not for GitHub issues — that's `issue-address` (a different data source: issues, not
122
+ open-PR review threads).
123
+ - Not a decision on whether to contact a reviewer — that's `pr-signal`, invoked separately
124
+ and rarely.
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: pr-signal
3
+ description: >-
4
+ Request or re-request a reviewer on one PR on the current project's repo — the ONLY
5
+ step in the PR flow that contacts a person. Deliberately separate from pr-review-sweep
6
+ and meant to be invoked rarely — most projects don't tag reviewers often. Requires the
7
+ user's explicit, fresh, per-PR approval every time — a prior approval never carries
8
+ forward, and CI must be green at the moment of signaling, not just when approval was
9
+ given. Use only when the user explicitly names a PR number and says to
10
+ request/ping/notify the reviewer, or approves signaling in response to a
11
+ pr-review-sweep report.
12
+ ---
13
+
14
+ # pr-signal — the one step that contacts a reviewer (rare, gated)
15
+
16
+ Global, project-agnostic — works against whatever repo the current project's `gh` remote
17
+ points to. Input: a PR whose queued PRDs have all landed and whose threads
18
+ `pr-review-sweep:land-and-resolve` has replied to and resolved (CI green) — plus the user's
19
+ explicit approval for this specific PR number, given in this conversation, not inherited
20
+ from an earlier one. If the project has its own reviewer-contact policy doc (e.g. sigma's
21
+ `docs/pr-review-workflow.local.md`), read it for repo-specific nuance — reviewer identity,
22
+ cadence norms — but the approval-per-PR and CI-green-at-signal-time gates below are hard
23
+ constants regardless of what a project's doc says.
24
+
25
+ **This skill runs far less often than the rest of the flow.** Most PRs on this repo don't need
26
+ an explicit re-request — a push alone re-triggers review for an already-requested reviewer, and
27
+ this team doesn't like being tagged unnecessarily. Only invoke this when the user actually asks
28
+ for it, by PR number.
29
+
30
+ ## Steps
31
+
32
+ 1. **Verify the gate, don't assume it from a report given earlier in the conversation:**
33
+ - The PR is still open (`gh pr view <n> --json state,mergedAt`) — a merged/closed PR gets
34
+ no signal; report the state change instead.
35
+ - Every review thread is resolved (re-check now via GraphQL `reviewThreads.isResolved` — a
36
+ `pr-review-sweep:land-and-resolve` report from even a few minutes ago can be stale if
37
+ anything else touched the PR, and a new comment that arrived since means the PR goes back
38
+ through `pr-review-sweep:classify`, not to a signal).
39
+ - CI is green **right now** — re-run `gh pr checks <n> --repo "$(gh repo view --json nameWithOwner -q .nameWithOwner)"` immediately
40
+ before acting. An approval given while CI was green does not survive CI going red in
41
+ between (a later push, a flaky rerun). If CI is red at signal-time, stop and report it —
42
+ never signal on a stale approval, and never solicit approval on a PR that's currently
43
+ CI-red in the first place.
44
+ - No review is already outstanding (requested, not yet dismissed by a later push) — if one
45
+ is, the push itself was already the signal; do not re-request
46
+ ([[no-reviewer-ping-without-approval]] / [[reviewers-dont-spam]]).
47
+ - The user's approval is for **this PR number, in this conversation** — a blanket "yes,
48
+ signal when ready" said about a different PR, or said before this session, does not count.
49
+
50
+ 2. **If any gate check fails**, stop and report exactly which one — don't ask "should I signal
51
+ now?" as a throwaway line and proceed anyway.
52
+
53
+ 3. **If every gate check passes**, request the reviewer:
54
+ ```bash
55
+ gh pr edit <number> --repo "$(gh repo view --json nameWithOwner -q .nameWithOwner)" --add-reviewer <reviewer>
56
+ ```
57
+ If `gh pr edit` fails with the known "Projects (classic)" GraphQL deprecation error on this
58
+ repo, fall back to
59
+ `gh api repos/$(gh repo view --json nameWithOwner -q .nameWithOwner)/pulls/<n>/requested_reviewers -f "reviewers[]=<reviewer>"` —
60
+ and send it exactly once; verify via `gh pr view <n> --json reviewRequests` rather than
61
+ retrying blind (a retry after an ambiguous failure is how a double-ping happens).
62
+ Do not add a "ready for re-review" comment or @-mention on top of the request — the request
63
+ itself is the signal; a comment on top of it is the over-notification this skill exists to
64
+ avoid.
65
+
66
+ 4. **Report** the PR as signaled, and loop back to `project-status-local` to pick up the new
67
+ state on its next run.
@@ -5,7 +5,7 @@ description: Use when completing tasks, implementing major features, or before m
5
5
 
6
6
  # Requesting Code Review
7
7
 
8
- Dispatch superpowers:code-reviewer subagent to catch issues before they cascade.
8
+ Dispatch the native `code-reviewer` subagent (via the Agent tool, `subagent_type: "code-reviewer"`) to catch issues before they cascade.
9
9
 
10
10
  **Core principle:** Review early, review often.
11
11
 
@@ -31,7 +31,7 @@ HEAD_SHA=$(git rev-parse HEAD)
31
31
 
32
32
  **2. Dispatch code-reviewer subagent:**
33
33
 
34
- Use Task tool with superpowers:code-reviewer type, fill template at `code-reviewer.md`
34
+ Use the Agent tool with `subagent_type: "code-reviewer"`, filling the template at `code-reviewer.md`
35
35
 
36
36
  **Placeholders:**
37
37
  - `{WHAT_WAS_IMPLEMENTED}` - What you just built
@@ -56,7 +56,7 @@ You: Let me request code review before proceeding.
56
56
  BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
57
57
  HEAD_SHA=$(git rev-parse HEAD)
58
58
 
59
- [Dispatch superpowers:code-reviewer subagent]
59
+ [Dispatch code-reviewer subagent via the Agent tool]
60
60
  WHAT_WAS_IMPLEMENTED: Verification and repair functions for conversation index
61
61
  PLAN_OR_REQUIREMENTS: Task 2 from docs/plans/deployment-plan.md
62
62
  BASE_SHA: a7981ec
@@ -74,20 +74,23 @@ You: [Fix progress indicators]
74
74
  [Continue to Task 3]
75
75
  ```
76
76
 
77
- ## Integration with Workflows
78
-
79
- **Subagent-Driven Development:**
80
- - Review after EACH task
81
- - Catch issues before they compound
82
- - Fix before moving to next task
83
-
84
- **Executing Plans:**
85
- - Review after each batch (3 tasks)
86
- - Get feedback, apply, continue
87
-
88
- **Ad-Hoc Development:**
89
- - Review before merge
90
- - Review when stuck
77
+ ## Integration with /develop
78
+
79
+ This is the **default** reviewer at `/develop`'s Phase 2 done-gate (step 8) — but not the only
80
+ one. `/develop` routes to a matching specialist first when a PRD's surface calls for it
81
+ (`api-designer` for API-contract changes, `security-auditor` for auth/input/data, `refactorer`
82
+ for structural refactors, `perf-profiler` for hot-path changes, `dependency-auditor` for
83
+ dependency bumps) and only falls back to this generic reviewer for everything else or when no
84
+ specialist fits. Don't treat this skill as covering ground those specialists already own.
85
+
86
+ Since this project's actual unit of work is a scheduler PRD (not a live multi-task session), the
87
+ review point is per-PRD, at its own commit range — `BASE_SHA`/`HEAD_SHA` above are that PRD's
88
+ commit(s), not an arbitrary task boundary from a different workflow shape. Review:
89
+ - **After a PRD completes**, as part of `/develop`'s definition-of-done gate (step 8) — every
90
+ major/risky PRD, before calling it done.
91
+ - **When a PRD comes back `needs_review`** — read the scheduler's auto-filed RCA first
92
+ (`rcaFeedbackHook`'s `<date>-rca-<slug>-<runId>.md`), then use this review to confirm the fix
93
+ if one gets queued.
91
94
 
92
95
  ## Red Flags
93
96