── CORE CONCEPTS ──
Stack Detection
Exo automatically detects your project's language and framework by scanning for marker files.
## How Detection Works
The internal/detector package scans the current directory for known marker files and returns a StackInfo struct.
internal/detector/detect.go
1type StackInfo struct {2 Language string // "go", "node", "python", "java", "rust", "unknown"3 Framework string // "gin", "express", "flask", "spring", etc.4 Files []string // Marker files found5}## Detection Matrix
| Marker File | Language | Framework Detection |
|---|---|---|
go.mod | Go | Checks imports for gin, echo, fiber, chi |
package.json | Node.js | Checks deps for express, react, next, fastify, koa, nest |
requirements.txt | Python | Checks for flask, django, fastapi |
Pipfile | Python | Same framework detection as requirements.txt |
setup.py | Python | Same framework detection as requirements.txt |
pyproject.toml | Python | Same framework detection as requirements.txt |
pom.xml | Java | Checks for spring-boot, quarkus, micronaut |
build.gradle | Java | Checks for spring, quarkus, micronaut |
Cargo.toml | Rust | Checks for actix-web, axum, rocket, warp |
| None found | Unknown | Falls back to wizard prompt |
## Detection Flow
┌─────────────────┐
│ Scan CWD for │
│ marker files │
└────────┬────────┘
│
┌─────▼─────┐ ┌─────────────────────┐
│ go.mod ? ├─Yes──▸│ Language: Go │
└─────┬─────┘ │ Scan go.mod imports │
│No └─────────────────────┘
┌─────▼─────────┐ ┌─────────────────────┐
│ package.json ?├─Yes─▸│ Language: Node │
└─────┬─────────┘ │ Scan dependencies │
│No └─────────────────────┘
┌─────▼───────────────┐ ┌────────────────┐
│ requirements.txt / ├─Yes─▸│ Language: │
│ Pipfile / setup.py /│ │ Python │
│ pyproject.toml │ └────────────────┘
└─────┬───────────────┘
│No
┌─────▼──────────────────┐ ┌─────────────┐
│ pom.xml / build.gradle?├─Yes─▸│ Java │
└─────┬──────────────────┘ └─────────────┘
│No
┌─────▼─────────┐ ┌──────────────────────┐
│ Cargo.toml ? ├─Yes─▸│ Language: Rust │
└─────┬─────────┘ └──────────────────────┘
│No
┌─────▼─────────┐
│ Language: │
│ "unknown" │
└───────────────┘## Go Framework Detection
When go.mod is found, Exo reads its contents and checks for known framework import paths:
go
1frameworks := map[string]string{2 "github.com/gin-gonic/gin": "gin",3 "github.com/labstack/echo": "echo",4 "github.com/gofiber/fiber": "fiber",5 "github.com/go-chi/chi": "chi",6}## Node.js Framework Detection
When package.json is found, dependencies are checked:
go
1// Detected: express, react, next, fastify, koa, nest2frameworks := []string{"express", "react", "next", "fastify", "koa", "nest"}3for _, fw := range frameworks {4 if strings.Contains(packageJSON, fw) {5 return fw6 }7}## Python Framework Detection
When any Python marker is found, the requirements file is checked:
go
1// Detected: flask, django, fastapi2frameworks := []string{"flask", "django", "fastapi"}3lower := strings.ToLower(requirementsContent)4for _, fw := range frameworks {5 if strings.Contains(lower, fw) {6 return fw7 }8}## Java Framework Detection
When pom.xml or build.gradle is found:
go
1// Detected: spring-boot (spring), quarkus, micronaut2javaFrameworks := []string{"spring-boot", "spring", "quarkus", "micronaut"}3for _, fw := range javaFrameworks {4 if strings.Contains(lower, fw) {5 return fw6 }7}## Rust Framework Detection
When Cargo.toml is found:
go
1// Detected: actix-web, axum, rocket, warp2rustFrameworks := []string{"actix-web", "axum", "rocket", "warp"}3for _, fw := range rustFrameworks {4 if strings.Contains(lower, fw) {5 return fw6 }7}## Using the Scan Command
Run exo scan to see what Exo detects:
bash
$ exo scanScanning current directory... Language: go Framework: gin Files found: go.mod, go.sum, main.goDetection complete.