export type DependencyKind = 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies';
export interface PackageJson {
    name?: string;
    version?: string;
    type?: string;
    workspaces?: string[] | {
        packages?: string[];
        nohoist?: string[];
    };
    dependencies?: Record<string, string>;
    devDependencies?: Record<string, string>;
    peerDependencies?: Record<string, string>;
    optionalDependencies?: Record<string, string>;
    [key: string]: unknown;
}
export declare function readPackageJson(pkgPath: string): PackageJson | null;
export declare function writePackageJson(pkgPath: string, pkg: PackageJson): void;
/**
 * Parse a user spec into `{ name, range }`:
 *   `react`         → { name: 'react', range: undefined }
 *   `react@^18`     → { name: 'react', range: '^18' }
 *   `@types/node`   → { name: '@types/node', range: undefined }
 *   `@types/node@1` → { name: '@types/node', range: '1' }
 */
export declare function parseSpec(spec: string): {
    name: string;
    range?: string;
};
/**
 * Collect existing dependencies + devDependencies + optionalDependencies
 * from a project package.json into installable specs of the form
 * `name@range`. Used by `gjsify install` (no args) to seed the resolver
 * with the project's existing dependency manifest — equivalent to
 * `npm install` reading `package.json`.
 */
export declare function projectSpecsFromPackageJson(pkg: PackageJson): string[];
/**
 * Add or update a dependency entry in `pkg`. If the spec didn't include
 * a range, callers fill in the installed version after resolution and
 * call this again with `installedVersion` set.
 */
export declare function addDependencyEntry(pkg: PackageJson, name: string, range: string, kind: DependencyKind): void;
/**
 * Default version range when the user didn't pin one: `^x.y.z` from the
 * installed version. Mirrors npm's `save-prefix` default (`^`).
 */
export declare function defaultRangeFromVersion(version: string): string;
