Skip to content

[WIP] Add refactoring Agent#4

Draft
alpe wants to merge 5 commits intomainfrom
alex/refactoring-agent
Draft

[WIP] Add refactoring Agent#4
alpe wants to merge 5 commits intomainfrom
alex/refactoring-agent

Conversation

@alpe
Copy link

@alpe alpe commented Mar 6, 2026

Goal: Build a Level-1 autonomous agent using @mariozechner/pi-agent-core + @mariozechner/pi-ai that fetches GitHub PR diffs since its last run, synthesizes them with local skill docs, and opens a draft PR with prioritised refactoring suggestions.

@alpe alpe changed the title [WIP] Refactoring Agent [WIP] Add refactoring Agent Mar 6, 2026
alpe added 4 commits March 6, 2026 17:24
- Task 1: Project scaffolding (package.json, tsconfig.json, .gitignore)
- Task 2: Config & state management (src/config.ts, src/state.ts)
- Task 3: GitHub API tools (src/tools/{list-prs,get-pr-diff,create-draft-pr}.ts)
- Task 4: Skills context loader (src/skills.ts)
- Task 5: System prompt (prompts/system.md)
- Task 6: Agent orchestrator (src/index.ts) using getModel + Agent from pi-agent-core
- Task 7: README.md with setup/run/architecture docs
- Task 8: Unit tests (src/tools/list-prs.test.ts, vitest.config.ts)
- create-draft-pr: re-throw non-422 errors instead of swallowing all
- create-draft-pr: accept explicit base branch param (removes extra API call)
- list-prs: add pagination with early-exit (was silently missing >50 PRs)
- skills: use recursive readdirSync to pick up nested skill files
- state: rename getSince -> getEffectiveSince for clarity
- index: remove redundant waitForIdle(), tighten user prompt to one line
- index: pass BASE_BRANCH env var to create-draft-pr tool
- tsconfig: switch module/moduleResolution to ESNext/Bundler for vitest compat
- .env.example: document GEMINI_API_KEY and BASE_BRANCH
- eslint.config.js: use tsconfig.eslint.json, add argsIgnorePattern ^_ for unused params
- tsconfig.eslint.json: new — extends tsconfig.json, includes test files
- config.ts: remove unused fs import
- index.ts: add Promise<void> return type, drop unused _provider name, String() for number in template
- skills.ts: replace parentPath/any hack with explicit typed recursive walker
- create-draft-pr.ts: String() for number in template, drop unused _signal name
- get-pr-diff.ts: drop unused _signal name
- list-prs.ts: extract PrRecord type alias (T[] not Array<T>), drop unused execute param names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant