@oh-my-pi/pi-utils 18.0.0 → 18.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [18.0.1] - 2026-08-23
6
+
7
+ ### Fixed
8
+
9
+ - Fixed the Mermaid ASCII renderer throwing on left-to-right diagrams containing a `subgraph`, which made the fenced block fall back to raw source in the terminal. `offsetDrawingForSubgraphs` shifts every drawing coordinate to make room for subgraph borders that extend past the origin, but the canvas had already been sized from the pre-shift grid extents, so edges routed to the outermost column wrote past the allocation and `drawLine` threw on the missing column. The canvas and role canvas now grow by the same shift. ([#9340](https://github.com/can1357/oh-my-pi/issues/9340))
10
+ - Fixed child shell environments inheriting Bun-autoloaded `.env.<mode>.local` values from the launch directory. ([#9290](https://github.com/can1357/oh-my-pi/issues/9290))
11
+
5
12
  ## [17.4.2] - 2026-08-21
6
13
 
7
14
  ### Fixed
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-utils",
4
- "version": "18.0.0",
4
+ "version": "18.0.3",
5
5
  "description": "Shared utilities for pi packages",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Stencil Labs, Inc.",
@@ -31,7 +31,7 @@
31
31
  "fmt": "biome format --write ."
32
32
  },
33
33
  "dependencies": {
34
- "@oh-my-pi/pi-natives": "18.0.0"
34
+ "@oh-my-pi/pi-natives": "18.0.3"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/bun": "^1.3.14"
package/src/env.ts CHANGED
@@ -102,16 +102,39 @@ export function filterChildShellEnv(
102
102
  ): Record<string, string> {
103
103
  const result = filterProcessEnv(env);
104
104
  const projectEnv = parseEnvFile(path.join(cwd, ".env"));
105
- const nodeEnvName = `.env.${env.NODE_ENV || "development"}`;
105
+ const launchNodeEnv = launchEnvValues ? launchEnvValues.get("NODE_ENV") : env.NODE_ENV;
106
+ const nodeEnvName = `.env.${launchNodeEnv || "development"}`;
106
107
  const modeEnv = parseEnvFile(path.join(cwd, nodeEnvName));
107
108
  const localEnv = parseEnvFile(path.join(cwd, ".env.local"));
108
- const launchEnv = { ...projectEnv, ...modeEnv, ...localEnv };
109
+ const modeLocalEnv = parseEnvFile(path.join(cwd, `${nodeEnvName}.local`));
110
+ const launchEnv = { ...projectEnv, ...modeEnv, ...localEnv, ...modeLocalEnv };
109
111
  const expandedLaunchEnv = {
110
112
  ...expandDotenvValues(projectEnv, result),
111
113
  ...expandDotenvValues(modeEnv, result),
112
114
  ...expandDotenvValues(localEnv, result),
115
+ ...expandDotenvValues(modeLocalEnv, result),
113
116
  };
114
- for (const key in launchEnv) {
117
+ let fallbackLaunchEnv: Record<string, string> | undefined;
118
+ let expandedFallbackLaunchEnv: Record<string, string> | undefined;
119
+ if (!launchEnvValues && nodeEnvName !== ".env.development") {
120
+ const fallbackModeEnv = parseEnvFile(path.join(cwd, ".env.development"));
121
+ const fallbackModeLocalEnv = parseEnvFile(path.join(cwd, ".env.development.local"));
122
+ const candidate = { ...projectEnv, ...fallbackModeEnv, ...localEnv, ...fallbackModeLocalEnv };
123
+ const expandedCandidate = {
124
+ ...expandDotenvValues(projectEnv, result),
125
+ ...expandDotenvValues(fallbackModeEnv, result),
126
+ ...expandDotenvValues(localEnv, result),
127
+ ...expandDotenvValues(fallbackModeLocalEnv, result),
128
+ };
129
+ if (candidate.NODE_ENV === env.NODE_ENV || expandedCandidate.NODE_ENV === env.NODE_ENV) {
130
+ // Without a launch snapshot, NODE_ENV may itself have come from dotenv.
131
+ // Bun chose the default mode before loading it, so retain both candidates.
132
+ fallbackLaunchEnv = candidate;
133
+ expandedFallbackLaunchEnv = expandedCandidate;
134
+ }
135
+ }
136
+ const allLaunchEnv = fallbackLaunchEnv ? { ...launchEnv, ...fallbackLaunchEnv } : launchEnv;
137
+ for (const key in allLaunchEnv) {
115
138
  const launchValue = launchEnvValues?.get(key);
116
139
  if (launchValue !== undefined) {
117
140
  // Launcher-owned name: it keeps the launcher's own value. Bun overwrites
@@ -119,7 +142,10 @@ export function filterChildShellEnv(
119
142
  // value whenever what survived is exactly what the dotenv file defines.
120
143
  if (
121
144
  result[key] !== launchValue &&
122
- (result[key] === launchEnv[key] || result[key] === expandedLaunchEnv[key])
145
+ (result[key] === launchEnv[key] ||
146
+ result[key] === expandedLaunchEnv[key] ||
147
+ result[key] === fallbackLaunchEnv?.[key] ||
148
+ result[key] === expandedFallbackLaunchEnv?.[key])
123
149
  ) {
124
150
  result[key] = launchValue;
125
151
  }
@@ -130,7 +156,12 @@ export function filterChildShellEnv(
130
156
  // absent from it, or OMP itself injected the value — either way it came
131
157
  // from a project dotenv file, not the parent shell.
132
158
  delete result[key];
133
- } else if (result[key] === launchEnv[key] || result[key] === expandedLaunchEnv[key]) {
159
+ } else if (
160
+ result[key] === launchEnv[key] ||
161
+ result[key] === expandedLaunchEnv[key] ||
162
+ result[key] === fallbackLaunchEnv?.[key] ||
163
+ result[key] === expandedFallbackLaunchEnv?.[key]
164
+ ) {
134
165
  // No launch-env snapshot (dotenv autoloaded without procfs): best-effort
135
166
  // value match against the Bun-parsed dotenv.
136
167
  delete result[key];
@@ -11,7 +11,14 @@ import type {
11
11
  GridCoord, DrawingCoord, Direction, AsciiGraph, AsciiNode, AsciiSubgraph,
12
12
  } from './types'
13
13
  import { gridKey } from './types'
14
- import { mkCanvas, setCanvasSizeToGrid, setRoleCanvasSizeToGrid } from './canvas'
14
+ import {
15
+ getCanvasSize,
16
+ increaseRoleCanvasSize,
17
+ increaseSize,
18
+ mkCanvas,
19
+ setCanvasSizeToGrid,
20
+ setRoleCanvasSizeToGrid,
21
+ } from './canvas'
15
22
  import { determinePath, determineLabelLine } from './edge-routing'
16
23
  import { analyzeEdgeBundles, processBundles } from './edge-bundling'
17
24
  import { drawBox } from './draw'
@@ -374,6 +381,14 @@ export function offsetDrawingForSubgraphs(graph: AsciiGraph): void {
374
381
  node.drawingCoord.y += offsetY
375
382
  }
376
383
  }
384
+
385
+ // The canvas was sized from the pre-shift grid extents, but every drawing
386
+ // coordinate — including edge path endpoints, which gridToDrawingCoord
387
+ // offsets on read — now sits `offset` cells further out. Grow it to match,
388
+ // or drawing the rightmost/bottom-most edges writes past the allocation.
389
+ const [maxX, maxY] = getCanvasSize(graph.canvas)
390
+ increaseSize(graph.canvas, maxX + offsetX, maxY + offsetY)
391
+ increaseRoleCanvasSize(graph.roleCanvas, maxX + offsetX, maxY + offsetY)
377
392
  }
378
393
 
379
394
  // ============================================================================