CLI

A command-line interface that runs anywhere

Below is a full list of CLI commands.

General Options

The below options can be run with any command.

Note: The --workdir command is made only for development purposes. We don’t recommend using this option in your normal workflows.

napi [command]

Options:
  --help           Show help             [boolean]
  --version        Show version number   [boolean]
  --workdir, --wd  working directory     [string] [default: "/your/current/directory"]

napi login

The login command works to connect your cloud account with the CLI. Similar to tools like Pulumi, this enables a seamless interaction between your workspaces and manifests.

Options

  • --api-host: [Optional] The url of the backend to login to. Defaults to https://api.nanoapi.io .

  • --api-token: [Optional] An API token to use for authentication. This flow is to enable the CLI to run in CI environments such as Github Actions.

Basic Execution

napi login

Sends an email to the specified email address with a one-time login code

Examples

napi login --api-host=https://your.self-hosted.api.com # Login with self-hosting

napi login --api-token=**-***-* # Login with a user-level token

napi init

The init command runs in the current directory by default and outputs a .napirc file. These files are used so the tool can understand your codebases. Alongside this, the init command will also ask you to create or select a project to upload the mainfests to.

Options

The init command takes no specific arguments beyond the general options.

Basic Execution

napi init

initialize a NanoAPI project

Examples

napi init # Run in the current directory

napi init --help # Show command info

napi init --workdir=/path/to/your/project # Run init in a specific directory

napi manifest generate

The manifest generate command creates the special data structure needed to visualize the architecture of a codebase.

This command not only generates the manifest, but also pushes it to the relevant project. This way the manifests are always in sync.

The command will output a link to view the manifest once the upload is complete.

Options

  • --branch: [Optional] The named branch of this commit. If omitted, the CLI will take the name of the current branch.

  • --commit-sha: [Optional] The commit SHA. If omitted, the CLI will take the current commit SHA.

  • --commit-sha-date: [Optional] The date of the commit. If omitted, the CLI will take first the commit date of the SHA from the logs, else the current date. Note that the CLI requires ISO 8601 format (e.g. 2024-01-01T00:00:00Z).

Basic Execution

napi manifest generate

Generate the manifest for viewing and auditing your system architecture

Examples

# Manually specify all details. Best for CI environments
napi manifest generate --branch=fix/branchname --commit-sha=8b7d630c --commit-sha-date=2024-01-01T00:00:00Z

napi extract

napi extract enables you to extract functionality from codebases into a separate system or codebase. This is how Symbol Extraction runs within the system and this command powers that process.

Options

  • —symbol: accepts a single definition of a symbol in the shape of <filename>|<symbol_name>. This tells napi to extract that functionality and all dependencies into an output codebase. Multiple —symbol invocations are possible for a single run of napi extract.

Basic Execution

napi extract --symbol=app.py|app --symbol=...

Extract the above symbols into an output microservice
Updated on