Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

Add Beacon infinity banner

Cursor Agent42d7ae1bdb5a
diff --git a/cli/beacon/cmd/root.go b/cli/beacon/cmd/root.go
index 28396d6d..0a958523 100644
--- a/cli/beacon/cmd/root.go
+++ b/cli/beacon/cmd/root.go
@@ -18,13 +18,7 @@ local telemetry, and writes Wazuh-compatible JSON logs without requiring an
Beacon-hosted backend.`,
Version: version.GetVersion(),
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("Beacon Endpoint Agent")
- fmt.Println()
- fmt.Println("Start with:")
- fmt.Println(" beacon endpoint install")
- fmt.Println(" beacon endpoint status")
- fmt.Println(" beacon endpoint wazuh print-config")
- fmt.Println()
+ printBeaconIntro(cmd)
cmd.Usage()
},
}
diff --git a/cli/beacon/cmd/root_banner.go b/cli/beacon/cmd/root_banner.go
new file mode 100644
index 00000000..c96d5c4a
--- /dev/null
+++ b/cli/beacon/cmd/root_banner.go
@@ -0,0 +1,81 @@
+package cmd
+
+import (
+ "fmt"
+ "io"
+ "os"
+ "path/filepath"
+ "strings"
+ "time"
+
+ "github.com/spf13/cobra"
+
+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/version"
+)
+
+const beaconIntroDelay = 45 * time.Millisecond
+
+var sleepBeaconIntro = time.Sleep
+
+func printBeaconIntro(cmd *cobra.Command) {
+ out := cmd.OutOrStdout()
+ lines := beaconIntroLines()
+ if shouldAnimateBeaconIntro(out) {
+ for _, line := range lines {
+ fmt.Fprintln(out, line)
+ sleepBeaconIntro(beaconIntroDelay)
+ }
+ } else {
+ for _, line := range lines {
+ fmt.Fprintln(out, line)
+ }
+ }
+ fmt.Fprintln(out)
+ fmt.Fprintln(out, "Start with:")
+ fmt.Fprintln(out, " beacon endpoint install")
+ fmt.Fprintln(out, " beacon endpoint status")
+ fmt.Fprintln(out, " beacon endpoint wazuh print-config")
+ fmt.Fprintln(out)
+}
+
+func beaconIntroLines() []string {
+ return []string{
+ fmt.Sprintf(" ∞∞∞ ∞∞∞ Beacon CLI %s", version.GetVersion()),
+ " ∞∞ ∞∞ ∞∞ ∞∞ Local AI runtime telemetry",
+ " ∞∞ ∞ ∞∞ Endpoint visibility for agentic tools",
+ fmt.Sprintf(" ∞∞ ∞∞ ∞∞ ∞∞ %s", compactWorkingDir()),
+ " ∞∞∞ ∞∞∞",
+ }
+}
+
+func compactWorkingDir() string {
+ wd, err := os.Getwd()
+ if err != nil || wd == "" {
+ return "beacon endpoint"
+ }
+ home, err := os.UserHomeDir()
+ if err == nil && home != "" {
+ if rel, err := filepath.Rel(home, wd); err == nil && rel != "." && !strings.HasPrefix(rel, "..") {
+ return filepath.Join("~", rel)
+ }
+ if wd == home {
+ return "~"
+ }
+ }
+ return wd
+}
+
+func shouldAnimateBeaconIntro(out io.Writer) bool {
+ if os.Getenv("BEACON_NO_ANIMATION") != "" || os.Getenv("CI") != "" || os.Getenv("TERM") == "dumb" {
+ return false
+ }
+ file, ok := out.(*os.File)
+ if !ok {
+ return false
+ }
+ info, err := file.Stat()
+ if err != nil {
+ return false
+ }
+ return info.Mode()&os.ModeCharDevice != 0
+}
diff --git a/cli/beacon/cmd/root_banner_test.go b/cli/beacon/cmd/root_banner_test.go
new file mode 100644
index 00000000..2282efd5
--- /dev/null
+++ b/cli/beacon/cmd/root_banner_test.go
@@ -0,0 +1,51 @@
+package cmd
+
+import (
+ "bytes"
+ "strings"
+ "testing"
+
+ "github.com/spf13/cobra"
+)
+
+func TestBeaconIntroLinesUseInfinityMark(t *testing.T) {
+ lines := beaconIntroLines()
+ if len(lines) == 0 {
+ t.Fatal("beaconIntroLines returned no lines")
+ }
+ got := strings.Join(lines, "\n")
+ if !strings.Contains(got, "∞") {
+ t.Fatalf("beaconIntroLines() = %q, want infinity mark", got)
+ }
+ if !strings.Contains(got, "Beacon CLI") {
+ t.Fatalf("beaconIntroLines() = %q, want Beacon CLI label", got)
+ }
+}
+
+func TestPrintBeaconIntroIncludesStartingCommands(t *testing.T) {
+ var out bytes.Buffer
+ cmd := &cobra.Command{}
+ cmd.SetOut(&out)
+
+ printBeaconIntro(cmd)
+
+ got := out.String()
+ for _, want := range []string{
+ "∞",
+ "Beacon CLI",
+ "beacon endpoint install",
+ "beacon endpoint status",
+ "beacon endpoint wazuh print-config",
+ } {
+ if !strings.Contains(got, want) {
+ t.Fatalf("printBeaconIntro output missing %q:\n%s", want, got)
+ }
+ }
+}
+
+func TestShouldAnimateBeaconIntroFalseForNonFileWriter(t *testing.T) {
+ var out bytes.Buffer
+ if shouldAnimateBeaconIntro(&out) {
+ t.Fatal("shouldAnimateBeaconIntro returned true for non-file writer")
+ }
+}