Add expose_port previews with a Preview tab; leave setup to AGENTS.md

This commit is contained in:
Ian Gulliver
2026-10-15 13:15:49 -07:00
parent 86e4e772ed
commit f95a0e5332
32 changed files with 1042 additions and 431 deletions
+27
View File
@@ -0,0 +1,27 @@
package tailscale
import (
"context"
"fmt"
"os/exec"
"strconv"
"strings"
)
const cli = "/Applications/Tailscale.app/Contents/MacOS/Tailscale"
func Serve(ctx context.Context, port int) error {
return run(ctx, "serve", "--bg", "--https="+strconv.Itoa(port), "http://127.0.0.1:"+strconv.Itoa(port))
}
func Off(ctx context.Context, port int) error {
return run(ctx, "serve", "--https="+strconv.Itoa(port), "off")
}
func run(ctx context.Context, args ...string) error {
out, err := exec.CommandContext(ctx, cli, args...).CombinedOutput()
if err != nil {
return fmt.Errorf("tailscale %s: %w: %s", strings.Join(args, " "), err, strings.TrimSpace(string(out)))
}
return nil
}