Commander V, Your AI Captain of Concatenation
To the humans working to fix their terrible code,
...and to the magical AIs racing ahead to help us.
To each and every one of us, GODSPEED. I am coming home
— Last words of Commander V, spoken as he transformed into a VS Code extension
🛳️🐬💦 SPRING 2024: Version 2.1 Hits the High Seas
New in v.2.1
- Folder Support - Commander V now concatenates all non-binary files within any selected folder. Even select multiple folders, or mix and match a selection of files and folders. All will be joined.
- Improved KB Support – Trigger Commander V on the active tab with
Shift + Cmd + V
- Improved ASCII tree formatting, custom file separators, and more
Overview
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 structure and context for the files and folders you share.
Sharing in this way makes it easier to pair with an AI for help with your code, and to solve problems with an approach that makes sense for the system as a whole – not just for a single function or system in isolation.
Regularly reorienting your partner AI in the updated state of your code can also help overcome limits on memory, and can reduce the drift toward hallucination that smaller, self-hosted models are known to experience when pressed at length.
Watch...👇👀🍿
Features
- Concatenates files into a single, structured monolith of information and pushes it to your clipboard
- Adds an ASCII tree of your project's structure illustrating the relative location of files
- Sensible comment structure to clearly demark file beginning/end
- Optionally orders files after project's folder structure or your selection order
- Supports local configuration via optional
v.config.js
file
- More, but not a lot more
Commander V Enters the Chat
Summon Commander V by selecting one or more items (files or folders) from the file explorer sidebar in Visual Studio Code. Then right-click on the items, and choose "Commander V" (Shift + Cmd + V) to have them added to your clipboard as a highly digestible blob.
Always choose Commander V.
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: 24px;
font-weight: bold;
color: [#333](https://github.com/kerns/commander-v/issues/333);
margin-bottom: 10px;
}
/* --- End /style/global.css --- */
Installation Steps
- Open Visual Studio Code
- Open the command palette (Mac:
Cmd+P
/ Win: Ctrl+P
) and type ext install kerns.commander-v
and press Enter
– or just search for "Commander V" in the extensions tab
- Enjoy Commander V
Usage
- In the VSC explorer sidebar, hold down
Ctrl
(Windows) or Cmd
(Mac) and select multiple files
- Right-click on one of the selected files and choose
Commander V
from the context menu – or use the keyboard shortcut Shift + Cmd + V
to trigger Commander V on the active tab
- The content of the selected files with an ASCII tree view of your project is merged and pushed to your clipboard
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 VS Code.
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)
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. 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... different way of thinking.
In the years that followed he lost the burden of that debt. But never 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 Commander to stay sailin'.
[1] Do not ask why or how
[2] And/or Larry Tesler, Tim Mott, Xerox PARC