Project bootstrap
The console client can scaffold a fresh XTaskJS application from the official typescript-starter and optionally install dependencies with npm, pnpm, yarn, or bun.
CLI
This page covers the xtask console workflow from first install to day-to-day project scaffolding, including create, generate, option reference, and troubleshooting guidance from the upstream repository.
2 commands + 5 option groups
The console client can scaffold a fresh XTaskJS application from the official typescript-starter and optionally install dependencies with npm, pnpm, yarn, or bun.
The generate command emits controllers, services, repositories, DTOs, guards, middlewares, modules, resources, gateways, value objects, event-source scaffolds, and throttler helpers that follow upstream templates.
The cache command talks to runtime management endpoints so teams can inspect models, inspect entries, clear caches, and check effective HTTP/browser cache metadata from the terminal.
The add command installs official @xtaskjs modules, supports npm/pnpm/yarn/bun, and can list the latest published versions from npm for selective upgrades.
Install
Install the published package globally when you want a shell-wide xtask binary for repeated project scaffolding and code generation.
npm install -g @xtaskjs/cli
xtask --helpUse npx to verify the published package or run the console client without changing the current machine's global toolchain.
npx @xtaskjs/cli --helpRun the CLI from source while iterating on templates, generators, or release packaging.
git clone https://github.com/xtaskjs/xtask-cli.git
cd xtask-cli
npm install
npm run start -- --helpUse the verified create workflow from the CLI repo to bootstrap an app, then add the cache package before wiring cache decorators into generated code.
xtask create cache-demo
cd cache-demo
npm install @xtaskjs/cacheCommands
Bootstraps a new XTaskJS application from the official typescript-starter archive and can install dependencies immediately after scaffolding.
xtask create <project-name> [directory] [options]
xtask create my-api
xtask create billing-api ./services/billing --package-manager pnpm --skip-install
Emits feature-oriented source files inside an existing XTaskJS app, supporting controller, service, repository, dto, guard, middleware, module, resource, gateway, value-object, event-aggregate, event-subscriber, throttle-guard, and throttle-config scaffolds.
xtask generate <type> <name> [options]
xtask generate controller users
xtask generate resource billing --path src/modules --crud
xtask generate resource cache-entries --path src/modules --crud --with-dto
xtask generate module reports --path src/modules --with-guard
xtask generate event-aggregate orders --path src/domain
xtask generate throttle-guard api --path src/security
Manages an XTaskJS app cache using runtime admin endpoints, including model inspection, entry inspection, invalidation, and HTTP cache policy checks.
xtask cache <subcommand> [options]
xtask cache models
xtask cache entry products 42
xtask cache http-route --method GET --path /articles/landing
xtask cache models --server http://127.0.0.1:4000 --management-path /internal/cache
Installs official @xtaskjs modules into an existing project and can query npm to list current published versions.
xtask add [modules...] [options]
xtask add cache queues socket-io
xtask add --all
xtask add --list core cache socket-io
Options
Applies to the top-level xtask binary regardless of subcommand.
Print command help and exit.
Show the installed CLI version.
Controls how the create command chooses a destination directory and installs dependencies.
Allow scaffolding into a non-empty destination directory.
Download the starter but do not run the selected package manager afterward.
Choose which package manager to run after scaffolding: npm, pnpm, yarn, or bun.
Shapes where generated files are written and how much scaffold code is emitted.
Resolve generated output relative to a different source directory.
Override the route path used by generated controllers.
Write files directly into the target path instead of creating a feature subdirectory.
Generate a guard file and wire it into module or resource controllers.
For resource scaffolds, also emit a DTO file for request validation.
For resource scaffolds, emit CRUD-style controller, service, repository, and DTO code.
Overwrite existing files instead of aborting when the destination already exists.
Controls how cache subcommands reach runtime management endpoints.
Override the base server URL used by cache requests (default: http://127.0.0.1:3000).
Override the cache management controller path (default: /ops/cache).
Inspect one route's effective HTTP/browser cache policy exposed by createCacheManagementController().
Controls how the add command resolves official modules and package managers.
Install every official @xtaskjs module currently mapped by the CLI.
Print module names with latest published npm versions instead of installing.
Choose install command family for add: npm, pnpm, yarn, or bun.
Troubleshooting
Confirm node -v and the active npm global prefix before assuming the xtask binary is broken.
Run npm list -g --depth=0 @xtaskjs/cli and type -a xtask to see whether the current shell can resolve the installed package.
If you use nvm or multiple Node versions, reinstall @xtaskjs/cli in the active version and refresh the shell hash.
Use xtask --help or npx @xtaskjs/cli --help to confirm the published package works before troubleshooting project-specific commands.
Notes