asepharyana
4fa7d8b6d0
fix(cli): fallback to user-local private key + record analytics
...
- cli.ts: key resolution now falls back to ~/.hermes/keys/pr-agent-key.pem
when /opt/pr-agent-server/private-key.pem is EACCES/ENOENT (CLI as
non-root user works out of the box)
- cli.ts+index.ts: export logReviewEvent; CLI now records an analytics
event (describe/improve/review) in the legacy pr-agent.*.log format,
best-effort (never fails the CLI on a log write), honoring
PR_AGENT_ANALYTICS_DIR
- Verified: 16/16 tests, tsc clean, describe publishes, review publishes
(comment 5757282509), webhook 403/ping/ignored paths correct
2026-09-21 15:11:36 +07:00
asepharyana
608b52a0e5
feat(server): port /describe and /improve tools + real analytics
...
Phase 8 (extras) complete:
- describe.ts — full port of pr_description: type/title/description/diagram/
per-file walkthrough table, PATCH /pulls to update description, optional
labels. Verified live: PR #19 body updated with AI description (Type,
Description bullets, mermaid diagram, file walkthrough table).
- improve.ts — full port of pr_code_suggestions summarize path:
getPrMultiDiffs chunking, parallel LLM calls, score filtering, category
table with unified diff snippets + persistent comment with history.
Verified live: persistent update of existing '## PR Code Suggestions ✨ '
comment (updated_at 07:26:53) with new table.
- prompts.ts — verbatim pr_description_prompts.toml + code_suggestions prompts
- github.ts — getLineLink (SHA-256 diff anchor like pr_agent), getLabels,
updateDescription (pulls.update); getPrMultiDiffs in diff.ts
- index.ts — real analytics: readLegacy pr-agent.*.log files (mtime-sorted,
fixes pid-filename ordering bug), logReviewEvent writes legacy-format
events, /api/metrics + /api/analytics now serve real data (427 events,
per-command breakdown)
- cli.ts — --tool review|describe|improve
- tests 16/16, tsc clean
2026-09-21 14:36:02 +07:00
asepharyana
bc69998d8e
feat(server): production cut-over to Bun — notify_review, setup/callback, key resolution
...
- index.ts: add POST /api/v1/notify_review (queue-worker Discord bridge),
/setup/callback (GitHub App manifest conversion), error logging on review
failure, PR_AGENT_APP_DIR-based private key resolution
- config.ts: API key falls back to on-disk omniroute_key (same source as
run_server.py) when no env key present — fixes 401 in systemd context
- markdown.ts: don't hyperlink non-URL ticket values (N/A)
- secrets.ts: fallback private key from ~/.hermes/keys + omni key ~/.hermes
- pr-queue-worker.py / auto_merge_bot.py: notify_review default port 4002→4023
Deploy: pr-agent-bun.service (Bun binary, port 4023) replaces
pr-agent-server.service (Python, port 4002, disabled). Caddy route updated in
asepharyana/infra (proxy 4023). Verified live: webhook → review → claude-opus-5
→ persistent GitHub comment published after Python shutdown.
2026-09-21 13:47:47 +07:00
asepharyana
055501aed1
feat(server): Bun/TypeScript re-implementation of PR review engine
...
Reimplements the pr_agent review pipeline (previously Python package) in
Bun/TypeScript, verified end-to-end against a real GitHub App + 9router:
- src/diff.ts: git patch processing (extend_patch, line-numbered hunks,
token-budget generate_full_patch, generated/invalid file filters)
- src/review.ts: orchestrator (fetch PR/diff -> render prompts -> LLM ->
YAML parse -> markdown render -> publish), fallback models
- src/github.ts: GitHub App auth via @octokit/auth-app (JWT -> installation
token, custom authStrategy for Bun), PR/diff/languages/comments REST
- src/prompts.ts: verbatim pr_reviewer_prompts.toml port (nunjucks templates)
- src/yaml.ts: resilient load_yaml with 9 fallback fixers
- src/markdown.ts: convert_to_markdown_v2 port ('PR Reviewer Guide' comment)
- src/llm.ts: 9router OpenAI-compatible chat completions (non-stream,
temp omitted for claude-opus-5), timeout 600s
- src/token.ts: js-tiktoken o200k counting
- src/index.ts: webhook server (HMAC verify, segment analytics, /health,
/api/metrics) + cli.ts one-shot review
- e2e.ts: real-world harness (bun e2e --repo o/r --pr N [--publish])
Verified: bun test 13/13, tsc clean, E2E published a real review comment
(## PR Reviewer Guide) on asepharyana/nextjs-template#19 via GitHub App
MythEclipseBotReview + claude-opus-5 through 9router.
Python run_server.py + pr_agent remain for the live queue worker; server/
is the replacement path.
2026-09-21 12:50:10 +07:00