Skip to content

Commit 5d817f4

Browse files
author
hongyu9
committed
first commit
0 parents  commit 5d817f4

10,185 files changed

Lines changed: 2994320 additions & 0 deletions

File tree

Some content is hidden

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

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
idea/platform.zip filter=lfs diff=lfs merge=lfs -text
2+
3+
*.ps1 text eol=crlf

.gitignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
.DS_Store
2+
*.log
3+
debug-resources
4+
5+
.pnpm-store
6+
dist
7+
out
8+
out-*
9+
node_modules
10+
coverage/
11+
12+
.DS_Store
13+
14+
# Builds
15+
bin/
16+
roo-cline-*.vsix
17+
18+
# Local prompts and rules
19+
/local-prompts
20+
21+
# Test environment
22+
.test_env
23+
.vscode-test/
24+
25+
# Docs
26+
docs/_site/
27+
28+
# Dotenv
29+
.env
30+
.env.*
31+
!.env.*.sample
32+
33+
34+
#Local lint config
35+
.eslintrc.local.json
36+
37+
#Logging
38+
logs
39+
.idea/
40+
*.vsix
41+
# Vite development
42+
.vite-port
43+
44+
# cursor
45+
.cursor/rules/
46+
.cursor/prompts/
47+
48+
# vscode import
49+
base/vscode/*

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "roo-code"]
2+
path = roo-code
3+
url = https://github.com/RooCodeInc/Roo-Code.git
4+
[submodule "vscode"]
5+
path = vscode
6+
url = https://github.com/microsoft/vscode.git

.vscode/extensions.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"dbaeumer.vscode-eslint",
6+
"esbenp.prettier-vscode",
7+
"csstools.postcss",
8+
"bradlc.vscode-tailwindcss",
9+
"connor4312.esbuild-problem-matchers",
10+
"yoavbls.pretty-ts-errors"
11+
]
12+
}

.vscode/launch.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"runtimeExecutable": "${execPath}",
13+
"args": ["--extensionDevelopmentPath=${workspaceFolder}/src"],
14+
"sourceMaps": true,
15+
"outFiles": ["${workspaceFolder}/src/dist/**/*.js"],
16+
"preLaunchTask": "${defaultBuildTask}",
17+
"env": {
18+
"NODE_ENV": "development",
19+
"VSCODE_DEBUG_MODE": "true"
20+
},
21+
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"],
22+
"presentation": {
23+
"hidden": false,
24+
"group": "tasks",
25+
"order": 1
26+
}
27+
},
28+
{
29+
"name": "调试扩展进程与插件代码",
30+
"type": "node",
31+
"request": "launch",
32+
"program": "${workspaceFolder}/base/dist/src/extension.js",
33+
"args": ["--listen", "--port=51234"],
34+
"outFiles": [
35+
"${workspaceFolder}/base/dist/**/*.js",
36+
"${workspaceFolder}/roo-code/dist/**/*.js",
37+
"${workspaceFolder}/roo-code/src/**/*.js"
38+
],
39+
"sourceMaps": true,
40+
"stopOnEntry": false,
41+
"restart": true,
42+
"timeout": 999999,
43+
"internalConsoleOptions": "openOnSessionStart",
44+
"autoAttachChildProcesses": true,
45+
"skipFiles": ["<node_internals>/**"],
46+
"resolveSourceMapLocations": [
47+
"${workspaceFolder}/roo-code/src/**",
48+
"${workspaceFolder}/roo-code/dist/**",
49+
"${workspaceFolder}/base/**",
50+
"!**/node_modules/**"
51+
],
52+
"sourceMapPathOverrides": {
53+
"webpack:///./~/*": "${workspaceFolder}/node_modules/*",
54+
"webpack:///./*": "${workspaceFolder}/*",
55+
"webpack:///*": "*"
56+
},
57+
"env": {
58+
"NODE_ENV": "development",
59+
"DEBUG": "true",
60+
"VSCODE_DEBUG_MODE": "true",
61+
"NODE_OPTIONS": "--inspect --enable-source-maps"
62+
}
63+
// "preLaunchTask": "prepare-debug"
64+
}
65+
]
66+
}

