12 Commits
Author SHA1 Message Date
John SmithandClaude 401fd85d07 Fix ocr scan: enumerate files explicitly for CI checkout
On a fresh CI checkout (actions/checkout), git diff is empty, so ocr
scan's auto-discovery finds 0 files to review. Replace the bare
--path '.' with an explicit comma-separated file list built from find.

This ensures every file under SCAN_PATH is reviewed, matching the
behavior ocr scan shows when run locally with a dirty working tree.

Co-Authored-By: Claude <[email protected]>
2026-07-30 13:45:35 -04:00
John SmithandClaude 0f7bfb29bc Fix ocr-scan: replace broken eval with direct command invocation
The eval-based flag building used embedded quotes inside variables,
which shell interprets as literal quote characters. This caused
ocr scan --path '. to become --path with value '.'\'' (including
quotes), making it scan an empty directory set and exit immediately.

Fix: invoke ocr scan directly with properly quoted arguments,
using shell conditional expansion for the optional --no-plan flag.

Co-Authored-By: Claude <[email protected]>
2026-07-30 13:34:52 -04:00
John SmithandClaude 1d1cf3ef23 Optimize OCR workflows: direct CLI, provider config, credential validation, concurrency/background/no-plan flags
Rewrite both ocr-review.yml and ocr-scan.yml to use direct CLI
invocation instead of the marketplace composite action, matching the
official OCR CI/CD documentation patterns.

Changes:
- ocr-review.yml: Replace alibaba/open-code-review@main action with
  direct 'ocr review' CLI. Add --background (PR title context),
  --concurrency (default 5), provider-based config (custom_providers.*),
  credential validation via 'ocr llm test', version pin to 1.8.1.
- ocr-scan.yml: Switch to same provider config model. Add --concurrency
  (default 5), --no-plan toggle (opt-out for speed, 'false' for quality).
  Fix default model from claude-sonnet-4-20250514 to deepseek-v4-flash.
  Add credential validation step.
- Design spec: docs/superpowers/specs/2026-07-30-ocr-workflow-optimization-design.md

Co-Authored-By: Claude <[email protected]>
2026-07-30 13:31:41 -04:00
John Smith 6eb60ecb84 Align ocr-scan LLM config with official CI/CD docs pattern
From official docs at integrations/ci.md:
- Use llm.* config keys (llm.url, llm.auth_token, llm.model,
  llm.use_anthropic) instead of custom_providers
- Add llm.extra_body to disable thinking mode for provider compat
- Model is configured via ocr config set, not --model flag

Docs ref: github.com/alibaba/open-code-review/blob/main/
  pages/src/content/docs/en/integrations/ci.md
2026-07-30 12:20:07 -04:00
John Smith b378f5b67d Fix ocr-scan: correct package, add LLM config, fix output handling
Root cause analysis (5-perspective adversarial review):

