@linxiraos/pi-utils 1.4.12 → 1.4.13
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/CHANGELOG.md +4 -0
- package/dist/types/dirs.d.ts +12 -8
- package/package.json +3 -3
- package/src/dirs.ts +23 -12
- package/src/ptree.ts +2 -2
package/CHANGELOG.md
CHANGED
package/dist/types/dirs.d.ts
CHANGED
|
@@ -284,18 +284,21 @@ export declare function hashPath(absPath: string): string;
|
|
|
284
284
|
export declare function getWorktreeDir(segment: string): string;
|
|
285
285
|
/**
|
|
286
286
|
* Get the GitHub view cache database path (~/.zeta/cache/github-cache.db).
|
|
287
|
-
* Honors the `
|
|
288
|
-
*
|
|
287
|
+
* Honors the `ZETA_GITHUB_CACHE_DB` env var (`OMP_GITHUB_CACHE_DB` kept as a
|
|
288
|
+
* read alias) when set so tests can isolate the cache file without touching
|
|
289
|
+
* the rest of the config root.
|
|
289
290
|
*/
|
|
290
291
|
export declare function getGithubCacheDbPath(): string;
|
|
291
292
|
/**
|
|
292
293
|
* Get the conventional commit inference cache database path (~/.zeta/cache/commit-inference.db).
|
|
293
|
-
* Honors `OMP_COMMIT_CACHE_DB`
|
|
294
|
+
* Honors `ZETA_COMMIT_CACHE_DB` (`OMP_COMMIT_CACHE_DB` kept as a read alias)
|
|
295
|
+
* so tests and operators can isolate the cache.
|
|
294
296
|
*/
|
|
295
297
|
export declare function getCommitCacheDbPath(): string;
|
|
296
298
|
/**
|
|
297
299
|
* Get the judgment answer cache database path (~/.zeta/cache/judgment-cache.db).
|
|
298
|
-
* Honors `OMP_JUDGMENT_CACHE_DB`
|
|
300
|
+
* Honors `ZETA_JUDGMENT_CACHE_DB` (`OMP_JUDGMENT_CACHE_DB` kept as a read
|
|
301
|
+
* alias) so tests and operators can isolate the cache.
|
|
299
302
|
*/
|
|
300
303
|
export declare function getJudgmentCacheDbPath(): string;
|
|
301
304
|
/** Get the legacy Pi extension parse cache database path. */
|
|
@@ -421,10 +424,11 @@ export declare function getMCPConfigPath(scope: "user" | "project", cwd?: string
|
|
|
421
424
|
/** Get the SSH config file path. */
|
|
422
425
|
export declare function getSSHConfigPath(scope: "user" | "project", cwd?: string): string;
|
|
423
426
|
/**
|
|
424
|
-
* Application label for usage attribution (`
|
|
425
|
-
* `
|
|
426
|
-
*
|
|
427
|
-
*
|
|
427
|
+
* Application label for usage attribution (`ZETA_APP_NAME`, with
|
|
428
|
+
* `OMP_APP_NAME` kept as a read alias), defaulting to `zeta`. Embedders that
|
|
429
|
+
* drive zeta programmatically (robomp, CI bots, …) set the env var so
|
|
430
|
+
* broker-side per-client burn tracking can answer "what did app X use" instead
|
|
431
|
+
* of folding everything into one install-wide bucket.
|
|
428
432
|
*/
|
|
429
433
|
export declare function getAppName(): string;
|
|
430
434
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxiraos/pi-utils",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.13",
|
|
4
4
|
"description": "Shared utilities for pi packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"utilities",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@linxiraos/pi-natives": "1.4.
|
|
58
|
-
"@linxiraos/zeta-schema": "1.4.
|
|
57
|
+
"@linxiraos/pi-natives": "1.4.13",
|
|
58
|
+
"@linxiraos/zeta-schema": "1.4.13"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/bun": "1.4.4"
|
package/src/dirs.ts
CHANGED
|
@@ -24,6 +24,13 @@ import { isBunTestRuntime } from "./test-runtime";
|
|
|
24
24
|
* names, provider attribution headers, splash wordmark. NOT the CLI command. */
|
|
25
25
|
export const APP_NAME: string = "zeta";
|
|
26
26
|
|
|
27
|
+
/** Read `primary`, falling back to the pre-rename `legacy` spelling. */
|
|
28
|
+
function readAliasedEnv(primary: string, legacy: string): string | undefined {
|
|
29
|
+
const value = process.env[primary]?.trim();
|
|
30
|
+
if (value) return value;
|
|
31
|
+
return process.env[legacy]?.trim() || undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
/** CLI binary name (`npm i -g @linxiraos/zeta` installs exactly one bin,
|
|
28
35
|
* `zetacode` — the retired `zeta-c`/`zeta-cli` aliases are gone). Every
|
|
29
36
|
* user-facing "run this command" string and process title uses this; the
|
|
@@ -971,30 +978,33 @@ export function getWorktreeDir(segment: string): string {
|
|
|
971
978
|
|
|
972
979
|
/**
|
|
973
980
|
* Get the GitHub view cache database path (~/.zeta/cache/github-cache.db).
|
|
974
|
-
* Honors the `
|
|
975
|
-
*
|
|
981
|
+
* Honors the `ZETA_GITHUB_CACHE_DB` env var (`OMP_GITHUB_CACHE_DB` kept as a
|
|
982
|
+
* read alias) when set so tests can isolate the cache file without touching
|
|
983
|
+
* the rest of the config root.
|
|
976
984
|
*/
|
|
977
985
|
export function getGithubCacheDbPath(): string {
|
|
978
|
-
const override =
|
|
986
|
+
const override = readAliasedEnv("ZETA_GITHUB_CACHE_DB", "OMP_GITHUB_CACHE_DB");
|
|
979
987
|
if (override) return override;
|
|
980
988
|
return dirs.rootSubdir(path.join("cache", "github-cache.db"), "cache");
|
|
981
989
|
}
|
|
982
990
|
/**
|
|
983
991
|
* Get the conventional commit inference cache database path (~/.zeta/cache/commit-inference.db).
|
|
984
|
-
* Honors `OMP_COMMIT_CACHE_DB`
|
|
992
|
+
* Honors `ZETA_COMMIT_CACHE_DB` (`OMP_COMMIT_CACHE_DB` kept as a read alias)
|
|
993
|
+
* so tests and operators can isolate the cache.
|
|
985
994
|
*/
|
|
986
995
|
export function getCommitCacheDbPath(): string {
|
|
987
|
-
const override =
|
|
996
|
+
const override = readAliasedEnv("ZETA_COMMIT_CACHE_DB", "OMP_COMMIT_CACHE_DB");
|
|
988
997
|
if (override) return override;
|
|
989
998
|
return dirs.rootSubdir(path.join("cache", "commit-inference.db"), "cache");
|
|
990
999
|
}
|
|
991
1000
|
|
|
992
1001
|
/**
|
|
993
1002
|
* Get the judgment answer cache database path (~/.zeta/cache/judgment-cache.db).
|
|
994
|
-
* Honors `OMP_JUDGMENT_CACHE_DB`
|
|
1003
|
+
* Honors `ZETA_JUDGMENT_CACHE_DB` (`OMP_JUDGMENT_CACHE_DB` kept as a read
|
|
1004
|
+
* alias) so tests and operators can isolate the cache.
|
|
995
1005
|
*/
|
|
996
1006
|
export function getJudgmentCacheDbPath(): string {
|
|
997
|
-
const override =
|
|
1007
|
+
const override = readAliasedEnv("ZETA_JUDGMENT_CACHE_DB", "OMP_JUDGMENT_CACHE_DB");
|
|
998
1008
|
if (override) return override;
|
|
999
1009
|
return dirs.rootSubdir(path.join("cache", "judgment-cache.db"), "cache");
|
|
1000
1010
|
}
|
|
@@ -1355,13 +1365,14 @@ let cachedInstallId: string | null = null;
|
|
|
1355
1365
|
|
|
1356
1366
|
const INSTALL_ID_FILE = "install-id";
|
|
1357
1367
|
/**
|
|
1358
|
-
* Application label for usage attribution (`
|
|
1359
|
-
* `
|
|
1360
|
-
*
|
|
1361
|
-
*
|
|
1368
|
+
* Application label for usage attribution (`ZETA_APP_NAME`, with
|
|
1369
|
+
* `OMP_APP_NAME` kept as a read alias), defaulting to `zeta`. Embedders that
|
|
1370
|
+
* drive zeta programmatically (robomp, CI bots, …) set the env var so
|
|
1371
|
+
* broker-side per-client burn tracking can answer "what did app X use" instead
|
|
1372
|
+
* of folding everything into one install-wide bucket.
|
|
1362
1373
|
*/
|
|
1363
1374
|
export function getAppName(): string {
|
|
1364
|
-
const value =
|
|
1375
|
+
const value = readAliasedEnv("ZETA_APP_NAME", "OMP_APP_NAME");
|
|
1365
1376
|
return value ? value : "zeta";
|
|
1366
1377
|
}
|
|
1367
1378
|
|
package/src/ptree.ts
CHANGED
|
@@ -16,8 +16,8 @@ type InMask = "pipe" | "ignore" | Buffer | Uint8Array | null;
|
|
|
16
16
|
/** A Bun subprocess with stdout/stderr always piped (stdin may vary). */
|
|
17
17
|
type PipedSubprocess<In extends InMask = InMask> = Subprocess<In, "pipe", "pipe">;
|
|
18
18
|
|
|
19
|
-
const LINUX_SUBREAPER_COMMAND_ENV = "
|
|
20
|
-
const LINUX_SUBREAPER_BUN_BE_BUN_ENV = "
|
|
19
|
+
const LINUX_SUBREAPER_COMMAND_ENV = "ZETA_PTREE_SUBREAPER_COMMAND";
|
|
20
|
+
const LINUX_SUBREAPER_BUN_BE_BUN_ENV = "ZETA_PTREE_SUBREAPER_BUN_BE_BUN";
|
|
21
21
|
const SUBREAPER_KILL_WINDOW_MS = 100;
|
|
22
22
|
const SUBREAPER_KILL_POLL_MS = 5;
|
|
23
23
|
|