mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 12:03:49 +00:00
- Sync all packages to version 0.7.7 - Rewrite sync-versions.js to handle ALL inter-package dependencies automatically - Fix web-ui dependency on pi-ai (was 0.6.0, now 0.7.7) - Move agent fix changelog entry to coding-agent CHANGELOG - Remove redundant agent CHANGELOG.md - Improve README.md with clearer lockstep versioning docs - Add /changelog command to display full changelog in TUI (newest last) - Fix changelog description (not a scrollable viewer, just displays in chat) - Update CHANGELOG for 0.7.7 release
96 lines
2.8 KiB
JavaScript
96 lines
2.8 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Syncs ALL @mariozechner/* package dependency versions to match their current versions.
|
|
* This ensures lockstep versioning across the monorepo.
|
|
*/
|
|
|
|
import { readFileSync, writeFileSync, readdirSync } from 'fs';
|
|
import { join } from 'path';
|
|
|
|
const packagesDir = join(process.cwd(), 'packages');
|
|
const packageDirs = readdirSync(packagesDir, { withFileTypes: true })
|
|
.filter(dirent => dirent.isDirectory())
|
|
.map(dirent => dirent.name);
|
|
|
|
// Read all package.json files and build version map
|
|
const packages = {};
|
|
const versionMap = {};
|
|
|
|
for (const dir of packageDirs) {
|
|
const pkgPath = join(packagesDir, dir, 'package.json');
|
|
try {
|
|
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
packages[dir] = { path: pkgPath, data: pkg };
|
|
versionMap[pkg.name] = pkg.version;
|
|
} catch (e) {
|
|
console.error(`Failed to read ${pkgPath}:`, e.message);
|
|
}
|
|
}
|
|
|
|
console.log('Current versions:');
|
|
for (const [name, version] of Object.entries(versionMap).sort()) {
|
|
console.log(` ${name}: ${version}`);
|
|
}
|
|
|
|
// Verify all versions are the same (lockstep)
|
|
const versions = new Set(Object.values(versionMap));
|
|
if (versions.size > 1) {
|
|
console.error('\n❌ ERROR: Not all packages have the same version!');
|
|
console.error('Expected lockstep versioning. Run one of:');
|
|
console.error(' npm run version:patch');
|
|
console.error(' npm run version:minor');
|
|
console.error(' npm run version:major');
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log('\n✅ All packages at same version (lockstep)');
|
|
|
|
// Update all inter-package dependencies
|
|
let totalUpdates = 0;
|
|
for (const [dir, pkg] of Object.entries(packages)) {
|
|
let updated = false;
|
|
|
|
// Check dependencies
|
|
if (pkg.data.dependencies) {
|
|
for (const [depName, currentVersion] of Object.entries(pkg.data.dependencies)) {
|
|
if (versionMap[depName]) {
|
|
const newVersion = `^${versionMap[depName]}`;
|
|
if (currentVersion !== newVersion) {
|
|
console.log(`\n${pkg.data.name}:`);
|
|
console.log(` ${depName}: ${currentVersion} → ${newVersion}`);
|
|
pkg.data.dependencies[depName] = newVersion;
|
|
updated = true;
|
|
totalUpdates++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Check devDependencies
|
|
if (pkg.data.devDependencies) {
|
|
for (const [depName, currentVersion] of Object.entries(pkg.data.devDependencies)) {
|
|
if (versionMap[depName]) {
|
|
const newVersion = `^${versionMap[depName]}`;
|
|
if (currentVersion !== newVersion) {
|
|
console.log(`\n${pkg.data.name}:`);
|
|
console.log(` ${depName}: ${currentVersion} → ${newVersion} (devDependencies)`);
|
|
pkg.data.devDependencies[depName] = newVersion;
|
|
updated = true;
|
|
totalUpdates++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Write if updated
|
|
if (updated) {
|
|
writeFileSync(pkg.path, JSON.stringify(pkg.data, null, '\t') + '\n');
|
|
}
|
|
}
|
|
|
|
if (totalUpdates === 0) {
|
|
console.log('\nAll inter-package dependencies already in sync.');
|
|
} else {
|
|
console.log(`\n✅ Updated ${totalUpdates} dependency version(s)`);
|
|
}
|