@d5render/cli 0.1.81 → 0.1.83
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/bin/d5cli +36 -3
- package/package.json +1 -1
package/bin/d5cli
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { argv, env, platform } from "node:process";
|
|
3
|
-
import { execSync, spawn } from "node:child_process";
|
|
3
|
+
import { execSync, spawn, spawnSync } from "node:child_process";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
@@ -8,7 +8,7 @@ import { fileURLToPath } from "node:url";
|
|
|
8
8
|
|
|
9
9
|
//#region package.json
|
|
10
10
|
var name$1 = "@d5render/cli";
|
|
11
|
-
var version = "0.1.
|
|
11
|
+
var version = "0.1.83";
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region packages/env.ts
|
|
@@ -311,6 +311,11 @@ async function deploy() {
|
|
|
311
311
|
//#endregion
|
|
312
312
|
//#region review/copilot/index.ts
|
|
313
313
|
const bind = "copilot";
|
|
314
|
+
const TOKEN_KEYS = [
|
|
315
|
+
"COPILOT_GITHUB_TOKEN",
|
|
316
|
+
"GH_TOKEN",
|
|
317
|
+
"GITHUB_TOKEN"
|
|
318
|
+
];
|
|
314
319
|
async function cli() {
|
|
315
320
|
await deploy();
|
|
316
321
|
const httpProxy = env.HTTP_PROXY || env.http_proxy || "";
|
|
@@ -318,6 +323,34 @@ async function cli() {
|
|
|
318
323
|
if (httpProxy) env.HTTP_PROXY = httpProxy;
|
|
319
324
|
if (httpsProxy) env.HTTPS_PROXY = httpsProxy;
|
|
320
325
|
console.log("@d5render/cli version:", VERSION);
|
|
326
|
+
const childEnv = platform === "win32" ? void 0 : env;
|
|
327
|
+
if (childEnv) {
|
|
328
|
+
console.log("[env] child env keys count:", Object.keys(childEnv).length);
|
|
329
|
+
console.log("[env] child env token keys present:", TOKEN_KEYS.filter((k) => childEnv[k]).join(", ") || "(none)");
|
|
330
|
+
const check = spawnSync(process.execPath, ["-e", `
|
|
331
|
+
const ok = process.env.COPILOT_GITHUB_TOKEN ? 'OK' : 'MISSING';
|
|
332
|
+
console.log('[env] env injected:', ok);
|
|
333
|
+
const keys = ['COPILOT_GITHUB_TOKEN','GH_TOKEN','GITHUB_TOKEN'];
|
|
334
|
+
const lengths = keys.map(k => k + '=' + (process.env[k]?.length ?? 0)).join(', ');
|
|
335
|
+
console.log('[env] token lengths (7~8 may be literal [MASKED]):', lengths);
|
|
336
|
+
`.trim()], {
|
|
337
|
+
env: childEnv,
|
|
338
|
+
encoding: "utf8"
|
|
339
|
+
});
|
|
340
|
+
(check.stdout?.trim() || check.stderr?.trim() || "").split("\n").forEach((line) => console.log(line));
|
|
341
|
+
const parentLengths = TOKEN_KEYS.map((k) => `${k}=${env[k]?.length ?? 0}`).join(", ");
|
|
342
|
+
console.log("[env] parent process token lengths:", parentLengths);
|
|
343
|
+
try {
|
|
344
|
+
const whichOut = spawnSync(platform === "win32" ? "where copilot" : "which copilot", [], {
|
|
345
|
+
shell: true,
|
|
346
|
+
encoding: "utf8"
|
|
347
|
+
});
|
|
348
|
+
const pathOut = (whichOut.stdout?.trim() || whichOut.stderr?.trim() || "").split("\n")[0];
|
|
349
|
+
console.log("[env] copilot executable:", pathOut || "(not found)");
|
|
350
|
+
} catch {
|
|
351
|
+
console.log("[env] copilot executable: (resolve failed)");
|
|
352
|
+
}
|
|
353
|
+
} else console.log("[env] child env: inherits process.env (win32)");
|
|
321
354
|
const child = spawn(bind, [
|
|
322
355
|
...tools,
|
|
323
356
|
"-p",
|
|
@@ -329,7 +362,7 @@ async function cli() {
|
|
|
329
362
|
"pipe",
|
|
330
363
|
"pipe"
|
|
331
364
|
],
|
|
332
|
-
...platform === "win32" ? { shell: true } : { env:
|
|
365
|
+
...platform === "win32" ? { shell: true } : { env: childEnv }
|
|
333
366
|
});
|
|
334
367
|
child.stdout.on("data", (chunk) => console.log(String(chunk)));
|
|
335
368
|
child.stderr.on("data", (chunk) => console.error(String(chunk)));
|