/**
 * Transform: Update @agentuity/* packages to ^2.0.0
 *
 * Handles:
 * - "latest" tag → "^2.0.0"
 * - "*" → "^2.0.0"
 * - v1.x.x versions → "^2.0.0"
 */
/**
 * Update all outdated @agentuity/* packages to ^2.0.0
 */
export function transformPackageJson(currentContent, outdatedPackages) {
    if (outdatedPackages.length === 0) {
        return { content: null, updated: [] };
    }
    try {
        const pkg = JSON.parse(currentContent);
        const updated = [];
        for (const outdated of outdatedPackages) {
            const { name, section } = outdated;
            if (pkg[section] && pkg[section][name]) {
                pkg[section][name] = '^2.0.0';
                updated.push(`${name}: ${outdated.currentVersion} → ^2.0.0`);
            }
        }
        if (updated.length === 0) {
            return { content: null, updated: [] };
        }
        // Format with indentation (matching typical package.json style)
        return {
            content: JSON.stringify(pkg, null, '\t') + '\n',
            updated,
        };
    }
    catch {
        return { content: null, updated: [] };
    }
}
//# sourceMappingURL=package-json.js.map