mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-07 02:58:15 +00:00
feat(marketplace): yaml migrate for modes, + uninstall UX (remove empty)
This commit is contained in:
parent
faf985724f
commit
f05457d2c9
5 changed files with 35 additions and 28 deletions
29
pnpm-lock.yaml
generated
29
pnpm-lock.yaml
generated
|
|
@ -195,8 +195,8 @@ importers:
|
|||
specifier: ^4.0.1
|
||||
version: 4.0.1
|
||||
config-rocket:
|
||||
specifier: ^0.5.8
|
||||
version: 0.5.8
|
||||
specifier: ^0.6.1
|
||||
version: 0.6.1
|
||||
default-shell:
|
||||
specifier: ^2.2.0
|
||||
version: 2.2.0
|
||||
|
|
@ -282,8 +282,8 @@ importers:
|
|||
specifier: ^1.6.4
|
||||
version: 1.6.4
|
||||
roo-rocket:
|
||||
specifier: ^0.4.0
|
||||
version: 0.4.0(config-rocket@0.5.8)
|
||||
specifier: ^0.5.0
|
||||
version: 0.5.0(config-rocket@0.6.1)
|
||||
sanitize-filename:
|
||||
specifier: ^1.6.3
|
||||
version: 1.6.3
|
||||
|
|
@ -526,8 +526,8 @@ importers:
|
|||
specifier: ^1.0.0
|
||||
version: 1.1.1(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
config-rocket:
|
||||
specifier: ^0.5.8
|
||||
version: 0.5.8
|
||||
specifier: ^0.6.1
|
||||
version: 0.6.1
|
||||
date-fns:
|
||||
specifier: ^4.1.0
|
||||
version: 4.1.0
|
||||
|
|
@ -3911,8 +3911,8 @@ packages:
|
|||
confbox@0.2.2:
|
||||
resolution: {integrity: sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ==}
|
||||
|
||||
config-rocket@0.5.8:
|
||||
resolution: {integrity: sha512-89J5RCDPk/6BFsjmNBWqxbfhEubuVrN3WogVG0IvGgXXT1w3H7gJzxdYwVShVwiRVszI2kweOEXjMwXFumxY9Q==}
|
||||
config-rocket@0.6.1:
|
||||
resolution: {integrity: sha512-b6A0ankpEIJ59nRKLs3apgxEnl2hbDgikjkoIWGg86P9n+f9keF4Bp+KPr47WZwJ0wVb34E2UPEgtGx5QjJ0oQ==}
|
||||
engines: {node: '>=20.13.1'}
|
||||
hasBin: true
|
||||
|
||||
|
|
@ -7299,11 +7299,11 @@ packages:
|
|||
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
|
||||
hasBin: true
|
||||
|
||||
roo-rocket@0.4.0:
|
||||
resolution: {integrity: sha512-qKAQc9Wxgl3fkn4eEXX5kFJBTU17TlO1L0nzP73G5w56pVU7l7XkZWsZdF2e2QV4PAYHVNb9A6A2jTaKrBL/vg==}
|
||||
roo-rocket@0.5.0:
|
||||
resolution: {integrity: sha512-rE6XlnUhlaCjnOihxXhTT124NpFU1hQ/Zd6kG6VB7gNwmwnezg5dOlFbZZauCNv/IMx4MxwYwJzxLGuNjT9dYg==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
config-rocket: ^0.5.3
|
||||
config-rocket: ^0.6.1
|
||||
|
||||
roughjs@4.6.6:
|
||||
resolution: {integrity: sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ==}
|
||||
|
|
@ -12826,7 +12826,7 @@ snapshots:
|
|||
|
||||
confbox@0.2.2: {}
|
||||
|
||||
config-rocket@0.5.8:
|
||||
config-rocket@0.6.1:
|
||||
dependencies:
|
||||
citty: 0.1.6
|
||||
consola: 3.4.2
|
||||
|
|
@ -12837,6 +12837,7 @@ snapshots:
|
|||
pathe: 2.0.3
|
||||
std-env: 3.9.0
|
||||
tinyglobby: 0.2.13
|
||||
yaml: 2.8.0
|
||||
|
||||
consola@3.4.2: {}
|
||||
|
||||
|
|
@ -17174,10 +17175,10 @@ snapshots:
|
|||
'@rollup/rollup-win32-x64-msvc': 4.40.2
|
||||
fsevents: 2.3.3
|
||||
|
||||
roo-rocket@0.4.0(config-rocket@0.5.8):
|
||||
roo-rocket@0.5.0(config-rocket@0.6.1):
|
||||
dependencies:
|
||||
citty: 0.1.6
|
||||
config-rocket: 0.5.8
|
||||
config-rocket: 0.6.1
|
||||
consola: 3.4.2
|
||||
defu: 6.1.4
|
||||
hookable: 5.5.3
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@
|
|||
"cheerio": "^1.0.0",
|
||||
"chokidar": "^4.0.1",
|
||||
"clone-deep": "^4.0.1",
|
||||
"config-rocket": "^0.5.8",
|
||||
"config-rocket": "^0.6.1",
|
||||
"default-shell": "^2.2.0",
|
||||
"delay": "^6.0.0",
|
||||
"diff": "^5.2.0",
|
||||
|
|
@ -396,7 +396,7 @@
|
|||
"puppeteer-chromium-resolver": "^23.0.0",
|
||||
"puppeteer-core": "^23.4.0",
|
||||
"reconnecting-eventsource": "^1.6.4",
|
||||
"roo-rocket": "^0.4.0",
|
||||
"roo-rocket": "^0.5.0",
|
||||
"sanitize-filename": "^1.6.3",
|
||||
"say": "^0.16.0",
|
||||
"serialize-error": "^11.0.3",
|
||||
|
|
|
|||
|
|
@ -161,8 +161,10 @@ export class InstalledMetadataManager {
|
|||
// Serialize metadata to YAML
|
||||
const yamlContent = yaml.stringify(metadata)
|
||||
|
||||
// Write to file
|
||||
await fs.writeFile(filePath, yamlContent, "utf-8")
|
||||
// Write to file if there are any entries, otherwise remove file
|
||||
if (Object.keys(metadata).length) await fs.writeFile(filePath, yamlContent, "utf-8")
|
||||
else await fs.rm(filePath)
|
||||
|
||||
console.debug(`InstalledMetadataManager: Metadata saved successfully to ${filePath}`)
|
||||
} catch (error) {
|
||||
console.error(`InstalledMetadataManager: Error saving metadata file ${filePath}:`, error)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import * as vscode from "vscode"
|
||||
import * as path from "path"
|
||||
import * as fs from "fs/promises"
|
||||
import * as yaml from "yaml"
|
||||
import { GitFetcher } from "./GitFetcher"
|
||||
import {
|
||||
MarketplaceItem,
|
||||
|
|
@ -684,17 +685,16 @@ export class MarketplaceManager {
|
|||
mcps: [],
|
||||
files: [],
|
||||
}
|
||||
customHookable.hook("onFileOutput", ({ filePath, data }) => {
|
||||
customHookable.hook("onFileOutput", ({ filePath, parsedData }) => {
|
||||
const pD = parsedData as Record<string, any>
|
||||
if (filePath.endsWith("/.roomodes")) {
|
||||
const parsedData = JSON.parse(data)
|
||||
if (parsedData?.customModes?.length) {
|
||||
parsedData.customModes.forEach((mode: any) => {
|
||||
if (pD?.customModes?.length) {
|
||||
pD.customModes.forEach((mode: any) => {
|
||||
itemInstalledMetadata.modes?.push(mode.slug)
|
||||
})
|
||||
}
|
||||
} else if (filePath.endsWith("/.roo/mcp.json")) {
|
||||
const parsedData = JSON.parse(data)
|
||||
const mcpSlugs = Object.keys(parsedData?.mcpServers ?? {})
|
||||
const mcpSlugs = Object.keys(pD?.mcpServers ?? {})
|
||||
if (mcpSlugs.length) {
|
||||
mcpSlugs.forEach((mcpSlug: any) => {
|
||||
itemInstalledMetadata.mcps?.push(mcpSlug)
|
||||
|
|
@ -737,11 +737,13 @@ export class MarketplaceManager {
|
|||
if (await fs.access(modesFilePath).catch(() => true))
|
||||
vscode.window.showWarningMessage(`"${item.name}": modes file not found`)
|
||||
else {
|
||||
const parsedModesFile = JSON.parse(await fs.readFile(modesFilePath, "utf-8"))
|
||||
const parsedModesFile = yaml.parse(await fs.readFile(modesFilePath, "utf-8"))
|
||||
parsedModesFile.customModes = parsedModesFile.customModes.filter(
|
||||
(m: any) => !itemInstalledMetadata.modes!.includes(m.slug),
|
||||
)
|
||||
await fs.writeFile(modesFilePath, JSON.stringify(parsedModesFile, null, 2), "utf-8")
|
||||
if (parsedModesFile.customModes.length)
|
||||
await fs.writeFile(modesFilePath, yaml.stringify(parsedModesFile, null, 2), "utf-8") // Remove file if no more modes left
|
||||
else await fs.rm(modesFilePath)
|
||||
}
|
||||
}
|
||||
if (itemInstalledMetadata.mcps) {
|
||||
|
|
@ -752,7 +754,9 @@ export class MarketplaceManager {
|
|||
itemInstalledMetadata.mcps.forEach((mcp) => {
|
||||
delete parsedMcpsFile.mcpServers[mcp]
|
||||
})
|
||||
await fs.writeFile(mcpsFilePath, JSON.stringify(parsedMcpsFile, null, 2), "utf-8")
|
||||
if (Object.keys(parsedMcpsFile.mcpServers).length)
|
||||
await fs.writeFile(mcpsFilePath, JSON.stringify(parsedMcpsFile, null, 2), "utf-8") // Remove file if no more modes left
|
||||
else await fs.rm(mcpsFilePath)
|
||||
}
|
||||
}
|
||||
if (itemInstalledMetadata.files) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"cmdk": "^1.0.0",
|
||||
"config-rocket": "^0.5.8",
|
||||
"config-rocket": "^0.6.1",
|
||||
"date-fns": "^4.1.0",
|
||||
"debounce": "^2.1.1",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue