TriggerMate - Automates tasks based on file updates
TriggerMate is a VSCode extension that watches for file changes and automatically executes predefined commands. This helps streamline workflows by ensuring necessary scripts run whenever critical files are updated.
🚀 Features
- 🔍 Smart File Watching: Automatically detect changes in your files and act instantly.
- ⚡ Custom Command Execution: Run your favorite scripts or commands seamlessly.
- 🛠️ Task Integration: Execute VSCode tasks directly as part of your automation workflow.
- 🎛️ Event Control: Fine-tune which events to monitor—creation, modification, or deletion.
- 📊 Detailed Logs: Stay informed with real-time logs of active watchers and triggered events.
- ⏱️ Debounce Protection: Avoid chaos with configurable delays to prevent rapid command execution.
TriggerMate makes your development workflow smarter, faster, and more efficient. 🚀
🎯 Use Cases
- Automatically run build scripts when source files change.
- Trigger deployment processes when configuration files are updated.
- Execute tests when test files are modified.
- Run linting or formatting commands when code files are saved.
- Perform database migrations when migration files are added or changed.
⚙️ Configuration Options
TriggerMate provides flexible configuration options to control its behavior. Below are the supported properties:
triggerMate.fileTriggers
Defines the list of files to watch and commands to run.
Properties:
file
(string, required) – The path to the file relative to the workspace. Supports glob patterns.
command
(string, optional) – The command to execute when the file changes.
autoExecute
(boolean, optional, default: false) – If true
, the command runs automatically without prompting the user.
commandType
(string, optional, default: "terminal") – Specifies whether to execute the command in a terminal or as a VSCode task. Options: "terminal"
, "task"
.
ignoreCreateEvents
(boolean, optional, default: true) – If true
, ignores file creation events.
ignoreChangeEvents
(boolean, optional, default: false) – If true
, ignores file change events.
ignoreDeleteEvents
(boolean, optional, default: true) – If true
, ignores file deletion events.
commandDebounce
(number, optional, default: 0) – The number of milliseconds to wait before executing the next command for the same file.
Examples:
1️⃣ Basic File Notification (No Command Execution)
{
"triggerMate.fileTriggers": [{ "file": "README.md" }]
}
📌 Triggers a notification when README.md
changes.

2️⃣ Prompted Command Execution
{
"triggerMate.fileTriggers": [
{
"file": "package.json",
"command": "npm install"
}
]
}
📌 Notifies the user and asks if they want to run npm install
when package.json
updates.

3️⃣ Automatic Command Execution
{
"triggerMate.fileTriggers": [
{
"file": "pyproject.toml",
"command": "poetry install",
"autoExecute": true
}
]
}
📌 Runs poetry install
automatically when pyproject.toml
changes.

4️⃣ Glob Pattern Matching
{
"triggerMate.fileTriggers": [
{
"file": "**/migrations/*.py",
"command": "poetry run python manage.py migrate"
}
]
}
📌 Runs poetry run python manage.py migrate
when any Python file in the migrations
directory changes.
5️⃣ Advanced Configuration with Debounce and Event Filtering
{
"triggerMate.fileTriggers": [
{
"file": "**/*.js",
"command": "eslint",
"commandType": "task",
"ignoreCreateEvents": true,
"ignoreChangeEvents": false,
"ignoreDeleteEvents": true,
"commandDebounce": 500
}
]
}
📌 Runs eslint
as a VSCode task when any JavaScript file changes, with a 500ms debounce to prevent rapid executions.
🛠️ How It Works
- The extension detects changes in the specified files.
- A notification prompts you to execute the associated command.
- On confirmation, the command runs in a new terminal instance or as a VSCode task.
💡 Contributing
Want to improve TriggerMate? Feel free to open an issue or submit a pull request!
📜 License
MIT License. Free to use and modify.
TriggerMate – Your automation companion in VSCode! 🚀
Made with ❤️ by Wust