@arjunkhera/atlas 0.3.6 → 0.3.7
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/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/work/lib/child-env.mjs +14 -0
package/package.json
CHANGED
package/work/lib/child-env.mjs
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
// The variables a program started by Atlas receives: a short list, never the
|
|
2
2
|
// Engram connection, never an ATLAS_WORK_* setting (F11 study, fix one).
|
|
3
3
|
const CHILD_VARIABLES = ['PATH', 'HOME', 'USER', 'LOGNAME', 'LANG', 'LC_ALL', 'TMPDIR', 'XDG_CONFIG_HOME', 'SSL_CERT_FILE', 'SSH_AUTH_SOCK'];
|
|
4
|
+
// A Claude cloud session reaches GitHub only through Claude's own proxy on the
|
|
5
|
+
// loopback address. Its GH_TOKEN is a stand-in that only that proxy turns into
|
|
6
|
+
// a real credential, so `gh` with no proxy gets "Bad credentials". In a cloud
|
|
7
|
+
// session only, a program also receives the proxy variables, and only when the
|
|
8
|
+
// proxy is a loopback address (owner, 7 October 2026: "yes fix it and test").
|
|
9
|
+
const CLOUD_PROXY_VARIABLES = ['HTTPS_PROXY', 'https_proxy'];
|
|
10
|
+
const CLOUD_NO_PROXY_VARIABLES = ['NO_PROXY', 'no_proxy'];
|
|
11
|
+
const LOOPBACK_PROXY = /^http:\/\/(127\.0\.0\.1|localhost|\[::1\]):\d{1,5}\/?$/;
|
|
4
12
|
|
|
5
13
|
export function childEnvironment(env = process.env) {
|
|
6
14
|
const out = {};
|
|
7
15
|
for (const [name, value] of Object.entries(env)) {
|
|
8
16
|
if (CHILD_VARIABLES.includes(name) || name.startsWith('GH_') || name === 'GITHUB_TOKEN') out[name] = value;
|
|
9
17
|
}
|
|
18
|
+
if (env.CLAUDE_CODE_REMOTE === 'true') {
|
|
19
|
+
const proxies = CLOUD_PROXY_VARIABLES.filter((name) => env[name] !== undefined);
|
|
20
|
+
if (proxies.length && proxies.every((name) => LOOPBACK_PROXY.test(env[name]))) {
|
|
21
|
+
for (const name of [...proxies, ...CLOUD_NO_PROXY_VARIABLES]) if (env[name] !== undefined) out[name] = env[name];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
10
24
|
return out;
|
|
11
25
|
}
|