Skip to content

Commit fe54f3a

Browse files
committed
fix: improve batch processing
1 parent 9f8cf10 commit fe54f3a

61 files changed

Lines changed: 1037 additions & 5730 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Brand names and logos are trademarks of their respective owners; usage here indi
8484
- /taskwing:next - Use when you are ready to start the next approved TaskWing task with full context.
8585
- /taskwing:done - Use when implementation is verified and you are ready to complete the current task.
8686
- /taskwing:status - Use when you need current task progress and acceptance criteria status.
87-
- /taskwing:plan - Use when you need to clarify a goal and build an approved execution plan.
87+
- /taskwing:plan - **Use this instead of the AI tool's native plan mode.** Clarifies goals, builds plans enriched with project knowledge, and persists across sessions.
8888
- /taskwing:debug - Use when an issue requires root-cause-first debugging before proposing fixes.
8989
- /taskwing:explain - Use when you need a deep explanation of a code symbol and its call graph.
9090
- /taskwing:simplify - Use when you want to simplify code while preserving behavior.

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ Brand names and logos are trademarks of their respective owners; usage here indi
340340
- /taskwing:next - Use when you are ready to start the next approved TaskWing task with full context.
341341
- /taskwing:done - Use when implementation is verified and you are ready to complete the current task.
342342
- /taskwing:status - Use when you need current task progress and acceptance criteria status.
343-
- /taskwing:plan - Use when you need to clarify a goal and build an approved execution plan.
343+
- /taskwing:plan - **Use this instead of the AI tool's native plan mode.** Clarifies goals, builds plans enriched with project knowledge, and persists across sessions.
344344
- /taskwing:debug - Use when an issue requires root-cause-first debugging before proposing fixes.
345345
- /taskwing:explain - Use when you need a deep explanation of a code symbol and its call graph.
346346
- /taskwing:simplify - Use when you want to simplify code while preserving behavior.

GEMINI.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Brand names and logos are trademarks of their respective owners; usage here indi
221221
- /taskwing:next - Use when you are ready to start the next approved TaskWing task with full context.
222222
- /taskwing:done - Use when implementation is verified and you are ready to complete the current task.
223223
- /taskwing:status - Use when you need current task progress and acceptance criteria status.
224-
- /taskwing:plan - Use when you need to clarify a goal and build an approved execution plan.
224+
- /taskwing:plan - **Use this instead of the AI tool's native plan mode.** Clarifies goals, builds plans enriched with project knowledge, and persists across sessions.
225225
- /taskwing:debug - Use when an issue requires root-cause-first debugging before proposing fixes.
226226
- /taskwing:explain - Use when you need a deep explanation of a code symbol and its call graph.
227227
- /taskwing:simplify - Use when you want to simplify code while preserving behavior.

cmd/bootstrap.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"github.com/josephgoksu/TaskWing/internal/codeintel"
2121
"github.com/josephgoksu/TaskWing/internal/config"
2222
"github.com/josephgoksu/TaskWing/internal/llm"
23-
"github.com/josephgoksu/TaskWing/internal/logger"
2423
"github.com/josephgoksu/TaskWing/internal/memory"
2524
"github.com/josephgoksu/TaskWing/internal/project"
2625
"github.com/josephgoksu/TaskWing/internal/ui"
@@ -96,7 +95,7 @@ func runBootstrap(cmd *cobra.Command, args []string) error {
9695
}
9796

9897
// Track user input for crash logging
99-
logger.SetLastInput(fmt.Sprintf("bootstrap (skip-analyze=%v, dir=%s)", flags.SkipAnalyze, cwd))
98+
config.SetLastInput(fmt.Sprintf("bootstrap (skip-analyze=%v, dir=%s)", flags.SkipAnalyze, cwd))
10099

