1pub const EXIT_DIRECT_COMMANDS: &[&str] = &[
15 "implement",
16 "yes",
17 "go",
18 "start",
19 "approve",
20 "approved",
21 "implement now",
22 "start implementing",
23 "start implementation",
24 "execute plan",
25 "execute the plan",
26 "execute this plan",
27 "switch to agent mode",
28 "exit planning workflow",
29 "exit planning workflow and implement",
30];
31
32pub const APPROVAL_WORDS: &[&str] = &["approve", "approved", "lgtm", "accepted", "accept"];
34
35pub const APPROVAL_PHRASES: &[&str] = &[
37 "approve the plan",
38 "approve this plan",
39 "approve the proposed plan",
40 "looks good",
41 "ship it",
42 "accept the plan",
43 "accept this plan",
44];
45
46pub const EXIT_TRIGGER_PHRASES: &[&str] = &[
48 "start implement",
49 "start implementation",
50 "start implementing",
51 "implement now",
52 "implement the plan",
53 "implement this plan",
54 "begin implement",
55 "begin implementation",
56 "begin coding",
57 "proceed to implement",
58 "proceed with implementation",
59 "proceed to coding",
60 "proceed with coding",
61 "execute the plan",
62 "execute this plan",
63 "let s implement",
64 "lets implement",
65 "go ahead and implement",
66 "go ahead and code",
67 "ready to implement",
68 "start coding",
69 "start building",
70 "switch to agent mode",
71 "exit planning workflow",
72 "exit planning workflow and implement",
73];
74
75pub const STAY_PHRASES: &[&str] = &[
81 "stay in planning workflow",
82 "keep in planning workflow",
83 "continue planning",
84 "keep planning",
85 "do not implement",
86 "don t implement",
87 "not ready to implement",
88 "don t exit planning workflow",
89 "do not exit planning workflow",
90 "edit the plan",
91 "edit plan",
92 "revise the plan",
93 "revise plan",
94];
95
96pub const ENTER_PHRASES: &[&str] = &[
99 "make a plan",
100 "create a plan",
101 "write a plan",
102 "come up with a plan",
103 "plan this",
104 "stay in planning workflow",
105 "keep planning",
106 "continue planning",
107 "before you implement make a plan",
108 "before implementing make a plan",
109 "outline the implementation plan",
110];
111
112pub const IMPLEMENTATION_CUES: &[&str] = &[
114 "implement this plan",
115 "implement the plan",
116 "ready to implement",
117 "exit planning workflow",
118 "execute the plan",
119 "switch out of planning workflow",
120 "start implementation",
121 "start implementing",
122 "start coding",
123];
124
125pub const EXECUTION_MODE_ALIASES: &[&str] = &[
130 "implement",
131 "continue",
132 "go",
133 "start",
134 "yes",
135 "approve",
136 "approved",
137 "lgtm",
138 "accepted",
139 "accept",
140 "ship it",
141 "implement now",
142 "start implementing",
143 "start implementation",
144 "execute plan",
145 "execute the plan",
146 "execute this plan",
147 "switch to agent mode",
148 "exit planning workflow and implement",
149];
150
151pub const FLAG_CLEARING_ONLY_ALIASES: &[&str] = &["exit planning workflow"];
155
156pub fn normalize_plan_intent(text: &str) -> String {
159 text.chars()
160 .map(|c| {
161 if c.is_alphanumeric() {
162 c.to_ascii_lowercase()
163 } else {
164 ' '
165 }
166 })
167 .collect()
168}
169
170pub fn matches_exit_intent(normalized: &str) -> bool {
177 let trimmed = normalized.trim();
178 EXIT_DIRECT_COMMANDS.contains(&trimmed)
179 || APPROVAL_WORDS
180 .iter()
181 .any(|word| normalized.split_whitespace().any(|tok| tok == *word))
182 || APPROVAL_PHRASES.iter().any(|phrase| normalized.contains(phrase))
183 || EXIT_TRIGGER_PHRASES.iter().any(|phrase| normalized.contains(phrase))
184}
185
186pub fn matches_stay_intent(normalized: &str) -> bool {
188 STAY_PHRASES.iter().any(|phrase| normalized.contains(phrase))
189}
190
191pub fn matches_enter_intent(normalized: &str) -> bool {
194 ENTER_PHRASES.iter().any(|phrase| normalized.contains(phrase))
195}
196
197pub fn contains_implementation_cue(normalized: &str) -> bool {
199 IMPLEMENTATION_CUES.iter().any(|cue| normalized.contains(cue))
200}
201
202pub fn is_execution_mode_alias(input: &str) -> bool {
205 let normalized = input.trim().to_ascii_lowercase();
206 EXECUTION_MODE_ALIASES
207 .iter()
208 .chain(FLAG_CLEARING_ONLY_ALIASES.iter())
209 .any(|alias| *alias == normalized)
210}
211
212pub fn is_implementation_alias(input: &str) -> bool {
215 let normalized = input.trim().to_ascii_lowercase();
216 EXECUTION_MODE_ALIASES.iter().any(|alias| *alias == normalized)
217}