Skip to content

Commit 1943151

Browse files
committed
Remove hook and mobile-info debug prints that corrupt PTY display
- Remove all fmt.Printf("[hook]...") from hook_socket.go and hook_claude.go that wrote directly to stdout during live PTY sessions - Remove fmt.Printf("[mobile-info]...") from commands_info.go - These prints caused terminal layout corruption on the mobile client
1 parent 565ccbe commit 1943151

3 files changed

Lines changed: 6 additions & 16 deletions

File tree

commands_info.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,9 @@ func (d *Daemon) handleMobileInfo(args string) {
5252
AppVersion string `json:"app_version"`
5353
}
5454
if err := json.Unmarshal([]byte(args), &info); err != nil {
55-
fmt.Printf("%s[mobile-info] Invalid JSON: %v%s\n", dim, err, reset)
5655
return
5756
}
5857

59-
fmt.Printf("%s[mobile-info] App version: %s%s\n", dim, info.AppVersion, reset)
60-
6158
appVer, err := parseSemver(info.AppVersion)
6259
if err != nil {
6360
return

hook_claude.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"encoding/json"
5-
"fmt"
65
"os"
76
"path/filepath"
87
)
@@ -45,7 +44,7 @@ func ensureClaudeHooksInstalled() {
4544
// Read existing settings
4645
settings, err := readClaudeSettings(settingsPath)
4746
if err != nil {
48-
fmt.Printf("%s[hook] Cannot read Claude settings: %v%s\n", dim, err, reset)
47+
// Cannot read settings — skip hook installation
4948
return
5049
}
5150

@@ -69,11 +68,11 @@ func ensureClaudeHooksInstalled() {
6968

7069
// Write back
7170
if err := writeClaudeSettings(settingsPath, settings); err != nil {
72-
fmt.Printf("%s[hook] Cannot write Claude settings: %v%s\n", dim, err, reset)
71+
// Cannot write settings — skip
7372
return
7473
}
7574

76-
fmt.Printf("%s[hook] Installed aipilot hooks in %s%s\n", dim, settingsPath, reset)
75+
// Hooks installed successfully
7776
}
7877

7978
// addClaudeHookIfMissing adds an aipilot hook entry to the given event array

hook_socket.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package main
33
import (
44
"bufio"
55
"encoding/json"
6-
"fmt"
76
"net"
87
"os"
98
"sync"
@@ -29,7 +28,7 @@ func (d *Daemon) startHookSocket(socketPath string) {
2928

3029
listener, err := net.Listen("unix", socketPath)
3130
if err != nil {
32-
fmt.Printf("%s[hook] Failed to create socket %s: %v%s\n", dim, socketPath, err, reset)
31+
// Socket creation failed — logged silently to avoid PTY corruption
3332
return
3433
}
3534

@@ -38,8 +37,6 @@ func (d *Daemon) startHookSocket(socketPath string) {
3837
d.hookSocketPath = socketPath
3938
d.mu.Unlock()
4039

41-
fmt.Printf("%s[hook] Listening on %s%s\n", dim, socketPath, reset)
42-
4340
go d.hookSocketAcceptLoop(listener)
4441
}
4542

@@ -73,7 +70,6 @@ func (d *Daemon) hookSocketHandleConn(conn net.Conn) {
7370

7471
var msg HookMessage
7572
if err := json.Unmarshal(line, &msg); err != nil {
76-
fmt.Printf("%s[hook] Invalid JSON: %v%s\n", dim, err, reset)
7773
continue
7874
}
7975

@@ -87,15 +83,15 @@ func (d *Daemon) handleHookMessage(msg HookMessage) {
8783
case "agent_status":
8884
d.handleHookAgentStatus(msg.Data)
8985
default:
90-
fmt.Printf("%s[hook] Unknown event: %s%s\n", dim, msg.Event, reset)
86+
// Unknown event — ignore silently
9187
}
9288
}
9389

9490
// handleHookAgentStatus processes agent_status events from hooks
9591
func (d *Daemon) handleHookAgentStatus(data json.RawMessage) {
9692
var status AgentStatusData
9793
if err := json.Unmarshal(data, &status); err != nil {
98-
fmt.Printf("%s[hook] Invalid agent_status data: %v%s\n", dim, err, reset)
94+
// Invalid agent_status data — ignore
9995
return
10096
}
10197

@@ -111,13 +107,11 @@ func (d *Daemon) handleHookAgentStatus(data json.RawMessage) {
111107
if !d.agentBusy {
112108
d.agentBusy = true
113109
d.sendControlMessage("agent-status:busy")
114-
fmt.Printf("%s[hook] Agent status: busy%s\n", dim, reset)
115110
}
116111
case "idle":
117112
if d.agentBusy {
118113
d.agentBusy = false
119114
d.sendControlMessage("agent-status:idle")
120-
fmt.Printf("%s[hook] Agent status: idle%s\n", dim, reset)
121115
}
122116
}
123117
}

0 commit comments

Comments
 (0)