main.go 922 B

12345678910111213141516171819202122232425262728293031323334
  1. // Package main is the entry point for the Crush CLI.
  2. //
  3. // @title Crush API
  4. // @version 1.0
  5. // @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.
  6. // @contact.name Charm
  7. // @contact.url https://charm.sh
  8. // @license.name MIT
  9. // @license.url https://github.com/charmbracelet/crush/blob/main/LICENSE
  10. // @BasePath /v1
  11. package main
  12. import (
  13. "log/slog"
  14. "net/http"
  15. _ "net/http/pprof"
  16. "os"
  17. "github.com/charmbracelet/crush/internal/cmd"
  18. _ "github.com/joho/godotenv/autoload"
  19. )
  20. func main() {
  21. if os.Getenv("CRUSH_PROFILE") != "" {
  22. go func() {
  23. slog.Info("Serving pprof at localhost:6060")
  24. if httpErr := http.ListenAndServe("localhost:6060", nil); httpErr != nil {
  25. slog.Error("Failed to pprof listen", "error", httpErr)
  26. }
  27. }()
  28. }
  29. cmd.Execute()
  30. }