Compare commits

...

5 Commits

Author SHA1 Message Date
Sarah Fortune ecd373f4af Merge branch 'sjf-h2' of https://github.com/cline/cline into sjf-h2 2025-06-10 18:44:23 -07:00
Sarah Fortune ef2308c516 During cleanup remove generated files that have been moved to a different location. 2025-06-10 18:44:03 -07:00
Sarah Fortune 62bb8d8208 During cleanup remove generated files that have been moved to a different location. 2025-06-10 18:42:51 -07:00
Sarah Fortune a831800d32 Update package.json 2025-06-10 12:49:04 -07:00
Sarah Fortune 80c0412a02 Add a host bridge client that uses the appropriate underlying client (vscode or external grpc service)
Add placeholders for the external clients.

Move the hosts directory under src, add an alias in tsconfig.json for @hosts
2025-06-10 12:46:59 -07:00
+31 -10
View File
@@ -15,6 +15,7 @@ const protoc = path.join(require.resolve("grpc-tools"), "../bin/protoc")
const __filename = fileURLToPath(import.meta.url)
const SCRIPT_DIR = path.dirname(__filename)
const ROOT_DIR = path.resolve(SCRIPT_DIR, "..")
const TS_OUT_DIR = path.join(ROOT_DIR, "src", "shared", "proto")
const isWindows = process.platform === "win32"
const tsProtoPlugin = isWindows
@@ -68,18 +69,9 @@ async function main() {
// Check for Apple Silicon compatibility before proceeding
checkAppleSiliconCompatibility()
// Define output directories
const TS_OUT_DIR = path.join(ROOT_DIR, "src", "shared", "proto")
// Create output directories if they don't exist
await fs.mkdir(TS_OUT_DIR, { recursive: true })
// Clean up existing generated files
console.log(chalk.cyan("Cleaning up existing generated TypeScript files..."))
const existingFiles = await globby("**/*.ts", { cwd: TS_OUT_DIR })
for (const file of existingFiles) {
await fs.unlink(path.join(TS_OUT_DIR, file))
}
await cleanup()
// Check for missing proto files for services in serviceNameMap
await ensureProtoFilesExist()
@@ -654,6 +646,35 @@ export {
console.log(chalk.green(`Generated host gRPC client at ${configPath}`))
}
async function cleanup() {
// Clean up existing generated files
console.log(chalk.cyan("Cleaning up existing generated TypeScript files..."))
const existingFiles = await globby("**/*.ts", { cwd: TS_OUT_DIR })
for (const file of existingFiles) {
await fs.unlink(path.join(TS_OUT_DIR, file))
}
// Clean up generated files that were moved.
await fs.rm(path.join(ROOT_DIR, "src", "standalone", "services", "host-grpc-client.ts"), { force: true })
await rmdir(path.join(ROOT_DIR, "src", "standalone", "services"))
await fs.rm(path.join(ROOT_DIR, "hosts", "vscode"), { force: true, recursive: true })
await rmdir(path.join(ROOT_DIR, "hosts"))
}
/**
* Remove an empty dir, do nothing if the directory doesn't exist or is not empty.
*/
async function rmdir(path) {
try {
await fs.rmdir(path)
} catch (error) {
if (error.code !== "ENOTEMPTY" && error.code !== "ENOENT") {
// Only re-throw if it's not "not empty" or "doesn't exist"
throw error
}
}
}
// Check for Apple Silicon compatibility
function checkAppleSiliconCompatibility() {
// Only run check on macOS