CLI inspector
@daloyjs/core ships a tiny daloy binary that loads your App instance and prints what is registered. It is the fastest way to answer questions like “what routes does this service expose?”, “are any operationIds missing?”, or “give me the OpenAPI spec” without starting a server.
Quick start
pnpm daloy inspect # tries ./src/app.ts, ./src/app.js, ./app.ts, ./app.js
pnpm daloy inspect ./src/server.ts
pnpm daloy inspect --schemas
pnpm daloy inspect --check # exit 1 on contract errors
pnpm daloy inspect --openapi > openapi.json
pnpm daloy inspect --tag Users
pnpm daloy inspect --method post --jsonLoading the App
The entry file must export an App instance, either as the default export or as a named export called app:
import { App } from "@daloyjs/core";
export const app = new App();
app.route({ /* ... */ });
// Or:
// export default app;TypeScript entry files are loaded via tsx. create-daloy templates already include tsx; in other projects install it with pnpm add -D tsx.
Flags
--json— emit a machine-readable JSON document instead of a human table.--check— run the contract suite ( missing operationIds, duplicate operationIds, dead routes, body schemas on safe methods, invalid examples) and exit 1 on any error.--schemas— add aB/Q/P/Hcolumn showing which of body, query, params, and headers schemas the route declares.--openapi— print the OpenAPI 3.1 document.--tag <tag>— only show routes that declare this tag.--method <method>— only show routes for this HTTP method.-h, --help·-v, --version
CI usage
daloy inspect --check is a drop-in replacement for the in-process runContractTests runner. Wire it into your pipeline to fail builds on dead routes, duplicate operationIds, and missing operationIds:
- name: Contract checks
run: pnpm daloy inspect --checkProgrammatic API
The CLI is also exported as a function so you can wire it into custom scripts or your own binary:
import { runCli } from "@daloyjs/core/cli";
const result = await runCli(process.argv.slice(2), {
stdout: (chunk) => process.stdout.write(chunk),
stderr: (chunk) => process.stderr.write(chunk),
importEntry: (specifier) => import(specifier),
version: "1.0.0",
});
process.exit(result.exitCode);