1. Wrong NPM package — used @open-code-review/cli (doesn't exist),
   correct is @alibaba-group/open-code-review (verified on npmjs.com)

2. Missing LLM config — OCR_LLM_URL/OCR_LLM_TOKEN are custom env vars
   OCR doesn't read. Added ocr config set step mapping to a custom
   provider with the protocol/url/key from workflow secrets.

3. No install verification — previous install step swallowed all
   errors with 2>/dev/null || true. Now uses npm install -g + ocr
   scan --help + ocr llm test for fail-fast verification.

4. Wrong output path — scan --format json writes JSON to stdout, not
   .ocr/result.json. Now captures stdout directly to .ocr/result.json.

5. Missing comments field in envelope — build-envelope.sh didn't
   handle .comments[] from scan output (only handled .issues and
   .review_comments). Added .comments extraction with field mapping.

Fixes:
- .github/workflows/ocr-scan.yml: Split into Install & Configure +
  Run Scan steps. Correct package, LLM config via custom provider,
  direct output capture, explicit --model flag.
- .github/actions/ocr-envelope/build-envelope.sh: Handle .comments[]
  from scan output, map to uniform findings format with file/line/
  message/severity, handle object-typed .summary field.
2026-07-30 12:18:44 -04:00
John Smith 23bd0ccee3 Fix jq stdin hang and broken OCR CLI install
Two bugs from previous 'cat | jq' fix commit:

1. All Summarize/Read Agent Output steps used 'jq -r ...'
   without file argument — jq reads stdin, hangs in GH Actions
   (stdin = /dev/null, parse error, empty output).
   Added '.agent/output.json' arg to every jq call.

2. ocr-scan.yml Install step swallowed errors (2>/dev/null || true),
   silently installing old OCR binary without 'scan' subcommand.
   Removed install step, replaced with 'npx @open-code-review/cli@latest
   scan' — always pulls latest from npm.

Also fixed jq in disabled Create Issues step.
2026-07-30 12:06:43 -04:00
John SmithandClaude 8cf36d27de Fix 'cat | jq' pipefail crashes in summarize steps
All workflow 'Summarize' / 'Read Agent Output' steps used
'cat file | jq ... >> ' pipelines. With
set -o pipefail (GitHub Actions default), a jq exit code 5 (parse
error on malformed JSON) would kill the entire step — even though
the envelope was written successfully.

Fix: Replace all cat|jq pipe patterns with direct 'jq -r ... file'
invocations. jq can read files directly without cat, and the error
handling uses 2>/dev/null || true for robust fallback when the file
happens to be malformed between write and read.

Co-Authored-By: Claude <[email protected]>
2026-07-30 11:43:53 -04:00
John SmithandClaude 5edce69249 Fix internal action references: use relative paths not org/repo@tag
When a workflow inside a repo references a composite action from the same
repo, it must use './.github/actions/name' — not 'org/repo/.github/actions/name@tag'.
The latter is for external repos and fails with 'Can't find action.yml'.

Fixed across all 10 workflow files.

Co-Authored-By: Claude <[email protected]>
2026-07-30 11:29:18 -04:00
John SmithandClaude 929f0a9c23 Fix CI failures: permissions, reserved secret name, pre-commit types
Three issues causing all workflow runs to fail:

1. github_token is a reserved name in workflow_call secrets
   - Renamed to repo_token across ocr-review, ocr-scan, release, and
     check-status workflows. Updated all secrets.repo_token refs.

2. Shell scripts not executable (exit code 126)
   - chmod +x all .sh files in .github/actions/

3. pre-commit types_or rejected 'typescript' type tag
   - Changed to 'ts' in .pre-commit-config.yaml for eslint and prettier hooks

Co-Authored-By: Claude <[email protected]>
2026-07-30 11:24:16 -04:00
John SmithandClaude c20975e3d2 Add ocr_llm_model secret for default model configuration
Users can now set OCR_LLM_MODEL as a GitHub secret to configure the
LLM model once at the repo/org level without exposing it in workflow files.

Resolution order: secrets.ocr_llm_model -> inputs.ocr-llm-model ->
vars.OCR_LLM_MODEL -> built-in default (claude-sonnet-4-20250514)

Updated both ocr-review and ocr-scan workflows plus README documentation.

Co-Authored-By: Claude <[email protected]>
2026-07-30 11:17:12 -04:00
John SmithandClaude d931be0fb8 Fix invalid GitHub secret names (hyphens -> underscores)
GitHub secret names can only contain alphanumeric and underscore characters.
Renamed all hyphenated secret names in workflow_call definitions to use
underscores instead:

- ocr-llm-url -> ocr_llm_url
- ocr-llm-token -> ocr_llm_token
- github-token -> github_token (across ocr-review, ocr-scan, release, check-status)
- npm-token -> npm_token (release.yml)

Updated all corresponding secrets.X references and README documentation.

Co-Authored-By: Claude <[email protected]>
2026-07-30 11:15:41 -04:00
John SmithandClaude fb2dcbbf25 Add Open Code Review (OCR) workflows for PR review and full codebase scan
Two new optional reusable workflows integrating alibaba/open-code-review into
the heretek-actions ecosystem:

- ocr-review.yml — AI-powered PR review on pull_request_target, with
  re-trigger support via /open-code-review or @open-code-review comments.
  Outputs .agent/output.json with findings for agent consumption.

- ocr-scan.yml — Full codebase scan on workflow_dispatch, scans the entire
  repo (or a sub-path) using OCR CLI. Outputs agent envelope with scan
  findings. Optional issue creation from findings.

Shared component:
- .github/actions/ocr-envelope/ — Composite action that reads OCR output
  and writes the standardized .agent/output.json with status, findings, and
  suggestions for agents to act upon.

Documentation:
- Updated README with OCR usage examples, configuration guide (secrets/vars),
  and workflow table entries

Co-Authored-By: Claude <[email protected]>
2026-07-30 11:05:50 -04:00