Skip to content

Commit 11c74f2

Browse files
committed
Add a new @roo-code/types package and use it everywhere
1 parent 8729027 commit 11c74f2

File tree

206 files changed

+1460
-4898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+1460
-4898
lines changed

.husky/pre-commit

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ else
1212
pnpm_cmd="pnpm"
1313
fi
1414

15-
"$pnpm_cmd" --filter roo-cline generate-types
16-
17-
if [ -n "$(git diff --name-only src/exports/roo-code.d.ts)" ]; then
18-
echo "Error: There are unstaged changes to roo-code.d.ts after running 'pnpm --filter roo-cline generate-types'."
19-
echo "Please review and stage the changes before committing."
20-
exit 1
21-
fi
22-
2315
# Detect if running on Windows and use npx.cmd, otherwise use npx.
2416
if [ "$OS" = "Windows_NT" ]; then
2517
npx_cmd="npx.cmd"

apps/vscode-e2e/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
"private": true,
44
"scripts": {
55
"lint": "eslint src --ext=ts --max-warnings=0",
6-
"check-types": "tsc --noEmit",
6+
"check-types": "tsc -p tsconfig.esm.json --noEmit",
77
"format": "prettier --write src",
8-
"test:ci": "pnpm --filter roo-cline build:development && pnpm test:run",
8+
"test:ci": "pnpm -w bundle && pnpm test:run",
99
"test:run": "rimraf out && tsc -p tsconfig.json && npx dotenvx run -f .env.local -- node ./out/runTest.js",
1010
"clean": "rimraf out .turbo"
1111
},
1212
"devDependencies": {
1313
"@roo-code/config-eslint": "workspace:^",
1414
"@roo-code/config-typescript": "workspace:^",
15-
"@roo-code/types": "^1.12.0",
15+
"@roo-code/types": "workspace:^",
1616
"@types/mocha": "^10.0.10",
1717
"@types/node": "^22.14.1",
1818
"@types/vscode": "^1.95.0",

apps/vscode-e2e/src/suite/extension.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as assert from "assert"
22
import * as vscode from "vscode"
33

4-
import { Package } from "@roo-code/types"
5-
64
suite("Roo Code Extension", () => {
75
test("Commands should be registered", async () => {
86
const expectedCommands = [
@@ -36,12 +34,10 @@ suite("Roo Code Extension", () => {
3634
"terminalExplainCommand",
3735
]
3836

39-
const commands = new Set(
40-
(await vscode.commands.getCommands(true)).filter((cmd) => cmd.startsWith(Package.name)),
41-
)
37+
const commands = new Set((await vscode.commands.getCommands(true)).filter((cmd) => cmd.startsWith("roo-cline")))
4238

4339
for (const command of expectedCommands) {
44-
assert.ok(commands.has(`${Package.name}.${command}`), `Command ${command} should be registered`)
40+
assert.ok(commands.has(`roo-cline.${command}`), `Command ${command} should be registered`)
4541
}
4642
})
4743
})

apps/vscode-e2e/src/suite/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Mocha from "mocha"
33
import { glob } from "glob"
44
import * as vscode from "vscode"
55

6-
import { type RooCodeAPI, Package } from "@roo-code/types"
6+
import type { RooCodeAPI } from "@roo-code/types"
77

88
import { waitFor } from "./utils"
99

@@ -12,7 +12,7 @@ declare global {
1212
}
1313

1414
export async function run() {
15-
const extension = vscode.extensions.getExtension<RooCodeAPI>(`${Package.publisher}.${Package.name}`)
15+
const extension = vscode.extensions.getExtension<RooCodeAPI>("RooVeterinaryInc.roo-cline")
1616

1717
if (!extension) {
1818
throw new Error("Extension not found")
@@ -26,7 +26,7 @@ export async function run() {
2626
openRouterModelId: "google/gemini-2.0-flash-001",
2727
})
2828

29-
await vscode.commands.executeCommand(`${Package.name}.SidebarProvider.focus`)
29+
await vscode.commands.executeCommand("roo-cline.SidebarProvider.focus")
3030
await waitFor(() => api.isReady())
3131

3232
// @ts-expect-error - Expose the API to the tests.

apps/vscode-e2e/src/suite/subtasks.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ suite.skip("Roo Code Subtasks", () => {
4949
// The parent task should not have resumed yet, so we shouldn't see
5050
// "Parent task resumed".
5151
assert.ok(
52-
messages[parentTaskId].find(({ type, text }) => type === "say" && text === "Parent task resumed") ===
52+
messages[parentTaskId]?.find(({ type, text }) => type === "say" && text === "Parent task resumed") ===
5353
undefined,
5454
"Parent task should not have resumed after subtask cancellation",
5555
)
@@ -63,7 +63,7 @@ suite.skip("Roo Code Subtasks", () => {
6363

6464
// The parent task should still not have resumed.
6565
assert.ok(
66-
messages[parentTaskId].find(({ type, text }) => type === "say" && text === "Parent task resumed") ===
66+
messages[parentTaskId]?.find(({ type, text }) => type === "say" && text === "Parent task resumed") ===
6767
undefined,
6868
"Parent task should not have resumed after subtask cancellation",
6969
)

apps/vscode-e2e/tsconfig.esm.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "@roo-code/config-typescript/base.json",
3+
"compilerOptions": {
4+
"outDir": "out"
5+
},
6+
"include": ["src"],
7+
"exclude": ["node_modules"]
8+
}

apps/vscode-e2e/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"useUnknownInCatchVariables": false,
1212
"outDir": "out"
1313
},
14-
"include": ["src", "../src/exports/roo-code.d.ts"],
14+
"include": ["src"],
1515
"exclude": [".vscode-test", "**/node_modules/**", "out"]
1616
}

apps/vscode-nightly/esbuild.mjs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ const __filename = fileURLToPath(import.meta.url)
99
const __dirname = path.dirname(__filename)
1010

1111
async function main() {
12+
const name = "extension-nightly"
1213
const production = process.argv.includes("--production")
1314
const minify = production
1415
const sourcemap = !production
1516

1617
const overrideJson = JSON.parse(fs.readFileSync(path.join(__dirname, "package.nightly.json"), "utf8"))
17-
console.log(`[main] name: ${overrideJson.name}`)
18-
console.log(`[main] version: ${overrideJson.version}`)
18+
console.log(`[${name}] name: ${overrideJson.name}`)
19+
console.log(`[${name}] version: ${overrideJson.version}`)
1920

2021
const gitSha = getGitSha()
21-
console.log(`[main] gitSha: ${gitSha}`)
22+
console.log(`[${name}] gitSha: ${gitSha}`)
2223

2324
/**
2425
* @type {import('esbuild').BuildOptions}
@@ -43,12 +44,22 @@ async function main() {
4344
const buildDir = path.join(__dirname, "build")
4445
const distDir = path.join(buildDir, "dist")
4546

47+
console.log(`[${name}] srcDir: ${srcDir}`)
48+
console.log(`[${name}] buildDir: ${buildDir}`)
49+
console.log(`[${name}] distDir: ${distDir}`)
50+
51+
// Clean build directory before starting new build
52+
if (fs.existsSync(buildDir)) {
53+
console.log(`[${name}] Cleaning build directory: ${buildDir}`)
54+
fs.rmSync(buildDir, { recursive: true, force: true })
55+
}
56+
4657
/**
4758
* @type {import('esbuild').Plugin[]}
4859
*/
4960
const plugins = [
5061
{
51-
name: "copy-files",
62+
name: "copyPaths",
5263
setup(build) {
5364
build.onEnd(() => {
5465
copyPaths(
@@ -69,7 +80,7 @@ async function main() {
6980
},
7081
},
7182
{
72-
name: "generate-package-json",
83+
name: "generatePackageJson",
7384
setup(build) {
7485
build.onEnd(() => {
7586
const packageJson = JSON.parse(fs.readFileSync(path.join(srcDir, "package.json"), "utf8"))
@@ -81,7 +92,7 @@ async function main() {
8192
})
8293

8394
fs.writeFileSync(path.join(buildDir, "package.json"), JSON.stringify(generatedPackageJson, null, 2))
84-
console.log(`[generate-package-json] Generated package.json`)
95+
console.log(`[generatePackageJson] Generated package.json`)
8596

8697
let count = 0
8798

@@ -92,7 +103,7 @@ async function main() {
92103
}
93104
})
94105

95-
console.log(`[copy-src] Copied ${count} package.nls*.json files to ${buildDir}`)
106+
console.log(`[generatePackageJson] Copied ${count} package.nls*.json files to ${buildDir}`)
96107

97108
const nlsPkg = JSON.parse(fs.readFileSync(path.join(srcDir, "package.nls.json"), "utf8"))
98109

@@ -105,18 +116,18 @@ async function main() {
105116
JSON.stringify({ ...nlsPkg, ...nlsNightlyPkg }, null, 2),
106117
)
107118

108-
console.log(`[copy-src] Generated package.nls.json`)
119+
console.log(`[generatePackageJson] Generated package.nls.json`)
109120
})
110121
},
111122
},
112123
{
113-
name: "copy-wasms",
124+
name: "copyWasms",
114125
setup(build) {
115126
build.onEnd(() => copyWasms(srcDir, distDir))
116127
},
117128
},
118129
{
119-
name: "copy-locales",
130+
name: "copyLocales",
120131
setup(build) {
121132
build.onEnd(() => copyLocales(srcDir, distDir))
122133
},

apps/vscode-nightly/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
"private": true,
55
"packageManager": "[email protected]",
66
"scripts": {
7-
"bundle": "pnpm clean && pnpm --filter @roo-code/build build && node esbuild.mjs",
8-
"build": "pnpm bundle --production && pnpm --filter @roo-code/vscode-webview build --mode nightly",
9-
"vsix": "pnpm build && cd build && mkdirp ../../../bin && npx vsce package --no-dependencies --out ../../../bin",
7+
"bundle:nightly": "node esbuild.mjs",
8+
"vsix:nightly": "cd build && mkdirp ../../../bin && npx vsce package --no-dependencies --out ../../../bin",
109
"clean": "rimraf build .turbo"
1110
},
1211
"devDependencies": {

0 commit comments

Comments
 (0)