mirror of
https://github.com/runbear-io/beardrive.git
synced 2026-08-25 08:08:08 +02:00
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>
88 lines
2.8 KiB
Go
88 lines
2.8 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/runbear-io/beardrive/internal/agentskills"
|
|
)
|
|
|
|
// bdrive skill — install the `beardrive` skill into whatever agent platforms
|
|
// the user works with (Claude Code, Codex, Gemini CLI, Hermes), so the agent
|
|
// can do the setup itself: sign in, `bdrive init`, and — the part people miss
|
|
// when they copy commands by hand — `bdrive hooks install`.
|
|
func skillCmd() *cobra.Command {
|
|
c := &cobra.Command{
|
|
Use: "skill",
|
|
Short: "Show which AI agent platforms have the beardrive skill installed",
|
|
Args: cobra.NoArgs,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
folder, err := absFolder(nil)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
detected := map[string]bool{}
|
|
for _, a := range agentskills.Detect(folder) {
|
|
detected[a] = true
|
|
}
|
|
for _, a := range agentskills.Agents {
|
|
state := "not detected"
|
|
if detected[a] {
|
|
state = "detected, skill not installed"
|
|
if agentskills.Installed(a) {
|
|
state = "skill installed"
|
|
}
|
|
}
|
|
fmt.Printf(" %-8s %-32s %s\n", a, state, agentskills.Path(a))
|
|
}
|
|
fmt.Println("\ninstall with: bdrive skill install [--agent claude,codex,gemini,hermes]")
|
|
return nil
|
|
},
|
|
}
|
|
|
|
var agentsFlag string
|
|
install := &cobra.Command{
|
|
Use: "install [folder]",
|
|
Short: "Install the beardrive skill for detected agent platforms (or --agent list)",
|
|
Long: "Writes the beardrive skill to each agent's user-level skills directory\n" +
|
|
"(~/.codex/skills/beardrive/SKILL.md and friends), so the agent knows the\n" +
|
|
"CLI everywhere — ask it to set up a folder and it runs login, init, and\n" +
|
|
"`bdrive hooks install` for you. Re-running refreshes the copy shipped\n" +
|
|
"with this binary.",
|
|
Args: cobra.MaximumNArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
folder, err := absFolder(args)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
var agents []string
|
|
if agentsFlag != "" && agentsFlag != "auto" {
|
|
agents = strings.Split(agentsFlag, ",")
|
|
}
|
|
results, err := agentskills.Install(folder, agents)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if len(results) == 0 {
|
|
fmt.Println("no agent platforms detected (looked for .claude/, .codex/, .gemini/, .hermes/ here or in ~)")
|
|
fmt.Println("pick explicitly: bdrive skill install --agent claude,codex,gemini,hermes")
|
|
return nil
|
|
}
|
|
for _, r := range results {
|
|
state := "already current"
|
|
if r.Changed {
|
|
state = "installed"
|
|
}
|
|
fmt.Printf(" %-8s %s → %s\n", r.Agent, state, r.Path)
|
|
}
|
|
fmt.Println("\nnow ask your agent to set up the folder — it will run init and register sync hooks")
|
|
return nil
|
|
},
|
|
}
|
|
install.Flags().StringVar(&agentsFlag, "agent", "auto", "comma-separated platforms (claude,codex,gemini,hermes) or auto")
|
|
c.AddCommand(install)
|
|
return c
|
|
}
|