wdyt 0.1.9 → 0.1.10

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": "wdyt",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "description": "Code review context builder for LLMs - what do you think?",
6
6
  "license": "MIT",
@@ -19,7 +19,12 @@ export interface BuilderResponse {
19
19
 
20
20
  /**
21
21
  * Parse builder JSON argument
22
- * @param args - JSON string like {"summary": "test"}
22
+ * Handles formats:
23
+ * - {} or {"summary": "..."} (JSON object)
24
+ * - "summary text" (JSON string - flowctl format)
25
+ * - "summary" --response-type review (flowctl with flags - flags ignored)
26
+ *
27
+ * @param args - JSON string or object
23
28
  * @returns Parsed BuilderConfig or null if invalid
24
29
  */
25
30
  function parseBuilderArgs(args?: string): BuilderConfig | null {
@@ -28,9 +33,25 @@ function parseBuilderArgs(args?: string): BuilderConfig | null {
28
33
  return {};
29
34
  }
30
35
 
36
+ let jsonPart = args.trim();
37
+
38
+ // Strip --response-type flag if present (not supported, but don't fail)
39
+ // flowctl passes: "summary" --response-type review
40
+ const responseTypeMatch = jsonPart.match(/^(.+?)\s+--response-type\s+\w+$/);
41
+ if (responseTypeMatch) {
42
+ jsonPart = responseTypeMatch[1].trim();
43
+ }
44
+
31
45
  try {
32
- const config = JSON.parse(args.trim()) as BuilderConfig;
33
- return config;
46
+ const parsed = JSON.parse(jsonPart);
47
+
48
+ // If parsed is a string, convert to BuilderConfig with summary
49
+ if (typeof parsed === "string") {
50
+ return { summary: parsed };
51
+ }
52
+
53
+ // Otherwise expect an object
54
+ return parsed as BuilderConfig;
34
55
  } catch {
35
56
  return null;
36
57
  }