plan-review 1.0.5 → 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 +64 -40
- package/dist/browser/index.html +451 -42
- package/dist/index.js +30 -272
- package/dist/index.js.map +7 -1
- package/package.json +12 -9
- package/README.md +0 -145
- 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 -9
- package/dist/server/routes.js +0 -112
- 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 -22
- package/dist/transport.js +0 -35
- 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/skills/plan-review/SKILL.md +0 -70
package/dist/parser.js
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
const MIN_SECTION_CHARS = 5;
|
|
2
|
-
export function parse(input, strategy = 'auto') {
|
|
3
|
-
const lines = input.split('\n');
|
|
4
|
-
const title = extractTitle(lines);
|
|
5
|
-
const metadata = extractMetadata(lines);
|
|
6
|
-
if (strategy === 'auto') {
|
|
7
|
-
if (isPlanDocument(input)) {
|
|
8
|
-
return parsePlan(input, title, metadata);
|
|
9
|
-
}
|
|
10
|
-
return parseGeneric(input, title, metadata);
|
|
11
|
-
}
|
|
12
|
-
if (strategy === 'separator') {
|
|
13
|
-
return parseBySeparator(input, title, metadata);
|
|
14
|
-
}
|
|
15
|
-
return parseGeneric(input, title, metadata);
|
|
16
|
-
}
|
|
17
|
-
function extractTitle(lines) {
|
|
18
|
-
const h1 = lines.find((l) => /^# /.test(l));
|
|
19
|
-
return h1 ? h1.replace(/^# /, '').trim() : 'Untitled';
|
|
20
|
-
}
|
|
21
|
-
function extractMetadata(lines) {
|
|
22
|
-
const meta = {};
|
|
23
|
-
for (const line of lines.slice(0, 20)) {
|
|
24
|
-
const match = line.match(/^\*\*(\w[\w\s]*?):\*\*\s*(.+)/);
|
|
25
|
-
if (match) {
|
|
26
|
-
meta[match[1].trim()] = match[2].trim();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return meta;
|
|
30
|
-
}
|
|
31
|
-
export function isPlanDocument(input) {
|
|
32
|
-
const stripped = input.replace(/```[\s\S]*?```/g, '');
|
|
33
|
-
const hasH2H3Hierarchy = /^## /m.test(stripped) && /^### /m.test(stripped);
|
|
34
|
-
const hasPlanFields = /\*\*Depends On:\*\*/m.test(stripped) ||
|
|
35
|
-
/\*\*Blocks:\*\*/m.test(stripped) ||
|
|
36
|
-
/\*\*Verification:\*\*/m.test(stripped) ||
|
|
37
|
-
/\*\*Related Files:\*\*/m.test(stripped);
|
|
38
|
-
return hasH2H3Hierarchy && hasPlanFields;
|
|
39
|
-
}
|
|
40
|
-
function parseGeneric(input, title, metadata) {
|
|
41
|
-
const sections = splitByHeadings(input);
|
|
42
|
-
if (sections.length === 0) {
|
|
43
|
-
return parseBySeparator(input, title, metadata);
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
title,
|
|
47
|
-
metadata,
|
|
48
|
-
mode: 'generic',
|
|
49
|
-
sections: sections.map((s, i) => ({
|
|
50
|
-
id: `section-${i + 1}`,
|
|
51
|
-
heading: s.heading,
|
|
52
|
-
level: s.level,
|
|
53
|
-
body: s.body,
|
|
54
|
-
})),
|
|
55
|
-
comments: [],
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function splitByHeadings(input) {
|
|
59
|
-
const lines = input.split('\n');
|
|
60
|
-
const sections = [];
|
|
61
|
-
let currentHeading = '';
|
|
62
|
-
let currentLevel = 0;
|
|
63
|
-
let currentBody = [];
|
|
64
|
-
// Find the most common heading level (## or ###)
|
|
65
|
-
const h2Count = (input.match(/^## /gm) || []).length;
|
|
66
|
-
const h3Count = (input.match(/^### /gm) || []).length;
|
|
67
|
-
const splitLevel = h2Count > 0 ? 2 : h3Count > 0 ? 3 : 0;
|
|
68
|
-
if (splitLevel === 0)
|
|
69
|
-
return [];
|
|
70
|
-
const headingRegex = new RegExp(`^${'#'.repeat(splitLevel)} (.+)`);
|
|
71
|
-
let inCodeBlock = false;
|
|
72
|
-
for (const line of lines) {
|
|
73
|
-
if (line.startsWith('```')) {
|
|
74
|
-
inCodeBlock = !inCodeBlock;
|
|
75
|
-
if (currentHeading) {
|
|
76
|
-
currentBody.push(line);
|
|
77
|
-
}
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
if (inCodeBlock) {
|
|
81
|
-
if (currentHeading) {
|
|
82
|
-
currentBody.push(line);
|
|
83
|
-
}
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
const match = line.match(headingRegex);
|
|
87
|
-
if (match) {
|
|
88
|
-
if (currentHeading) {
|
|
89
|
-
sections.push({
|
|
90
|
-
heading: currentHeading,
|
|
91
|
-
level: currentLevel,
|
|
92
|
-
body: currentBody.join('\n').trim(),
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
currentHeading = match[1].trim();
|
|
96
|
-
currentLevel = splitLevel;
|
|
97
|
-
currentBody = [];
|
|
98
|
-
}
|
|
99
|
-
else if (currentHeading) {
|
|
100
|
-
currentBody.push(line);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (currentHeading) {
|
|
104
|
-
sections.push({
|
|
105
|
-
heading: currentHeading,
|
|
106
|
-
level: currentLevel,
|
|
107
|
-
body: currentBody.join('\n').trim(),
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
return sections;
|
|
111
|
-
}
|
|
112
|
-
function parseBySeparator(input, title, metadata) {
|
|
113
|
-
const parts = input.split(/\n---\n/).filter((p) => {
|
|
114
|
-
return p.trim().length >= MIN_SECTION_CHARS;
|
|
115
|
-
});
|
|
116
|
-
if (parts.length <= 1) {
|
|
117
|
-
return {
|
|
118
|
-
title,
|
|
119
|
-
metadata,
|
|
120
|
-
mode: 'generic',
|
|
121
|
-
sections: [
|
|
122
|
-
{
|
|
123
|
-
id: 'section-1',
|
|
124
|
-
heading: title,
|
|
125
|
-
level: 1,
|
|
126
|
-
body: input.trim(),
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
comments: [],
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
title,
|
|
134
|
-
metadata,
|
|
135
|
-
mode: 'generic',
|
|
136
|
-
sections: parts.map((p, i) => {
|
|
137
|
-
const lines = p.trim().split('\n');
|
|
138
|
-
const firstLine = lines[0].replace(/^#+\s*/, '').trim();
|
|
139
|
-
return {
|
|
140
|
-
id: `section-${i + 1}`,
|
|
141
|
-
heading: firstLine || `Section ${i + 1}`,
|
|
142
|
-
level: 2,
|
|
143
|
-
body: p.trim(),
|
|
144
|
-
};
|
|
145
|
-
}),
|
|
146
|
-
comments: [],
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
function parsePlan(input, title, metadata) {
|
|
150
|
-
const lines = input.split('\n');
|
|
151
|
-
const sections = [];
|
|
152
|
-
let milestoneIndex = 0;
|
|
153
|
-
let taskIndex = 0;
|
|
154
|
-
let currentMilestoneId = '';
|
|
155
|
-
let currentHeading = '';
|
|
156
|
-
let currentLevel = 0;
|
|
157
|
-
let currentBody = [];
|
|
158
|
-
let inCodeBlock = false;
|
|
159
|
-
function flushSection() {
|
|
160
|
-
if (!currentHeading)
|
|
161
|
-
return;
|
|
162
|
-
const body = currentBody.join('\n').trim();
|
|
163
|
-
if (currentLevel === 2) {
|
|
164
|
-
milestoneIndex++;
|
|
165
|
-
taskIndex = 0;
|
|
166
|
-
currentMilestoneId = `milestone-${milestoneIndex}`;
|
|
167
|
-
sections.push({
|
|
168
|
-
id: currentMilestoneId,
|
|
169
|
-
heading: currentHeading,
|
|
170
|
-
level: 2,
|
|
171
|
-
body,
|
|
172
|
-
});
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
taskIndex++;
|
|
176
|
-
const id = `${milestoneIndex}.${taskIndex}`;
|
|
177
|
-
sections.push({
|
|
178
|
-
id,
|
|
179
|
-
heading: currentHeading,
|
|
180
|
-
level: 3,
|
|
181
|
-
body,
|
|
182
|
-
parent: currentMilestoneId,
|
|
183
|
-
dependencies: extractDependencies(body),
|
|
184
|
-
relatedFiles: extractRelatedFiles(body),
|
|
185
|
-
verification: extractVerification(body),
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
for (const line of lines) {
|
|
189
|
-
if (line.startsWith('```')) {
|
|
190
|
-
inCodeBlock = !inCodeBlock;
|
|
191
|
-
currentBody.push(line);
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
if (inCodeBlock) {
|
|
195
|
-
currentBody.push(line);
|
|
196
|
-
continue;
|
|
197
|
-
}
|
|
198
|
-
const h2Match = line.match(/^## (.+)/);
|
|
199
|
-
const h3Match = line.match(/^### (.+)/);
|
|
200
|
-
if (h2Match) {
|
|
201
|
-
flushSection();
|
|
202
|
-
currentHeading = h2Match[1].trim();
|
|
203
|
-
currentLevel = 2;
|
|
204
|
-
currentBody = [];
|
|
205
|
-
}
|
|
206
|
-
else if (h3Match) {
|
|
207
|
-
flushSection();
|
|
208
|
-
currentHeading = h3Match[1].trim();
|
|
209
|
-
currentLevel = 3;
|
|
210
|
-
currentBody = [];
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
currentBody.push(line);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
flushSection();
|
|
217
|
-
return {
|
|
218
|
-
title,
|
|
219
|
-
metadata,
|
|
220
|
-
mode: 'plan',
|
|
221
|
-
sections,
|
|
222
|
-
comments: [],
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
function extractDependencies(body) {
|
|
226
|
-
const dependsMatch = body.match(/\*\*Depends On:\*\*\s*(.+)/);
|
|
227
|
-
const blocksMatch = body.match(/\*\*Blocks:\*\*\s*(.+)/);
|
|
228
|
-
const parseList = (raw) => {
|
|
229
|
-
const trimmed = raw.trim();
|
|
230
|
-
if (trimmed === '(none)' || trimmed === '')
|
|
231
|
-
return [];
|
|
232
|
-
return trimmed.split(/,\s*/).map((s) => s.trim());
|
|
233
|
-
};
|
|
234
|
-
return {
|
|
235
|
-
dependsOn: dependsMatch ? parseList(dependsMatch[1]) : [],
|
|
236
|
-
blocks: blocksMatch ? parseList(blocksMatch[1]) : [],
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
function extractRelatedFiles(body) {
|
|
240
|
-
const files = [];
|
|
241
|
-
const lines = body.split('\n');
|
|
242
|
-
let inRelatedFiles = false;
|
|
243
|
-
for (const line of lines) {
|
|
244
|
-
if (/\*\*Related Files:\*\*/.test(line)) {
|
|
245
|
-
inRelatedFiles = true;
|
|
246
|
-
continue;
|
|
247
|
-
}
|
|
248
|
-
if (inRelatedFiles) {
|
|
249
|
-
const fileMatch = line.match(/^- `(.+)`(.*)$/);
|
|
250
|
-
if (fileMatch) {
|
|
251
|
-
const suffix = fileMatch[2].trim();
|
|
252
|
-
files.push(suffix ? `${fileMatch[1]} ${suffix}` : fileMatch[1]);
|
|
253
|
-
}
|
|
254
|
-
else if (line.trim() === '' || /^\*\*/.test(line.trim())) {
|
|
255
|
-
inRelatedFiles = false;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
return files;
|
|
260
|
-
}
|
|
261
|
-
function extractVerification(body) {
|
|
262
|
-
const match = body.match(/\*\*Verification:\*\*\s*`(.+?)`/);
|
|
263
|
-
return match ? match[1] : undefined;
|
|
264
|
-
}
|
|
265
|
-
//# sourceMappingURL=parser.js.map
|
package/dist/parser.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,WAA0B,MAAM;IACnE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAExC,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;QAC7B,OAAO,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,YAAY,CAAC,KAAe;IACnC,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,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,CAAC;YAClE,CAAC;iBAAM,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;gBAC3D,cAAc,GAAG,KAAK,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAY;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC5D,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC"}
|
package/dist/renderer.d.ts
DELETED
package/dist/renderer.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { marked } from 'marked';
|
|
2
|
-
import { markedTerminal } from 'marked-terminal';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
marked.use(markedTerminal());
|
|
5
|
-
export function renderSection(section) {
|
|
6
|
-
const parts = [];
|
|
7
|
-
if (section.level === 3 && section.dependencies) {
|
|
8
|
-
parts.push(renderMetadataHeader(section));
|
|
9
|
-
parts.push('');
|
|
10
|
-
}
|
|
11
|
-
const heading = `${'#'.repeat(section.level)} ${section.heading}`;
|
|
12
|
-
const body = section.body || '';
|
|
13
|
-
const markdown = `${heading}\n\n${body}`;
|
|
14
|
-
parts.push(marked.parse(markdown));
|
|
15
|
-
return parts.join('\n');
|
|
16
|
-
}
|
|
17
|
-
function renderMetadataHeader(section) {
|
|
18
|
-
const deps = section.dependencies;
|
|
19
|
-
const dependsOn = deps.dependsOn.length > 0 ? deps.dependsOn.join(', ') : '(none)';
|
|
20
|
-
const blocks = deps.blocks.length > 0 ? deps.blocks.join(', ') : '(none)';
|
|
21
|
-
const lines = [
|
|
22
|
-
`Task ${section.id}: ${section.heading}`,
|
|
23
|
-
`← Depends on: ${dependsOn}`,
|
|
24
|
-
`→ Blocks: ${blocks}`,
|
|
25
|
-
];
|
|
26
|
-
if (section.relatedFiles && section.relatedFiles.length > 0) {
|
|
27
|
-
const fileList = section.relatedFiles.length <= 2
|
|
28
|
-
? section.relatedFiles.join(', ')
|
|
29
|
-
: `${section.relatedFiles[0]} (+${section.relatedFiles.length - 1} more)`;
|
|
30
|
-
lines.push(`Files: ${fileList}`);
|
|
31
|
-
}
|
|
32
|
-
if (section.verification) {
|
|
33
|
-
lines.push(`Verify: ${section.verification}`);
|
|
34
|
-
}
|
|
35
|
-
const maxLen = Math.max(...lines.map((l) => l.length));
|
|
36
|
-
const width = Math.min(maxLen + 4, process.stdout.columns || 80);
|
|
37
|
-
const innerWidth = width - 2;
|
|
38
|
-
const top = chalk.dim(`┌${'─'.repeat(innerWidth)}┐`);
|
|
39
|
-
const bottom = chalk.dim(`└${'─'.repeat(innerWidth)}┘`);
|
|
40
|
-
const content = lines.map((l) => chalk.dim('│') + ' ' + chalk.cyan(l.slice(0, innerWidth - 2).padEnd(innerWidth - 2)) + ' ' + chalk.dim('│'));
|
|
41
|
-
return [top, ...content, bottom].join('\n');
|
|
42
|
-
}
|
|
43
|
-
export function renderToc(doc) {
|
|
44
|
-
const parts = [];
|
|
45
|
-
const commentedIds = new Set(doc.comments.map((c) => c.sectionId));
|
|
46
|
-
parts.push('');
|
|
47
|
-
parts.push(chalk.bold.underline(doc.title));
|
|
48
|
-
parts.push('');
|
|
49
|
-
if (doc.mode === 'plan') {
|
|
50
|
-
for (const section of doc.sections) {
|
|
51
|
-
if (section.level === 2) {
|
|
52
|
-
parts.push(chalk.bold.yellow(` ${section.heading}`));
|
|
53
|
-
}
|
|
54
|
-
else if (section.level === 3) {
|
|
55
|
-
const marker = commentedIds.has(section.id) ? chalk.green('✓') : ' ';
|
|
56
|
-
parts.push(` ${marker} ${chalk.dim(section.id)} ${section.heading}`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
const reviewable = doc.sections.filter((s) => s.level >= 2);
|
|
62
|
-
for (let i = 0; i < reviewable.length; i++) {
|
|
63
|
-
const section = reviewable[i];
|
|
64
|
-
const num = String(i + 1).padStart(2);
|
|
65
|
-
const marker = commentedIds.has(section.id) ? chalk.green('✓') : ' ';
|
|
66
|
-
parts.push(` ${marker} ${chalk.dim(num)} ${section.heading}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const commentedCount = commentedIds.size;
|
|
70
|
-
const reviewable = doc.sections.filter((s) => doc.mode === 'plan' ? s.level === 3 : s.level >= 2);
|
|
71
|
-
const remaining = reviewable.length - commentedCount;
|
|
72
|
-
parts.push('');
|
|
73
|
-
parts.push(` ${chalk.green(`${commentedCount} section${commentedCount !== 1 ? 's' : ''} commented`)}` +
|
|
74
|
-
` ${chalk.dim(`${remaining} remaining`)}`);
|
|
75
|
-
parts.push('');
|
|
76
|
-
return parts.join('\n');
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=renderer.js.map
|
package/dist/renderer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC;AAE7B,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,OAAO,CAAC,KAAK,KAAK,CAAC,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QAChD,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,MAAM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AAC,CAAC;IAEf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/server/assets.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getAssetHtml(): string;
|
package/dist/server/assets.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { readFileSync, existsSync } from 'node:fs';
|
|
2
|
-
import { join, dirname } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
-
// When running from source (vitest), look for pre-built dist/browser/index.html
|
|
6
|
-
// When running from dist, the sibling ../browser/ path is used
|
|
7
|
-
function resolveHtmlPath() {
|
|
8
|
-
const siblingPath = join(__dirname, '..', 'browser', 'index.html');
|
|
9
|
-
if (existsSync(siblingPath))
|
|
10
|
-
return siblingPath;
|
|
11
|
-
// Fallback: walk up to project root and look in dist/browser/
|
|
12
|
-
const projectRoot = join(__dirname, '..', '..');
|
|
13
|
-
const distPath = join(projectRoot, 'dist', 'browser', 'index.html');
|
|
14
|
-
if (existsSync(distPath))
|
|
15
|
-
return distPath;
|
|
16
|
-
throw new Error(`Browser HTML not found. Run 'npm run build' first.\nLooked in:\n ${siblingPath}\n ${distPath}`);
|
|
17
|
-
}
|
|
18
|
-
let cached = null;
|
|
19
|
-
export function getAssetHtml() {
|
|
20
|
-
if (!cached) {
|
|
21
|
-
cached = readFileSync(resolveHtmlPath(), 'utf-8');
|
|
22
|
-
}
|
|
23
|
-
return cached;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=assets.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/server/assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,gFAAgF;AAChF,+DAA+D;AAC/D,SAAS,eAAe;IACtB,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IACnE,IAAI,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,WAAW,CAAC;IAEhD,8DAA8D;IAC9D,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IACpE,IAAI,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAE1C,MAAM,IAAI,KAAK,CAAC,qEAAqE,WAAW,OAAO,QAAQ,EAAE,CAAC,CAAC;AACrH,CAAC;AAED,IAAI,MAAM,GAAkB,IAAI,CAAC;AAEjC,MAAM,UAAU,YAAY;IAC1B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,YAAY,CAAC,eAAe,EAAE,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/server/routes.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import type { PlanDocument, ReviewComment } from '../types.js';
|
|
3
|
-
export interface RouteContext {
|
|
4
|
-
getDocument: () => PlanDocument;
|
|
5
|
-
onSubmit: (comments: ReviewComment[]) => void;
|
|
6
|
-
getAssetHtml: () => string;
|
|
7
|
-
onSessionSave?: (comments: ReviewComment[], activeSection: string | null) => void;
|
|
8
|
-
}
|
|
9
|
-
export declare function createRouteHandler(ctx: RouteContext): (req: IncomingMessage, res: ServerResponse) => void;
|
package/dist/server/routes.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
const MAX_BODY_SIZE = 1024 * 1024; // 1MB
|
|
2
|
-
function validateComment(obj) {
|
|
3
|
-
if (typeof obj !== 'object' || obj === null)
|
|
4
|
-
return false;
|
|
5
|
-
const c = obj;
|
|
6
|
-
return typeof c.sectionId === 'string' && typeof c.text === 'string';
|
|
7
|
-
}
|
|
8
|
-
export function createRouteHandler(ctx) {
|
|
9
|
-
return (req, res) => {
|
|
10
|
-
const { method, url } = req;
|
|
11
|
-
if (method === 'GET' && url === '/') {
|
|
12
|
-
const html = ctx.getAssetHtml();
|
|
13
|
-
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
14
|
-
res.end(html);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if (method === 'GET' && url === '/api/doc') {
|
|
18
|
-
const doc = ctx.getDocument();
|
|
19
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
20
|
-
res.end(JSON.stringify({ document: doc }));
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
if (method === 'POST' && url === '/api/review') {
|
|
24
|
-
let body = '';
|
|
25
|
-
let size = 0;
|
|
26
|
-
req.on('data', (chunk) => {
|
|
27
|
-
size += chunk.length;
|
|
28
|
-
if (size > MAX_BODY_SIZE) {
|
|
29
|
-
res.writeHead(413, { 'Content-Type': 'application/json' });
|
|
30
|
-
res.end(JSON.stringify({ error: 'Request body too large' }));
|
|
31
|
-
req.destroy();
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
body += chunk.toString();
|
|
35
|
-
});
|
|
36
|
-
req.on('end', () => {
|
|
37
|
-
if (size > MAX_BODY_SIZE)
|
|
38
|
-
return;
|
|
39
|
-
try {
|
|
40
|
-
const parsed = JSON.parse(body);
|
|
41
|
-
const comments = parsed.comments;
|
|
42
|
-
if (!Array.isArray(comments)) {
|
|
43
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
44
|
-
res.end(JSON.stringify({ error: 'comments must be an array' }));
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
for (const c of comments) {
|
|
48
|
-
if (!validateComment(c)) {
|
|
49
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
50
|
-
res.end(JSON.stringify({ error: 'Each comment must have sectionId (string) and text (string)' }));
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
ctx.onSubmit(comments);
|
|
55
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
56
|
-
res.end(JSON.stringify({ success: true }));
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
60
|
-
res.end(JSON.stringify({ error: 'Invalid JSON' }));
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (method === 'PUT' && url === '/api/session') {
|
|
66
|
-
let body = '';
|
|
67
|
-
let size = 0;
|
|
68
|
-
req.on('data', (chunk) => {
|
|
69
|
-
size += chunk.length;
|
|
70
|
-
if (size > MAX_BODY_SIZE) {
|
|
71
|
-
res.writeHead(413, { 'Content-Type': 'application/json' });
|
|
72
|
-
res.end(JSON.stringify({ error: 'Request body too large' }));
|
|
73
|
-
req.destroy();
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
body += chunk.toString();
|
|
77
|
-
});
|
|
78
|
-
req.on('end', () => {
|
|
79
|
-
if (size > MAX_BODY_SIZE)
|
|
80
|
-
return;
|
|
81
|
-
try {
|
|
82
|
-
const parsed = JSON.parse(body);
|
|
83
|
-
const comments = parsed.comments;
|
|
84
|
-
if (!Array.isArray(comments)) {
|
|
85
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
86
|
-
res.end(JSON.stringify({ error: 'comments must be an array' }));
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
for (const c of comments) {
|
|
90
|
-
if (!validateComment(c)) {
|
|
91
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
92
|
-
res.end(JSON.stringify({ error: 'Each comment must have sectionId (string) and text (string)' }));
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
const activeSection = typeof parsed.activeSection === 'string' ? parsed.activeSection : null;
|
|
97
|
-
ctx.onSessionSave?.(comments, activeSection);
|
|
98
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
99
|
-
res.end(JSON.stringify({ success: true }));
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
103
|
-
res.end(JSON.stringify({ error: 'Invalid JSON' }));
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
109
|
-
res.end('Not Found');
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
//# sourceMappingURL=routes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/server/routes.ts"],"names":[],"mappings":"AAGA,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,MAAM;AASzC,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,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G,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
|
-
}>;
|