autopilot-code 0.2.2 → 0.2.4

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": "autopilot-code",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "private": false,
5
5
  "description": "Repo-issue–driven autopilot runner",
6
6
  "license": "MIT",
@@ -147,7 +147,21 @@ Provide your analysis and plan in a clear, structured format. Focus on WHAT need
147
147
 
148
148
  # Run opencode to generate the plan
149
149
  cd "$WORKTREE"
150
- PLAN_OUTPUT=$("$OPENCODE_BIN" run "$PLANNING_PROMPT" 2>&1 || echo "Planning failed")
150
+ RAW_OUTPUT=$("$OPENCODE_BIN" run "$PLANNING_PROMPT" 2>&1 || echo "Planning failed")
151
+
152
+ # Filter out noise - keep only the final plan output
153
+ # Remove tool calls, internal logs, and system messages
154
+ PLAN_OUTPUT=$(echo "$RAW_OUTPUT" | grep -vE '^\s*(bash|read|write|edit|grep|glob|question|task|webfetch|google_search|morph-mcp|todowrite|todoread|skill|search)\s' | \
155
+ grep -vE '^\s*(Running|Executing|File:|Offset:|Limit:|parameters:|pattern:|path:|include:)' | \
156
+ grep -vE '^<[a-z_]+>|^<\/[a-z_]+>|^system:|^user:|^assistant:|^model:' | \
157
+ grep -vE '^\s*\$|^\s*\[.*\]|^Using|Called|Invoked' | \
158
+ grep -vE '^\s*$|^(command|description|filePath|oldString|newString|questions|header|options):' | \
159
+ tail -100)
160
+
161
+ # If filtering removed everything, use a fallback
162
+ if [[ -z "$PLAN_OUTPUT" ]]; then
163
+ PLAN_OUTPUT="Unable to extract a clean plan. The raw output contained excessive tool logs."
164
+ fi
151
165
 
152
166
  # Post the plan as a comment on the issue
153
167
  PLAN_COMMENT="## 📋 Implementation Plan
@@ -431,16 +445,65 @@ I'm monitoring the CI checks and will auto-merge once they pass. This may take a
431
445
  elif [[ "$MERGE_STATE_STATUS" == "CLEAN" || "$MERGE_STATE_STATUS" == "HAS_HOOKS" ]]; then
432
446
  # Check statusCheckRollup - if null/empty, no checks configured, so PASSED
433
447
  if command -v jq >/dev/null 2>&1; then
434
- CHECK_STATUS=$(echo "$PR_STATUS_JSON" | jq -r '.statusCheckRollup | if . == null or length == 0 then "PASSED" elif map(.conclusion) | any(. == "FAILURE") then "FAILED" elif map(.conclusion) | any(. == "PENDING") or any(. == "QUEUED") then "PENDING" else "PASSED" end')
448
+ # Debug: log the statusCheckRollup value
449
+ SCR_VALUE=$(echo "$PR_STATUS_JSON" | jq -r '.statusCheckRollup')
450
+ echo "[run_opencode_issue.sh] Debug: statusCheckRollup value = $SCR_VALUE"
451
+
452
+ # Check if statusCheckRollup is null or empty array
453
+ SCR_IS_NULL=$(echo "$PR_STATUS_JSON" | jq -r '.statusCheckRollup == null')
454
+ SCR_LENGTH=$(echo "$PR_STATUS_JSON" | jq -r '.statusCheckRollup | length // 0')
455
+ echo "[run_opencode_issue.sh] Debug: statusCheckRollup is_null=$SCR_IS_NULL, length=$SCR_LENGTH"
456
+
457
+ if [[ "$SCR_IS_NULL" == "true" ]] || [[ "$SCR_LENGTH" == "0" ]]; then
458
+ CHECK_STATUS="PASSED"
459
+ echo "[run_opencode_issue.sh] No CI checks configured (statusCheckRollup is null/empty)"
460
+ else
461
+ # Has checks - determine status
462
+ CHECK_STATUS=$(echo "$PR_STATUS_JSON" | jq -r '.statusCheckRollup | map(.conclusion) | if any(. == "FAILURE") then "FAILED" elif any(. == "PENDING") or any(. == "QUEUED") then "PENDING" else "PASSED" end')
463
+ echo "[run_opencode_issue.sh] CI checks found, status = $CHECK_STATUS"
464
+ fi
435
465
  else
