Supporting multiple programming languages in a cloud platform usually means forcing developers to write configuration files.
Dockerfile, docker-compose.yml, devcontainer.json. If you want to run Python, write this. If you want to run Go, write that.
I built HYNA-Stage to eliminate this friction. The platform currently supports 12 different programming runtimes, and the user doesn't write a single line of configuration to use them.
Instead of asking the developer what they are building, the CLI looks at their repository and figures it out.
Here is the exact logic behind the inference engine, how it handles edge cases, and where it still fails.
TL;DR
- HYNA-Stage uses a CLI inference engine to auto-detect runtimes by scanning for standard manifest files (
package.json,requirements.txt,go.mod, etc.). - It infers the package manager, runtime version, and default start command.
- If inference fails, users can override it with CLI flags (
--runtime,--start) instead of writing YAML. - The system struggles with monorepos and non-standard build scripts, which is an active area of development.
🧠 How the Inference Engine Actually Works
When a user runs hyna-stage up, the CLI executes a detection function before it ever talks to the cloud. It scans the root directory for known manifest files.
Here is a simplified version of the detection logic running in the CLI:
import fs from 'fs';
import path from 'path';
function detectRuntime(projectDir) {
const files = fs.readdirSync(projectDir);
if (files.includes('package.json')) {
const pkg = JSON.parse(fs.readFileSync(path.join(projectDir, 'package.json'), 'utf8'));
// Check for yarn.lock or pnpm-lock.yaml to infer package manager
if (files.includes('yarn.lock')) return { runtime: 'node', manager: 'yarn', start: pkg.scripts?.start || 'node index.js' };
if (files.includes('pnpm-lock.yaml')) return { runtime: 'node', manager: 'pnpm', start: pkg.scripts?.start || 'node index.js' };
return { runtime: 'node', manager: 'npm', start: pkg.scripts?.start || 'node index.js' };
}
if (files.includes('requirements.txt') || files.includes('Pipfile')) {
return { runtime: 'python', manager: 'pip', start: 'python main.py' };
}
if (files.includes('go.mod')) {
return { runtime: 'go', manager: 'go', start: 'go run main.go' };
}
if (files.includes('Cargo.toml')) {
return { runtime: 'rust', manager: 'cargo', start: 'cargo run' };
}
// Fallback
return null;
}
This function returns a structured object that the provisioning pipeline uses to set up the MicroVM environment. No YAML required.
🛠️ The Fallback: When Inference Fails
Inference is a heuristic, not magic. It works perfectly for standard web servers, APIs, and scripts. It fails when developers use custom build steps or non-standard file names.
Instead of forcing users to write a config file when the guess is wrong, I built an escape hatch using CLI flags:
# Override the runtime and start command manually
hyna-stage up --runtime python --start "uvicorn main:app --port 8000"
This covers the edge cases without bringing the complexity of a configuration file back into the workflow.
📂 How I Organized the CLI
To keep the inference logic maintainable as I add more runtimes, I structured the CLI project by responsibility:
cli/
├── src/
│ ├── commands/
│ │ └── up.js # The main entry point for provisioning
│ ├── inference/
│ │ └── detect.js # The runtime detection logic shown above
│ ├── api/
│ │ └── client.js # Supabase Edge Function communication
│ └── index.js # Commander setup
├── package.json
└── README.md
Separating inference/detect.js from the provisioning logic means I can add a new language (like Ruby or PHP) by just updating one file, without touching the network code.
⚠️ The Honest Limitations
I want to be clear about where this approach breaks down, because pretending it doesn't will just frustrate users:
-
Monorepos: If you have three
package.jsonfiles in different folders, the current engine only looks at the root. It will guess wrong. -
Custom Build Steps: If your app requires
npm run buildbeforenpm start, the engine doesn't know that yet. It will try to start the uncompiled source. -
Global Dependencies: If your app relies on a globally installed tool (like
prismaortypescriptCLI) that isn't in yourpackage.jsondependencies, the sandbox won't have it.
I am working on a --manifest flag to specify a sub-directory for monorepos, and a build detection step, but they aren't shipped yet.
🔨 Try the Inference Engine
I want to see what happens when you point the CLI at a repo with zero infrastructure code.
npm install -g @hynaweb/stage
hyna-stage init python # Or go, rust, node
Dashboard: https://hyna-stage.netlify.app/
GitHub: https://github.com/harun-sket/hyna-stage
If you try it on a weird tech stack and it fails, open an issue on GitHub. Tell me what files your project uses, and I'll add them to the detection logic.
— Harun, Founder & CEO, HYNAWEB 🐯☁️
Top comments (0)