Contracts

gitignore-manager-api.yaml

openapi: 3.0.0 info: title: GitignoreManager API version: 1.0.0 description: API contract for the GitignoreManager class that protects AI agent directories

components: schemas: AgentDirectory: type: object required:

properties: name: type: string description: Agent name identifier example: "claude" directory: type: string description: Directory path with trailing slash pattern: "^\\..*/$" example: ".claude/" is_special: type: boolean description: Indicates if special handling is needed example: false description: type: string description: Human-readable description example: "Claude Code CLI"

  • name
  • directory
  • is_special
  • description

ProtectionResult: type: object required:

properties: success: type: boolean description: Whether the operation succeeded modified: type: boolean description: Whether .gitignore was modified entries_added: type: array items: type: string description: New entries added to .gitignore entries_skipped: type: array items: type: string description: Entries already present errors: type: array items: type: string description: Error messages if any warnings: type: array items: type: string description: Warning messages if any

  • success
  • modified
  • entries_added
  • entries_skipped
  • errors
  • warnings

paths: /protect-all: post: summary: Protect all known agent directories operationId: protectAllAgents responses: '200': description: Protection result content: application/json: schema: $ref: '#/components/schemas/ProtectionResult'

/protect-selected: post: summary: Protect selected agent directories operationId: protectSelectedAgents requestBody: required: true content: application/json: schema: type: object required:

properties: agents: type: array items: type: string description: List of agent names to protect example: ["claude", "codex", "opencode"] responses: '200': description: Protection result content: application/json: schema: $ref: '#/components/schemas/ProtectionResult'

  • agents

/agent-directories: get: summary: Get all known agent directories operationId: getAgentDirectories responses: '200': description: List of agent directories content: application/json: schema: type: array items: $ref: '#/components/schemas/AgentDirectory'

test-contract.md

API Contract: User Authentication Service

Overview

This document defines the contract for the User Authentication Service API.

Endpoints

POST /auth/login

Authenticates a user and returns access tokens.

Request Body:

{
  "username": "string",
  "password": "string",
  "mfa_code": "string (optional)"
}

Response:

{
  "access_token": "string",
  "refresh_token": "string",
  "expires_in": 3600,
  "user": {
    "id": "string",
    "username": "string",
    "email": "string"
  }
}

Status Codes

CodeDescription
200Successful authentication
401Invalid credentials
403Account locked or MFA required
429Too many login attempts

Security Requirements

1. All endpoints must use HTTPS 2. Passwords must be hashed using bcrypt 3. Tokens must be JWT with RS256 signing 4. MFA using TOTP when enabled

> Note: This is a test contract for demonstration purposes.