@commonlyai/cli 0.1.179 → 0.1.180
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.
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* (Seatbelt, bwrap) is what stops a process that goes looking.
|
|
12
12
|
*/
|
|
13
13
|
import { randomUUID } from 'node:crypto';
|
|
14
|
+
import { realpathSync } from 'node:fs';
|
|
14
15
|
import { mkdtemp, mkdir, chmod, readFile, rm } from 'node:fs/promises';
|
|
15
16
|
import { homedir, tmpdir } from 'node:os';
|
|
16
17
|
import { delimiter, join, resolve, sep } from 'node:path';
|
|
@@ -35,6 +36,10 @@ const isInside = (path, dir) => {
|
|
|
35
36
|
* read the user's login (~/.local/bin/claude). Adapters run their CLI by
|
|
36
37
|
* absolute path, so the run loses nothing it needs.
|
|
37
38
|
*/
|
|
39
|
+
// A HOME reached through a symlink (macOS /var -> /private/var) shows up in
|
|
40
|
+
// PATH under its resolved path too, e.g. npm's cwd-derived node_modules/.bin.
|
|
41
|
+
const spellings = (dir) => { try { return [dir, realpathSync(dir)]; } catch { return [dir]; } };
|
|
42
|
+
|
|
38
43
|
const scrubPath = (value, realHomes) => value.split(delimiter)
|
|
39
44
|
.filter((entry) => entry && !realHomes.some((home) => isInside(entry, home)))
|
|
40
45
|
.join(delimiter);
|
|
@@ -122,7 +127,7 @@ export const prepareRunEnv = async ({
|
|
|
122
127
|
const hook = trace && typeof trace.emit === 'function' ? trace : traceOf(ctx);
|
|
123
128
|
const issued = grantMeta ? grantIssued(grantMeta) : null;
|
|
124
129
|
if (issued) hook.emit('grant.issued', issued);
|
|
125
|
-
const realHomes = [...new Set([baseEnv.HOME, homedir()].filter(Boolean))];
|
|
130
|
+
const realHomes = [...new Set([baseEnv.HOME, homedir()].filter(Boolean).flatMap(spellings))];
|
|
126
131
|
const DENIED = {
|
|
127
132
|
not_granted: 'is not in the run grant',
|
|
128
133
|
unresolved: 'could not be resolved',
|