1.3.1 • Published 1 year ago

@cdwr/cli v1.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Codeware Sthlm Developer CLI

GitHub Workflow Status (with branch) npm (scoped) Semantic Release

Table of contents

Description

This is a CLI to make local development a bit easier and structured. Some commonly used tools and scripts are bundled and provided by CLI commands.

Though it's a public repo this CLI is aimed for Codeware Sthlm developers. If anyone finds it useful we're more than happy to share our code, or the CLI itself from NPM.

Recipes

Setup a local npm registry using verdaccio

# Start verdaccio
cdwr registry start

# Change your local registry setting to use the verdaccio host
cdwr registry set local

# Check status and get registry info
cdwr registry status

Deployment to npm via npm publish should end up in verdaccio repository.

The repository content is accessed via http://localhost:4373.

# Stop verdaccio
cdwr registry stop

# Verify it's stopped
cdwr registry status

General Usage

$ npm install -g @cdwr/cli
$ cdwr COMMAND
running command...
$ cdwr (--version)
@cdwr/cli/1.3.1 linux-x64 node-v18.18.0
$ cdwr --help [COMMAND]
USAGE
  $ cdwr COMMAND
...

Commands

cdwr autocomplete [SHELL]

display autocomplete installation instructions

USAGE
  $ cdwr autocomplete [SHELL] [-r]

ARGUMENTS
  SHELL  shell type

FLAGS
  -r, --refresh-cache  Refresh cache (ignores displaying instructions)

DESCRIPTION
  display autocomplete installation instructions

EXAMPLES
  $ cdwr autocomplete

  $ cdwr autocomplete bash

  $ cdwr autocomplete zsh

  $ cdwr autocomplete --refresh-cache

See code: @oclif/plugin-autocomplete

cdwr commands

list all the commands

USAGE
  $ cdwr commands [--json] [-h] [--hidden] [--tree] [--columns <value> | -x] [--sort <value>] [--filter
    <value>] [--output csv|json|yaml |  | [--csv | --no-truncate]] [--no-header | ]

FLAGS
  -h, --help         Show CLI help.
  -x, --extended     show extra columns
  --columns=<value>  only show provided columns (comma-separated)
  --csv              output is csv format [alias: --output=csv]
  --filter=<value>   filter property by partial string matching, ex: name=foo
  --hidden           show hidden commands
  --no-header        hide table header from output
  --no-truncate      do not truncate output to fit screen
  --output=<option>  output in a more machine friendly format
                     <options: csv|json|yaml>
  --sort=<value>     property to sort by (prepend '-' for descending)
  --tree             show tree of commands

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  list all the commands

See code: @oclif/plugin-commands

cdwr help [COMMANDS]

Display help for cdwr.

USAGE
  $ cdwr help [COMMANDS] [-n]

ARGUMENTS
  COMMANDS  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for cdwr.

See code: @oclif/plugin-help

cdwr registry [COMMAND]

Manage registry settings and actions

USAGE
  $ cdwr registry [COMMAND]

DESCRIPTION
  Manage registry settings and actions

See code: dist/commands/registry/index.ts

cdwr registry set [LOCATION]

Set the active registry location

USAGE
  $ cdwr registry set [LOCATION]

ARGUMENTS
  LOCATION  (local|remote) Registry location

DESCRIPTION
  Set the active registry location

EXAMPLES
  $ cdwr registry set local

  $ cdwr registry set remote

cdwr registry start

Start local verdaccio registry

USAGE
  $ cdwr registry start [-d]

FLAGS
  -d, --detach  Run verdaccio as background process

DESCRIPTION
  Start local verdaccio registry

EXAMPLES
  $ cdwr registry start

  $ cdwr registry start -d

cdwr registry status

Display registry status

USAGE
  $ cdwr registry status

DESCRIPTION
  Display registry status

  Prints the current registry settings
  and the status of the local verdaccio registry

cdwr registry stop

Stop local verdaccio registry

USAGE
  $ cdwr registry stop

DESCRIPTION
  Stop local verdaccio registry

cdwr search

Search for a command.

USAGE
  $ cdwr search

DESCRIPTION
  Search for a command.

  Once you select a command, hit enter and it will show the help for that command.

See code: @oclif/plugin-search

cdwr version

USAGE
  $ cdwr version [--json] [--verbose]

FLAGS
  --verbose  Show additional information about the CLI.

GLOBAL FLAGS
  --json  Format output as json.

FLAG DESCRIPTIONS
  --verbose  Show additional information about the CLI.

    Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.

See code: @oclif/plugin-version

CLI Development

Prerequisites

tsx must be globally installed to be able to start CLI in development mode.

npm i -g tsx

Setup

git clone https://github.com/codeware-sthlm/cdwr-cli.git [PATH]
cd [PATH]
yarn

Start

Launch development mode

bin/dev.js [COMMAND]

Launch production build

yarn build
bin/run.js [COMMAND]

Linting

yarn lint

Unit tests

yarn test

Create local tarball releases (optional)

yarn release:local

Commit some changes

# Stage files
git add [FILES]

# Start interactive Git commit CLI
yarn commit
# or
yarn c

# with ai support (setup required)
yarn commit ai
# or
yarn cai

Setup OpenAI token

https://cz-git.qbb.sh/recipes/openai#setup-openai-token

npx czg --openai-token=sk-xxxxx

Token is saved to ~/.config/.czrc