---
description: Analyze project and create optimal container configuration automatically
argument-hint: [directory]
---

# Quick Project Container Setup

Automatically analyze a project and create an optimal container configuration.

## Usage

```
/msetup [directory]
```

If no directory specified, uses current working directory.

---

## Instructions

When invoked, automatically analyze the project and create a containerized development environment.

### Step 1: Analyze Project

Scan the directory for project indicators:

```bash
ls -la
```

Look for:
| File | Project Type | Profile | Default Port |
|------|-------------|---------|--------------|
| `package.json` | Node.js | dev-node | 3000 |
| `pyproject.toml` | Python (modern) | dev-python | 8000 |
| `requirements.txt` | Python | dev-python | 8000 |
| `Cargo.toml` | Rust | dev-rust | 8080 |
| `go.mod` | Go | base | 8080 |
| `Gemfile` | Ruby | base | 3000 |
| `pom.xml` | Java/Maven | base | 8080 |
| `.devcontainer/` | Devcontainer | (import) | - |

### Step 2: Detect Additional Requirements

Check for:
- **Database needs**: Look for database connection strings, ORM configs
- **GPU needs**: Look for tensorflow, pytorch, cuda imports
- **GUI needs**: Look for Qt, GTK, Electron dependencies
- **Secrets**: Look for `.env.example`, config templates

### Step 3: Generate Configuration

Create a spec file based on analysis:

```yaml
# Auto-generated by /msetup
name: <project-directory-name>
runtime: docker
profiles:
  - base
  - <detected-profile>

volumes:
  - .:/workspace

working_dir: /workspace

network:
  ports:
    - <detected-port>:<detected-port>
```

### Step 4: Handle Special Cases

**If .devcontainer exists:**
```bash
gaol devcontainer import -o container.yaml
```

**If .env.example exists:**
- Prompt user to create secrets for sensitive values
- Use `${secret:NAME}` syntax in spec

### Step 5: Create and Start Container

```bash
gaol spec validate container.yaml
gaol apply container.yaml --start
gaol status <name>
```

### Step 6: Post-Setup Instructions

Provide user with:
1. How to enter the container: `gaol shell <name>`
2. How to run their app: `gaol exec <name> -- <start-command>`
3. How to view logs: `gaol logs <name> --follow`
4. The generated spec file location for customization

### Interactive Mode:

If project type is unclear, ask the user:
1. What type of project is this?
2. What ports do you need exposed?
3. Do you need GPU support?
