How decker-dev/shipa-app works
Project type and purpose
• This is a GitHub App built on Probot (Node.js/TypeScript).
• It listens for pull‑request and push events, analyzes documentation changes, invokes an AI service, and posts review comments.
File structure
• Root / config files: .env, Dockerfile, app.yml (App manifest), package.json, TS config, lint/build/test settings.
• src/index.ts: Probot entry point – registers event handlers.
• src/services/github.ts: Wrapper over GitHub REST API calls (e.g., fetch diffs, post comments).
• src/ai/suggestions.ts: Encapsulates OpenAI API calls to generate documentation improvement suggestions.
• src/types/: Shared TypeScript interfaces.
• Tests & build: vitest.config.ts, build scripts in package.json.
README for additional insights
• Confirms the event flow (PR synchronize/push → doc change detection → AI suggestions → post review comments).
• Lists required environment variables and installation/deployment instructions.
Main components and their interactions
a. GitHub Webhook Listener (Probot)
• Receives events from GitHub (pull_request.synchronize, push).
b. Event Router / Handler (src/index.ts)
• Dispatches incoming events to the appropriate logic.
c. Change Analyzer
• Examines modified files for documentation (comments, JSDoc).
d. AI Suggestion Module (src/ai/suggestions.ts)
• Constructs prompts and calls the OpenAI API using OPENAI_API_KEY.
• Receives suggestion payloads (text/markdown).
e. GitHub Service Module (src/services/github.ts)
• Uses APP_ID, WEBHOOK_SECRET, PRIVATE_KEY to authenticate.
• Posts review comments back to the pull request via GitHub’s REST API.
f. External Services
• GitHub API (event delivery, diff retrieval, comment posting).
• OpenAI API (suggestion generation).
Architectural patterns and design principles
• Modular separation:
• Event handling (index.ts)
• Service layer (GitHub API wrapper)
• AI integration layer
• Depend‑inversion: Use of interfaces in src/types for loose coupling.
• Single responsibility: Each module focuses on a specific concern.