printProjectMetadata writes the human-readable view of a project row.
(db *sql.DB, p *flowdb.Project, root string)
| 399 | |
| 400 | // printProjectMetadata writes the human-readable view of a project row. |
| 401 | func printProjectMetadata(db *sql.DB, p *flowdb.Project, root string) { |
| 402 | archivedMarker := "" |
| 403 | if p.ArchivedAt.Valid { |
| 404 | archivedMarker = " (archived)" |
| 405 | } |
| 406 | fmt.Printf("slug: %s%s\n", p.Slug, archivedMarker) |
| 407 | fmt.Printf("name: %s\n", p.Name) |
| 408 | fmt.Printf("status: %s\n", p.Status) |
| 409 | fmt.Printf("priority: %s\n", p.Priority) |
| 410 | |
| 411 | wdLine := p.WorkDir |
| 412 | if wd, err := flowdb.GetWorkdir(db, p.WorkDir); err == nil { |
| 413 | var parts []string |
| 414 | if wd.Name.Valid && wd.Name.String != "" { |
| 415 | parts = append(parts, "known: "+wd.Name.String) |
| 416 | } else { |
| 417 | parts = append(parts, "known") |
| 418 | } |
| 419 | if wd.GitRemote.Valid && wd.GitRemote.String != "" { |
| 420 | parts = append(parts, "origin: "+wd.GitRemote.String) |
| 421 | } |
| 422 | wdLine = fmt.Sprintf("%s [%s]", p.WorkDir, strings.Join(parts, ", ")) |
| 423 | } |
| 424 | fmt.Printf("work_dir: %s\n", wdLine) |
| 425 | |
| 426 | fmt.Printf("created: %s\n", p.CreatedAt) |
| 427 | fmt.Printf("updated: %s\n", p.UpdatedAt) |
| 428 | if p.ArchivedAt.Valid { |
| 429 | fmt.Printf("archived: %s\n", p.ArchivedAt.String) |
| 430 | } |
| 431 | briefPath := filepath.Join(root, "projects", p.Slug, "brief.md") |
| 432 | fmt.Printf("brief: %s\n", briefPath) |
| 433 | |
| 434 | updates := listUpdateFiles(filepath.Join(root, "projects", p.Slug, "updates")) |
| 435 | if len(updates) == 0 { |
| 436 | fmt.Println("updates: (none)") |
| 437 | } else { |
| 438 | fmt.Println("updates:") |
| 439 | for _, u := range updates { |
| 440 | fmt.Printf(" - %s\n", u) |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | // Auxiliary .md files (sidecar references — not eagerly loaded). |
| 445 | auxFiles, auxErr := enumerateAuxFiles(filepath.Join(root, "projects", p.Slug)) |
| 446 | if auxErr != nil { |
| 447 | fmt.Fprintf(os.Stderr, "warning: enumerate aux files: %v\n", auxErr) |
| 448 | } |
| 449 | if len(auxFiles) == 0 { |
| 450 | fmt.Println("other: (none)") |
| 451 | } else { |
| 452 | fmt.Println("other:") |
| 453 | for _, fp := range auxFiles { |
| 454 | fmt.Printf(" - %s\n", fp) |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | // Knowledge-base files, same as on `flow show task`. |
no test coverage detected