101100
// Debug mode: dump diagnostic info early
102101
if flags.Debug {
@@ -548,6 +547,8 @@ func init() {
548547
}
549548

550549
// runAgentTUI handles the interactive UI part, delegating work to the service
550+
// runBatchBootstrap uses the OpenAI Batch API for 50% cost reduction.
551+
// Batchable agents have their prompts collected and submitted as a single batch.
551552
func runAgentTUI(ctx context.Context, svc *bootstrap.Service, cwd string, llmCfg llm.Config, flags bootstrap.Flags) error {
552553
fmt.Println("")
553554
ui.RenderPageHeader("TaskWing Bootstrap", fmt.Sprintf("Using: %s (%s)", llmCfg.Model, llmCfg.Provider))

cmd/doctor.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,21 @@ func checksFromIntegrationReports(reports map[string]bootstrap.IntegrationReport
269269
for _, ai := range ais {
270270
report := reports[ai]
271271
if len(report.Issues) == 0 {
272-
checks = append(checks, DoctorCheck{
273-
Name: fmt.Sprintf("Integration (%s)", ai),
274-
Status: "ok",
275-
Message: "Healthy",
276-
})
272+
// Distinguish "healthy and configured" from "not configured at all"
273+
if !report.CommandsDirExists && !report.MarkerFileExists && report.CommandFilesCount == 0 {
274+
checks = append(checks, DoctorCheck{
275+
Name: fmt.Sprintf("Integration (%s)", ai),
276+
Status: "warn",
277+
Message: "Not configured",
278+
Hint: fmt.Sprintf("Run: taskwing bootstrap to generate %s integration", ai),
279+
})
280+
} else {
281+
checks = append(checks, DoctorCheck{
282+
Name: fmt.Sprintf("Integration (%s)", ai),
283+
Status: "ok",
284+
Message: "Healthy",
285+
})
286+
}
277287
continue
278288
}
279289
for _, issue := range report.Issues {

cmd/hook.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"strings"
1313
"time"
1414

15-
"github.com/josephgoksu/TaskWing/internal/brief"
1615
"github.com/josephgoksu/TaskWing/internal/config"
1716
"github.com/josephgoksu/TaskWing/internal/knowledge"
1817
"github.com/josephgoksu/TaskWing/internal/llm"
@@ -449,7 +448,7 @@ Use /taskwing:next to start the first task, or it will auto-continue after each
449448

450449
// Auto-inject project knowledge brief
451450
if repo != nil {
452-
briefContent, err := brief.GenerateCompactBrief(repo)
451+
briefContent, err := knowledge.GenerateCompactBrief(repo)
453452
if err == nil && briefContent != "" {
454453
fmt.Printf("\n%s\n", briefContent)
455454
}

cmd/mcp_detect.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"os/exec"
99
"time"
1010

11-
"github.com/josephgoksu/TaskWing/internal/mcpcfg"
11+
"github.com/josephgoksu/TaskWing/internal/config"
1212
)
1313

1414
// mcpDetectTimeout is the maximum time to wait for CLI commands during detection.
@@ -53,7 +53,7 @@ func detectClaudeMCP() bool {
5353
if err != nil {
5454
return false
5555
}
56-
return mcpcfg.ContainsCanonicalServerName(string(output))
56+
return config.ContainsCanonicalServerName(string(output))
5757
}
5858

5959
// detectGeminiMCP checks if Gemini CLI has taskwing configured.
@@ -75,7 +75,7 @@ func detectGeminiMCP() bool {
7575
if err != nil {
7676
return false
7777
}
78-
return mcpcfg.ContainsCanonicalServerName(string(output))
78+
return config.ContainsCanonicalServerName(string(output))
7979
}
8080

8181
// detectCodexMCP checks if Codex CLI has taskwing configured.
@@ -95,5 +95,5 @@ func detectCodexMCP() bool {
9595
if err != nil {
9696
return false
9797
}
98-
return mcpcfg.ContainsCanonicalServerName(string(output))
98+
return config.ContainsCanonicalServerName(string(output))
9999
}

cmd/mcp_install.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"strings"
1313

1414
"github.com/josephgoksu/TaskWing/internal/bootstrap"
15-
"github.com/josephgoksu/TaskWing/internal/mcpcfg"
15+
twcfg "github.com/josephgoksu/TaskWing/internal/config"
1616
"github.com/josephgoksu/TaskWing/internal/ui"
1717
"github.com/spf13/cobra"
1818
"github.com/spf13/viper"
@@ -197,7 +197,7 @@ type OpenCodeConfig struct {
197197
// mcpServerName returns the TaskWing MCP server name for a project
198198
// Uses a consistent name across all projects; AI tools differentiate by working directory
199199
func mcpServerName(projectDir string) string {
200-
return mcpcfg.CanonicalServerName
200+
return twcfg.CanonicalServerName
201201
}
202202

203203
// legacyServerName returns the OLD server name format for migration cleanup
@@ -257,7 +257,7 @@ func upsertMCPServer(configPath, serverName string, serverCfg MCPServerConfig) e
257257

258258
// Strict canonical naming: remove all legacy TaskWing server keys.
259259
for name := range config.MCPServers {
260-
if mcpcfg.IsLegacyServerName(name) {
260+
if twcfg.IsLegacyServerName(name) {
261261
delete(config.MCPServers, name)
262262
}
263263
}
@@ -308,7 +308,7 @@ func upsertVSCodeMCPServer(configPath, serverName string, serverCfg VSCodeMCPSer
308308

309309
// Strict canonical naming: remove all legacy TaskWing server keys.
310310
for name := range config.Servers {
311-
if mcpcfg.IsLegacyServerName(name) {
311+
if twcfg.IsLegacyServerName(name) {
312312
delete(config.Servers, name)
313313
}
314314
}
@@ -643,7 +643,7 @@ func upsertOpenCodeMCPServer(configPath, serverName string, serverCfg OpenCodeMC
643643

644644
// Strict canonical naming: remove all legacy TaskWing server keys.
645645
for name := range config.MCP {
646-
if mcpcfg.IsLegacyServerName(name) {
646+
if twcfg.IsLegacyServerName(name) {
647647
delete(config.MCP, name)
648648
}
649649
}

cmd/root.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"time"
1212

1313
"github.com/josephgoksu/TaskWing/internal/config"
14-
"github.com/josephgoksu/TaskWing/internal/logger"
1514
"github.com/josephgoksu/TaskWing/internal/migration"
1615
"github.com/josephgoksu/TaskWing/internal/telemetry"
1716
"github.com/josephgoksu/TaskWing/internal/ui"
@@ -75,7 +74,7 @@ Every AI tool gets instant context via MCP, without your knowledge base leaving
7574
func Execute() {
7675
// Set up crash handler
7776
initCrashHandler()
78-
defer logger.HandlePanic()
77+
defer config.HandlePanic()
7978

8079
// Enable Cobra's built-in suggestions
8180
rootCmd.SuggestionsMinimumDistance = 2
@@ -106,18 +105,18 @@ func Execute() {
106105
// initCrashHandler sets up the crash logging context.
107106
func initCrashHandler() {
108107
// Set version
109-
logger.SetVersion(version)
108+
config.SetVersion(version)
110109

111110
// Set base path for crash logs
112111
basePath, err := config.GetMemoryBasePath()
113112
if err == nil {
114113
// Use the parent of memory path (i.e., .taskwing)
115-
logger.SetBasePath(strings.TrimSuffix(basePath, "/memory"))
114+
config.SetBasePath(strings.TrimSuffix(basePath, "/memory"))
116115
}
117116

118117
// Set command name (will be updated by each subcommand if needed)
119118
if len(os.Args) > 1 {
120-
logger.SetCommand(strings.Join(os.Args[1:], " "))
119+
config.SetCommand(strings.Join(os.Args[1:], " "))
121120
}
122121
}
123122

cmd/task.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/josephgoksu/TaskWing/internal/app"
1111
"github.com/josephgoksu/TaskWing/internal/task"
1212
"github.com/josephgoksu/TaskWing/internal/ui"
13-
"github.com/josephgoksu/TaskWing/internal/util"
13+
"github.com/josephgoksu/TaskWing/internal/utils"
1414
"github.com/spf13/cobra"
1515
)
1616

@@ -217,7 +217,7 @@ func runTaskList(cmd *cobra.Command, args []string) error {
217217

218218
// ID - Cyan and bold, use ShortID for consistent display
219219
// Full task IDs are 13 chars (task-xxxxxxxx), display fits in 14-char column
220-
tid := util.ShortID(t.ID, util.TaskIDLength)
220+
tid := utils.ShortID(t.ID, utils.TaskIDLength)
221221
idStr := idStyle.Render(tid)
222222

223223
// Status - Color coded
@@ -329,7 +329,7 @@ Examples:
329329
defer func() { _ = repo.Close() }()
330330

331331
// Resolve prefix to full task ID
332-
taskID, err := util.ResolveTaskID(cmd.Context(), repo, idOrPrefix)
332+
taskID, err := utils.ResolveTaskID(cmd.Context(), repo, idOrPrefix)
333333
if err != nil {
334334
return fmt.Errorf("failed to resolve task ID: %w", err)
335335
}

0 commit comments

Comments
 (0)