Project Ref: devcontextDocument: API_SPECS

API & Schema Documentation

Internal technical references, payload schemas, and SAM template configurations for DevContext.AI.

01. API Gateway REST Integration

POST /api/v1/analyze

Triggers an asynchronous analysis of a GitHub repository via the Bedrock 3-stage pipeline.

Request Payload (application/json)
{
  "repository_url": "https://github.com/rounakneema/Revealr",
  "branch": "main",
  "depth": 2,
  "options": {
    "skip_tests": true,
    "focus_areas": ["security", "architecture"]
  },
  "callback_url": "https://webhook.site/..."
}
Response Payload (202 Accepted)
{
  "job_id": "dcx_9f8b2c1a4e",
  "status": "queued",
  "estimated_completion": "30s",
  "websocket_ticket": "ws_ticket_7b9211aa",
  "links": {
    "status": "/api/v1/analyze/dcx_9f8b2c1a4e/status"
  }
}

02. WebSocket Streaming Protocol

Used for streaming the simulated interview session and real-time intelligence report generation. Connections authenticated via websocket_ticket.

Event: ANALYSIS_PROGRESS

{ "type": "ANALYSIS_PROGRESS", "payload": { "stage": "AST_PARSING", "files_processed": 42, "total_files": 128, "current_file": "src/core/engine.go" } }

Event: INTERVIEW_CHUNK

{ "type": "INTERVIEW_CHUNK", "payload": { "chunk_id": "chk_001", "role": "interviewer", "text": "I noticed you used raw sockets in Revealr instead of...", "grounding": { "file": "scanner/network.go", "lines": [45, 89] } } }

03. Infrastructure as Code (SAM)

template.yaml (Snippet)
Resources:
  AnalyzeRepoFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: src/analyze/
      Handler: app.lambda_handler
      Runtime: python3.11
      Timeout: 900
      MemorySize: 2048
      Environment:
        Variables:
          DDB_TABLE: !Ref AnalysisTable
          BEDROCK_MODEL_ID: anthropic.claude-3-sonnet-20240229-v1:0
      Policies:
        - DynamoDBCrudPolicy:
            TableName: !Ref AnalysisTable
        - Statement:
            - Effect: Allow
              Action:
                - bedrock:InvokeModel
                - bedrock:InvokeModelWithResponseStream
              Resource: "*"

  WebSocketApi:
    Type: AWS::ApiGatewayV2::Api
    Properties:
      Name: DevContextWS
      ProtocolType: WEBSOCKET
      RouteSelectionExpression: "$request.body.action"

04. Pipeline Deployment Trace

deploy_production.sh
$ sam build --use-container
Starting Build inside a container...
Building codeuri: /workspace/src/analyze runtime: python3.11
Build Succeeded
$ sam deploy --config-env prod --no-confirm-changeset
Deploying with following values:
===============================
Stack name : devcontext-prod
Region : us-east-1
Confirm changeset : False
Deployment s3 bucket : aws-sam-cli-managed-default-samclisourcebucket
Initiating deployment
===============================
Waiting for changeset to be created..
Operation
LogicalResourceId
ResourceType
* Modify
AnalyzeRepoFunction
AWS::Lambda::Function
* Modify
WebSocketApi
AWS::ApiGatewayV2::Api
CloudFormation events from stack operations (lineage: ...):
UPDATE_IN_PROGRESS AWS::Lambda::Function AnalyzeRepoFunction
UPDATE_COMPLETE AWS::Lambda::Function AnalyzeRepoFunction
UPDATE_IN_PROGRESS AWS::CloudFormation::Stack devcontext-prod
UPDATE_COMPLETE AWS::CloudFormation::Stack devcontext-prod
Successfully created/updated stack - devcontext-prod in us-east-1
_