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/navigator.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import * as readline from 'node:readline';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { renderSection, renderToc } from './renderer.js';
|
|
4
|
-
export async function navigate(doc, inputFromStdin = false, onCommentChange) {
|
|
5
|
-
// When input was read from stdin, stdin is exhausted.
|
|
6
|
-
// Open /dev/tty directly for interactive prompts.
|
|
7
|
-
const ttyInput = inputFromStdin
|
|
8
|
-
? (await import('node:fs')).createReadStream('/dev/tty')
|
|
9
|
-
: process.stdin;
|
|
10
|
-
const rl = readline.createInterface({
|
|
11
|
-
input: ttyInput,
|
|
12
|
-
output: process.stderr,
|
|
13
|
-
});
|
|
14
|
-
const ask = (prompt) => new Promise((resolve) => {
|
|
15
|
-
rl.question(prompt, (answer) => resolve(answer.trim()));
|
|
16
|
-
});
|
|
17
|
-
const reviewableSections = getReviewableSections(doc);
|
|
18
|
-
let running = true;
|
|
19
|
-
while (running) {
|
|
20
|
-
console.error(renderToc(doc));
|
|
21
|
-
const input = await ask(chalk.cyan('> Enter section (e.g. 1.1), \'all\' for linear review, or \'done\' to finish: '));
|
|
22
|
-
if (input === 'done' || input === 'q') {
|
|
23
|
-
running = false;
|
|
24
|
-
}
|
|
25
|
-
else if (input === 'all') {
|
|
26
|
-
await linearReview(doc, reviewableSections, ask, onCommentChange);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
const section = findSection(doc, input);
|
|
30
|
-
if (section) {
|
|
31
|
-
const startIdx = reviewableSections.indexOf(section);
|
|
32
|
-
await linearReview(doc, reviewableSections.slice(startIdx), ask, onCommentChange);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
console.error(chalk.red(`Section "${input}" not found. Try again.`));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
rl.close();
|
|
40
|
-
printSummary(doc);
|
|
41
|
-
return doc;
|
|
42
|
-
}
|
|
43
|
-
async function linearReview(doc, sections, ask, onCommentChange) {
|
|
44
|
-
for (let i = 0; i < sections.length; i++) {
|
|
45
|
-
const section = sections[i];
|
|
46
|
-
console.error(renderSection(section));
|
|
47
|
-
const input = await ask(chalk.cyan('> Comment (enter to skip, \'toc\' for menu, \'back\' for previous): '));
|
|
48
|
-
if (input === 'toc') {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
else if (input === 'back') {
|
|
52
|
-
i -= (i > 0) ? 2 : 1; // -2 to go back (loop increments), -1 to re-show current
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
else if (input !== '') {
|
|
56
|
-
doc.comments.push({
|
|
57
|
-
sectionId: section.id,
|
|
58
|
-
text: input,
|
|
59
|
-
timestamp: new Date(),
|
|
60
|
-
});
|
|
61
|
-
onCommentChange?.();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
export function findSection(doc, input) {
|
|
66
|
-
// Try exact ID match first
|
|
67
|
-
const byId = doc.sections.find((s) => s.id === input);
|
|
68
|
-
if (byId)
|
|
69
|
-
return byId;
|
|
70
|
-
// Try numeric index for generic mode
|
|
71
|
-
const num = parseInt(input, 10);
|
|
72
|
-
if (!isNaN(num)) {
|
|
73
|
-
const reviewable = getReviewableSections(doc);
|
|
74
|
-
if (num >= 1 && num <= reviewable.length) {
|
|
75
|
-
return reviewable[num - 1];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
export function getReviewableSections(doc) {
|
|
81
|
-
return doc.sections.filter((s) => doc.mode === 'plan' ? s.level === 3 : s.level >= 2);
|
|
82
|
-
}
|
|
83
|
-
export function printSummary(doc) {
|
|
84
|
-
const reviewable = getReviewableSections(doc);
|
|
85
|
-
const commentedIds = new Set(doc.comments.map((c) => c.sectionId));
|
|
86
|
-
console.error('');
|
|
87
|
-
console.error(chalk.bold('Review Summary'));
|
|
88
|
-
console.error(` Sections: ${reviewable.length}`);
|
|
89
|
-
console.error(` Commented: ${chalk.green(String(commentedIds.size))}`);
|
|
90
|
-
console.error(` Skipped: ${chalk.dim(String(reviewable.length - commentedIds.size))}`);
|
|
91
|
-
console.error(` Total comments: ${doc.comments.length}`);
|
|
92
|
-
console.error('');
|
|
93
|
-
}
|
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,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CACnD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAiB;IAC5C,MAAM,UAAU,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC9C,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAEnE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC5C,OAAO,CAAC,KAAK,CAAC,eAAe,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;IAClD,OAAO,CAAC,KAAK,CAAC,gBAAgB,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;IACxE,OAAO,CAAC,KAAK,CAAC,cAAc,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;IACxF,OAAO,CAAC,KAAK,CAAC,qBAAqB,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1D,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACpB,CAAC"}
|
package/dist/output.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { OutputTarget } from './types.js';
|
|
2
|
-
export declare function writeOutput(content: string, target: OutputTarget, options?: {
|
|
3
|
-
outputFile?: string;
|
|
4
|
-
inputFile?: string;
|
|
5
|
-
}): void;
|
|
6
|
-
export declare function getClipboardCommand(platform: string): string | null;
|
|
7
|
-
export declare function isClaudeAvailable(): boolean;
|
package/dist/output.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { execSync, spawn } from 'node:child_process';
|
|
2
|
-
import { writeFileSync } from 'node:fs';
|
|
3
|
-
import { resolve } from 'node:path';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
export function writeOutput(content, target, options = {}) {
|
|
6
|
-
switch (target) {
|
|
7
|
-
case 'stdout':
|
|
8
|
-
process.stdout.write(content + '\n');
|
|
9
|
-
break;
|
|
10
|
-
case 'clipboard':
|
|
11
|
-
writeToClipboard(content);
|
|
12
|
-
break;
|
|
13
|
-
case 'file':
|
|
14
|
-
writeToFile(content, options.outputFile, options.inputFile);
|
|
15
|
-
break;
|
|
16
|
-
case 'claude':
|
|
17
|
-
sendToClaude(content);
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function writeToClipboard(content) {
|
|
22
|
-
const cmd = getClipboardCommand(process.platform);
|
|
23
|
-
if (!cmd) {
|
|
24
|
-
console.error(chalk.yellow('Clipboard not supported on this platform. Falling back to stdout.'));
|
|
25
|
-
process.stdout.write(content + '\n');
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
execSync(cmd, { input: content, stdio: ['pipe', 'ignore', 'ignore'] });
|
|
30
|
-
console.error(chalk.green('Review copied to clipboard.'));
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
console.error(chalk.yellow('Failed to copy to clipboard. Falling back to stdout.'));
|
|
34
|
-
process.stdout.write(content + '\n');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function writeToFile(content, outputFile, inputFile) {
|
|
38
|
-
const filePath = outputFile
|
|
39
|
-
? resolve(outputFile)
|
|
40
|
-
: inputFile
|
|
41
|
-
? resolve(inputFile.replace(/\.md$/, '.review.md'))
|
|
42
|
-
: resolve('review.md');
|
|
43
|
-
try {
|
|
44
|
-
writeFileSync(filePath, content, 'utf-8');
|
|
45
|
-
console.error(chalk.green(`Review written to ${filePath}`));
|
|
46
|
-
}
|
|
47
|
-
catch (err) {
|
|
48
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
49
|
-
console.error(chalk.red(`Failed to write file: ${msg}`));
|
|
50
|
-
console.error(chalk.yellow('Falling back to stdout.'));
|
|
51
|
-
process.stdout.write(content + '\n');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function sendToClaude(content) {
|
|
55
|
-
if (!isClaudeAvailable()) {
|
|
56
|
-
console.error(chalk.red('Claude CLI not found in PATH.'));
|
|
57
|
-
console.error(chalk.dim('Install: https://docs.anthropic.com/en/docs/claude-code'));
|
|
58
|
-
console.error(chalk.yellow('Falling back to stdout.'));
|
|
59
|
-
process.stdout.write(content + '\n');
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const child = spawn('claude', [], {
|
|
63
|
-
stdio: ['pipe', 'inherit', 'inherit'],
|
|
64
|
-
});
|
|
65
|
-
child.stdin.write(content);
|
|
66
|
-
child.stdin.end();
|
|
67
|
-
child.on('error', (err) => {
|
|
68
|
-
console.error(chalk.yellow(`Failed to pipe to claude: ${err.message}. Falling back to stdout.`));
|
|
69
|
-
process.stdout.write(content + '\n');
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
export function getClipboardCommand(platform) {
|
|
73
|
-
switch (platform) {
|
|
74
|
-
case 'darwin':
|
|
75
|
-
return 'pbcopy';
|
|
76
|
-
case 'linux':
|
|
77
|
-
return 'xclip -selection clipboard';
|
|
78
|
-
case 'win32':
|
|
79
|
-
return 'clip';
|
|
80
|
-
default:
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
export function isClaudeAvailable() {
|
|
85
|
-
try {
|
|
86
|
-
execSync('which claude', { stdio: 'ignore' });
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
catch {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
//# sourceMappingURL=output.js.map
|
package/dist/output.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,UAAU,WAAW,CACzB,OAAe,EACf,MAAoB,EACpB,UAAuD,EAAE;IAEzD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;YACrC,MAAM;QACR,KAAK,WAAW;YACd,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC1B,MAAM;QACR,KAAK,MAAM;YACT,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;YAC5D,MAAM;QACR,KAAK,QAAQ;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM;IACV,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAe;IACvC,MAAM,GAAG,GAAG,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,mEAAmE,CAAC,CAAC,CAAC;QACjG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;QACrC,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,QAAQ,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,MAA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AC;QACH,QAAQ,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/dist/parser.d.ts
DELETED
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;Q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xC,cAAc,GAAG,IAAI,CAAC;YACtB,SAAS;QACX,CAAC;QACD,IAAI,cAAc,EAAE,CAAC;YACnB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YAC/C,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;gBACnC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,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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,CAAC,CACnD,CAAC;IACF,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,GAAG,cAAc,CAAC;IAErD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CACR,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,cAAc,WAAW,cAAc,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,EAAE;QACzF,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,YAAY,CAAC,EAAE,CAC7C,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,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,14 +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
|
-
getInitialActiveSection?: () => string | null;
|
|
6
|
-
getAssetBaseDir?: () => string | null;
|
|
7
|
-
onSubmit: (comments: ReviewComment[]) => void;
|
|
8
|
-
getAssetHtml: () => string;
|
|
9
|
-
onSessionSave?: (comments: ReviewComment[], activeSection: string | null) => void;
|
|
10
|
-
onHeartbeat?: () => void;
|
|
11
|
-
onPause?: () => void;
|
|
12
|
-
onCancel?: () => void;
|
|
13
|
-
}
|
|
14
|
-
export declare function createRouteHandler(ctx: RouteContext): (req: IncomingMessage, res: ServerResponse) => void;
|