- Bump version across all components (CLI, plugin, MCP server) - Update CHANGELOG.md with comprehensive hash ID migration notes - Replace critical multi-clone warning with hash ID announcement - Add Hash-Based Issue IDs section to README with: - ID format explanation (4/5/6 char progressive scaling) - Why hash IDs solve collision issues - Birthday paradox collision probability math - Migration instructions - Update all examples to use hash IDs (bd-a1b2) instead of sequential (bd-1) Breaking changes: - Sequential ID generation removed (bd-c7af, bd-8e05, bd-4c74) - issue_counters table removed from schema - --resolve-collisions flag removed (no longer needed) Migration: Run 'bd migrate' to upgrade database schema Amp-Thread-ID: https://ampcode.com/threads/T-0b000145-350a-4dfe-a3f1-67d4d52a6717 Co-authored-by: Amp <amp@ampcode.com>
93 lines
2.2 KiB
Go
93 lines
2.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/steveyegge/beads"
|
|
"github.com/steveyegge/beads/internal/rpc"
|
|
)
|
|
|
|
var (
|
|
// Version is the current version of bd (overridden by ldflags at build time)
|
|
Version = "0.20.1"
|
|
// Build can be set via ldflags at compile time
|
|
Build = "dev"
|
|
)
|
|
|
|
var versionCmd = &cobra.Command{
|
|
Use: "version",
|
|
Short: "Print version information",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
checkDaemon, _ := cmd.Flags().GetBool("daemon")
|
|
|
|
if checkDaemon {
|
|
showDaemonVersion()
|
|
return
|
|
}
|
|
|
|
if jsonOutput {
|
|
outputJSON(map[string]string{
|
|
"version": Version,
|
|
"build": Build,
|
|
})
|
|
} else {
|
|
fmt.Printf("bd version %s (%s)\n", Version, Build)
|
|
}
|
|
},
|
|
}
|
|
|
|
func showDaemonVersion() {
|
|
// Connect to daemon (PersistentPreRun skips version command)
|
|
// We need to find the database path first to get the socket path
|
|
if dbPath == "" {
|
|
// Use public API to find database (same logic as PersistentPreRun)
|
|
if foundDB := beads.FindDatabasePath(); foundDB != "" {
|
|
dbPath = foundDB
|
|
}
|
|
}
|
|
|
|
socketPath := getSocketPath()
|
|
client, err := rpc.TryConnect(socketPath)
|
|
if err != nil || client == nil {
|
|
fmt.Fprintf(os.Stderr, "Error: daemon is not running\n")
|
|
fmt.Fprintf(os.Stderr, "Hint: start daemon with 'bd daemon'\n")
|
|
os.Exit(1)
|
|
}
|
|
defer func() { _ = client.Close() }()
|
|
|
|
health, err := client.Health()
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Error checking daemon health: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
if jsonOutput {
|
|
outputJSON(map[string]interface{}{
|
|
"daemon_version": health.Version,
|
|
"client_version": Version,
|
|
"compatible": health.Compatible,
|
|
"daemon_uptime": health.Uptime,
|
|
})
|
|
} else {
|
|
fmt.Printf("Daemon version: %s\n", health.Version)
|
|
fmt.Printf("Client version: %s\n", Version)
|
|
if health.Compatible {
|
|
fmt.Printf("Compatibility: ✓ compatible\n")
|
|
} else {
|
|
fmt.Printf("Compatibility: ✗ incompatible (restart daemon recommended)\n")
|
|
}
|
|
fmt.Printf("Daemon uptime: %.1f seconds\n", health.Uptime)
|
|
}
|
|
|
|
if !health.Compatible {
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
versionCmd.Flags().Bool("daemon", false, "Check daemon version and compatibility")
|
|
rootCmd.AddCommand(versionCmd)
|
|
}
|