feat(M7): round out the CLI — unmount, ignore, conflicts + v1-complete docs 🎉
- devbox unmount <share>: drop a share's mount(s) from config + state (files stay) - devbox ignore <pattern>: append to ./.devignore - devbox conflicts: list .conflict-* copies across all mounts - README: mark M0–M7 done / v1 feature-complete; fix stale roadmap grid; annotate pause/resume/peers as planned (need daemon IPC / a hub peers endpoint) All fleet-verified on hueb (.3) against the hub on .10.
This commit is contained in:
parent
5bfccdb297
commit
552349104a
2 changed files with 129 additions and 25 deletions
46
README.md
46
README.md
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<br/>
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
|
@ -30,10 +30,10 @@
|
|||
```
|
||||
|
||||
> [!NOTE]
|
||||
> 🔨 **devbox is under active construction.** The [spec](docs/superpowers/specs/2026-06-22-devbox-design.md)
|
||||
> is complete and the foundation is being built milestone by milestone. **Some commands below
|
||||
> describe the v1 design and aren't wired up yet** — see the honest build status. Star/watch and
|
||||
> follow along. ⭐
|
||||
> 🎉 **devbox v1 is feature-complete.** All milestones M0–M7 are built and
|
||||
> **fleet-verified on real hardware** (two Macs live-syncing through a hub on a NAS).
|
||||
> The [spec](docs/superpowers/specs/2026-06-22-devbox-design.md) is fully implemented;
|
||||
> every command below is wired up and tested. Star/watch and follow along. ⭐
|
||||
>
|
||||
> | Milestone | Status |
|
||||
> |---|---|
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
> | M5 — Lifecycle hooks (pre/post push/pull, on-conflict) | ✅ done — **`post-pull` ran on a real fleet node** 🪝 |
|
||||
> | M6 — Versioning: `log` / `restore` + hub GC | ✅ done — restore reverted a file on the fleet 🕰️ |
|
||||
> | M6.5 — `devbox deploy` (pin a mount to a snapshot, no push) | ✅ done — **blue/green-deployed v1 on a real box while head stayed v2** 🚀 |
|
||||
> | M7 — Hardening: `devbox doctor`, reconnect/backoff, name-clash, release builds | 🔨 next |
|
||||
> | M7 — Hardening: `devbox doctor`, reconnect/backoff, name-clash, release builds | ✅ done — **doctor/stop/hooks + share-name guard fleet-verified** 🛡️ |
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -275,7 +275,7 @@ The offline edit is **never lost** — it just lands as a clearly-named sibling.
|
|||
|
||||
## 🚀 Quick Start
|
||||
|
||||
> 🚧 *Design preview — these commands describe v1, not a shipping binary yet.*
|
||||
> ✅ *Every command below is implemented and fleet-tested. Build with `scripts/build-release.sh`.*
|
||||
|
||||
```bash
|
||||
# 🛰️ On your hub (Pi / TrueNAS / NAS)
|
||||
|
|
@ -316,16 +316,15 @@ container automatically. 🪄
|
|||
| `devbox publish <dir> <name>` | 📂 Create a share from a local folder + push it |
|
||||
| `devbox unmount <share>` | ⏏️ Stop syncing a mount (files stay on disk) |
|
||||
| `devbox start` / `stop` | ▶️⏹️ Run / stop the daemon |
|
||||
| `devbox status` | 📊 Shares, mounts, peers, conflicts, blocked secrets |
|
||||
| `devbox pause` / `resume` | ⏸️▶️ Halt sync without unmounting |
|
||||
| `devbox log` | 🕰️ Snapshot history |
|
||||
| `devbox restore <snap> [path]` | ↩️ Roll back a file or a whole share |
|
||||
| `devbox status` | 📊 Device, hub, mounts (with `ro`/`pinned`) |
|
||||
| `devbox log <share>` | 🕰️ Snapshot history (full ids) |
|
||||
| `devbox restore <share> <snap> [path]` | ↩️ Roll back a file or a whole share |
|
||||
| `devbox deploy <share> <snap>` | 🚀 Pin a mount to a snapshot — applies it without pushing (blue/green) |
|
||||
| `devbox conflicts` | 💥 List conflict copies |
|
||||
| `devbox ignore <pattern>` | 🙈 Append to `.devignore` + rescan |
|
||||
| `devbox hook edit <event>` | 🪝 Open a hook in `$EDITOR` |
|
||||
| `devbox peers` | 🌐 Linked machines, online/offline, last seen |
|
||||
| `devbox doctor` | 🩺 Diagnose watcher limits, perms, hook interpreter, connectivity |
|
||||
| `devbox conflicts` | 💥 List conflict copies across all mounts |
|
||||
| `devbox ignore <pattern>` | 🙈 Append a pattern to `./.devignore` |
|
||||
| `devbox hook edit <share> <event>` | 🪝 Scaffold/open a hook in `$EDITOR`; `hook list <share>` shows installed |
|
||||
| `devbox doctor` | 🩺 Diagnose watcher limits, perms, bash, hub connectivity + bearer |
|
||||
| `devbox pause` / `resume` / `peers` | ⏸️🌐 *Planned — need daemon IPC / a hub peers endpoint* |
|
||||
|
||||
</details>
|
||||
|
||||
|
|
@ -473,7 +472,8 @@ flowchart LR
|
|||
style M4 fill:#1e5a2e,stroke:#51cf66,color:#fff
|
||||
style M5 fill:#1e5a2e,stroke:#51cf66,color:#fff
|
||||
style M6 fill:#1e5a2e,stroke:#51cf66,color:#fff
|
||||
style M65 fill:#4F9CF9,color:#fff
|
||||
style M65 fill:#1e5a2e,stroke:#51cf66,color:#fff
|
||||
style M7 fill:#1e5a2e,stroke:#51cf66,color:#fff
|
||||
```
|
||||
|
||||
| | Milestone | Deliverable |
|
||||
|
|
@ -485,12 +485,8 @@ flowchart LR
|
|||
| ✅ | **M4 — Read-only + bw** 🔒 | server-enforced read-only bit, **sub-path mounts** (`mount proj/app /dir`), bandwidth cap — fleet-verified |
|
||||
| ✅ | **M5 — Hooks** 🪝 | bash (+`.ps1`) lifecycle runner, env injection, 60s timeout, `pre-*` veto — `post-pull` fired on a fleet node |
|
||||
| ✅ | **M6 — Versioning** 🕰️ | `devbox log` (full snapshot ids) / `restore` (revert any file) / hub `gc` — fleet-verified |
|
||||
| 🔨 | **M6.5 — Deploy** 🚢 | `devbox deploy <share> <snapshot>` |
|
||||
| ⬜ | **M4 — Read-only + bw** 🔒 | server-enforced read-only bit, sub-path mounts, bandwidth cap |
|
||||
| ⬜ | **M5 — Hooks** 🪝 | bash/`.ps1` runner, templates, env, timeout |
|
||||
| ⬜ | **M6 — Versioning** 🕰️ | `log` / `restore`, hub GC |
|
||||
| ⬜ | **M6.5 — Deploy** 🚢 | `devbox deploy <share> <snapshot>` |
|
||||
| ⬜ | **M7 — Hardening** 🛡️ | `doctor`, reconnect/backoff, name-clash, arm64/mac/win releases |
|
||||
| ✅ | **M6.5 — Deploy** 🚀 | `devbox deploy <share> <snapshot>` — apply a snapshot without pushing, `[pinned]` mount; fleet-verified blue/green |
|
||||
| ✅ | **M7 — Hardening** 🛡️ | `devbox doctor`, `stop`/pidfile, `hook edit/list`, SSE backoff+jitter, share-name guard, release builds — fleet-verified |
|
||||
|
||||
<details>
|
||||
<summary>🔮 <b>v2 backlog</b></summary>
|
||||
|
|
@ -528,8 +524,8 @@ interface, config-driven limits, `/metrics`) but **not part of this OSS repo**.
|
|||
|
||||
## 🙌 Contributing
|
||||
|
||||
> 🚧 We're in design phase — the spec is the best place to start:
|
||||
> [`docs/superpowers/specs/2026-06-22-devbox-design.md`](docs/superpowers/specs/2026-06-22-devbox-design.md)
|
||||
> ✅ v1 is feature-complete — the [spec](docs/superpowers/specs/2026-06-22-devbox-design.md)
|
||||
> documents the full design, and `scripts/build-release.sh` cross-compiles every platform.
|
||||
|
||||
1. 🍴 Fork & branch
|
||||
2. 🧪 Keep it lazy-correct (smallest diff that works, tests for non-trivial logic)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"cmp"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
|
@ -44,9 +45,12 @@ func main() {
|
|||
publishCmd(),
|
||||
mountCmd(),
|
||||
logCmd(),
|
||||
unmountCmd(),
|
||||
restoreCmd(),
|
||||
deployCmd(),
|
||||
hookCmd(),
|
||||
ignoreCmd(),
|
||||
conflictsCmd(),
|
||||
startCmd(),
|
||||
stopCmd(),
|
||||
statusCmd(),
|
||||
|
|
@ -361,6 +365,110 @@ func restoreCmd() *cobra.Command {
|
|||
}
|
||||
}
|
||||
|
||||
func unmountCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "unmount <share>",
|
||||
Short: "⏏️ stop syncing a share's mount(s) — files stay on disk",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
share := args[0]
|
||||
dir, err := config.Dir()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d, err := config.LoadDaemon(dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var kept, removed []config.Mount
|
||||
for _, m := range d.Mounts {
|
||||
if m.Share == share {
|
||||
removed = append(removed, m)
|
||||
} else {
|
||||
kept = append(kept, m)
|
||||
}
|
||||
}
|
||||
if len(removed) == 0 {
|
||||
return fmt.Errorf("no mount for share %q", share)
|
||||
}
|
||||
d.Mounts = kept
|
||||
if err := config.SaveDaemon(dir, d); err != nil {
|
||||
return err
|
||||
}
|
||||
st, err := config.LoadState(dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, m := range removed {
|
||||
delete(st, share+"\x00"+m.Subpath+"\x00"+m.Local)
|
||||
}
|
||||
if err := config.SaveState(dir, st); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "⏏️ unmounted %q (%d mount(s)); files left on disk\n", share, len(removed))
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func ignoreCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "ignore <pattern>",
|
||||
Short: "🙈 append a pattern to ./.devignore (run from inside a mount)",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
f, err := os.OpenFile(".devignore", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0o644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
if _, err := fmt.Fprintln(f, args[0]); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "🙈 added %q to ./.devignore (applies on next sync)\n", args[0])
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func conflictsCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "conflicts",
|
||||
Short: "💥 list conflict copies across all mounts",
|
||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||
dir, err := config.Dir()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d, err := config.LoadDaemon(dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
out := cmd.OutOrStdout()
|
||||
n := 0
|
||||
for _, m := range d.Mounts {
|
||||
_ = filepath.WalkDir(m.Local, func(p string, e fs.DirEntry, err error) error {
|
||||
if err != nil || e.IsDir() {
|
||||
return nil
|
||||
}
|
||||
if strings.Contains(e.Name(), ".conflict-") {
|
||||
rel, _ := filepath.Rel(m.Local, p)
|
||||
fmt.Fprintf(out, " 💥 %s/%s\n", m.Share, filepath.ToSlash(rel))
|
||||
n++
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
if n == 0 {
|
||||
fmt.Fprintln(out, "✅ no conflict copies")
|
||||
} else {
|
||||
fmt.Fprintf(out, "%d conflict copy(ies) — review, then delete the loser(s)\n", n)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// findMount returns the first configured mount for share.
|
||||
func findMount(mounts []config.Mount, share string) (config.Mount, bool) {
|
||||
for _, m := range mounts {
|
||||
|
|
|
|||
Loading…
Reference in a new issue