refactor(dirs): centralized directory path utilities into @oh-my-pi/pi-utils/dirs module

- Extracted directory path utilities from multiple packages into a centralized '@oh-my-pi/pi-utils/dirs' module.
- Moved 30+ path helper functions (getAgentDir, getConfigRootDir, getPluginsDir, getMCPConfigPath, etc.) from scattered locations into a single shared utility module.
- Consolidated APP_NAME, CONFIG_DIR_NAME, and VERSION constants into the centralized dirs module for reuse across packages.
- Updated 70+ import statements across packages/ai, packages/coding-agent, packages/stats, and packages/tui to use the new centralized module.
- Removed local path construction logic and replaced with utility function calls for improved maintainability and consistency.
- Deleted packages/coding-agent/src/extensibility/plugins/paths.ts as its functions were moved to the centralized dirs module.
This commit is contained in:
can1357
2026-02-13 15:06:05 +01:00
parent 402713a1ee
commit fcd7ff4f84
73 changed files with 456 additions and 347 deletions
+2 -3
View File
@@ -3,11 +3,10 @@
*
* Handles `omp setup <component>` to install dependencies for optional features.
*/
import * as os from "node:os";
import * as path from "node:path";
import { APP_NAME, getPythonEnvDir } from "@oh-my-pi/pi-utils/dirs";
import { $ } from "bun";
import chalk from "chalk";
import { APP_NAME, CONFIG_DIR_NAME } from "../config";
import { theme } from "../modes/theme/theme";
export type SetupComponent = "python";
@@ -23,7 +22,7 @@ export interface SetupCommandArgs {
const VALID_COMPONENTS: SetupComponent[] = ["python"];
const PYTHON_PACKAGES = ["jupyter_kernel_gateway", "ipykernel"];
const MANAGED_PYTHON_ENV = path.join(os.homedir(), CONFIG_DIR_NAME, "python-env");
const MANAGED_PYTHON_ENV = getPythonEnvDir();
/**
* Parse setup subcommand arguments.