0
# Repository Setup
1
2
Comprehensive repository initialization and configuration capabilities for setting up moon workspace management.
3
4
## Capabilities
5
6
### Initialize Workspace
7
8
Set up moon in a repository with workspace configuration and toolchain setup.
9
10
```bash { .api }
11
/**
12
* Initialize moon workspace in current or specified directory
13
* Creates .moon directory with configuration files
14
*/
15
moon init [tool]
16
17
# Arguments:
18
# [tool] Optional specific tool to initialize (bun, node, rust, typescript)
19
20
# Options:
21
--force Overwrite existing config files if they exist
22
--minimal Generate minimal configurations with sane defaults
23
--to <path> Destination directory to initialize (default: current directory)
24
--yes Skip all prompts and enable tools based on file detection
25
```
26
27
**Usage Examples:**
28
29
```bash
30
# Initialize moon in current directory
31
moon init
32
33
# Initialize with minimal configuration
34
moon init --minimal
35
36
# Initialize in specific directory
37
moon init --to ./my-workspace
38
39
# Auto-detect and configure without prompts
40
moon init --yes
41
42
# Initialize specific tool after initial setup
43
moon init node
44
moon init typescript
45
```
46
47
### Tool-Specific Initialization
48
49
Configure individual tools within an existing moon workspace.
50
51
```bash { .api }
52
/**
53
* Initialize and configure a specific tool in the toolchain
54
* Modifies .moon/toolchain.yml configuration
55
*/
56
moon init <tool>
57
58
# Available tools:
59
# bun Bun JavaScript runtime and package manager
60
# node Node.js runtime and npm package manager
61
# rust Rust compiler and Cargo package manager
62
# typescript TypeScript compiler and type checking
63
```
64
65
**Usage Examples:**
66
67
```bash
68
# Add Node.js to existing workspace
69
moon init node
70
71
# Configure TypeScript in workspace
72
moon init typescript
73
74
# Set up Rust toolchain
75
moon init rust
76
77
# Add Bun runtime support
78
moon init bun
79
```
80
81
### Configuration Files Created
82
83
The init command creates several configuration files:
84
85
```bash { .api }
86
# Directory structure created:
87
.moon/
88
├── workspace.yml # Workspace-level configuration
89
├── toolchain.yml # Tool versions and settings
90
└── tasks.yml # Global task definitions (optional)
91
```
92
93
**workspace.yml structure:**
94
```yaml
95
# Project discovery and workspace settings
96
projects:
97
- 'apps/*'
98
- 'packages/*'
99
100
# Workspace-level configuration
101
versionConstraint: '>=1.0.0'
102
```
103
104
**toolchain.yml structure:**
105
```yaml
106
# Tool configurations
107
node:
108
version: '18.17.0'
109
packageManager: 'npm'
110
111
typescript:
112
version: '5.0.0'
113
```
114
115
### Setup Command
116
117
Prepare the toolchain by installing configured tools.
118
119
```bash { .api }
120
/**
121
* Setup toolchain by installing all configured tools
122
* Downloads and installs tools defined in toolchain.yml
123
*/
124
moon setup
125
126
# Options:
127
--force Force reinstall tools even if already present
128
```
129
130
**Usage Examples:**
131
132
```bash
133
# Install all configured tools
134
moon setup
135
136
# Force reinstall all tools
137
moon setup --force
138
```
139
140
### Teardown Command
141
142
Clean up installed toolchain tools.
143
144
```bash { .api }
145
/**
146
* Teardown toolchain by uninstalling tools
147
* Removes tools installed by moon setup
148
*/
149
moon teardown
150
```
151
152
### Upgrade Command
153
154
Update moon to the latest version.
155
156
```bash { .api }
157
/**
158
* Upgrade moon binary to latest available version
159
* Downloads and replaces current installation
160
*/
161
moon upgrade
162
```
163
164
## Error Handling
165
166
Common initialization errors and solutions:
167
168
- **Permission Errors**: Ensure write permissions to target directory
169
- **Existing Configuration**: Use `--force` to overwrite existing files
170
- **Tool Detection Failures**: Manually specify tools or use `--minimal` flag
171
- **Network Issues**: Setup command requires internet access for tool downloads