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
18 changes: 15 additions & 3 deletions src/cli/task/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,11 @@ pub fn go_cmd(db: &Database, args: &GoArgs, json: bool) -> Result<()> {
eprintln!("pre-condition: {}", pre);
}

if let Some(post) = response["task"]["post_condition"].as_str() {
eprintln!();
eprintln!("post-condition (acceptance): {}", post);
}

// Concise action hints — just the essentials
if !json {
let ready = response["remaining"]["ready"].as_u64().unwrap_or(0);
Expand Down Expand Up @@ -977,11 +982,18 @@ pub fn done_cmd(db: &Database, args: DoneArgs, json: bool, compact: bool) -> Res
let has_downstream = list_dependencies(db, &task.id)
.map(|deps| deps.iter().any(|d| d.from_task == task.id))
.unwrap_or(false);
let has_post_condition = task.post_condition.is_some();

if !result_provided && has_downstream {
if !result_provided && (has_downstream || has_post_condition) {
let reason = match (has_downstream, has_post_condition) {
(true, true) => "task has downstream dependents and a post-condition",
(true, false) => "task has downstream dependents",
(false, true) => "task has a post-condition to verify",
_ => unreachable!(),
};
eprintln!(
"hint: this task has downstream dependents. Consider: plandb done {} --result '<your findings>'",
task.id
"hint: {}. Consider: plandb done {} --result '<your findings>'",
reason, task.id
);
}

Expand Down
12 changes: 12 additions & 0 deletions tests/functional_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,18 @@ assert_eq "get returns post_condition" "all endpoints return JSON" "$(jq_field "
PLAIN_TASK=$($PLANDB --db "$DB" --json task create --project "$PROJ_ID" "No Conditions")
assert_eq "no pre_condition is empty" "" "$(jq_field "$PLAIN_TASK" "pre_condition")"

# Verify pre/post condition surfaces in go/done text output (not just JSON)
COND_PROJ=$($PLANDB --db "$DB" --json project create "conditions-surfacing")
COND_PROJ_ID=$(jq_field "$COND_PROJ" "id")
$PLANDB --db "$DB" --json task create --project "$COND_PROJ_ID" "Conditioned Go" --pre "env vars set" --post "result must include summary" >/dev/null
GO_TEXT=$($PLANDB --db "$DB" task go --project "$COND_PROJ_ID" --agent cond-agent 2>&1 || true)
assert_contains "go text output shows pre-condition" "pre-condition: env vars set" "$GO_TEXT"
assert_contains "go text output shows post-condition" "post-condition (acceptance): result must include summary" "$GO_TEXT"

# done without --result on a task with post_condition should hint + echo acceptance criteria
DONE_HINT=$($PLANDB --db "$DB" task done --agent cond-agent 2>&1 || true)
assert_contains "done hints about post-condition when no result" "post-condition" "$DONE_HINT"

echo ""

# ─────────────────────────────────────────────
Expand Down
Loading