mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-09-11 21:39:01 +00:00
7cda0d7896
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).
168 lines
4.7 KiB
Go
168 lines
4.7 KiB
Go
package cli
|
|
|
|
import (
|
|
"bytes"
|
|
"os/exec"
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"github.com/PerpetualSoftware/pad/internal/config"
|
|
"github.com/PerpetualSoftware/pad/internal/models"
|
|
)
|
|
|
|
// BuildWorkspaceContext converts detected project metadata plus the current Pad
|
|
// client configuration into a machine-readable workspace context.
|
|
func BuildWorkspaceContext(dir string, info ProjectInfo, cfg *config.Config) *models.WorkspaceContext {
|
|
context := &models.WorkspaceContext{
|
|
Repositories: detectWorkspaceRepositories(dir),
|
|
Paths: detectWorkspacePaths(dir),
|
|
Commands: detectWorkspaceCommands(info),
|
|
Stack: &models.WorkspaceStack{
|
|
Languages: uniqueNonEmpty([]string{info.Language}),
|
|
Frameworks: uniqueNonEmpty(info.Frameworks),
|
|
PackageManagers: uniqueNonEmpty(info.PackageManagers),
|
|
},
|
|
Deployment: detectWorkspaceDeployment(cfg),
|
|
Assumptions: detectWorkspaceAssumptions(dir, cfg),
|
|
}
|
|
|
|
if len(context.Repositories) == 0 {
|
|
context.Repositories = nil
|
|
}
|
|
if context.Paths != nil && *context.Paths == (models.WorkspacePaths{}) {
|
|
context.Paths = nil
|
|
}
|
|
if context.Commands != nil && *context.Commands == (models.WorkspaceCommands{}) {
|
|
context.Commands = nil
|
|
}
|
|
if context.Stack != nil && len(context.Stack.Languages) == 0 && len(context.Stack.Frameworks) == 0 && len(context.Stack.PackageManagers) == 0 {
|
|
context.Stack = nil
|
|
}
|
|
if context.Deployment != nil && *context.Deployment == (models.WorkspaceDeployment{}) {
|
|
context.Deployment = nil
|
|
}
|
|
if len(context.Assumptions) == 0 {
|
|
context.Assumptions = nil
|
|
}
|
|
|
|
return context
|
|
}
|
|
|
|
func detectWorkspaceRepositories(dir string) []models.WorkspaceRepository {
|
|
var repos []models.WorkspaceRepository
|
|
repos = append(repos, models.WorkspaceRepository{
|
|
Name: filepath.Base(dir),
|
|
Role: "primary",
|
|
Path: ".",
|
|
Repo: detectGitRemoteSlug(dir),
|
|
})
|
|
|
|
docsPath := filepath.Join(dir, "..", "pad-web")
|
|
if fileExists(docsPath, "package.json") {
|
|
repos = append(repos, models.WorkspaceRepository{
|
|
Name: filepath.Base(docsPath),
|
|
Role: "docs",
|
|
Path: "../pad-web",
|
|
Repo: detectGitRemoteSlug(docsPath),
|
|
})
|
|
}
|
|
|
|
return repos
|
|
}
|
|
|
|
func detectWorkspacePaths(dir string) *models.WorkspacePaths {
|
|
paths := &models.WorkspacePaths{
|
|
Root: ".",
|
|
}
|
|
if fileExists(filepath.Join(dir, "..", "pad-web"), "package.json") {
|
|
paths.DocsRepo = "../pad-web"
|
|
}
|
|
if fileExists(dir, "package.json") {
|
|
paths.Web = "."
|
|
} else if dirExists(dir, "web") {
|
|
paths.Web = "web"
|
|
}
|
|
if dirExists(dir, "internal", "server") {
|
|
paths.Server = "internal/server"
|
|
}
|
|
if dirExists(dir, "skills") {
|
|
paths.Skills = "skills"
|
|
}
|
|
if fileExists(dir, ".pad.toml") {
|
|
paths.Config = ".pad.toml"
|
|
}
|
|
return paths
|
|
}
|
|
|
|
func detectWorkspaceCommands(info ProjectInfo) *models.WorkspaceCommands {
|
|
return &models.WorkspaceCommands{
|
|
Setup: info.SetupCmd,
|
|
Build: info.BuildCmd,
|
|
Test: info.TestCmd,
|
|
Lint: info.LintCmd,
|
|
Dev: info.DevCmd,
|
|
Start: info.DevCmd,
|
|
Web: info.WebBuildCmd,
|
|
Format: "",
|
|
}
|
|
}
|
|
|
|
func detectWorkspaceDeployment(cfg *config.Config) *models.WorkspaceDeployment {
|
|
if cfg == nil {
|
|
return nil
|
|
}
|
|
|
|
deployment := &models.WorkspaceDeployment{
|
|
Mode: cfg.Mode,
|
|
BaseURL: cfg.BaseURL(),
|
|
}
|
|
if cfg.Mode == config.ModeLocal {
|
|
deployment.Host = cfg.Host
|
|
}
|
|
return deployment
|
|
}
|
|
|
|
func detectWorkspaceAssumptions(dir string, cfg *config.Config) []string {
|
|
var assumptions []string
|
|
if fileExists(filepath.Join(dir, "..", "pad-web"), "package.json") {
|
|
assumptions = append(assumptions, "A companion docs or marketing repo lives at ../pad-web")
|
|
}
|
|
if cfg != nil {
|
|
switch cfg.Mode {
|
|
case config.ModeCloud:
|
|
assumptions = append(assumptions, "This client connects to Pad Cloud at "+config.CloudBaseURL)
|
|
case config.ModeRemote:
|
|
assumptions = append(assumptions, "This client connects to a self-hosted remote Pad server")
|
|
case config.ModeLocal:
|
|
assumptions = append(assumptions, "This client manages a local Pad server by default")
|
|
}
|
|
}
|
|
if dirExists(dir, "web") && dirExists(dir, "internal", "server") {
|
|
assumptions = append(assumptions, "This repository contains both server and web application surfaces")
|
|
}
|
|
return uniqueNonEmpty(assumptions)
|
|
}
|
|
|
|
func detectGitRemoteSlug(dir string) string {
|
|
cmd := exec.Command("git", "-C", dir, "remote", "get-url", "origin")
|
|
var out bytes.Buffer
|
|
cmd.Stdout = &out
|
|
if err := cmd.Run(); err != nil {
|
|
return ""
|
|
}
|
|
return normalizeGitRemoteSlug(out.String())
|
|
}
|
|
|
|
func normalizeGitRemoteSlug(raw string) string {
|
|
raw = strings.TrimSpace(raw)
|
|
raw = strings.TrimSuffix(raw, ".git")
|
|
switch {
|
|
case strings.HasPrefix(raw, "git@github.com:"):
|
|
return strings.TrimPrefix(raw, "git@github.com:")
|
|
case strings.HasPrefix(raw, "https://github.com/"):
|
|
return strings.TrimPrefix(raw, "https://github.com/")
|
|
default:
|
|
return ""
|
|
}
|
|
}
|