waypoint-codex 1.0.5 → 1.0.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { existsSync, readFileSync, readdirSync,
|
|
3
|
+
import { existsSync, readFileSync, readdirSync, realpathSync, writeFileSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
|
|
@@ -101,19 +101,28 @@ function parseFrontmatter(filePath) {
|
|
|
101
101
|
return { summary, readWhen };
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
function walkDocs(projectRoot, currentDir, output) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
function walkDocs(projectRoot, currentDir, output, visitedDirs) {
|
|
105
|
+
const resolvedCurrentDir = realpathSync(currentDir);
|
|
106
|
+
if (visitedDirs.has(resolvedCurrentDir)) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
visitedDirs.add(resolvedCurrentDir);
|
|
110
|
+
|
|
111
|
+
for (const entry of readdirSync(currentDir, { withFileTypes: true })) {
|
|
112
|
+
if (entry.isSymbolicLink()) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
117
|
+
if (entry.isDirectory()) {
|
|
118
|
+
if (SKIP_DIRS.has(entry.name)) {
|
|
110
119
|
continue;
|
|
111
120
|
}
|
|
112
|
-
walkDocs(projectRoot, fullPath, output);
|
|
121
|
+
walkDocs(projectRoot, fullPath, output, visitedDirs);
|
|
113
122
|
continue;
|
|
114
123
|
}
|
|
115
124
|
|
|
116
|
-
if (!entry.endsWith(".md") || SKIP_NAMES.has(entry)) {
|
|
125
|
+
if (!entry.isFile() || !entry.name.endsWith(".md") || SKIP_NAMES.has(entry.name)) {
|
|
117
126
|
continue;
|
|
118
127
|
}
|
|
119
128
|
|
|
@@ -134,7 +143,7 @@ function collectDocEntries(projectRoot, docsDir) {
|
|
|
134
143
|
const entries = [];
|
|
135
144
|
|
|
136
145
|
if (existsSync(docsDir)) {
|
|
137
|
-
walkDocs(projectRoot, docsDir, entries);
|
|
146
|
+
walkDocs(projectRoot, docsDir, entries, new Set());
|
|
138
147
|
}
|
|
139
148
|
|
|
140
149
|
return entries;
|