Commander V for VSC ✌️
Overview
For a Better AI Pair Programming Experience on the Open Seas of AI
Better because you can instantly convert selected folders and files into a single, shareable, blueprint of your codebase. This plaintext blueprint takes the form of an ASCII tree of your project's directory structure, joined with the full contents of the selected files. Comments are added between files to explain what and where everything is. (e.g. /* --- Begin /path/to/file.js --- */
)
🛳️🐬💦 Spring 2024 – Version 2 Sets Sail
New Features
- Mix and match a selection of files and folders. It works recursively. All will be joined.
- Ability to read open, unsaved files directly from the editor
- Improved KB Support allows
Cmd + Shift + V
to capture the active tab and Cmd + Shift + R
to rerun Commander V on the previous selection
- Improved ASCII tree formatting, custom file separators, and more
Details
Commander V was a gifted and beloved Ship Captain who gave his life to take the form of an extension for Microsoft's Visual Studio Code 1. He did this in exchange for the power of combining multiple files, together with an ASCII tree view of your project's directory structure, to your clipboard – giving greater context to the files and folders you share.
Sharing the updated state of your code in this way improves productivity when pair programming with an AI.
Because regularly reorienting your partner AI is more likely to solve problems in a way that makes sense for the system as a whole – not just for a single function or system in isolation.
It can also help overcome limits on memory, and can reduce the drift toward hallucination that smaller, self-hosted AI models are known to experience when pushed hard.
Watch...👇👀🍿
A demonstration of Commander V in use, this clip loops every 30 seconds, and makes more sense on subsequent views.
Installation
- Open Visual Studio Code
- Search for "Commander V" in the extensions tab. Or open the command palette (Mac:
Cmd+P
/ Win: Ctrl+P
) and type ext install kerns.commander-v
and press Enter
- Enjoy Commander V
Usage
Commander V Enters the Chat...
Summon Commander V by selecting one or more items (files and/or folders) from the file explorer sidebar in Visual Studio Code
Right-click on the items, and choose "Commander V" from the context menu
A blueprint of your project files is pushed to your clipboard
This moves quickly but loops every 15 seconds. Watch it a few times to grasp the full banality of what you're seeing.
Sample Output
My Project/
├─┬ components/
│ └── logo.tsx
├── index.tsx
└─┬ style/
└── global.css
/* --- Begin /components/logo.tsx --- */
import React from "react";
const Logo = ({ logoUrl }) => <img src={logoUrl} alt="" />;
export default Logo;
/* --- End /components/logo.tsx --- */
/* --- Begin /index.tsx --- */
import React from "react";
const HelloWorld = () => {
return <h1>Hello World</h1>;
};
export default HelloWorld;
/* --- End /index.tsx --- */
/* --- Begin /style/global.css --- */
h1 {
font-size: 2em;
font-weight: bold;
color: hsl(200 100% 50%);
margin-bottom: 1em;
}
/* --- End /style/global.css --- */
Optional Configuration
Global settings can be configured in your Visual Studio Code extension settings, under "Commander V". A local override can be configured on a per-project basis via a v.config.js
placed on the root of your project. May require a restart of VSC.
Configurable settings (Optional):
includeProjectTree
: Prepends directory structure of your project to the output in ASCII format (boolean)
projectTreeDepth
: Maximum depth for the project tree (number)
pruneProjectTree
: Limits the project tree to only show the files being concatenated (boolean)
orderFilesBy
: Sets the order in which files should appear – their order in the tree or the order in which they were selected ('treeOrder' or 'selectionOrder')
ignoreFile
: File to use for ignoring files or folders from the project tree (defaults to .gitignore
) (string)
commentAtFileBegin
: Comment to prepend before each file's content (string)
commentAtFileEnd
: Comment to append after each file's content (string)
includeSeparator
: Includes a separator between file contents when concatenating (boolean)
separatorCharacter
: The character to use for the separator between file contents (string)
separatorLength
: The length of the separator between file contents (number)
wrapInCodeBlock
: Wraps the concatenated file contents in a code block (```) (boolean)
playSoundOnComplete
: Play a sound when operations are successful and output is delivered to your clipboard (boolean)
readFromEditor
: Read unsaved file contents directly from the editor if the file is open, otherwise read from the last saved file (boolean)
Sample v.config.js
file
module.exports = {
pruneProjectTree: true,
ignoreFile: ".some-custom-ignore-file",
orderFilesBy: "selectionOrder",
includeSeparator: false,
separatorCharacter: "-",
separatorLength: 16,
wrapInCodeBlock: false,
};
The Rest of the Story (Epilogue)
A restless boy, determined to see the world, lost his way back home at what he thought was the end of his journey. Fate had him spend a decade more at sea, in close quarters with a man he would come to know as Commander V.
During this time, the boy was captivated and ultimately transformed by the Commander's unwavering passion for tidiness, coherence, and context in all aspects of his care for the ship that had become their home. Everything about life at sea with Commander V was a lesson in the importance of structure and order.
As their time together drew to a close, the boy felt heavy with the burden of a debt he knew he could never repay. Not for the years of food, shelter, and companionship – but for the gift of a new, or as he would one day come to describe it... a different way of thinking.
In the years that followed he lost the burden of that debt. But never missed an opportunity to signal a public tribute to Commander V. Why, it's the reason every Apple Computer since 1983 has used "Command V" for paste 2. Because of a boy who grew into a man. A man we knew as STEVE JOBS.
Feedback
The Commander is listening. Bugs, ideas, feedback and pull requests can go to GitHub issue tracker. If you're using and enjoying Commander V, please consider leaving a review on the Visual Studio Marketplace. This motivates The Commander to stay sailin'.
[1] Unclear why or how
[2] And/or Larry Tesler, Tim Mott, Xerox PARC