plan-review 1.1.0 → 1.1.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.
Files changed (44) hide show
  1. package/dist/browser/app.js +38 -38
  2. package/dist/browser/index.html +129 -38
  3. package/dist/index.js +30 -305
  4. package/dist/index.js.map +7 -1
  5. package/package.json +12 -13
  6. package/README.md +0 -149
  7. package/dist/formatter.d.ts +0 -2
  8. package/dist/formatter.js +0 -60
  9. package/dist/formatter.js.map +0 -1
  10. package/dist/index.d.ts +0 -2
  11. package/dist/navigator.d.ts +0 -5
  12. package/dist/navigator.js +0 -94
  13. package/dist/navigator.js.map +0 -1
  14. package/dist/output.d.ts +0 -7
  15. package/dist/output.js +0 -93
  16. package/dist/output.js.map +0 -1
  17. package/dist/parser.d.ts +0 -3
  18. package/dist/parser.js +0 -265
  19. package/dist/parser.js.map +0 -1
  20. package/dist/renderer.d.ts +0 -3
  21. package/dist/renderer.js +0 -78
  22. package/dist/renderer.js.map +0 -1
  23. package/dist/server/assets.d.ts +0 -1
  24. package/dist/server/assets.js +0 -25
  25. package/dist/server/assets.js.map +0 -1
  26. package/dist/server/routes.d.ts +0 -14
  27. package/dist/server/routes.js +0 -192
  28. package/dist/server/routes.js.map +0 -1
  29. package/dist/server/server.d.ts +0 -7
  30. package/dist/server/server.js +0 -23
  31. package/dist/server/server.js.map +0 -1
  32. package/dist/session.d.ts +0 -25
  33. package/dist/session.js +0 -133
  34. package/dist/session.js.map +0 -1
  35. package/dist/transport.d.ts +0 -32
  36. package/dist/transport.js +0 -62
  37. package/dist/transport.js.map +0 -1
  38. package/dist/types.d.ts +0 -34
  39. package/dist/types.js +0 -2
  40. package/dist/types.js.map +0 -1
  41. package/examples/demo-browser.gif +0 -0
  42. package/examples/demo-plan.md +0 -129
  43. package/examples/renderer-fixture.md +0 -246
  44. package/skills/plan-review/SKILL.md +0 -70
