mirror of
https://github.com/charmbracelet/crush.git
synced 2026-05-30 18:47:33 +00:00
36 lines
971 B
Go
36 lines
971 B
Go
// 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/charmbracelet/crush/internal/dns"
|
|
_ "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()
|
|
}
|