Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 105 additions & 90 deletions .github/workflows/opencode-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
# triggers: [pull_request]
# variants:
# - name: standard
# description: Uses standard GitHub Actions with direct API calls
# - name: nix
# description: Uses Nix for reproducible environment
# description: Uses OpenCode GitHub Action
# ---

name: OpenCode AI PR Review
Expand All @@ -24,102 +22,119 @@ on:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
review:
opencode:
# Don't run on draft PRs; do run when they become ready_for_review.
if: ${{ github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false

timeout-minutes: 10
permissions:
id-token: write
contents: write
pull-requests: write
issues: read

steps:
- name: Checkout code
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get PR diff
id: diff
- name: Configure git
run: |
git diff origin/${{ github.base_ref }}...HEAD > pr_diff.txt
echo "diff_path=pr_diff.txt" >> $GITHUB_OUTPUT
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Get previous review comments
id: previous-comments
uses: actions/github-script@v7
with:
script: |
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
const opencodeComments = comments.data.filter(c =>
c.user.login === 'github-actions[bot]' &&
c.body.includes('OpenCode AI Review')
);
return opencodeComments.map(c => c.body).join('\n---\n');

- name: Run OpenCode AI Review
- name: Run opencode
uses: anomalyco/opencode/github@latest
env:
KIMI_API_KEY: ${{ secrets.KIMI_API_KEY }}
PR_DIFF: ${{ steps.diff.outputs.diff_path }}
PREVIOUS_COMMENTS: ${{ steps.previous-comments.outputs.result }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_DESCRIPTION: ${{ github.event.pull_request.body }}
run: |
# Read the diff file
DIFF_CONTENT=$(cat "$PR_DIFF")

# Create the review prompt
PROMPT=$(cat <<EOF
You are an expert code reviewer. Review the following pull request:

Title: $PR_TITLE
Description: $PR_DESCRIPTION

Previous Review Context:
$PREVIOUS_COMMENTS

Code Changes:
\`\`\`diff
$DIFF_CONTENT
\`\`\`

Provide a structured review with:
1. Overall assessment (merge-ready, needs changes, etc.)
2. Critical issues (if any)
3. High-priority improvements
4. Medium-priority suggestions
5. Low-priority nitpicks
6. Confidence score (0-100)

Format as markdown with clear headers.
EOF
)

# Call OpenCode AI API
curl -X POST https://api.opencode.ai/v1/chat/completions \
-H "Authorization: Bearer $KIMI_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"kimi-latest\",
\"messages\": [{\"role\": \"user\", \"content\": $(echo "$PROMPT" | jq -Rs .)}]
}" > review_response.json

# Extract and post review
REVIEW_TEXT=$(cat review_response.json | jq -r '.choices[0].message.content')

echo "$REVIEW_TEXT" > review_output.txt
cat review_output.txt

- name: Post review comment
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const reviewText = fs.readFileSync('review_output.txt', 'utf8');
const formattedReview = `## OpenCode AI Review 🤖\n\n${reviewText}`;
model: kimi-for-coding/k2p5
prompt: |
You are reviewing a pull request. Analyze the code changes and output your review in the following STRICT STRUCTURE:

---

## 📋 Summary
First, check if the PR description mentions any linked issues (e.g., "Closes #123", "Fixes #456", "Resolves #789").

If linked issues are found:
- Mention the issue number(s) explicitly
- Verify the PR actually implements what the issue(s) requested
- State whether the implementation fully satisfies the issue requirements

Then provide 2-3 sentences summarizing the PR purpose, scope, and overall quality.

## 🔴 Critical Issues (Must Fix - Blocks Merge)
Only issues that could cause crashes, security vulnerabilities, data loss, or major bugs.

For each issue, use this exact format:
```
**[CRITICAL]** `File:Line` - Issue Title
**Confidence:** High|Medium|Low (how sure you are this is a real problem)
**Description:** Clear explanation of the issue
**Impact:** What could go wrong if merged
**Suggested Fix:** Specific code changes needed
```

## ⚠️ High Priority Issues (Should Fix)
Significant code quality issues, potential bugs, or architectural problems.

Same format as Critical, but with **[HIGH]** prefix.

## 💡 Medium Priority Issues (Nice to Fix)
Style issues, minor optimizations, or code clarity improvements.

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: formattedReview
});
Same format, with **[MEDIUM]** prefix.

## ℹ️ Low Priority Suggestions (Optional)
Minor suggestions, documentation improvements, or subjective preferences.

Same format, with **[LOW]** prefix.

## 📊 SOLID Principles Score
| Principle | Score | Notes |
|-----------|-------|-------|
| Single Responsibility | 0-10 | Brief justification |
| Open/Closed | 0-10 | Brief justification |
| Liskov Substitution | 0-10 | Brief justification |
| Interface Segregation | 0-10 | Brief justification |
| Dependency Inversion | 0-10 | Brief justification |
| **Average** | **X.X** | |

## 🎯 Final Assessment

### Overall Confidence Score: XX%
Rate your confidence in this PR being ready to merge (0-100%).
**How to interpret:**
- 0-30%: Major concerns, do not merge without significant rework
- 31-60%: Moderate concerns, several issues need addressing
- 61-80%: Minor concerns, mostly ready with some fixes
- 81-100%: High confidence, ready to merge or with trivial fixes

### Confidence Breakdown:
- **Code Quality:** XX% (how well-written is the code?)
- **Completeness:** XX% (does it fulfill requirements?)
- **Risk Level:** XX% (how risky is this change?)
- **Test Coverage:** XX% (are changes adequately tested?)

### Merge Readiness:
- [ ] All critical issues resolved
- [ ] SOLID average score >= 6.0
- [ ] Overall confidence >= 60%
- [ ] No security concerns
- [ ] Tests present and passing (if applicable)

### Verdict:
**MERGE** | **MERGE WITH FIXES** | **DO NOT MERGE**

One-sentence explanation of the verdict.

---

**Review Guidelines:**
1. Check the PR description for linked issues ("Fixes #123", "Closes #456", etc.) and verify the implementation
2. Be extremely specific with file paths and line numbers
3. Confidence scores should reflect how certain you are - use "Low" when unsure
4. If you have nothing meaningful to add to a section, write "None identified" instead of omitting it
5. Always provide actionable fixes, never just complaints
29 changes: 29 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Source files (we publish compiled dist/)
src/

# Development
node_modules/
.github/
CLAUDE.md
AGENTS.md
.env
.env.local

# Build artifacts
dist/**/*.test.js
dist/**/*.test.d.ts
*.log

# IDE
.vscode/
.idea/
*.swp
*.swo

# Testing
coverage/
.nyc_output/

# OS
.DS_Store
Thumbs.db
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Agent Guidelines for workflow-automator
# Agent Guidelines for ActionFlow

This document provides guidelines for AI agents working on this repository.

Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 OpenStaticFish

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workflow Automator
# ActionFlow

Interactive TUI for installing curated GitHub Actions workflows with a cyberpunk aesthetic.

Expand Down Expand Up @@ -30,8 +30,8 @@ bun run src/tui/index.tsx
Or install globally:

```bash
bun link
workflow-automator
bun install -g @openstaticfish/actionflow
actionflow
```

## Keyboard Shortcuts
Expand All @@ -50,7 +50,7 @@ workflow-automator

```
┌─────────────────────────────────────────────────────────────────┐
│ ⚡ WORKFLOW AUTOMATOR v1.0 Category: [opencode ▼] │
│ ⚡ ACTIONFLOW v0.1.0 Category: [opencode ▼] │
├──────────────────┬──────────────────────────────────────────────┤
│ 🌲 Tree │ ┌─ Workflow Details ──────────────────────┐│
│ ▾ pr │ │ 🔍 OpenCode AI PR Review ││
Expand Down
52 changes: 46 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,59 @@
{
"name": "workflow-automator",
"module": "src/tui/index.tsx",
"type": "module",
"private": true,
"name": "@openstaticfish/actionflow",
"version": "0.1.0",
"description": "A terminal UI tool for managing and installing GitHub Actions workflow templates",
"license": "MIT",
"author": "OpenStaticFish <contact@openstaticfish.com>",
"repository": {
"type": "git",
"url": "https://github.com/openstaticfish/actionflow.git"
},
"homepage": "https://github.com/openstaticfish/actionflow#readme",
"bugs": {
"url": "https://github.com/openstaticfish/actionflow/issues"
},
"keywords": [
"github-actions",
"workflow",
"cli",
"terminal",
"tui",
"automation",
"ci-cd",
"templates"
],
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"bin": {
"workflow-automator": "./src/tui/index.tsx"
"actionflow": "./dist/index.js",
"af": "./dist/index.js"
},
"files": [
"dist",
"workflows",
"README.md",
"LICENSE"
],
"engines": {
"bun": ">=1.0.0"
},
"scripts": {
"start": "bun run src/tui/index.tsx",
"build": "bun build src/tui/index.tsx --outdir=dist --target=bun",
"build:types": "tsc --declaration --emitDeclarationOnly --outDir dist",
"prepublishOnly": "bun run build && bun run build:types",
"test": "bun test"
},
"devDependencies": {
"@types/bun": "latest",
"@types/react": "^18.2.0"
"@types/react": "^18.2.0",
"typescript": "^5.0.0"
},
"peerDependencies": {
"typescript": "^5"
Expand Down
2 changes: 1 addition & 1 deletion src/tui/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function Header({
alignItems="center"
>
<Text bold color={cyberpunkTheme.colors.primary}>
WORKFLOW AUTOMATOR
ACTIONFLOW
</Text>

<Box marginLeft={2}>
Expand Down
Loading