.vscode/settings.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
5+
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
6+
},
7+
"search.exclude": {
8+
"out": true, // set this to false to include "out" folder in search results
9+
"dist": true // set this to false to include "dist" folder in search results
10+
},
11+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
12+
"typescript.tsc.autoDetect": "off"
13+
}

.vscode/tasks.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "watch",
8+
"dependsOn": ["watch:webview", "watch:bundle", "watch:tsc"],
9+
"presentation": {
10+
"reveal": "never"
11+
},
12+
"group": {
13+
"kind": "build",
14+
"isDefault": true
15+
}
16+
},
17+
{
18+
"label": "watch:webview",
19+
"type": "shell",
20+
"command": "pnpm --filter @roo-code/vscode-webview dev",
21+
"group": "build",
22+
"problemMatcher": {
23+
"owner": "vite",
24+
"pattern": {
25+
"regexp": "^$"
26+
},
27+
"background": {
28+
"activeOnStart": true,
29+
"beginsPattern": ".*VITE.*",
30+
"endsPattern": ".*Local:.*"
31+
}
32+
},
33+
"isBackground": true,
34+
"presentation": {
35+
"group": "watch",
36+
"reveal": "always"
37+
}
38+
},
39+
{
40+
"label": "watch:bundle",
41+
"type": "shell",
42+
"command": "npx turbo watch:bundle",
43+
"group": "build",
44+
"problemMatcher": {
45+
"owner": "esbuild",
46+
"pattern": {
47+
"regexp": "^$"
48+
},
49+
"background": {
50+
"activeOnStart": true,
51+
"beginsPattern": "esbuild-problem-matcher#onStart",
52+
"endsPattern": "esbuild-problem-matcher#onEnd"
53+
}
54+
},
55+
"isBackground": true,
56+
"presentation": {
57+
"group": "watch",
58+
"reveal": "always"
59+
}
60+
},
61+
{
62+
"label": "watch:tsc",
63+
"type": "shell",
64+
"command": "npx turbo watch:tsc",
65+
"group": "build",
66+
"problemMatcher": "$tsc-watch",
67+
"isBackground": true,
68+
"presentation": {
69+
"group": "watch",
70+
"reveal": "always"
71+
}
72+
}
73+
]
74+
}

base/bootstrap-cli.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
// Delete `VSCODE_CWD` very early. We have seen
7+
// reports where `code .` would use the wrong
8+
// current working directory due to our variable
9+
// somehow escaping to the parent shell
10+
// (https://github.com/microsoft/vscode/issues/126399)
11+
delete process.env["VSCODE_CWD"]

