0.15.5 • Published 2 years ago

@unhack/cli v0.15.5

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
2 years ago

unhack

Unhack CLI

oclif Version CircleCI Downloads/week

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 username
  • dockerPassword: Docker Hub password

Project specific:

  • owners: this option is relevant for the split command. It consists of an array of objects. Each object has two keys: teamName and globs. globs is an array of glob patterns that specify paths that belong to teamName. The format of the glob patterns is the one supported by the minimatch 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:

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]

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

0.15.5

2 years ago

0.14.5

2 years ago

0.14.0

2 years ago

0.14.1

2 years ago

0.14.2

2 years ago

0.14.3

2 years ago

0.14.4

2 years ago

0.15.4

2 years ago

0.15.3

2 years ago

0.13.22

2 years ago

0.13.6

2 years ago

0.13.7

2 years ago

0.13.8

2 years ago

0.13.9

2 years ago

0.13.1

2 years ago

0.13.2

2 years ago

0.13.4

2 years ago

0.13.5

2 years ago

0.12.10

2 years ago

0.12.11

2 years ago

0.10.4

2 years ago

0.12.12

2 years ago

0.10.5

2 years ago

0.12.13

2 years ago

0.10.6

2 years ago

0.10.7

2 years ago

0.11.8

2 years ago

0.11.9

2 years ago

0.11.0

2 years ago

0.11.1

2 years ago

0.11.2

2 years ago

0.11.3

2 years ago

0.11.4

2 years ago

0.11.5

2 years ago

0.11.6

2 years ago

0.11.7

2 years ago

0.13.12

2 years ago

0.13.11

2 years ago

0.13.10

2 years ago

0.13.16

2 years ago

0.13.15

2 years ago

0.13.14

2 years ago

0.13.13

2 years ago

0.13.19

2 years ago

0.13.18

2 years ago

0.13.17

2 years ago

0.13.21

2 years ago

0.13.20

2 years ago

0.12.7

2 years ago

0.12.8

2 years ago

0.12.9

2 years ago

0.12.0

2 years ago

0.12.1

2 years ago

0.12.2

2 years ago

0.12.3

2 years ago

0.12.4

2 years ago

0.12.5

2 years ago

0.12.6

2 years ago

0.9.13

2 years ago

0.9.14

2 years ago

0.9.15

2 years ago

0.10.1

2 years ago

0.10.2

2 years ago

0.10.3

2 years ago

0.10.0

2 years ago

0.9.12

2 years ago

0.9.10

2 years ago

0.9.11

2 years ago

0.9.0

2 years ago

0.9.2

2 years ago

0.9.1

2 years ago

0.9.8

2 years ago

0.9.7

2 years ago

0.9.9

2 years ago

0.8.24

2 years ago

0.9.4

2 years ago

0.9.3

2 years ago

0.9.6

2 years ago

0.9.5

2 years ago

0.8.23

2 years ago

0.8.22

2 years ago

0.8.21

2 years ago

0.8.20

2 years ago

0.8.19

2 years ago

0.8.18

2 years ago

0.8.9

2 years ago

0.8.5

2 years ago

0.8.4

2 years ago

0.8.6

2 years ago

0.7.11

2 years ago

0.7.10

2 years ago

0.7.9

2 years ago

0.7.13

2 years ago

0.7.12

2 years ago

0.7.8

2 years ago

0.7.15

2 years ago

0.7.14

2 years ago

0.7.17

2 years ago

0.7.16

2 years ago

0.8.12

2 years ago

0.8.11

2 years ago

0.8.14

2 years ago

0.8.13

2 years ago

0.8.10

2 years ago

0.8.16

2 years ago

0.8.15

2 years ago

0.8.17

2 years ago

0.8.1

2 years ago

0.8.0

2 years ago

0.8.3

2 years ago

0.8.2

2 years ago

0.7.6

2 years ago

0.7.5

2 years ago

0.7.7

2 years ago

0.7.4

2 years ago

0.7.3

2 years ago

0.7.2

2 years ago

0.7.1

2 years ago

0.7.0

2 years ago

0.6.7

3 years ago

0.6.6

3 years ago

0.6.9

3 years ago

0.6.8

3 years ago

0.6.5

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.4

3 years ago

0.6.1

3 years ago

0.5.6

3 years ago

0.6.0

3 years ago

0.5.5

3 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.5.2

3 years ago

0.5.0

3 years ago

0.5.1

3 years ago

0.4.5

3 years ago

0.4.6

3 years ago

0.4.4

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago