Files
pad/internal/cli/workspace_context_detect_test.go
xarmian 7cda0d7896 feat: rebrand to Perpetual Software + new tagline (IDEA-832) (#273)
Migrates from xarmian/pad to PerpetualSoftware/pad across the entire
repo and updates the product subtitle to "Collaborate with your AI
agents".

Go module rename
- go.mod: github.com/xarmian/pad → github.com/PerpetualSoftware/pad
- All Go imports updated across cmd/pad, internal/{cli,server,store,
  models,collections,items,events,metrics,webhooks} (~130 files)
- Test fixtures with the literal repo slug ("xarmian/pad" in JSON
  shapes, SSH/HTTPS git URL strings, workspace_context fixtures)
  also updated, including the secondary repo entry
  (xarmian/pad-web → PerpetualSoftware/pad-web — pad-web was also
  moved to the org per branch context)

Docs / config
- README badges, install instructions, brew tap, Docker image, source
  build path, sponsor link (sponsor link kept as personal @xarmian)
- Subtitle: "Project management for developers and AI agents." →
  "Collaborate with your AI agents." (README, manifests, web layout
  meta, .goreleaser homebrew description)
- CONTRIBUTING.md, SECURITY.md, skills/INSTALL.md
- .goreleaser.yaml: homebrew_casks owner, GHCR image, release github
  owner, cosign cert-identity regex, comments
- .github/workflows/release.yml: tap/release comments
- deploy/k8s/deployment.yaml: container image
- docs/deployment.md: clone URL
- web/static/{site.webmanifest,manifest.json}: description
- web/src/routes/+layout.svelte: meta description + og:description

Brew tap path is PerpetualSoftware/tap/pad (CamelCase, matches
GitHub user case). GHCR image is ghcr.io/perpetualsoftware/pad
(lowercased per GHCR's URL normalization). CODEOWNERS @xarmian and
FUNDING.yml github: xarmian intentionally retained — those are the
personal maintainer / sponsor account, separate from the org repo.

Verification: go build ./..., go test ./... (all pkgs pass), web
build, and make install all clean (TASK-844, TASK-845).
2026-04-28 12:26:39 -04:00

108 lines
4.1 KiB
Go

package cli
import (
"os"
"path/filepath"
"testing"
"github.com/PerpetualSoftware/pad/internal/config"
)
func TestDetectProjectCapturesMakeAndNestedWebSignals(t *testing.T) {
dir := t.TempDir()
if err := os.WriteFile(filepath.Join(dir, "go.mod"), []byte("module example.com/test\n"), 0644); err != nil {
t.Fatalf("write go.mod: %v", err)
}
if err := os.WriteFile(filepath.Join(dir, "Makefile"), []byte("install:\n\tgo build ./...\n\nbuild:\n\tgo build ./...\n\ntest:\n\tgo test ./...\n\ndev:\n\tgo run ./cmd/pad\n"), 0644); err != nil {
t.Fatalf("write Makefile: %v", err)
}
if err := os.MkdirAll(filepath.Join(dir, "web"), 0755); err != nil {
t.Fatalf("mkdir web: %v", err)
}
if err := os.WriteFile(filepath.Join(dir, "web", "package.json"), []byte(`{"dependencies":{"@sveltejs/kit":"^2.0.0"},"scripts":{"build":"vite build","dev":"vite dev","lint":"eslint ."}}`), 0644); err != nil {
t.Fatalf("write package.json: %v", err)
}
info := DetectProject(dir)
if info.Language != "go" {
t.Fatalf("expected language go, got %q", info.Language)
}
if info.BuildCmd != "make build" {
t.Fatalf("expected build command make build, got %q", info.BuildCmd)
}
if info.SetupCmd != "make install" {
t.Fatalf("expected setup command make install, got %q", info.SetupCmd)
}
if info.DevCmd != "make dev" {
t.Fatalf("expected dev command make dev, got %q", info.DevCmd)
}
if info.WebBuildCmd != "npm run build" {
t.Fatalf("expected web build command npm run build, got %q", info.WebBuildCmd)
}
if len(info.Frameworks) == 0 || info.Frameworks[0] != "sveltekit" {
t.Fatalf("expected sveltekit framework detection, got %#v", info.Frameworks)
}
}
func TestBuildWorkspaceContext(t *testing.T) {
dir := t.TempDir()
if err := os.MkdirAll(filepath.Join(dir, "web"), 0755); err != nil {
t.Fatalf("mkdir web: %v", err)
}
if err := os.MkdirAll(filepath.Join(dir, "internal", "server"), 0755); err != nil {
t.Fatalf("mkdir server: %v", err)
}
if err := os.MkdirAll(filepath.Join(dir, "skills"), 0755); err != nil {
t.Fatalf("mkdir skills: %v", err)
}
if err := os.MkdirAll(filepath.Join(dir, "..", "pad-web"), 0755); err != nil {
t.Fatalf("mkdir docs repo: %v", err)
}
if err := os.WriteFile(filepath.Join(dir, "..", "pad-web", "package.json"), []byte(`{}`), 0644); err != nil {
t.Fatalf("write sibling package.json: %v", err)
}
info := ProjectInfo{
Language: "go",
BuildCmd: "make build",
SetupCmd: "make install",
TestCmd: "go test ./...",
WebBuildCmd: "npm run build",
PackageManagers: []string{"go", "npm"},
Frameworks: []string{"sveltekit"},
}
cfg := &config.Config{Mode: config.ModeLocal, URL: "http://127.0.0.1:7777", Host: "127.0.0.1"}
context := BuildWorkspaceContext(dir, info, cfg)
if context.Paths == nil || context.Paths.Web != "web" {
t.Fatalf("expected web path, got %#v", context.Paths)
}
if context.Paths == nil || context.Paths.DocsRepo != "../pad-web" {
t.Fatalf("expected docs repo path, got %#v", context.Paths)
}
if context.Commands == nil || context.Commands.Setup != "make install" {
t.Fatalf("expected setup command, got %#v", context.Commands)
}
if context.Stack == nil || len(context.Stack.PackageManagers) != 2 {
t.Fatalf("expected package managers, got %#v", context.Stack)
}
if context.Deployment == nil || context.Deployment.Mode != config.ModeLocal {
t.Fatalf("expected local deployment, got %#v", context.Deployment)
}
if len(context.Repositories) < 2 {
t.Fatalf("expected primary and docs repositories, got %#v", context.Repositories)
}
}
func TestNormalizeGitRemoteSlug(t *testing.T) {
if got := normalizeGitRemoteSlug("git@github.com:PerpetualSoftware/pad.git\n"); got != "PerpetualSoftware/pad" {
t.Fatalf("expected SSH slug PerpetualSoftware/pad, got %q", got)
}
if got := normalizeGitRemoteSlug("https://github.com/PerpetualSoftware/pad.git"); got != "PerpetualSoftware/pad" {
t.Fatalf("expected HTTPS slug PerpetualSoftware/pad, got %q", got)
}
if got := normalizeGitRemoteSlug("ssh://git@example.com/foo"); got != "" {
t.Fatalf("expected unsupported remote to be blank, got %q", got)
}
}