mirror of
https://github.com/runbear-io/beardrive.git
synced 2026-08-25 08:08:08 +02:00
rename: sfs -> BearDrive everywhere; CLI becomes bdrive
Product and project are BearDrive; the CLI binary is bdrive (bdrive mnt, bdrive sync, ...), the web viewer is bdrive-web. All conventions follow the full name: .beardrive settings file, .beardriveignore, ~/.beardrive home, BEARDRIVE_HOME, .beardrive-conflict-* / .beardrive-tmp-* files. Plugin/skill/marketplace renamed to beardrive (/beardrive:mount). Module path is now github.com/runbear-io/beardrive — merge only after renaming the GitHub repo, or go install breaks. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HHEUaYfFHhmDvqLYw74Ehz
This commit is contained in:
co-authored by
Claude Fable 5
parent
7f098b3ff5
commit
1ac128db2c
@@ -1,20 +1,20 @@
|
||||
// sfs-web serves a read-only website for a folder or an sfs remote: browse
|
||||
// bdrive-web serves a read-only website for a folder or a beardrive remote: browse
|
||||
// folders and files, read rendered markdown (Obsidian-style, including
|
||||
// [[wikilinks]]), and download any file.
|
||||
//
|
||||
// Two sources:
|
||||
//
|
||||
// - a local folder, served straight from disk (the default — on an sfs
|
||||
// - a local folder, served straight from disk (the default — on a beardrive
|
||||
// mount the daemon keeps it fresh, so this is the simplest deployment);
|
||||
// - an sfs remote, read directly from the object store with per-file
|
||||
// - a beardrive remote, read directly from the object store with per-file
|
||||
// provenance from the journals — no mount, daemon, or local state needed.
|
||||
//
|
||||
// Examples:
|
||||
//
|
||||
// sfs-web # serve the current directory
|
||||
// sfs-web ./notes # serve a folder
|
||||
// sfs-web s3://bucket/prefix # serve an sfs remote
|
||||
// sfs-web --remote gs://bucket/prefix --addr :8080
|
||||
// bdrive-web # serve the current directory
|
||||
// bdrive-web ./notes # serve a folder
|
||||
// bdrive-web s3://bucket/prefix # serve a beardrive remote
|
||||
// bdrive-web --remote gs://bucket/prefix --addr :8080
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -29,12 +29,12 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/runbear-io/sfs/internal/remote"
|
||||
"github.com/runbear-io/sfs/internal/webapp"
|
||||
"github.com/runbear-io/beardrive/internal/remote"
|
||||
"github.com/runbear-io/beardrive/internal/webapp"
|
||||
)
|
||||
|
||||
func main() {
|
||||
remoteURL := flag.String("remote", "", "sfs remote to serve (s3://bucket/prefix, gs://bucket/prefix, file:///path)")
|
||||
remoteURL := flag.String("remote", "", "bdrive remote to serve (s3://bucket/prefix, gs://bucket/prefix, file:///path)")
|
||||
dir := flag.String("dir", "", "local folder to serve (default: current directory)")
|
||||
addr := flag.String("addr", ":4173", "address to listen on")
|
||||
volume := flag.String("volume", "", "volume display name (default: folder or remote basename)")
|
||||
@@ -51,7 +51,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
if *remoteURL != "" && *dir != "" {
|
||||
fmt.Fprintln(os.Stderr, "usage: sfs-web [folder | remote-url] [--addr :4173] (--remote and --dir are mutually exclusive)")
|
||||
fmt.Fprintln(os.Stderr, "usage: bdrive-web [folder | remote-url] [--addr :4173] (--remote and --dir are mutually exclusive)")
|
||||
os.Exit(2)
|
||||
}
|
||||
if *remoteURL == "" && *dir == "" {
|
||||
@@ -97,7 +97,7 @@ func main() {
|
||||
if strings.HasPrefix(shown, ":") {
|
||||
shown = "localhost" + shown
|
||||
}
|
||||
fmt.Printf("sfs-web serving %s\n volume: %s\n url: http://%s\n", display, name, shown)
|
||||
fmt.Printf("bdrive-web serving %s\n volume: %s\n url: http://%s\n", display, name, shown)
|
||||
if err := http.ListenAndServe(*addr, srv.Handler()); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "error:", err)
|
||||
os.Exit(1)
|
||||
@@ -113,5 +113,5 @@ func volumeName(remoteURL string) string {
|
||||
return u.Host
|
||||
}
|
||||
}
|
||||
return "sfs"
|
||||
return "beardrive"
|
||||
}
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/runbear-io/sfs/internal/config"
|
||||
"github.com/runbear-io/sfs/internal/daemon"
|
||||
"github.com/runbear-io/sfs/internal/journal"
|
||||
"github.com/runbear-io/sfs/internal/syncer"
|
||||
"github.com/runbear-io/beardrive/internal/config"
|
||||
"github.com/runbear-io/beardrive/internal/daemon"
|
||||
"github.com/runbear-io/beardrive/internal/journal"
|
||||
"github.com/runbear-io/beardrive/internal/syncer"
|
||||
)
|
||||
|
||||
func syncCmd() *cobra.Command {
|
||||
@@ -56,12 +56,12 @@ func statusCmd() *cobra.Command {
|
||||
}
|
||||
mi, ok := mounts[folder]
|
||||
if !ok {
|
||||
return fmt.Errorf("%s is not an sfs mount", folder)
|
||||
return fmt.Errorf("%s is not a beardrive mount", folder)
|
||||
}
|
||||
mounts = map[string]config.MountInfo{folder: mi}
|
||||
}
|
||||
if len(mounts) == 0 {
|
||||
fmt.Println("no sfs mounts (create one with `sfs mnt <folder>`)")
|
||||
fmt.Println("no beardrive mounts (create one with `bdrive mnt <folder>`)")
|
||||
return nil
|
||||
}
|
||||
dev, err := config.LoadDevice()
|
||||
@@ -76,7 +76,7 @@ func statusCmd() *cobra.Command {
|
||||
}
|
||||
first = false
|
||||
if eff, _, found, err := config.EffectiveMount(folder); err == nil && found {
|
||||
mi = eff // .sfs project file wins over the registry
|
||||
mi = eff // .beardrive project file wins over the registry
|
||||
}
|
||||
fmt.Printf("%s\n", folder)
|
||||
fmt.Printf(" volume: %s\n", mi.Volume)
|
||||
@@ -228,7 +228,7 @@ func remoteCmd() *cobra.Command {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("remote of %s set to %s\n", folder, raw)
|
||||
fmt.Println("run `sfs sync` to sync now (a running daemon picks it up automatically)")
|
||||
fmt.Println("run `bdrive sync` to sync now (a running daemon picks it up automatically)")
|
||||
return nil
|
||||
},
|
||||
}
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/runbear-io/sfs/internal/config"
|
||||
"github.com/runbear-io/sfs/internal/remote"
|
||||
"github.com/runbear-io/sfs/internal/store"
|
||||
"github.com/runbear-io/sfs/internal/syncer"
|
||||
"github.com/runbear-io/beardrive/internal/config"
|
||||
"github.com/runbear-io/beardrive/internal/remote"
|
||||
"github.com/runbear-io/beardrive/internal/store"
|
||||
"github.com/runbear-io/beardrive/internal/syncer"
|
||||
)
|
||||
|
||||
func absFolder(args []string) (string, error) {
|
||||
@@ -20,8 +20,8 @@ func absFolder(args []string) (string, error) {
|
||||
return filepath.Abs(arg)
|
||||
}
|
||||
|
||||
// mustMount resolves a folder's settings: the .sfs project file wins over
|
||||
// the global registry, so a folder that carries its own .sfs works even
|
||||
// mustMount resolves a folder's settings: the .beardrive project file wins over
|
||||
// the global registry, so a folder that carries its own .beardrive works even
|
||||
// before it is registered on this device.
|
||||
func mustMount(folder string) (config.MountInfo, error) {
|
||||
mi, _, found, err := config.EffectiveMount(folder)
|
||||
@@ -29,7 +29,7 @@ func mustMount(folder string) (config.MountInfo, error) {
|
||||
return mi, err
|
||||
}
|
||||
if !found {
|
||||
return mi, fmt.Errorf("%s is not an sfs mount (run `sfs mnt %s` first)", folder, folder)
|
||||
return mi, fmt.Errorf("%s is not a beardrive mount (run `bdrive mnt %s` first)", folder, folder)
|
||||
}
|
||||
if mi.Volume == "" {
|
||||
mi.Volume = filepath.Base(folder)
|
||||
@@ -92,7 +92,7 @@ func printCycle(res *syncer.Result) {
|
||||
fmt.Printf(" local changes: %d\n", res.LocalOps)
|
||||
fmt.Printf(" pulled changes: %d\n", res.PulledOps)
|
||||
if res.Conflicts > 0 {
|
||||
fmt.Printf(" conflicts: %d (preserved as *.sfs-conflict-* files)\n", res.Conflicts)
|
||||
fmt.Printf(" conflicts: %d (preserved as *.beardrive-conflict-* files)\n", res.Conflicts)
|
||||
}
|
||||
fmt.Printf(" files updated: %d\n", res.Materialized)
|
||||
switch {
|
||||
@@ -1,4 +1,4 @@
|
||||
// sfs is a syncing file system for AI agents: mount a folder, and its
|
||||
// bdrive is the BearDrive CLI: mount a folder, and its
|
||||
// contents stay synchronized across devices through cloud object storage,
|
||||
// with full per-file change history and offline support.
|
||||
package main
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/runbear-io/sfs/internal/config"
|
||||
"github.com/runbear-io/beardrive/internal/config"
|
||||
)
|
||||
|
||||
// version is set at release time via -ldflags "-X main.version=...".
|
||||
@@ -17,12 +17,12 @@ var version = "0.1.0-dev"
|
||||
|
||||
func main() {
|
||||
root := &cobra.Command{
|
||||
Use: "sfs",
|
||||
Use: "bdrive",
|
||||
Short: "BearDrive: a synced file system for AI agents",
|
||||
Long: `sfs — the BearDrive CLI. A mountable, offline-first, synced file
|
||||
Long: `bdrive — the BearDrive CLI. A mountable, offline-first, synced file
|
||||
system for AI agents.
|
||||
|
||||
Mount any folder and sfs keeps it synchronized across your devices through
|
||||
Mount any folder and BearDrive keeps it synchronized across your devices through
|
||||
cloud object storage (Amazon S3, Google Cloud Storage, or a plain shared
|
||||
directory). Every change is journaled — you can always see which device and
|
||||
author changed which file, and when. Files are real files on disk, so
|
||||
@@ -48,9 +48,9 @@ everything keeps working offline; changes sync when the remote is reachable.`,
|
||||
func versionCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print the sfs version",
|
||||
Short: "Print the bdrive version",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("sfs", version)
|
||||
fmt.Println("beardrive", version)
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func whoamiCmd() *cobra.Command {
|
||||
fmt.Printf("device id: %s\n", dev.ID)
|
||||
fmt.Printf("device name: %s\n", dev.Name)
|
||||
fmt.Printf("author: %s\n", dev.Author)
|
||||
fmt.Printf("sfs home: %s\n", home)
|
||||
fmt.Printf("beardrive home: %s\n", home)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/runbear-io/sfs/internal/config"
|
||||
"github.com/runbear-io/sfs/internal/daemon"
|
||||
"github.com/runbear-io/sfs/internal/store"
|
||||
"github.com/runbear-io/beardrive/internal/config"
|
||||
"github.com/runbear-io/beardrive/internal/daemon"
|
||||
"github.com/runbear-io/beardrive/internal/store"
|
||||
)
|
||||
|
||||
func mntCmd() *cobra.Command {
|
||||
@@ -20,17 +20,17 @@ func mntCmd() *cobra.Command {
|
||||
c := &cobra.Command{
|
||||
Use: "mnt <folder>",
|
||||
Aliases: []string{"mount"},
|
||||
Short: "Mount a folder as a synced sfs volume",
|
||||
Long: `Mount a folder as a synced sfs volume.
|
||||
Short: "Mount a folder as a synced beardrive volume",
|
||||
Long: `Mount a folder as a synced beardrive volume.
|
||||
|
||||
Existing files in the folder are imported into the volume. If a remote is
|
||||
configured (--remote, or previously via "sfs remote set"), the volume syncs
|
||||
configured (--remote, or previously via "bdrive remote set"), the volume syncs
|
||||
with it and with every other device mounting the same remote. A background
|
||||
daemon keeps the folder in sync until "sfs umnt".`,
|
||||
Example: ` sfs mnt ./notes
|
||||
sfs mnt ./notes --remote s3://my-bucket/notes
|
||||
sfs mnt ./notes --remote gs://my-bucket/notes
|
||||
sfs mnt ./shared --remote file:///Volumes/nas/sfs/shared`,
|
||||
daemon keeps the folder in sync until "bdrive umnt".`,
|
||||
Example: ` bdrive mnt ./notes
|
||||
bdrive mnt ./notes --remote s3://my-bucket/notes
|
||||
bdrive mnt ./notes --remote gs://my-bucket/notes
|
||||
bdrive mnt ./shared --remote file:///Volumes/nas/beardrive/shared`,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
folder, err := absFolder(args)
|
||||
@@ -41,7 +41,7 @@ daemon keeps the folder in sync until "sfs umnt".`,
|
||||
return err
|
||||
}
|
||||
|
||||
// Settings resolution: flags win, then the folder's .sfs file,
|
||||
// Settings resolution: flags win, then the folder's .beardrive file,
|
||||
// then the global registry. The result is written back to both,
|
||||
// so the project file travels with the folder and the registry
|
||||
// knows which mounts are active on this device.
|
||||
@@ -112,10 +112,10 @@ daemon keeps the folder in sync until "sfs umnt".`,
|
||||
if mi.Remote != "" {
|
||||
fmt.Printf(" remote: %s\n", mi.Remote)
|
||||
} else {
|
||||
fmt.Printf(" remote: (none — local only; set one with `sfs remote set %s <url>`)\n", folder)
|
||||
fmt.Printf(" remote: (none — local only; set one with `bdrive remote set %s <url>`)\n", folder)
|
||||
}
|
||||
fmt.Printf(" device: %s (%s) as %s\n", dev.Name, dev.ID, dev.Author)
|
||||
fmt.Printf(" config: %s (volume/remote/include; add a .sfsignore next to it to exclude paths)\n",
|
||||
fmt.Printf(" config: %s (volume/remote/include; add a .beardriveignore next to it to exclude paths)\n",
|
||||
filepath.Join(folder, config.ProjectFile))
|
||||
printCycle(res)
|
||||
|
||||
@@ -145,10 +145,10 @@ func umntCmd() *cobra.Command {
|
||||
Aliases: []string{"umount", "unmount"},
|
||||
Short: "Stop syncing a mounted folder",
|
||||
Long: `Stop the sync daemon for a folder. Files stay on disk and the volume's
|
||||
history is kept; "sfs mnt" the folder again to resume syncing.
|
||||
history is kept; "bdrive mnt" the folder again to resume syncing.
|
||||
|
||||
With --forget the folder is also removed from the mount registry (local
|
||||
volume data under ~/.sfs/volumes is still kept).`,
|
||||
volume data under ~/.beardrive/volumes is still kept).`,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
folder, err := absFolder(args)
|
||||
@@ -181,7 +181,7 @@ volume data under ~/.sfs/volumes is still kept).`,
|
||||
if err := config.SaveMounts(mounts); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("forgot mount %s (volume %q kept under ~/.sfs/volumes)\n", folder, mi.Volume)
|
||||
fmt.Printf("forgot mount %s (volume %q kept under ~/.beardrive/volumes)\n", folder, mi.Volume)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
Reference in New Issue
Block a user