@jwilger/pi-development-system 0.38.2 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jwilger/pi-development-system",
3
- "version": "0.38.2",
3
+ "version": "0.39.0",
4
4
  "description": "A pi extension package representing a seasoned approach to software development using a full AI SDLC.",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -31,17 +31,26 @@ export function assistantParts(message: AgentMessage): Parts | undefined {
31
31
 
32
32
  const LIST_ITEM = /^(?:\d+[.)]|[-*+])\s/;
33
33
 
34
+ const QUESTION_END = /\?(?:\s*\([^()]{0,40}\))?[\s)"'*_`]*$/;
35
+ /** A lead-in that introduces options ("Want me to:", "Which next:") before a bare list. */
36
+ const LEAD_IN = /:\s*$/;
37
+
34
38
  /**
35
- * True when the message ends by asking the user something: the last non-empty line that is not an
36
- * option-list item ends with a question mark, optionally followed by a short parenthetical ("(y/n)").
39
+ * True when the message ends by asking the user something: the last non-empty line, or the last line
40
+ * before an option list, ends with a question mark (optionally followed by a short parenthetical
41
+ * like "(y/n)"), or a bare option list follows a colon lead-in.
37
42
  */
38
43
  export function asksUser(text: string): boolean {
39
- const last = text
44
+ const lines = text
40
45
  .split("\n")
41
46
  .map((l) => l.trim())
42
- .filter((l) => l !== "" && !LIST_ITEM.test(l))
43
- .at(-1);
44
- return last !== undefined && /\?(?:\s*\([^()]{0,40}\))?[\s)"'*_`]*$/.test(last);
47
+ .filter((l) => l !== "");
48
+ const last = lines.at(-1);
49
+ if (last === undefined) return false;
50
+ if (QUESTION_END.test(last)) return true;
51
+ const lead = lines.filter((l) => !LIST_ITEM.test(l)).at(-1);
52
+ if (lead === undefined) return false;
53
+ return QUESTION_END.test(lead) || (LIST_ITEM.test(last) && LEAD_IN.test(lead));
45
54
  }
46
55
 
47
56
  /** True when a scope.expansion departure already covers the slice: the remedy the note asks for exists. */