import re with open('apps/server/src/api-docs.ts', 'r') as f: content = f.read() new_endpoint = """ { method: 'POST', path: '/api/agent/chat', purpose: 'Send a message to the AI agent', request: { message: 'Hello agent', projectPath: '/app/data/projects/my-project' }, response: { sessionId: 'session-123', status: 'started' }, },""" # Insert before /api/projects content = re.sub( r"(\s*\{\s*method: 'GET',\s*path: '/api/projects',)", new_endpoint + r"\1", content ) with open('apps/server/src/api-docs.ts', 'w') as f: f.write(content)