@unhack/cli v0.15.5
unhack
Unhack CLI
Apply Unhack patterns on a git repository.
Configuration
Configure Unhack CLI for your project by creating a config.json
file at <project dir>/.unhack/config.json
, or configure globally for all projects at $HOME/.unhack/config.json
.
Config options
Global:
branchesPrefix
: a prefix that helps distinguish branches created by Unhack (defaults to"unhack"
)engineImageName
: the name of the Docker image that provides the Unhack Engine (defaults to"unhack/web-engine"
)dockerUser
: Docker Hub usernamedockerPassword
: Docker Hub password
Project specific:
owners
: this option is relevant for thesplit
command. It consists of an array of objects. Each object has two keys:teamName
andglobs
.globs
is an array of glob patterns that specify paths that belong toteamName
. The format of the glob patterns is the one supported by theminimatch
library.testCmd
: a testing/linting command that will be ran against each change produced by Unhack Engine. The command can also contain fixes from external tools (e.g.eslint --fix
).enginePort
: the port used by Unhack Engine to listen for connections; when set, Unhack CLI stops managing the engine instance (starting, stopping), so you have to start it yourself.
Custom Patterns
You can define custom patterns that are specific to your project.
The CLI reads custom patterns from the .unhack/patterns
directory. The file extension is .unhack
.
For example:
// <project dir>/.unhack/pattern/mypattern.unhack
pattern MyCustomPattern() = `deprecatedFunction($someArg)` => `newFunction($someArg)`
Development
## Install dependencies
yarn
## Run the CLI
./bin/dev <command>
Best Practices
Try to follow these CLI design best practices:
- https://github.com/lirantal/nodejs-cli-apps-best-practices
- https://devcenter.heroku.com/articles/cli-style-guide
Usage
$ npm install -g @unhack/cli
$ unhack COMMAND
running command...
$ unhack (--version)
@unhack/cli/0.15.5 linux-x64 node-v16.16.0
$ unhack --help [COMMAND]
USAGE
$ unhack COMMAND
...
Commands
unhack apply PATTERN [GLOB]
unhack help [COMMAND]
unhack install
unhack migrate MIGRATIONNAME [PATH]
unhack patterns
unhack source PATTERN_NAME
unhack stop
unhack version
unhack apply PATTERN [GLOB]
Apply a pattern on the project.
USAGE
$ unhack apply [PATTERN] [GLOB] [-b] [-i] [-o <value>] [-q] [-t] [--slow]
ARGUMENTS
PATTERN Name of the pattern to apply
GLOB [default: **/*] File, directory, or glob (inside quotes) to apply pattern
FLAGS
-b, --branch Send each transformation to a different branch
-i, --interactive Ask for each change
-o, --onlyDiff=<value> Run only on files diff with provided branch
-q, --quiet Hide diffs from output
-t, --test Run tests
--slow Run the apply slowly, for debugging
DESCRIPTION
Apply a pattern on the project.
See code: dist/commands/apply.ts
unhack help [COMMAND]
Display help for unhack.
USAGE
$ unhack help [COMMAND] [-n]
ARGUMENTS
COMMAND Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for unhack.
See code: @oclif/plugin-help
unhack install
Install supporting binaries.
USAGE
$ unhack install [--update]
FLAGS
--update Look for updates to installed agents.
DESCRIPTION
Install supporting binaries.
See code: dist/commands/install.ts
unhack migrate MIGRATIONNAME [PATH]
Run a migration on the current directory.
USAGE
$ unhack migrate [MIGRATIONNAME] [PATH] [-v] [-b]
ARGUMENTS
MIGRATIONNAME Name of the migration
PATH [default: **/*] Path to apply the migration on
FLAGS
-b, --builtin Use a built-in migration
-v, --verbose Verbose
DESCRIPTION
Run a migration on the current directory.
See code: dist/commands/migrate.ts
unhack patterns
List all available named patterns.
USAGE
$ unhack patterns
DESCRIPTION
List all available named patterns.
See code: dist/commands/patterns.ts
unhack source PATTERN_NAME
Display the source of a pattern.
USAGE
$ unhack source [PATTERN_NAME]
ARGUMENTS
PATTERN_NAME Name of the pattern
DESCRIPTION
Display the source of a pattern.
See code: dist/commands/source.ts
unhack stop
Stop all background agents.
USAGE
$ unhack stop
DESCRIPTION
Stop all background agents.
See code: dist/commands/stop.ts
unhack version
Display version information about the CLI and agents.
USAGE
$ unhack version
DESCRIPTION
Display version information about the CLI and agents.
See code: dist/commands/version.ts
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago