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.
- package/dist/browser/app.js +38 -38
- package/dist/browser/index.html +129 -38
- package/dist/index.js +30 -305
- package/dist/index.js.map +7 -1
- package/package.json +12 -13
- package/README.md +0 -149
- package/dist/formatter.d.ts +0 -2
- package/dist/formatter.js +0 -60
- package/dist/formatter.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/navigator.d.ts +0 -5
- package/dist/navigator.js +0 -94
- package/dist/navigator.js.map +0 -1
- package/dist/output.d.ts +0 -7
- package/dist/output.js +0 -93
- package/dist/output.js.map +0 -1
- package/dist/parser.d.ts +0 -3
- package/dist/parser.js +0 -265
- package/dist/parser.js.map +0 -1
- package/dist/renderer.d.ts +0 -3
- package/dist/renderer.js +0 -78
- package/dist/renderer.js.map +0 -1
- package/dist/server/assets.d.ts +0 -1
- package/dist/server/assets.js +0 -25
- package/dist/server/assets.js.map +0 -1
- package/dist/server/routes.d.ts +0 -14
- package/dist/server/routes.js +0 -192
- package/dist/server/routes.js.map +0 -1
- package/dist/server/server.d.ts +0 -7
- package/dist/server/server.js +0 -23
- package/dist/server/server.js.map +0 -1
- package/dist/session.d.ts +0 -25
- package/dist/session.js +0 -133
- package/dist/session.js.map +0 -1
- package/dist/transport.d.ts +0 -32
- package/dist/transport.js +0 -62
- package/dist/transport.js.map +0 -1
- package/dist/types.d.ts +0 -34
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/examples/demo-browser.gif +0 -0
- package/examples/demo-plan.md +0 -129
- package/examples/renderer-fixture.md +0 -246
- package/skills/plan-review/SKILL.md +0 -70
package/dist/server/routes.js
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs';
|
|
2
|
-
import { join, normalize, resolve as resolvePath, sep, extname } from 'node:path';
|
|
3
|
-
const MAX_BODY_SIZE = 1024 * 1024; // 1MB
|
|
4
|
-
const MIME_BY_EXT = {
|
|
5
|
-
'.gif': 'image/gif',
|
|
6
|
-
'.png': 'image/png',
|
|
7
|
-
'.jpg': 'image/jpeg',
|
|
8
|
-
'.jpeg': 'image/jpeg',
|
|
9
|
-
'.svg': 'image/svg+xml',
|
|
10
|
-
'.webp': 'image/webp',
|
|
11
|
-
'.avif': 'image/avif',
|
|
12
|
-
'.ico': 'image/x-icon',
|
|
13
|
-
};
|
|
14
|
-
function validateComment(obj) {
|
|
15
|
-
if (typeof obj !== 'object' || obj === null)
|
|
16
|
-
return false;
|
|
17
|
-
const c = obj;
|
|
18
|
-
return typeof c.sectionId === 'string' && typeof c.text === 'string';
|
|
19
|
-
}
|
|
20
|
-
export function createRouteHandler(ctx) {
|
|
21
|
-
return (req, res) => {
|
|
22
|
-
const { method, url } = req;
|
|
23
|
-
if (method === 'GET' && url === '/') {
|
|
24
|
-
const html = ctx.getAssetHtml();
|
|
25
|
-
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
26
|
-
res.end(html);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (method === 'GET' && url === '/api/doc') {
|
|
30
|
-
const doc = ctx.getDocument();
|
|
31
|
-
const initialState = { activeSection: ctx.getInitialActiveSection?.() ?? null };
|
|
32
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
33
|
-
res.end(JSON.stringify({ document: doc, initialState }));
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
if (method === 'POST' && url === '/api/review') {
|
|
37
|
-
let body = '';
|
|
38
|
-
let size = 0;
|
|
39
|
-
req.on('data', (chunk) => {
|
|
40
|
-
size += chunk.length;
|
|
41
|
-
if (size > MAX_BODY_SIZE) {
|
|
42
|
-
res.writeHead(413, { 'Content-Type': 'application/json' });
|
|
43
|
-
res.end(JSON.stringify({ error: 'Request body too large' }));
|
|
44
|
-
req.destroy();
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
body += chunk.toString();
|
|
48
|
-
});
|
|
49
|
-
req.on('end', () => {
|
|
50
|
-
if (size > MAX_BODY_SIZE)
|
|
51
|
-
return;
|
|
52
|
-
try {
|
|
53
|
-
const parsed = JSON.parse(body);
|
|
54
|
-
const comments = parsed.comments;
|
|
55
|
-
if (!Array.isArray(comments)) {
|
|
56
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
57
|
-
res.end(JSON.stringify({ error: 'comments must be an array' }));
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
for (const c of comments) {
|
|
61
|
-
if (!validateComment(c)) {
|
|
62
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
63
|
-
res.end(JSON.stringify({ error: 'Each comment must have sectionId (string) and text (string)' }));
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
ctx.onSubmit(comments);
|
|
68
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
69
|
-
res.end(JSON.stringify({ success: true }));
|
|
70
|
-
}
|
|
71
|
-
catch {
|
|
72
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
73
|
-
res.end(JSON.stringify({ error: 'Invalid JSON' }));
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (method === 'PUT' && url === '/api/session') {
|
|
79
|
-
let body = '';
|
|
80
|
-
let size = 0;
|
|
81
|
-
req.on('data', (chunk) => {
|
|
82
|
-
size += chunk.length;
|
|
83
|
-
if (size > MAX_BODY_SIZE) {
|
|
84
|
-
res.writeHead(413, { 'Content-Type': 'application/json' });
|
|
85
|
-
res.end(JSON.stringify({ error: 'Request body too large' }));
|
|
86
|
-
req.destroy();
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
body += chunk.toString();
|
|
90
|
-
});
|
|
91
|
-
req.on('end', () => {
|
|
92
|
-
if (size > MAX_BODY_SIZE)
|
|
93
|
-
return;
|
|
94
|
-
try {
|
|
95
|
-
const parsed = JSON.parse(body);
|
|
96
|
-
const comments = parsed.comments;
|
|
97
|
-
if (!Array.isArray(comments)) {
|
|
98
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
99
|
-
res.end(JSON.stringify({ error: 'comments must be an array' }));
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
for (const c of comments) {
|
|
103
|
-
if (!validateComment(c)) {
|
|
104
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
105
|
-
res.end(JSON.stringify({ error: 'Each comment must have sectionId (string) and text (string)' }));
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
const activeSection = typeof parsed.activeSection === 'string' ? parsed.activeSection : null;
|
|
110
|
-
ctx.onSessionSave?.(comments, activeSection);
|
|
111
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
112
|
-
res.end(JSON.stringify({ success: true }));
|
|
113
|
-
}
|
|
114
|
-
catch {
|
|
115
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
116
|
-
res.end(JSON.stringify({ error: 'Invalid JSON' }));
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
if (method === 'POST' && url === '/api/heartbeat') {
|
|
122
|
-
ctx.onHeartbeat?.();
|
|
123
|
-
res.writeHead(204);
|
|
124
|
-
res.end();
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (method === 'POST' && url === '/api/pause') {
|
|
128
|
-
ctx.onPause?.();
|
|
129
|
-
res.writeHead(204);
|
|
130
|
-
res.end();
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
if (method === 'POST' && url === '/api/cancel') {
|
|
134
|
-
ctx.onCancel?.();
|
|
135
|
-
res.writeHead(204);
|
|
136
|
-
res.end();
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
// Static asset proxy: /_assets/<rel-path> serves files from the plan
|
|
140
|
-
// file's directory. Only image extensions are allowed; path traversal
|
|
141
|
-
// (e.g. ../etc/passwd) is rejected. Inline plans set baseDir to null and
|
|
142
|
-
// get a 404 — there is no on-disk anchor to resolve against.
|
|
143
|
-
if (method === 'GET' && url && url.startsWith('/_assets/')) {
|
|
144
|
-
const baseDir = ctx.getAssetBaseDir?.();
|
|
145
|
-
if (!baseDir) {
|
|
146
|
-
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
147
|
-
res.end('No asset base directory');
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
let rel;
|
|
151
|
-
try {
|
|
152
|
-
rel = decodeURIComponent(url.slice('/_assets/'.length).split('?')[0].split('#')[0]);
|
|
153
|
-
}
|
|
154
|
-
catch {
|
|
155
|
-
res.writeHead(400, { 'Content-Type': 'text/plain' });
|
|
156
|
-
res.end('Bad request');
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
const ext = extname(rel).toLowerCase();
|
|
160
|
-
if (!MIME_BY_EXT[ext]) {
|
|
161
|
-
res.writeHead(415, { 'Content-Type': 'text/plain' });
|
|
162
|
-
res.end('Unsupported media type');
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
const normalized = normalize(rel);
|
|
166
|
-
const resolvedBase = resolvePath(baseDir);
|
|
167
|
-
const resolvedFile = resolvePath(join(resolvedBase, normalized));
|
|
168
|
-
if (!resolvedFile.startsWith(resolvedBase + sep) && resolvedFile !== resolvedBase) {
|
|
169
|
-
res.writeHead(403, { 'Content-Type': 'text/plain' });
|
|
170
|
-
res.end('Forbidden');
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
readFile(resolvedFile, (err, buf) => {
|
|
174
|
-
if (err) {
|
|
175
|
-
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
176
|
-
res.end('Not Found');
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
res.writeHead(200, {
|
|
180
|
-
'Content-Type': MIME_BY_EXT[ext],
|
|
181
|
-
'Content-Length': buf.length,
|
|
182
|
-
'Cache-Control': 'no-store',
|
|
183
|
-
});
|
|
184
|
-
res.end(buf);
|
|
185
|
-
});
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
189
|
-
res.end('Not Found');
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
//# sourceMappingURL=routes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/server/routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,IAAI,WAAW,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGlF,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,MAAM;AAEzC,MAAM,WAAW,GAA2B;IAC1C,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,eAAe;IACvB,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,cAAc;CACvB,CAAC;AAcF,SAAS,eAAe,CAAC,GAAY;IACnC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC1D,MAAM,CAAC,GAAG,GAA8B,CAAC;IACzC,OAAO,OAAO,CAAC,CAAC,SAAS,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,GAAiB;IAClD,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAClB,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;QAE5B,IAAI,MAAM,KAAK,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AAE,WAAW,CAAC,GAAG,CAAC;oBAChC,gBAAgB,EAAE,GAAG,CAAC,MAAM;oBAC5B,eAAe,EAAE,UAAU;iBAC5B,CAAC,CAAC;gBACH,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACf,CAAC,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,CAAC;QACrD,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/server/server.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type Server } from 'node:http';
|
|
2
|
-
import { type RouteContext } from './routes.js';
|
|
3
|
-
export declare function createReviewServer(ctx: RouteContext): Server;
|
|
4
|
-
export declare function startServer(server: Server, port: number): Promise<{
|
|
5
|
-
url: string;
|
|
6
|
-
}>;
|
|
7
|
-
export declare function stopServer(server: Server): Promise<void>;
|
package/dist/server/server.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createServer } from 'node:http';
|
|
2
|
-
import { createRouteHandler } from './routes.js';
|
|
3
|
-
export function createReviewServer(ctx) {
|
|
4
|
-
return createServer(createRouteHandler(ctx));
|
|
5
|
-
}
|
|
6
|
-
export function startServer(server, port) {
|
|
7
|
-
return new Promise((resolve, reject) => {
|
|
8
|
-
server.on('error', reject);
|
|
9
|
-
server.listen(port, () => {
|
|
10
|
-
const addr = server.address();
|
|
11
|
-
const actualPort = typeof addr === 'object' && addr ? addr.port : port;
|
|
12
|
-
resolve({ url: `http://localhost:${actualPort}` });
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
export function stopServer(server) {
|
|
17
|
-
return new Promise((resolve, reject) => {
|
|
18
|
-
server.close((err) => (err ? reject(err) : resolve()));
|
|
19
|
-
// Force-close keep-alive sockets so close() doesn't hang on an idle browser tab.
|
|
20
|
-
server.closeAllConnections();
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAqB,MAAM,aAAa,CAAC;AAEpE,MAAM,UAAU,kBAAkB,CAAC,GAAiB;IAClD,OAAO,YAAY,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,IAAY;IACtD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;YACvB,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;YAC9B,MAAM,UAAU,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;YACvE,OAAO,CAAC,EAAE,GAAG,EAAE,oBAAoB,UAAU,EAAE,EAAE,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACvD,iFAAiF;QACjF,MAAM,CAAC,mBAAmB,EAAE,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/session.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ReviewComment } from './types.js';
|
|
2
|
-
export interface SessionData {
|
|
3
|
-
version: number;
|
|
4
|
-
planPath: string;
|
|
5
|
-
contentHash: string;
|
|
6
|
-
comments: ReviewComment[];
|
|
7
|
-
activeSection: string | null;
|
|
8
|
-
lastModified: string;
|
|
9
|
-
}
|
|
10
|
-
export interface SessionLoadResult {
|
|
11
|
-
comments: ReviewComment[];
|
|
12
|
-
activeSection: string | null;
|
|
13
|
-
stale: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare function getSessionDir(): string;
|
|
16
|
-
export declare function computeContentHash(content: string): string;
|
|
17
|
-
export declare function saveSession(planPath: string, contentHash: string, comments: ReviewComment[], activeSection: string | null): void;
|
|
18
|
-
export declare function loadSession(planPath: string, currentContentHash: string): SessionLoadResult | null;
|
|
19
|
-
export declare function clearSession(planPath: string): void;
|
|
20
|
-
export declare function listSessions(): Array<{
|
|
21
|
-
planPath: string;
|
|
22
|
-
commentCount: number;
|
|
23
|
-
lastModified: string;
|
|
24
|
-
stale: boolean | null;
|
|
25
|
-
}>;
|
package/dist/session.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
import { mkdirSync, readFileSync, writeFileSync, unlinkSync, readdirSync, existsSync, } from 'node:fs';
|
|
3
|
-
import { join, resolve } from 'node:path';
|
|
4
|
-
import { homedir } from 'node:os';
|
|
5
|
-
// ── Internal helpers (not exported) ────────────────────────────────
|
|
6
|
-
function pathHash(planPath) {
|
|
7
|
-
const abs = resolve(planPath);
|
|
8
|
-
const hash = createHash('sha256').update(abs).digest('hex');
|
|
9
|
-
return hash.slice(0, 16);
|
|
10
|
-
}
|
|
11
|
-
function sessionFilePath(planPath) {
|
|
12
|
-
return join(getSessionDir(), pathHash(planPath) + '.json');
|
|
13
|
-
}
|
|
14
|
-
// ── Exported functions ─────────────────────────────────────────────
|
|
15
|
-
export function getSessionDir() {
|
|
16
|
-
const dir = join(homedir(), '.plan-review', 'sessions');
|
|
17
|
-
mkdirSync(dir, { recursive: true });
|
|
18
|
-
return dir;
|
|
19
|
-
}
|
|
20
|
-
export function computeContentHash(content) {
|
|
21
|
-
const hex = createHash('sha256').update(content).digest('hex');
|
|
22
|
-
return `sha256:${hex}`;
|
|
23
|
-
}
|
|
24
|
-
export function saveSession(planPath, contentHash, comments, activeSection) {
|
|
25
|
-
try {
|
|
26
|
-
const data = {
|
|
27
|
-
version: 1,
|
|
28
|
-
planPath,
|
|
29
|
-
contentHash,
|
|
30
|
-
comments,
|
|
31
|
-
activeSection,
|
|
32
|
-
lastModified: new Date().toISOString(),
|
|
33
|
-
};
|
|
34
|
-
const filePath = sessionFilePath(planPath);
|
|
35
|
-
writeFileSync(filePath, JSON.stringify(data, null, 2), 'utf-8');
|
|
36
|
-
}
|
|
37
|
-
catch (err) {
|
|
38
|
-
console.warn(`[plan-review] Failed to save session: ${err.message}`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export function loadSession(planPath, currentContentHash) {
|
|
42
|
-
const filePath = sessionFilePath(planPath);
|
|
43
|
-
if (!existsSync(filePath)) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
let raw;
|
|
47
|
-
try {
|
|
48
|
-
raw = readFileSync(filePath, 'utf-8');
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
let data;
|
|
54
|
-
try {
|
|
55
|
-
data = JSON.parse(raw);
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
console.warn(`[plan-review] Corrupt session file, removing: ${filePath}`);
|
|
59
|
-
try {
|
|
60
|
-
unlinkSync(filePath);
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
// ignore
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
// Restore Date objects in comment timestamps
|
|
68
|
-
const comments = data.comments.map((c) => ({
|
|
69
|
-
...c,
|
|
70
|
-
timestamp: new Date(c.timestamp),
|
|
71
|
-
}));
|
|
72
|
-
return {
|
|
73
|
-
comments,
|
|
74
|
-
activeSection: data.activeSection,
|
|
75
|
-
stale: data.contentHash !== currentContentHash,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
export function clearSession(planPath) {
|
|
79
|
-
const filePath = sessionFilePath(planPath);
|
|
80
|
-
try {
|
|
81
|
-
unlinkSync(filePath);
|
|
82
|
-
}
|
|
83
|
-
catch {
|
|
84
|
-
// No error if missing
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
export function listSessions() {
|
|
88
|
-
const dir = getSessionDir();
|
|
89
|
-
let files;
|
|
90
|
-
try {
|
|
91
|
-
files = readdirSync(dir);
|
|
92
|
-
}
|
|
93
|
-
catch {
|
|
94
|
-
return [];
|
|
95
|
-
}
|
|
96
|
-
const results = [];
|
|
97
|
-
for (const file of files) {
|
|
98
|
-
if (!file.endsWith('.json'))
|
|
99
|
-
continue;
|
|
100
|
-
const filePath = join(dir, file);
|
|
101
|
-
let data;
|
|
102
|
-
try {
|
|
103
|
-
const raw = readFileSync(filePath, 'utf-8');
|
|
104
|
-
data = JSON.parse(raw);
|
|
105
|
-
}
|
|
106
|
-
catch {
|
|
107
|
-
console.warn(`[plan-review] Skipping corrupt session file: ${filePath}`);
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
let stale;
|
|
111
|
-
if (!existsSync(data.planPath)) {
|
|
112
|
-
stale = null;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
try {
|
|
116
|
-
const currentContent = readFileSync(data.planPath, 'utf-8');
|
|
117
|
-
const currentHash = computeContentHash(currentContent);
|
|
118
|
-
stale = currentHash !== data.contentHash;
|
|
119
|
-
}
|
|
120
|
-
catch {
|
|
121
|
-
stale = null;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
results.push({
|
|
125
|
-
planPath: data.planPath,
|
|
126
|
-
commentCount: data.comments.length,
|
|
127
|
-
lastModified: data.lastModified,
|
|
128
|
-
stale,
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
return results;
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=session.js.map
|
package/dist/session.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAoBlC,sEAAsE;AAEtE,SAAS,QAAQ,CAAC,QAAgB;IAChC,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACvC,OAAO,IAAI,CAAC,aAAa,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,CAAC;AAC7D,CAAC;AAED,sEAAsE;AAEtE,MAAM,UAAU,aAAa;IAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;IACxD,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI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AEtC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjC,IAAI,IAAiB,CAAC;QACtB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC5C,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAgB,CAAC;QACxC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,IAAI,CAAC,gDAAgD,QAAQ,EAAE,CAAC,CAAC;YACzE,SAAS;QACX,CAAC;QAED,IAAI,KAAqB,CAAC;QAC1B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,KAAK,GAAG,IAAI,CAAC;QACf,CAAC;aAAM,CAAC;YACN,IAAI,CAAC;gBACH,MAAM,cAAc,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBAC5D,MAAM,WAAW,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;gBACvD,KAAK,GAAG,WAAW,KAAK,IAAI,CAAC,WAAW,CAAC;YAC3C,CAAC;YAAC,MAAM,CAAC;gBACP,KAAK,GAAG,IAAI,CAAC;YACf,CAAC;QACH,CAAC;QAED,OAAO,CAAC,IAAI,CAAC;YACX,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM;YAClC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/transport.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { PlanDocument, ReviewComment } from './types.js';
|
|
2
|
-
export interface Transport {
|
|
3
|
-
sendDocument(doc: PlanDocument): void;
|
|
4
|
-
onReviewSubmit(handler: (comments: ReviewComment[]) => void): void;
|
|
5
|
-
start(port: number): Promise<{
|
|
6
|
-
url: string;
|
|
7
|
-
}>;
|
|
8
|
-
stop(): Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
export declare class HttpTransport implements Transport {
|
|
11
|
-
private doc;
|
|
12
|
-
private initialActiveSection;
|
|
13
|
-
private assetBaseDir;
|
|
14
|
-
private submitHandler;
|
|
15
|
-
private sessionSaveHandler;
|
|
16
|
-
private heartbeatHandler;
|
|
17
|
-
private pauseHandler;
|
|
18
|
-
private cancelHandler;
|
|
19
|
-
private server;
|
|
20
|
-
sendDocument(doc: PlanDocument): void;
|
|
21
|
-
setInitialActiveSection(section: string | null): void;
|
|
22
|
-
setAssetBaseDir(dir: string | null): void;
|
|
23
|
-
onReviewSubmit(handler: (comments: ReviewComment[]) => void): void;
|
|
24
|
-
onSessionSave(handler: (comments: ReviewComment[], activeSection: string | null) => void): void;
|
|
25
|
-
onHeartbeat(handler: () => void): void;
|
|
26
|
-
onPause(handler: () => void): void;
|
|
27
|
-
onCancel(handler: () => void): void;
|
|
28
|
-
start(port: number): Promise<{
|
|
29
|
-
url: string;
|
|
30
|
-
}>;
|
|
31
|
-
stop(): Promise<void>;
|
|
32
|
-
}
|
package/dist/transport.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { createReviewServer, startServer, stopServer } from './server/server.js';
|
|
2
|
-
import { getAssetHtml } from './server/assets.js';
|
|
3
|
-
export class HttpTransport {
|
|
4
|
-
doc = null;
|
|
5
|
-
initialActiveSection = null;
|
|
6
|
-
assetBaseDir = null;
|
|
7
|
-
submitHandler = null;
|
|
8
|
-
sessionSaveHandler = null;
|
|
9
|
-
heartbeatHandler = null;
|
|
10
|
-
pauseHandler = null;
|
|
11
|
-
cancelHandler = null;
|
|
12
|
-
server = null;
|
|
13
|
-
sendDocument(doc) {
|
|
14
|
-
this.doc = doc;
|
|
15
|
-
}
|
|
16
|
-
setInitialActiveSection(section) {
|
|
17
|
-
this.initialActiveSection = section;
|
|
18
|
-
}
|
|
19
|
-
// Plan-file directory used to serve relative images via /_assets/<rel>.
|
|
20
|
-
// Null for inline plans where there's no on-disk anchor.
|
|
21
|
-
setAssetBaseDir(dir) {
|
|
22
|
-
this.assetBaseDir = dir;
|
|
23
|
-
}
|
|
24
|
-
onReviewSubmit(handler) {
|
|
25
|
-
this.submitHandler = handler;
|
|
26
|
-
}
|
|
27
|
-
onSessionSave(handler) {
|
|
28
|
-
this.sessionSaveHandler = handler;
|
|
29
|
-
}
|
|
30
|
-
onHeartbeat(handler) {
|
|
31
|
-
this.heartbeatHandler = handler;
|
|
32
|
-
}
|
|
33
|
-
onPause(handler) {
|
|
34
|
-
this.pauseHandler = handler;
|
|
35
|
-
}
|
|
36
|
-
onCancel(handler) {
|
|
37
|
-
this.cancelHandler = handler;
|
|
38
|
-
}
|
|
39
|
-
async start(port) {
|
|
40
|
-
if (!this.doc)
|
|
41
|
-
throw new Error('No document set');
|
|
42
|
-
this.server = createReviewServer({
|
|
43
|
-
getDocument: () => this.doc,
|
|
44
|
-
getInitialActiveSection: () => this.initialActiveSection,
|
|
45
|
-
getAssetBaseDir: () => this.assetBaseDir,
|
|
46
|
-
onSubmit: (comments) => this.submitHandler?.(comments),
|
|
47
|
-
getAssetHtml: () => getAssetHtml(),
|
|
48
|
-
onSessionSave: (comments, activeSection) => this.sessionSaveHandler?.(comments, activeSection),
|
|
49
|
-
onHeartbeat: () => this.heartbeatHandler?.(),
|
|
50
|
-
onPause: () => this.pauseHandler?.(),
|
|
51
|
-
onCancel: () => this.cancelHandler?.(),
|
|
52
|
-
});
|
|
53
|
-
return startServer(this.server, port);
|
|
54
|
-
}
|
|
55
|
-
async stop() {
|
|
56
|
-
if (this.server && this.server.listening) {
|
|
57
|
-
await stopServer(this.server);
|
|
58
|
-
this.server = null;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=transport.js.map
|
package/dist/transport.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-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
sections: Section[];
|
|
6
|
-
comments: ReviewComment[];
|
|
7
|
-
}
|
|
8
|
-
export interface Section {
|
|
9
|
-
id: string;
|
|
10
|
-
heading: string;
|
|
11
|
-
level: number;
|
|
12
|
-
body: string;
|
|
13
|
-
parent?: string;
|
|
14
|
-
dependencies?: {
|
|
15
|
-
dependsOn: string[];
|
|
16
|
-
blocks: string[];
|
|
17
|
-
};
|
|
18
|
-
relatedFiles?: string[];
|
|
19
|
-
verification?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface LineAnchor {
|
|
22
|
-
type: 'lines';
|
|
23
|
-
startLine: number;
|
|
24
|
-
endLine: number;
|
|
25
|
-
lineTexts: string[];
|
|
26
|
-
}
|
|
27
|
-
export interface ReviewComment {
|
|
28
|
-
sectionId: string;
|
|
29
|
-
text: string;
|
|
30
|
-
timestamp: Date;
|
|
31
|
-
anchor?: LineAnchor;
|
|
32
|
-
}
|
|
33
|
-
export type OutputTarget = 'stdout' | 'clipboard' | 'file' | 'claude';
|
|
34
|
-
export type SplitStrategy = 'heading' | 'separator' | 'auto';
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
Binary file
|