-
Build the extension:
npm run compile
-
Package the extension (optional):
npm install -g vsce vsce package
-
Install in VSCode via the Extensions panel or by opening the
.vsixfile
Tasks are defined in .vscode/tasks.json. Example:
{
"version": "1.0.0",
"tasks": [
{
"id": "hello-world",
"name": "Hello World",
"description": "Simple hello world command",
"command": "echo",
"args": ["Hello from CmdPipe!"],
"category": "utility",
"timeout": 5000,
"tags": ["demo", "test"]
}
]
}// ...existing code...
name: Unique task name within its sourcecommand: Shell command to executedescription: Human-readable description (optional)group: Task group (build, test, etc.) (optional)args: Command arguments (optional)options: Task execution options (see below)
CmdPipe resolves VS Code style placeholders before a task runs so commands, arguments, working directories, and environment variables stay portable.
- Workspace placeholders: use
${workspaceFolder},${workspaceFolder:<name>},${workspaceFolderBasename},${relativeFile},${file},${fileDirname},${fileBasename},${fileBasenameNoExtension},${fileExtname}to scope tasks to the current folder or active file. - Environment placeholders:
${env:VAR_NAME}mergesprocess.env, workspace defaults, and task-level overrides. Missing variables block execution with a descriptive error and the logs redact resolved values. - Configuration placeholders:
${config:cmdpipe.shell.defaultWorkingDirectory}(and other settings) honor VS Code scope precedence. Non-string values surface validation failures.
Example task snippet:
{
"id": "build-with-context",
"command": "${workspaceFolder}/scripts/build.sh",
"args": ["--config", "${config:cmdpipe.build.profile}"],
"workingDirectory": "${workspaceFolder}",
"environmentVariables": {
"API_TOKEN": "${env:API_TOKEN}"
}
}View substitution outcomes in the CmdPipe logs (CmdPipe Config: Show Logs) for troubleshooting redacted values and failure reasons.
Configure the extension in VSCode settings (settings.json):
{
"cmdPipe.defaultShell": "powershell.exe",
"cmdPipe.timeout": 30000,
"cmdPipe.maxOutputSize": 1048576,
"cmdPipe.outputFormat": "raw",
"cmdPipe.insertionMode": "cursor",
"cmdPipe.taskSources": [".vscode/shell-tasks.json"],
"cmdPipe.includeExampleTasks": true,
"cmdPipe.showNotifications": true,
"cmdPipe.confirmDangerousCommands": true
}- Open a new file in VSCode
- Place cursor where you want output
- Run Quick Echo:
- Command Palette →
CmdPipe: Quick Echo - Should insert "Hello from CmdPipe!" at cursor
- Command Palette →
- Run Custom Command:
- Command Palette →
CmdPipe: Quick Command - Enter:
echo "Custom command works!" - Press Enter
- Command Palette →
- Open configuration:
- Command Palette →
CmdPipe: Open Configuration - Should open
.vscode/shell-tasks.json
- Command Palette →
- Run configured task:
- Command Palette →
CmdPipe: Run Shell Task - Select "Hello World" or another task
- Should execute and insert output
- Command Palette →
- Type a command in editor:
echo "Selected text execution" - Select the text
- Execute selection:
- Command Palette →
CmdPipe: Execute Selection as Command - Should execute the selected text as command
- Command Palette →
- Test:
dircommand for file listing - Test:
echo %date% %time%for date/time - Test:
systeminfofor system information
- Test:
ls -lacommand for file listing - Test:
datefor current date/time - Test:
uname -afor system information
- Invalid command:
- Run:
nonexistentcommand123 - Should show error notification
- Run:
- Timeout test:
- Run command that takes longer than timeout
- Should handle timeout gracefully
- Permission test:
- Try running restricted commands
- Should handle permissions appropriately
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Run tests
npm test
# Watch mode for development
npm run watch
# Lint code
npm run lint- Unit Tests: 63 tests covering core components
- Integration Tests: 25 tests for workflow validation
- All Tests: 88 tests total with 100% pass rate
- Shell Execution: Cross-platform shell command execution
- Text Insertion: Multiple insertion modes with cursor management
- Configuration: JSON-based task definitions with validation
- UI Components: Status bar, progress tracking, notifications
- Error Handling: Comprehensive error handling and logging
-
Commands not found:
- Check PATH environment variable
- Ensure shell is properly configured
- Try absolute paths for commands
-
Permission denied:
- Check file/directory permissions
- Run VSCode with appropriate privileges
- Verify command accessibility
-
Timeout errors:
- Increase timeout in configuration
- Check command efficiency
- Verify network connectivity for network commands
-
Output not appearing:
- Check cursor position
- Verify editor is active and writable
- Check insertion mode settings
- View logs: Command Palette →
CmdPipe: Show Logs - Enable debug logging: Set
"cmdPipe.logLevel": "debug" - Check VSCode Developer Console:
Help → Toggle Developer Tools
- Fork the repository
- Create a feature branch
- Make changes with tests
- Submit pull request
MIT License - see LICENSE file for details.