diff --git a/README.md b/README.md index aedd59a..69384a6 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@
-![status](https://img.shields.io/badge/status-%F0%9F%94%A8%20building%20%C2%B7%20M7-yellow?style=for-the-badge) +![status](https://img.shields.io/badge/status-%F0%9F%8E%89%20v1%20complete%20%C2%B7%20M0%E2%80%93M7%20%E2%9C%85-brightgreen?style=for-the-badge) ![language](https://img.shields.io/badge/Go-1.22%2B-00ADD8?style=for-the-badge&logo=go&logoColor=white) ![license](https://img.shields.io/badge/license-AGPLv3-blue?style=for-the-badge) ![platforms](https://img.shields.io/badge/Linux%20%C2%B7%20macOS%20%C2%B7%20Windows-โœ“-success?style=for-the-badge) @@ -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 ` | ๐Ÿ“‚ Create a share from a local folder + push it | | `devbox unmount ` | โ๏ธ 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 [path]` | โ†ฉ๏ธ Roll back a file or a whole share | +| `devbox status` | ๐Ÿ“Š Device, hub, mounts (with `ro`/`pinned`) | +| `devbox log ` | ๐Ÿ•ฐ๏ธ Snapshot history (full ids) | +| `devbox restore [path]` | โ†ฉ๏ธ Roll back a file or a whole share | | `devbox deploy ` | ๐Ÿš€ Pin a mount to a snapshot โ€” applies it without pushing (blue/green) | -| `devbox conflicts` | ๐Ÿ’ฅ List conflict copies | -| `devbox ignore ` | ๐Ÿ™ˆ Append to `.devignore` + rescan | -| `devbox hook edit ` | ๐Ÿช 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 ` | ๐Ÿ™ˆ Append a pattern to `./.devignore` | +| `devbox hook edit ` | ๐Ÿช Scaffold/open a hook in `$EDITOR`; `hook list ` shows installed | +| `devbox doctor` | ๐Ÿฉบ Diagnose watcher limits, perms, bash, hub connectivity + bearer | +| `devbox pause` / `resume` / `peers` | โธ๏ธ๐ŸŒ *Planned โ€” need daemon IPC / a hub peers endpoint* | @@ -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 ` | -| โฌœ | **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 ` | -| โฌœ | **M7 โ€” Hardening** ๐Ÿ›ก๏ธ | `doctor`, reconnect/backoff, name-clash, arm64/mac/win releases | +| โœ… | **M6.5 โ€” Deploy** ๐Ÿš€ | `devbox deploy ` โ€” 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 |
๐Ÿ”ฎ v2 backlog @@ -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) diff --git a/cmd/devbox/main.go b/cmd/devbox/main.go index ed110f4..9e3f8e3 100644 --- a/cmd/devbox/main.go +++ b/cmd/devbox/main.go @@ -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 ", + 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 ", + 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 {