<commit_before># naut-cli

A cli client for SilverStripe's deploynaut.

## Install

Download the latest phar from the releases section of this repo and put it somewhere
on your `$PATH`.

Or you can clone this repository and build the phar yourself by following
the instructions in the Build section below.
    
## Usage

There are a few different commands that can be run.

### Configure

naut-cli relies on a configuration file existing in your home directory.

You can create this by running:

    php naut-cli.phar configure
    
This will ask you for:

- The domain of deploynaut (e.g. https://deploy.test.com)
- Your username (e.g. <EMAIL>)
- Your deploynaut API token

And create a new file at `~/.naut.env` that is only readable by the current user.

### Deploy

Deploy the latest commit of a project to a specific environment with deploy:

    php naut-cli.phar deploy <project_id> <environment> <branch_name>
    
Where:

- `<project_id>` is the short text identifier of the project in deploynaut (also seen in the deploynaut URL at `/naut/project/<project_id>`)
- `<environment>` is the name of the environment you want to deploy to (e.g. '`prod`', '`uat`', '`test1`')
- `<branch_name>` is the name of the git branch you would like to deploy

A few things will happen when you run this command:

1. Fetch latest changes from git
2. Trigger deployment
3. Stream the deployment log back to your terminal

## Build phar from source

To build the `naut-cli.phar` file from source run the script `bin/build-phar.sh`.

This will create a fresh copy of the phar at `dist/naut-cli.phar`.<commit_msg>Add snapshot info to readme<commit_after># naut-cli

A cli client for SilverStripe's deploynaut.

## Install

Download the latest phar from the releases section of this repo and put it somewhere
on your `$PATH`.

Or you can clone this repository and build the phar yourself by following
the instructions in the Build section below.
    
## Usage

There are a few different commands that can be run.

### Configure

naut-cli relies on a configuration file existing in your home directory.

You can create this by running:

    php naut-cli.phar configure
    
This will ask you for:

- The domain of deploynaut (e.g. https://deploy.test.com)
- Your username (e.g. <EMAIL>)
- Your deploynaut API token

And create a new file at `~/.naut.env` that is only readable by the current user.

### Deploy

Deploy the latest commit of a project to a specific environment with deploy:

    php naut-cli.phar deploy <project_id> <environment> <branch_name>
    
Where:

- `<project_id>` is the short text identifier of the project in deploynaut (also seen in the deploynaut URL at `/naut/project/<project_id>`)
- `<environment>` is the name of the environment you want to deploy to (e.g. '`prod`', '`uat`', '`test1`')
- `<branch_name>` is the name of the git branch you would like to deploy

A few things will happen when you run this command:

1. Fetch latest changes from git
2. Trigger deployment
3. Stream the deployment log back to your terminal

### Snapshots

You can see a list of snapshots for a specific stack with the command:

    php naut-cli.php snapshot:list <stack_id>

This will display a table containing columns for: the snapshot id, source environment, size, and created date/time.

You can delete a snapshot with the command:

    php naut-cli.php snapshot:delete <stack_id> <snapshot_id>

You can create a new snapshot for a specific stack/environment with the command:

    php naut-cli.php snapshot:create <stack_id> <snapshot_id>

Optionally, you can include the `--mode` flag. This flag sets the type of snapshot to create.

Valid options are:

- all
- db
- assets

The default if the `--mode` flag is missing is `all`. Example usage: `--mode=assets`.

## Build phar from source

To build the `naut-cli.phar` file from source run the script `bin/build-phar.sh`.

This will create a fresh copy of the phar at `dist/naut-cli.phar`.
{'fraction_non_alphanumeric': 0.07938118184123763, 'fraction_numerical': 0.002028911995942176, 'mean_word_length': 3.7575392038600723, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '846346', 'n_tokens_mistral': 1195, 'n_tokens_neox': 1165, 'n_words': 577}