From ae79f3b622b95ca17fc643b9efc7b93c51ea1d13 Mon Sep 17 00:00:00 2001 From: Beatrix Date: Fri, 16 Aug 2024 12:20:31 -0700 Subject: [PATCH] fix lint --- .../source.extension.vsixmanifest | 5 +- src/build.cake | 194 +++++++++--------- 2 files changed, 100 insertions(+), 99 deletions(-) diff --git a/src/Cody.VisualStudio/source.extension.vsixmanifest b/src/Cody.VisualStudio/source.extension.vsixmanifest index d4eed8c2..6e192588 100644 --- a/src/Cody.VisualStudio/source.extension.vsixmanifest +++ b/src/Cody.VisualStudio/source.extension.vsixmanifest @@ -3,8 +3,9 @@ Cody for Visual Studio - AI Coding Assistant - AI coding assistant that uses search and codebase context to help you write code faster. Cody brings autocomplete, chat, and commands to VS Code, so you can generate code, write unit tests, create docs, and explain complex code using AI. Choose from the latest LLMs, including GPT-4o and Claude 3. - https://sourcegraph.com/ + AI coding assistant that uses search and codebase context to help you write code faster. Cody brings chat, and commands to Visual Studio, so you can generate code, write unit tests, create docs, and explain complex code using AI. Choose from the latest LLMs, including GPT-4o, Claude 3.5 Sonnet, Claude 3 Opus, Google Gemini 1.5 Pro and more! + https://sourcegraph.com/cody + https://sourcegraph.com/docs Resources\Marketplace.png Resources\Preview.png ai, openai, anthropic, assistant, chatbot, chat, refactor, documentation, test, sourcegraph, codey, llm, codegen, bot, model, typescript, javascript, python, golang, go, html, css, java, php, swift, kotlin, ollama, c#, c++, gemini diff --git a/src/build.cake b/src/build.cake index ed685f35..ebfc5da5 100644 --- a/src/build.cake +++ b/src/build.cake @@ -33,121 +33,121 @@ var marketplaceToken = EnvironmentVariable("CODY_VS_MARKETPLACE_RELEASE_TOKEN"); ////////////////////////////////////////////////////////////////////// Task("BuildCodyAgent") - .Does(() => + .Does(() => { - // Check for the env var to see if we should use the local cody directory. - // This is used to build the agent from the local cody directory instead of cloning from github. - var isDevMode = EnvironmentVariable("CODY_VS_DEV_PORT") == "3113"; - if (isDevMode && DirectoryExists(codyDevDir)) - { - Information($"--> Running in DevMode using:'{codyDir}'"); - codyDir = codyDevDir; - } + // Check for the env var to see if we should use the local cody directory. + // This is used to build the agent from the local cody directory instead of cloning from github. + var isDevMode = EnvironmentVariable("CODY_VS_DEV_PORT") == "3113"; + if (isDevMode && DirectoryExists(codyDevDir)) + { + Information($"--> Running in DevMode using:'{codyDir}'"); + codyDir = codyDevDir; + } - var codyAgentDir = MakeAbsolute(codyDir + Directory("agent")); - var codyAgentDistDir = codyAgentDir + Directory("dist"); - var branchName = "main"; + var codyAgentDir = MakeAbsolute(codyDir + Directory("agent")); + var codyAgentDistDir = codyAgentDir + Directory("dist"); + var branchName = "main"; - if (!DirectoryExists(codyDir) || !GitIsValidRepository(codyDir)) - { - Information($"--> Cloning repository:'{codyRepo}'"); - GitClone(codyRepo, codyDir, new GitCloneSettings { BranchName = branchName }); - } + if (!DirectoryExists(codyDir) || !GitIsValidRepository(codyDir)) + { + Information($"--> Cloning repository:'{codyRepo}'"); + GitClone(codyRepo, codyDir, new GitCloneSettings { BranchName = branchName }); + } - if (!isDevMode) - { - Information($"--> Checkout '{branchName}' ..."); - GitCheckout(codyDir, branchName); + if (!isDevMode) + { + Information($"--> Checkout '{branchName}' ..."); + GitCheckout(codyDir, branchName); - //GitCheckout(codyDir, codyCommit); + //GitCheckout(codyDir, codyCommit); - Information($"--> git pull ..."); - GitPull(codyDir, "cake", "cake@cake.com"); - } + Information($"--> git pull ..."); + GitPull(codyDir, "cake", "cake@cake.com"); + } - Information($"--> Cleaning '{codyAgentDistDir}' ..."); - CleanDirectory(codyAgentDistDir); + Information($"--> Cleaning '{codyAgentDistDir}' ..."); + CleanDirectory(codyAgentDistDir); - Context.Environment.WorkingDirectory = codyAgentDir; + Context.Environment.WorkingDirectory = codyAgentDir; - Information($"--> pnpm install ..."); - PnpmInstall(); + Information($"--> pnpm install ..."); + PnpmInstall(); - Information($"--> pnpm build ..."); - PnpmRun("build"); + Information($"--> pnpm build ..."); + PnpmRun("build"); - //PnpmRun("build:agent"); - //PnpmRun("build:webviews"); + //PnpmRun("build:agent"); + //PnpmRun("build:webviews"); - Context.Environment.WorkingDirectory = solutionDir; + Context.Environment.WorkingDirectory = solutionDir; - var deleteSettings = new DeleteDirectorySettings - { - Recursive = true, - Force = true - }; - Information($"--> Cleaning '{agentDir}' ..."); - CleanDirectory(agentDir); + var deleteSettings = new DeleteDirectorySettings + { + Recursive = true, + Force = true + }; + Information($"--> Cleaning '{agentDir}' ..."); + CleanDirectory(agentDir); - Information($"--> Copying the agent to '{agentDir}'"); - CreateDirectory(agentDir); - CopyDirectory(codyAgentDistDir, agentDir); + Information($"--> Copying the agent to '{agentDir}'"); + CreateDirectory(agentDir); + CopyDirectory(codyAgentDistDir, agentDir); - var codyWebviewsFolder = MakeAbsolute(codyDir + Directory("agent/dist/webviews")); - Information($"--> Copying the webviews from '{codyWebviewsFolder}' to '{agentDir}' ..."); - CopyDirectory(codyWebviewsFolder, $"{agentDir}/webviews"); + var codyWebviewsFolder = MakeAbsolute(codyDir + Directory("agent/dist/webviews")); + Information($"--> Copying the webviews from '{codyWebviewsFolder}' to '{agentDir}' ..."); + CopyDirectory(codyWebviewsFolder, $"{agentDir}/webviews"); - // removing pnpm build:root artefacts (/src and /scripts folders) + // removing pnpm build:root artefacts (/src and /scripts folders) - var srcFolder = @$"{agentDir}/src"; - var scriptsFolder = @$"{agentDir}/scripts"; - if (DirectoryExists(srcFolder)) - DeleteDirectory(srcFolder, deleteSettings); + var srcFolder = @$"{agentDir}/src"; + var scriptsFolder = @$"{agentDir}/scripts"; + if (DirectoryExists(srcFolder)) + DeleteDirectory(srcFolder, deleteSettings); - if (DirectoryExists(scriptsFolder)) - DeleteDirectory(scriptsFolder, deleteSettings); + if (DirectoryExists(scriptsFolder)) + DeleteDirectory(scriptsFolder, deleteSettings); }); Task("DownloadNode") - .Does(() => + .Does(() => { - if (!FileExists(nodeExeFile)) - { - CreateDirectory(nodeBinariesDir); - DownloadFile(nodeBinaryUrl, nodeExeFile); - } - - if (!FileExists(nodeArmExeFile)) - { - CreateDirectory(nodeBinariesDir); - DownloadFile(nodeArmBinaryUrl, nodeArmExeFile); - } - - CopyFileToDirectory(nodeExeFile, agentDir); - CopyFileToDirectory(nodeArmExeFile, agentDir); + if (!FileExists(nodeExeFile)) + { + CreateDirectory(nodeBinariesDir); + DownloadFile(nodeBinaryUrl, nodeExeFile); + } + + if (!FileExists(nodeArmExeFile)) + { + CreateDirectory(nodeBinariesDir); + DownloadFile(nodeArmBinaryUrl, nodeArmExeFile); + } + + CopyFileToDirectory(nodeExeFile, agentDir); + CopyFileToDirectory(nodeArmExeFile, agentDir); }); Task("Build") - .IsDependentOn("BuildCodyAgent") - .IsDependentOn("DownloadNode") - .IsDependentOn("Restore") - .Does(() => + .IsDependentOn("BuildCodyAgent") + .IsDependentOn("DownloadNode") + .IsDependentOn("Restore") + .Does(() => { - MSBuild("./Cody.sln", new MSBuildSettings - { - Configuration = configuration, - PlatformTarget = PlatformTarget.MSIL - }); + MSBuild("./Cody.sln", new MSBuildSettings + { + Configuration = configuration, + PlatformTarget = PlatformTarget.MSIL + }); }); Task("Restore") .Does(() => { - Information($"Restore ..."); + Information($"Restore ..."); MSBuild("./Cody.sln", new MSBuildSettings { Targets = { "Restore" }, Verbosity = Verbosity.Minimal @@ -155,36 +155,36 @@ Task("Restore") }); Task("Publish") - //.IsDependentOn("Build") - .Does(() => + //.IsDependentOn("Build") + .Does(() => { - var args = new ProcessSettings().WithArguments(x => x - .Append("publish") - .AppendSwitchQuoted("-payload", buildExtensionFile) - .AppendSwitchQuoted("-publishManifest", publishManifestFile) - .AppendSwitchQuoted("-personalAccessToken", marketplaceToken) - ); + var args = new ProcessSettings().WithArguments(x => x + .Append("publish") + .AppendSwitchQuoted("-payload", buildExtensionFile) + .AppendSwitchQuoted("-publishManifest", publishManifestFile) + .AppendSwitchQuoted("-personalAccessToken", marketplaceToken) + ); - var returnCode = StartProcess(vsixPublisherFile, args); - if (returnCode != 0) throw new Exception("Publishing error"); + var returnCode = StartProcess(vsixPublisherFile, args); + if (returnCode != 0) throw new Exception("Publishing error"); - //StartProcess(vsixPublisherFile, $"publish -payload \"{buildExtensionFile}\" -publishManifest \"{publishManifestFile}\" -personalAccessToken \"{marketplaceToken}\""); + //StartProcess(vsixPublisherFile, $"publish -payload \"{buildExtensionFile}\" -publishManifest \"{publishManifestFile}\" -personalAccessToken \"{marketplaceToken}\""); }); Task("Clean") - //.WithCriteria(c => HasArgument("rebuild")) - .Does(() => + //.WithCriteria(c => HasArgument("rebuild")) + .Does(() => { - //todo + //todo }); Task("Test") - .IsDependentOn("Build") - .Does(() => + .IsDependentOn("Build") + .Does(() => { - //todo + //todo }); //////////////////////////////////////////////////////////////////////