Compare commits
No commits in common. "36690ee292fdcfeb0d42a05f16f8124b8c1c44c3" and "70054e68e6cd5dda21035942cd47b7744dec296d" have entirely different histories.
36690ee292
...
70054e68e6
16 changed files with 30 additions and 629 deletions
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
|
|
@ -25,7 +25,7 @@ jobs:
|
|||
- name: De-version asset names (match install.sh)
|
||||
run: |
|
||||
cd dist
|
||||
for f in devbox_*_* devbox-hub_*_* devbox-mcpd-plugin_*_*; do
|
||||
for f in devbox_*_* devbox-hub_*_*; do
|
||||
[ -f "$f" ] || continue
|
||||
ext=""; case "$f" in *.exe) ext=".exe"; f="${f%.exe}";; esac
|
||||
arch="${f##*_}"; rest="${f%_*}"; os="${rest##*_}"; bin="${rest%_*}"; bin="${bin%_*}"
|
||||
|
|
@ -33,7 +33,7 @@ jobs:
|
|||
done
|
||||
cp ../install.sh ../install.ps1 .
|
||||
rm SHA256SUMS
|
||||
sha256sum devbox_* devbox-hub_* devbox-mcpd-plugin_* install.sh install.ps1 > SHA256SUMS
|
||||
sha256sum devbox_* devbox-hub_* install.sh install.ps1 > SHA256SUMS
|
||||
ls -la
|
||||
- name: Publish GitHub release
|
||||
env:
|
||||
|
|
@ -44,6 +44,6 @@ jobs:
|
|||
else
|
||||
notes=(--generate-notes)
|
||||
fi
|
||||
gh release create "${{ github.ref_name }}" dist/devbox_* dist/devbox-hub_* dist/devbox-mcpd-plugin_* dist/install.sh dist/install.ps1 dist/SHA256SUMS \
|
||||
gh release create "${{ github.ref_name }}" dist/devbox_* dist/devbox-hub_* dist/install.sh dist/install.ps1 dist/SHA256SUMS \
|
||||
--title "${{ github.ref_name }}" \
|
||||
"${notes[@]}"
|
||||
|
|
|
|||
16
README.md
16
README.md
|
|
@ -91,11 +91,8 @@ flowchart LR
|
|||
Client -->|"regular Tailscale app"| Hub["Hub with embedded Tailscale"]
|
||||
```
|
||||
|
||||
**Mozilla AI integration, native Go:** v2.3.0 ships an optional
|
||||
`devbox-mcpd-plugin` built with Mozilla's official Go plugin SDK. It records
|
||||
tool-request metadata without logging arguments or file contents. Use the
|
||||
[tested mcpd setup](examples/mcpd/README.md) to enable it alongside devbox's
|
||||
built-in MCP server; Go and PHP plugins share mcpd's middleware protocol.
|
||||
**Mozilla AI mcpd supported:** use the [tested daemon configuration](examples/mcpd/README.md)
|
||||
to manage devbox through mcpd, with optional Go or PHP middleware plugins.
|
||||
|
||||
Read the [MCP setup guide](docs/MCP.md) for tool names, configuration, execution
|
||||
limits, and errors, or the [implementation plan](docs/MCP-PLAN.md) for scope.
|
||||
|
|
@ -137,10 +134,6 @@ curl -fsSL https://git.shoemoney.ai/shoemoney/devbox-dist/releases/download/late
|
|||
sh install.sh --hub --no-service
|
||||
```
|
||||
|
||||
For the optional native Mozilla mcpd plugin (v2.3.0+), run
|
||||
`sh install.sh --mcpd-plugin --no-service`; see the
|
||||
[mcpd guide](examples/mcpd/README.md) for registration.
|
||||
|
||||
`--service` installs a keep-alive service for the **client sync daemon**. Run the
|
||||
hub separately, or configure its own service with the `serve` arguments below.
|
||||
|
||||
|
|
@ -155,7 +148,6 @@ the [Forgejo distribution mirror](https://git.shoemoney.ai/shoemoney/devbox-dist
|
|||
Both are public. Release downloads include `devbox` and `devbox-hub` for Linux amd64/arm64/arm,
|
||||
macOS amd64/arm64, and Windows amd64, plus `SHA256SUMS`. The shell installer
|
||||
supports amd64 and arm64; download the Linux arm binaries directly for 32-bit Pi OS.
|
||||
The optional `devbox-mcpd-plugin` has matching platform binaries.
|
||||
Use `--release-url` / `DEVBOX_RELEASE_URL` to select a versioned release.
|
||||
|
||||
## 🚀 Tailscale quick start
|
||||
|
|
@ -353,10 +345,10 @@ pinned Tailscale dependency. Downloading prebuilt binaries needs no Go toolchain
|
|||
go build ./cmd/devbox ./cmd/devbox-hub
|
||||
go vet ./...
|
||||
go test -race ./...
|
||||
VERSION=v2.3.0 ./scripts/build-release.sh
|
||||
VERSION=v2.2.0 ./scripts/build-release.sh
|
||||
```
|
||||
|
||||
The release script cross-compiles the client, hub, and optional mcpd plugin for six platform/architecture
|
||||
The release script cross-compiles both binaries for six platform/architecture
|
||||
combinations and generates checksums. Public binaries are available through
|
||||
[GitHub Releases](https://github.com/shoemoney/devbox/releases) and the Forgejo
|
||||
[`devbox-dist`](https://git.shoemoney.ai/shoemoney/devbox-dist) mirror. The default
|
||||
|
|
|
|||
|
|
@ -1,141 +0,0 @@
|
|||
// devbox-mcpd-plugin is metadata-only request audit middleware for Mozilla mcpd.
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
mcpdpluginsv1 "github.com/mozilla-ai/mcpd-plugins-sdk-go/pkg/plugins/v1"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
var version = "dev"
|
||||
|
||||
// Only canonical, bounded tool identifiers may enter the audit stream.
|
||||
var toolName = regexp.MustCompile(`^devbox_[a-z][a-z0-9_]{0,63}$`)
|
||||
|
||||
type auditPlugin struct {
|
||||
mcpdpluginsv1.BasePlugin
|
||||
version string
|
||||
output io.Writer
|
||||
mu sync.Mutex
|
||||
stop context.CancelFunc
|
||||
}
|
||||
|
||||
func (p *auditPlugin) GetMetadata(context.Context, *emptypb.Empty) (*mcpdpluginsv1.Metadata, error) {
|
||||
return &mcpdpluginsv1.Metadata{Name: "devbox-mcpd-plugin", Version: p.version, Description: "Metadata-only audit telemetry for devbox tool requests"}, nil
|
||||
}
|
||||
func (p *auditPlugin) GetCapabilities(context.Context, *emptypb.Empty) (*mcpdpluginsv1.Capabilities, error) {
|
||||
return &mcpdpluginsv1.Capabilities{Flows: []mcpdpluginsv1.Flow{mcpdpluginsv1.FlowRequest}}, nil
|
||||
}
|
||||
func (p *auditPlugin) Stop(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
|
||||
if p.stop != nil {
|
||||
p.stop()
|
||||
}
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
func requestTool(req *mcpdpluginsv1.HTTPRequest) string {
|
||||
if req.GetMethod() != "POST" {
|
||||
return ""
|
||||
}
|
||||
const prefix = "/api/v1/servers/devbox/tools/"
|
||||
path := req.GetPath()
|
||||
if !strings.HasPrefix(path, prefix) {
|
||||
return ""
|
||||
}
|
||||
tool := strings.TrimPrefix(path, prefix)
|
||||
if !toolName.MatchString(tool) {
|
||||
return ""
|
||||
}
|
||||
// Path is decoded by HTTP servers. Check the wire representations too, so
|
||||
// percent-encoded separators or identifiers cannot masquerade as canonical paths.
|
||||
for _, raw := range []string{req.GetUrl(), req.GetRequestUri()} {
|
||||
if raw == "" {
|
||||
continue
|
||||
}
|
||||
u, err := url.ParseRequestURI(raw)
|
||||
if err != nil || u.EscapedPath() != path || u.Fragment != "" {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
return tool
|
||||
}
|
||||
|
||||
func (p *auditPlugin) HandleRequest(ctx context.Context, req *mcpdpluginsv1.HTTPRequest) (*mcpdpluginsv1.HTTPResponse, error) {
|
||||
if tool := requestTool(req); tool != "" {
|
||||
event := struct {
|
||||
Event string `json:"event"`
|
||||
Version string `json:"version"`
|
||||
Method string `json:"method"`
|
||||
Tool string `json:"tool"`
|
||||
}{"devbox.tool.request", p.version, "POST", tool}
|
||||
p.mu.Lock()
|
||||
// Telemetry failures must never block or change a tool request's policy.
|
||||
_ = json.NewEncoder(p.output).Encode(event)
|
||||
p.mu.Unlock()
|
||||
}
|
||||
return p.BasePlugin.HandleRequest(ctx, req)
|
||||
}
|
||||
|
||||
func run(args []string, stdout, stderr io.Writer) error {
|
||||
flags := flag.NewFlagSet("devbox-mcpd-plugin", flag.ContinueOnError)
|
||||
flags.SetOutput(stderr)
|
||||
address := flags.String("address", "", "gRPC address (socket path for unix, host:port for tcp)")
|
||||
network := flags.String("network", "unix", "Network type (unix or tcp)")
|
||||
showVersion := flags.Bool("version", false, "Print version and exit")
|
||||
if err := flags.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
if *showVersion {
|
||||
_, err := fmt.Fprintln(stdout, "devbox-mcpd-plugin", version)
|
||||
return err
|
||||
}
|
||||
if flags.NArg() != 0 || *address == "" || (*network != "unix" && *network != "tcp") {
|
||||
return fmt.Errorf("--address and --network unix|tcp are required")
|
||||
}
|
||||
lis, err := net.Listen(*network, *address)
|
||||
if err != nil {
|
||||
return fmt.Errorf("plugin listener failed")
|
||||
}
|
||||
defer lis.Close()
|
||||
if *network == "unix" {
|
||||
defer os.Remove(*address)
|
||||
}
|
||||
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer cancel()
|
||||
server := grpc.NewServer()
|
||||
mcpdpluginsv1.RegisterPluginServer(server, &auditPlugin{version: version, output: stderr, stop: cancel})
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
server.GracefulStop()
|
||||
case <-done:
|
||||
}
|
||||
}()
|
||||
err = server.Serve(lis)
|
||||
close(done)
|
||||
if err != nil {
|
||||
return fmt.Errorf("plugin server failed")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func main() {
|
||||
if err := run(os.Args[1:], os.Stdout, os.Stderr); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,205 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
mcpdpluginsv1 "github.com/mozilla-ai/mcpd-plugins-sdk-go/pkg/plugins/v1"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"google.golang.org/grpc/test/bufconn"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
func clientFor(t *testing.T, p *auditPlugin) mcpdpluginsv1.PluginClient {
|
||||
t.Helper()
|
||||
listener := bufconn.Listen(1 << 20)
|
||||
server := grpc.NewServer()
|
||||
mcpdpluginsv1.RegisterPluginServer(server, p)
|
||||
go func() { _ = server.Serve(listener) }()
|
||||
conn, err := grpc.NewClient("passthrough:///plugin", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { return listener.Dial() }))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { conn.Close(); server.Stop(); listener.Close() })
|
||||
return mcpdpluginsv1.NewPluginClient(conn)
|
||||
}
|
||||
|
||||
func TestSDKLifecycleAndTelemetry(t *testing.T) {
|
||||
var logs bytes.Buffer
|
||||
stopped := false
|
||||
p := &auditPlugin{version: "v2.3.0", output: &logs, stop: func() { stopped = true }}
|
||||
client := clientFor(t, p)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
empty := &emptypb.Empty{}
|
||||
metadata, err := client.GetMetadata(ctx, empty)
|
||||
if err != nil || metadata.GetName() != "devbox-mcpd-plugin" || metadata.GetVersion() != "v2.3.0" || !strings.Contains(metadata.GetDescription(), "audit") {
|
||||
t.Fatalf("metadata: %v %v", metadata, err)
|
||||
}
|
||||
caps, err := client.GetCapabilities(ctx, empty)
|
||||
if err != nil || len(caps.GetFlows()) != 1 || caps.Flows[0] != mcpdpluginsv1.FlowRequest {
|
||||
t.Fatalf("capabilities: %v %v", caps, err)
|
||||
}
|
||||
if _, err := client.CheckHealth(ctx, empty); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := client.CheckReady(ctx, empty); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := client.Configure(ctx, &mcpdpluginsv1.PluginConfig{CustomConfig: map[string]string{"secret": "CONFIG_PII"}}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
path := "/api/v1/servers/devbox/tools/devbox_status"
|
||||
req := &mcpdpluginsv1.HTTPRequest{Method: "POST", Path: path, Url: "http://localhost" + path + "?token=QUERY_SECRET", RequestUri: path + "?token=QUERY_SECRET", Headers: map[string]string{"Authorization": "HEADER_SECRET", "X-User": "USER_PII"}, Body: []byte("ARGS_SECRET /home/private/FILE_SECRET\x00\xff"), RemoteAddr: "IP_PII"}
|
||||
before := proto.Clone(req)
|
||||
resp, err := client.HandleRequest(ctx, req)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := &mcpdpluginsv1.HTTPResponse{Continue: true, Headers: req.Headers, Body: req.Body}
|
||||
if !proto.Equal(resp, want) || !proto.Equal(req, before) {
|
||||
t.Fatal("request changed")
|
||||
}
|
||||
original := &mcpdpluginsv1.HTTPResponse{StatusCode: 207, Headers: req.Headers, Body: req.Body, Continue: true}
|
||||
after, err := client.HandleResponse(ctx, original)
|
||||
if err != nil || !proto.Equal(after, original) {
|
||||
t.Fatalf("response changed: %v", err)
|
||||
}
|
||||
var event map[string]string
|
||||
if err := json.Unmarshal(logs.Bytes(), &event); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(event) != 4 || event["event"] != "devbox.tool.request" || event["version"] != "v2.3.0" || event["method"] != "POST" || event["tool"] != "devbox_status" {
|
||||
t.Fatalf("unexpected audit fields: %v", event)
|
||||
}
|
||||
for _, secret := range []string{"CONFIG_PII", "QUERY_SECRET", "HEADER_SECRET", "USER_PII", "ARGS_SECRET", "FILE_SECRET", "IP_PII", path, "localhost"} {
|
||||
if strings.Contains(logs.String(), secret) {
|
||||
t.Fatalf("audit leaked %s", secret)
|
||||
}
|
||||
}
|
||||
if _, err := client.Stop(ctx, empty); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !stopped {
|
||||
t.Fatal("Stop did not cancel")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIgnoredRoutes(t *testing.T) {
|
||||
const valid = "/api/v1/servers/devbox/tools/devbox_status"
|
||||
cases := []struct{ method, path, raw string }{
|
||||
{"GET", valid, ""}, {"post", valid, ""}, {"POST\n", valid, ""},
|
||||
{"POST", "/api/v1/servers/other/tools/devbox_status", ""},
|
||||
{"POST", "/api/v1/servers/devbox/tools/other", ""},
|
||||
{"POST", valid + "/", ""}, {"POST", valid + "/extra", ""},
|
||||
{"POST", valid + "?x=y", ""}, {"POST", valid + "\nFORGED", ""},
|
||||
{"POST", valid + ".txt", ""}, {"POST", valid + "%0a", ""},
|
||||
{"POST", strings.Replace(valid, "devbox_status", "devbox_..", 1), ""},
|
||||
{"POST", strings.Replace(valid, "/tools/", "//tools/", 1), ""},
|
||||
{"POST", valid + strings.Repeat("a", 65), ""},
|
||||
{"POST", valid, strings.Replace(valid, "status", "%73tatus", 1)},
|
||||
{"POST", valid, strings.Replace(valid, "/tools/", "%2ftools/", 1)},
|
||||
{"POST", valid, valid + "%0aFORGED"}, {"POST", valid, "/different"},
|
||||
{"POST", valid, "http://[invalid"},
|
||||
}
|
||||
var logs bytes.Buffer
|
||||
client := clientFor(t, &auditPlugin{version: "v2.3.0", output: &logs})
|
||||
for i, tc := range cases {
|
||||
req := &mcpdpluginsv1.HTTPRequest{Method: tc.method, Path: tc.path, RequestUri: tc.raw, Headers: map[string]string{"secret": "sentinel"}, Body: []byte{0, 255, 1}}
|
||||
resp, err := client.HandleRequest(context.Background(), req)
|
||||
if err != nil || !resp.GetContinue() || !bytes.Equal(resp.GetBody(), req.Body) || resp.Headers["secret"] != "sentinel" {
|
||||
t.Fatalf("case %d changed request: %v", i, err)
|
||||
}
|
||||
}
|
||||
if logs.Len() != 0 {
|
||||
t.Fatalf("ignored paths logged: %s", &logs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConcurrentRequests(t *testing.T) {
|
||||
var logs bytes.Buffer
|
||||
client := clientFor(t, &auditPlugin{version: "v2.3.0", output: &logs})
|
||||
var wg sync.WaitGroup
|
||||
for i := 0; i < 64; i++ {
|
||||
wg.Go(func() {
|
||||
resp, err := client.HandleRequest(context.Background(), &mcpdpluginsv1.HTTPRequest{Method: "POST", Path: "/api/v1/servers/devbox/tools/devbox_status"})
|
||||
if err != nil || !resp.GetContinue() {
|
||||
t.Errorf("request: %v", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
wg.Wait()
|
||||
dec := json.NewDecoder(&logs)
|
||||
for i := 0; i < 64; i++ {
|
||||
var v map[string]string
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
var extra any
|
||||
if err := dec.Decode(&extra); err != io.EOF {
|
||||
t.Fatalf("extra log data: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
type brokenWriter struct{}
|
||||
|
||||
func (brokenWriter) Write([]byte) (int, error) { return 0, fmt.Errorf("sink unavailable") }
|
||||
func TestAuditFailureIsPassThrough(t *testing.T) {
|
||||
p := &auditPlugin{output: brokenWriter{}}
|
||||
resp, err := p.HandleRequest(context.Background(), &mcpdpluginsv1.HTTPRequest{Method: "POST", Path: "/api/v1/servers/devbox/tools/devbox_status"})
|
||||
if err != nil || !resp.Continue {
|
||||
t.Fatalf("telemetry blocked request: %v", err)
|
||||
}
|
||||
}
|
||||
func TestVersion(t *testing.T) {
|
||||
for _, flag := range []string{"-version", "--version"} {
|
||||
var out, logs bytes.Buffer
|
||||
if err := run([]string{flag}, &out, &logs); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if out.String() != "devbox-mcpd-plugin "+version+"\n" || logs.Len() != 0 {
|
||||
t.Fatal("invalid version output")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNativeServerStop(t *testing.T) {
|
||||
socket := t.TempDir() + "/plugin.sock"
|
||||
done := make(chan error, 1)
|
||||
go func() { done <- run([]string{"--network", "unix", "--address", socket}, io.Discard, io.Discard) }()
|
||||
conn, err := grpc.NewClient("passthrough:///native", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(func(ctx context.Context, _ string) (net.Conn, error) {
|
||||
return (&net.Dialer{}).DialContext(ctx, "unix", socket)
|
||||
}))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer conn.Close()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
client := mcpdpluginsv1.NewPluginClient(conn)
|
||||
if _, err := client.CheckHealth(ctx, &emptypb.Empty{}, grpc.WaitForReady(true)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := client.Stop(ctx, &emptypb.Empty{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
select {
|
||||
case err := <-done:
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
case <-time.After(time.Second):
|
||||
t.Fatal("Stop did not exit server promptly")
|
||||
}
|
||||
}
|
||||
|
|
@ -71,11 +71,8 @@ mcpd v0.7.0 and devbox v2.2.0 on Linux, including authenticated snapshot history
|
|||
|
||||
Mozilla's [Go plugin SDK](https://github.com/mozilla-ai/mcpd-plugins-sdk-go) and
|
||||
the community [PHP plugin SDK](https://github.com/shoemoney/mcpd-plugins-sdk-php)
|
||||
provide middleware around daemon requests/responses. In v2.3.0, the optional
|
||||
`devbox-mcpd-plugin` uses Mozilla's Go SDK to record metadata for devbox tool
|
||||
requests without logging payloads. Install it with `--mcpd-plugin` and follow
|
||||
the [native plugin setup](../examples/mcpd/README.md#use-the-native-mozilla-go-sdk-plugin-v230).
|
||||
The daemon can also manage the tool server without enabling this plugin.
|
||||
provide optional middleware around daemon requests/responses. Devbox's native
|
||||
MCP tools work through mcpd without adding a plugin dependency.
|
||||
|
||||
## Available tools
|
||||
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
# v2.3.0 — Native Mozilla AI Go SDK integration
|
||||
|
||||
Devbox now ships an optional **native mcpd middleware plugin**, built with
|
||||
Mozilla AI's official [`mcpd-plugins-sdk-go`](https://github.com/mozilla-ai/mcpd-plugins-sdk-go).
|
||||
|
||||
## Install the plugin
|
||||
|
||||
```bash
|
||||
curl -fsSL https://git.shoemoney.ai/shoemoney/devbox-dist/releases/download/latest/install.sh -o install.sh
|
||||
sh install.sh --mcpd-plugin --no-service
|
||||
```
|
||||
|
||||
The PowerShell installer supports `-McpdPlugin`. Releases include the plugin
|
||||
alongside the client and hub for Linux amd64/arm64/arm, macOS amd64/arm64,
|
||||
and Windows amd64.
|
||||
|
||||
Register `devbox-mcpd-plugin` in mcpd's plugin directory and enable its optional
|
||||
request observability flow. The [tested setup guide](https://github.com/shoemoney/devbox/tree/main/examples/mcpd)
|
||||
includes complete configuration and a PHP HTTP example.
|
||||
|
||||
The plugin records the tool name, HTTP method, event, and plugin version for
|
||||
recognized devbox tool requests. It leaves the request unchanged and excludes
|
||||
arguments, bodies, headers, queries, identities, addresses, filenames, and file
|
||||
contents from audit records. It is request telemetry, not a durable transaction
|
||||
history or proof an operation completed. Existing tool permissions still apply.
|
||||
|
||||
## Built-in MCP and Tailscale remain available
|
||||
|
||||
```bash
|
||||
codex mcp add devbox -- /absolute/path/to/devbox mcp
|
||||
devbox-hub serve --data ./hub-data --tailscale
|
||||
```
|
||||
|
||||
The client serves structured agent tools over local stdio. The hub embeds
|
||||
Tailscale, while client machines use their regular Tailscale connection. mcpd
|
||||
can manage the tool server with or without the optional plugin.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
The CLI/MCP screenshots were captured from v2.2.0; that tool surface remains in
|
||||
v2.3.0. The live dashboard capture uses an isolated local demo, not production
|
||||
Tailscale enrollment.
|
||||
|
||||
## Downloads
|
||||
|
||||
Each release provides **18 binaries**, both installers, and `SHA256SUMS`:
|
||||
21 assets, with hashes for all 20 payloads. Public downloads are on GitHub and
|
||||
Forgejo. Prebuilt binaries require no Go toolchain; source builds require Go
|
||||
1.27.4 or newer. Mozilla's Go plugin SDK is pinned to v0.1.1.
|
||||
|
||||
## Verification
|
||||
|
||||
Passed vet and the full race suite, SDK gRPC lifecycle and request tests,
|
||||
concurrent audit tests, payload-exclusion checks, installer smoke, and nine
|
||||
publication tests. A real mcpd v0.7.0 instance loaded the native plugin, served
|
||||
devbox tool calls, emitted metadata records without header/query/body sentinels,
|
||||
kept the write allowlist enforced, and stopped the plugin without a forced kill.
|
||||
PowerShell installer execution was not available in the validation environment.
|
||||
|
|
@ -17,9 +17,8 @@ snapshot history through mcpd's HTTP API.
|
|||
serves that same middleware role. `status.php` here is a plain HTTP consumer;
|
||||
it does not require a plugin SDK.
|
||||
|
||||
The plugin SDK and the MCP tool server are separate integration points. Basic
|
||||
mcpd management works without a plugin. **v2.3.0 also ships an optional native
|
||||
`devbox-mcpd-plugin` built with Mozilla's official Go plugin SDK.**
|
||||
The plugin SDK and the MCP tool server are separate integration points. No new
|
||||
Go dependency is required in devbox for mcpd to manage it.
|
||||
|
||||
## 1. Install the prerequisites
|
||||
|
||||
|
|
@ -125,59 +124,3 @@ config and hub, but filesystem diagnostics cannot inspect the actual files.
|
|||
This example does not enable mutation tools. Enabling them also requires writable
|
||||
mounts, appropriate container ownership, and an updated mcpd tool allowlist.
|
||||
Use the [native MCP guide](../../docs/MCP.md) for the tool permission model.
|
||||
|
||||
## Use the native Mozilla Go SDK plugin (v2.3.0)
|
||||
|
||||
Install the optional plugin along with the client:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://git.shoemoney.ai/shoemoney/devbox-dist/releases/download/latest/install.sh -o install.sh
|
||||
sh install.sh --mcpd-plugin --no-service
|
||||
```
|
||||
|
||||
On Windows the PowerShell installer supports `-McpdPlugin`. Select the plugin
|
||||
binary matching the machine running **mcpd**, which may be different from
|
||||
Docker's Linux architecture. The Linux binary requirement above applies to the
|
||||
MCP server inside the container, not the native middleware process.
|
||||
|
||||
Create a dedicated plugin directory and place the executable inside it:
|
||||
|
||||
```bash
|
||||
mkdir -p ./plugins
|
||||
cp /absolute/path/to/devbox-mcpd-plugin ./plugins/devbox-mcpd-plugin
|
||||
chmod 755 ./plugins/devbox-mcpd-plugin
|
||||
```
|
||||
|
||||
Copy `mcpd-with-plugin.toml` and set `[plugins].dir` to that directory's absolute
|
||||
path. The configured plugin name must match the executable filename. Start the
|
||||
daemon with that configuration and your existing runtime file:
|
||||
|
||||
```bash
|
||||
mcpd daemon --config-file ./mcpd-with-plugin.toml --runtime-file /absolute/path/to/runtime.local.toml --addr 127.0.0.1:8090 --timeout-mcp-request 150s --log-level INFO --log-path ./mcpd.log
|
||||
```
|
||||
|
||||
mcpd launches the native plugin over its standard gRPC socket protocol. The
|
||||
plugin is written against `mozilla-ai/mcpd-plugins-sdk-go`; it is a separate
|
||||
native executable included in devbox releases, not a replacement for
|
||||
`devbox mcp`.
|
||||
|
||||
The plugin records **request metadata only** for recognized devbox tool-call
|
||||
routes: the event, plugin version, HTTP method, and tool name. It leaves the
|
||||
request unchanged. Audit records exclude arguments, request/response bodies,
|
||||
headers, query strings, user identities, network addresses, filenames, and file
|
||||
contents. It does not change tool permissions or authorize a write. The
|
||||
observability category is optional; these records are operational telemetry,
|
||||
not a durable transaction history or proof an operation completed.
|
||||
|
||||
Only the request flow is advertised. Other daemon routes pass through without
|
||||
a devbox audit event. mcpd captures the plugin's stderr and forwards it into its
|
||||
logs. Its normal startup/lifecycle logs are separate from the audit records.
|
||||
|
||||
### Verified behavior
|
||||
|
||||
The v2.3.0 plugin was exercised in a real mcpd v0.7.0 process. It registered,
|
||||
received tool requests, emitted `devbox.tool.request` records, and left
|
||||
header/query/body sentinels out of those records. An unlisted write tool still
|
||||
received HTTP 403. On daemon shutdown the native plugin exited without a
|
||||
forced-kill warning. Unit tests also exercise the official SDK's metadata,
|
||||
capability, health, readiness, request, and Stop RPCs over real gRPC.
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
[[servers]]
|
||||
name = "devbox"
|
||||
package = "docker::alpine@3.22"
|
||||
tools = ["devbox_status", "devbox_doctor", "devbox_conflicts", "devbox_history", "devbox_members"]
|
||||
[servers.volumes.binary]
|
||||
path = "/opt/devbox/devbox:ro"
|
||||
required = true
|
||||
[servers.volumes.config]
|
||||
path = "/config/devbox:ro"
|
||||
required = true
|
||||
[servers.volumes.certificates]
|
||||
path = "/etc/ssl/certs:ro"
|
||||
required = true
|
||||
|
||||
# Install the v2.3.0 native plugin into this directory, then set its absolute path.
|
||||
[plugins]
|
||||
dir = "/absolute/path/to/mcpd/plugins"
|
||||
|
||||
[[plugins.observability]]
|
||||
name = "devbox-mcpd-plugin"
|
||||
flows = ["request"]
|
||||
required = false
|
||||
4
go.mod
4
go.mod
|
|
@ -7,12 +7,9 @@ require (
|
|||
github.com/fsnotify/fsnotify v1.10.1
|
||||
github.com/jotfs/fastcdc-go v0.2.0
|
||||
github.com/modelcontextprotocol/go-sdk v1.8.0
|
||||
github.com/mozilla-ai/mcpd-plugins-sdk-go v0.1.1
|
||||
github.com/spf13/cobra v1.10.2
|
||||
github.com/zeebo/blake3 v0.2.4
|
||||
golang.org/x/time v0.16.0
|
||||
google.golang.org/grpc v1.83.2
|
||||
google.golang.org/protobuf v1.36.12
|
||||
modernc.org/sqlite v1.53.0
|
||||
tailscale.com v1.106.1
|
||||
)
|
||||
|
|
@ -120,7 +117,6 @@ require (
|
|||
golang.org/x/tools v0.52.0 // indirect
|
||||
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
|
||||
golang.zx2c4.com/wireguard/windows v1.0.1 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect
|
||||
gvisor.dev/gvisor v0.0.0-20261117040555-0303b2605d5e // indirect
|
||||
honnef.co/go/tools v0.8.1 // indirect
|
||||
modernc.org/libc v1.73.4 // indirect
|
||||
|
|
|
|||
28
go.sum
28
go.sum
|
|
@ -50,8 +50,6 @@ github.com/bradfitz/reco v0.0.0-20260929154613-b883fbd17e3f h1:jdXGSp5Ge5/kzikux
|
|||
github.com/bradfitz/reco v0.0.0-20260929154613-b883fbd17e3f/go.mod h1:oiCPXxBoDKSkb/RGEZwAZk8y/fwDlQ1vYlBbNRxPysw=
|
||||
github.com/bramvdbogaerde/go-scp v1.6.1 h1:HE63uMkmMEB62JwqdRrVqRTBi7H/L/rkTp8TPC7uffY=
|
||||
github.com/bramvdbogaerde/go-scp v1.6.1/go.mod h1:Lqx75BOgAvQoeBbPuPN/MfU3jf5tlfZVmUqpPbSZkZc=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cilium/ebpf v0.22.0 h1:v2ktp0roffpMOj2MMf3idtCQZOsAoC4BJbAJN+ke2bY=
|
||||
github.com/cilium/ebpf v0.22.0/go.mod h1:CDzZbe2hC5JjlDC+CY3KFCzlYwN4gbxppYM+Z10bQt4=
|
||||
github.com/coder/websocket v1.8.15 h1:6B2JPeOGlpff2Uz6vOEH1Vzpi0iUz20A+lPVhPHtNUA=
|
||||
|
|
@ -91,10 +89,6 @@ github.com/github/fakeca v0.1.0 h1:Km/MVOFvclqxPM9dZBC4+QE564nU4gz4iZ0D9pMw28I=
|
|||
github.com/github/fakeca v0.1.0/go.mod h1:+bormgoGMMuamOscx7N91aOuUST7wdaJ2rNjeohylyo=
|
||||
github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3 h1:UADEEmDKgfXbtnGJZ97beY5XLo9ZechG1nlU4KnRrkE=
|
||||
github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
|
||||
github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
|
||||
github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
||||
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||
github.com/go4org/hashtriemap v0.0.0-20260925222741-44e5305f85d9 h1:J8S+Ms89nvHX1F9Ma2m3KhdTl41ZhbFKMyAJqvDA+iE=
|
||||
|
|
@ -107,8 +101,6 @@ github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63Y
|
|||
github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
|
||||
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ=
|
||||
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg=
|
||||
github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
|
|
@ -176,8 +168,6 @@ github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc
|
|||
github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
|
||||
github.com/modelcontextprotocol/go-sdk v1.8.0 h1:KIvahhYqwtbeniWVPs3TcXEA7b8jEtwfBpOTAI+Urx4=
|
||||
github.com/modelcontextprotocol/go-sdk v1.8.0/go.mod h1:dL7u98E/zjJTGzEq+j30jQ8K2k1mb6LeAH4inEcSGts=
|
||||
github.com/mozilla-ai/mcpd-plugins-sdk-go v0.1.1 h1:I8zb8vn/PNxiuYZV3f5dBOx12M/IhxzpgHm+c5KNQJI=
|
||||
github.com/mozilla-ai/mcpd-plugins-sdk-go v0.1.1/go.mod h1:mcdV4ULyHd8wVtBeDgZj4M9Ouis+dGEJPc7DM8BHUQE=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w=
|
||||
|
|
@ -257,18 +247,6 @@ github.com/zeebo/blake3 v0.2.4 h1:KYQPkhpRtcqh0ssGYcKLG1JYvddkEA8QwCM/yBqhaZI=
|
|||
github.com/zeebo/blake3 v0.2.4/go.mod h1:7eeQ6d2iXWRGF6npfaxl2CU+xy2Fjo2gxeyZGCRUjcE=
|
||||
github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo=
|
||||
github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU=
|
||||
go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ=
|
||||
go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M=
|
||||
go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s=
|
||||
go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58=
|
||||
go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA=
|
||||
go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag=
|
||||
go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
||||
|
|
@ -317,12 +295,6 @@ golang.zx2c4.com/wireguard v0.0.0-20260522210424-ecfc5a8d5446 h1:cqHQ3AycTHvM2R7
|
|||
golang.zx2c4.com/wireguard v0.0.0-20260522210424-ecfc5a8d5446/go.mod h1:rpwXGsirqLqN2L0JDJQlwOboGHmptD5ZD6T2VmcqhTw=
|
||||
golang.zx2c4.com/wireguard/windows v1.0.1 h1:eOxiDVbywPC+ZQqvdCK7x+ZwWXKbYv50TtH8ysFIbw8=
|
||||
golang.zx2c4.com/wireguard/windows v1.0.1/go.mod h1:+fbT3FFdX4zzYDLwJh5+HPEcNN/3HyNdzhNSVsQM+zs=
|
||||
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
|
||||
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa h1:mZHHdPZl0dbGHCflZgAq/Q468DWVFcU2whhB2KAo8fk=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
|
||||
google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU=
|
||||
google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8=
|
||||
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
|
||||
google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
param(
|
||||
[string]$BinDir = $env:DEVBOX_BIN_DIR,
|
||||
[switch]$Hub,
|
||||
[switch]$McpdPlugin,
|
||||
[switch]$Service,
|
||||
[switch]$NoService,
|
||||
[string]$ReleaseUrl = $(if ($env:DEVBOX_RELEASE_URL) { $env:DEVBOX_RELEASE_URL } else { "https://git.shoemoney.ai/shoemoney/devbox-dist/releases/download/latest" })
|
||||
|
|
@ -74,7 +73,6 @@ function Install-One($name) {
|
|||
}
|
||||
Install-One "devbox"
|
||||
if ($Hub) { Install-One "devbox-hub" }
|
||||
if ($McpdPlugin) { Install-One "devbox-mcpd-plugin" }
|
||||
|
||||
# Add to the user PATH (persisted) if missing.
|
||||
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
||||
|
|
|
|||
|
|
@ -9,12 +9,10 @@
|
|||
# DEVBOX_BIN_DIR=~/.local/bin DEVBOX_SERVICE=1 sh install.sh # non-interactive
|
||||
#
|
||||
# Knobs (flags or env): --bin-dir DIR (DEVBOX_BIN_DIR) · --hub (DEVBOX_INSTALL_HUB=1)
|
||||
# · --mcpd-plugin (DEVBOX_INSTALL_MCPD_PLUGIN=1)
|
||||
# · --service / --no-service (DEVBOX_SERVICE=1/0) · --release-url URL (DEVBOX_RELEASE_URL).
|
||||
set -eu
|
||||
|
||||
INSTALL_HUB="${DEVBOX_INSTALL_HUB:-0}"
|
||||
INSTALL_MCPD_PLUGIN="${DEVBOX_INSTALL_MCPD_PLUGIN:-0}"
|
||||
BIN_DIR="${DEVBOX_BIN_DIR:-}"
|
||||
WANT_SERVICE="${DEVBOX_SERVICE:-ask}"
|
||||
RELEASE_URL="${DEVBOX_RELEASE_URL:-https://git.shoemoney.ai/shoemoney/devbox-dist/releases/download/latest}"
|
||||
|
|
@ -22,7 +20,6 @@ RELEASE_URL="${DEVBOX_RELEASE_URL:-https://git.shoemoney.ai/shoemoney/devbox-dis
|
|||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--hub) INSTALL_HUB=1 ;;
|
||||
--mcpd-plugin) INSTALL_MCPD_PLUGIN=1 ;;
|
||||
--bin-dir) BIN_DIR="$2"; shift ;;
|
||||
--service) WANT_SERVICE=1 ;;
|
||||
--no-service) WANT_SERVICE=0 ;;
|
||||
|
|
@ -120,7 +117,6 @@ install_one() {
|
|||
say "🚚 installing to $BIN_DIR"
|
||||
install_one devbox
|
||||
[ "$INSTALL_HUB" = 1 ] && install_one devbox-hub
|
||||
[ "$INSTALL_MCPD_PLUGIN" = 1 ] && install_one devbox-mcpd-plugin
|
||||
|
||||
case ":$PATH:" in *":$BIN_DIR:"*) ;; *)
|
||||
say "⚠️ $BIN_DIR is not on your PATH. Add to your shell rc:"
|
||||
|
|
@ -220,5 +216,3 @@ fi
|
|||
say ""
|
||||
say "🎉 done. Next: run 'devbox setup' to join a hub and start syncing."
|
||||
[ "$INSTALL_HUB" = 1 ] && say " hub: 'devbox-hub serve --dashboard' — or use the Dockerfile for a NAS (see README)."
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Cross-compile all three devbox binaries for all release targets.
|
||||
# Cross-compile both devbox binaries for all release targets.
|
||||
# Override version: VERSION=v1.2.3 ./scripts/build-release.sh
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
|
@ -9,7 +9,7 @@ cd "$(dirname "$0")/.."
|
|||
VERSION="${VERSION:-$(git describe --tags --always --dirty 2>/dev/null || echo dev)}"
|
||||
LDFLAGS="-s -w -X main.version=$VERSION"
|
||||
|
||||
BINS=(devbox devbox-hub devbox-mcpd-plugin)
|
||||
BINS=(devbox devbox-hub)
|
||||
# linux/arm64 = Raspberry Pi 5/4/3 (64-bit) + arm Macs' Linux VMs; linux/arm = 32-bit Pi OS.
|
||||
TARGETS=(linux/amd64 linux/arm64 linux/arm darwin/arm64 darwin/amd64 windows/amd64)
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ BUILD_VERSION=$(sed -n '2p' dist/BUILD_INFO)
|
|||
STAGE=dist/release-assets
|
||||
rm -rf "$STAGE"
|
||||
mkdir -p "$STAGE"
|
||||
for bin in devbox devbox-hub devbox-mcpd-plugin; do
|
||||
for bin in devbox devbox-hub; do
|
||||
for target in linux/amd64 linux/arm64 linux/arm darwin/arm64 darwin/amd64 windows/amd64; do
|
||||
os="${target%/*}"; arch="${target#*/}"; ext=""
|
||||
[ "$os" != windows ] || ext=.exe
|
||||
|
|
@ -40,7 +40,7 @@ for bin in devbox devbox-hub devbox-mcpd-plugin; do
|
|||
done
|
||||
done
|
||||
cp install.sh install.ps1 "$STAGE/"
|
||||
(cd "$STAGE" && hashes devbox_* devbox-hub_* devbox-mcpd-plugin_* install.sh install.ps1 > SHA256SUMS)
|
||||
(cd "$STAGE" && hashes devbox_* devbox-hub_* install.sh install.ps1 > SHA256SUMS)
|
||||
|
||||
# Read errors fail the release; a 404 alone means the tag has no release.
|
||||
old_json=$(mktemp)
|
||||
|
|
@ -57,7 +57,7 @@ if [ -n "$old_id" ] && [ "$TAG" != latest ]; then
|
|||
fi
|
||||
upload_tag="$TAG"
|
||||
[ "$TAG" != latest ] || upload_tag="latest-staging-${COMMIT:0:12}-$(date +%s)"
|
||||
body=$(printf 'devbox %s — built from source `%s`, binary version `%s`.\n\nBuilt-in Tailscale in the hub: `devbox-hub serve --data ./hub-data --tailscale`. No separate Tailscale installation is required on the hub. Authenticate using the logged login URL or TS_AUTHKEY; identity persists under <data>/tailscale. Clients use the regular Tailscale app. Existing HTTP/HTTPS deployments remain supported.\n\nInstall: `curl -fsSL https://git.shoemoney.ai/%s/releases/download/%s/install.sh -o install.sh && sh install.sh --release-url https://git.shoemoney.ai/%s/releases/download/%s`\n\nAssets include 18 binaries, both installers, and SHA256SUMS. Building from source requires Go 1.27.4+.' "$TAG" "$COMMIT" "$BUILD_VERSION" "$REPO" "$TAG" "$REPO" "$TAG")
|
||||
body=$(printf 'devbox %s — built from source `%s`, binary version `%s`.\n\nBuilt-in Tailscale in the hub: `devbox-hub serve --data ./hub-data --tailscale`. No separate Tailscale installation is required on the hub. Authenticate using the logged login URL or TS_AUTHKEY; identity persists under <data>/tailscale. Clients use the regular Tailscale app. Existing HTTP/HTTPS deployments remain supported.\n\nInstall: `curl -fsSL https://git.shoemoney.ai/%s/releases/download/%s/install.sh -o install.sh && sh install.sh --release-url https://git.shoemoney.ai/%s/releases/download/%s`\n\nAssets include 12 binaries, both installers, and SHA256SUMS. Building from source requires Go 1.27.4+.' "$TAG" "$COMMIT" "$BUILD_VERSION" "$REPO" "$TAG" "$REPO" "$TAG")
|
||||
if [ -f "docs/releases/$BUILD_VERSION.md" ]; then
|
||||
body="$(cat "docs/releases/$BUILD_VERSION.md")
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ for f in "$STAGE"/*; do
|
|||
curl -fsSL "${auth[@]}" -X POST "$API/repos/$REPO/releases/$rel_id/assets?name=$name" -F "attachment=@$f" >/dev/null
|
||||
done
|
||||
count=$(api "$API/repos/$REPO/releases/$rel_id" | python3 -c 'import json,sys;print(len(json.load(sys.stdin)["assets"]))')
|
||||
[ "$count" = 21 ] || { echo "Expected 21 assets, got $count; leaving draft unpublished" >&2; exit 1; }
|
||||
[ "$count" = 15 ] || { echo "Expected 15 assets, got $count; leaving draft unpublished" >&2; exit 1; }
|
||||
# Keep the existing moving release until the replacement is fully uploaded.
|
||||
if [ -n "$old_id" ]; then api -X DELETE "$API/repos/$REPO/releases/$old_id" >/dev/null; fi
|
||||
# Forgejo cannot publish a renamed draft onto an existing tag (it returns 500).
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Installer smoke using explicit temporary binaries; never installs services."""
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
INSTALLER = Path(__file__).resolve().parents[1] / 'install.sh'
|
||||
|
||||
|
||||
class InstallTest(unittest.TestCase):
|
||||
def test_optional_plugin(self):
|
||||
for mode in ('default', 'flag', 'env'):
|
||||
with self.subTest(mode=mode), tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
env = dict(os.environ)
|
||||
env.pop('DEVBOX_INSTALL_HUB', None)
|
||||
env.pop('DEVBOX_INSTALL_MCPD_PLUGIN', None)
|
||||
for binary in ('devbox', 'devbox-hub', 'devbox-mcpd-plugin'):
|
||||
source = root / binary
|
||||
source.write_text(f'#!/bin/sh\necho {binary}-fixture\n')
|
||||
source.chmod(0o755)
|
||||
env[binary.upper().replace('-', '_') + '_BIN'] = str(source)
|
||||
dest = root / 'installed'
|
||||
args = ['sh', str(INSTALLER), '--no-service', '--bin-dir', str(dest)]
|
||||
if mode == 'flag':
|
||||
args += ['--mcpd-plugin', '--hub']
|
||||
if mode == 'env':
|
||||
env['DEVBOX_INSTALL_MCPD_PLUGIN'] = '1'
|
||||
result = subprocess.run(args, env=env, capture_output=True, text=True, timeout=10)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
expected = {'devbox'}
|
||||
if mode != 'default':
|
||||
expected.add('devbox-mcpd-plugin')
|
||||
if mode == 'flag':
|
||||
expected.add('devbox-hub')
|
||||
self.assertEqual({p.name for p in dest.iterdir()}, expected)
|
||||
for binary in expected:
|
||||
self.assertEqual(subprocess.check_output([str(dest / binary)], text=True), f'{binary}-fixture\n')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
@ -9,7 +9,6 @@ import shutil
|
|||
import subprocess
|
||||
import tempfile
|
||||
import threading
|
||||
import textwrap
|
||||
import unittest
|
||||
|
||||
SCRIPT = Path(__file__).with_name('release.sh').resolve()
|
||||
|
|
@ -30,14 +29,14 @@ class ReleaseTest(unittest.TestCase):
|
|||
dist = self.root / 'dist'
|
||||
dist.mkdir()
|
||||
lines = []
|
||||
for binary in ('devbox', 'devbox-hub', 'devbox-mcpd-plugin'):
|
||||
for binary in ('devbox', 'devbox-hub'):
|
||||
for target in ('linux_amd64', 'linux_arm64', 'linux_arm', 'darwin_arm64', 'darwin_amd64', 'windows_amd64.exe'):
|
||||
name = f'{binary}_v2.3.0_{target}'
|
||||
name = f'{binary}_v2.1.0_{target}'
|
||||
data = name.encode()
|
||||
(dist / name).write_bytes(data)
|
||||
lines.append(f'{hashlib.sha256(data).hexdigest()} {name}\n')
|
||||
(dist / 'SHA256SUMS').write_text(''.join(lines))
|
||||
(dist / 'BUILD_INFO').write_text(f'{self.sha}\nv2.3.0\n')
|
||||
(dist / 'BUILD_INFO').write_text(f'{self.sha}\nv2.1.0\n')
|
||||
self.calls = []
|
||||
self.assets = []
|
||||
self.existing = False
|
||||
|
|
@ -84,11 +83,10 @@ class ReleaseTest(unittest.TestCase):
|
|||
env=env, capture_output=True, text=True, timeout=20)
|
||||
|
||||
def test_complete_versioned_release(self):
|
||||
result = self.run_release('v2.3.0')
|
||||
result = self.run_release('v2.1.0')
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertEqual(len(self.assets), 21)
|
||||
self.assertEqual(len(self.assets), 15)
|
||||
self.assertIn('devbox-hub_windows_amd64.exe', self.assets)
|
||||
self.assertIn('devbox-mcpd-plugin_windows_amd64.exe', self.assets)
|
||||
self.assertIn('install.ps1', self.assets)
|
||||
creates = [json.loads(body) for method, _, body in self.calls if method == 'POST' and body.startswith(b'{')]
|
||||
self.assertTrue(creates[0]['draft'])
|
||||
|
|
@ -98,24 +96,7 @@ class ReleaseTest(unittest.TestCase):
|
|||
for line in (stage / 'SHA256SUMS').read_text().splitlines():
|
||||
digest, name = line.split()
|
||||
self.assertEqual(hashlib.sha256((stage / name).read_bytes()).hexdigest(), digest)
|
||||
self.assertEqual(len((stage / 'SHA256SUMS').read_text().splitlines()), 20)
|
||||
|
||||
def test_github_asset_rename_and_checksums(self):
|
||||
workflow = SCRIPT.parents[1] / '.github/workflows/release.yml'
|
||||
text = workflow.read_text()
|
||||
shell = text.split(' - name: De-version asset names (match install.sh)\n run: |\n', 1)[1].split(' - name: Publish GitHub release', 1)[0]
|
||||
result = subprocess.run(['bash', '-euc', textwrap.dedent(shell)], cwd=self.root,
|
||||
capture_output=True, text=True, timeout=10)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
dist = self.root / 'dist'
|
||||
checksums = (dist / 'SHA256SUMS').read_text().splitlines()
|
||||
self.assertEqual(len(checksums), 20)
|
||||
self.assertIn('devbox-mcpd-plugin_windows_amd64.exe', {line.split()[1] for line in checksums})
|
||||
for line in checksums:
|
||||
digest, name = line.split()
|
||||
self.assertEqual(hashlib.sha256((dist / name).read_bytes()).hexdigest(), digest)
|
||||
# BUILD_INFO is provenance only and is deliberately excluded from upload.
|
||||
self.assertIn('dist/devbox-mcpd-plugin_*', text.split('gh release create', 1)[1])
|
||||
self.assertEqual(len((stage / 'SHA256SUMS').read_text().splitlines()), 14)
|
||||
|
||||
def test_latest_keeps_old_release_until_uploads_complete(self):
|
||||
self.existing = True
|
||||
|
|
@ -135,14 +116,14 @@ class ReleaseTest(unittest.TestCase):
|
|||
|
||||
def test_existing_version_is_immutable(self):
|
||||
self.existing = True
|
||||
self.assertNotEqual(self.run_release('v2.3.0').returncode, 0)
|
||||
self.assertNotEqual(self.run_release('v2.1.0').returncode, 0)
|
||||
self.assertEqual([method for method, _, _ in self.calls], ['GET'])
|
||||
|
||||
def test_checked_in_release_notes_are_published(self):
|
||||
notes = self.root / 'docs/releases'
|
||||
notes.mkdir(parents=True)
|
||||
(notes / 'v2.3.0.md').write_text('# Custom release\n\n\n')
|
||||
result = self.run_release('v2.3.0')
|
||||
(notes / 'v2.1.0.md').write_text('# Custom release\n\n\n')
|
||||
result = self.run_release('v2.1.0')
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
create = next(json.loads(body) for method, _, body in self.calls if method == 'POST' and body.startswith(b'{'))
|
||||
self.assertIn('![Screenshot]', create['body'])
|
||||
|
|
@ -154,13 +135,13 @@ class ReleaseTest(unittest.TestCase):
|
|||
self.assertEqual([method for method, _, _ in self.calls], ['GET'])
|
||||
|
||||
def test_corrupt_artifact_never_reaches_api(self):
|
||||
(self.root / 'dist/devbox_v2.3.0_linux_amd64').write_bytes(b'corrupt')
|
||||
self.assertNotEqual(self.run_release('v2.3.0').returncode, 0)
|
||||
(self.root / 'dist/devbox_v2.1.0_linux_amd64').write_bytes(b'corrupt')
|
||||
self.assertNotEqual(self.run_release('v2.1.0').returncode, 0)
|
||||
self.assertEqual(self.calls, [])
|
||||
|
||||
def test_wrong_source_never_reaches_api(self):
|
||||
(self.root / 'dist/BUILD_INFO').write_text('wrong\nv2.3.0\n')
|
||||
self.assertNotEqual(self.run_release('v2.3.0').returncode, 0)
|
||||
(self.root / 'dist/BUILD_INFO').write_text('wrong\nv2.1.0\n')
|
||||
self.assertNotEqual(self.run_release('v2.1.0').returncode, 0)
|
||||
self.assertEqual(self.calls, [])
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue