Skip to content

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

feat(endpoint): discover Cline and inventory its managed plugin

Clauded7b0a2c4115b
diff --git a/cli/beacon/internal/endpoint/harness/harness.go b/cli/beacon/internal/endpoint/harness/harness.go
index 51566b28..2da72cd7 100644
--- a/cli/beacon/internal/endpoint/harness/harness.go
+++ b/cli/beacon/internal/endpoint/harness/harness.go
@@ -55,6 +55,7 @@ func DiscoverAll() []Harness {
DiscoverAntigravity(),
DiscoverCopilotCLI(),
DiscoverOpenCode(),
+ DiscoverCline(),
DiscoverPi(),
DiscoverHermes(),
DiscoverFactory(),
@@ -174,6 +175,38 @@ func DiscoverOpenCode() Harness {
return h
}
+// DiscoverCline reports whether Cline is present and whether Beacon's plugin is installed for it.
+//
+// Unlike every other hook runtime, Cline cannot be found by looking for an executable. It runs as a
+// VS Code extension, a JetBrains plugin, and a CLI over one agent core, and the two IDE hosts ship
+// no `cline` binary at all -- so a binary probe reports "not detected" on the majority of real
+// installs. The ~/.cline directory is what every host shares, and the CLI binary is treated as an
+// extra signal rather than the deciding one.
+func DiscoverCline() Harness {
+ h := Harness{Name: "cline", DisplayName: "Cline", Capability: "plugin"}
+ detectExecutable(&h, "cline")
+ home, _ := os.UserHomeDir()
+ pluginPath := filepath.Join(home, ".cline", "plugins", "beacon.ts")
+ h.ConfigPath = pluginPath
+ if !h.Detected && dirExists(filepath.Join(home, ".cline")) {
+ h.Detected = true
+ }
+ if fileExists(pluginPath) {
+ data, _ := os.ReadFile(pluginPath)
+ if strings.Contains(string(data), "beacon-managed-cline-plugin:v1") {
+ h.TelemetryStatus = TelemetryEnabled
+ h.Message = "Beacon Cline plugin is configured"
+ } else {
+ h.TelemetryStatus = TelemetryDisabled
+ h.Message = "Cline plugin file exists but Beacon endpoint plugin was not found"
+ }
+ } else {
+ h.TelemetryStatus = TelemetryMissing
+ h.Message = "Beacon Cline plugin was not found"
+ }
+ return h
+}
+
func DiscoverHermes() Harness {
h := Harness{Name: "hermes", DisplayName: "Hermes Agent", Capability: "hooks"}
detectExecutable(&h, "hermes")
diff --git a/cli/beacon/internal/endpoint/harness/harness_test.go b/cli/beacon/internal/endpoint/harness/harness_test.go
index 04b1a9eb..28ea00df 100644
--- a/cli/beacon/internal/endpoint/harness/harness_test.go
+++ b/cli/beacon/internal/endpoint/harness/harness_test.go
@@ -765,3 +765,81 @@ func clearCopilotEnv(t *testing.T) {
t.Setenv(key, "")
}
}
+
+// Cline is the one hook runtime that cannot be found by looking for an executable: it runs as a VS
+// Code extension, a JetBrains plugin and a CLI over one agent core, and the two IDE hosts ship no
+// `cline` binary. Detecting on the directory alone is deliberate here, and the opposite of what
+// DiscoverCodex and DiscoverGemini do -- a binary probe would report "not detected" on the majority
+// of real Cline installs.
+func TestDiscoverClineDetectsConfigDirectoryWithoutAnExecutable(t *testing.T) {
+ home := t.TempDir()
+ testenv.SetHome(t, home)
+ t.Setenv("PATH", t.TempDir())
+ if err := os.MkdirAll(filepath.Join(home, ".cline"), 0755); err != nil {
+ t.Fatalf("mkdir cline config dir: %v", err)
+ }
+
+ h := DiscoverCline()
+ if !h.Detected {
+ t.Fatalf("DiscoverCline did not detect Cline from its config directory: %#v", h)
+ }
+ if h.ExecutablePath != "" {
+ t.Fatalf("ExecutablePath = %q, want empty with no binary on PATH", h.ExecutablePath)
+ }
+ if h.TelemetryStatus != TelemetryMissing {
+ t.Fatalf("TelemetryStatus = %q, want %q", h.TelemetryStatus, TelemetryMissing)
+ }
+ if h.ConfigPath != filepath.Join(home, ".cline", "plugins", "beacon.ts") {
+ t.Fatalf("ConfigPath = %q, want the managed plugin path", h.ConfigPath)
+ }
+}
+
+func TestDiscoverClineTelemetryStatusVariants(t *testing.T) {
+ cases := []struct {
+ name string
+ plugin string
+ want TelemetryStatus
+ message string
+ }{
+ {name: "managed plugin", plugin: "// beacon-managed-cline-plugin:v1\nexport default {}", want: TelemetryEnabled, message: "configured"},
+ // Someone else's plugin at Beacon's path. Reporting that as enabled would claim telemetry
+ // Beacon is not collecting.
+ {name: "unmanaged plugin", plugin: "export default { name: \"someone-else\" }", want: TelemetryDisabled, message: "was not found"},
+ }
+ for _, tc := range cases {
+ t.Run(tc.name, func(t *testing.T) {
+ home := t.TempDir()
+ testenv.SetHome(t, home)
+ t.Setenv("PATH", t.TempDir())
+ pluginPath := filepath.Join(home, ".cline", "plugins", "beacon.ts")
+ if err := os.MkdirAll(filepath.Dir(pluginPath), 0755); err != nil {
+ t.Fatalf("mkdir cline plugin dir: %v", err)
+ }
+ if err := os.WriteFile(pluginPath, []byte(tc.plugin), 0644); err != nil {
+ t.Fatalf("write cline plugin: %v", err)
+ }
+
+ h := DiscoverCline()
+ if h.TelemetryStatus != tc.want {
+ t.Fatalf("TelemetryStatus = %q, want %q", h.TelemetryStatus, tc.want)
+ }
+ if !strings.Contains(h.Message, tc.message) {
+ t.Fatalf("Message = %q, want it to mention %q", h.Message, tc.message)
+ }
+ })
+ }
+}
+
+// A runtime missing from DiscoverAll is invisible to `beacon endpoint discover`, which is where an
+// operator looks to find out whether Beacon can see their agent at all.
+func TestDiscoverAllIncludesCline(t *testing.T) {
+ for _, h := range DiscoverAll() {
+ if h.Name == "cline" {
+ if h.DisplayName != "Cline" || h.Capability != "plugin" {
+ t.Fatalf("cline harness = %#v, want display name Cline and capability plugin", h)
+ }
+ return
+ }
+ }
+ t.Fatal("DiscoverAll does not include cline")
+}
diff --git a/cli/beacon/internal/endpoint/inventory/inventory.go b/cli/beacon/internal/endpoint/inventory/inventory.go
index 0a6e7243..de6da3b2 100644
--- a/cli/beacon/internal/endpoint/inventory/inventory.go
+++ b/cli/beacon/internal/endpoint/inventory/inventory.go
@@ -201,6 +201,7 @@ func candidates(home, wd string) []candidate {
items = append(items, factoryCandidates(home, wd)...)
items = append(items, copilotCandidates(home)...)
items = append(items, opencodeCandidates(home, wd)...)
+ items = append(items, clineCandidates(home, wd)...)
items = append(items, hermesCandidates(home)...)
items = append(items, devinCandidates(home, wd)...)
items = append(items, grokCandidates(home, wd)...)
@@ -283,6 +284,13 @@ func opencodeCandidates(home, wd string) []candidate {
}
}
+func clineCandidates(home, wd string) []candidate {
+ return []candidate{
+ {runtime: "cline", path: filepath.Join(home, ".cline", "plugins", "beacon.ts"), scope: ScopeUser, format: formatMetadataOnly, kind: KindPlugin},
+ {runtime: "cline", path: filepath.Join(wd, ".cline", "plugins", "beacon.ts"), scope: ScopeProject, format: formatMetadataOnly, kind: KindPlugin},
+ }
+}
+
func hermesCandidates(home string) []candidate {
return []candidate{{runtime: "hermes", path: filepath.Join(home, ".hermes", "config.yaml"), scope: ScopeUser, format: formatYAML, kind: KindNativeConfig}}
}
@@ -612,6 +620,8 @@ func beaconManaged(item candidate, data []byte) bool {
}
case "opencode":
return strings.Contains(text, "beacon-managed-opencode-plugin:v1")
+ case "cline":
+ return strings.Contains(text, "beacon-managed-cline-plugin:v1")
case "grok":
return strings.Contains(text, "beacon-managed-grok-hooks:v1")
}
diff --git a/cli/beacon/internal/endpoint/inventory/inventory_test.go b/cli/beacon/internal/endpoint/inventory/inventory_test.go
index e2816daa..fd4060a3 100644
--- a/cli/beacon/internal/endpoint/inventory/inventory_test.go
+++ b/cli/beacon/internal/endpoint/inventory/inventory_test.go
@@ -338,6 +338,8 @@ func TestScanIncludesAllSupportedCurrentUserAndProjectConfigs(t *testing.T) {
{runtime: "copilot_cli", path: filepath.Join(home, ".bash_profile"), scope: ScopeUser, format: formatMetadataOnly, kind: KindProfile},
{runtime: "opencode", path: filepath.Join(home, ".config", "opencode", "plugins", "beacon.ts"), scope: ScopeUser, format: formatMetadataOnly, kind: KindPlugin},
{runtime: "opencode", path: filepath.Join(work, ".opencode", "plugins", "beacon.ts"), scope: ScopeProject, format: formatMetadataOnly, kind: KindPlugin},
+ {runtime: "cline", path: filepath.Join(home, ".cline", "plugins", "beacon.ts"), scope: ScopeUser, format: formatMetadataOnly, kind: KindPlugin},
+ {runtime: "cline", path: filepath.Join(work, ".cline", "plugins", "beacon.ts"), scope: ScopeProject, format: formatMetadataOnly, kind: KindPlugin},
{runtime: "hermes", path: filepath.Join(home, ".hermes", "config.yaml"), scope: ScopeUser, format: formatYAML, kind: KindNativeConfig},
{runtime: "devin-cli", path: filepath.Join(home, ".config", "devin", "config.json"), scope: ScopeUser, format: formatJSON, kind: KindNativeConfig},
{runtime: "devin-cli", path: filepath.Join(work, ".devin", "hooks.v1.json"), scope: ScopeProject, format: formatJSON, kind: KindHookConfig},
@@ -375,6 +377,7 @@ mcpServers:
- mcp-server-memory
`)
writeFile(t, filepath.Join(home, ".config", "opencode", "plugins", "beacon.ts"), `// beacon-managed-opencode-plugin:v1`)
+ writeFile(t, filepath.Join(home, ".cline", "plugins", "beacon.ts"), `// beacon-managed-cline-plugin:v1`)
writeFile(t, filepath.Join(home, ".zshrc"), `export OTEL_TELEMETRY_ENDPOINT=http://127.0.0.1:4318`)
result := Scan(Options{
@@ -394,6 +397,19 @@ mcpServers:
if opencode.ParserMode != formatMetadataOnly || opencode.ConfigKind != KindPlugin {
t.Fatalf("opencode mode/kind = %s/%s, want %s/%s", opencode.ParserMode, opencode.ConfigKind, formatMetadataOnly, KindPlugin)
}
+ // Each plugin runtime needs its own marker case in beaconManaged; a missing one reports an
+ // installed plugin as unmanaged, which is how an inventory comes to show telemetry as absent on
+ // a machine that has it.
+ cline := findConfig(result.Configs, "cline", filepath.Join(home, ".cline", "plugins", "beacon.ts"))
+ if cline == nil {
+ t.Fatal("cline metadata-only config not found")
+ }
+ if cline.ParserStatus != StatusOK || !cline.BeaconManaged {
+ t.Fatalf("cline status = %s managed=%t, want ok/managed", cline.ParserStatus, cline.BeaconManaged)
+ }
+ if cline.ParserMode != formatMetadataOnly || cline.ConfigKind != KindPlugin {
+ t.Fatalf("cline mode/kind = %s/%s, want %s/%s", cline.ParserMode, cline.ConfigKind, formatMetadataOnly, KindPlugin)
+ }
factoryProfile := findConfig(result.Configs, "factory", filepath.Join(home, ".zshrc"))
if factoryProfile == nil {
t.Fatal("factory shell profile config not found")
diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
index b38779d4..31066d9c 100644
--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
@@ -808,6 +808,8 @@ func configureHarnesses(cfg endpointconfig.Config) ([]string, error) {
paths = append(paths, path)
case "opencode":
return paths, fmt.Errorf("opencode telemetry is installed with `beacon endpoint hooks install --harness opencode`, not endpoint install")
+ case "cline":
+ return paths, fmt.Errorf("Cline telemetry is installed with `beacon endpoint hooks install --harness cline`, not endpoint install")
case "copilot", "copilot_cli", "github_copilot":
return paths, fmt.Errorf("Copilot CLI telemetry is MDM-managed; set COPILOT_OTEL_ENABLED=true and OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:%d in the Copilot CLI launch environment instead of using --harness %s", cfg.Collector.HTTPPort, name)
case "factory", "droid":
diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go
index 948286c3..f69ee3e5 100644
--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go
+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go
@@ -259,6 +259,17 @@ func TestConfigureHarnessesRejectsOpenCodeAsHookManaged(t *testing.T) {
}
}
+// Cline telemetry is a plugin, not an OTLP endpoint setting, so `endpoint install --harness cline`
+// has nothing to configure. Saying so names the command that does work; falling through to
+// "unsupported harness" would suggest Cline is not supported at all.
+func TestConfigureHarnessesRejectsClineAsHookManaged(t *testing.T) {
+ cfg := endpointconfig.Config{Harnesses: []string{"cline"}}
+ _, err := configureHarnesses(cfg)
+ if err == nil || !strings.Contains(err.Error(), "endpoint hooks install --harness cline") {
+ t.Fatalf("configureHarnesses error = %v, want the Cline hook-managed error", err)
+ }
+}
+
func TestConfigureHarnessesAcceptsGemini(t *testing.T) {
home := t.TempDir()
t.Setenv("HOME", home)