@@ -1,129 +0,0 @@
1
- # User Authentication System — Implementation Plan
2
-
3
- **Goal:** Add email/password authentication with session management to the web app.
4
-
5
- **Architecture:** Express middleware + bcrypt + JWT tokens + PostgreSQL sessions table. Three milestones: database schema, auth endpoints, session management.
6
-
7
- **Tech Stack:** Node.js, Express, PostgreSQL, bcrypt, jsonwebtoken
8
-
9
- ---
10
-
11
- ## Milestone 1: Database Foundation
12
-
13
- ### Task 1.1: Create users table
14
-
15
- **Depends On:** (none)
16
- **Blocks:** 1.2, 2.1, 2.2
17
- **Related Files:** `src/db/migrations/001_users.sql`, `src/db/schema.ts`
18
- **Verification:** `npm run migrate && npm test`
19
-
20
- Create the users table with the following columns:
21
-
22
- | Column | Type | Constraints |
23
- |--------|------|-------------|
24
- | id | UUID | PRIMARY KEY, DEFAULT gen_random_uuid() |
25
- | email | VARCHAR(255) | UNIQUE, NOT NULL |
26
- | password_hash | VARCHAR(255) | NOT NULL |
27
- | created_at | TIMESTAMP | DEFAULT NOW() |
28
- | updated_at | TIMESTAMP | DEFAULT NOW() |
29
-
30
- Add an index on `email` for login lookups. The migration should be idempotent (use `IF NOT EXISTS`).
31
-
32
- ### Task 1.2: Create sessions table
33
-
34
- **Depends On:** 1.1
35
- **Blocks:** 3.1, 3.2
36
- **Related Files:** `src/db/migrations/002_sessions.sql`, `src/db/schema.ts`
37
- **Verification:** `npm run migrate && npm test`
38
-
39
- Sessions table for server-side session tracking:
40
-
41
- - `id` (UUID, primary key)
42
- - `user_id` (UUID, foreign key → users.id, ON DELETE CASCADE)
43
- - `token` (VARCHAR, unique, indexed)
44
- - `expires_at` (TIMESTAMP, NOT NULL)
45
- - `created_at` (TIMESTAMP, DEFAULT NOW())
46
-
47
- Add a cleanup index on `expires_at` for the session pruning job.
48
-
49
- ---
50
-
51
- ## Milestone 2: Authentication Endpoints
52
-
53
- ### Task 2.1: POST /auth/register
54
-
55
- **Depends On:** 1.1
56
- **Blocks:** 2.3
57
- **Related Files:** `src/routes/auth.ts`, `src/services/user.ts`, `tests/auth.test.ts`
58
- **Verification:** `npm test -- --grep "register"`
59
-
60
- Accepts `{ email, password }`. Validates:
61
- - Email format (basic regex, no need for RFC 5322 compliance)
62
- - Password minimum 8 characters
63
- - Email not already registered (unique constraint handles race conditions)
64
-
65
- Hash password with bcrypt (cost factor 12). Return `201 { user: { id, email } }` on success, `400` with validation errors, `409` if email exists.
66
-
67
- ### Task 2.2: POST /auth/login
68
-
69
- **Depends On:** 1.1
70
- **Blocks:** 2.3
71
- **Related Files:** `src/routes/auth.ts`, `src/services/auth.ts`, `tests/auth.test.ts`
72
- **Verification:** `npm test -- --grep "login"`
73
-
74
- Accepts `{ email, password }`. Compares against stored bcrypt hash.
75
-
76
- On success: create a session (Task 3.1), return `200 { token, expiresAt }`.
77
- On failure: return `401 { error: "Invalid credentials" }`. Do **not** reveal whether the email exists.
78
-
79
- Rate limiting: 5 attempts per email per 15 minutes. Use a simple in-memory counter (Redis in v2).
80
-
81
- ### Task 2.3: Auth middleware
82
-
83
- **Depends On:** 2.1, 2.2
84
- **Blocks:** 3.2
85
- **Related Files:** `src/middleware/auth.ts`, `tests/middleware.test.ts`
86
- **Verification:** `npm test -- --grep "middleware"`
87
-
88
- Express middleware that:
89
- 1. Extracts `Authorization: Bearer <token>` header
90
- 2. Looks up session by token
91
- 3. Checks `expires_at > NOW()`
92
- 4. Attaches `req.user = { id, email }` if valid
93
- 5. Returns `401` if missing/invalid/expired
94
-
95
- Should be composable: `router.get('/profile', requireAuth, handler)`.
96
-
97
- ---
98
-
99
- ## Milestone 3: Session Management
100
-
101
- ### Task 3.1: Session creation and token generation
102
-
103
- **Depends On:** 1.2
104
- **Blocks:** 3.2
105
- **Related Files:** `src/services/session.ts`, `tests/session.test.ts`
106
- **Verification:** `npm test -- --grep "session"`
107
-
108
- Generate tokens using `crypto.randomBytes(32).toString('hex')` — not JWT for session tokens (JWTs can't be revoked without a blacklist, defeating the purpose of server-side sessions).
109
-
110
- Default expiry: 7 days. Configurable via `SESSION_TTL_HOURS` env var.
111
-
112
- ### Task 3.2: Session cleanup and logout
113
-
114
- **Depends On:** 1.2, 2.3
115
- **Blocks:** (none)
116
- **Related Files:** `src/services/session.ts`, `src/routes/auth.ts`, `tests/session.test.ts`
117
- **Verification:** `npm test -- --grep "logout|cleanup"`
118
-
119
- Two features:
120
-
121
- **Logout endpoint** — `POST /auth/logout` (requires auth middleware). Deletes the current session row. Returns `204`.
122
-
123
- **Cleanup job** — Runs every hour via `setInterval`. Deletes sessions where `expires_at < NOW()`. Log the count of pruned sessions.
124
-
125
- ```sql
126
- DELETE FROM sessions WHERE expires_at < NOW();
127
- ```
128
-
129
- Consider: should logout invalidate all sessions for the user, or just the current one? Start with current-only. Add "logout everywhere" as a v2 feature.
@@ -1,246 +0,0 @@
1
- # Renderer Fixture
2
-
3
- A single-file smoke test for every markdown structure the browser and terminal renderers should handle. Used to triage formatting bugs.
4
-
5
- ## Paragraphs and inline formatting
6
-
7
- Regular paragraph with **bold**, *italic*, ***bold italic***, ~~strikethrough~~, `inline code`, and a [link](https://example.com). Hard line break:\
8
- new line here. Soft wrap
9
- continues on the next line.
10
-
11
- Escape chars: \*not italic\* \_not italic\_ \`not code\`.
12
-
13
- ## Headings (levels 3-6 inside a section)
14
-
15
- ### Level 3
16
-
17
- #### Level 4
18
-
19
- ##### Level 5
20
-
21
- ###### Level 6
22
-
23
- ## Lists
24
-
25
- ### Unordered, nested
26
-
27
- - one
28
- - one-a
29
- - one-a-i
30
- - one-b
31
- - two
32
- - three with **bold** and `code`
33
-
34
- ### Ordered, nested
35
-
36
- 1. first
37
- 2. second
38
- 1. two-a
39
- 2. two-b
40
- 3. third
41
-
42
- ### Mixed
43
-
44
- 1. outer ordered
45
- - inner unordered
46
- 1. inner-inner ordered
47
- - another inner
48
- 2. back to outer
49
-
50
- ### GitHub task list
51
-
52
- - [ ] unchecked
53
- - [x] checked
54
- - [ ] nested parent
55
- - [x] nested child done
56
- - [ ] nested child todo
57
-
58
- ## Blockquotes
59
-
60
- > Single-level quote.
61
-
62
- > Nested:
63
- >
64
- > > Level 2
65
- > >
66
- > > > Level 3 with `code` and **bold**.
67
-
68
- > Quote containing a code block:
69
- >
70
- > ```js
71
- > const x = 1;
72
- > ```
73
-
74
- ## Code blocks
75
-
76
- Inline `code` and a plain fence:
77
-
78
- ```
79
- plain fenced block, no language
80
- ```
81
-
82
- Language-tagged fence:
83
-
84
- ```ts
85
- function greet(name: string): string {
86
- return `Hello, ${name}!`;
87
- }
88
- ```
89
-
90
- Long line that should wrap or scroll (no hidden overflow please):
91
-
92
- ```
93
- this is a very long line in a code block that should handle horizontal overflow gracefully without breaking layout or being silently clipped by CSS max-width
94
- ```
95
-
96
- ## Mermaid
97
-
98
- Flowchart (exercises all 6 roles + yes/no branches):
99
-
100
- ```mermaid
101
- flowchart TD
102
- Begin([Start request]) --> CheckAuth{Valid token?}
103
- CheckAuth -->|Yes| Serve[Serve resource]
104
- CheckAuth -->|No| Fail[Auth error log]
105
- Serve --> Log[/Write audit/]
106
- Log --> Done([End])
107
- Fail --> Done
108
- ```
109
-
110
- Sequence diagram:
111
-
112
- ```mermaid
113
- sequenceDiagram
114
- participant User
115
- participant CLI
116
- participant Server
117
- User->>CLI: plan-review plan.md --browser
118
- CLI->>Server: start
119
- Server-->>User: open http://localhost:PORT
120
- User->>Server: submit review
121
- Server-->>CLI: comments
122
- ```
123
-
124
- ## Other fenced diagram languages
125
-
126
- Plain dot/graphviz (expected: rendered as code or degraded cleanly, not crash):
127
-
128
- ```dot
129
- digraph { A -> B -> C; A -> C; }
130
- ```
131
-
132
- ## Tables
133
-
134
- Basic:
135
-
136
- | col a | col b | col c |
137
- |-------|-------|-------|
138
- | 1 | 2 | 3 |
139
- | 4 | 5 | 6 |
140
-
141
- With alignment:
142
-
143
- | left | center | right |
144
- |:-----|:------:|------:|
145
- | l | c | r |
146
- | ll | cc | rrrr |
147
-
148
- With inline formatting in cells:
149
-
150
- | term | meaning |
151
- |------|---------|
152
- | `cmd` | runs a **command** with [docs](https://example.com) |
153
- | `flag` | passes *an option* |
154
-
155
- ## Images
156
-
157
- Local path (may or may not resolve depending on how plan-review handles relative paths):
158
-
159
- ![local gif](demo-browser.gif)
160
-
161
- Remote URL:
162
-
163
- ![remote placeholder](https://placehold.co/240x80/16213e/00adb5/png?text=plan-review)
164
-
165
- ## Links
166
-
167
- Auto-link: <https://anthropic.com>
168
-
169
- Reference-style: this is a [ref link][1] and here is [another][2].
170
-
171
- [1]: https://example.com "Example"
172
- [2]: https://github.com/alvaroaac/plan-review
173
-
174
- ## Footnotes
175
-
176
- Here's a claim with a footnote[^note1]. And a second[^note2].
177
-
178
- [^note1]: The first footnote body.
179
- [^note2]: The second one, with `code` and **bold**.
180
-
181
- ## Math
182
-
183
- Inline: $E = mc^2$ and a longer one $\sum_{i=1}^{n} i = \frac{n(n+1)}{2}$.
184
-
185
- Display:
186
-
187
- $$
188
- f(x) = \int_{-\infty}^{\infty} \hat f(\xi)\, e^{2 \pi i \xi x}\, d\xi
189
- $$
190
-
191
- ## Inline HTML
192
-
193
- <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy. H<sub>2</sub>O and E = mc<sup>2</sup>.
194
-
195
- <details>
196
- <summary>Click to expand</summary>
197
-
198
- Hidden content with **formatting** and a `code` sample.
199
-
200
- </details>
201
-
202
- ## Admonitions / callouts
203
-
204
- > [!NOTE]
205
- > GitHub-style note admonition.
206
-
207
- > [!WARNING]
208
- > GitHub-style warning admonition.
209
-
210
- :::note
211
- Docusaurus-style note admonition.
212
- :::
213
-
214
- :::tip
215
- Docusaurus tip with **inline formatting** and `code`.
216
- :::
217
-
218
- ## Horizontal rules
219
-
220
- Above this line.
221
-
222
- ---
223
-
224
- Below this line.
225
-
226
- ## Emoji
227
-
228
- Shortcodes: :tada: :rocket: :warning: (may or may not expand).
229
-
230
- Unicode: 🎉 🚀 ⚠️ (should always render).
231
-
232
- ## Hard edge cases
233
-
234
- Fence containing triple-backtick:
235
-
236
- ````md
237
- ```js
238
- // nested fence
239
- ```
240
- ````
241
-
242
- Mixed HTML + markdown in a blockquote:
243
-
244
- > <kbd>Enter</kbd> to submit, or *cancel* and [try again](#).
245
-
246
- Long word: supercalifragilisticexpialidocious-plus-a-lot-more-characters-to-see-how-wrapping-behaves-in-tight-layouts.
@@ -1,70 +0,0 @@
1
- ---
2
- name: plan-review
3
- description: Use when the user asks to review a plan, start plan review, or says "I want to review this plan". Triggers on plan review requests for markdown implementation plans, specs, or design docs — including plans produced on-the-fly in this conversation. Builds and runs the plan-review browser UI, feeds review output back into the conversation.
4
- ---
5
-
6
- # Plan Review
7
-
8
- Launch the plan-review browser UI for interactive review of markdown plans, then feed the structured review output back into this session.
9
-
10
- Works with two input sources:
11
- - **A plan file on disk** (path given by the user, or the most recent plan file in the project).
12
- - **An on-the-fly plan** produced in this conversation (e.g. from plan mode, or markdown the user just pasted). The plan content is piped in via stdin — no temp file needed.
13
-
14
- ## Prerequisites
15
-
16
- Either the `plan-review` CLI is on `$PATH` (installed via `npm install -g plan-review`) or a local dev checkout exists at `~/desenv/personal/plan-review/`.
17
-
18
- ## Process
19
-
20
- 1. **Identify the plan source.** Decide which branch you're in:
21
- - **File branch** — the user named a file, or pointed at a path, or asked to review "the plan at X". Also the default when you find a single recent match in `docs/superpowers/plans/*.md`. If multiple candidates exist, ask which one.
22
- - **Inline branch** — the user asks to review "this plan" / "the plan above" / "the plan you just wrote" / pastes markdown, or plan mode just produced a plan in the conversation. No file path exists.
23
-
24
- 2. **Pick the binary.** Prefer the installed CLI; fall back to the local dev build.
25
- ```bash
26
- if command -v plan-review >/dev/null 2>&1; then
27
- PLAN_REVIEW_CMD="plan-review"
28
- else
29
- # Dev fallback: build if dist missing
30
- if [ ! -f ~/desenv/personal/plan-review/dist/index.js ]; then
31
- (cd ~/desenv/personal/plan-review && npm run build)
32
- fi
33
- PLAN_REVIEW_CMD="node $HOME/desenv/personal/plan-review/dist/index.js"
34
- fi
35
- ```
36
-
37
- 3. **Run the review.** Browser mode is the default — no flag needed.
38
-
39
- **File branch:**
40
- ```bash
41
- $PLAN_REVIEW_CMD <plan-file> -o stdout
42
- ```
43
-
44
- **Inline branch** — pipe the plan content via a quoted heredoc so markdown is passed through verbatim (no shell expansion, no escaping needed):
45
- ```bash
46
- $PLAN_REVIEW_CMD -o stdout <<'PLAN_EOF'
47
- # My Plan
48
-
49
- ## Section 1
50
- ...plan content from this conversation...
51
- PLAN_EOF
52
- ```
53
-
54
- Both variants open the browser review UI and block until the user clicks "Submit Review", then print structured review output to stdout.
55
-
56
- 4. **Read the output.** The review output is structured markdown with the user's comments anchored to specific sections. Read it and present a summary to the user.
57
-
58
- 5. **Act on feedback.** Ask the user what they want to do with the review:
59
- - Address the comments (modify the plan or code)
60
- - Save the review to a file
61
- - Continue discussion about specific comments
62
-
63
- ## Important
64
-
65
- - Browser mode (three-panel TOC + content + comments UI) is the default — no flag needed. Pass `--cli` only for SSH/CI/headless environments.
66
- - The `-o stdout` flag ensures the review output comes back to this session.
67
- - The command will block until the user clicks "Submit Review" in the browser.
68
- - **File branch only:** if a session exists for this plan, the user is prompted to resume. Use `--fresh` to skip.
69
- - **Inline branch:** there is no file anchor, so no session resume — the review is ephemeral.
70
- - Always use a **quoted** heredoc delimiter (`<<'PLAN_EOF'`) so backticks, `$`, and other shell metacharacters in the plan are left alone.