use super::*;
#[test]
fn every_ordinary_imperative_still_infers_act() {
for prompt in [
"add a test for the parser",
"update the docs",
"remove the dead code",
"refactor the tty module",
"rename the field",
"install the hooks",
"upgrade serde",
"bump the version",
"revert that",
"rebase onto main",
"tag the release",
"extract the helper",
"wire it up",
"port it to windows",
"migrate the store",
"continue",
"proceed",
"go ahead",
"carry on",
"clean that up",
"split the file",
"land it",
] {
assert_eq!(
PromptIntake::analyze(prompt).disposition(),
PromptDisposition::Act,
"{prompt:?} reaches Act only through the terminal fallback — \
the #1971 narrowing must not touch it"
);
}
}
#[test]
fn a_mixed_prompt_keeps_act() {
let intake = PromptIntake::analyze(&format!("{GIT_REMOTE_FYI}. add the CI workflow"));
assert_eq!(intake.disposition(), PromptDisposition::Act);
let kinds: Vec<AskKind> = intake.atomic_asks().iter().map(AtomicAsk::kind).collect();
assert_eq!(
kinds,
vec![AskKind::Informational, AskKind::Instruction],
"the clauses are classified separately: {:?}",
intake.atomic_asks()
);
assert!(intake.model_card().contains(GIT_REMOTE_FYI));
}
#[test]
fn only_a_positive_statement_shape_is_informational() {
for stated in [
"fyi the remote moved",
"btw we are on 0.8 now",
"note that the CI runner is self-hosted",
"i'll want a TUI eventually",
"the parser is broken",
"there is a bug in the parser",
] {
assert_eq!(
PromptIntake::analyze(stated).disposition(),
PromptDisposition::Explain,
"{stated:?} states a fact"
);
}
for instructed in [
"make sure it is green",
"the tests need updating",
"i want you to fix the parser",
] {
assert_eq!(
PromptIntake::analyze(instructed).disposition(),
PromptDisposition::Act,
"{instructed:?} instructs"
);
}
}
#[test]
fn an_fyi_prefix_cannot_launder_a_recognised_imperative() {
assert_eq!(
PromptIntake::analyze("fyi the parser is broken, fix it").disposition(),
PromptDisposition::Act,
"`fix` is an action needle and wins outright"
);
}
#[test]
fn an_unrecognised_imperative_joined_to_an_fyi_by_a_comma_is_read_as_stated() {
let intake = PromptIntake::analyze("fyi the parser is broken, tidy it up");
assert_eq!(intake.disposition(), PromptDisposition::Explain);
assert!(
intake.model_card().contains("tidy it up"),
"the request is not lost, only unauthorized: {}",
intake.model_card()
);
}
#[test]
fn quoted_command_test_question_is_an_action_turn() {
let prompt = "you should have a \"gh\" command ... test \"gh auth status\" now to tell me if you can use it?";
assert_eq!(
PromptIntake::analyze(prompt).disposition(),
PromptDisposition::Act
);
assert_eq!(
PromptIntake::analyze("Explain how the test harness works?").disposition(),
PromptDisposition::Explain
);
assert_eq!(
PromptIntake::analyze("What is the latest \"release\"?").disposition(),
PromptDisposition::Explain
);
assert_eq!(
PromptIntake::analyze("Explain the greatest 'risk'?").disposition(),
PromptDisposition::Explain
);
assert_eq!(
PromptIntake::analyze("test \"gh auth status\" now").disposition(),
PromptDisposition::Act
);
}