diff --git a/skills/ingest/scripts/open-pr.sh b/skills/ingest/scripts/open-pr.sh index cac5fc0..9ea4a9b 100644 --- a/skills/ingest/scripts/open-pr.sh +++ b/skills/ingest/scripts/open-pr.sh @@ -46,6 +46,12 @@ fi git commit -m "$title" git push -u origin "$branch" +# DRY_RUN: local git work done; skip the Forgejo API (offline tests). +if [[ -n "${DRY_RUN:-}" ]]; then + echo "PR opened: DRY-RUN ${branch} -> ${base}" + exit 0 +fi + # 2. Open the PR via Forgejo API (jq builds the JSON safely) body="$(cat "$body_file")" payload="$(jq -n --arg head "$branch" --arg base "$base" \ diff --git a/skills/ingest/scripts/run-ingest.sh b/skills/ingest/scripts/run-ingest.sh index b9fab70..5bb6964 100644 --- a/skills/ingest/scripts/run-ingest.sh +++ b/skills/ingest/scripts/run-ingest.sh @@ -16,7 +16,7 @@ manifest="${2:-.ingest-manifest.json}" SCRIPTS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" fail() { - jq -n --arg stage "$1" --arg reason "$2" \ + jq -nc --arg stage "$1" --arg reason "$2" \ '{status:"error", stage:$stage, reason:$reason}' exit 1 } @@ -72,12 +72,12 @@ done < <(jq -r '.pages[] | select(.status=="created") # --- 2. log entry --- out="$(jq -r '[.pages[].path | "[[" + (sub("^wiki/";"") | sub("\\.md$";"")) + "]]"] | join(", ")' "$manifest")" -"${SCRIPTS}/log-append.sh" --type INGEST --subject "$slug" --model "$model" \ +bash "${SCRIPTS}/log-append.sh" --type INGEST --subject "$slug" --model "$model" \ --context "[[${raw_source}]]" --output "${out:-*(none)*}" --reasoning "$reasoning" \ || fail "log" "log-append failed" # --- 3. scoped lint (capture findings for the PR; never aborts the run) --- -lint_out="$( "${SCRIPTS}/scoped-lint.sh" "$genome" "${all_paths[@]}" 2>&1 )" && lint_rc=0 || lint_rc=$? +lint_out="$( bash "${SCRIPTS}/scoped-lint.sh" "$genome" "${all_paths[@]}" 2>&1 )" && lint_rc=0 || lint_rc=$? # --- 4. assemble the PR body (manifest tables + lint results) --- body="$(mktemp)" @@ -102,13 +102,13 @@ body="$(mktemp)" # --- 5. open the PR --- pr_args=( --slug "$slug" --title "feat: ingest ${slug}" --body-file "$body" ) [[ -n "$conflict_label" ]] && pr_args+=( --label "$conflict_label" ) -pr_out="$( "${SCRIPTS}/open-pr.sh" "${pr_args[@]}" 2>&1 )" && pr_rc=0 || pr_rc=$? +pr_out="$( bash "${SCRIPTS}/open-pr.sh" "${pr_args[@]}" 2>&1 )" && pr_rc=0 || pr_rc=$? pr_url="$(printf '%s\n' "$pr_out" | sed -n 's/^PR opened: //p' | head -n1)" rm -f "$body" # --- final result line for n8n --- -jq -n \ +jq -nc \ --arg status "$([[ $pr_rc -eq 0 ]] && echo ok || echo pr_failed)" \ --arg slug "$slug" \ --arg pr_url "$pr_url" \