mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-09-24 03:16:43 +00:00
bde15d45ca
* Rename "Phases" to "Plans" and clean up deprecated phase aliases
Renames the default "Phases" collection to "Plans" across the full stack:
- DB migration renames existing collections in-place (name, slug, prefix PLAN, icon 🗺️)
- Removes all deprecated Phase* backward-compat aliases from models and store
- Removes --phase CLI flag (use --parent instead)
- Updates convention triggers: on-phase-start/complete → on-plan-start/complete
- Updates dashboard API: active_phases → active_plans, /phases-progress → /plans-progress
- Updates all frontend components, types, and documentation
Closes IDEA-124
* Fix CSRF cookie not being cleared on logout
The SessionAuth middleware was re-issuing a CSRF cookie before the
logout handler could clear it, resulting in two Set-Cookie headers.
Skip CSRF re-issue for /api/v1/auth/ paths since auth endpoints
manage their own CSRF cookies (login sets, logout clears).
* Fix migration issues found in Codex review
- P1: Move doc_type UPDATE from migration 024 into 025, which recreates
the table with the new CHECK constraint first (SQLite enforces CHECK
on UPDATE, so the old constraint would reject 'plan')
- P1: Add PostgreSQL migration 005 for the collection rename (phases →
plans) — previously only existed on the SQLite path
- P2: Recreate FTS triggers, indexes, and rebuild FTS after the table
swap in migration 025 (DROP TABLE drops associated objects in SQLite)
* Fix parent filter field name and sync .agents skill copy
Codex review round 2 findings:
- P1: Parent filter compared against `parent_id` (wrong) instead of
`parent_link_id` — plan filtering in collection view was broken
- P1: .agents/skills/pad/SKILL.md still had old --phase flags and
"Phases" references — synced from the updated .claude copy
- P2: Accept legacy 'phase' filter key for backward compat with
existing saved views that serialized the old key name
* Fix PG migration JSONB casting and add slug collision guards
Codex PR review bot findings:
- P1: PostgreSQL REPLACE/LIKE don't work on JSONB columns — cast
schema::text and fields::text before string ops, then back to ::jsonb
- P1: If a workspace already has a custom 'plans' collection, the
rename hits UNIQUE(workspace_id, slug) — added NOT EXISTS guard
to both SQLite and PostgreSQL migrations
288 lines
9.1 KiB
Go
288 lines
9.1 KiB
Go
package collections
|
|
|
|
import "github.com/xarmian/pad/internal/models"
|
|
|
|
// DefaultCollection holds the definition for a default collection that gets
|
|
// created when a workspace is initialized.
|
|
type DefaultCollection struct {
|
|
Name string
|
|
Slug string
|
|
Icon string
|
|
Description string
|
|
Schema models.CollectionSchema
|
|
Settings models.CollectionSettings
|
|
SortOrder int
|
|
}
|
|
|
|
// Defaults returns the six default collections for a new workspace.
|
|
func Defaults() []DefaultCollection {
|
|
return []DefaultCollection{
|
|
{
|
|
Name: "Tasks",
|
|
Slug: "tasks",
|
|
Icon: "✓",
|
|
Description: "Track work items, bugs, and to-dos",
|
|
SortOrder: 0,
|
|
Schema: models.CollectionSchema{
|
|
Fields: []models.FieldDef{
|
|
{
|
|
Key: "status",
|
|
Label: "Status",
|
|
Type: "select",
|
|
Options: []string{"open", "in-progress", "done", "cancelled"},
|
|
TerminalOptions: []string{"done", "cancelled"},
|
|
Default: "open",
|
|
Required: true,
|
|
},
|
|
{
|
|
Key: "priority",
|
|
Label: "Priority",
|
|
Type: "select",
|
|
Options: []string{"low", "medium", "high", "critical"},
|
|
Default: "medium",
|
|
},
|
|
{
|
|
Key: "due_date",
|
|
Label: "Due Date",
|
|
Type: "date",
|
|
},
|
|
{
|
|
Key: "effort",
|
|
Label: "Effort",
|
|
Type: "select",
|
|
Options: []string{"xs", "s", "m", "l", "xl"},
|
|
},
|
|
},
|
|
},
|
|
Settings: models.CollectionSettings{
|
|
Layout: "fields-primary",
|
|
DefaultView: "board",
|
|
BoardGroupBy: "status",
|
|
ListSortBy: "priority",
|
|
QuickActions: []models.QuickAction{
|
|
{Label: "Implement this", Prompt: "/pad implement {ref} \"{title}\" (status: {status}, priority: {priority})", Scope: "item", Icon: "🔨"},
|
|
{Label: "Write tests", Prompt: "/pad write tests for {ref} \"{title}\"", Scope: "item", Icon: "🧪"},
|
|
{Label: "Explain this task", Prompt: "/pad explain {ref} \"{title}\" — what does it involve and why is it needed?", Scope: "item", Icon: "💬"},
|
|
{Label: "Triage open tasks", Prompt: "/pad triage all open tasks and suggest priorities", Scope: "collection", Icon: "📋"},
|
|
{Label: "Status report", Prompt: "/pad summarize progress on all tasks", Scope: "collection", Icon: "📊"},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
Name: "Ideas",
|
|
Slug: "ideas",
|
|
Icon: "💡",
|
|
Description: "Capture ideas, feature requests, and inspiration",
|
|
SortOrder: 1,
|
|
Schema: models.CollectionSchema{
|
|
Fields: []models.FieldDef{
|
|
{
|
|
Key: "status",
|
|
Label: "Status",
|
|
Type: "select",
|
|
Options: []string{"new", "exploring", "planned", "implemented", "rejected"},
|
|
TerminalOptions: []string{"implemented", "rejected"},
|
|
Default: "new",
|
|
Required: true,
|
|
},
|
|
{
|
|
Key: "impact",
|
|
Label: "Impact",
|
|
Type: "select",
|
|
Options: []string{"low", "medium", "high"},
|
|
},
|
|
{
|
|
Key: "category",
|
|
Label: "Category",
|
|
Type: "text",
|
|
},
|
|
},
|
|
},
|
|
Settings: models.CollectionSettings{
|
|
Layout: "balanced",
|
|
DefaultView: "list",
|
|
ListSortBy: "created_at",
|
|
ListGroupBy: "status",
|
|
QuickActions: []models.QuickAction{
|
|
{Label: "Explore this idea", Prompt: "/pad explore {ref} \"{title}\" — research feasibility, trade-offs, and implementation approaches", Scope: "item", Icon: "🔍"},
|
|
{Label: "Break into tasks", Prompt: "/pad break down {ref} \"{title}\" into actionable tasks", Scope: "item", Icon: "📝"},
|
|
{Label: "Research this", Prompt: "/pad research {ref} \"{title}\" and summarize findings", Scope: "item", Icon: "📚"},
|
|
{Label: "Review all new ideas", Prompt: "/pad triage all new ideas and suggest which to pursue", Scope: "collection", Icon: "💡"},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
Name: "Plans",
|
|
Slug: "plans",
|
|
Icon: "🗺️",
|
|
Description: "Plan and track project plans and milestones",
|
|
SortOrder: 2,
|
|
Schema: models.CollectionSchema{
|
|
Fields: []models.FieldDef{
|
|
{
|
|
Key: "status",
|
|
Label: "Status",
|
|
Type: "select",
|
|
Options: []string{"planned", "active", "completed", "paused"},
|
|
TerminalOptions: []string{"completed"},
|
|
Default: "planned",
|
|
Required: true,
|
|
},
|
|
{
|
|
Key: "start_date",
|
|
Label: "Start Date",
|
|
Type: "date",
|
|
},
|
|
{
|
|
Key: "end_date",
|
|
Label: "End Date",
|
|
Type: "date",
|
|
},
|
|
{
|
|
Key: "progress",
|
|
Label: "Progress",
|
|
Type: "number",
|
|
Suffix: "%",
|
|
Computed: true,
|
|
},
|
|
},
|
|
},
|
|
Settings: models.CollectionSettings{
|
|
Layout: "content-primary",
|
|
DefaultView: "list",
|
|
ListSortBy: "sort_order",
|
|
QuickActions: []models.QuickAction{
|
|
{Label: "Plan this", Prompt: "/pad plan {ref} \"{title}\" — outline goals, deliverables, and timeline", Scope: "item", Icon: "📐"},
|
|
{Label: "Break into tasks", Prompt: "/pad break {ref} \"{title}\" into PR-sized tasks", Scope: "item", Icon: "📝"},
|
|
{Label: "Run a retro", Prompt: "/pad run a retrospective on {ref} \"{title}\"", Scope: "item", Icon: "🔄"},
|
|
{Label: "Compare progress", Prompt: "/pad compare progress across all plans", Scope: "collection", Icon: "📊"},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
Name: "Docs",
|
|
Slug: "docs",
|
|
Icon: "📄",
|
|
Description: "Documentation, notes, and reference material",
|
|
SortOrder: 3,
|
|
Schema: models.CollectionSchema{
|
|
Fields: []models.FieldDef{
|
|
{
|
|
Key: "status",
|
|
Label: "Status",
|
|
Type: "select",
|
|
Options: []string{"draft", "published", "archived"},
|
|
TerminalOptions: []string{"archived"},
|
|
Default: "draft",
|
|
Required: true,
|
|
},
|
|
{
|
|
Key: "category",
|
|
Label: "Category",
|
|
Type: "text",
|
|
},
|
|
},
|
|
},
|
|
Settings: models.CollectionSettings{
|
|
Layout: "content-primary",
|
|
DefaultView: "list",
|
|
ListSortBy: "updated_at",
|
|
ListGroupBy: "category",
|
|
QuickActions: []models.QuickAction{
|
|
{Label: "Review this doc", Prompt: "/pad review {ref} \"{title}\" for accuracy and completeness", Scope: "item", Icon: "👀"},
|
|
{Label: "Update this doc", Prompt: "/pad update {ref} \"{title}\" to reflect the current state of the codebase", Scope: "item", Icon: "✏️"},
|
|
{Label: "Summarize this", Prompt: "/pad summarize {ref} \"{title}\"", Scope: "item", Icon: "📋"},
|
|
{Label: "Find outdated docs", Prompt: "/pad review all docs and identify which are outdated", Scope: "collection", Icon: "🔍"},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
Name: "Conventions",
|
|
Slug: "conventions",
|
|
Icon: "📏",
|
|
Description: "Project rules and conventions that guide agent behavior",
|
|
SortOrder: 4,
|
|
Schema: models.CollectionSchema{
|
|
Fields: []models.FieldDef{
|
|
{
|
|
Key: "status",
|
|
Label: "Status",
|
|
Type: "select",
|
|
Options: []string{"active", "draft", "disabled"},
|
|
TerminalOptions: []string{"disabled"},
|
|
Default: "active",
|
|
Required: true,
|
|
},
|
|
{
|
|
Key: "trigger",
|
|
Label: "When",
|
|
Type: "select",
|
|
Options: []string{"always", "on-task-start", "on-task-complete", "on-implement", "on-commit", "on-pr-create", "on-plan-start", "on-plan-complete", "on-plan"},
|
|
},
|
|
{
|
|
Key: "scope",
|
|
Label: "Scope",
|
|
Type: "select",
|
|
Options: []string{"all", "backend", "frontend", "mobile", "docs", "devops"},
|
|
},
|
|
{
|
|
Key: "priority",
|
|
Label: "Priority",
|
|
Type: "select",
|
|
Options: []string{"must", "should", "nice-to-have"},
|
|
},
|
|
{
|
|
Key: "role",
|
|
Label: "Role",
|
|
Type: "text",
|
|
},
|
|
},
|
|
},
|
|
Settings: models.CollectionSettings{
|
|
Layout: "balanced",
|
|
DefaultView: "list",
|
|
ListSortBy: "trigger",
|
|
ListGroupBy: "trigger",
|
|
},
|
|
},
|
|
{
|
|
Name: "Playbooks",
|
|
Slug: "playbooks",
|
|
Icon: "📘",
|
|
Description: "Multi-step workflows that agents follow for specific actions",
|
|
SortOrder: 5,
|
|
Schema: models.CollectionSchema{
|
|
Fields: []models.FieldDef{
|
|
{
|
|
Key: "status",
|
|
Label: "Status",
|
|
Type: "select",
|
|
Options: []string{"active", "draft", "deprecated"},
|
|
TerminalOptions: []string{"deprecated"},
|
|
Default: "draft",
|
|
Required: true,
|
|
},
|
|
{
|
|
Key: "trigger",
|
|
Label: "When",
|
|
Type: "select",
|
|
Options: []string{"on-implement", "on-triage", "on-release", "on-plan", "on-review", "on-deploy", "manual"},
|
|
},
|
|
{
|
|
Key: "scope",
|
|
Label: "Scope",
|
|
Type: "select",
|
|
Options: []string{"all", "backend", "frontend", "mobile", "devops"},
|
|
},
|
|
},
|
|
},
|
|
Settings: models.CollectionSettings{
|
|
Layout: "content-primary",
|
|
DefaultView: "list",
|
|
ListSortBy: "updated_at",
|
|
ListGroupBy: "trigger",
|
|
},
|
|
},
|
|
}
|
|
}
|