fix: make mosaic init idempotent — detect existing config files #355
Reference in New Issue
Block a user
Delete Branch "fix/idempotent-init"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
mosaic initblindly overwrites existingSOUL.md,USER.md, andTOOLS.mdwith no detection, causing users to lose their customized agent identity on reinstall/upgrade.Changes
packages/mosaic/framework/tools/_scripts/mosaic-init(bash script)detect_existing_config()— checks for existing config files before proceeding--forceis passed)import_existing_values()— parses agent name, role, style, user name, pronouns, timezone from existing markdown--forceflag to skip detection in scripts/CIpackages/cli/src/commands/launch.tscheckSoul()now prefersmosaic wizard(TypeScript, already idempotent) over the legacy bashmosaic-initwhen SOUL.md is missingpackages/mosaic/src/stages/detect-install.tsreconfigureaction now pre-loads existing config values (previously onlykeepdid this)packages/mosaic/src/stages/soul-setup.tsreconfigure, shows existing agent name and communication style as pre-filled defaultsTests
Testing