npm package: @kunai-consulting/code-notate
Description: CLI tools for automatically documenting your code
Author: Kunai Consulting
Latest version: 0.0.2

@kunai-consulting/code-notate
=================

CLI tools for automatically documenting your code

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/@kunai-consulting/code-notate.svg)](https://npmjs.org/package/@kunai-consulting/code-notate)
[![Downloads/week](https://img.shields.io/npm/dw/@kunai-consulting/code-notate.svg)](https://npmjs.org/package/@kunai-consulting/code-notate)

<!-- toc -->
* [Installation](#installation)
* [Configuration](#configuration)
* [Commands](#commands)
<!-- tocstop -->
# Installation
<!-- usage -->
```sh-session
$ npm install -g @kunai-consulting/code-notate
$ cn COMMAND
running command...
$ cn (--version)
@kunai-consulting/code-notate/0.0.2 darwin-arm64 node-v22.14.0
$ cn --help [COMMAND]
USAGE
  $ cn COMMAND
...
```
<!-- usagestop -->

# Configuration

Create a `code-notate.config.js` file in your project root where your `package.json` is located.:

```javascript
/** @type {import('@kunai-consulting/code-notate').CodeNotateConfig} */
export default {
  // The LLM model to use
  aiModel: "claude-3-5-sonnet-20241022",
  // The LLM provider. Currently only Anthropic is supported
  aiProvider: "anthropic",
  // The folder where API information and documentation is stored
  documentationFolder: "./docs",
  // Optional. The command to run to format the generated documentation
  formatCommand: "pnpm format",
  // Optional. The directory where the format command can be run
  formatDirectory: ".",
  // Optional. The name of the framework the code is written in
  framework: "Qwik",
  // The folder where the code resides, to be analyzed and documented. Can be overridden with a command-line argument.
  sourceFolder: "./src/components/grid",
};
```
If the config file is located elsewhere, you can use the `-c` flag to specify the path, for example: `cn gen-api -c ./config`

## Anthropic API key
If you are using the Anthropic API, you need to set the `ANTHROPIC_API_KEY` environment variable.

To accomplish this, you can add a `.env` file to your project root, or you can set the environment variable globally in your Node.js environment.

Example `.env` file:
```
ANTHROPIC_API_KEY=sk-1234567890123456789012345678901234567890
```

# Commands
<!-- commands -->
* [`cn gen-api [FOLDER]`](#cn-gen-api-folder)
* [`cn gen-docs [FOLDER]`](#cn-gen-docs-folder)
* [`cn help [COMMAND]`](#cn-help-command)
* [`cn plugins`](#cn-plugins)
* [`cn plugins add PLUGIN`](#cn-plugins-add-plugin)
* [`cn plugins:inspect PLUGIN...`](#cn-pluginsinspect-plugin)
* [`cn plugins install PLUGIN`](#cn-plugins-install-plugin)
* [`cn plugins link PATH`](#cn-plugins-link-path)
* [`cn plugins remove [PLUGIN]`](#cn-plugins-remove-plugin)
* [`cn plugins reset`](#cn-plugins-reset)
* [`cn plugins uninstall [PLUGIN]`](#cn-plugins-uninstall-plugin)
* [`cn plugins unlink [PLUGIN]`](#cn-plugins-unlink-plugin)
* [`cn plugins update`](#cn-plugins-update)

## `cn gen-api [FOLDER]`

Generate API

```
USAGE
  $ cn gen-api [FOLDER] [-c <value>]

ARGUMENTS
  FOLDER  The folder where the code resides, where we want to analyze and generate the API documentation

FLAGS
  -c, --configPath=<value>  location of the code-notate.config.js file

DESCRIPTION
  Generate API

EXAMPLES
  $ cn gen-api
```

_See code: [src/commands/gen-api/index.ts](https://github.com/kunai-consulting/code-notate/blob/v0.0.2/src/commands/gen-api/index.ts)_

## `cn gen-docs [FOLDER]`

Generate Docs

```
USAGE
  $ cn gen-docs [FOLDER] [-c <value>]

ARGUMENTS
  FOLDER  The folder where the code resides, where we want to analyze and generate the API documentation

FLAGS
  -c, --configPath=<value>  location of the code-notate.config.js file

DESCRIPTION
  Generate Docs

EXAMPLES
  $ cn gen-docs
```

_See code: [src/commands/gen-docs/index.ts](https://github.com/kunai-consulting/code-notate/blob/v0.0.2/src/commands/gen-docs/index.ts)_

## `cn help [COMMAND]`

Display help for cn.

```
USAGE
  $ cn 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 cn.
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.26/src/commands/help.ts)_

## `cn plugins`

List installed plugins.

```
USAGE
  $ cn plugins [--json] [--core]

FLAGS
  --core  Show core plugins.

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  List installed plugins.

EXAMPLES
  $ cn plugins
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/index.ts)_

## `cn plugins add PLUGIN`

Installs a plugin into cn.

```
USAGE
  $ cn plugins add PLUGIN... [--json] [-f] [-h] [-s | -v]

ARGUMENTS
  PLUGIN...  Plugin to install.

FLAGS
  -f, --force    Force npm to fetch remote resources even if a local copy exists on disk.
  -h, --help     Show CLI help.
  -s, --silent   Silences npm output.
  -v, --verbose  Show verbose npm output.

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Installs a plugin into cn.

  Uses npm to install plugins.

  Installation of a user-installed plugin will override a core plugin.

  Use the CN_NPM_LOG_LEVEL environment variable to set the npm loglevel.
  Use the CN_NPM_REGISTRY environment variable to set the npm registry.

ALIASES
  $ cn plugins add

EXAMPLES
  Install a plugin from npm registry.

    $ cn plugins add myplugin

  Install a plugin from a github url.

    $ cn plugins add https://github.com/someuser/someplugin

  Install a plugin from a github slug.

    $ cn plugins add someuser/someplugin
```

## `cn plugins:inspect PLUGIN...`

Displays installation properties of a plugin.

```
USAGE
  $ cn plugins inspect PLUGIN...

ARGUMENTS
  PLUGIN...  [default: .] Plugin to inspect.

FLAGS
  -h, --help     Show CLI help.
  -v, --verbose

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Displays installation properties of a plugin.

EXAMPLES
  $ cn plugins inspect myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/inspect.ts)_

## `cn plugins install PLUGIN`

Installs a plugin into cn.

```
USAGE
  $ cn plugins install PLUGIN... [--json] [-f] [-h] [-s | -v]

ARGUMENTS
  PLUGIN...  Plugin to install.

FLAGS
  -f, --force    Force npm to fetch remote resources even if a local copy exists on disk.
  -h, --help     Show CLI help.
  -s, --silent   Silences npm output.
  -v, --verbose  Show verbose npm output.

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Installs a plugin into cn.

  Uses npm to install plugins.

  Installation of a user-installed plugin will override a core plugin.

  Use the CN_NPM_LOG_LEVEL environment variable to set the npm loglevel.
  Use the CN_NPM_REGISTRY environment variable to set the npm registry.

ALIASES
  $ cn plugins add

EXAMPLES
  Install a plugin from npm registry.

    $ cn plugins install myplugin

  Install a plugin from a github url.

    $ cn plugins install https://github.com/someuser/someplugin

  Install a plugin from a github slug.

    $ cn plugins install someuser/someplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/install.ts)_

## `cn plugins link PATH`

Links a plugin into the CLI for development.

```
USAGE
  $ cn plugins link PATH [-h] [--install] [-v]

ARGUMENTS
  PATH  [default: .] path to plugin

FLAGS
  -h, --help          Show CLI help.
  -v, --verbose
      --[no-]install  Install dependencies after linking the plugin.

DESCRIPTION
  Links a plugin into the CLI for development.

  Installation of a linked plugin will override a user-installed or core plugin.

  e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
  command will override the user-installed or core plugin implementation. This is useful for development work.


EXAMPLES
  $ cn plugins link myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/link.ts)_

## `cn plugins remove [PLUGIN]`

Removes a plugin from the CLI.

```
USAGE
  $ cn plugins remove [PLUGIN...] [-h] [-v]

ARGUMENTS
  PLUGIN...  plugin to uninstall

FLAGS
  -h, --help     Show CLI help.
  -v, --verbose

DESCRIPTION
  Removes a plugin from the CLI.

ALIASES
  $ cn plugins unlink
  $ cn plugins remove

EXAMPLES
  $ cn plugins remove myplugin
```

## `cn plugins reset`

Remove all user-installed and linked plugins.

```
USAGE
  $ cn plugins reset [--hard] [--reinstall]

FLAGS
  --hard       Delete node_modules and package manager related files in addition to uninstalling plugins.
  --reinstall  Reinstall all plugins after uninstalling.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/reset.ts)_

## `cn plugins uninstall [PLUGIN]`

Removes a plugin from the CLI.

```
USAGE
  $ cn plugins uninstall [PLUGIN...] [-h] [-v]

ARGUMENTS
  PLUGIN...  plugin to uninstall

FLAGS
  -h, --help     Show CLI help.
  -v, --verbose

DESCRIPTION
  Removes a plugin from the CLI.

ALIASES
  $ cn plugins unlink
  $ cn plugins remove

EXAMPLES
  $ cn plugins uninstall myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/uninstall.ts)_

## `cn plugins unlink [PLUGIN]`

Removes a plugin from the CLI.

```
USAGE
  $ cn plugins unlink [PLUGIN...] [-h] [-v]

ARGUMENTS
  PLUGIN...  plugin to uninstall

FLAGS
  -h, --help     Show CLI help.
  -v, --verbose

DESCRIPTION
  Removes a plugin from the CLI.

ALIASES
  $ cn plugins unlink
  $ cn plugins remove

EXAMPLES
  $ cn plugins unlink myplugin
```

## `cn plugins update`

Update installed plugins.

```
USAGE
  $ cn plugins update [-h] [-v]

FLAGS
  -h, --help     Show CLI help.
  -v, --verbose

DESCRIPTION
  Update installed plugins.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/update.ts)_
<!-- commandsstop -->