wile 0.4.20 → 0.4.21
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/dist/agent/scripts/claude-stream.js +3 -0
- package/dist/agent/scripts/opencode-stream.js +3 -0
- package/dist/agent/scripts/prompt-preflight.md +9 -1
- package/dist/agent/scripts/test-preflight-claude-docker.sh +89 -0
- package/dist/agent/scripts/test-preflight-docker.sh +6 -2
- package/package.json +1 -1
|
@@ -16,6 +16,9 @@ const extractText = (content) => {
|
|
|
16
16
|
if (!chunk || typeof chunk !== "object") continue;
|
|
17
17
|
if (chunk.type === "text" && typeof chunk.text === "string") {
|
|
18
18
|
process.stdout.write(chunk.text);
|
|
19
|
+
if (!chunk.text.endsWith("\n")) {
|
|
20
|
+
process.stdout.write("\n");
|
|
21
|
+
}
|
|
19
22
|
continue;
|
|
20
23
|
}
|
|
21
24
|
if (chunk.type === "thinking" && typeof chunk.thinking === "string") {
|
|
@@ -28,6 +28,8 @@ cat .wile/prd.json
|
|
|
28
28
|
**Failures:**
|
|
29
29
|
- ...
|
|
30
30
|
```
|
|
31
|
+
- Under **Checks run**, include the exact command(s) you executed (verbatim).
|
|
32
|
+
- Under **Failures**, include the specific missing file names or failing commands.
|
|
31
33
|
|
|
32
34
|
- If GitHub is configured (`WILE_REPO_SOURCE=github` or `GITHUB_REPO_URL` is set), commit and push the progress update:
|
|
33
35
|
|
|
@@ -46,10 +48,16 @@ The entire response must be exactly that single line. No other text before or af
|
|
|
46
48
|
|
|
47
49
|
5. If all checks pass, respond with exactly:
|
|
48
50
|
```
|
|
49
|
-
<promise>
|
|
51
|
+
<promise>PREFLIGHT_SUCCEEDED</promise>
|
|
50
52
|
```
|
|
51
53
|
The entire response must be exactly that single line. No other text before or after. No extra lines. No markdown. No backticks. No code blocks.
|
|
52
54
|
|
|
55
|
+
## Strict Output Rules
|
|
56
|
+
|
|
57
|
+
- Output must contain exactly one promise tag.
|
|
58
|
+
- Never repeat the promise tag on the same line or across multiple lines.
|
|
59
|
+
- Never include any other text before or after the promise tag.
|
|
60
|
+
|
|
53
61
|
## Notes
|
|
54
62
|
|
|
55
63
|
- Preflight may have side effects if the checks require them.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
ROOT_DIR=$(cd "$(dirname "$0")/../../.." && pwd)
|
|
5
|
+
AGENT_DIR="$ROOT_DIR/packages/agent"
|
|
6
|
+
|
|
7
|
+
if [ -z "${CC_CLAUDE_CODE_OAUTH_TOKEN:-}" ] && [ -z "${CC_ANTHROPIC_API_KEY:-}" ]; then
|
|
8
|
+
echo "error: CC_CLAUDE_CODE_OAUTH_TOKEN or CC_ANTHROPIC_API_KEY is required" >&2
|
|
9
|
+
exit 1
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
docker build -t wile-agent:local "$AGENT_DIR" >/dev/null
|
|
13
|
+
|
|
14
|
+
TMP_DIR=$(mktemp -d /tmp/wile-preflight-claude-XXXXXX)
|
|
15
|
+
cleanup() {
|
|
16
|
+
rm -rf "$TMP_DIR"
|
|
17
|
+
}
|
|
18
|
+
trap cleanup EXIT INT TERM
|
|
19
|
+
|
|
20
|
+
mkdir -p "$TMP_DIR/.wile"
|
|
21
|
+
cat > "$TMP_DIR/.wile/prd.json" <<'JSON'
|
|
22
|
+
{
|
|
23
|
+
"userStories": [
|
|
24
|
+
{
|
|
25
|
+
"id": "US-TEST-CLAUDE-001",
|
|
26
|
+
"title": "Preflight fail test (claude)",
|
|
27
|
+
"acceptanceCriteria": ["n/a"],
|
|
28
|
+
"priority": 1,
|
|
29
|
+
"passes": false
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
JSON
|
|
34
|
+
|
|
35
|
+
cat > "$TMP_DIR/.wile/preflight.md" <<'MD'
|
|
36
|
+
- Verify the file exists:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
test -f /proc/this-file-should-not-exist
|
|
40
|
+
```
|
|
41
|
+
MD
|
|
42
|
+
|
|
43
|
+
OUTPUT_FILE="$TMP_DIR/output.txt"
|
|
44
|
+
|
|
45
|
+
set +e
|
|
46
|
+
docker run --rm \
|
|
47
|
+
-e CODING_AGENT=CC \
|
|
48
|
+
-e CC_CLAUDE_MODEL=haiku \
|
|
49
|
+
-e CC_CLAUDE_CODE_OAUTH_TOKEN="${CC_CLAUDE_CODE_OAUTH_TOKEN:-}" \
|
|
50
|
+
-e CC_ANTHROPIC_API_KEY="${CC_ANTHROPIC_API_KEY:-}" \
|
|
51
|
+
-e WILE_REPO_SOURCE=local \
|
|
52
|
+
-e WILE_LOCAL_REPO_PATH=/home/wile/workspace/repo \
|
|
53
|
+
-e MAX_ITERATIONS=1 \
|
|
54
|
+
-v "$TMP_DIR:/home/wile/workspace/repo" \
|
|
55
|
+
wile-agent:local 2>&1 | tee "$OUTPUT_FILE"
|
|
56
|
+
EXIT_CODE=$?
|
|
57
|
+
set -e
|
|
58
|
+
|
|
59
|
+
fail() {
|
|
60
|
+
local message="$1"
|
|
61
|
+
echo "error: $message" >&2
|
|
62
|
+
if [ -f "$OUTPUT_FILE" ]; then
|
|
63
|
+
echo "output (tail):" >&2
|
|
64
|
+
tail -n 80 "$OUTPUT_FILE" >&2
|
|
65
|
+
fi
|
|
66
|
+
exit 1
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if [ "$EXIT_CODE" -eq 0 ]; then
|
|
70
|
+
fail "expected non-zero exit code for preflight failure"
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
grep -q "Model: haiku" "$OUTPUT_FILE" || fail "expected haiku model in output"
|
|
74
|
+
grep -q "PREFLIGHT FAILED - Cannot continue" "$OUTPUT_FILE" || fail "missing preflight failure banner"
|
|
75
|
+
grep -q "^<promise>PREFLIGHT_FAILED</promise>$" "$OUTPUT_FILE" || fail "missing preflight failed promise line"
|
|
76
|
+
grep -q "/proc/this-file-should-not-exist" "$OUTPUT_FILE" || fail "missing preflight check command in output"
|
|
77
|
+
if grep -q "PREFLIGHT_SUCCEEDED" "$OUTPUT_FILE"; then
|
|
78
|
+
fail "preflight should not succeed in claude failure test"
|
|
79
|
+
fi
|
|
80
|
+
if grep -q "Iteration 1 of" "$OUTPUT_FILE"; then
|
|
81
|
+
fail "preflight failure should stop before main loop"
|
|
82
|
+
fi
|
|
83
|
+
if [ ! -f "$TMP_DIR/.wile/progress.txt" ]; then
|
|
84
|
+
fail "expected progress log to be written on preflight failure"
|
|
85
|
+
fi
|
|
86
|
+
grep -q "PREFLIGHT FAILED" "$TMP_DIR/.wile/progress.txt" || fail "progress log missing failure entry"
|
|
87
|
+
grep -q "/proc/this-file-should-not-exist" "$TMP_DIR/.wile/progress.txt" || fail "progress log missing failed check detail"
|
|
88
|
+
|
|
89
|
+
echo "test-preflight-claude-docker: ok"
|
|
@@ -56,7 +56,7 @@ MD
|
|
|
56
56
|
-e WILE_MOCK_CLAUDE=true \
|
|
57
57
|
-e WILE_MOCK_MODE=preflight_fail \
|
|
58
58
|
-v "$TMP_DIR:/home/wile/workspace/repo" \
|
|
59
|
-
wile-agent:local
|
|
59
|
+
wile-agent:local 2>&1 | tee "$OUTPUT_FILE"
|
|
60
60
|
EXIT_CODE=$?
|
|
61
61
|
set -e
|
|
62
62
|
|
|
@@ -66,6 +66,10 @@ MD
|
|
|
66
66
|
fi
|
|
67
67
|
|
|
68
68
|
grep -q "PREFLIGHT FAILED - Cannot continue" "$OUTPUT_FILE"
|
|
69
|
+
if grep -q "Iteration 1 of" "$OUTPUT_FILE"; then
|
|
70
|
+
echo "error: preflight failure should stop before main loop" >&2
|
|
71
|
+
exit 1
|
|
72
|
+
fi
|
|
69
73
|
grep -q "PREFLIGHT FAILED" "$TMP_DIR/.wile/progress.txt"
|
|
70
74
|
|
|
71
75
|
rm -rf "$TMP_DIR"
|
|
@@ -113,7 +117,7 @@ MD
|
|
|
113
117
|
-e MAX_ITERATIONS=1 \
|
|
114
118
|
-e WILE_MOCK_CLAUDE=true \
|
|
115
119
|
-v "$TMP_DIR:/home/wile/workspace/repo" \
|
|
116
|
-
wile-agent:local
|
|
120
|
+
wile-agent:local 2>&1 | tee "$OUTPUT_FILE"
|
|
117
121
|
EXIT_CODE=$?
|
|
118
122
|
set -e
|
|
119
123
|
|