Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ engineering portfolio.
- [x] Align the Go module path with the public repository so `go install ...@latest` is supported.
- [x] Report module versions correctly for both GoReleaser and `go install`, and keep Go/Actions dependencies monitored.
- [x] Publish a reproducible engineering case study of the Go data-race workflow.
- [x] Validate the complete research, edit, deterministic verification, and review workflow with a local Ollama model.
- [x] Propagate cancellation through agent-run command process trees and report local-model telemetry without false precision.
- [x] Remove the disconnected legacy `monitor` and imperative `release` command implementations while preserving public-surface compatibility tests.
- [ ] Retire or isolate the legacy Live, training, Supabase, and experimental command surfaces with compatibility tests.
- [ ] Raise coverage in legacy workflow packages without presenting the public fixture as repository-wide coverage.
22 changes: 16 additions & 6 deletions cmd/gptcode/do.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/jadercorrea/gptcode/internal/config"
"github.com/jadercorrea/gptcode/internal/intelligence"
"github.com/jadercorrea/gptcode/internal/langdetect"
"github.com/jadercorrea/gptcode/internal/live"
"github.com/jadercorrea/gptcode/internal/llm"
"github.com/jadercorrea/gptcode/internal/modes"
Expand Down Expand Up @@ -143,7 +144,7 @@ func runDoExecutionWithRetry(ctx context.Context, task string, verbose bool, max
}

startTime := time.Now()
err := runDoExecution(ctx, task, verbose, supervised, setup, currentBackend, currentEditorModel)
err := runDoExecution(ctx, task, verbose, supervised, setup, currentBackend, currentEditorModel, maxAttempts)
elapsed := time.Since(startTime).Milliseconds()

