waypoint-codex 1.0.4 → 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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { execFileSync } from "node:child_process";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
@@ -172,19 +172,29 @@ function isWithinPath(childPath, parentPath) {
|
|
|
172
172
|
|
|
173
173
|
function collectSessionFiles(rootDir) {
|
|
174
174
|
const files = [];
|
|
175
|
+
const visitedDirs = new Set();
|
|
175
176
|
|
|
176
177
|
function walk(currentDir) {
|
|
177
178
|
if (!existsSync(currentDir)) {
|
|
178
179
|
return;
|
|
179
180
|
}
|
|
181
|
+
const resolvedCurrentDir = safeRealpath(currentDir);
|
|
182
|
+
if (!resolvedCurrentDir || visitedDirs.has(resolvedCurrentDir)) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
visitedDirs.add(resolvedCurrentDir);
|
|
186
|
+
|
|
180
187
|
for (const entry of readdirSync(currentDir)) {
|
|
181
188
|
const fullPath = path.join(currentDir, entry);
|
|
182
189
|
let stats;
|
|
183
190
|
try {
|
|
184
|
-
stats =
|
|
191
|
+
stats = lstatSync(fullPath);
|
|
185
192
|
} catch {
|
|
186
193
|
continue;
|
|
187
194
|
}
|
|
195
|
+
if (stats.isSymbolicLink()) {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
188
198
|
if (stats.isDirectory()) {
|
|
189
199
|
walk(fullPath);
|
|
190
200
|
} else if (entry.endsWith(".jsonl")) {
|