Files
beardrive/cmd/bdrive/main.go
T
Snow LeeandClaude Opus 4.8 5c6099177b feat: bdrive skill install + one-paste Codex/Hermes setup guide
The hub's install guide told Codex and Hermes users to run four CLI
commands by hand, and the one people skipped — `bdrive hooks install` —
is exactly the one that makes files sync at turn boundaries. Hand the
setup to the agent instead, the way the Claude tab hands it to the
plugin.

- `bdrive skill install` (internal/agentskills, plugin/embed.go): the
  binary now carries the beardrive skill and writes it to any agent that
  reads SKILL.md — ~/.{claude,codex,gemini,hermes}/skills/beardrive/.
  User-level on purpose: the skill is about the CLI, not one folder, and
  a synced project folder should never carry it. Idempotent; refreshes a
  stale copy after a CLI upgrade. Bare `bdrive skill` prints the table,
  mirroring `bdrive hooks`.
- Guide's Codex/Hermes tabs are now a single paste, no terminal: the
  prompt has the agent install the CLI, keep the skill, sign in, init,
  and register hooks. The commands ride inside the prompt because these
  agents ship no BearDrive knowledge (Claude's tab is terse only because
  the plugin carries it). `login --device` there — a browser-callback
  sign-in is invisible to an agent mid-turn, while the device flow gives
  it a code and URL to relay. Plain commands live on in an "or run it
  yourself" fallback.
- Docs realigned: README, SKILL.md, /beardrive:install, self-hosting.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 14:30:06 -07:00

86 lines
2.0 KiB
Go

// 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
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/runbear-io/beardrive/internal/config"
)
// version is set at release time via -ldflags "-X main.version=...".
var version = "0.1.0-dev"
func main() {
root := &cobra.Command{
Use: "bdrive",
Short: "BearDrive: a synced file system for AI agents",
Long: `bdrive — the BearDrive CLI. A mountable, offline-first, synced file
system for AI agents.
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
everything keeps working offline; changes sync when the remote is reachable.`,
SilenceUsage: true,
}
root.AddCommand(
loginCmd(),
logoutCmd(),
initCmd(),
shareCmd(),
urlCmd(),
stopCmd(),
syncCmd(),
readLogCmd(),
hooksCmd(),
skillCmd(),
statusCmd(),
logCmd(),
webCmd(),
whoamiCmd(),
daemonCmd(),
versionCmd(),
)
if err := root.Execute(); err != nil {
os.Exit(1)
}
}
func versionCmd() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Print the bdrive version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("beardrive", version)
},
}
}
func whoamiCmd() *cobra.Command {
return &cobra.Command{
Use: "whoami",
Short: "Show this device's identity used in change tracking",
RunE: func(cmd *cobra.Command, args []string) error {
dev, err := config.LoadDevice()
if err != nil {
return err
}
home, err := config.Home()
if err != nil {
return err
}
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("beardrive home: %s\n", home)
return nil
},
}
}