if err == nil {
Expand Down Expand Up @@ -331,7 +332,7 @@ func shouldPromptForRetry(interactive bool) bool {
return interactive && term.IsTerminal(int(os.Stdin.Fd()))
}

func runDoExecution(ctx context.Context, task string, verbose bool, supervised bool, setup *config.Setup, backendName string, editorModel string) error {
func runDoExecution(ctx context.Context, task string, verbose bool, supervised bool, setup *config.Setup, backendName string, editorModel string, maxAttempts int) error {
backendCfg := setup.Backend[backendName]

cwd, _ := os.Getwd()
Expand Down Expand Up @@ -372,10 +373,7 @@ func runDoExecution(ctx context.Context, task string, verbose bool, supervised b
fmt.Fprintf(os.Stderr, "Analyzing task complexity...\n")
}
// Detect language
language := setup.Defaults.Lang
if language == "" {
language = "go" // default
}
language := executionLanguage(cwd, setup.Defaults.Lang)

liveClient := live.GetClient()
var reportConfig *live.ReportConfig
Expand All @@ -389,6 +387,7 @@ func runDoExecution(ctx context.Context, task string, verbose bool, supervised b
}

executor := modes.NewAutonomousExecutorWithLive(queryProvider, cwd, queryModel, language, liveClient, reportConfig, backendName)
executor.SetMaxAttempts(maxAttempts)
return executor.Execute(ctx, task)
}

Expand Down Expand Up @@ -428,3 +427,14 @@ func runDoExecution(ctx context.Context, task string, verbose bool, supervised b

return nil
}

func executionLanguage(cwd, configured string) string {
detected := langdetect.DetectLanguage(cwd)
if detected != langdetect.Unknown {
return string(detected)
}
if configured != "" {
return configured
}
return string(langdetect.Go)
}
13 changes: 13 additions & 0 deletions cmd/gptcode/do_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"os"
"path/filepath"
"testing"

"github.com/jadercorrea/gptcode/internal/config"
Expand Down Expand Up @@ -32,6 +34,17 @@ func TestSelectDoModelsPrefersConfiguredAgentModels(t *testing.T) {
}
}

func TestExecutionLanguagePrefersRepositoryOverGlobalDefault(t *testing.T) {
repository := t.TempDir()
if err := os.WriteFile(filepath.Join(repository, "mix.exs"), []byte("defmodule Demo.MixProject do\nend\n"), 0644); err != nil {
t.Fatal(err)
}

if got := executionLanguage(repository, "go"); got != "elixir" {
t.Fatalf("execution language = %q, want repository language elixir", got)
}
}

func TestRetryPromptRequiresExplicitInteractiveMode(t *testing.T) {
if shouldPromptForRetry(false) {
t.Fatal("non-interactive execution must not prompt for retry input")
Expand Down
73 changes: 0 additions & 73 deletions cmd/gptcode/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/jadercorrea/gptcode/internal/elixir"
"github.com/jadercorrea/gptcode/internal/feedback"
"github.com/jadercorrea/gptcode/internal/langdetect"
"github.com/jadercorrea/gptcode/internal/live"
"github.com/jadercorrea/gptcode/internal/llm"
"github.com/jadercorrea/gptcode/internal/memory"
"github.com/jadercorrea/gptcode/internal/ml"
Expand Down Expand Up @@ -203,78 +202,6 @@ func init() {
rootCmd.AddCommand(reviewCmd)
}

// monitorCmd scans local AI agent logs and reports real API usage to the Live Dashboard
var monitorCmd = &cobra.Command{
Use: "monitor",
Short: "Scan local AI agents and report real API usage to Live Dashboard",
Long: `Discovers installed AI coding agents (Antigravity, Cursor, Windsurf, etc.),
reads their log files, counts today's API calls per model, and reports real
usage data to the gptcode Live Dashboard.

This is the 'fuel gauge' — shows how much of your daily model quota is used.`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("🔍 Scanning local AI agents...")
fmt.Println()

result, err := live.Monitor()
if err != nil {
return fmt.Errorf("scan failed: %w", err)
}

if len(result.Agents) == 0 {
fmt.Println("No AI agent activity found today.")
return nil
}

// Display results
fmt.Printf("📊 Found %d API calls across %d agent(s) today:\n\n", result.TotalAPICalls, len(result.Agents))
for _, u := range result.Agents {
pct := int(u.QuotaUsed * 100)
bar := renderBar(u.QuotaUsed)
exhaustedTag := ""
if u.Exhausted {
exhaustedTag = " ⚠️ HIT RATE LIMIT"
}
fmt.Printf(" %s (%s)\n", u.DisplayName(), u.Agent)
fmt.Printf(" %s %d%% · %d calls · %s → %s%s\n\n", bar, pct, u.APICalls, u.FirstCall, u.LastCall, exhaustedTag)
}

// Report to Live Dashboard
liveURL := os.Getenv("GPTCODE_LIVE_URL")
if liveURL == "" {
liveURL = "https://gptcode.live"
}

reportConfig := live.DefaultReportConfig()
reportConfig.SetBaseURL(liveURL)

fmt.Println("📡 Reporting to Live Dashboard...")
if err := result.ReportToLive(reportConfig); err != nil {
fmt.Printf("⚠️ Report error: %v\n", err)
} else {
fmt.Printf("✅ Reported to %s\n", liveURL)
}

return nil
},
}

func renderBar(quota float64) string {
filled := int(quota * 10)
if filled > 10 {
filled = 10
}
empty := 10 - filled
bar := ""
for i := 0; i < filled; i++ {
bar += "●"
}
for i := 0; i < empty; i++ {
bar += "○"
}
return bar
}

func newBuilderAndLLM(lang, mode, hint string) (*prompt.Builder, llm.Provider, string, error) {
setup, err := config.LoadSetup()
if err != nil {
Expand Down
183 changes: 0 additions & 183 deletions cmd/gptcode/release.go

This file was deleted.

2 changes: 1 addition & 1 deletion internal/agents/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Do NOT suggest changes. Just report what exists.`, task)
}
}
}
result := tools.ExecuteToolFromLLM(llmCall, a.cwd)
result := tools.ExecuteToolFromLLMContext(ctx, llmCall, a.cwd)

content := result.Result
if result.Error != "" {
Expand Down
Loading