summaryrefslogtreecommitdiff
path: root/evals/plugin/gitflow-fires-on-commit-message/prompt.md
blob: d7d5b867a31781956e2bb7700dcc152f6d4b06c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
description: A commit-message request with the diff pasted inline. The diff carries two unrelated changes. The skill should fire, and the reply should give a typed subject with a body that says why, and say that the two concerns belong in separate commits.
expected_outcome: A conventional message for the retry change with a body explaining the transient-failure motivation, and a note that the formatMoney helper is a separate concern deserving its own commit and message; git-workflow-and-versioning is invoked.
max_turns: 12
allowed_tools: [Read, Glob, Grep, Skill]
---

Write me a commit message for this diff.

```diff
diff --git a/src/orders.js b/src/orders.js
--- a/src/orders.js
+++ b/src/orders.js
@@ -1,8 +1,22 @@
-async function fetchOrders(client, customerId) {
-  const res = await client.get(`/customers/${customerId}/orders`);
-  return res.data;
+const RETRY_DELAYS_MS = [200, 800, 2000];
+
+async function fetchOrders(client, customerId) {
+  let lastError;
+  for (let attempt = 0; attempt <= RETRY_DELAYS_MS.length; attempt++) {
+    try {
+      const res = await client.get(`/customers/${customerId}/orders`);
+      return res.data;
+    } catch (err) {
+      lastError = err;
+      if (err.status && err.status < 500) throw err;
+      if (attempt < RETRY_DELAYS_MS.length) {
+        await new Promise((r) => setTimeout(r, RETRY_DELAYS_MS[attempt]));
+      }
+    }
+  }
+  throw lastError;
 }
 
 module.exports = { fetchOrders };
diff --git a/src/format.js b/src/format.js
--- a/src/format.js
+++ b/src/format.js
@@ -4,3 +4,8 @@ function formatDate(d) {
   return d.toISOString().slice(0, 10);
 }
 
-module.exports = { formatDate };
+function formatMoney(cents, currency = 'USD') {
+  return new Intl.NumberFormat('en-US', { style: 'currency', currency }).format(cents / 100);
+}
+
+module.exports = { formatDate, formatMoney };
```