forked from charmbracelet/crush
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (30 loc) · 922 Bytes
/
Copy pathmain.go
File metadata and controls
34 lines (30 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Package main is the entry point for the Crush CLI.
//
// @title Crush API
// @version 1.0
// @description Crush is a terminal-based AI coding assistant. This API is served over a Unix socket (or Windows named pipe) and provides programmatic access to workspaces, sessions, agents, LSP, MCP, and more.
// @contact.name Charm
// @contact.url https://charm.sh
// @license.name MIT
// @license.url https://github.com/charmbracelet/crush/blob/main/LICENSE
// @BasePath /v1
package main
import (
"log/slog"
"net/http"
_ "net/http/pprof"
"os"
"github.com/charmbracelet/crush/internal/cmd"
_ "github.com/joho/godotenv/autoload"
)
func main() {
if os.Getenv("CRUSH_PROFILE") != "" {
go func() {
slog.Info("Serving pprof at localhost:6060")
if httpErr := http.ListenAndServe("localhost:6060", nil); httpErr != nil {
slog.Error("Failed to pprof listen", "error", httpErr)
}
}()
}
cmd.Execute()
}