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";
package_manager?: string; // npm, pnpm, yarn, bun, pip, poetry, etc.
name?: string; // Project name from manifest
version?: string; // Project version
scripts: string[]; // Available script names
}

Examples

Basic Detection

detect {path: "."}

Response:

{
"type": "node",
"package_manager": "pnpm",
"name": "my-react-app",
"version": "1.0.0",
"scripts": ["dev", "build", "test", "lint", "typecheck"]
}

Detect Subdirectory

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

Go Project

detect {path: "./backend"}

Response:

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

Python Project

detect {path: "./scripts"}

Response:

{
"type": "python",
"name": "my-python-app",
"scripts": ["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