@brimveyn/aimux 1.18.2 → 1.18.3
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
|
@@ -60,8 +60,15 @@ export async function assertSafeAimuxWorktreePath(path: string): Promise<void> {
|
|
|
60
60
|
if (!isInsideAimuxWorktreeRoot(path)) {
|
|
61
61
|
throw new Error(`refusing worktree path outside Aimux temp root: ${path}`)
|
|
62
62
|
}
|
|
63
|
+
// Create the repo-scoped parent (<root>/r-<hash>) before resolving it: git
|
|
64
|
+
// worktree add does not create intermediate dirs, and realpath() would throw
|
|
65
|
+
// ENOENT on the first worktree for a repo. mkdir(recursive) leaves an
|
|
66
|
+
// existing symlink in place, so the realpath check below still catches an
|
|
67
|
+
// escape out of the temp root.
|
|
68
|
+
const parent = resolve(path, '..')
|
|
69
|
+
await mkdir(parent, { recursive: true })
|
|
63
70
|
const realRoot = await realpath(root)
|
|
64
|
-
const realParent = await realpath(
|
|
71
|
+
const realParent = await realpath(parent)
|
|
65
72
|
if (`${realParent}/`.startsWith(`${realRoot}/`)) return
|
|
66
73
|
throw new Error(`unsafe Aimux worktree parent: ${realParent}`)
|
|
67
74
|
}
|