refactor(cmd): consolidate styles across dev, php, and sdk packages
- dev: Replace hardcoded colours in ci, issues, reviews, impact, work - php: Use shared colour constants and deploy styles - sdk: Replace local styles with shared aliases - shared: Add Yellow500, Emerald500, Purple500 colours - shared: Add PrNumberStyle and deploy status styles Removes 111 lines of duplicate style definitions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
90a049b937
commit
c28d778322
9 changed files with 70 additions and 111 deletions
|
|
@ -8,27 +8,17 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/host-uk/core/cmd/shared"
|
||||
"github.com/host-uk/core/pkg/repos"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// CI-specific styles
|
||||
// CI-specific styles (aliases to shared)
|
||||
var (
|
||||
ciSuccessStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#22c55e")) // green-500
|
||||
|
||||
ciFailureStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#ef4444")) // red-500
|
||||
|
||||
ciPendingStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#f59e0b")) // amber-500
|
||||
|
||||
ciSkippedStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#6b7280")) // gray-500
|
||||
ciSuccessStyle = shared.SuccessStyle
|
||||
ciFailureStyle = shared.ErrorStyle
|
||||
ciPendingStyle = shared.StatusWarningStyle
|
||||
ciSkippedStyle = shared.DimStyle
|
||||
)
|
||||
|
||||
// WorkflowRun represents a GitHub Actions workflow run
|
||||
|
|
|
|||
|
|
@ -4,23 +4,16 @@ import (
|
|||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/host-uk/core/cmd/shared"
|
||||
"github.com/host-uk/core/pkg/repos"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// Impact-specific styles
|
||||
// Impact-specific styles (aliases to shared)
|
||||
var (
|
||||
impactDirectStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#ef4444")) // red-500
|
||||
|
||||
impactIndirectStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#f59e0b")) // amber-500
|
||||
|
||||
impactSafeStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#22c55e")) // green-500
|
||||
impactDirectStyle = shared.ErrorStyle
|
||||
impactIndirectStyle = shared.StatusWarningStyle
|
||||
impactSafeStyle = shared.StatusSuccessStyle
|
||||
)
|
||||
|
||||
// Impact command flags
|
||||
|
|
|
|||
|
|
@ -9,32 +9,19 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/host-uk/core/cmd/shared"
|
||||
"github.com/host-uk/core/pkg/repos"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// Issue-specific styles
|
||||
// Issue-specific styles (aliases to shared)
|
||||
var (
|
||||
issueRepoStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#6b7280")) // gray-500
|
||||
|
||||
issueNumberStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#3b82f6")) // blue-500
|
||||
|
||||
issueTitleStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#e2e8f0")) // gray-200
|
||||
|
||||
issueLabelStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#f59e0b")) // amber-500
|
||||
|
||||
issueAssigneeStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#22c55e")) // green-500
|
||||
|
||||
issueAgeStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#6b7280")) // gray-500
|
||||
issueRepoStyle = shared.DimStyle
|
||||
issueNumberStyle = shared.TitleStyle
|
||||
issueTitleStyle = shared.ValueStyle
|
||||
issueLabelStyle = shared.WarningStyle
|
||||
issueAssigneeStyle = shared.StatusSuccessStyle
|
||||
issueAgeStyle = shared.DimStyle
|
||||
)
|
||||
|
||||
// GitHubIssue represents a GitHub issue from the API.
|
||||
|
|
|
|||
|
|
@ -9,37 +9,20 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/host-uk/core/cmd/shared"
|
||||
"github.com/host-uk/core/pkg/repos"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// PR-specific styles
|
||||
// PR-specific styles (aliases to shared)
|
||||
var (
|
||||
prNumberStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#a855f7")) // purple-500
|
||||
|
||||
prTitleStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#e2e8f0")) // gray-200
|
||||
|
||||
prAuthorStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#3b82f6")) // blue-500
|
||||
|
||||
prApprovedStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#22c55e")) // green-500
|
||||
|
||||
prChangesStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#f59e0b")) // amber-500
|
||||
|
||||
prPendingStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#6b7280")) // gray-500
|
||||
|
||||
prDraftStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#6b7280")) // gray-500
|
||||
prNumberStyle = shared.PrNumberStyle
|
||||
prTitleStyle = shared.ValueStyle
|
||||
prAuthorStyle = shared.InfoStyle
|
||||
prApprovedStyle = shared.SuccessStyle
|
||||
prChangesStyle = shared.WarningStyle
|
||||
prPendingStyle = shared.DimStyle
|
||||
prDraftStyle = shared.DimStyle
|
||||
)
|
||||
|
||||
// GitHubPR represents a GitHub pull request.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/host-uk/core/cmd/shared"
|
||||
"github.com/host-uk/core/pkg/git"
|
||||
"github.com/host-uk/core/pkg/repos"
|
||||
|
|
@ -125,8 +124,7 @@ func runWork(registryPath string, statusOnly, autoCommit bool) error {
|
|||
// Auto-commit dirty repos if requested
|
||||
if autoCommit && len(dirtyRepos) > 0 {
|
||||
fmt.Println()
|
||||
hdrStyle := lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("#3b82f6"))
|
||||
fmt.Printf("%s\n", hdrStyle.Render("Committing dirty repos with Claude..."))
|
||||
fmt.Printf("%s\n", shared.TitleStyle.Render("Committing dirty repos with Claude..."))
|
||||
fmt.Println()
|
||||
|
||||
for _, s := range dirtyRepos {
|
||||
|
|
@ -211,14 +209,13 @@ func printStatusTable(statuses []git.RepoStatus) {
|
|||
}
|
||||
|
||||
// Print header with fixed-width formatting
|
||||
hdrStyle := lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("#3b82f6"))
|
||||
fmt.Printf("%-*s %8s %9s %6s %5s\n",
|
||||
nameWidth,
|
||||
hdrStyle.Render("Repo"),
|
||||
hdrStyle.Render("Modified"),
|
||||
hdrStyle.Render("Untracked"),
|
||||
hdrStyle.Render("Staged"),
|
||||
hdrStyle.Render("Ahead"),
|
||||
shared.TitleStyle.Render("Repo"),
|
||||
shared.TitleStyle.Render("Modified"),
|
||||
shared.TitleStyle.Render("Untracked"),
|
||||
shared.TitleStyle.Render("Staged"),
|
||||
shared.TitleStyle.Render("Ahead"),
|
||||
)
|
||||
|
||||
// Print separator
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ var (
|
|||
// Service colors for log output (domain-specific, keep local)
|
||||
var (
|
||||
phpFrankenPHPStyle = lipgloss.NewStyle().Foreground(shared.ColourIndigo500)
|
||||
phpViteStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#eab308")) // yellow-500
|
||||
phpViteStyle = lipgloss.NewStyle().Foreground(shared.ColourYellow500)
|
||||
phpHorizonStyle = lipgloss.NewStyle().Foreground(shared.ColourOrange500)
|
||||
phpReverbStyle = lipgloss.NewStyle().Foreground(shared.ColourViolet500)
|
||||
phpRedisStyle = lipgloss.NewStyle().Foreground(shared.ColourRed500)
|
||||
|
|
|
|||
|
|
@ -6,21 +6,16 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/host-uk/core/cmd/shared"
|
||||
phppkg "github.com/host-uk/core/pkg/php"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// Deploy command styles
|
||||
// Deploy command styles (aliases to shared)
|
||||
var (
|
||||
phpDeployStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#10b981")) // emerald-500
|
||||
|
||||
phpDeployPendingStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#f59e0b")) // amber-500
|
||||
|
||||
phpDeployFailedStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#ef4444")) // red-500
|
||||
phpDeployStyle = shared.DeploySuccessStyle
|
||||
phpDeployPendingStyle = shared.StatusWarningStyle
|
||||
phpDeployFailedStyle = shared.StatusErrorStyle
|
||||
)
|
||||
|
||||
func addPHPDeployCommands(parent *cobra.Command) {
|
||||
|
|
|
|||
|
|
@ -5,26 +5,17 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/host-uk/core/cmd/shared"
|
||||
sdkpkg "github.com/host-uk/core/pkg/sdk"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// SDK styles (aliases to shared)
|
||||
var (
|
||||
sdkHeaderStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#3b82f6"))
|
||||
|
||||
sdkSuccessStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#22c55e"))
|
||||
|
||||
sdkErrorStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#ef4444"))
|
||||
|
||||
sdkDimStyle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#6b7280"))
|
||||
sdkHeaderStyle = shared.TitleStyle
|
||||
sdkSuccessStyle = shared.SuccessStyle
|
||||
sdkErrorStyle = shared.ErrorStyle
|
||||
sdkDimStyle = shared.DimStyle
|
||||
)
|
||||
|
||||
var sdkCmd = &cobra.Command{
|
||||
|
|
|
|||
|
|
@ -37,11 +37,14 @@ const (
|
|||
ColourAmber400 = lipgloss.Color("#fbbf24")
|
||||
ColourAmber500 = lipgloss.Color("#f59e0b")
|
||||
ColourAmber600 = lipgloss.Color("#d97706")
|
||||
ColourOrange500 = lipgloss.Color("#f97316")
|
||||
ColourViolet400 = lipgloss.Color("#a78bfa")
|
||||
ColourViolet500 = lipgloss.Color("#8b5cf6")
|
||||
ColourIndigo500 = lipgloss.Color("#6366f1")
|
||||
ColourCyan500 = lipgloss.Color("#06b6d4")
|
||||
ColourOrange500 = lipgloss.Color("#f97316")
|
||||
ColourYellow500 = lipgloss.Color("#eab308")
|
||||
ColourEmerald500 = lipgloss.Color("#10b981")
|
||||
ColourPurple500 = lipgloss.Color("#a855f7")
|
||||
ColourViolet400 = lipgloss.Color("#a78bfa")
|
||||
ColourViolet500 = lipgloss.Color("#8b5cf6")
|
||||
ColourIndigo500 = lipgloss.Color("#6366f1")
|
||||
ColourCyan500 = lipgloss.Color("#06b6d4")
|
||||
ColourGray50 = lipgloss.Color("#f9fafb")
|
||||
ColourGray100 = lipgloss.Color("#f3f4f6")
|
||||
ColourGray200 = lipgloss.Color("#e5e7eb")
|
||||
|
|
@ -169,6 +172,11 @@ var (
|
|||
// NumberStyle for numeric values.
|
||||
NumberStyle = lipgloss.NewStyle().
|
||||
Foreground(ColourBlue300)
|
||||
|
||||
// PrNumberStyle for pull request numbers (purple, bold).
|
||||
PrNumberStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(ColourPurple500)
|
||||
)
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
|
@ -261,6 +269,21 @@ var (
|
|||
GitConflictStyle = lipgloss.NewStyle().Bold(true).Foreground(ColourRed500)
|
||||
)
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Deploy Styles (for deployment status display)
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
var (
|
||||
// DeploySuccessStyle for successful deployments (emerald).
|
||||
DeploySuccessStyle = lipgloss.NewStyle().Foreground(ColourEmerald500)
|
||||
|
||||
// DeployPendingStyle for pending deployments (amber).
|
||||
DeployPendingStyle = lipgloss.NewStyle().Foreground(ColourAmber500)
|
||||
|
||||
// DeployFailedStyle for failed deployments (red).
|
||||
DeployFailedStyle = lipgloss.NewStyle().Foreground(ColourRed500)
|
||||
)
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Box Styles (for bordered content)
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue