0
# Toolchain Management
1
2
Commands for managing development tools, runtime environments, and toolchain plugins within the moon workspace.
3
4
## Capabilities
5
6
### Get Tool Binary Path
7
8
Return the absolute path to a tool's binary within the moon toolchain.
9
10
```bash { .api }
11
moon bin <tool>
12
```
13
14
**Arguments:**
15
- `tool` (required) - The name of the tool to query (e.g., "node", "npm", "pnpm", "yarn")
16
17
**Usage Examples:**
18
19
```bash
20
# Get path to Node.js binary
21
moon bin node
22
# Output: /home/user/.moon/tools/node/18.17.0/bin/node
23
24
# Get path to npm binary
25
moon bin npm
26
27
# Use in scripts
28
NODE_PATH=$(moon bin node)
29
$NODE_PATH --version
30
```
31
32
### Node.js Commands
33
34
Special commands for working with Node.js within the moon environment.
35
36
```bash { .api }
37
moon node <subcommand>
38
```
39
40
**Subcommands:**
41
42
#### Run Package.json Script
43
44
Execute a `package.json` script within a project using the moon-managed Node.js installation.
45
46
```bash { .api }
47
moon node run-script <script> [--project <ID>]
48
```
49
50
**Arguments:**
51
- `script` (required) - Name of the script to run from package.json
52
53
**Options:**
54
- `--project <ID>` - Project ID to run the script in (defaults to current directory project)
55
56
**Usage Examples:**
57
58
```bash
59
# Run a script in the current project
60
moon node run-script build
61
62
# Run a script in a specific project
63
moon node run-script test --project my-app
64
65
# Run development server
66
moon node run-script dev
67
```
68
69
### Toolchain Plugin Management
70
71
Manage toolchain plugins that provide language and tool support.
72
73
```bash { .api }
74
moon toolchain <subcommand>
75
```
76
77
**Subcommands:**
78
79
#### Add Toolchain Plugin
80
81
Add and configure a new toolchain plugin in the workspace.
82
83
```bash { .api }
84
moon toolchain add <plugin> [--to <PATH>]
85
```
86
87
**Arguments:**
88
- `plugin` (required) - Plugin identifier or URL
89
90
**Options:**
91
- `--to <PATH>` - Configuration file path (defaults to .moon/toolchain.yml)
92
93
**Usage Examples:**
94
95
```bash
96
# Add Node.js toolchain plugin
97
moon toolchain add node
98
99
# Add a custom plugin from URL
100
moon toolchain add https://github.com/example/moon-plugin
101
102
# Add plugin to specific config file
103
moon toolchain add rust --to ./rust-toolchain.yml
104
```
105
106
#### Show Toolchain Plugin Information
107
108
Display detailed information about a configured toolchain plugin.
109
110
```bash { .api }
111
moon toolchain info <plugin> [--json]
112
```
113
114
**Arguments:**
115
- `plugin` (required) - Name of the plugin to query
116
117
**Options:**
118
- `--json` - Output information in JSON format
119
120
**Usage Examples:**
121
122
```bash
123
# Show info about Node.js plugin
124
moon toolchain info node
125
126
# Get plugin info as JSON
127
moon toolchain info node --json
128
```
129
130
## Toolchain Configuration
131
132
Toolchain behavior is configured in `.moon/toolchain.yml`:
133
134
```yaml
135
# Example toolchain configuration
136
node:
137
version: "18.17.0"
138
packageManager: "npm"
139
syncProjectWorkspaceDependencies: true
140
141
python:
142
version: "3.11.0"
143
syncProjectWorkspaceDependencies: false
144
```
145
146
## Supported Tools
147
148
Moon supports automatic installation and management of:
149
150
- **Node.js** - JavaScript runtime and package managers (npm, pnpm, yarn)
151
- **Python** - Python interpreter and package managers (pip, poetry)
152
- **Rust** - Rust compiler and Cargo package manager
153
- **Go** - Go compiler and module system
154
- **Java** - JDK and build tools (Maven, Gradle)
155
- **Custom Tools** - Via plugin system
156
157
## Tool Version Management
158
159
Moon ensures consistent tool versions across all environments:
160
161
```bash
162
# Check installed tool versions
163
moon toolchain info node
164
165
# Update tool version in configuration
166
# Edit .moon/toolchain.yml, then run:
167
moon setup
168
```
169
170
## Plugin Development
171
172
Custom toolchain plugins can be developed to support additional languages and tools. Plugins define:
173
174
- Tool installation and management
175
- Language-specific task detection
176
- Dependency resolution
177
- Build and test commands