autopilot-code 0.2.3 → 0.2.5

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/cli.js CHANGED
@@ -300,6 +300,15 @@ function logsSystemdService() {
300
300
  (0, node_child_process_1.spawnSync)("journalctl", args, { stdio: "inherit" });
301
301
  }
302
302
  async function initCommand() {
303
+ const logo = `
304
+ _ _ _ _
305
+ (_) |_ _ ___ ___| |_ __ _| |
306
+ | | __| |/ _ \\/ __| __/ _\` | |
307
+ | | |_| | (_) \\__ \\ || (_| | |
308
+ |_|\\__|_|\\___/|___/\\__\\__,_|_|
309
+ `;
310
+ console.log(logo);
311
+ console.log();
303
312
  const cwd = process.cwd();
304
313
  const validation = validatePath(cwd);
305
314
  // 1. Ensure global config exists
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autopilot-code",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
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
@@ -426,8 +440,31 @@ I'm monitoring the CI checks and will auto-merge once they pass. This may take a
426
440
  # If mergeStateStatus is CLEAN or HAS_HOOKS and statusCheckRollup is null/empty → PASSED
427
441
  # If mergeStateStatus is UNKNOWN → wait and retry
428
442
  if [[ "$MERGE_STATE_STATUS" == "UNKNOWN" ]]; then
429
- CHECK_STATUS="PENDING"
430
- echo "[run_opencode_issue.sh] mergeStateStatus is UNKNOWN, waiting for GitHub to calculate..."
443
+ # Check if there are any CI checks configured
444
+ if command -v jq >/dev/null 2>&1; then
445
+ SCR_IS_NULL=$(echo "$PR_STATUS_JSON" | jq -r '.statusCheckRollup == null')
446
+ SCR_LENGTH=$(echo "$PR_STATUS_JSON" | jq -r '.statusCheckRollup | length // 0')
447
+ else
448
+ SCR_VALUE=$(python3 -c 'import json,sys; data=json.load(sys.stdin); print(data.get("statusCheckRollup", "null"))' <<<"$PR_STATUS_JSON")
449
+ SCR_IS_NULL=$([[ "$SCR_VALUE" == "null" ]] && echo "true" || echo "false")
450
+ SCR_LENGTH=$(python3 -c 'import json,sys; data=json.load(sys.stdin); scr=data.get("statusCheckRollup"); print(len(scr) if scr else 0)' <<<"$PR_STATUS_JSON")
451
+ fi
452
+
453
+ # If no checks configured, wait at most 20 seconds for them to appear
454
+ if [[ "$SCR_IS_NULL" == "true" ]] || [[ "$SCR_LENGTH" == "0" ]]; then
455
+ if [[ $POLL_ATTEMPT -lt 1 ]]; then
456
+ CHECK_STATUS="PENDING"
457
+ echo "[run_opencode_issue.sh] No CI checks configured, waiting up to 20 seconds for checks to appear..."
458
+ sleep 20
459
+ continue
460
+ else
461
+ CHECK_STATUS="PASSED"
462
+ echo "[run_opencode_issue.sh] No checks found after waiting 20 seconds, continuing to merge..."
463
+ fi
464
+ else
465
+ CHECK_STATUS="PENDING"
466
+ echo "[run_opencode_issue.sh] mergeStateStatus is UNKNOWN, waiting for GitHub to calculate..."
467
+ fi
431
468
  elif [[ "$MERGE_STATE_STATUS" == "CLEAN" || "$MERGE_STATE_STATUS" == "HAS_HOOKS" ]]; then
432
469
  # Check statusCheckRollup - if null/empty, no checks configured, so PASSED
433
470
  if command -v jq >/dev/null 2>&1; then