waypoint-codex 0.1.3 → 0.1.5
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/src/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import { fileURLToPath } from "node:url";
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import { doctorRepository, importLegacyRepo, initRepository, syncRepository } from "./core.js";
|
|
8
|
-
const VERSION = JSON.parse(readFileSync(path.resolve(path.dirname(fileURLToPath(import.meta.url)), "
|
|
8
|
+
const VERSION = JSON.parse(readFileSync(path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../package.json"), "utf8")).version;
|
|
9
9
|
function resolveRepo(input) {
|
|
10
10
|
return path.resolve(input ?? ".");
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -55,8 +55,21 @@ function redactSecrets(text) {
|
|
|
55
55
|
return SECRET_PATTERNS.reduce((current, pattern) => current.replace(pattern, "[REDACTED]"), text);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
function safeRealpath(targetPath) {
|
|
59
|
+
try {
|
|
60
|
+
return realpathSync(targetPath);
|
|
61
|
+
} catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
58
66
|
function isWithinPath(childPath, parentPath) {
|
|
59
|
-
const
|
|
67
|
+
const resolvedParent = safeRealpath(parentPath);
|
|
68
|
+
const resolvedChild = safeRealpath(childPath);
|
|
69
|
+
if (!resolvedParent || !resolvedChild) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const rel = path.relative(resolvedParent, resolvedChild);
|
|
60
73
|
return rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel));
|
|
61
74
|
}
|
|
62
75
|
|