npm-ute-cli
v0.1.2
Published
A CLI tool for Under Tree Entertainment's internal use, providing various utilities and automation features to streamline development and operations.
Readme
ute-cli
ute-cli is an internal TypeScript CLI for routine developer and CI workflows across company repositories.
It is designed to:
- standardize pull request, branching, release, validation, and environment checks
- run the same way for local developers and Jenkins jobs
- execute from compiled JavaScript in
dist/, not directly from TypeScript
Requirements
- Node.js
18+ - Git
- GitHub CLI (
gh) for PR-related commands - Linux or macOS shell environment
Installation
Install dependencies and build the compiled output:
npm install
npm run buildThe package bin points to compiled output:
"bin": {
"ute-cli": "./dist/index.js"
}Run it locally after build:
node dist/index.js --helpFor package publishing, prepack rebuilds dist/ automatically so the published tarball contains compiled JavaScript only.
Package Publishing
The package is configured for internal registry distribution:
- only
dist/andREADME.mdare published - the CLI binary resolves to compiled output in
dist/index.js - source files, tests, local config, and staging notes are not included in the package tarball
publishConfig.access=restrictedkeeps the package aligned with private distribution flows
Typical publish flow:
npm publishTypical install flow from an internal registry:
npm install -g ute-cli
ute-cli --helpLocal Development With npm link
To use the CLI globally from your workstation during development:
npm install
npm run build
npm linkAfter linking, run:
ute-cli --help
ute-cli doctorWhen you change TypeScript source, rebuild before using the linked CLI:
npm run buildConfiguration
ute-cli looks for .ute-cli.json in the current directory and then walks upward until it finds one. If no file exists, built-in defaults are used.
Minimal repository example:
{
"baseBranch": "main",
"defaultPrDraft": true,
"ticketPattern": "[A-Z]{2,}-\\d+",
"allowedBranchPrefixes": ["feature", "fix", "chore", "release", "hotfix"],
"releaseTagPrefix": "v",
"git": {
"user": {
"name": "John Doe",
"email": "[email protected]",
"scope": "local"
}
},
"scan": {
"commands": {
"lint": "npm run lint",
"test": "npm test",
"build": "npm run build"
}
}
}This repository includes that sample as /mnt/T7/projects/under_tree_e/addons/ute-cli.npm/.ute-cli.json. Commands fall back to built-in defaults for fields not present in the file, so the minimal example is enough for branch, pr, release, scan, and doctor.
Commands
pr
Create or inspect pull requests.
Examples:
ute-cli pr --summary "Add API timeout handling"
ute-cli pr --summary "Add API timeout handling" --push
ute-cli pr
ute-cli pr create --summary "Release 1.2.0" --base main --head release/1.2.0 --draft
ute-cli pr statusNotes:
ute-cli pris the smart create entrypoint. If the required inputs are already provided, it creates the PR directly. If not, local interactive mode asks only the minimal follow-up questions.ute-cli pr createruns the same create flow explicitly.- In local interactive mode,
ute-clican prompt for missing summary text, draft mode, base branch when no default is configured, and whether to push the branch when required. - In CI, with
--non-interactive, or in any non-interactive terminal, prompts are disabled. Pass--summaryor both--titleand--body, plus any other required flags such as--base. ute-cli prnever pushes implicitly. If the branch is missing onoriginor is ahead oforigin, push it yourself first or pass--push.- If a PR already exists for the current branch,
ute-cliprints the existing PR and exits successfully instead of creating a duplicate. ghmust be installed and authenticated.
branch
Generate a standardized branch name, with optional checkout.
Examples:
ute-cli branch AX-142 improve timeout handling
ute-cli branch AX-142 improve timeout handling --type fix --checkout
ute-cli branch AX-142 prepare release branch --type release --checkout --base maingit setup
Configure git user.name and git user.email with an explicit local or global scope.
Examples:
ute-cli git setup
ute-cli git setup --name "John Doe" --email "[email protected]"
ute-cli git setup --global --name "John Doe" --email "[email protected]"
ute-cli git setup --from-configNotes:
- local scope is the default and is recommended for repository-specific setup
- global scope is only used when
--globalis passed, or when--from-configreads"scope": "global" ute-cli git setupnever changes git identity silently; interactive mode confirms before applying changes--from-configreadsgit.user.name,git.user.email, andgit.user.scopefrom.ute-cli.json- CI and other non-interactive environments must pass
--nameand--email, or use--from-config
release
Create and push an annotated git tag from the current commit.
Examples:
ute-cli release --version 1.2.0
ute-cli release --version 1.2.0 --rc 1
ute-cli release --version 1.2.0 --dry-runNotes:
- the git working tree must be clean
- the tag must not already exist locally or on
origin
scan
Run repository validation commands defined in .ute-cli.json.
Examples:
ute-cli scan --lint
ute-cli scan --test --build
ute-cli scan --allNotes:
scanonly runs commands that are configured underscan.commands- missing task configuration causes a fast failure
doctor
Check whether the local or CI environment is ready to use ute-cli.
Examples:
ute-cli doctor
ute-cli doctor --scope git
ute-cli doctor --scope github --strict
ute-cli doctor --format json
ute-cli doctor --jsondoctor checks items such as:
core: required runtime basics such asnode,git, and config readabilitygit: repository state such as git worktree presence, branch safety,origin, and whether git identity is configuredgithub:ghavailability and authenticationscan: scan command presence and optional tooling such assonar-scanneranddockerci: CI detection and prompt policy
By default, doctor runs a broad health check across all scopes but only fails the command for enforced scopes. Local default enforcement is intentionally narrow so advisory issues in git, github, scan, or ci still show up without making the command unusable outside those contexts.
Use --scope to focus on one or more capability areas and make those checks blocking:
ute-cli doctor --scope git
ute-cli doctor --scope git --scope github
ute-cli doctor --scope git,githubUse --strict when doctor should act as an enforcement gate, such as in CI:
ute-cli doctor --strictLocal Developer Examples
Create a branch and open a PR:
ute-cli branch AX-142 improve timeout handling --checkout
git push -u origin "$(git branch --show-current)"
ute-cli pr --summary "Improve timeout handling"Validate a repository before pushing:
ute-cli doctor
ute-cli scan --allCreate a release tag:
ute-cli release --version 1.2.0 --dry-run
ute-cli release --version 1.2.0Jenkins Examples
Assume ute-cli is already installed and available on PATH in the Jenkins build environment.
ute-cli doctor
pipeline {
agent any
stages {
stage('Doctor') {
steps {
sh 'ute-cli doctor --strict'
}
}
}
}ute-cli scan --all
pipeline {
agent any
stages {
stage('Scan') {
steps {
sh 'ute-cli scan --all'
}
}
}
}ute-cli release --version 1.2.0 --dry-run
pipeline {
agent any
stages {
stage('Release Dry Run') {
steps {
sh 'ute-cli release --version 1.2.0 --dry-run'
}
}
}
}CI behavior:
- prompts are disabled when
CI=trueorJENKINS_URLis set - commands return non-zero exit codes on failure
- use explicit flags for anything that would otherwise require input
Typical Setup Flow
For a new developer, the shortest path is:
npm install
npm run build
npm link
ute-cli doctorIf the repository needs custom scan tasks or PR defaults, add .ute-cli.json before using scan or automated PR flows.
