{"openapi":"3.1.0","info":{"title":"GitIDE API","description":"Interface para GPT Actions interagirem livremente com código, comandos e bancos de dados locais.","version":"1.0.0"},"paths":{"/api/info":{"get":{"tags":["Configuração"],"summary":"Get Server Info","description":"Retorna informações públicas do servidor.","operationId":"get_server_info_api_info_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/projects":{"get":{"tags":["Projetos"],"summary":"List Projects","description":"Lista todos os projetos cadastrados.","operationId":"list_projects_api_projects_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["Projetos"],"summary":"Create Project","description":"Cadastra um novo projeto (workspace) e clona do Git se um remoto for especificado.","operationId":"create_project_api_projects_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}":{"delete":{"tags":["Projetos"],"summary":"Delete Project","description":"Remove o cadastro do projeto do GitIDE (não apaga os arquivos do computador).","operationId":"delete_project_api_projects__project_id__delete","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/files":{"get":{"tags":["Arquivos"],"summary":"List Files","description":"Lista recursivamente os arquivos do projeto, ignorando pastas de build/dependências.","operationId":"list_files_api_projects__project_id__files_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/files/read":{"get":{"tags":["Arquivos"],"summary":"Read File","description":"Lê o conteúdo de um arquivo do projeto.\nSuporta paginação por intervalo de linhas para evitar erros de limite de resposta.","operationId":"read_file_api_projects__project_id__files_read_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}},{"name":"filepath","in":"query","required":true,"schema":{"type":"string","description":"Caminho relativo do arquivo","title":"Filepath"},"description":"Caminho relativo do arquivo"},{"name":"start_line","in":"query","required":false,"schema":{"type":"integer","title":"Start Line","description":"Linha inicial (1-indexed) para leitura parcial"},"description":"Linha inicial (1-indexed) para leitura parcial"},{"name":"end_line","in":"query","required":false,"schema":{"type":"integer","title":"End Line","description":"Linha final (1-indexed) para leitura parcial"},"description":"Linha final (1-indexed) para leitura parcial"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/files/write":{"post":{"tags":["Arquivos"],"summary":"Write File","description":"Grava ou edita o conteúdo de um arquivo. \nGera automaticamente um snapshot local para rollback.\nRequer autenticação Bearer Token para chamadas externas.","operationId":"write_file_api_projects__project_id__files_write_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileWrite"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/files/patch":{"patch":{"tags":["Arquivos"],"summary":"Patch File","description":"Substitui um trecho específico de um arquivo (atualização parcial)\nsem a necessidade de enviar o arquivo completo.\nGera automaticamente um snapshot local.\nRequer autenticação Bearer Token para chamadas externas.","operationId":"patch_file_api_projects__project_id__files_patch_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FilePatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/files/delete":{"delete":{"tags":["Arquivos"],"summary":"Delete File","description":"Exclui um arquivo do computador e cria um snapshot de backup.\nRequer autenticação Bearer Token para chamadas externas.","operationId":"delete_file_api_projects__project_id__files_delete_delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}},{"name":"filepath","in":"query","required":true,"schema":{"type":"string","description":"Caminho relativo do arquivo","title":"Filepath"},"description":"Caminho relativo do arquivo"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/execute":{"post":{"tags":["Execução"],"summary":"Execute Command","description":"Executa um comando de terminal (Shell) dentro da pasta do projeto.\nRequer autenticação Bearer Token para chamadas externas.","operationId":"execute_command_api_projects__project_id__execute_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommandExecute"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/db/query":{"post":{"tags":["Banco de Dados"],"summary":"Execute Db Query","description":"Executa uma query SQL em um banco de dados local (SQLite) ou de produção (Postgres/MySQL).\nRequer autenticação Bearer Token para chamadas externas.","operationId":"execute_db_query_api_projects__project_id__db_query_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DbQuery"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/git/status":{"get":{"tags":["Git Bridge"],"summary":"Git Status","description":"Retorna o status atual do Git no projeto.","operationId":"git_status_api_projects__project_id__git_status_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/git/init":{"post":{"tags":["Git Bridge"],"summary":"Git Init","description":"Inicializa um repositório Git ou vincula a URL remota configurada.","operationId":"git_init_api_projects__project_id__git_init_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/git/pull":{"post":{"tags":["Git Bridge"],"summary":"Git Pull","description":"Executa o git pull no repositório remoto.","operationId":"git_pull_api_projects__project_id__git_pull_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}},{"name":"branch","in":"query","required":false,"schema":{"type":"string","title":"Branch"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/git/deploy":{"post":{"tags":["Git Bridge"],"summary":"Git Deploy","description":"Executa o deploy do projeto (Git commit + Git push) na branch remota.\nRequer autenticação Bearer Token para chamadas externas.","operationId":"git_deploy_api_projects__project_id__git_deploy_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitDeployRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/git/branches":{"get":{"tags":["Git Bridge"],"summary":"Git List Branches","description":"Lista as branches locais e remotas do repositório Git.","operationId":"git_list_branches_api_projects__project_id__git_branches_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}},{"name":"fetch","in":"query","required":false,"schema":{"type":"boolean","description":"Forçar git fetch antes de listar","default":false,"title":"Fetch"},"description":"Forçar git fetch antes de listar"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Git Bridge"],"summary":"Git Create Branch","description":"Cria uma nova branch e realiza o checkout.","operationId":"git_create_branch_api_projects__project_id__git_branches_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBranchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/git/merge":{"post":{"tags":["Git Bridge"],"summary":"Git Merge Branch","description":"Mescla uma branch na branch ativa.","operationId":"git_merge_branch_api_projects__project_id__git_merge_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitMergeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/git/push":{"post":{"tags":["Git Bridge"],"summary":"Git Push","description":"Executa um Git push para enviar commits locais para o repositório remoto.","operationId":"git_push_api_projects__project_id__git_push_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitPushRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/git/pullrequest":{"post":{"tags":["Git Bridge"],"summary":"Git Create Pull Request","description":"Cria um Pull Request no repositório remoto do GitHub para o projeto ativo.","operationId":"git_create_pull_request_api_projects__project_id__git_pullrequest_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitPullRequestCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/documents/word":{"post":{"tags":["Documentos"],"summary":"Create Word Document","description":"Gera um documento Word (.docx) no diretório .documents do projeto.","operationId":"create_word_document_api_projects__project_id__documents_word_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentCreateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/documents":{"get":{"tags":["Documentos"],"summary":"List Documents","description":"Lista todos os documentos Word (.docx) gerados no diretório .documents do projeto.","operationId":"list_documents_api_projects__project_id__documents_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/documents/{filename}/download":{"get":{"tags":["Documentos"],"summary":"Download Document","description":"Faz o download do documento Word especificado.","operationId":"download_document_api_projects__project_id__documents__filename__download_get","parameters":[{"name":"filename","in":"path","required":true,"schema":{"type":"string","title":"Filename"}},{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CommandExecute":{"properties":{"command":{"type":"string","title":"Command","description":"Comando do terminal a ser executado na pasta do projeto"}},"type":"object","required":["command"],"title":"CommandExecute"},"CreateBranchRequest":{"properties":{"name":{"type":"string","title":"Name"}},"type":"object","required":["name"],"title":"CreateBranchRequest"},"DbQuery":{"properties":{"db_type":{"type":"string","title":"Db Type","description":"Tipo de banco: sqlite, postgresql, mysql","default":"sqlite"},"connection_string":{"type":"string","title":"Connection String","description":"Caminho do arquivo SQLite ou Connection String de Produção (Postgres/MySQL)"},"query":{"type":"string","title":"Query","description":"Query SQL a ser executada"}},"type":"object","required":["connection_string","query"],"title":"DbQuery"},"DocumentCreateRequest":{"properties":{"title":{"type":"string","title":"Title","description":"Título principal do documento"},"sections":{"items":{"$ref":"#/components/schemas/DocumentSection"},"type":"array","title":"Sections","description":"Lista de seções ordenadas do documento"}},"type":"object","required":["title","sections"],"title":"DocumentCreateRequest"},"DocumentSection":{"properties":{"heading":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Heading","description":"Título da seção","default":""},"text":{"type":"string","title":"Text","description":"Conteúdo de texto da seção"},"type":{"type":"string","title":"Type","description":"Tipo de formatação (paragraph, bullet, highlight, code, table)","default":"paragraph"}},"type":"object","required":["text"],"title":"DocumentSection"},"FilePatch":{"properties":{"filepath":{"type":"string","title":"Filepath","description":"Caminho do arquivo relativo à pasta do projeto"},"target_content":{"type":"string","title":"Target Content","description":"Trecho de texto exato a ser substituído"},"replacement_content":{"type":"string","title":"Replacement Content","description":"Conteúdo substituto"},"allow_multiple":{"type":"boolean","title":"Allow Multiple","description":"Permitir múltiplas substituições caso o trecho ocorra mais de uma vez","default":false}},"type":"object","required":["filepath","target_content","replacement_content"],"title":"FilePatch"},"FileWrite":{"properties":{"filepath":{"type":"string","title":"Filepath","description":"Caminho do arquivo relativo à pasta do projeto"},"content":{"type":"string","title":"Content","description":"Conteúdo completo a ser escrito no arquivo"}},"type":"object","required":["filepath","content"],"title":"FileWrite"},"GitDeployRequest":{"properties":{"commit_message":{"type":"string","title":"Commit Message","description":"Mensagem de commit para descrever as alterações"},"branch":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Branch","description":"Branch Git de destino (caso omitido, usa a branch atual)"}},"type":"object","required":["commit_message"],"title":"GitDeployRequest"},"GitMergeRequest":{"properties":{"branch":{"type":"string","title":"Branch","description":"Nome da branch a ser mesclada na branch ativa"}},"type":"object","required":["branch"],"title":"GitMergeRequest"},"GitPullRequestCreate":{"properties":{"title":{"type":"string","title":"Title","description":"Título do Pull Request"},"base":{"type":"string","title":"Base","description":"Branch de destino (ex: main, master)"},"body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body","description":"Descrição do Pull Request"}},"type":"object","required":["title","base"],"title":"GitPullRequestCreate"},"GitPushRequest":{"properties":{"branch":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Branch","description":"Nome da branch para dar push (opcional)"}},"type":"object","title":"GitPushRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ProjectCreate":{"properties":{"name":{"type":"string","title":"Name","description":"Nome descritivo do projeto"},"path":{"type":"string","title":"Path","description":"Caminho absoluto da pasta do projeto no computador"},"git_remote":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Git Remote","description":"URL do repositório Git remoto (GitHub/GitLab)"}},"type":"object","required":["name","path"],"title":"ProjectCreate"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}},"servers":[{"url":"https://ide.builtt.com.br","description":"Servidor local GitIDE"}]}