createRepoExtensionFile
Add a file to an extension. Each commit that changes it publishes a build from index.ts, which defines the extension's tools and imports its other modules (.ts, .tsx, .js, .jsx) and the npm packages its package.json declares; package.json declares @buildr/sdk too. ui/web/index.html and the files under ui/web/ make its UI, a module directly under ui/mcp/ makes each MCP UI it declares, and files under tests/ hold its tests and their fixtures. A binary file, such as a WebAssembly module its UI imports, takes {"path":…,"attachment_blob_id":…} for an uploaded attachment blob in place of "content", up to 16 MiB.
/repos/{repo_id}/branches/{branch}/extensions/{name}/filesPath parameters
Request body JSON required
Returns
201
ExtensionFile
- formatted_contentrequired
The file formatted with Prettier for reading, when that differs from
content. Forge formats a file shortly after it's written, so this is null until then, and stays null when the file is already formatted, isn't TypeScript, JavaScript or JSON, is over 256 KiB, or doesn't parse. Writes never take it, and builds read onlycontent, so edit fromcontent.
400
InvalidRequest | RequestBodyTooDeep
One of the following:
- InvalidRequestEncoded
- RequestBodyTooDeepEncoded
403
Forbidden | ForbiddenOrigin | RequiresPersonalSession | RunBranchRequired
One of the following:
- ForbiddenEncoded
- ForbiddenOriginEncoded
- RequiresPersonalSessionEncoded
- RunBranchRequiredEncoded
404
BranchNotFound | ExtensionNotFound | RepoNotFound
One of the following:
- BranchNotFoundEncoded
- ExtensionNotFoundEncoded
- RepoNotFoundEncoded
409
ExtensionFileBlobNotUploaded | RepoArchived
One of the following:
- ExtensionFileBlobNotUploadedEncoded
- RepoArchivedEncoded
413
ExtensionFileTooLarge | WriteTooLarge | RequestBodyTooLarge
One of the following:
- ExtensionFileTooLargeEncoded
- WriteTooLargeEncoded
- RequestBodyTooLargeEncoded
503
AttachmentStorageUnavailable | RepoBusy | SessionUnavailable | RateLimitUnavailable
One of the following:
- AttachmentStorageUnavailableEncoded
- RepoBusyEncoded
- SessionUnavailableEncoded
- RateLimitUnavailableEncoded