@oh-my-pi/pi-utils 11.0.1 → 11.0.3
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/env.ts +4 -4
- package/src/procmgr.ts +4 -4
- package/src/snowflake.ts +3 -5
package/package.json
CHANGED
package/src/env.ts
CHANGED
|
@@ -50,17 +50,17 @@ const projectEnv = parseEnvFile(path.join(process.cwd(), ".env"));
|
|
|
50
50
|
|
|
51
51
|
for (const file of [projectEnv, homeEnv]) {
|
|
52
52
|
for (const [key, value] of Object.entries(file)) {
|
|
53
|
-
if (!
|
|
54
|
-
|
|
53
|
+
if (!Bun.env[key]) {
|
|
54
|
+
Bun.env[key] = value;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
* Intentional re-export of
|
|
60
|
+
* Intentional re-export of Bun.env.
|
|
61
61
|
*
|
|
62
62
|
* All users should import this env module (import { $env } from "@oh-my-pi/pi-utils")
|
|
63
63
|
* before using environment variables. This ensures that .env files have been loaded and
|
|
64
64
|
* overrides (project, home) have been applied, so $env always reflects the correct values.
|
|
65
65
|
*/
|
|
66
|
-
export const $env: Record<string, string> =
|
|
66
|
+
export const $env: Record<string, string> = Bun.env as Record<string, string>;
|
package/src/procmgr.ts
CHANGED
|
@@ -34,7 +34,7 @@ function isExecutable(path: string): boolean {
|
|
|
34
34
|
function buildSpawnEnv(shell: string): Record<string, string> {
|
|
35
35
|
const noCI = $env.PI_BASH_NO_CI || $env.CLAUDE_BASH_NO_CI;
|
|
36
36
|
return {
|
|
37
|
-
...
|
|
37
|
+
...Bun.env,
|
|
38
38
|
SHELL: shell,
|
|
39
39
|
GIT_EDITOR: "true",
|
|
40
40
|
GPG_TTY: "not a tty",
|
|
@@ -135,11 +135,11 @@ export function getShellConfig(customShellPath?: string): ShellConfig {
|
|
|
135
135
|
if (process.platform === "win32") {
|
|
136
136
|
// 2. Try Git Bash in known locations
|
|
137
137
|
const paths: string[] = [];
|
|
138
|
-
const programFiles =
|
|
138
|
+
const programFiles = Bun.env.ProgramFiles;
|
|
139
139
|
if (programFiles) {
|
|
140
140
|
paths.push(`${programFiles}\\Git\\bin\\bash.exe`);
|
|
141
141
|
}
|
|
142
|
-
const programFilesX86 =
|
|
142
|
+
const programFilesX86 = Bun.env["ProgramFiles(x86)"];
|
|
143
143
|
if (programFilesX86) {
|
|
144
144
|
paths.push(`${programFilesX86}\\Git\\bin\\bash.exe`);
|
|
145
145
|
}
|
|
@@ -168,7 +168,7 @@ export function getShellConfig(customShellPath?: string): ShellConfig {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
// Unix: prefer user's shell from $SHELL if it's bash/zsh and executable
|
|
171
|
-
const userShell =
|
|
171
|
+
const userShell = Bun.env.SHELL;
|
|
172
172
|
const isValidShell = userShell && (userShell.includes("bash") || userShell.includes("zsh"));
|
|
173
173
|
if (isValidShell && isExecutable(userShell)) {
|
|
174
174
|
cachedShellConfig = buildConfig(userShell);
|
package/src/snowflake.ts
CHANGED
|
@@ -97,9 +97,8 @@ namespace Snowflake {
|
|
|
97
97
|
//
|
|
98
98
|
export function lowerbound(timelike: Date | number | Snowflake): Snowflake {
|
|
99
99
|
switch (typeof timelike) {
|
|
100
|
-
// biome-ignore lint/suspicious/noFallthroughSwitchClause: intentional fallthrough
|
|
101
100
|
case "object": // Date
|
|
102
|
-
|
|
101
|
+
return formatParts(timelike.getTime() - EPOCH, 0);
|
|
103
102
|
case "number":
|
|
104
103
|
return formatParts(timelike - EPOCH, 0);
|
|
105
104
|
case "string": // Snowflake hex string
|
|
@@ -108,11 +107,10 @@ namespace Snowflake {
|
|
|
108
107
|
}
|
|
109
108
|
export function upperbound(timelike: Date | number | Snowflake): Snowflake {
|
|
110
109
|
switch (typeof timelike) {
|
|
111
|
-
// biome-ignore lint/suspicious/noFallthroughSwitchClause: intentional fallthrough
|
|
112
110
|
case "object": // Date
|
|
113
|
-
|
|
111
|
+
return formatParts(timelike.getTime() - EPOCH, MAX_SEQ);
|
|
114
112
|
case "number":
|
|
115
|
-
return formatParts(timelike - EPOCH,
|
|
113
|
+
return formatParts(timelike - EPOCH, MAX_SEQ);
|
|
116
114
|
case "string": // Snowflake hex string
|
|
117
115
|
return timelike;
|
|
118
116
|
}
|