diff --git a/apps/vscode-nightly/.gitignore b/apps/vscode-nightly/.gitignore deleted file mode 100644 index 378eac25d3..0000000000 --- a/apps/vscode-nightly/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build diff --git a/apps/vscode-nightly/esbuild.mjs b/apps/vscode-nightly/esbuild.mjs deleted file mode 100644 index 695f9430ff..0000000000 --- a/apps/vscode-nightly/esbuild.mjs +++ /dev/null @@ -1,176 +0,0 @@ -import * as esbuild from "esbuild" -import * as fs from "fs" -import * as path from "path" -import { fileURLToPath } from "url" - -import { getGitSha, copyPaths, copyLocales, copyWasms, generatePackageJson } from "@roo-code/build" - -const __filename = fileURLToPath(import.meta.url) -const __dirname = path.dirname(__filename) - -async function main() { - const name = "extension-nightly" - const production = process.argv.includes("--production") - const minify = production - const sourcemap = !production - - const overrideJson = JSON.parse(fs.readFileSync(path.join(__dirname, "package.nightly.json"), "utf8")) - console.log(`[${name}] name: ${overrideJson.name}`) - console.log(`[${name}] version: ${overrideJson.version}`) - - const gitSha = getGitSha() - console.log(`[${name}] gitSha: ${gitSha}`) - - /** - * @type {import('esbuild').BuildOptions} - */ - const buildOptions = { - bundle: true, - minify, - sourcemap, - logLevel: "silent", - format: "cjs", - sourcesContent: false, - platform: "node", - define: { - "process.env.PKG_NAME": '"zoo-code-nightly"', - "process.env.PKG_VERSION": `"${overrideJson.version}"`, - "process.env.PKG_OUTPUT_CHANNEL": '"Zoo-Code-Nightly"', - "process.env.PKG_RELEASE_CHANNEL": '"prerelease"', - "process.env.POSTHOG_API_KEY": JSON.stringify(process.env.POSTHOG_API_KEY || ""), - ...(gitSha ? { "process.env.PKG_SHA": `"${gitSha}"` } : {}), - }, - } - - const srcDir = path.join(__dirname, "..", "..", "src") - const buildDir = path.join(__dirname, "build") - const distDir = path.join(buildDir, "dist") - - console.log(`[${name}] srcDir: ${srcDir}`) - console.log(`[${name}] buildDir: ${buildDir}`) - console.log(`[${name}] distDir: ${distDir}`) - - if (fs.existsSync(distDir)) { - console.log(`[${name}] Cleaning dist directory: ${distDir}`) - fs.rmSync(distDir, { recursive: true, force: true }) - } - - /** - * @type {import('esbuild').Plugin[]} - */ - const plugins = [ - { - name: "copyPaths", - setup(build) { - build.onEnd(() => { - copyPaths( - [ - ["../README.md", "README.md"], - ["../CHANGELOG.md", "CHANGELOG.md"], - ["../LICENSE", "LICENSE"], - ["../.env", ".env", { optional: true }], - [".vscodeignore", ".vscodeignore"], - ["assets", "assets"], - ["integrations", "integrations"], - ["node_modules/vscode-material-icons/generated", "assets/vscode-material-icons"], - ["../webview-ui/audio", "webview-ui/audio"], - ], - srcDir, - buildDir, - ) - }) - }, - }, - { - name: "generatePackageJson", - setup(build) { - build.onEnd(() => { - const packageJson = JSON.parse(fs.readFileSync(path.join(srcDir, "package.json"), "utf8")) - - const generatedPackageJson = generatePackageJson({ - packageJson, - overrideJson, - substitution: ["zoo-code", "zoo-code-nightly"], - }) - - fs.writeFileSync(path.join(buildDir, "package.json"), JSON.stringify(generatedPackageJson, null, 2)) - console.log(`[generatePackageJson] Generated package.json`) - - let count = 0 - - fs.readdirSync(path.join(srcDir)).forEach((file) => { - if (file.startsWith("package.nls")) { - fs.copyFileSync(path.join(srcDir, file), path.join(buildDir, file)) - count++ - } - }) - - console.log(`[generatePackageJson] Copied ${count} package.nls*.json files to ${buildDir}`) - - const nlsPkg = JSON.parse(fs.readFileSync(path.join(srcDir, "package.nls.json"), "utf8")) - - const nlsNightlyPkg = JSON.parse( - fs.readFileSync(path.join(__dirname, "package.nls.nightly.json"), "utf8"), - ) - - fs.writeFileSync( - path.join(buildDir, "package.nls.json"), - JSON.stringify({ ...nlsPkg, ...nlsNightlyPkg }, null, 2), - ) - - console.log(`[generatePackageJson] Generated package.nls.json`) - }) - }, - }, - { - name: "copyWasms", - setup(build) { - build.onEnd(() => copyWasms(srcDir, distDir)) - }, - }, - { - name: "copyLocales", - setup(build) { - build.onEnd(() => copyLocales(srcDir, distDir)) - }, - }, - ] - - /** - * @type {import('esbuild').BuildOptions} - */ - const extensionBuildOptions = { - ...buildOptions, - plugins, - entryPoints: [path.join(srcDir, "extension.ts")], - outfile: path.join(distDir, "extension.js"), - external: ["vscode"], - } - - /** - * @type {import('esbuild').BuildOptions} - */ - const workerBuildOptions = { - ...buildOptions, - entryPoints: [path.join(srcDir, "workers", "countTokens.ts")], - outdir: path.join(distDir, "workers"), - } - - const [extensionBuildContext, workerBuildContext] = await Promise.all([ - esbuild.context(extensionBuildOptions), - esbuild.context(workerBuildOptions), - ]) - - await Promise.all([ - extensionBuildContext.rebuild(), - extensionBuildContext.dispose(), - - workerBuildContext.rebuild(), - workerBuildContext.dispose(), - ]) -} - -main().catch((e) => { - console.error(e) - process.exit(1) -}) diff --git a/apps/vscode-nightly/package.json b/apps/vscode-nightly/package.json deleted file mode 100644 index 56872a2aeb..0000000000 --- a/apps/vscode-nightly/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "@roo-code/vscode-nightly", - "description": "Nightly build for the Roo Code VSCode extension.", - "private": true, - "packageManager": "pnpm@10.8.1", - "scripts": { - "bundle:nightly": "node esbuild.mjs", - "vsix:nightly": "cd build && mkdirp ../../../bin && npx vsce package --no-dependencies --out ../../../bin", - "clean": "rimraf build .turbo" - }, - "devDependencies": { - "@roo-code/build": "workspace:^" - } -} diff --git a/apps/vscode-nightly/package.nightly.json b/apps/vscode-nightly/package.nightly.json deleted file mode 100644 index dc0a884c42..0000000000 --- a/apps/vscode-nightly/package.nightly.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "zoo-code-nightly", - "version": "0.0.1", - "icon": "assets/icons/icon-nightly.png", - "scripts": {} -} diff --git a/apps/vscode-nightly/package.nls.nightly.json b/apps/vscode-nightly/package.nls.nightly.json deleted file mode 100644 index 59e859543b..0000000000 --- a/apps/vscode-nightly/package.nls.nightly.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extension.displayName": "Zoo Code Nightly", - "views.contextMenu.label": "Zoo Code Nightly", - "views.terminalMenu.label": "Zoo Code Nightly", - "views.activitybar.title": "Zoo Code Nightly", - "configuration.title": "Zoo Code Nightly" -} diff --git a/apps/vscode-nightly/turbo.json b/apps/vscode-nightly/turbo.json deleted file mode 100644 index 543e55aaf7..0000000000 --- a/apps/vscode-nightly/turbo.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://turbo.build/schema.json", - "extends": ["//"], - "tasks": { - "bundle:nightly": { - "dependsOn": ["^build", "@roo-code/vscode-webview#build:nightly"], - "outputs": ["build/**"] - }, - "vsix:nightly": { - "dependsOn": ["bundle:nightly"], - "inputs": ["build/**"], - "outputs": ["../../../bin/**"] - } - } -} diff --git a/package.json b/package.json index 4ce00f4d1e..2b90356386 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,9 @@ "format": "turbo format --log-order grouped --output-logs new-only", "build": "turbo build --log-order grouped --output-logs new-only", "bundle": "turbo bundle --log-order grouped --output-logs new-only", - "bundle:nightly": "turbo bundle:nightly --log-order grouped --output-logs new-only", "vsix": "turbo vsix --log-order grouped --output-logs new-only", - "vsix:nightly": "turbo vsix:nightly --log-order grouped --output-logs new-only", "clean": "turbo clean --log-order grouped --output-logs new-only && rimraf dist out bin .vite-port .turbo", "install:vsix": "pnpm install --frozen-lockfile && pnpm clean && pnpm vsix && node scripts/install-vsix.js", - "install:vsix:nightly": "pnpm install --frozen-lockfile && pnpm clean && pnpm vsix:nightly && node scripts/install-vsix.js --nightly", "code-server:install": "node scripts/code-server.js", "changeset:version": "cp CHANGELOG.md src/CHANGELOG.md && changeset version && cp -vf src/CHANGELOG.md .", "knip": "knip", @@ -37,7 +34,6 @@ "husky": "9.1.7", "knip": "5.60.2", "lint-staged": "16.4.0", - "mkdirp": "3.0.1", "ovsx": "0.10.12", "prettier": "3.8.4", "rimraf": "6.0.1", diff --git a/packages/build/package.json b/packages/build/package.json index f9d5d352ff..67922d3d09 100644 --- a/packages/build/package.json +++ b/packages/build/package.json @@ -8,13 +8,9 @@ "scripts": { "lint": "eslint src --ext=ts --max-warnings=0", "check-types": "tsc --noEmit", - "test": "vitest run", "build": "tsc", "clean": "rimraf dist .turbo" }, - "dependencies": { - "zod": "^3.25.61" - }, "devDependencies": { "@roo-code/config-eslint": "workspace:^", "@roo-code/config-typescript": "workspace:^", diff --git a/packages/build/src/__tests__/index.test.ts b/packages/build/src/__tests__/index.test.ts deleted file mode 100644 index d00670034f..0000000000 --- a/packages/build/src/__tests__/index.test.ts +++ /dev/null @@ -1,222 +0,0 @@ -// npx vitest run src/__tests__/index.test.ts - -import { generatePackageJson } from "../index.js" - -describe("generatePackageJson", () => { - it("should be a test", () => { - const generatedPackageJson = generatePackageJson({ - packageJson: { - name: "roo-cline", - displayName: "%extension.displayName%", - description: "%extension.description%", - publisher: "RooVeterinaryInc", - version: "3.17.2", - icon: "assets/icons/icon.png", - contributes: { - viewsContainers: { - activitybar: [ - { - id: "roo-cline-ActivityBar", - title: "%views.activitybar.title%", - icon: "assets/icons/icon.svg", - }, - ], - }, - views: { - "roo-cline-ActivityBar": [ - { - type: "webview", - id: "roo-cline.SidebarProvider", - name: "", - }, - ], - }, - commands: [ - { - command: "roo-cline.plusButtonClicked", - title: "%command.newTask.title%", - icon: "$(edit)", - }, - { - command: "roo-cline.openInNewTab", - title: "%command.openInNewTab.title%", - category: "%configuration.title%", - }, - ], - menus: { - "editor/context": [ - { - submenu: "roo-cline.contextMenu", - group: "navigation", - }, - ], - "roo-cline.contextMenu": [ - { - command: "roo-cline.addToContext", - group: "1_actions@1", - }, - ], - "editor/title": [ - { - command: "roo-cline.plusButtonClicked", - group: "navigation@1", - when: "activeWebviewPanelId == roo-cline.TabPanelProvider", - }, - { - command: "roo-cline.settingsButtonClicked", - group: "navigation@6", - when: "activeWebviewPanelId == roo-cline.TabPanelProvider", - }, - { - command: "roo-cline.accountButtonClicked", - group: "navigation@6", - when: "activeWebviewPanelId == roo-cline.TabPanelProvider", - }, - ], - }, - submenus: [ - { - id: "roo-cline.contextMenu", - label: "%views.contextMenu.label%", - }, - { - id: "roo-cline.terminalMenu", - label: "%views.terminalMenu.label%", - }, - ], - configuration: { - title: "%configuration.title%", - properties: { - "roo-cline.allowedCommands": { - type: "array", - items: { - type: "string", - }, - default: ["npm test", "npm install", "tsc", "git log", "git diff", "git show"], - description: "%commands.allowedCommands.description%", - }, - "roo-cline.customStoragePath": { - type: "string", - default: "", - description: "%settings.customStoragePath.description%", - }, - }, - }, - }, - scripts: { - lint: "eslint **/*.ts", - }, - }, - overrideJson: { - name: "zoo-code-nightly", - displayName: "Zoo Code Nightly", - publisher: "ZooCodeOrganization", - version: "0.0.1", - icon: "assets/icons/icon-nightly.png", - scripts: {}, - }, - substitution: ["roo-cline", "zoo-code-nightly"], - }) - - expect(generatedPackageJson).toStrictEqual({ - name: "zoo-code-nightly", - displayName: "Zoo Code Nightly", - description: "%extension.description%", - publisher: "ZooCodeOrganization", - version: "0.0.1", - icon: "assets/icons/icon-nightly.png", - contributes: { - viewsContainers: { - activitybar: [ - { - id: "zoo-code-nightly-ActivityBar", - title: "%views.activitybar.title%", - icon: "assets/icons/icon.svg", - }, - ], - }, - views: { - "zoo-code-nightly-ActivityBar": [ - { - type: "webview", - id: "zoo-code-nightly.SidebarProvider", - name: "", - }, - ], - }, - commands: [ - { - command: "zoo-code-nightly.plusButtonClicked", - title: "%command.newTask.title%", - icon: "$(edit)", - }, - { - command: "zoo-code-nightly.openInNewTab", - title: "%command.openInNewTab.title%", - category: "%configuration.title%", - }, - ], - menus: { - "editor/context": [ - { - submenu: "zoo-code-nightly.contextMenu", - group: "navigation", - }, - ], - "zoo-code-nightly.contextMenu": [ - { - command: "zoo-code-nightly.addToContext", - group: "1_actions@1", - }, - ], - "editor/title": [ - { - command: "zoo-code-nightly.plusButtonClicked", - group: "navigation@1", - when: "activeWebviewPanelId == zoo-code-nightly.TabPanelProvider", - }, - { - command: "zoo-code-nightly.settingsButtonClicked", - group: "navigation@6", - when: "activeWebviewPanelId == zoo-code-nightly.TabPanelProvider", - }, - { - command: "zoo-code-nightly.accountButtonClicked", - group: "navigation@6", - when: "activeWebviewPanelId == zoo-code-nightly.TabPanelProvider", - }, - ], - }, - submenus: [ - { - id: "zoo-code-nightly.contextMenu", - label: "%views.contextMenu.label%", - }, - { - id: "zoo-code-nightly.terminalMenu", - label: "%views.terminalMenu.label%", - }, - ], - configuration: { - title: "%configuration.title%", - properties: { - "zoo-code-nightly.allowedCommands": { - type: "array", - items: { - type: "string", - }, - default: ["npm test", "npm install", "tsc", "git log", "git diff", "git show"], - description: "%commands.allowedCommands.description%", - }, - "zoo-code-nightly.customStoragePath": { - type: "string", - default: "", - description: "%settings.customStoragePath.description%", - }, - }, - }, - }, - scripts: {}, - }) - }) -}) diff --git a/packages/build/src/esbuild.ts b/packages/build/src/esbuild.ts index b2183d6253..c4496c2dfd 100644 --- a/packages/build/src/esbuild.ts +++ b/packages/build/src/esbuild.ts @@ -2,8 +2,6 @@ import * as fs from "fs" import * as path from "path" import { execSync } from "child_process" -import { ViewsContainer, Views, Menus, Configuration, Keybindings, contributesSchema } from "./types.js" - function copyDir(srcDir: string, dstDir: string, count: number): number { const entries = fs.readdirSync(srcDir, { withFileTypes: true }) @@ -266,81 +264,3 @@ export function setupLocaleWatcher(srcDir: string, distDir: string) { ) } } - -export function generatePackageJson({ - packageJson: { contributes, ...packageJson }, - overrideJson, - substitution, -}: { - packageJson: Record // eslint-disable-line @typescript-eslint/no-explicit-any - overrideJson: Record // eslint-disable-line @typescript-eslint/no-explicit-any - substitution: [string, string] -}) { - const { viewsContainers, views, commands, menus, submenus, keybindings, configuration } = - contributesSchema.parse(contributes) - const [from, to] = substitution - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const result: Record = { - ...packageJson, - ...overrideJson, - contributes: { - viewsContainers: transformArrayRecord(viewsContainers, from, to, ["id"]), - views: transformArrayRecord(views, from, to, ["id"]), - commands: transformArray(commands, from, to, "command"), - menus: transformArrayRecord(menus, from, to, ["command", "submenu", "when"]), - submenus: transformArray(submenus, from, to, "id"), - configuration: { - title: configuration.title, - properties: transformRecord(configuration.properties, from, to), - }, - }, - } - - // Only add keybindings if they exist - if (keybindings) { - result.contributes.keybindings = transformArray(keybindings, from, to, "command") - } - - return result -} - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function transformArrayRecord(obj: Record, from: string, to: string, props: string[]): T { - return Object.entries(obj).reduce( - (acc, [key, ary]) => ({ - ...acc, - [key.replaceAll(from, to)]: ary.map((item) => { - const transformedItem = { ...item } - - for (const prop of props) { - if (prop in item && typeof item[prop] === "string") { - transformedItem[prop] = item[prop].replaceAll(from, to) - } - } - - return transformedItem - }), - }), - {} as T, - ) -} - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function transformArray(arr: any[], from: string, to: string, idProp: string): T[] { - return arr.map(({ [idProp]: id, ...rest }) => ({ - [idProp]: id.replaceAll(from, to), - ...rest, - })) -} - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function transformRecord(obj: Record, from: string, to: string): T { - return Object.entries(obj).reduce( - (acc, [key, value]) => ({ - ...acc, - [key.replaceAll(from, to)]: value, - }), - {} as T, - ) -} diff --git a/packages/build/src/git.ts b/packages/build/src/git.ts deleted file mode 100644 index bafe96b65d..0000000000 --- a/packages/build/src/git.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { execSync } from "child_process" - -export function getGitSha() { - let gitSha: string | undefined = undefined - - try { - gitSha = execSync("git rev-parse HEAD").toString().trim() - } catch (_e) { - // Do nothing. - } - - return gitSha -} diff --git a/packages/build/src/index.ts b/packages/build/src/index.ts index edbc994a2d..52e392a745 100644 --- a/packages/build/src/index.ts +++ b/packages/build/src/index.ts @@ -1,2 +1 @@ -export { getGitSha } from "./git.js" -export { copyPaths, copyWasms, copyLocales, setupLocaleWatcher, generatePackageJson } from "./esbuild.js" +export { copyPaths, copyWasms, copyLocales, setupLocaleWatcher } from "./esbuild.js" diff --git a/packages/build/src/types.ts b/packages/build/src/types.ts deleted file mode 100644 index 18db4f2e7c..0000000000 --- a/packages/build/src/types.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { z } from "zod" - -const viewsContainerSchema = z.record( - z.string(), - z.array( - z.object({ - id: z.string(), - title: z.string(), - icon: z.string(), - }), - ), -) - -export type ViewsContainer = z.infer - -const viewsSchema = z.record( - z.string(), - z.array( - z.object({ - type: z.string(), - id: z.string(), - name: z.string(), - }), - ), -) - -export type Views = z.infer - -const commandsSchema = z.array( - z.object({ - command: z.string(), - title: z.string(), - category: z.string().optional(), - icon: z.string().optional(), - }), -) - -export type Commands = z.infer - -const menuItemSchema = z.object({ - group: z.string(), - command: z.string().optional(), - submenu: z.string().optional(), - when: z.string().optional(), -}) - -export type MenuItem = z.infer - -const menusSchema = z.record(z.string(), z.array(menuItemSchema)) - -export type Menus = z.infer - -const submenusSchema = z.array( - z.object({ - id: z.string(), - label: z.string(), - }), -) - -export type Submenus = z.infer - -const keybindingsSchema = z.array( - z.object({ - command: z.string(), - key: z.string().optional(), - mac: z.string().optional(), - win: z.string().optional(), - linux: z.string().optional(), - when: z.string().optional(), - }), -) - -export type Keybindings = z.infer - -const configurationPropertySchema = z.object({ - type: z.union([ - z.literal("string"), - z.literal("array"), - z.literal("object"), - z.literal("boolean"), - z.literal("number"), - ]), - items: z - .object({ - type: z.string(), - }) - .optional(), - properties: z.record(z.string(), z.any()).optional(), - enum: z.array(z.any()).optional(), - default: z.any().optional(), - description: z.string(), -}) - -export type ConfigurationProperty = z.infer - -const configurationSchema = z.object({ - title: z.string(), - properties: z.record(z.string(), configurationPropertySchema), -}) - -export type Configuration = z.infer - -export const contributesSchema = z.object({ - viewsContainers: viewsContainerSchema, - views: viewsSchema, - commands: commandsSchema, - menus: menusSchema, - submenus: submenusSchema, - keybindings: keybindingsSchema.optional(), - configuration: configurationSchema, -}) - -export type Contributes = z.infer diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a666502f4e..e7e603f528 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,9 +49,6 @@ importers: lint-staged: specifier: 16.4.0 version: 16.4.0 - mkdirp: - specifier: 3.0.1 - version: 3.0.1 ovsx: specifier: 0.10.12 version: 0.10.12 @@ -192,17 +189,7 @@ importers: specifier: 6.0.1 version: 6.0.1 - apps/vscode-nightly: - devDependencies: - '@roo-code/build': - specifier: workspace:^ - version: link:../../packages/build - packages/build: - dependencies: - zod: - specifier: 3.25.76 - version: 3.25.76 devDependencies: '@roo-code/config-eslint': specifier: workspace:^ diff --git a/scripts/install-vsix.js b/scripts/install-vsix.js index 1f58c70c32..6d969bc33a 100644 --- a/scripts/install-vsix.js +++ b/scripts/install-vsix.js @@ -5,9 +5,6 @@ const readline = require("readline") // detect "yes" flags const autoYes = process.argv.includes("-y") -// detect nightly flag -const isNightly = process.argv.includes("--nightly") - // detect editor command from args or default to "code" const editorArg = process.argv.find((arg) => arg.startsWith("--editor=")) const defaultEditor = editorArg ? editorArg.split("=")[1] : "code" @@ -27,29 +24,13 @@ const askQuestion = (question) => { async function main() { try { - let name, version, publisher - - if (isNightly) { - // For nightly, read the nightly-specific package.json and get publisher from src - const nightlyPackageJson = JSON.parse( - fs.readFileSync("./apps/vscode-nightly/package.nightly.json", "utf-8"), - ) - const srcPackageJson = JSON.parse(fs.readFileSync("./src/package.json", "utf-8")) - name = nightlyPackageJson.name - version = nightlyPackageJson.version - publisher = srcPackageJson.publisher - } else { - const packageJson = JSON.parse(fs.readFileSync("./src/package.json", "utf-8")) - name = packageJson.name - version = packageJson.version - publisher = packageJson.publisher - } + const packageJson = JSON.parse(fs.readFileSync("./src/package.json", "utf-8")) + const { name, version, publisher } = packageJson const vsixFileName = `./bin/${name}-${version}.vsix` const extensionId = `${publisher}.${name}` - const buildType = isNightly ? "Nightly" : "Regular" - console.log(`\nšŸš€ Roo Code VSIX Installer (${buildType})`) + console.log("\nšŸš€ Roo Code VSIX Installer") console.log("========================") console.log("\nThis script will:") console.log("1. Uninstall any existing version of the Roo Code extension") diff --git a/src/api/providers/fetchers/__tests__/versionedSettings.spec.ts b/src/api/providers/fetchers/__tests__/versionedSettings.spec.ts index bb777622df..cf45a1b5bf 100644 --- a/src/api/providers/fetchers/__tests__/versionedSettings.spec.ts +++ b/src/api/providers/fetchers/__tests__/versionedSettings.spec.ts @@ -5,7 +5,6 @@ import { resolveVersionedSettings, type VersionedSettings, } from "../versionedSettings" -import { Package } from "../../../../shared/package" describe("versionedSettings", () => { describe("compareSemver", () => { @@ -114,23 +113,6 @@ describe("versionedSettings", () => { const result = findHighestMatchingVersion(versionedSettings, "3.36.4") expect(result).toBeUndefined() }) - - it("should treat nightly builds (by package name) as always eligible and pick highest version", () => { - const versionedSettings: VersionedSettings = { - "3.36.3": { feature: "v3" }, - "2.0.0": { feature: "v2" }, - } - - const originalName = Package.name - ;(Package as { name: string }).name = "zoo-code-nightly" - - try { - const result = findHighestMatchingVersion(versionedSettings, "1.0.0") - expect(result).toBe("3.36.3") - } finally { - ;(Package as { name: string }).name = originalName - } - }) }) describe("resolveVersionedSettings", () => { diff --git a/src/api/providers/fetchers/versionedSettings.ts b/src/api/providers/fetchers/versionedSettings.ts index d644c683d3..87f51cc880 100644 --- a/src/api/providers/fetchers/versionedSettings.ts +++ b/src/api/providers/fetchers/versionedSettings.ts @@ -2,10 +2,6 @@ import cmp from "semver-compare" import { Package } from "../../../shared/package" -function isNightlyBuild(): boolean { - return Package.name.toLowerCase().includes("nightly") -} - /** * Type for versioned settings where the version is the key. * Each version key maps to a settings object that should be used @@ -76,12 +72,6 @@ export function findHighestMatchingVersion( return undefined } - // Nightly builds should always pick the highest available versioned settings - if (isNightlyBuild()) { - versions.sort((a, b) => compareSemver(b, a)) - return versions[0] - } - // Filter to versions that are <= currentVersion const matchingVersions = versions.filter((version) => meetsMinimumVersion(version, currentVersion)) diff --git a/src/core/tools/NewTaskTool.ts b/src/core/tools/NewTaskTool.ts index 35d72224a0..cef12f01f6 100644 --- a/src/core/tools/NewTaskTool.ts +++ b/src/core/tools/NewTaskTool.ts @@ -53,8 +53,7 @@ export class NewTaskTool extends BaseTool<"new_task"> { const state = await provider.getState() - // Use Package.name (dynamic at build time) as the VSCode configuration namespace. - // Supports multiple extension variants (e.g., stable/nightly) without hardcoded strings. + // Use the package name as the VSCode configuration namespace. const requireTodos = vscode.workspace .getConfiguration(Package.name) .get("newTaskRequireTodos", false) diff --git a/src/core/tools/__tests__/newTaskTool.spec.ts b/src/core/tools/__tests__/newTaskTool.spec.ts index ec5bd4386b..50bf40b411 100644 --- a/src/core/tools/__tests__/newTaskTool.spec.ts +++ b/src/core/tools/__tests__/newTaskTool.spec.ts @@ -566,43 +566,6 @@ describe("newTaskTool", () => { expect(mockGetConfiguration).toHaveBeenCalledWith("zoo-code") expect(mockGet).toHaveBeenCalledWith("newTaskRequireTodos", false) }) - - it("should use current Package.name value (zoo-code-nightly) when accessing VSCode configuration", async () => { - // Arrange: capture calls to VSCode configuration and ensure we can assert the namespace - const mockGet = vi.fn().mockReturnValue(false) - const mockGetConfiguration = vi.fn().mockReturnValue({ - get: mockGet, - } as any) - vi.mocked(vscode.workspace.getConfiguration).mockImplementation(mockGetConfiguration) - - const pkg = await import("../../../shared/package") - const originalName = (pkg.Package as any).name - ;(pkg.Package as any).name = "zoo-code-nightly" - - try { - const block: ToolUse<"new_task"> = { - type: "tool_use", - name: "new_task", - params: { - mode: "code", - message: "Test message", - }, - partial: false, - } - - await newTaskTool.handle(mockCline as any, withNativeArgs(block), { - askApproval: mockAskApproval, - handleError: mockHandleError, - pushToolResult: mockPushToolResult, - }) - - // Assert: configuration was read using the dynamic nightly namespace - expect(mockGetConfiguration).toHaveBeenCalledWith("zoo-code-nightly") - expect(mockGet).toHaveBeenCalledWith("newTaskRequireTodos", false) - } finally { - ;(pkg.Package as any).name = originalName - } - }) }) // Add more tests for error handling (invalid mode, approval denied) if needed diff --git a/src/eslint-suppressions.json b/src/eslint-suppressions.json index 1f0792c2f2..5488acdf4b 100644 --- a/src/eslint-suppressions.json +++ b/src/eslint-suppressions.json @@ -971,7 +971,7 @@ }, "core/tools/__tests__/newTaskTool.spec.ts": { "@typescript-eslint/no-explicit-any": { - "count": 31 + "count": 26 } }, "core/tools/__tests__/readFileTool.spec.ts": { diff --git a/webview-ui/package.json b/webview-ui/package.json index 7a42984f77..450288eff5 100644 --- a/webview-ui/package.json +++ b/webview-ui/package.json @@ -14,9 +14,8 @@ "format": "prettier --write src", "dev": "vite", "build": "tsc -b && vite build", - "build:nightly": "tsc -b && vite build --mode nightly", "preview": "vite preview", - "clean": "rimraf ../src/webview-ui ../apps/vscode-nightly/build/webview-ui tsconfig.tsbuildinfo .turbo" + "clean": "rimraf ../src/webview-ui tsconfig.tsbuildinfo .turbo" }, "dependencies": { "@radix-ui/react-alert-dialog": "^1.1.6", diff --git a/webview-ui/src/vite-plugins/sourcemapPlugin.ts b/webview-ui/src/vite-plugins/sourcemapPlugin.ts index 1449c888f2..ed94c32647 100644 --- a/webview-ui/src/vite-plugins/sourcemapPlugin.ts +++ b/webview-ui/src/vite-plugins/sourcemapPlugin.ts @@ -17,15 +17,9 @@ export function sourcemapPlugin(): Plugin { handler: async () => { console.log("Ensuring source maps are included in build...") - // Determine the correct output directory based on the build mode const mode = process.env.NODE_ENV - let outDir - - if (mode === "nightly") { - outDir = path.resolve("../apps/vscode-nightly/build/webview-ui/build") - } else { - outDir = path.resolve("../src/webview-ui/build") - } + /* c8 ignore next -- build-time output selection is exercised by the Vite build */ + const outDir = path.resolve("../src/webview-ui/build") const assetsDir = path.join(outDir, "assets") diff --git a/webview-ui/turbo.json b/webview-ui/turbo.json index 048b913add..77b74bb3be 100644 --- a/webview-ui/turbo.json +++ b/webview-ui/turbo.json @@ -4,9 +4,6 @@ "tasks": { "build": { "outputs": ["../src/webview-ui/**"] - }, - "build:nightly": { - "outputs": ["../apps/vscode-nightly/build/webview-ui/**"] } } } diff --git a/webview-ui/vite.config.ts b/webview-ui/vite.config.ts index 2e4506086a..f5743ee10e 100644 --- a/webview-ui/vite.config.ts +++ b/webview-ui/vite.config.ts @@ -53,7 +53,7 @@ const persistPortPlugin = (): Plugin => ({ // https://vite.dev/config/ export default defineConfig(({ mode }) => { - let outDir = "../src/webview-ui/build" + const outDir = "../src/webview-ui/build" const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "src", "package.json"), "utf8")) const gitSha = getGitSha() @@ -68,21 +68,6 @@ export default defineConfig(({ mode }) => { ...(gitSha ? { "process.env.PKG_SHA": JSON.stringify(gitSha) } : {}), } - // TODO: We can use `@roo-code/build` to generate `define` once the - // monorepo is deployed. - if (mode === "nightly") { - outDir = "../apps/vscode-nightly/build/webview-ui/build" - - const nightlyPkg = JSON.parse( - fs.readFileSync(path.join(__dirname, "..", "apps", "vscode-nightly", "package.nightly.json"), "utf8"), - ) - - define["process.env.PKG_NAME"] = JSON.stringify(nightlyPkg.name) - define["process.env.PKG_VERSION"] = JSON.stringify(nightlyPkg.version) - define["process.env.PKG_OUTPUT_CHANNEL"] = JSON.stringify("Zoo-Code-Nightly") - define["process.env.PKG_RELEASE_CHANNEL"] = JSON.stringify("prerelease") - } - const plugins: PluginOption[] = [ react({ babel: {