Skip to content

Commit cac1cf1

Browse files
committed
🔧 Fix CI/CD linting and formatting issues; resolve golangci-lint YAML escape characters and update gosec security scanner to use direct installation
1 parent 075d0c5 commit cac1cf1

File tree

6 files changed

+71
-70
lines changed

6 files changed

+71
-70
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ jobs:
108108
go-version: ${{ env.GO_VERSION }}
109109

110110
- name: Run Gosec Security Scanner
111-
uses: securecodewarrior/github-action-gosec@master
112-
with:
113-
args: '-no-fail -fmt sarif -out gosec-results.sarif ./sidekick/...'
111+
run: |
112+
# Install gosec
113+
go install github.com/securecodewarrior/gosec/v2/cmd/gosec@latest
114+
# Run gosec scan
115+
gosec -no-fail -fmt sarif -out gosec-results.sarif ./sidekick/...
114116
115117
- name: Upload SARIF file
116118
uses: github/codeql-action/upload-sarif@v3

‎sidekick/.golangci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ issues:
114114

115115
exclude-use-default: false
116116
exclude:
117-
- "Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked"
117+
- 'Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked'
118118

119119
max-issues-per-linter: 0
120120
max-same-issues: 0

‎sidekick/main.go‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func main() {
9090
)
9191

9292
getFullProcessOutputTool := mcp.NewTool(
93-
"get_full_process_output",
93+
"get_full_process_output",
9494
mcp.WithDescription("Get the complete output from a process (all data in memory)"),
9595
mcp.WithString("process_id",
9696
mcp.Required(),
@@ -169,7 +169,7 @@ func main() {
169169
// 🚦 Setup signal handling for graceful shutdown
170170
sigChan := make(chan os.Signal, 1)
171171
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
172-
172+
173173
// Handle signals in a goroutine
174174
go func() {
175175
<-sigChan
@@ -188,12 +188,12 @@ func main() {
188188
func handleGracefulShutdown() {
189189
// Get all tracked processes
190190
processes := registry.getAllProcesses()
191-
191+
192192
// Send termination signal to all running process groups
193193
for _, tracker := range processes {
194194
tracker.Mutex.RLock()
195-
if tracker.Process != nil && tracker.Process.Process != nil &&
196-
(tracker.Status == StatusRunning || tracker.Status == StatusPending) {
195+
if tracker.Process != nil && tracker.Process.Process != nil &&
196+
(tracker.Status == StatusRunning || tracker.Status == StatusPending) {
197197
// Terminate the entire process group (Unix) or process (Windows)
198198
err := terminateProcessGroup(tracker.Process.Process.Pid)
199199
if err != nil {
@@ -203,38 +203,38 @@ func handleGracefulShutdown() {
203203
}
204204
tracker.Mutex.RUnlock()
205205
}
206-
206+
207207
// Give processes up to 5 seconds to terminate gracefully
208208
deadline := time.Now().Add(5 * time.Second)
209209
checkInterval := 100 * time.Millisecond
210-
210+
211211
for time.Now().Before(deadline) {
212212
allTerminated := true
213-
213+
214214
for _, tracker := range processes {
215215
tracker.Mutex.RLock()
216216
if tracker.Status == StatusRunning || tracker.Status == StatusPending {
217217
allTerminated = false
218218
}
219219
tracker.Mutex.RUnlock()
220-
220+
221221
if !allTerminated {
222222
break
223223
}
224224
}
225-
225+
226226
if allTerminated {
227227
return
228228
}
229-
229+
230230
time.Sleep(checkInterval)
231231
}
232-
232+
233233
// Force kill any remaining process groups
234234
for _, tracker := range processes {
235235
tracker.Mutex.RLock()
236236
if tracker.Process != nil && tracker.Process.Process != nil &&
237-
(tracker.Status == StatusRunning || tracker.Status == StatusPending) {
237+
(tracker.Status == StatusRunning || tracker.Status == StatusPending) {
238238
// Force kill the entire process group (Unix) or process (Windows)
239239
err := forceKillProcessGroup(tracker.Process.Process.Pid)
240240
if err != nil {

‎sidekick/process_unix.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ func terminateProcessGroup(pid int) error {
2828
// forceKillProcessGroup sends SIGKILL to a process group
2929
func forceKillProcessGroup(pid int) error {
3030
return killProcessGroup(pid, syscall.SIGKILL)
31-
}
31+
}

‎sidekick/process_windows.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ func forceKillProcessGroup(pid int) error {
3131
// On Windows, we don't have SIGKILL equivalent
3232
// The caller should use process.Kill() instead
3333
return fmt.Errorf("windows force kill requires process.Kill()")
34-
}
34+
}

0 commit comments

Comments
 (0)