detect
ward detect finds the supported project in the selected directory or its nearest parent, and
reports its language, build tool, framework, and project root. A project with more than one
language also gets a Languages: line that lists them all.
ward detect [-C <dir>]Options
Section titled “Options”| Option | What it does |
|---|---|
-C, --directory <dir> | Run as if Ward were started in <dir>. |
What is detected
Section titled “What is detected”- Gradle projects are recognized from
build.gradleandbuild.gradle.kts. - For Maven and Gradle projects, the language comes from the sources, not from the build file.
Ward looks for
src/main/javaandsrc/main/kotlinin the project and its modules:- With Java sources, the language is Java, even when the build script is
build.gradle.kts. - With only Kotlin sources, the language is Kotlin.
- With both, the language is Java, and
Languages:lists Java and Kotlin. - With no sources yet, the language is Java.
- With Java sources, the language is Java, even when the build script is
- Spring Boot is recognized when the POM references
org.springframework.boot. - TypeScript projects are recognized from
tsconfig.json, and JavaScript projects frompackage.json.
Node package manager
Section titled “Node package manager”For TypeScript and JavaScript, the first match decides the build tool:
- The
packageManagerfield ofpackage.json(npm@…,pnpm@…,yarn@…orbun@…). Other values are ignored. - A lock file, in this order:
bun.lockorbun.lockb(Bun),pnpm-lock.yaml(pnpm),yarn.lock(Yarn),package-lock.json(npm). - npm.
The packageManager field wins over a lock file that disagrees with it, because it is what Corepack
enforces. Deno is not supported.
Node version
Section titled “Node version”detect prints a Node: line with the target Node major version. The first source that gives a
number decides:
.nvmrc, such asv20.11.1→20. Aliases such aslts/*fall through..node-version.- The lower bound of
engines.nodeinpackage.json, such as^18.18.0 || >=20→18. 24.
Language: TypeScriptBuild tool: pnpmFramework: NoneNode: 22Project root: /path/to/frontendA malformed package.json is still detected; the manager then comes from lock files alone.
Modules and aggregators
Section titled “Modules and aggregators”Build modules belong to their aggregator, up to the Git top-level:
- A directory listed in an enclosing
pom.xml<modules>, including profile modules, resolves to that aggregator. - A Gradle build below an enclosing
settings.gradle(.kts)resolves to that build. - A package matched by the
workspacesfield of an enclosingpackage.json(an array, or{ "packages": [...] }), or by thepackageslist of an enclosingpnpm-workspace.yaml, resolves to that workspace root. This covers npm, pnpm, Yarn and Bun workspaces. - A nested build that no aggregator lists is its own project.
A workspace root is TypeScript when the root or any member has tsconfig.json, and JavaScript
otherwise.
Workspace patterns that start with ! are ignored rather than applied, so a package they would
exclude is still grouped under the root.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 | A supported project was detected. |
1 | No supported project was detected. |
2 | Ward could not run. |