VS Code Extension¶
Table of Contents¶
- Getting Started
- Publishing a File
- Publishing a Whole Folder
- Updating a File
- Updating Description and Tags
- Unpublishing a File
- Browsing Your Published Files
- Favoriting and Running Files
- Moving or Renaming a Published File
- Working with Teams
- Extension Settings
- Changing Your Settings
Getting Started¶
Before you can publish files you need to connect the extension to your CodeFetch server.
- Open the Command Palette (
Cmd+Shift+P/Ctrl+Shift+P) and run CodeFetch: Configure Settings. - Enter your API Endpoint — the URL of your CodeFetch server (your administrator will provide this).
- Enter your Secret Key — your authentication token.
- Optionally enter a Default Author name. This is attached to files you publish.
- Click Save Settings.
The panel stays open if you switch to another app (for example, to copy your credentials from a password manager). Once saved, the extension is ready to use — no restart required.
Your credentials are stored encrypted inside VS Code and are never written to any project file.
Publishing a File¶
Publishing makes a file available on your CodeFetch server.
From the Explorer (recommended):
- Right-click any file in the VS Code Explorer.
- Select CodeFetch: Publish File.
- Enter a description when prompted.
- Enter one or more tags, separated by commas (or leave blank and press Enter to skip).
The file is uploaded and a ✓ badge appears on it in the Explorer.
From an open editor:
Open the file, then open the Command Palette and run CodeFetch: Publish File.
A file can only be published once. If you try to publish an already-published file you will see a warning. Use Update File to edit its metadata instead.
Publishing a Whole Folder¶
If you have a folder full of scripts or configs you want to publish at once, use the Bulk Publish panel.
- Right-click a folder in the VS Code Explorer.
- Select CodeFetch: Publish Folder.
- A panel opens listing every file in the folder. Files already published show a
✓with their current description and tags pre-filled. - Fill in a description (and optionally tags) for each file you want to publish.
- The footer shows a live count of how many files will be published or updated.
- Click Save All when ready.
A progress notification tracks the upload. When complete, the footer shows a summary of what was published and updated. Any file left without a description is skipped.
Updating a File¶
Once a file is published, any time you save it in VS Code the extension checks whether the content has changed. If it has, the update is pushed to your CodeFetch server automatically — nothing extra is needed.
If the content hasn't changed since the last publish, no upload is triggered.
This is controlled by the codefetch.autoUpdateOnChange setting (default: on) — see Extension Settings to turn it off if you'd rather push updates manually.
Updating Description and Tags¶
- Open the Command Palette and run CodeFetch: Update File.
- The current description and tags are pre-filled — edit them as needed.
- Press Enter (or click OK) on each prompt to save.
You can also do this from the View Library panel — see Browsing Your Published Files.
Unpublishing a File¶
Unpublishing removes the file from your CodeFetch server. It does not delete the file from your project.
From the Explorer:
- Right-click the file.
- Select CodeFetch: Unpublish File.
- Confirm when prompted.
From the Bulk Publish panel:
Each published row has an Unpublish button. Click it to remove that file from the server. The row resets to unpublished state immediately.
Deleting a file from your project also removes it from CodeFetch automatically after a short delay. If you delete a file by mistake and restore it quickly (within ~2 seconds), it will not be unpublished.
Browsing Your Published Files¶
The library gives you a single view of every file you have published across your entire workspace.
- Open the Command Palette and run CodeFetch: View Library.
- A list appears showing each published file with its description and tags.
- Select a file to choose an action:
- Open File — opens it in the editor
- Update File — edit its metadata
- Remove from CodeFetch — unpublish it
- Copy ID — copies the file's unique ID to your clipboard
Favoriting and Running Files¶
If you regularly re-run a handful of scripts, favoriting them puts them one click away in their own sidebar list — instead of hunting through the Explorer or the full library each time.
Adding a favorite:
- Right-click an already-published file in the Explorer.
- Select CodeFetch: Toggle Favorite.
- The file's badge in the Explorer changes from
✓to✓★, and it appears in the CodeFetch view in the Activity Bar, under Favorites.
Running a favorite:
- Open the CodeFetch view from the Activity Bar.
- Click a file in the Favorites list (or its ▶ button).
This runs codefetch get <ID> in an integrated terminal, fetching and executing the file's published copy via the CodeFetch CLI — the same thing a teammate running it from the CLI would get. It does not simply run the file you have open locally, so make sure any local edits have been published first if you want them reflected.
Running a favorite requires the CodeFetch CLI to be installed and configured on your machine, separately from the VS Code extension's own settings.
Removing a favorite:
Right-click the file again — in either the Explorer or the Favorites list — and select CodeFetch: Toggle Favorite to remove it. This only removes it from your Favorites list; it does not unpublish the file.
Moving or Renaming a Published File¶
You can freely rename or move published files within your workspace. The extension detects the move automatically and updates the server record — the file keeps its original ID and history.
Simply rename or move the file as you normally would in VS Code or your file system. No manual steps are required.
Working with Teams¶
The extension stores a small metadata file alongside each published file inside a .codefetch/ids/ folder in your repo. These files are safe to commit to source control and contain no sensitive information.
To share published file badges with your team:
- Commit the
.codefetch/folder to your repository. - When a teammate clones or pulls the repo,
✓badges appear on published files in their Explorer automatically — no re-publishing needed.
Each repository manages its own published files independently, so projects do not interfere with each other.
Extension Settings¶
Two VS Code settings (Ctrl+, / Cmd+,, search "codefetch") control automatic behavior, independent of the connection settings above:
| Setting | Default | What it does |
|---|---|---|
codefetch.autoUpdateOnChange |
true |
Automatically push an update when you save a published file whose content has changed |
codefetch.autoPublishNewFiles |
false |
Automatically publish new files added to a watched folder, without prompting for a description |
Turn autoUpdateOnChange off if you'd rather review changes and push them manually via CodeFetch: Update File. Turn autoPublishNewFiles on if you're bulk-adding files to a folder you're already publishing from and don't want a prompt for each one — new files still need tags/description added afterward via Update File if you skip the prompt.
Changing Your Settings¶
To update your API endpoint, secret key, or author name at any time:
- Open the Command Palette and run CodeFetch: Configure Settings.
- Edit the fields you want to change.
- Leave the Secret Key field blank to keep your existing secret unchanged.
- Enter a new value to replace it.
- Click Save Settings.
To remove all saved credentials, click Clear Credentials at the bottom of the panel.
Quick Reference¶
| Task | How |
|---|---|
| First-time setup | Command Palette → CodeFetch: Configure Settings |
| Publish a file | Right-click file → CodeFetch: Publish File |
| Publish a folder | Right-click folder → CodeFetch: Publish Folder |
| Update a file | Just save it — updates happen automatically |
| Edit description/tags | Command Palette → CodeFetch: Update File |
| Unpublish a file | Right-click file → CodeFetch: Unpublish File |
| Browse all published files | Command Palette → CodeFetch: View Library |
| Add/remove a favorite | Right-click file → CodeFetch: Toggle Favorite |
| Run a favorite | CodeFetch view (Activity Bar) → click file, or its ▶ button |
| Change settings | Command Palette → CodeFetch: Configure Settings |