ContextShare - Complete Setup Guide
September 8, 2025 ยท View on GitHub
This guide will walk you through everything you need to know to set up and use the ContextShare extension effectively.
Table of Contents
- Installation & First Run
- Understanding the Interface
- Configuration Options
- Setting Up Your First Catalog
- Working with Hats (Presets)
- Team Collaboration Workflow
- Advanced Configuration
- Troubleshooting
Installation & First Run
Prerequisites
- VS Code version 1.90.0 or higher
- Basic understanding of Git (for team collaboration)
Installing the Extension
Option 1: From VSIX File (Local Development)
# Install the latest version
code --install-extension ./contextshare-0.1.32.vsix --force
Option 2: VS Code Marketplace (Future)
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X) - Search for "ContextShare"
- Click Install
First Launch
- Restart VS Code after installation
- Look for the ๐ icon in the Activity Bar (left sidebar)
- Click the icon to open the ContextShare view
Understanding the Interface
Activity Bar Icon ๐
- Located in the left sidebar
- Shows status: "ContextShare ๐ X/Y" (X active resources out of Y total)
- Click to open the main catalog tree view
Tree View
The main interface showing your catalog structure:
Resource States
- โ Active: Resource is copied to runtime directory and ready to use
- โ Modified: Active resource has been changed and differs from catalog version
- ๐ Available: Resource exists in catalog but isn't activated
- ๐ Missing: Referenced in Hat but not found in catalog
Context Menu (Right-click)
- Activate: Copy resource to runtime directory
- Deactivate: Remove resource from runtime directory
- Diff with Active: Compare catalog version with active version
- Edit: Open resource file for editing
- Show Active: Reveal active file in explorer
Title Bar Commands
Hats Menu ๐ฉ
- Apply Hat (Preset): Activate a saved preset
- Save Hat from Active (Workspace): Save current active resources as a workspace preset
- Save Hat from Active (User): Save current active resources as a user preset
- Delete Hat: Remove a saved preset
Dev Menu ๐ง
- Create Template Catalog: Generate sample catalog structure
- Refresh: Reload catalog and check for changes
- Diagnostics: Show detailed status and troubleshooting info
Configuration Options
Access settings via: File โ Preferences โ Settings โ Search "ContextShare"
Basic Settings
| Setting | Default | Description |
|---|---|---|
| Catalog Directory | {} | Maps catalog paths to display names. Can be local paths, workspace-relative paths, or HTTPS URLs |
| Runtime Directory | .github | Where active resources are copied (relative to target workspace) |
| Target Workspace | (current) | Workspace where resources should be activated |
Advanced Settings
| Setting | Default | Description |
|---|---|---|
| Remote Cache TTL Seconds | 300 | How long to cache remote catalog fetches (0 = no cache) |
| Enable File Logging | false | Write extension logs to user global storage |
Setting Up Your First Catalog
Method 1: Create Template Catalog (Recommended for New Users)
- Open any workspace in VS Code
- Open ContextShare view (๐ icon)
- Click Dev โ Create Template Catalog in title bar
- Explore the created structure:
copilot_catalog/ โโโ chatmodes/ # AI assistant modes โโโ instructions/ # Coding guidelines and rules โโโ prompts/ # Reusable prompt templates โโโ tasks/ # VS Code task definitions โโโ mcp/ # Model Context Protocol configs โโโ hats/ # Preset collections
Method 2: Manual Catalog Creation
-
Create the folder structure:
mkdir copilot_catalog cd copilot_catalog mkdir chatmodes instructions prompts tasks mcp hats -
Add your first resource (example instruction):
File: copilot_catalog/instructions/coding-standards.instructions.md
applyTo: '/*.js,/*.ts'
JavaScript/TypeScript Coding Standards
- Use TypeScript strict mode
- Prefer const over let, avoid var
- Use meaningful variable names
- Add JSDoc comments for public functions
3. **Refresh the Catalog view**
4. **Right-click your resource โ Activate**
### Method 3: Point to Existing Catalog
If you already have a catalog elsewhere:
1. **Open Settings** โ Search "ContextShare"
2. **Set Catalog Directory**:
- Key: Path to your catalog (absolute or relative to workspace)
- Value: Display name (optional)
3. **Refresh the Catalog view**
Example configuration:
```json
{
"copilotCatalog.catalogDirectory": {
"/path/to/my/shared-catalog": "Team Standards",
"./my-project-catalog": "Project Specific",
"https://raw.githubusercontent.com/org/repo/main/catalog": "Company Catalog"
}
}
Working with Hats (Presets)
Hats let you save and apply collections of resources with one click.
Creating Your First Hat
- Activate some resources (right-click โ Activate)
- Save as Hat: Click Hats โ Save Hat from Active (Workspace)
- Name it: e.g., "Code Review Setup"
- Add description (optional): "Resources for thorough code reviews"
Hat File Structure
Workspace hats are saved to .vscode/copilot-hats.json:
{
"hats": [
{
"name": "Code Review Setup",
"description": "Resources for thorough code reviews",
"resources": [
"instructions/code-review-checklist.instructions.md",
"prompts/security-review.prompt.md",
"chatmodes/reviewer.chatmode.md"
]
}
]
}
Applying Hats
- Click Hats โ Apply Hat (Preset)
- Choose your hat from the list
- Select mode:
- Additive: Add hat resources to currently active ones
- Exclusive: Deactivate everything else, activate only hat resources
Hat Types
Workspace Hats (.vscode/copilot-hats.json)
- Shared with your team via Git
- Perfect for role-based setups ("Frontend Dev", "Backend Dev", "QA")
- Project-specific configurations
User Hats (Global)
- Personal to your machine
- Cross-project personal preferences
- Not shared with team
Catalog Hats (copilot_catalog/hats/*.json)
- Stored in the catalog itself
- Can be shared across multiple repositories
- Version-controlled with the catalog
Team Collaboration Workflow
Setting Up Team Collaboration
- Repository Owner:
# Create and populate catalog mkdir copilot_catalog # Add your team's standard resources git add copilot_catalog/
git commit -m "Add team catalog"
Create team hats in VS Code and commit
git add .vscode/copilot-hats.json git commit -m "Add team presets" git push
2. **Team Members**:
```bash
git pull # Get latest catalog and hats
# Open VS Code, go to ContextShare view
# Click Hats โ Apply Hat โ Choose team preset
Best Practices for Teams
1. Catalog Organization
copilot_catalog/
โโโ instructions/
โ โโโ general/ # Company-wide standards
โ โโโ frontend/ # Frontend-specific guidelines
โ โโโ backend/ # Backend-specific guidelines
โโโ chatmodes/
โ โโโ roles/ # Role-based chat modes
โ โโโ tasks/ # Task-specific modes
โโโ hats/
โโโ frontend-dev.json # Frontend developer preset
โโโ backend-dev.json # Backend developer preset
โโโ code-review.json # Code reviewer preset
2. Hat Strategy
- Role-based hats: "Frontend Dev", "Backend Dev", "DevOps", "QA"
- Task-based hats: "Code Review", "Bug Fixing", "Feature Development"
- Project-phase hats: "Initial Development", "Maintenance", "Refactoring"
3. Naming Conventions
- Use consistent prefixes:
TEAM.,PROJECT.,ROLE. - Include version info for evolving standards:
coding-standards-v2.instructions.md - Use descriptive names:
react-component-best-practices.instructions.md
Review Process for Catalog Changes
- Create PR for catalog changes:
git checkout -b improve-coding-standards
Edit copilot_catalog/instructions/coding-standards.instructions.md
git add copilot_catalog/ git commit -m "Update coding standards for async/await usage" git push origin improve-coding-standards
2. **Team reviews catalog changes** just like code
3. **Merge and notify team** to refresh their catalogs
## Advanced Configuration
### Multiple Catalog Sources
You can configure multiple catalogs with display names:
```json
{
"copilotCatalog.catalogDirectory": {
"./copilot_catalog": "Project Catalog",
"/shared/team-catalog": "Team Standards",
"https://company.com/copilot-catalog": "Company-wide",
"../shared-resources/catalog": "Shared Resources"
}
}
Cross-Workspace Activation
Activate resources into a different workspace than where your catalog is:
{
"copilotCatalog.targetWorkspace": "/path/to/target/workspace"
}
Use case: Centralized catalog repository that activates resources into various project repositories.
Remote Catalogs
Load catalogs from HTTPS URLs:
{
"copilotCatalog.catalogDirectory": {
"https://raw.githubusercontent.com/company/ai-catalog/main": "Company Catalog"
},
"copilotCatalog.remoteCacheTtlSeconds": 600
}
Security Notes:
- Only HTTPS URLs are allowed
- Responses are size-limited and timeout-protected
- Cache reduces network requests
Custom Runtime Directory
Change where active resources are placed:
{
"copilotCatalog.runtimeDirectory": ".copilot"
}
Popular choices:
.github(default) - Works well with GitHub repositories.vscode- Keeps everything VS Code-related together.copilot- Clearly branded for AI resources
Troubleshooting
CI fails: Version mismatch (package.json vs VSIX manifest)
Cause: vsix/extension.vsixmanifest Version didnโt get updated.
Fix:
- Run one of the build scripts with --bump or --version, which auto-syncs the manifest:
pwsh ./build_vsix.ps1 --bump patchorbash ./build_vsix.sh --bump patch
- Or, run the guard:
npm run verify:versionto see the mismatch locally.
Tip: Do not hand-edit the manifest; scripts keep it correct based on package.json.
Common Issues
"No catalog found" Message
Problem: Catalog view shows "No catalog directory found"
Solutions:
- Check catalog exists: Ensure
copilot_catalog/folder exists in workspace - Configure path: Go to Settings โ ContextShare โ Catalog Directory
- Refresh view: Click refresh button in catalog view
- Check workspace: Ensure you have a workspace open (not just loose files)
Resources Not Activating
Problem: Right-click โ Activate doesn't work
Solutions:
- Check target workspace: Verify
copilotCatalog.targetWorkspacesetting - Check permissions: Ensure VS Code can write to runtime directory
- Check file conflicts: Look for existing files that might block activation
- View diagnostics: Use Dev โ Diagnostics for detailed error info
Hat Application Fails
Problem: Applying a hat doesn't activate expected resources
Solutions:
- Check resource paths: Ensure hat references valid catalog paths
- Refresh catalog: Resource might have been moved or renamed
- Check exclusive mode: In exclusive mode, other resources are deactivated
- Verify catalog source: Hat might reference resources from different catalog
Performance Issues
Problem: Catalog view is slow to load or refresh
Solutions:
- Check remote catalogs: HTTPS catalogs can be slow; adjust cache TTL
- Reduce catalog size: Large catalogs take time to process
- Check file system: Network drives can be slow
- Disable file logging: Turn off
enableFileLoggingif enabled
Diagnostic Information
Get detailed info: Dev โ Diagnostics command shows:
- Catalog discovery results
- Active resource status
- Configuration summary
- Recent errors
- Performance metrics
Check logs:
- Output panel โ "ContextShare" channel
- If file logging enabled: User global storage location shown in diagnostics
Getting Help
- Check Output Panel: View โ Output โ "ContextShare"
- Run Diagnostics: Dev โ Diagnostics in catalog view
- Review Settings: Ensure all paths are absolute and accessible
- Test Minimal Setup: Try with a simple catalog to isolate issues
Performance Optimization
For Large Catalogs
- Use specific catalog directory mappings instead of auto-discovery
- Increase remote cache TTL for stable remote catalogs
- Consider splitting very large catalogs into focused subcatalogs
For Remote Catalogs
- Set appropriate cache TTL (600+ seconds for stable catalogs)
- Use CDN-backed URLs when possible
- Monitor Output panel for fetch timing information
Next Steps
๐ฏ Try it out: Create a simple catalog and experiment with activating resources
๐ฉ Make your first Hat: Save a useful combination as a preset
๐ฅ Share with team: Commit your catalog and hats to Git
โก Iterate: Refine your setup based on what works for your workflow
Happy cataloging! ๐