Auto Run Command VSCode Extension
Automate your VSCode workflow. Configure rules to execute any command or shell snippet automatically when a specific condition is met on project open or initialization.
VSCode Marketplace
|
GitHub
🚀 Quick Start
This extension allows you to define automation rules directly in your VSCode settings. Each rule includes:
condition: When to trigger (e.g., on project folder name or file existence)
command: Which VSCode command—or shell command—to run
message: (optional) Shown if the rule matched
Both command and condition may be a string or an array.
When arrays are provided, all conditions must be true for the commands to execute. All commands listed will run if the rule triggers.
⏱️ Commands are triggered after a short startup delay for safety.
💡 Example Settings
Run Wallaby.js automatically on projects with a config:
"auto-run-command.rules": [
{
"condition": "hasFile: wallaby.js",
"command": "wallaby.start",
"message": "Wallaby started automatically."
}
]
Trigger a VSCode command only for a specific file & workspace:
"auto-run-command.rules": [
{
"condition": [
"hasFile: special-file",
"isRootFolder: my-coolz-prodgekt"
],
"command": "crazy-ext.do-magic",
"message": "Magic command executed."
}
]
Shell Command Example:
"auto-run-command.rules": [
{
"condition": [
"hasFile: special-file",
"isRootFolder: my-coolz-prodgekt"
],
"command": "export COOL_ENV_VARIABLE=cool",
"message": "Shell variable set.",
"shellCommand": true
}
]
🛠️ Supported Conditions
| Condition |
Description |
Argument |
Example |
always |
Always triggers |
none |
always |
hasFile |
True if a file (or glob) exists in project folder |
filename / glob pattern |
hasFile: wallaby.js |
isLanguage |
Checks if first opened file uses a given language |
language id |
isLanguage: typescript |
isRootFolder |
Workspace root folder name matches |
folder name |
isRootFolder: my-project |
isRunningInContainer |
True if VSCode runs in a container (e.g., devcontainer) |
none |
isRunningInContainer |
📚 Release Notes
See the Changelog for version history and improvements.
🤝 Contributing
- Clone, explore, and debug with VSCode.
- To add new rules, check out
src/lib/condition-parser.ts and src/lib/condition-checker.ts.
- Please include tests for new logic.
- PRs are warmly welcomed!
Happy automating! 🎉