// Shared types for package manager commands (npm, pnpm, yarn, bun). // Each PM file is a factory that receives these deps from child_process.ts. import type { ShellCommand, ShellResult, ShellContext } from "../shell-types"; export type PkgManager = "npm" | "pnpm" | "yarn" | "bun"; export interface PmDeps { installPackages: ( args: string[], ctx: ShellContext, pm?: PkgManager, ) => Promise; uninstallPackages: ( args: string[], ctx: ShellContext, pm?: PkgManager, ) => Promise; listPackages: (ctx: ShellContext, pm?: PkgManager) => Promise; runScript: (args: string[], ctx: ShellContext) => Promise; npmInitOrCreate: ( args: string[], sub: string, ctx: ShellContext, ) => Promise; npmInfo: (args: string[], ctx: ShellContext) => Promise; npmPack: (ctx: ShellContext) => ShellResult; npmConfig: (args: string[], ctx: ShellContext) => ShellResult; npxExecute: (params: string[], ctx: ShellContext) => Promise; executeNodeBinary: ( filePath: string, args: string[], ctx: ShellContext, opts?: { isFork?: boolean }, ) => Promise; evalCode: (code: string, ctx: ShellContext) => ShellResult; printCode: (code: string, ctx: ShellContext) => ShellResult; removeNodeModules: (cwd: string) => void; formatErr: (msg: string, pm: PkgManager) => string; formatWarn: (msg: string, pm: PkgManager) => string; hasFile: (path: string) => boolean; readFile: (path: string) => string; writeFile: (path: string, data: string) => void; npmPkg?: (args: string[], ctx: ShellContext) => ShellResult; }