Skip to content

Commit 77eace2

Browse files
committed
refactor: remove emojis from cmd package
- Replace emoji outputs with ui package functions - Use ui.PrintOK, ui.PrintError, ui.PrintWarn, ui.PrintTitle consistently - Affected files: init, my_role, policy, convert, mcp, mcp_register, validate, dashboard
1 parent 0e6b825 commit 77eace2

File tree

8 files changed

+72
-80
lines changed

8 files changed

+72
-80
lines changed

internal/cmd/convert.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/DevSymphony/sym-cli/internal/config"
1313
"github.com/DevSymphony/sym-cli/internal/converter"
1414
"github.com/DevSymphony/sym-cli/internal/llm"
15+
"github.com/DevSymphony/sym-cli/internal/ui"
1516
"github.com/DevSymphony/sym-cli/pkg/schema"
1617
"github.com/spf13/cobra"
1718
)
@@ -112,8 +113,8 @@ func runNewConverter(userPolicy *schema.UserPolicy) error {
112113
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
113114
defer cancel()
114115

115-
fmt.Printf("\n🚀 Converting with language-based routing and parallel LLM inference\n")
116-
fmt.Printf("📂 Output: %s\n\n", convertOutputDir)
116+
ui.PrintTitle("Convert", "Language-based routing with parallel LLM inference")
117+
fmt.Printf("Output: %s\n\n", convertOutputDir)
117118

118119
// Convert
119120
result, err := conv.Convert(ctx, userPolicy)
@@ -122,23 +123,26 @@ func runNewConverter(userPolicy *schema.UserPolicy) error {
122123
}
123124

124125
// Print results
125-
fmt.Printf("\n✅ Conversion completed successfully!\n")
126-
fmt.Printf("📦 Generated %d configuration file(s):\n", len(result.GeneratedFiles))
126+
fmt.Println()
127+
ui.PrintOK("Conversion completed successfully")
128+
fmt.Printf("Generated %d configuration file(s):\n", len(result.GeneratedFiles))
127129
for _, file := range result.GeneratedFiles {
128-
fmt.Printf(" %s\n", file)
130+
fmt.Printf(" - %s\n", file)
129131
}
130132

131133
if len(result.Errors) > 0 {
132-
fmt.Printf("\n⚠️ Errors (%d):\n", len(result.Errors))
134+
fmt.Println()
135+
ui.PrintWarn(fmt.Sprintf("Errors (%d):", len(result.Errors)))
133136
for linter, err := range result.Errors {
134-
fmt.Printf(" %s: %v\n", linter, err)
137+
fmt.Printf(" - %s: %v\n", linter, err)
135138
}
136139
}
137140

138141
if len(result.Warnings) > 0 {
139-
fmt.Printf("\n⚠️ Warnings (%d):\n", len(result.Warnings))
142+
fmt.Println()
143+
ui.PrintWarn(fmt.Sprintf("Warnings (%d):", len(result.Warnings)))
140144
for _, warning := range result.Warnings {
141-
fmt.Printf(" %s\n", warning)
145+
fmt.Printf(" - %s\n", warning)
142146
}
143147
}
144148

internal/cmd/dashboard.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
"github.com/DevSymphony/sym-cli/internal/roles"
88
"github.com/DevSymphony/sym-cli/internal/server"
9+
"github.com/DevSymphony/sym-cli/internal/ui"
910

1011
"github.com/spf13/cobra"
1112
)
@@ -33,20 +34,20 @@ func runDashboard(cmd *cobra.Command, args []string) {
3334
// Check if roles.json exists
3435
exists, err := roles.RolesExists()
3536
if err != nil || !exists {
36-
fmt.Println("❌ roles.json not found")
37+
ui.PrintError("roles.json not found")
3738
fmt.Println("Run 'sym init' to create it")
3839
os.Exit(1)
3940
}
4041

4142
// Start server
4243
srv, err := server.NewServer(dashboardPort)
4344
if err != nil {
44-
fmt.Printf("❌ Failed to create server: %v\n", err)
45+
ui.PrintError(fmt.Sprintf("Failed to create server: %v", err))
4546
os.Exit(1)
4647
}
4748

4849
if err := srv.Start(); err != nil {
49-
fmt.Printf("❌ Failed to start server: %v\n", err)
50+
ui.PrintError(fmt.Sprintf("Failed to start server: %v", err))
5051
os.Exit(1)
5152
}
5253
}

