oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package provider
2
3import (
4 "errors"
5 "strings"
6 "testing"
7)
8
9// A Mac's CLI reaches Equipo's tools through the runner binary itself,
10// in its tool-proxy mode, as the only MCP server: the same shape as the
11// Linux configuration, with real paths where Linux has its mounts.
12func TestDarwinToolMCP(t *testing.T) {
13 runner := "/Users/paulequipo/.local/lib/equipo-runner/equipo-runner"
14 socket := "/Users/paulequipo/.local/share/equipo-runner/scratch/t/123456/s"
15 got, err := DarwinToolMCP(runner, socket)
16 if err != nil {
17 t.Fatal(err)
18 }
19 want := `{"mcpServers":{"equipo":{"type":"stdio","command":"` + runner + `","args":["tool-proxy","--socket","` + socket + `"]}}}`
20 if string(got) != want {
21 t.Fatalf("MCP config\n got %s\nwant %s", got, want)
22 }
23 long := "/Users/" + strings.Repeat("n", MaxDarwinSocketPath)
24 for _, bad := range [][2]string{
25 {"equipo-runner", socket},
26 {runner + "/../equipo-runner", socket},
27 {runner, "t/123456/s"},
28 {runner, socket + "/"},
29 {runner, long[:MaxDarwinSocketPath+1]},
30 {runner, socket + "\x00"},
31 {runner, socket + "\n"},
32 } {
33 if out, err := DarwinToolMCP(bad[0], bad[1]); !errors.Is(err, ErrPolicy) || out != nil {
34 t.Fatalf("%q accepted: %s %v", bad, out, err)
35 }
36 }
37 // The longest socket path that fits a Mac's sun_path is accepted.
38 if _, err := DarwinToolMCP(runner, long[:MaxDarwinSocketPath]); err != nil {
39 t.Fatalf("a socket path of %d bytes: %v", MaxDarwinSocketPath, err)
40 }
41}
42