Hako
Reference

Auto-detection

Priority order and logic for automatic project detection.

Hako scans the repository root to determine the project type and generate a default configuration. It evaluates detection paths in the following priority order.

1. Docker Compose

Trigger: docker-compose.yml or compose.yml exists in the root directory. Detected command: docker compose up Package manager: N/A Port variable: Extracted from ${VAR} patterns in the compose file. Example: A service mapping 8080:${APP_PORT} sets APP_PORT as a managed variable.

2. Procfile

Trigger: A file named Procfile exists and contains a web: line. Detected command: The command string following the web: prefix. Package manager: N/A Port variable: PORT Example: web: bundle exec rails server generates a service named web.

3. package.json

Trigger: package.json exists with a dev or start script. Detected command: npm run dev or npm start (wrapped by the detected package manager). Package manager: Determined by lockfile presence. pnpm-lock.yaml selects pnpm. bun.lock or bun.lockb selects bun. yarn.lock selects yarn. Default is npm. Port variable: PORT Example: A dev script in package.json with yarn.lock present uses yarn run dev.

4. Monorepo

Trigger: package.json exists without dev or start scripts, but workspace configuration is present. Detected command: Workspace-specific run command for each detected service. Package manager: Scans pnpm-workspace.yaml, then package.json workspaces, then lerna.json. Lockfile detection follows the same logic as standard package.json detection, adding package-lock.json for npm. Port variable: PORT for single-service environments. PORT_{UPPER_NAME} for environments with multiple services. Example: A pnpm workspace with a web package uses pnpm --filter web run dev.

5. Makefile

Trigger: Makefile exists with a dev: or serve: target. Detected command: make dev (priority) or make serve. Package manager: N/A Port variable: PORT Example: A Makefile with a dev target uses make dev.

6. pyproject.toml

Trigger: pyproject.toml exists. Hako greps for framework dependencies. Detected command: uvicorn for FastAPI/Uvicorn, flask run for Flask, or python manage.py runserver for Django. Package manager: N/A Port variable: PORT Example: A project with fastapi in pyproject.toml uses uvicorn main:app.

7. Cargo.toml

Trigger: Cargo.toml exists in the root. Detected command: cargo run Package manager: cargo Port variable: PORT Example: A Rust project uses cargo run.

8. Go Module

Trigger: go.mod exists in the root. Detected command: go run . Package manager: go Port variable: PORT Example: A Go project uses go run ..

9. No Match

If no triggers match, Hako issues a warning. A manual hako.yml file is required to define the environment.

Auto-generation Behavior

The detection process generates a temporary configuration based on the detected mode.

  • Docker mode: Hako generates a ports configuration by extracting environment variables from the compose file.
  • Bare mode: Hako generates a services configuration with the detected command and port variables.

Validated Monorepos

The monorepo detection logic is tested against the following public repositories:

  • sveltejs/svelte
  • expo/expo
  • remix-run/remix
  • ionic-team/ionic-framework
  • sveltejs/kit

ops.origin: Masakiro Corp.

On this page