Webcogs VSCode extensionPart of the Webcogs open source experimental AI software engineering toolkit, which facilitates using an LLM as a compiler. The extension provides a CodeLens alternative for the buildcog and buildcogsinplace command line tools. FeaturesThe main idea behind Webcogs is that it allows you to use the LLM as a compiler, compiling specifications into code. Basically you write the docs, and have the AI generate specific functions and classes. Provides methodical prompts-as-code facilities that are complementary to the ad hoc prompting offered by most code generating AI tools. Instead of prompting in a chat line, then throwing away the prompts once the code is generated, prompts can be embedded in the source code or specified via a buildfile. This allows you to specify context more precisely and consistently, which increases generation accuracy. Also, you can re-generate code easily when the specifications change, making it easier to use AI code generation to not just create but also maintain your code.
How to useYou have to activate the codelenses from the command palette. Type Shift-Ctrl-P, then select "Webcogs: Enable Webcogs Codelens". You need to have an OpenAI API key, which you are prompted to fill in when the plugin initialises for the first time. If you have to re-enter it, use the command "Webcogs: Re-enter Webcogs OpenAI API Key". Note the tool now uses the new GPT-5 model by default, which is supposed to be as good as O3, which gives me good results, and is low-cost (about $0.01 to generate a function, $0.02 to generate a class). Building files via a buildfileFor building separate files, you can use a promptbuildfile which is a JSON file defining the build targets and corresponding prompts. Opening a promptbuildfile in the editor brings up a codelens for each target in the file. The file looks something like this:
Most important are:
For full documentation of the file format, see the github repo: https://github.com/borisvanschooten/webcogs-ai-toolkit Building functions inside an existing fileYou can augment your source files with @cogs directives inside multiline comments, which indicate prompts with which parts of your code can be generated. It currently supports C-style multiline comments only (without nesting), so it works for languages like Java, C, C++, C#, PHP, Javascript, Typescript, CSS. Example:
There's no accept/reject dialog after generating code yet, but the code generations can be undone with regular undo (Ctrl-Z). Building a function takes around 10 seconds, but you can build multiple functions in parallel. For full documentation, see the Github repo: https://github.com/borisvanschooten/webcogs-ai-toolkit Extension SettingsThis extension contributes the following settings:
Known IssuesThis is as yet an experimental plugin. Error handling still needs work. How to re-build from sourceDownload the repo. Make sure to install the vsce tool:
Go to the repo's vscode-extension/webcogs subdirectory, then:
This will create a vsix package, which you can install in VSCode:
|