@kunai-consulting/code-notate
v0.0.2
Published
CLI tools for automatically documenting your code
Downloads
76
Maintainers
Keywords
Readme
@kunai-consulting/code-notate
CLI tools for automatically documenting your code
Installation
$ 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
...Configuration
Create a code-notate.config.js file in your project root where your package.json is located.:
/** @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-1234567890123456789012345678901234567890Commands
cn gen-api [FOLDER]cn gen-docs [FOLDER]cn help [COMMAND]cn pluginscn plugins add PLUGINcn plugins:inspect PLUGIN...cn plugins install PLUGINcn plugins link PATHcn plugins remove [PLUGIN]cn plugins resetcn plugins uninstall [PLUGIN]cn plugins unlink [PLUGIN]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-apiSee code: 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-docsSee code: 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
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 pluginsSee code: @oclif/plugin-plugins
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/someplugincn 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 mypluginSee code: @oclif/plugin-plugins
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/somepluginSee code: @oclif/plugin-plugins
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 mypluginSee code: @oclif/plugin-plugins
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 myplugincn 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
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 mypluginSee code: @oclif/plugin-plugins
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 myplugincn 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
