-
Notifications
You must be signed in to change notification settings - Fork 1
add --pull=always #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ function getPlatformDockerCommand(): { command: string; args: string[] } { | |
| "run", | ||
| "--rm", | ||
| "-i", | ||
| "--pull=always", | ||
| "-v", | ||
| "${workspaceFolder}:/workspace", | ||
| "-e", | ||
|
|
@@ -38,7 +39,7 @@ function getPlatformDockerCommand(): { command: string; args: string[] } { | |
| command: "bash", | ||
| args: [ | ||
| "-c", | ||
| 'docker run --rm -i -v "${workspaceFolder}:/workspace" -e "WORKSPACE_ROOT=/workspace" -e "FASTEDGE_API_KEY=$FASTEDGE_API_KEY" -e "FASTEDGE_API_URL=$FASTEDGE_API_URL" ghcr.io/g-core/fastedge-mcp-server:latest', | ||
| 'docker run --rm -i --pull=always -v "${workspaceFolder}:/workspace" -e "WORKSPACE_ROOT=/workspace" -e "FASTEDGE_API_KEY=$FASTEDGE_API_KEY" -e "FASTEDGE_API_URL=$FASTEDGE_API_URL" ghcr.io/g-core/fastedge-mcp-server:latest', | ||
| ], | ||
| }; | ||
| } | ||
|
|
@@ -101,12 +102,25 @@ async function createMCPJson(context?: vscode.ExtensionContext) { | |
| ); | ||
|
|
||
| let existingMCPJson = {} as MCPConfiguration; | ||
| let existingRawContent: string | null = null; | ||
| try { | ||
| const fileData = await vscode.workspace.fs.readFile(mcpJsonPath); | ||
| const mcpJsonContent = Buffer.from(fileData).toString("utf8"); | ||
| existingMCPJson = JSON.parse(mcpJsonContent); | ||
| existingRawContent = Buffer.from(fileData).toString("utf8"); | ||
| } catch { | ||
| /* Do nothing - just means there is not an existing mcp.json */ | ||
| /* File doesn't exist - OK, we'll create a new one */ | ||
| } | ||
|
|
||
| if (existingRawContent !== null) { | ||
| try { | ||
| existingMCPJson = JSON.parse(existingRawContent); | ||
| } catch (error: any) { | ||
|
Comment on lines
+113
to
+116
|
||
| // File exists but is not valid JSON (e.g., trailing comma, comments). | ||
| // Do NOT overwrite — tell the user to fix it manually. | ||
| vscode.window.showErrorMessage( | ||
| `Existing .vscode/mcp.json could not be parsed as JSON (${error?.message || error}). Please fix or remove the file before running this command.`, | ||
| ); | ||
| return; | ||
| } | ||
|
Comment on lines
+117
to
+123
|
||
| } | ||
|
|
||
| if ( | ||
|
|
@@ -257,6 +271,7 @@ async function createMCPJson(context?: vscode.ExtensionContext) { | |
| : "Linux"; | ||
|
|
||
| const mcpJsonContent = { | ||
| ...existingMCPJson, | ||
| servers: { | ||
| ...existingMCPJson.servers, | ||
| "fastedge-assistant": { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The readFile() catch currently ignores all errors, but the comment assumes the file doesn't exist. This will also silently ignore cases like permission issues or transient FS errors and then proceed to overwrite/create mcp.json. Consider only swallowing the specific "file not found" error and surfacing other failures to the user (e.g., showErrorMessage and return).