StackBlitz Buddy · GPT アクション
StackBlitz Buddy
A service to upload, host, and interact with web app content using StackBlitz SDK.
POST /createStackBlitzProjectcreateStackBlitzProjectExpects a JSON payload to create a StackBlitz project. Returns the URL where the web page that hosts the project is accessible. Always call /briefing before it!
POST /mountExistingStackBlitzProjectmountExistingStackBlitzProjectExpects a JSON payload containing an existing StackBlitz project or a GitHub repository. Returns the URL where the web page that hosts the project is accessible.
GET /getFilesGet specific files or all files from a project, with optional content parsingRetrieves specific files or all files from the project's filesystem, with an option to parse file contents.
POST /editor/openFileOpen files in the editorOpens the specified files in the editor within the StackBlitz project.
POST /editor/setCurrentFileSet the current file in the editorSets the specified file as the current file in the StackBlitz editor.
POST /addOrReplaceFileAdd or replace a file or a specific element within a file in the projectAdds a new file, replaces an existing file, or replaces a specific element within a file in the project based on the provided mode.
GET /removeFileRemove a file from the projectRemoves the specified file from the project.
POST /briefingReceive instructions and mandatory rules for creation of a project / loading of a project / continuing work on a project. To be called on every new request, before other actions are called.Get instructions and mandatory rules.
GET /searchImageSearch for images on Pexels
元の API スキーマ
{
"openapi": "3.1.0",
"info": {
"title": "StackBlitz Buddy",
"description": "A service to upload, host, and interact with web app content using StackBlitz SDK.",
"version": "v1.0.0"
},
"servers": [
{
"url": "https://gpt-assisted-coding.onrender.com"
}
],
"paths": {
"/createStackBlitzProject": {
"post": {
"description": "Expects a JSON payload to create a StackBlitz project. Returns the URL where the web page that hosts the project is accessible. Always call /briefing before it!",
"operationId": "createStackBlitzProject",
"requestBody": {
"description": "JSON object representing a new StackBlitz project to be created.",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Details of the project.",
"properties": {
"title": {
"type": "string",
"description": "Title of the project."
},
"description": {
"type": "string",
"description": "Short description of the project."
},
"template": {
"type": "string",
"description": "Template type for the project. Later will be one of these values: 'polymer', 'angular-cli', 'create-react-app', 'vue'. At the moment only 'polymer' is supported."
},
"files": {
"type": "array",
"description": "Array of objects representing files in the project. Each object should have a fileName and fileContent property. The fileName is a string representing the file path, and the fileContent is a string representing the file's text content. The files index.html, index.js, style.css are just an example, as typically used for template 'polymer'. Other templates may require other files. The GPT should proactively add additional files, to keep individual files small and achieve good seperation of concerns.",
"items": {
"type": "object",
"properties": {
"fileName": {
"type": "string",
"description": "Path of the file from the root of the project."
},
"fileContent": {
"type": "string",
"description": "Text content of the file. It must be ensured that special characters (such as quotation marks and line breaks) are correctly escaped so that the JSON format of the POST body remains syntactically correct."
}
}
},
"example": [
{
"fileName": "index.html",
"fileContent": "<html>...</html>"
},
{
"fileName": "index.js",
"fileContent": "document.addEventListener('DOMContentLoaded', () => { console.log('Hello World'); });"
},
{
"fileName": "style.css",
"fileContent": "body { background-color: #fff; }"
}
]
},
"dependencies": {
"type": "object",
"description": "Dependencies of the project. Object keys: strings representing npm package names. Object values: strings representing npm package version specifiers."
}
},
"required": [
"title",
"description",
"template",
"files"
]
}
}
}
},
"responses": {
"200": {
"description": "success"
}
}
}
},
"/mountExistingStackBlitzProject": {
"post": {
"description": "Expects a JSON payload containing an existing StackBlitz project or a GitHub repository. Returns the URL where the web page that hosts the project is accessible.",
"operationId": "mountExistingStackBlitzProject",
"requestBody": {
"description": "JSON object representing an existing StackBlitz project or a GitHub repository.",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"projectType": {
"type": "string",
"description": "Type of the existing project. Values can be either 'existingStackBlitzProject' or 'existingGitHubProject'",
"enum": [
"existingStackBlitzProject",
"existingGitHubProject"
]
},
"gitHubOrStackBlitzProjectId": {
"type": "string",
"description": "Unique identifier for the existing project. If 'projectType' is 'existingStackBlitzProject', it is the StackBlitz project identifier from the URL. If 'projectType' is 'existingGitHubProject', it is the GitHub user and project name separated by a slash as found in GitHub URLs."
}
},
"required": [
"projectType",
"gitHubOrStackBlitzProjectId"
]
}
}
}
},
"responses": {
"200": {
"description": "success",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "URL where the web page that hosts the project is accessible"
},
"projectId": {
"type": "string",
"description": "Unique identifier for the newly processed project."
},
"explanation": {
"type": "string",
"description": "Details about the project processing status."
}
}
}
}
}
},
"400": {
"description": "Invalid or missing values."
},
"500": {
"description": "Internal server error"
}
}
}
},
"/getFiles": {
"get": {
"operationId": "getFiles",
"summary": "Get specific files or all files from a project, with optional content parsing",
"description": "Retrieves specific files or all files from the project's filesystem, with an option to parse file contents.",
"parameters": [
{
"name": "actionName",
"in": "query",
"description": "Always required: 'getFiles'",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "projectId",
"in": "query",
"description": "The unique identifier of the StackBlitz project",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "files",
"in": "query",
"description": "Specific file paths (comma separated) or 'all' for all files",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "parseFileContents",
"in": "query",
"description": "If true, returns a parsed content of files which contains line numbers (0-based). Should proactively be used, because this is helpful make more bandwith efficient, partial changes file contents (using /addOrReplaceFile) as opposed to complete file replacements.",
"required": true,
"schema": {
"type": "boolean"
}
},
{
"name": "withoutContent",
"in": "query",
"description": "If true, returns only the file list without content",
"required": false,
"schema": {
"type": "boolean"
}
}
],
"responses": {
"200": {
"description": "Filesystem data, file list, or parsed file data",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"files": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"fileParseResults": {
"type": "object",
"description": "Parsed contents of the files, if parseFileContents is true. Describes the elements (for example javascript functions) within the files.",
"additionalProperties": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"name": {
"type": "string"
},
"startLine": {
"type": "integer"
},
"endLine": {
"type": "integer"
}
}
}
}
},
"note": {
"type": "string",
"description": "A note about the response size or content"
}
}
}
}
}
}
}
}
},
"/editor/openFile": {
"post": {
"operationId": "openFile",
"summary": "Open files in the editor",
"description": "Opens the specified files in the editor within the StackBlitz project.",
"requestBody": {
"description": "Specifies which files to open",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"actionName": {
"type": "string",
"description": "Always required: 'openFile'"
},
"projectId": {
"type": "string"
},
"files": {
"type": "string",
"description": "Comma-separated list of file paths to open"
}
},
"required": [
"projectId",
"files"
]
}
}
}
},
"responses": {
"200": {
"description": "Files opened successfully"
}
}
}
},
"/editor/setCurrentFile": {
"post": {
"operationId": "setCurrentFile",
"summary": "Set the current file in the editor",
"description": "Sets the specified file as the current file in the StackBlitz editor.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"actionName": {
"type": "string",
"description": "Always required: 'setCurrentFile'"
},
"projectId": {
"type": "string"
},
"fileName": {
"type": "string"
},
"lines": {
"type": "string",
"description": "Optional: which lines should be highlighted (1-based). For example if lines 2 to 5 should be highlighted, the value is 'L2-L8', if only line 9 then 'L9'. Might make sense to gall /getFiles with parseFileContents and withoutContent to know exact line numbers (0-based, so you have to add 1!)."
}
},
"required": [
"actionName",
"projectId",
"fileName"
]
}
}
}
},
"responses": {
"200": {
"description": "Current file set successfully"
}
}
}
},
"/addOrReplaceFile": {
"post": {
"operationId": "addOrReplaceFile",
"summary": "Add or replace a file or a specific element within a file in the project",
"description": "Adds a new file, replaces an existing file, or replaces a specific element within a file in the project based on the provided mode.\n",
"requestBody": {
"description": "Details of the file to add or replace or the specific element to be replaced",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"actionName": {
"type": "string",
"description": "Always required: 'addOrReplaceFile'"
},
"projectId": {
"type": "string"
},
"fileName": {
"type": "string"
},
"content": {
"type": "string"
},
"mode": {
"type": "string",
"description": "Mode of operation, either 'completeFileContent' or 'elementContentOnly'. In 'elementContentOnly' mode, only a specific element within the file is replaced.\n",
"enum": [
"completeFileContent",
"elementContentOnly"
]
},
"elementStartLine": {
"type": "integer",
"nullable": true,
"description": "The 0 based starting line of the element to replace (required if mode is 'elementContentOnly')"
},
"elementEndLine": {
"type": "integer",
"nullable": true,
"description": "The 0 based ending line of the element to replace (required if mode is 'elementContentOnly')"
}
},
"required": [
"actionName",
"projectId",
"fileName",
"content",
"mode"
]
}
}
}
},
"responses": {
"200": {
"description": "File or specific element within the file added or replaced successfully"
}
}
}
},
"/removeFile": {
"get": {
"operationId": "removeFile",
"summary": "Remove a file from the project",
"description": "Removes the specified file from the project.",
"parameters": [
{
"name": "actionName",
"in": "query",
"description": "Always required: 'removeFile'",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "projectId",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "fileName",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "File removed successfully"
}
}
}
},
"/briefing": {
"post": {
"operationId": "briefing",
"summary": "Receive instructions and mandatory rules for creation of a project / loading of a project / continuing work on a project. To be called on every new request, before other actions are called.",
"description": "Get instructions and mandatory rules.",
"requestBody": {
"description": "Details about the existing or to be created project",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"actionName": {
"type": "string",
"description": "Always required: 'briefing'"
},
"projectId": {
"type": "string",
"description": "If the project already exists, the projectId, which is an unique uuid identifier of the project, otherwise the value 'none'."
},
"template": {
"type": "string",
"description": "The StackBlitz template in use in this project. Required! Must be provided! Later will be one of these values: 'polymer', 'angular-cli', 'create-react-app', 'vue'. At the moment only 'polymer' is supported."
}
},
"required": [
"actionName",
"projectId",
"template"
]
}
}
}
},
"responses": {
"200": {
"description": "The instructions that have to be followed"
}
}
}
},
"/searchImage": {
"get": {
"operationId": "searchImage",
"summary": "Search for images on Pexels",
"parameters": [
{
"name": "query",
"in": "query",
"description": "The search query text",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "A Pexels image search result object"
}
}
}
}
}
}