tewip-ai 0.8.0 → 0.8.1
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/dist/engine/llm/client.js +31 -4
- package/package.json +1 -1
|
@@ -14,14 +14,41 @@ const MAX_ATTEMPTS = 3;
|
|
|
14
14
|
/** TEWIP_LLM_CACHE moves the cache, e.g. into the project the command line runs in. */
|
|
15
15
|
const CACHE_FILE = process.env.TEWIP_LLM_CACHE || join(DATA_DIR, 'llm-cache.jsonl');
|
|
16
16
|
let envLoaded = false;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Loads a `.env` once, from the project being worked on.
|
|
19
|
+
*
|
|
20
|
+
* This used to read only Tewip's own folder, which is right when running from a checkout and wrong
|
|
21
|
+
* for everybody who installs it: their key sits in their project's .env, and Tewip silently found
|
|
22
|
+
* no model and answered with rules alone. The working directory is now looked at first, then its
|
|
23
|
+
* parent (a monorepo package), then Tewip's own folder for development.
|
|
24
|
+
*
|
|
25
|
+
* Variables already set in the environment always win: CI sets real secrets, a file must not
|
|
26
|
+
* quietly replace them.
|
|
27
|
+
*/
|
|
18
28
|
export function loadDotEnv() {
|
|
19
29
|
if (envLoaded)
|
|
20
30
|
return;
|
|
21
31
|
envLoaded = true;
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
const places = [process.cwd(), join(process.cwd(), '..'), PROJECT_ROOT];
|
|
33
|
+
for (const dir of places) {
|
|
34
|
+
const file = join(dir, '.env');
|
|
35
|
+
if (!existsSync(file))
|
|
36
|
+
continue;
|
|
37
|
+
const before = new Set(Object.keys(process.env));
|
|
38
|
+
const kept = {};
|
|
39
|
+
for (const name of before)
|
|
40
|
+
kept[name] = process.env[name];
|
|
41
|
+
try {
|
|
42
|
+
process.loadEnvFile(file);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
continue; // an unreadable or malformed file is not a reason to stop
|
|
46
|
+
}
|
|
47
|
+
for (const [name, value] of Object.entries(kept))
|
|
48
|
+
if (value !== undefined)
|
|
49
|
+
process.env[name] = value;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
25
52
|
}
|
|
26
53
|
export function openAiClient({ apiKey, model, reasoningEffort, baseUrl = 'https://api.openai.com/v1' }) {
|
|
27
54
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tewip-ai",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Tewip finds why each failing test failed - real bug, flaky test, environment, test data or changed selector - for any stack, from the command line, CI, or your editor.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"test-failures",
|