@latent-space-labs/open-auto-doc 0.5.9 → 0.5.11
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/index.js
CHANGED
|
@@ -2487,10 +2487,12 @@ You will receive Next.js / Fumadocs build error output. Your job is to find and
|
|
|
2487
2487
|
6. **HTML comments** \u2014 \`<!-- -->\` is not valid in MDX; remove or convert to JSX comments \`{/* */}\`.
|
|
2488
2488
|
7. **Unescaped pipes in tables** \u2014 Pipes inside table cells that break table parsing.
|
|
2489
2489
|
8. **Import/export statements** \u2014 Invalid or unnecessary import/export statements in MDX files.
|
|
2490
|
+
9. **TypeScript type errors in components** \u2014 Type mismatches in \`.tsx\`/\`.ts\` files (e.g. \`RefObject\` vs \`MutableRefObject\`, \`null\` vs \`undefined\`, missing type arguments). Fix the types directly.
|
|
2490
2491
|
|
|
2491
2492
|
## Rules
|
|
2492
2493
|
|
|
2493
|
-
-
|
|
2494
|
+
- You may edit files inside \`content/docs/\` (MDX files) AND \`components/\` or \`app/\` (TypeScript/React files).
|
|
2495
|
+
- For TypeScript errors in \`.tsx\`/\`.ts\` files, fix the type issues directly (e.g. ref type mismatches, missing imports, incorrect generics).
|
|
2494
2496
|
- Read the error output carefully to identify the exact file(s) and line(s).
|
|
2495
2497
|
- Use Read to examine the broken file, then Edit to fix it.
|
|
2496
2498
|
- After fixing, set \`fixed: true\` and list all changed file paths in \`filesChanged\`.
|
|
@@ -2509,7 +2511,7 @@ ${buildErrors}
|
|
|
2509
2511
|
\`\`\`
|
|
2510
2512
|
|
|
2511
2513
|
Read the failing files, identify the issues, and use Edit to fix them.
|
|
2512
|
-
|
|
2514
|
+
You may edit files in content/docs/, components/, and app/.`,
|
|
2513
2515
|
cwd: docsDir,
|
|
2514
2516
|
apiKey,
|
|
2515
2517
|
model,
|
|
@@ -2694,27 +2696,48 @@ ${stderr}`.trim();
|
|
|
2694
2696
|
return { success: false, output };
|
|
2695
2697
|
}
|
|
2696
2698
|
}
|
|
2697
|
-
function truncateErrors(output, max =
|
|
2699
|
+
function truncateErrors(output, max = 16e3) {
|
|
2698
2700
|
if (output.length <= max) return output;
|
|
2699
2701
|
return output.slice(0, max) + "\n\n... (truncated)";
|
|
2700
2702
|
}
|
|
2701
|
-
function extractErrorSummary(output, maxLines =
|
|
2703
|
+
function extractErrorSummary(output, maxLines = 80) {
|
|
2702
2704
|
const lines = output.split("\n");
|
|
2703
2705
|
const errorLines = [];
|
|
2706
|
+
let capturing = false;
|
|
2707
|
+
let blankCount = 0;
|
|
2704
2708
|
for (const line of lines) {
|
|
2705
|
-
|
|
2709
|
+
const isErrorLine = /error\s*(\(|:|\[)/i.test(line) || /TS\d{4}:/i.test(line) || /Error:|SyntaxError|TypeError|ReferenceError/i.test(line) || /Caused by:/.test(line) || /Type '.*' is not assignable/i.test(line) || /Property '.*' is missing/i.test(line) || /Overload \d+ of \d+/i.test(line) || /Types of parameters/i.test(line) || /Expected|Unexpected|Invalid|Unterminated/i.test(line);
|
|
2710
|
+
const isContextLine = /^\s*\d+\s*\|/.test(line) || // source line numbers from build output
|
|
2706
2711
|
/^\s*>/.test(line) || // pointer lines
|
|
2707
|
-
|
|
2712
|
+
/^\s+at\s+/.test(line) || // stack traces
|
|
2713
|
+
/failed/i.test(line);
|
|
2714
|
+
if (isErrorLine) {
|
|
2715
|
+
capturing = true;
|
|
2716
|
+
blankCount = 0;
|
|
2717
|
+
}
|
|
2718
|
+
if (capturing) {
|
|
2719
|
+
if (line.trim() === "") {
|
|
2720
|
+
blankCount++;
|
|
2721
|
+
if (blankCount >= 2) {
|
|
2722
|
+
capturing = false;
|
|
2723
|
+
continue;
|
|
2724
|
+
}
|
|
2725
|
+
} else {
|
|
2726
|
+
blankCount = 0;
|
|
2727
|
+
}
|
|
2728
|
+
errorLines.push(line);
|
|
2729
|
+
} else if (isContextLine) {
|
|
2708
2730
|
errorLines.push(line);
|
|
2709
2731
|
}
|
|
2732
|
+
if (errorLines.length >= maxLines) break;
|
|
2710
2733
|
}
|
|
2711
2734
|
if (errorLines.length === 0) {
|
|
2712
2735
|
return lines.slice(-maxLines).join("\n");
|
|
2713
2736
|
}
|
|
2714
|
-
return errorLines.
|
|
2737
|
+
return errorLines.join("\n");
|
|
2715
2738
|
}
|
|
2716
2739
|
async function runBuildCheck(options) {
|
|
2717
|
-
const { docsDir, apiKey, model, maxAttempts =
|
|
2740
|
+
const { docsDir, apiKey, model, maxAttempts = 10 } = options;
|
|
2718
2741
|
const spinner9 = p5.spinner();
|
|
2719
2742
|
spinner9.start("Verifying documentation build...");
|
|
2720
2743
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
@@ -5525,7 +5548,7 @@ async function logoutCommand() {
|
|
|
5525
5548
|
|
|
5526
5549
|
// src/index.ts
|
|
5527
5550
|
var program = new Command();
|
|
5528
|
-
program.name("open-auto-doc").description("Auto-generate beautiful documentation websites from GitHub repositories using AI").version("0.5.
|
|
5551
|
+
program.name("open-auto-doc").description("Auto-generate beautiful documentation websites from GitHub repositories using AI").version("0.5.11");
|
|
5529
5552
|
program.command("init", { isDefault: true }).description("Initialize and generate documentation for your repositories").option("-o, --output <dir>", "Output directory", "docs-site").action(initCommand);
|
|
5530
5553
|
program.command("generate").description("Regenerate documentation using existing configuration").option("--incremental", "Only re-analyze changed files (uses cached results)").option("--force", "Force full regeneration (ignore cache)").option("--repo <name>", "Only analyze this repo (uses cache for others)").action(generateCommand);
|
|
5531
5554
|
program.command("deploy").description("Create a GitHub repo for docs and push (connect to Vercel for auto-deploy)").option("-d, --dir <path>", "Docs site directory").action(deployCommand);
|
|
@@ -4,6 +4,9 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
4
4
|
import { useRouter } from "next/navigation";
|
|
5
5
|
import dynamic from "next/dynamic";
|
|
6
6
|
|
|
7
|
+
type NodeObject = { id?: string | number; x?: number; y?: number; [others: string]: any };
|
|
8
|
+
type LinkObject = { source?: string | number | NodeObject; target?: string | number | NodeObject; [others: string]: any };
|
|
9
|
+
|
|
7
10
|
const ForceGraph2D = dynamic(() => import("react-force-graph-2d"), {
|
|
8
11
|
ssr: false,
|
|
9
12
|
loading: () => (
|
|
@@ -78,7 +81,7 @@ const LINK_TYPE_COLORS: Record<string, { color: string; label: string }> = {
|
|
|
78
81
|
export function ForceGraph({ graphData, height = 500 }: ForceGraphProps) {
|
|
79
82
|
const router = useRouter();
|
|
80
83
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
81
|
-
const fgRef = useRef<{ centerAt: (x: number, y: number, ms: number) => void; zoom: (k: number, ms: number) => void } |
|
|
84
|
+
const fgRef = useRef<{ centerAt: (x: number, y: number, ms: number) => void; zoom: (k: number, ms: number) => void } | undefined>(undefined);
|
|
82
85
|
const [dimensions, setDimensions] = useState({ width: 800, height });
|
|
83
86
|
const [hoverNode, setHoverNode] = useState<GraphNode | null>(null);
|
|
84
87
|
const [tooltipPos, setTooltipPos] = useState({ x: 0, y: 0 });
|
|
@@ -203,23 +206,31 @@ export function ForceGraph({ graphData, height = 500 }: ForceGraphProps) {
|
|
|
203
206
|
[filteredGraphData.links],
|
|
204
207
|
);
|
|
205
208
|
|
|
209
|
+
// Track mouse position for tooltip since onNodeHover doesn't provide events
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
const el = containerRef.current;
|
|
212
|
+
if (!el) return;
|
|
213
|
+
const handler = (e: MouseEvent) => setTooltipPos({ x: e.clientX, y: e.clientY });
|
|
214
|
+
el.addEventListener("mousemove", handler);
|
|
215
|
+
return () => el.removeEventListener("mousemove", handler);
|
|
216
|
+
}, []);
|
|
217
|
+
|
|
206
218
|
const handleNodeHover = useCallback(
|
|
207
|
-
(node:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
setTooltipPos({ x: event.clientX, y: event.clientY });
|
|
212
|
-
}
|
|
219
|
+
(node: NodeObject | null, _previousNode: NodeObject | null) => {
|
|
220
|
+
const gNode = node as GraphNode | null;
|
|
221
|
+
updateHighlight(gNode);
|
|
222
|
+
setHoverNode(gNode);
|
|
213
223
|
},
|
|
214
224
|
[updateHighlight],
|
|
215
225
|
);
|
|
216
226
|
|
|
217
227
|
const handleNodeClick = useCallback(
|
|
218
|
-
(node:
|
|
219
|
-
|
|
228
|
+
(node: NodeObject, _event: MouseEvent) => {
|
|
229
|
+
const gNode = node as GraphNode;
|
|
230
|
+
if (gNode.docPath) {
|
|
220
231
|
// Navigate relative to current docs path
|
|
221
232
|
const basePath = window.location.pathname.replace(/\/system-graph\/?$/, "");
|
|
222
|
-
router.push(`${basePath}/${
|
|
233
|
+
router.push(`${basePath}/${gNode.docPath}`);
|
|
223
234
|
}
|
|
224
235
|
},
|
|
225
236
|
[router],
|
|
@@ -229,7 +240,8 @@ export function ForceGraph({ graphData, height = 500 }: ForceGraphProps) {
|
|
|
229
240
|
const labelColorDim = "#9ca3af";
|
|
230
241
|
|
|
231
242
|
const nodeCanvasObject = useCallback(
|
|
232
|
-
(
|
|
243
|
+
(nodeObj: NodeObject, ctx: CanvasRenderingContext2D, globalScale: number) => {
|
|
244
|
+
const node = nodeObj as GraphNode;
|
|
233
245
|
const isHighlighted = highlightNodes.current.size === 0 || highlightNodes.current.has(node.id);
|
|
234
246
|
const isSearchMatch = searchMatchIds.current.size > 0 && searchMatchIds.current.has(node.id);
|
|
235
247
|
const isDimmedBySearch = searchMatchIds.current.size > 0 && !isSearchMatch;
|
|
@@ -281,7 +293,8 @@ export function ForceGraph({ graphData, height = 500 }: ForceGraphProps) {
|
|
|
281
293
|
);
|
|
282
294
|
|
|
283
295
|
const linkCanvasObject = useCallback(
|
|
284
|
-
(
|
|
296
|
+
(linkObj: LinkObject, ctx: CanvasRenderingContext2D, globalScale: number) => {
|
|
297
|
+
const link = linkObj as GraphLink;
|
|
285
298
|
const linkId = getLinkId(link);
|
|
286
299
|
const isHighlighted = highlightLinks.current.size === 0 || highlightLinks.current.has(linkId);
|
|
287
300
|
|
|
@@ -466,15 +479,16 @@ export function ForceGraph({ graphData, height = 500 }: ForceGraphProps) {
|
|
|
466
479
|
width={dimensions.width}
|
|
467
480
|
height={dimensions.height}
|
|
468
481
|
nodeCanvasObject={nodeCanvasObject}
|
|
469
|
-
nodePointerAreaPaint={(node:
|
|
470
|
-
const
|
|
482
|
+
nodePointerAreaPaint={(node: NodeObject, color: string, ctx: CanvasRenderingContext2D) => {
|
|
483
|
+
const gNode = node as GraphNode;
|
|
484
|
+
const radius = Math.max(Math.sqrt(gNode.val || 1) * 3, 4);
|
|
471
485
|
ctx.beginPath();
|
|
472
|
-
ctx.arc(
|
|
486
|
+
ctx.arc(gNode.x ?? 0, gNode.y ?? 0, radius + 2, 0, 2 * Math.PI);
|
|
473
487
|
ctx.fillStyle = color;
|
|
474
488
|
ctx.fill();
|
|
475
489
|
}}
|
|
476
490
|
linkCanvasObject={linkCanvasObject}
|
|
477
|
-
linkPointerAreaPaint={(link:
|
|
491
|
+
linkPointerAreaPaint={(link: LinkObject, color: string, ctx: CanvasRenderingContext2D) => {
|
|
478
492
|
const source = link.source as GraphNode;
|
|
479
493
|
const target = link.target as GraphNode;
|
|
480
494
|
if (!source.x || !target.x) return;
|