Script Resolution
Understanding how Miso resolves commands is important for organizing your scripts and avoiding conflicts. This page explains the resolution order and priority.
Resolution Order
When you run a command with Miso, it resolves the command in the following order:
- Built-in commands - Core Miso functionality
- Scripts folder - Custom scripts in your configured scripts directory
- Package.json scripts - Scripts defined in package.json
- Passthrough - Forwarded to the package manager
Let’s examine each step in detail.
1. Built-in Commands
Miso checks for built-in commands first. These include:
install- Install dependenciesadd- Add new dependenciesremove- Remove dependenciesrun- Run package.json scripts explicitlydev- Start development serverinit- Initialize a new projectversion- Display Miso versionmisox- Generate shell completionsupdate- Update Miso itselfscripts- List all available scripts
If your command matches a built-in command, it executes immediately - unless you’ve created an override (see Script Overrides).
2. Scripts Folder
If no built-in command matches, Miso searches the configured scripts folder:
scripts/
build.sh → miso build
test.py → miso test
deploy/
staging.sh → miso deploy/stagingThe scripts folder is searched recursively, and the first matching script is executed.
Matching Rules
- Script name (without extension) matches the command
- Subdirectory paths are preserved (
deploy/staging) - Index files serve as directory defaults
3. Package.json Scripts
If no script is found in the scripts folder, Miso looks for a matching entry in package.json:
{
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint ."
}
}If a match is found, it’s executed via your configured package manager:
miso dev
# Executes: pnpm run dev (or npm run dev, yarn dev, bun dev)4. Passthrough
If the command isn’t found in any of the previous steps, Miso forwards it to your package manager with a notification:
miso outdated
# → forwarding "outdated" to pnpm
# Executes: pnpm outdatedThis allows you to use Miso as a unified interface for all package manager commands without needing to remember which package manager you’re using.
Command Conflicts
When the same command name exists in multiple locations, the resolution order determines which one executes:
Example 1: Script Overrides Built-in
scripts/install.sh existsmiso install
# Executes: scripts/install.sh (not the built-in install command)Example 2: Scripts Folder Takes Precedence
scripts/dev.sh exists
package.json has "dev": "vite"miso dev
# Executes: scripts/dev.sh (not package.json script)Example 3: Explicit Execution
To force execution of a package.json script when a scripts folder script exists:
miso run dev
# Executes: package.json "dev" script via package managerBest Practices
1. Avoid Unintentional Overrides
Be aware when naming scripts that match built-in commands. Only override built-in commands when you specifically want to customize behavior.
2. Use Descriptive Names
Use specific, descriptive names to avoid conflicts:
- ✅
scripts/build/frontend.sh - ✅
scripts/deploy/staging.sh - ❌
scripts/i.sh(too vague)
3. Organize by Purpose
Group related scripts in subdirectories:
scripts/
build/
index.sh
miso.sh
docs.sh
test/
unit.sh
integration.sh4. Document Overrides
If you override built-in commands, document why in comments:
#!/bin/sh
# Custom install that runs additional setup
# Overrides: miso install
pnpm install
./scripts/setup.shListing All Commands
Use the miso scripts command to see all available commands and their sources:
miso scriptsThis shows scripts from both the scripts folder and package.json, helping you understand what’s available and identify any conflicts.