The `mosaic gateway install` command had three UX problems:
1. Admin API token was silently saved to meta.json and never shown to
the user — no way to retrieve it without reading the file.
2. If install crashed mid-way (e.g. daemon health-check failure), the
next run prompted "Reinstall? [y/N]" and aborted on N, leaving a
half-configured install with no resume path.
3. Health-check failures only pointed at `mosaic gateway logs` — user
had to run a separate command to see the actual error.
Changes:
- **Prominent admin token banner** printed immediately after bootstrap
creates the first admin user. Clear "save now, won't be shown again"
warning.
- **Resumable install state machine.** Detects partial installs from
meta.json + .env + mosaic.config.json + daemon state, and picks up
where a prior attempt stopped instead of prompting. Fully set up
installs now offer "re-run config wizard" with explicit warnings
about what it does (regenerates .env, clears admin token, may change
backend storage).
- **Inline log tail on health failure.** Last 30 non-empty lines of
gateway.log printed automatically when the daemon fails to become
healthy, so the user sees the underlying error without running a
second command.
- **Corrupt-state detection.** If exactly one of .env / mosaic.config.json
exists (from an interrupted prior install), refuses to guess and
directs the user to `mosaic gateway uninstall`.
- **BETTER_AUTH_SECRET preservation** across config regeneration so
existing Better Auth sessions aren't silently invalidated.
- **Admin token dropped on any config regeneration** (the wizard may
point at a different backend; the old token is unverifiable).
- **Daemon stopped before config rewrite** so the live process never
serves stale config.
- Bump `@mosaic/mosaic` 0.0.19 → 0.0.20.
Known follow-ups (noted in review):
- `--port 14242` as an explicit override cannot be distinguished from
commander's default value; requires plumbing an `explicit` flag.
- No automated test coverage for the new state branches; requires
mocking fs/readline/fetch/spawn.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mosaic/mosaic is now the single package providing both:
- 'mosaic' binary (CLI: yolo, coord, prdy, tui, gateway, etc.)
- 'mosaic-wizard' binary (installation wizard)
Changes:
- Move packages/cli/src/* into packages/mosaic/src/
- Convert dynamic @mosaic/mosaic imports to static relative imports
- Add CLI deps (ink, react, socket.io-client, @mosaic/config) to mosaic
- Add jsx: react-jsx to mosaic's tsconfig
- Exclude packages/cli from workspace (pnpm-workspace.yaml)
- Update install.sh to install @mosaic/mosaic instead of @mosaic/cli
- Bump version to 0.0.17
This eliminates the circular dependency between @mosaic/cli and
@mosaic/mosaic that was blocking the build graph.
git pull --rebase fails with 'cannot pull with rebase: You have
unstaged changes' when the skills repo has local modifications.
Fix: detect dirty index/worktree, stash before pull, restore after.
Also gracefully handle pull failures (warn and continue with existing
checkout) and stash pop conflicts.
Two bugs causing 'EACCES: permission denied, copyfile' when source
and target are the same path (e.g. wizard with sourceDir == mosaicHome):
1. No same-path guard — syncDirectory tried to copy every file onto
itself; git pack files are read-only (0444) so copyFileSync fails.
2. excludeGit only matched top-level .git — nested .git dirs like
sources/agent-skills/.git were copied, hitting the same permission
issue.
Fixes:
- Early return when resolve(source) === resolve(target)
- Match .git dirs at any depth via dirName and relPath checks
- Skip files inside .git/ paths
Added file-ops.test.ts with 4 tests covering all cases.
- mosaic-init bash script: detect existing SOUL.md/USER.md/TOOLS.md and
prompt user to keep, import (re-use values as defaults), or overwrite.
Non-interactive mode exits cleanly unless --force is passed.
Overwrite creates timestamped backups before replacing files.
- launch.ts checkSoul(): prefer 'mosaic wizard' over legacy bash script
when SOUL.md is missing, with fallback to mosaic-init.
- detect-install.ts: pre-populate wizard state with existing values when
user chooses 'reconfigure', so they see current settings as defaults.
- soul-setup.ts: show existing agent name and communication style as
defaults during reconfiguration.
- Added tests for reconfigure pre-population and reset non-population.
The #351 merge landed before the force-push with full commands.
This adds the missing subcommands:
- mosaic coord {init,status,mission,continue,run,smoke,resume}
→ delegates to tools/orchestrator/*.sh with --claude/--codex/--pi/--yolo
- mosaic prdy {init,update,validate,status}
→ delegates to tools/prdy/*.sh with --claude/--codex/--pi
- mosaic seq {check,fix,start}
→ sequential-thinking MCP management (native TS)
- mosaic upgrade {release,check,project}
→ delegates to tools/_scripts/mosaic-release-upgrade and mosaic-upgrade
Also removes duplicate prdy registration (was in both launch.ts and
the old registerPrdyCommand — now only in launch.ts).
Templates moved from packages/mosaic/templates/ to
packages/mosaic/framework/templates/ in #345. The test's
existsSync guard silently skipped the copy, causing writeSoul
to early-return without writing SOUL.md.