Skip to content

Commit c855ac1

Browse files
docs: update README and AGENTS.md for clean command and snapshot restore
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent 4a2f388 commit c855ac1

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

AGENTS.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@ openboot/
1616
├── cmd/openboot/ # main.go → cli.Execute()
1717
├── internal/
1818
│ ├── auth/ # OAuth-like login, token in ~/.openboot/auth.json (0600)
19-
│ ├── brew/ # Homebrew ops, parallel install (4 workers), retry logic
20-
│ ├── cli/ # Cobra commands: root, snapshot, doctor, update, version
19+
│ ├── brew/ # Homebrew ops, parallel install (4 workers), retry logic, uninstall
20+
│ ├── cleaner/ # Diff current system vs desired state, remove extra packages
21+
│ ├── cli/ # Cobra commands: root, snapshot, doctor, clean, update, version
2122
│ ├── config/ # Embedded YAML (packages + presets), remote config fetch
2223
│ │ └── data/ # packages.yaml (9 categories), presets.yaml (3 presets)
2324
│ ├── dotfiles/ # Clone + stow/symlink with .openboot.bak backup
24-
│ ├── installer/ # Main orchestrator: 7-step wizard (693 lines)
25+
│ ├── installer/ # Main orchestrator: 7-step wizard + snapshot restore (git/shell/packages)
2526
│ ├── macos/ # `defaults write` preferences, app restart
26-
│ ├── npm/ # Batch install with sequential fallback
27+
│ ├── npm/ # Batch install with sequential fallback, uninstall
2728
│ ├── search/ # Online search via openboot.dev API (8s timeout)
28-
│ ├── shell/ # Oh-My-Zsh install, .zshrc config
29+
│ ├── shell/ # Oh-My-Zsh install, .zshrc config, snapshot restore (theme/plugins)
2930
│ ├── snapshot/ # Capture/match/restore environment state (see subdir AGENTS.md)
3031
│ ├── system/ # RunCommand/RunCommandSilent, arch detection, git config
3132
│ ├── ui/ # TUI components (see subdir AGENTS.md)
@@ -45,9 +46,11 @@ openboot/
4546
| Add CLI command | `internal/cli/` | Register in root.go init(), follow cobra pattern |
4647
| Add package category | `internal/config/data/packages.yaml` | Rebuild after changing embedded YAML |
4748
| Change install flow | `internal/installer/installer.go` | 7 steps: homebrew → git → preset → packages → shell → macos → dotfiles |
49+
| Change clean/uninstall | `internal/cleaner/cleaner.go` | Diffs current vs desired, calls brew/npm Uninstall |
4850
| Add TUI component | `internal/ui/` | Use bubbletea Model pattern, lipgloss styling |
49-
| Change brew behavior | `internal/brew/brew.go` | Parallel workers, StickyProgress for output |
51+
| Change brew behavior | `internal/brew/brew.go` | Parallel workers, StickyProgress for output, Uninstall/UninstallCask |
5052
| Add snapshot data | `internal/snapshot/capture.go` | Add to CaptureWithProgress steps |
53+
| Change snapshot restore | `internal/installer/installer.go` | stepRestoreGit, stepRestoreShell + packages/shell/macos |
5154
| Update self-update | `internal/updater/updater.go` | AutoUpgrade() called from root.go RunE |
5255
| Modify presets | `internal/config/data/presets.yaml` | 3 presets: minimal, developer, full |
5356

@@ -64,6 +67,7 @@ cli (root)
6467
│ ├── shell (no deps)
6568
│ ├── system (no deps)
6669
│ └── ui → config, search, snapshot, system
70+
├── cleaner → brew, npm, snapshot, ui
6771
├── updater → ui
6872
├── auth → ui
6973
└── snapshot → config, macos

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ curl -fsSL openboot.dev/install.sh | bash
4545
- **macOS preferences** — Developer-friendly defaults (Dock, Finder, keyboard)
4646
- **Git identity** — Configure name and email during setup
4747
- **Smart installs** — Detects already-installed tools, skips them
48+
- **Clean up** — Remove packages not in your config with `openboot clean`
49+
- **Full snapshot restore** — Restores packages, git config, shell theme & plugins
4850

4951
## Web Dashboard
5052

@@ -75,7 +77,20 @@ Already set up? Capture your environment and share it.
7577
openboot snapshot
7678
```
7779

78-
Captures Homebrew packages, macOS preferences, shell config, and git settings. Upload to [openboot.dev](https://openboot.dev) for a shareable install URL, or save locally with `--local`. [Learn more →](https://openboot.dev/docs/snapshot)
80+
Captures Homebrew packages, macOS preferences, shell config (Oh-My-Zsh theme & plugins), and git settings. Upload to [openboot.dev](https://openboot.dev) for a shareable install URL, or save locally with `--local`.
81+
82+
Restoring from a snapshot now fully restores your environment — packages, git identity, shell theme, and plugins. [Learn more →](https://openboot.dev/docs/snapshot)
83+
84+
### Clean
85+
86+
Drifted from your config? Remove extra packages.
87+
88+
```bash
89+
openboot clean # Compare against local snapshot
90+
openboot clean --user yourname # Compare against cloud config
91+
openboot clean --from my-setup.json # Compare against a snapshot file
92+
openboot clean --dry-run # Preview what would be removed
93+
```
7994

8095
## For Teams
8196

@@ -128,6 +143,7 @@ curl -fsSL openboot.dev/install.sh | bash -s -- --preset developer --silent
128143
```bash
129144
openboot # Interactive setup
130145
openboot snapshot # Capture your current setup
146+
openboot clean # Remove packages not in your config
131147
openboot doctor # Check system health
132148
openboot update # Update Homebrew and packages
133149
openboot update --dry-run # Preview updates

internal/snapshot/AGENTS.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,21 @@ Each step is independent. Failures are non-fatal (captured as empty).
5252
}
5353
```
5454

55+
## RESTORE PIPELINE
56+
57+
`snapshot --import` restores:
58+
1. Taps → `brew tap`
59+
2. Formulae/Casks → `brew install` (via installer.RunFromSnapshot)
60+
3. NPM packages → `npm install -g`
61+
4. Git config → `git config --global user.name/email` (skips if already set)
62+
5. Shell → Installs Oh-My-Zsh, sets ZSH_THEME and plugins in .zshrc
63+
6. macOS preferences → `defaults write`
64+
65+
Snapshot data is mapped to `config.SnapshotGitConfig` and `config.SnapshotShellConfig` in `cli/snapshot.go`, then consumed by `installer.stepRestoreGit` and `installer.stepRestoreShell`.
66+
5567
## WHEN MODIFYING
5668

5769
- Adding capture step: Add to `CaptureWithProgress()`, update `totalSteps`, add to `Snapshot` struct
70+
- Adding restore step: Add to `installer.RunFromSnapshot()`, create `config.Snapshot*Config` type, wire in `cli/snapshot.go`
5871
- Adding preset detection: Modify `DetectBestPreset()` scoring in `match.go`
5972
- Tests: Table-driven with testify. `capture_test.go` mocks command output. `match_test.go` tests Jaccard scoring.

0 commit comments

Comments
 (0)