466
+ # Python fallback
467
+ SCR_VALUE=$(python3 -c 'import json,sys; data=json.load(sys.stdin); print(data.get("statusCheckRollup", "null"))' <<<"$PR_STATUS_JSON")
468
+ echo "[run_opencode_issue.sh] Debug: statusCheckRollup value = $SCR_VALUE"
469
+
436
470
  CHECK_STATUS=$(python3 -c 'import json,sys; data=json.load(sys.stdin); scr=data.get("statusCheckRollup"); print("PASSED" if not scr or len(scr)==0 else "FAILED" if any(c.get("conclusion")=="FAILURE" for c in scr) else "PENDING" if any(c.get("conclusion") in ["PENDING","QUEUED"] for c in scr) else "PASSED")' <<<"$PR_STATUS_JSON")
471
+
472
+ if [[ "$SCR_VALUE" == "null" ]] || [[ "$SCR_VALUE" == "[]" ]]; then
473
+ echo "[run_opencode_issue.sh] No CI checks configured (statusCheckRollup is null/empty)"
474
+ fi
437
475
  fi
438
476
  elif [[ "$MERGE_STATE_STATUS" == "BLOCKED" ]]; then
439
477
  # If mergeStateStatus is BLOCKED, check if it's due to failed checks
478
+ echo "[run_opencode_issue.sh] mergeStateStatus is BLOCKED, checking if due to failed checks"
440
479
  if command -v jq >/dev/null 2>&1; then
441
- CHECK_STATUS=$(echo "$PR_STATUS_JSON" | jq -r '.statusCheckRollup | if . == null or length == 0 then "PASSED" elif map(.conclusion) | any(. == "FAILURE") then "FAILED" elif map(.conclusion) | any(. == "PENDING") or any(. == "QUEUED") then "PENDING" else "PASSED" end')
480
+ # Debug: log the statusCheckRollup value
481
+ SCR_VALUE=$(echo "$PR_STATUS_JSON" | jq -r '.statusCheckRollup')
482
+ echo "[run_opencode_issue.sh] Debug: statusCheckRollup value = $SCR_VALUE"
483
+
484
+ # Check if statusCheckRollup is null or empty array
485
+ SCR_IS_NULL=$(echo "$PR_STATUS_JSON" | jq -r '.statusCheckRollup == null')
486
+ SCR_LENGTH=$(echo "$PR_STATUS_JSON" | jq -r '.statusCheckRollup | length // 0')
487
+ echo "[run_opencode_issue.sh] Debug: statusCheckRollup is_null=$SCR_IS_NULL, length=$SCR_LENGTH"
488
+
489
+ if [[ "$SCR_IS_NULL" == "true" ]] || [[ "$SCR_LENGTH" == "0" ]]; then
490
+ CHECK_STATUS="FAILED"
491
+ echo "[run_opencode_issue.sh] No CI checks but mergeStateStatus is BLOCKED - other blocking issue"
492
+ else
493
+ # Has checks - determine status
494
+ CHECK_STATUS=$(echo "$PR_STATUS_JSON" | jq -r '.statusCheckRollup | map(.conclusion) | if any(. == "FAILURE") then "FAILED" elif any(. == "PENDING") or any(. == "QUEUED") then "PENDING" else "PASSED" end')
495
+ echo "[run_opencode_issue.sh] CI checks found, status = $CHECK_STATUS"
496
+ fi
442
497
  else
498
+ # Python fallback
499
+ SCR_VALUE=$(python3 -c 'import json,sys; data=json.load(sys.stdin); print(data.get("statusCheckRollup", "null"))' <<<"$PR_STATUS_JSON")
500
+ echo "[run_opencode_issue.sh] Debug: statusCheckRollup value = $SCR_VALUE"
501
+
443
502
  CHECK_STATUS=$(python3 -c 'import json,sys; data=json.load(sys.stdin); scr=data.get("statusCheckRollup"); print("PASSED" if not scr or len(scr)==0 else "FAILED" if any(c.get("conclusion")=="FAILURE" for c in scr) else "PENDING" if any(c.get("conclusion") in ["PENDING","QUEUED"] for c in scr) else "PASSED")' <<<"$PR_STATUS_JSON")
503
+
504
+ if [[ "$SCR_VALUE" == "null" ]] || [[ "$SCR_VALUE" == "[]" ]]; then
505
+ echo "[run_opencode_issue.sh] No CI checks but mergeStateStatus is BLOCKED - other blocking issue"
506
+ fi
444
507
  fi
445
508
  else
446
509
  # Other states (DRAFT, DIRTY, BEHIND) - mark as FAILED to exit