xPulse
πŸ‡¬πŸ‡§ EN

Schema

Command convention

Each xPart that provides CLI commands places Command classes under src/commands/. One file = one Command class. No cli.js, no registration.

@xpulse/my-package/
src/
commands/
FetchCommand.js ← extends Command
ChangelogCommand.js ← extends Command

Minimal example

// src/commands/HelloCommand.js
import { Command } from '@xpulse/cli/command';
export class HelloCommand extends Command {
configure() {
this
.setName('tapp:hello')
.setDescription('Say hello')
.addArgument('name', 'Anon', 'Recipient name');
}
async run(input, output) {
output.success(`Hello ${input.getArgument('name')}!`);
return 0;
}
}

Required

Field Description
setName() Command name – namespace:area:command
setDescription() Short description for --help and --list
run() Execution logic – returns exit code

Autodiscovery order

1. node_modules/@xpulse/*/src/commands/*.js ← installed xParts
2. src/commands/*.js ← local project

The local project behaves like an implicit xPart – no npm link needed.

Namespace convention

Command Namespace xPart
doc:fetch doc @xpulse/doc
project:config:show project @xpulse/config
repo:changelog:generate repo @xpulse/repo
release:prepare release @xpulse/release

Package structure

@xpulse/cli/
bin/
xpulse.js ← entry point: autodiscovery, parser, Input/Output, timeout
src/
command.js ← Command base class with configure(), keepAlive(), run()
input.js ← Input class: getArgument, getOption, getFlag, isVerbose ...
output.js ← Output class + internal helpers (--help, --list, --version)
loader.js ← find + import node_modules/@xpulse/*/src/commands/*.js
parser.js ← CLI input β†’ { name, args, rawArguments, verbose, quiet, ansi }
docs/
index.md
de/ index, guide, api, schema
en/ index, guide, api, schema
test/
command.test.js
input.test.js
parser.test.js
loader.test.js
README.md
package.json
xpulse.json

Exports

import { Command } from '@xpulse/cli/command'; // Command base class – for xParts
import { Input } from '@xpulse/cli/input'; // Input class (rarely needed directly)
import { Output } from '@xpulse/cli/output'; // Output class (rarely needed directly)

project `package.json` requirements

{
"type": "module"
}

"type": "module" is required because the entire xPulse ecosystem uses ESM. Without it, Node.js will fail to load Command files with import statements.

en/schema.md 2026-03-16