pi-jev-guard 0.1.3 → 0.1.4
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 +1 -1
- package/src/commands.ts +11 -1
package/package.json
CHANGED
package/src/commands.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFileSync, existsSync, statSync, realpathSync, writeFileSync, mkdirSync, chmodSync } from "node:fs";
|
|
2
2
|
import { resolve, dirname } from "node:path";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
3
4
|
import type { ExtensionAPI, ModelRegistry } from "@earendil-works/pi-coding-agent";
|
|
4
5
|
import type { JevConfig } from "./config.ts";
|
|
5
6
|
import { defaultConfigPath, expandHome, parseUpstreamRef, resolveBackend, saveConfig } from "./config.ts";
|
|
@@ -345,9 +346,18 @@ export function registerJevCommand(pi: ExtensionAPI, deps: JevCommandDeps) {
|
|
|
345
346
|
|
|
346
347
|
if (sub === "save-key") {
|
|
347
348
|
const cfg = deps.config();
|
|
348
|
-
|
|
349
|
+
let target = cfg.jev.apiKeyFile?.trim()
|
|
349
350
|
? expandHome(cfg.jev.apiKeyFile.trim())
|
|
350
351
|
: resolve(dirname(defaultConfigPath()), "jev-api-key.txt");
|
|
352
|
+
// Mai chiavi in tmp: dir effimera (pulizia automatica = chiave persa).
|
|
353
|
+
// Può capitare con config stantie caricate in memoria prima di un fix.
|
|
354
|
+
if (target === tmpdir() || target.startsWith(tmpdir() + "/")) {
|
|
355
|
+
ctx.ui.notify(
|
|
356
|
+
`Jev: percorso chiave sotto tmp ignorato (${target}); uso quello canonico.`,
|
|
357
|
+
"warning",
|
|
358
|
+
);
|
|
359
|
+
target = resolve(dirname(defaultConfigPath()), "jev-api-key.txt");
|
|
360
|
+
}
|
|
351
361
|
let key: string | undefined;
|
|
352
362
|
try {
|
|
353
363
|
key = await ctx.ui.input(
|