@xera-ai/core 0.12.1 → 0.12.2
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/internal.ts +23 -8
- package/dist/bin/internal.js +11 -2
- package/package.json +3 -3
package/bin/internal.ts
CHANGED
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import { existsSync } from 'node:fs';
|
|
3
|
-
import { config } from 'dotenv';
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { config, parse } from 'dotenv';
|
|
4
4
|
import { run } from '../src/bin-internal/index';
|
|
5
5
|
|
|
6
6
|
// xera canonicalizes on `.env` (gitignored; see `xera init`, `xera doctor`,
|
|
7
|
-
// scaffolded `.gitignore`).
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
7
|
+
// scaffolded `.gitignore`). The Bun runtime auto-loads dotenv files BEFORE
|
|
8
|
+
// this script runs, and Bun's precedence puts `.env.local` ahead of `.env` —
|
|
9
|
+
// so a stale value in `.env.local` would silently override the canonical
|
|
10
|
+
// value in `.env` (issue #92, post-#103 followup).
|
|
11
|
+
//
|
|
12
|
+
// Mitigation: warn when `.env.local` exists AND surgically force `.env`'s
|
|
13
|
+
// values to win for any key present in both files. We touch only keys
|
|
14
|
+
// already in `.env.local` so shell-injected and CI-injected env vars
|
|
15
|
+
// (which the user did not put in `.env.local`) stay untouched.
|
|
11
16
|
if (existsSync('.env.local')) {
|
|
12
17
|
console.error(
|
|
13
|
-
'\nwarning: .env.local detected
|
|
14
|
-
'
|
|
18
|
+
'\nwarning: .env.local detected — xera uses .env as the canonical source. ' +
|
|
19
|
+
'Values in .env will be forced to win for any key in both files; ' +
|
|
20
|
+
'merge values into .env and delete .env.local to silence this warning.\n',
|
|
15
21
|
);
|
|
22
|
+
if (existsSync('.env')) {
|
|
23
|
+
const localKeys = Object.keys(parse(readFileSync('.env.local')));
|
|
24
|
+
const envValues = parse(readFileSync('.env'));
|
|
25
|
+
for (const k of localKeys) {
|
|
26
|
+
const v = envValues[k];
|
|
27
|
+
if (v !== undefined) process.env[k] = v;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
16
30
|
}
|
|
31
|
+
// Safety net for non-Bun invocations (Bun already auto-loaded `.env`).
|
|
17
32
|
config();
|
|
18
33
|
|
|
19
34
|
const code = await run(process.argv.slice(2));
|
package/dist/bin/internal.js
CHANGED
|
@@ -8559,7 +8559,7 @@ var init_graph_backfill = __esm(() => {
|
|
|
8559
8559
|
|
|
8560
8560
|
// bin/internal.ts
|
|
8561
8561
|
var import_dotenv = __toESM(require_main(), 1);
|
|
8562
|
-
import { existsSync as existsSync33 } from "fs";
|
|
8562
|
+
import { existsSync as existsSync33, readFileSync as readFileSync29 } from "fs";
|
|
8563
8563
|
|
|
8564
8564
|
// src/bin-internal/ac-coverage-backfill-finalize.ts
|
|
8565
8565
|
init_store();
|
|
@@ -13356,8 +13356,17 @@ Commands: ${Object.keys(COMMANDS).join(", ")}`);
|
|
|
13356
13356
|
// bin/internal.ts
|
|
13357
13357
|
if (existsSync33(".env.local")) {
|
|
13358
13358
|
console.error(`
|
|
13359
|
-
warning: .env.local detected
|
|
13359
|
+
warning: .env.local detected \u2014 xera uses .env as the canonical source. ` + "Values in .env will be forced to win for any key in both files; " + `merge values into .env and delete .env.local to silence this warning.
|
|
13360
13360
|
`);
|
|
13361
|
+
if (existsSync33(".env")) {
|
|
13362
|
+
const localKeys = Object.keys(import_dotenv.parse(readFileSync29(".env.local")));
|
|
13363
|
+
const envValues = import_dotenv.parse(readFileSync29(".env"));
|
|
13364
|
+
for (const k of localKeys) {
|
|
13365
|
+
const v = envValues[k];
|
|
13366
|
+
if (v !== undefined)
|
|
13367
|
+
process.env[k] = v;
|
|
13368
|
+
}
|
|
13369
|
+
}
|
|
13361
13370
|
}
|
|
13362
13371
|
import_dotenv.config();
|
|
13363
13372
|
var code = await run(process.argv.slice(2));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xera-ai/core",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"zod": "4.4.3",
|
|
34
|
-
"@xera-ai/web": "^0.12.
|
|
35
|
-
"@xera-ai/http": "^0.12.
|
|
34
|
+
"@xera-ai/web": "^0.12.2",
|
|
35
|
+
"@xera-ai/http": "^0.12.2",
|
|
36
36
|
"@playwright/test": "1.60.0",
|
|
37
37
|
"dotenv": "^16.0.0",
|
|
38
38
|
"fflate": "0.8.3",
|