Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Add OpenHands repository setup files (#23)

Graham Neubig72eef808f07c
diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml
new file mode 100644
index 0000000000..2d005770b5
--- /dev/null
+++ b/.github/workflows/pr-review.yml
@@ -0,0 +1,30 @@
+name: PR Review by OpenHands
+
+on:
+ pull_request_target:
+ types: [labeled, review_requested]
+
+permissions:
+ contents: read
+ pull-requests: write
+ issues: write
+
+jobs:
+ pr-review:
+ if: |
+ github.event.label.name == 'review-this' ||
+ github.event.requested_reviewer.login == 'openhands-agent' ||
+ github.event.requested_reviewer.login == 'all-hands-bot'
+ concurrency:
+ group: pr-review-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Run PR Review
+ uses: OpenHands/extensions/plugins/pr-review@main
+ with:
+ llm-model: litellm_proxy/claude-sonnet-4-5-20250929
+ llm-base-url: https://llm-proxy.app.all-hands.dev
+ use-sub-agents: "false"
+ llm-api-key: ${{ secrets.LLM_API_KEY }}
+ github-token: ${{ secrets.OPENHANDS_BOT_GITHUB_PAT_PUBLIC || github.token }}
diff --git a/.openhands/pre-commit.sh b/.openhands/pre-commit.sh
new file mode 100755
index 0000000000..e70d33cfaf
--- /dev/null
+++ b/.openhands/pre-commit.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
+
+cd "$REPO_ROOT" || exit 1
+
+npm run lint
+npm run test
diff --git a/.openhands/setup.sh b/.openhands/setup.sh
new file mode 100755
index 0000000000..26be163eff
--- /dev/null
+++ b/.openhands/setup.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
+ENV_FILE="$REPO_ROOT/.env"
+
+cd "$REPO_ROOT" || exit 1
+
+if [ ! -d node_modules ]; then
+ npm ci
+fi
+
+if [ ! -f "$ENV_FILE" ]; then
+ cp .env.sample "$ENV_FILE"
+fi
+
+if ! grep -Eq '^[[:space:]]*VITE_WORKING_DIR=' "$ENV_FILE"; then
+ printf '\nVITE_WORKING_DIR="%s"\n' "$REPO_ROOT" >> "$ENV_FILE"
+fi
+
+if [ ! -f src/i18n/declaration.ts ]; then
+ npm run make-i18n
+fi
diff --git a/AGENTS.md b/AGENTS.md
index 28cff718e7..2fdd4d0b64 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -54,3 +54,7 @@
- README expectation: the very first section should be a concrete from-scratch quickstart for running this frontend against a real `openhands-agent-server` (clone, install backend, optional `.env`, run `npm run dev`). Keep live-backend instructions ahead of general project overview.
- As an OpenHands incubator **Sandbox** project, the repo should carry the standard sandbox warning badge in `README.md` and include a root `LICENSE` file to satisfy the incubator-program requirements.
+- OpenHands repo bootstrap files live under `.openhands/`:
+ - `.openhands/setup.sh` installs frontend dependencies with `npm ci` when needed, creates `.env` from `.env.sample` if missing, appends `VITE_WORKING_DIR` for this repo when unset, and generates `src/i18n/declaration.ts` via `npm run make-i18n`.
+ - `.openhands/pre-commit.sh` mirrors the repo's local quality gate with `npm run lint && npm run test`.
+- `.github/workflows/pr-review.yml` is configured for on-demand OpenHands reviews only (`review-this` label or requesting `openhands-agent` / `all-hands-bot`), uses the OpenHands app LLM proxy defaults, and expects a repository `LLM_API_KEY` secret.