mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
Three private tiles published to the codeflash workspace: - codeflash-internal-rules: 6 eager rules (code-style, architecture, optimization-patterns, git-conventions, testing-rules, multi-language-handlers) - codeflash-internal-docs: 8 lazy doc pages (domain-types, optimization-pipeline, test-generation-pipeline, context-extraction, aiservice/cf-api endpoints, configuration-thresholds, llm-provider-abstraction) - codeflash-internal-skills: 4 on-demand skills (debug-optimization-failure, add-language-support, add-api-endpoint, debug-test-generation)
2 KiB
2 KiB
CF-API Endpoints
Express routes in js/cf-api/routes/. The cf-api acts as middleware between clients (VSC-Extension, CLI) and the aiservice backend.
Route Registration Order (routes/index.ts)
Registration order matters — webhook routes must be before the body parser:
- Webhook routes — before
express.json()(raw body for signature verification) - Body parser —
express.json({ limit: JSON_BODY_LIMIT }) - Public routes — no authentication required
- Protected routes — require API key (
checkForValidAPIKeymiddleware)
Route Files
webhook.routes.ts
POST /github/webhooks— GitHub App webhook handler (Octokit signature verification)POST /stripe/webhooks— Stripe webhook handler- Both need raw body access (before JSON parser)
optimization.routes.ts
Protected optimization endpoints:
POST /suggest-pr-changes— suggest PR changesPOST /create-pr— create optimization PRPOST /verify-existing-optimizations— check existing optimizationsPOST /is-already-optimized— check if code was already optimizedPOST /add-code-hash— add optimized code context hashPOST /mark-as-success— mark optimization as successfulPOST /create-staging— create staging reviewPOST /get-staging-code— get staged codePOST /commit-staging-code— commit staged codePOST /test-repo— add repository manually
github.routes.ts
GitHub-related endpoints for repository management.
subscription.routes.ts
Subscription management endpoints.
user.routes.ts
User management endpoints.
public.routes.ts
Public endpoints (no authentication): health checks, version info.
Middleware Stack
checkForValidAPIKey— API key authenticationtrackEndpointCalls— PostHog endpoint trackingidLimiter— rate limitinglogAuthEvent/logRequestBody— enhanced logging (dev only)trackUsage— usage tracking for optimization endpoints