summaryrefslogtreecommitdiff
path: root/internal/api/validate.go
diff options
context:
space:
mode:
authorClaudomator Agent <agent@claudomator>2026-06-05 09:21:32 +0000
committerClaudomator Agent <agent@claudomator>2026-06-05 09:21:32 +0000
commit0eb0b79396663c4901597becc6857a4cd795c58e (patch)
tree3532c82aa3f7c6deeed03f143d1c360d7cf6cc47 /internal/api/validate.go
parentfa3ed5220a28f326d443726233c37e1a7df0ced5 (diff)
chore: remove stories/checker backend dead code
Remove the dead stories/checker backend tracked as design debt in CLAUDE.md: - Delete internal/api/stories.go, stories_test.go, elaborate.go - Delete internal/task/story.go, story_test.go - Remove story/checker columns from storage schema and all CRUD methods - Remove checkStoryCompletion, spawnCheckerTask, triggerStoryDeploy, createValidationTask, checkValidationResult, ShipStory, CheckStoryCompletion from executor; simplify handleRunResult - Remove story/checker fields from task.Task (StoryID, AcceptanceCriteria, CheckerForTaskID, CheckerReport) - Remove story routes and geminiBinPath from API server - Move claudeJSONResult/extractJSON from elaborate.go to validate.go - Rename ensureStoryBranch -> ensureBranch in ContainerRunner - Fix git identity in bare-repo tests; fix initial-branch to use main Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/api/validate.go')
-rw-r--r--internal/api/validate.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/api/validate.go b/internal/api/validate.go
index 07d293c..9e91882 100644
--- a/internal/api/validate.go
+++ b/internal/api/validate.go
@@ -7,11 +7,29 @@ import (
"fmt"
"net/http"
"os/exec"
+ "strings"
"time"
)
const validateTimeout = 20 * time.Second
+// claudeJSONResult is the top-level object returned by `claude --output-format json`.
+type claudeJSONResult struct {
+ Result string `json:"result"`
+ IsError bool `json:"is_error"`
+}
+
+// extractJSON returns the first top-level JSON object found in s, stripping
+// surrounding prose or markdown code fences the model may have added.
+func extractJSON(s string) string {
+ start := strings.Index(s, "{")
+ end := strings.LastIndex(s, "}")
+ if start == -1 || end == -1 || end < start {
+ return s
+ }
+ return s[start : end+1]
+}
+
const validateSystemPrompt = `You are a task instruction reviewer for Claudomator, an AI task runner that executes tasks by running Claude or Gemini as a subprocess.
Analyze the given task name and instructions for clarity and completeness.