Skip to content

Commit da80b54

Browse files
committed
fix(app-server): update planning.rs to handle Plan tool schema
Address Greptile review feedback - the container mode Plan implementation in planning.rs was missing support for the new required field agent_analyses and other optional fields. Changes: - Added agent_analyses parameter handling (required) - Added optional fields: architecture, tech_stack, use_cases, risks, success_criteria, timeline - Build plan_data JSON with all fields for consistency
1 parent 358838d commit da80b54

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

src/cortex-app-server/src/tools/planning.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,50 @@ pub async fn plan(args: Value) -> ToolResult {
7070
.get("description")
7171
.and_then(|v| v.as_str())
7272
.unwrap_or("");
73+
let architecture = args.get("architecture").and_then(|v| v.as_str());
74+
let tech_stack = args.get("tech_stack").cloned();
7375
let tasks = args.get("tasks").cloned().unwrap_or(json!([]));
76+
let use_cases = args.get("use_cases").cloned();
77+
let agent_analyses = args.get("agent_analyses").cloned().unwrap_or(json!([]));
78+
let risks = args.get("risks").cloned();
79+
let success_criteria = args.get("success_criteria").cloned();
80+
let timeline = args.get("timeline").and_then(|v| v.as_str());
7481
let estimate = args
7582
.get("estimated_changes")
7683
.and_then(|v| v.as_str())
7784
.unwrap_or("");
7885

79-
let plan_data = json!({
86+
// Build the plan data with all fields
87+
let mut plan_data = json!({
8088
"type": "plan",
8189
"title": title,
8290
"description": description,
8391
"tasks": tasks,
92+
"agent_analyses": agent_analyses,
8493
"estimated_changes": estimate,
8594
"status": "pending_approval"
8695
});
8796

97+
// Add optional fields if present
98+
if let Some(arch) = architecture {
99+
plan_data["architecture"] = json!(arch);
100+
}
101+
if let Some(stack) = tech_stack {
102+
plan_data["tech_stack"] = stack;
103+
}
104+
if let Some(cases) = use_cases {
105+
plan_data["use_cases"] = cases;
106+
}
107+
if let Some(risk_list) = risks {
108+
plan_data["risks"] = risk_list;
109+
}
110+
if let Some(criteria) = success_criteria {
111+
plan_data["success_criteria"] = criteria;
112+
}
113+
if let Some(tl) = timeline {
114+
plan_data["timeline"] = json!(tl);
115+
}
116+
88117
ToolResult {
89118
success: true,
90119
output: serde_json::to_string_pretty(&plan_data).unwrap_or_default(),

0 commit comments

Comments
 (0)