Skip to main content

detect

Detect project type, package manager, and available scripts.

Synopsis

detect {path: "<directory>"}

Parameters

ParameterTypeRequiredDefaultDescription
pathstringNo.Directory to analyze

Response

interface DetectResponse {
type: "go" | "node" | "python" | "unknown";
name: string; // Project name from manifest
framework?: string; // Detected framework (e.g. next, vite, django)
package_manager?: string; // npm, pnpm, yarn, bun, pip, poetry, etc.
scripts: DetectScript[]; // Full script descriptors
script_names: string[]; // Convenience list of script names
metadata?: Record<string, string>;
summary?: string; // Human-readable detection summary
}

interface DetectScript {
name: string;
command: string;
proc_run: string; // Suggested `run` command for proc/run
proc_wait: string; // Readiness wait hint
likely_signals: string[]; // URL/error signals this script tends to emit
}

Examples

Basic Detection

detect {path: "."}

Response:

{
"type": "node",
"package_manager": "pnpm",
"name": "my-react-app",
"framework": "vite",
"script_names": ["dev", "build", "test", "lint", "typecheck"],
"scripts": [
{
"name": "dev",
"command": "vite",
"proc_run": "pnpm run dev",
"proc_wait": "Local:\\s+{url}",
"likely_signals": ["url", "http_error"]
}
]
}

Detect Subdirectory

detect {path: "./packages/api"}

Go Project

detect {path: "./backend"}

Response:

{
"type": "go",
"name": "github.com/user/myproject",
"script_names": ["build", "test", "lint", "vet", "fmt"]
}

Python Project

detect {path: "./scripts"}

Response:

{
"type": "python",
"name": "my-python-app",
"script_names": ["test", "lint", "format", "type-check"]
}

Detection Logic

Priority Order

  1. Go - Checks for go.mod
  2. Node.js - Checks for package.json
  3. Python - Checks for pyproject.tomlsetup.pysetup.cfgrequirements.txt

Package Manager Detection (Node.js)

LockfilePackage Manager
pnpm-lock.yamlpnpm
yarn.lockyarn
bun.lockbbun
package-lock.jsonnpm

Default Scripts

Go

ScriptCommand
buildgo build ./...
testgo test ./...
lintgolangci-lint run
vetgo vet ./...
fmtgo fmt ./...

Node.js

Scripts from package.json are used directly.

Python

ScriptCommand
testpytest
lintflake8 or ruff check
formatblack .
type-checkmypy .

Error Responses

No Project Detected

{
"error": "no project detected",
"path": "/some/empty/directory"
}

Invalid Path

{
"error": "path does not exist",
"path": "/nonexistent/path"
}

See Also