refactor(deps): restructured codebase to use centralized pi-utils package

- Created new @oh-my-pi/pi-utils workspace package with shared utilities for logging, process management, stream handling, and temporary directory management.
- Migrated all packages to use centralized logger from @oh-my-pi/pi-utils instead of local winston implementations.
- Replaced custom process spawning and stream reading implementations with standardized cspawn and readLines utilities across all modules.
- Converted synchronous file operations and process spawning to async patterns using Bun shell syntax and fs/promises.
- Added streaming edit abort functionality with configurable setting to abort on patch preview failures.
- Updated test framework from vitest to bun:test across all test suites.
This commit is contained in:
can1357
2026-01-20 05:33:21 +01:00
parent 030b812624
commit b2c94bef1a
166 changed files with 3821 additions and 3215 deletions
@@ -1,4 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test";
import { createTempDirSync } from "@oh-my-pi/pi-utils";
import { PythonKernel } from "../../src/core/python-kernel";
import { PYTHON_PRELUDE } from "../../src/core/python-prelude";
import * as shell from "../../src/utils/shell";
@@ -98,7 +99,8 @@ describe("PythonKernel.start (local gateway)", () => {
.spyOn(PythonKernel.prototype, "execute")
.mockResolvedValue({ status: "ok", cancelled: false, timedOut: false, stdinRequested: false });
const kernel = await PythonKernel.start({ cwd: "/tmp/project", env: { CUSTOM_VAR: "ok" } });
using tempDir = createTempDirSync("@python-kernel-env-");
const kernel = await PythonKernel.start({ cwd: tempDir.path, env: { CUSTOM_VAR: "ok" } });
const createCall = fetchSpy.mock.calls.find(([input, init]) => {
const url = typeof input === "string" ? input : input.toString();
@@ -117,7 +119,7 @@ describe("PythonKernel.start (local gateway)", () => {
expect(spawnEnv?.CUSTOM_VAR).toBe("ok");
expect(spawnEnv?.OPENAI_API_KEY).toBeUndefined();
expect(spawnEnv?.UNSAFE_TOKEN).toBeUndefined();
expect(spawnEnv?.PYTHONPATH).toBe("/tmp/project");
expect(spawnEnv?.PYTHONPATH).toBe(tempDir.path);
expect(executeSpy).toHaveBeenCalledWith(
PYTHON_PRELUDE,