# How to use the Sandcastle CLI

## What is the Sandcastle CLI

The cli is a suite of utilities that speed up development with the sandcastle repo

## Where is the CLI

Just point your terminal here

```
cd ./apps/cli/src
```

In the future, this will be globally installed so that the cli can be called by typing `sc [command]` anywhere in the terminal

## Examples

To show the version being used

```
ts-node index.ts -V
```

To show the help screen...

```
ts-node index.ts --help
```

To perform a scaffold based on a readme.json file

```
ts-node index.ts scaffold
```

## Scaffolding

Scaffolding is a way to rapidly scaffold the code for modules/components/tests/documentation/storybook/api/schema/etc by placing basic data in a readme.json file.

To begin, create a readme.json file describing all of your components/tests/etc.

Then, run the following command

```
ts-node index.ts scaffold -i {./path/to/readme/file} -o {./path/to/folder}
```

## ReadMe.json Keys

The json keys of the file should be...

```
{
  name:string
  description:string
  workflow:string // the url path to an image
  user_stories:array // this is an array of strings
  test_plan:array // an array of "Test Plan" objects
  screens:array // the url path to an image <-- should be an array
  components:array // an array of "Component" objects
  database:array // an array of "Database" objects
  api:array // an array of "API" objects
}
```

### Test Plan Object

```
{
  scenario:string
  expected:string
  automated:string
  type:string
}
```

### Component Object

```
{
  type:string
  name:string
  description:string
  behaviors:string
  exists:enum(Yes|No)
  package:enum(Yes|No)
  schema:array // an array of "Schema" objects
  tests:array // an array of "Test" objects
}
```

### Database Object

```
{
  name:string
  schema:array // An array of "Schema" objects
}
```

### API Object

```
{
  name:string
  schema:array // An array of "Schema" objects
  tests:array // An array of "Test" objects
}
```

### Schema Object

```
{
  schema_type?:string
  name:string
  required?:bool
  public?:bool
  type:string
  description?:string
}
```

### Test Object

```
{
  it:string
  type:enum(Integration|Unit)
}
```

## Testing with storybook
