{"openapi":"3.1.0","info":{"title":"Azure DevOps Story Copier & AI Studio API","version":"1.0.0","description":"REST API and agent protocol for Azure DevOps Story Copier, Local Database Drafts, and AI Refinement Studio.\n\n**Agent Declaration:** *Yes, I'll play nicely*\nExternal agents, Antigravity sessions, and automated tools can interact with all endpoints directly without authentication on localhost.","contact":{"name":"DevOps AI Studio","email":"andrew.helmann@kbx.com"}},"servers":[{"url":"https://devopsai.cis-projects.net","description":"Local Active Server"}],"tags":[{"name":"Agent Protocol","description":"Agent discovery, handshakes, and machine guidance"},{"name":"Search","description":"High-speed local full-text search"},{"name":"Azure DevOps","description":"Live Azure DevOps work item retrieval and synchronization"},{"name":"Stories & Drafts","description":"Local working copies, drafts, and folder organization"},{"name":"Helper Workspace","description":"Cached work items, filters, and batch updates"},{"name":"Reporting & Hierarchy","description":"Executive metrics, feature trees, and briefings"},{"name":"Ollama AI","description":"Local LLM chat and story refinement"}],"paths":{"/api/agent":{"get":{"tags":["Agent Protocol"],"summary":"Agent Handshake & Status","description":"Returns the official \"Yes, I'll play nicely\" declaration, server info, capabilities, and links.","responses":{"200":{"description":"Agent handshake payload","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"agent_friendly":{"type":"boolean"},"declaration":{"type":"string"},"friendly_greeting":{"type":"string"}}}}}}}}},"/api/agent/prompt-context":{"get":{"tags":["Agent Protocol"],"summary":"Prompt Context Snippet","description":"Returns pre-formatted prompt text for passing directly to an external Antigravity chat.","responses":{"200":{"description":"Plain text prompt context","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/llms.txt":{"get":{"tags":["Agent Protocol"],"summary":"LLM Agent Documentation Standard","description":"Concise markdown document describing the system and capabilities for LLMs.","responses":{"200":{"description":"Markdown document","content":{"text/markdown":{"schema":{"type":"string"}},"text/plain":{"schema":{"type":"string"}}}}}}},"/api/health":{"get":{"tags":["Agent Protocol"],"summary":"Health Check","description":"Returns server operational status.","responses":{"200":{"description":"Server healthy","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"timestamp":{"type":"string"}}}}}}}}},"/api/search/fast":{"get":{"tags":["Search"],"summary":"Fast Full-Text Search","description":"Searches across local draft stories, cached work items, and folders.","parameters":[{"name":"q","in":"query","required":true,"description":"Search term","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Maximum results to return","schema":{"type":"integer","default":20}},{"name":"type","in":"query","required":false,"description":"Filter by entity type (devops, draft, folder)","schema":{"type":"string"}}],"responses":{"200":{"description":"Search results list","content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string"},"total":{"type":"integer"},"results":{"type":"array","items":{"type":"object"}}}}}}}}}},"/api/devops/items/{id}":{"get":{"tags":["Azure DevOps"],"summary":"Get Work Item by ID","description":"Fetches work item from Azure DevOps and records a local snapshot.","parameters":[{"name":"id","in":"path","required":true,"description":"Work item numeric ID","schema":{"type":"integer"}}],"responses":{"200":{"description":"Work item details"},"404":{"description":"Item not found"}}}},"/api/devops/items/{id}/freshness":{"get":{"tags":["Azure DevOps"],"summary":"Check Revision Freshness","description":"Compares local cached revision against the remote Azure DevOps revision.","parameters":[{"name":"id","in":"path","required":true,"description":"Work item numeric ID","schema":{"type":"integer"}}],"responses":{"200":{"description":"Freshness status","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer"},"localRev":{"type":"integer"},"remoteRev":{"type":"integer"},"isFresh":{"type":"boolean"}}}}}}}}},"/api/devops/search":{"post":{"tags":["Azure DevOps"],"summary":"Search Remote Azure DevOps Items","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string"},"itemType":{"type":"string","example":"User Story"},"limit":{"type":"integer","default":20}}}}}},"responses":{"200":{"description":"DevOps search results"}}}},"/api/stories/saved":{"get":{"tags":["Stories & Drafts"],"summary":"List Saved Story Drafts","parameters":[{"name":"folderId","in":"query","schema":{"type":"integer"}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"sort","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"List of draft stories"}}}},"/api/stories/{id}":{"get":{"tags":["Stories & Drafts"],"summary":"Get Draft Story by ID","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Draft story details"},"404":{"description":"Draft not found"}}},"delete":{"tags":["Stories & Drafts"],"summary":"Delete Draft Story","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Story deleted"}}}},"/api/stories/copy-sanitize":{"post":{"tags":["Stories & Drafts"],"summary":"Copy & Sanitize Work Item into Draft","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id"],"properties":{"id":{"type":"integer","description":"Original ADO item ID"},"folderId":{"type":"integer","default":1},"titleSuffix":{"type":"string","default":"Copy"}}}}}},"responses":{"200":{"description":"Created draft story"}}}},"/api/stories/save-draft":{"post":{"tags":["Stories & Drafts"],"summary":"Save or Update Draft Story","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","description":"Working copy ID (omit for new)"},"title":{"type":"string"},"description":{"type":"string"},"acceptanceCriteria":{"type":"string"},"storyPoints":{"type":"number"},"assignedTo":{"type":"string"},"areaPath":{"type":"string"},"iterationPath":{"type":"string"},"tags":{"type":"string"}}}}}},"responses":{"200":{"description":"Saved draft story"}}}},"/api/helper/items":{"get":{"tags":["Helper Workspace"],"summary":"List Cached Helper Work Items","parameters":[{"name":"state","in":"query","schema":{"type":"string"}},{"name":"assignedTo","in":"query","schema":{"type":"string"}},{"name":"search","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Array of cached helper items"}}}},"/api/helper/batch-update":{"post":{"tags":["Helper Workspace"],"summary":"Batch Update Work Items","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["itemIds","updates"],"properties":{"itemIds":{"type":"array","items":{"type":"integer"}},"updates":{"type":"object"}}}}}},"responses":{"200":{"description":"Batch update result"}}}},"/api/reporting/features-hierarchy":{"get":{"tags":["Reporting & Hierarchy"],"summary":"Feature Hierarchy & Rollup Metrics","description":"Returns Feature -> Story -> Task tree with point totals and blocker counts.","responses":{"200":{"description":"Hierarchy data"}}}},"/api/reporting/leadership-summary":{"get":{"tags":["Reporting & Hierarchy"],"summary":"Executive Leadership Summary","responses":{"200":{"description":"Aggregated summary stats"}}}},"/api/azure/features/import":{"post":{"tags":["Reporting & Hierarchy"],"summary":"Import Full Feature Tree from ADO","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["featureId"],"properties":{"featureId":{"type":"integer","description":"Numeric Feature ID"}}}}}},"responses":{"200":{"description":"Imported feature and count of items"}}}},"/api/ollama/models":{"get":{"tags":["Ollama AI"],"summary":"List Available Ollama Models","responses":{"200":{"description":"List of models"}}}},"/api/ollama/chat":{"post":{"tags":["Ollama AI"],"summary":"Story Refinement Chat Completion","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string"},"model":{"type":"string"},"systemPrompt":{"type":"string"}}}}}},"responses":{"200":{"description":"AI response"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"PAT or JWT","description":"Personal Access Token (pat_live_...) or User JWT"}}},"security":[{"bearerAuth":[]}]}