base/bootstrap-esm.ts

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import * as path from "path"
7+
import * as fs from "fs"
8+
import { fileURLToPath } from "url"
9+
import { createRequire, register } from "node:module"
10+
import { product, pkg } from "./bootstrap-meta.js"
11+
import "./bootstrap-node.js"
12+
import * as performance from "./vs/base/common/performance.js"
13+
import { INLSConfiguration } from "./vs/nls.js"
14+
15+
const require = createRequire(import.meta.url)
16+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
17+
18+
// Install a hook to module resolution to map 'fs' to 'original-fs'
19+
if (process.env["ELECTRON_RUN_AS_NODE"] || process.versions["electron"]) {
20+
const jsCode = `
21+
export async function resolve(specifier, context, nextResolve) {
22+
if (specifier === 'fs') {
23+
return {
24+
format: 'builtin',
25+
shortCircuit: true,
26+
url: 'node:original-fs'
27+
};
28+
}
29+
30+
// Defer to the next hook in the chain, which would be the
31+
// Node.js default resolve if this is the last user-specified loader.
32+
return nextResolve(specifier, context);
33+
}`
34+
register(`data:text/javascript;base64,${Buffer.from(jsCode).toString("base64")}`, import.meta.url)
35+
}
36+
37+
// Prepare globals that are needed for running
38+
globalThis._VSCODE_PRODUCT_JSON = { ...product }
39+
if (process.env["VSCODE_DEV"]) {
40+
try {
41+
const overrides: unknown = require("../product.overrides.json")
42+
globalThis._VSCODE_PRODUCT_JSON = Object.assign(globalThis._VSCODE_PRODUCT_JSON, overrides)
43+
} catch (error) {
44+
/* ignore */
45+
}
46+
}
47+
globalThis._VSCODE_PACKAGE_JSON = { ...pkg }
48+
globalThis._VSCODE_FILE_ROOT = __dirname
49+
50+
//#region NLS helpers
51+
52+
let setupNLSResult: Promise<INLSConfiguration | undefined> | undefined = undefined
53+
54+
function setupNLS(): Promise<INLSConfiguration | undefined> {
55+
if (!setupNLSResult) {
56+
setupNLSResult = doSetupNLS()
57+
}
58+
59+
return setupNLSResult
60+
}
61+
62+
async function doSetupNLS(): Promise<INLSConfiguration | undefined> {
63+
performance.mark("code/willLoadNls")
64+
65+
let nlsConfig: INLSConfiguration | undefined = undefined
66+
67+
let messagesFile: string | undefined
68+
if (process.env["VSCODE_NLS_CONFIG"]) {
69+
try {
70+
nlsConfig = JSON.parse(process.env["VSCODE_NLS_CONFIG"])
71+
if (nlsConfig?.languagePack?.messagesFile) {
72+
messagesFile = nlsConfig.languagePack.messagesFile
73+
} else if (nlsConfig?.defaultMessagesFile) {
74+
messagesFile = nlsConfig.defaultMessagesFile
75+
}
76+
77+
globalThis._VSCODE_NLS_LANGUAGE = nlsConfig?.resolvedLanguage
78+
} catch (e) {
79+
console.error(`Error reading VSCODE_NLS_CONFIG from environment: ${e}`)
80+
}
81+
}
82+
83+
if (
84+
process.env["VSCODE_DEV"] || // no NLS support in dev mode
85+
!messagesFile // no NLS messages file
86+
) {
87+
return undefined
88+
}
89+
90+
try {
91+
globalThis._VSCODE_NLS_MESSAGES = JSON.parse((await fs.promises.readFile(messagesFile)).toString())
92+
} catch (error) {
93+
console.error(`Error reading NLS messages file ${messagesFile}: ${error}`)
94+
95+
// Mark as corrupt: this will re-create the language pack cache next startup
96+
if (nlsConfig?.languagePack?.corruptMarkerFile) {
97+
try {
98+
await fs.promises.writeFile(nlsConfig.languagePack.corruptMarkerFile, "corrupted")
99+
} catch (error) {
100+
console.error(`Error writing corrupted NLS marker file: ${error}`)
101+
}
102+
}
103+
104+
// Fallback to the default message file to ensure english translation at least
105+
if (nlsConfig?.defaultMessagesFile && nlsConfig.defaultMessagesFile !== messagesFile) {
106+
try {
107+
globalThis._VSCODE_NLS_MESSAGES = JSON.parse(
108+
(await fs.promises.readFile(nlsConfig.defaultMessagesFile)).toString(),
109+
)
110+
} catch (error) {
111+
console.error(`Error reading default NLS messages file ${nlsConfig.defaultMessagesFile}: ${error}`)
112+
}
113+
}
114+
}
115+
116+
performance.mark("code/didLoadNls")
117+
118+
return nlsConfig
119+
}
120+
121+
//#endregion
122+
123+
export async function bootstrapESM(): Promise<void> {
124+
// NLS
125+
await setupNLS()
126+
}

0 commit comments

Comments
 (0)