internal/cmd/init.go

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,13 @@ func runInit(cmd *cobra.Command, args []string) {
9292
}
9393

9494
rolesPath, _ := roles.GetRolesPath()
95-
fmt.Println("✓ roles.json created successfully!")
96-
fmt.Printf(" Location: %s\n", rolesPath)
95+
ui.PrintOK("roles.json created")
96+
fmt.Println(ui.Indent(fmt.Sprintf("Location: %s", rolesPath)))
9797

9898
// Create default policy file with RBAC roles
99-
fmt.Println("\nCreating default policy file...")
10099
if err := createDefaultPolicy(); err != nil {
101-
fmt.Printf("⚠ Warning: Failed to create policy file: %v\n", err)
102-
fmt.Println("You can manually create it later using the dashboard")
100+
ui.PrintWarn(fmt.Sprintf("Failed to create policy file: %v", err))
101+
fmt.Println(ui.Indent("You can manually create it later using the dashboard"))
103102
} else {
104103
ui.PrintOK("user-policy.json created with default RBAC roles")
105104
}
@@ -113,9 +112,9 @@ func runInit(cmd *cobra.Command, args []string) {
113112

114113
// Set default role to admin during initialization
115114
if err := roles.SetCurrentRole("admin"); err != nil {
116-
fmt.Printf("⚠ Warning: Failed to save role selection: %v\n", err)
115+
ui.PrintWarn(fmt.Sprintf("Failed to save role selection: %v", err))
117116
} else {
118-
fmt.Println("✓ Your role has been set to: admin (default for initialization)")
117+
ui.PrintOK("Your role has been set to: admin")
119118
}
120119

121120
// MCP registration prompt
@@ -132,13 +131,9 @@ func runInit(cmd *cobra.Command, args []string) {
132131
fmt.Println()
133132
ui.PrintDone("Initialization complete")
134133
fmt.Println()
135-
fmt.Println("Dashboard features:")
136-
fmt.Println(" 📋 Manage roles - Configure permissions for each role")
137-
fmt.Println(" 📝 Edit policies - Create and modify coding conventions")
138-
fmt.Println(" 🎭 Change role - Select a different role anytime")
139-
fmt.Println(" ✅ Test validation - Check rules against your code in real-time")
140-
fmt.Println()
141-
fmt.Println("After setup, commit and push .sym/roles.json and .sym/user-policy.json to share with your team.")
134+
fmt.Println("Next steps:")
135+
fmt.Println(ui.Indent("Run 'sym dashboard' to manage roles and policies"))
136+
fmt.Println(ui.Indent("Commit .sym/ folder to share with your team"))
142137
}
143138

144139
// createDefaultPolicy creates a default policy file with RBAC roles

internal/cmd/mcp.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"github.com/DevSymphony/sym-cli/internal/git"
1010
"github.com/DevSymphony/sym-cli/internal/mcp"
11+
"github.com/DevSymphony/sym-cli/internal/ui"
1112
"github.com/pkg/browser"
1213
"github.com/spf13/cobra"
1314
)
@@ -60,15 +61,16 @@ func runMCP(cmd *cobra.Command, args []string) error {
6061

6162
// If no user-policy.json → Launch dashboard
6263
if !userPolicyExists {
63-
fmt.Println("❌ User policy not found at:", userPolicyPath)
64-
fmt.Println("📝 Opening dashboard to create policy...")
64+
ui.PrintError(fmt.Sprintf("User policy not found at: %s", userPolicyPath))
65+
fmt.Println("Opening dashboard to create policy...")
6566

6667
// Launch dashboard
6768
if err := launchDashboard(); err != nil {
6869
return fmt.Errorf("failed to launch dashboard: %w", err)
6970
}
7071

71-
fmt.Println("\n✓ Dashboard launched at http://localhost:8787")
72+
fmt.Println()
73+
ui.PrintOK("Dashboard launched at http://localhost:8787")
7274
fmt.Println("Please create your policy in the dashboard, then restart MCP server.")
7375
return nil
7476
}

internal/cmd/mcp_register.go

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,16 @@ type VSCodeServerConfig struct {
4444

4545
// MCP tool options for multi-select
4646
var mcpToolOptions = []string{
47-
"Claude Desktop (global)",
48-
"Claude Code (project)",
49-
"Cursor (project)",
50-
"VS Code Copilot (project)",
51-
"Cline (global)",
47+
"Claude Code",
48+
"Cursor",
49+
"VS Code Copilot",
5250
}
5351

5452
// mcpToolToApp maps display name to internal app identifier
5553
var mcpToolToApp = map[string]string{
56-
"Claude Desktop (global)": "claude-desktop",
57-
"Claude Code (project)": "claude-code",
58-
"Cursor (project)": "cursor",
59-
"VS Code Copilot (project)": "vscode",
60-
"Cline (global)": "cline",
54+
"Claude Code": "claude-code",
55+
"Cursor": "cursor",
56+
"VS Code Copilot": "vscode",
6157
}
6258

6359
// promptMCPRegistration prompts user to register Symphony as MCP server
@@ -85,6 +81,7 @@ func promptMCPRegistration() {
8581
fmt.Println()
8682
ui.PrintTitle("MCP", "Register Symphony as an MCP server")
8783
fmt.Println(ui.Indent("Symphony MCP provides code convention tools for AI assistants"))
84+
fmt.Println(ui.Indent("(Use arrows to move, space to select, enter to submit)"))
8885
fmt.Println()
8986

9087
// Multi-select prompt for tools
@@ -139,14 +136,8 @@ func registerMCP(app string) error {
139136
return fmt.Errorf("config path not determined")
140137
}
141138

142-
// Check if this is a project-specific config
143-
isProjectConfig := app != "claude-desktop" && app != "cline"
144-
145-
if isProjectConfig {
146-
fmt.Println(ui.Indent(fmt.Sprintf("Configuring %s (project-specific)", getAppDisplayName(app))))
147-
} else {
148-
fmt.Println(ui.Indent(fmt.Sprintf("Configuring %s (global)", getAppDisplayName(app))))
149-
}
139+
// All supported apps are now project-specific
140+
fmt.Println(ui.Indent(fmt.Sprintf("Configuring %s", getAppDisplayName(app))))
150141
fmt.Println(ui.Indent(fmt.Sprintf("Location: %s", configPath)))
151142

152143
// Create config directory if it doesn't exist
@@ -264,12 +255,9 @@ func registerMCP(app string) error {
264255

265256
fmt.Println(ui.Indent("Symphony MCP server registered"))
266257

267-
// Create instructions file for project-specific configs
268-
// Note: Cline has global MCP config but project-specific .clinerules
269-
if isProjectConfig || app == "cline" {
270-
if err := createInstructionsFile(app); err != nil {
271-
fmt.Println(ui.Indent(fmt.Sprintf("Failed to create instructions file: %v", err)))
272-
}
258+
// Create instructions file for all supported apps
259+
if err := createInstructionsFile(app); err != nil {
260+
fmt.Println(ui.Indent(fmt.Sprintf("Failed to create instructions file: %v", err)))
273261
}
274262

275263
return nil
@@ -419,9 +407,9 @@ func createInstructionsFile(app string) error {
419407
if app == "vscode" {
420408
gitignorePath := ".github/instructions/"
421409
if err := ensureGitignore(gitignorePath); err != nil {
422-
fmt.Printf(" ⚠ Warning: Failed to update .gitignore: %v\n", err)
410+
fmt.Println(ui.Indent(fmt.Sprintf("Warning: Failed to update .gitignore: %v", err)))
423411
} else {
424-
fmt.Printf(" ✓ Added %s to .gitignore\n", gitignorePath)
412+
fmt.Println(ui.Indent(fmt.Sprintf("Added %s to .gitignore", gitignorePath)))
425413
}
426414
}
427415

internal/cmd/my_role.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010

1111
"github.com/DevSymphony/sym-cli/internal/roles"
12+
"github.com/DevSymphony/sym-cli/internal/ui"
1213

1314
"github.com/spf13/cobra"
1415
)
@@ -41,8 +42,8 @@ func runMyRole(cmd *cobra.Command, args []string) {
4142
output := map[string]string{"error": "roles.json not found"}
4243
_ = json.NewEncoder(os.Stdout).Encode(output)
4344
} else {
44-
fmt.Println("❌ roles.json not found")
45-
fmt.Println("Run 'sym init' first")
45+
ui.PrintError("roles.json not found")
46+
fmt.Println(ui.Indent("Run 'sym init' first"))
4647
}
4748
os.Exit(1)
4849
}
@@ -67,32 +68,30 @@ func runMyRole(cmd *cobra.Command, args []string) {
6768
_ = json.NewEncoder(os.Stdout).Encode(output)
6869
} else {
6970
if role == "" {
70-
fmt.Println("⚠ No role selected")
71-
fmt.Println("Run 'sym my-role --select' to select a role")
72-
fmt.Println("Or use the dashboard: 'sym dashboard'")
71+
ui.PrintWarn("No role selected")
72+
fmt.Println(ui.Indent("Run 'sym my-role --select' to select a role"))
7373
} else {
7474
fmt.Printf("Current role: %s\n", role)
75-
fmt.Println("\nTo change your role:")
76-
fmt.Println(" sym my-role --select")
75+
fmt.Println(ui.Indent("Run 'sym my-role --select' to change"))
7776
}
7877
}
7978
}
8079

8180
func selectNewRole() {
8281
availableRoles, err := roles.GetAvailableRoles()
8382
if err != nil {
84-
fmt.Printf("❌ Failed to get available roles: %v\n", err)
83+
ui.PrintError(fmt.Sprintf("Failed to get available roles: %v", err))
8584
os.Exit(1)
8685
}
8786

8887
if len(availableRoles) == 0 {
89-
fmt.Println("❌ No roles defined in roles.json")
88+
ui.PrintError("No roles defined in roles.json")
9089
os.Exit(1)
9190
}
9291

9392
currentRole, _ := roles.GetCurrentRole()
9493

95-
fmt.Println("🎭 Select your role:")
94+
ui.PrintTitle("Role", "Select your role")
9695
fmt.Println()
9796
for i, role := range availableRoles {
9897
marker := " "
@@ -109,30 +108,30 @@ func selectNewRole() {
109108
input = strings.TrimSpace(input)
110109

111110
if input == "" {
112-
fmt.Println("⚠ No selection made")
111+
ui.PrintWarn("No selection made")
113112
return
114113
}
115114

116115
num, err := strconv.Atoi(input)
117116
if err != nil || num < 1 || num > len(availableRoles) {
118-
fmt.Println("❌ Invalid selection")
117+
ui.PrintError("Invalid selection")
119118
os.Exit(1)
120119
}
121120

122121
selectedRole := availableRoles[num-1]
123122
if err := roles.SetCurrentRole(selectedRole); err != nil {
124-
fmt.Printf("❌ Failed to save role: %v\n", err)
123+
ui.PrintError(fmt.Sprintf("Failed to save role: %v", err))
125124
os.Exit(1)
126125
}
127126

128-
fmt.Printf("✓ Your role has been changed to: %s\n", selectedRole)
127+
ui.PrintOK(fmt.Sprintf("Your role has been changed to: %s", selectedRole))
129128
}
130129

131130
func handleError(msg string, err error, jsonMode bool) {
132131
if jsonMode {
133132
output := map[string]string{"error": fmt.Sprintf("%s: %v", msg, err)}
134133
_ = json.NewEncoder(os.Stdout).Encode(output)
135134
} else {
136-
fmt.Printf("❌ %s: %v\n", msg, err)
135+
ui.PrintError(fmt.Sprintf("%s: %v", msg, err))
137136
}
138137
}

0 commit comments

Comments
 (0)