Skip to content
Back to search

napi

Software architecture tooling for the AI age

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/nanoapi-io--napi/badge.svg)](/listings/nanoapi-io--napi)

HTML

<a href="/listings/nanoapi-io--napi"><img src="/api/listings/nanoapi-io--napi/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

These steps run a script from the network that findsafeskills does not scan.

Unix (macOS, Linux)

curl -fsSL https://raw.githubusercontent.com/nanoapi-io/napi/refs/heads/main/install_scripts/install.sh | bash

Or download a binary directly from [GitHub Releases](https://github.com/nanoapi-io/napi/releases/latest).

Windows

Use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) to run napi. Native Windows support is in progress.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 308 lines · 2 findings marked

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. ![NanoAPI Banner](/media/github-banner.png)
  2. # napi - Better Software Architecture for the AI Age
  3. `napi` is a fully offline CLI that analyzes your codebase's architecture --
  4. dependencies, complexity, and structure -- then lets you visualize and refactor
  5. it, all without sending your code anywhere.
  6. It generates dependency manifests from your source code, stores them locally,
  7. and serves an interactive graph visualizer directly from the CLI.
  8. ![NanoAPI UI Overview](/media/hero-app.png)
  9. ## Features
  10. - **🔍 Dependency Analysis**: Map every file, symbol, and dependency in your
  11. codebase automatically.
  12. - **🚨 Audit**: Detect files and symbols that exceed complexity, size, or
  13. coupling thresholds.
  14. - **📊 Interactive Visualizer**: Explore your architecture through Cytoscape.js
  15. graphs served locally in your browser.
  16. - **📝 Symbol Extraction**: Extract specific functions, classes, or symbols into
  17. standalone files for refactoring.
  18. - **🏷️ AI Labeling** (optional): Use OpenAI, Google, or Anthropic models to
  19. auto-label dependencies.
  20. - **⚙️ CI/CD Ready**: Integrates into any pipeline -- generate manifests on
  21. every push and track architecture over time.
  22. - **🔒 Fully Offline**: No accounts, no servers, no data leaves your machine.
  23. ## Supported Languages
  24. | Language | Status |
  25. | -------- | -------------- |
  26. | Python | ✅ Supported |
  27. | C# | ✅ Supported |
  28. | C | ✅ Supported |
  29. | Java | ✅ Supported |
  30. | C++ | 🚧 In Progress |
  31. | PHP | 🚧 In Progress |
  32. | JS/TS | 🚧 In Progress |
  33. ## Installation
  34. ### Unix (macOS, Linux)
  35. ```bash
  36. curl -fsSL https://raw.githubusercontent.com/nanoapi-io/napi/refs/heads/main/install_scripts/install.sh | bash
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 47 on GitHub
  37. ```
  38. Or download a binary directly from
  39. [GitHub Releases](https://github.com/nanoapi-io/napi/releases/latest).
  40. ### Windows
  41. Use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) to run napi.
  42. Native Windows support is in progress.
  43. ## Quick Start
  44. ```bash
  45. # 1. Initialize your project (creates .napirc)
  46. napi init
  47. # 2. Generate a dependency manifest
  48. napi generate
  49. # 3. Open the visualizer in your browser
  50. napi view
  51. ```
  52. That's it. Your manifest is saved locally in `.napi/manifests/` and the
  53. visualizer opens at `http://localhost:3000`.
  54. ## CLI Commands
  55. ### `napi init`
  56. Interactive setup that creates a `.napirc` configuration file in your project
  57. root.
  58. Prompts you for:
  59. - **Language** -- Python, C#, C, or Java
  60. - **Include/exclude patterns** -- which files to analyze
  61. - **Output directory** -- where extracted symbols are written
  62. - **AI labeling** (optional) -- provider and concurrency settings
  63. ```bash
  64. napi init
  65. ```
  66. ### `napi generate`
  67. Analyzes your codebase and generates a dependency manifest. The manifest
  68. captures every file, symbol, dependency, and metric (lines, complexity,
  69. coupling).
  70. Manifests are saved as JSON files in `.napi/manifests/` with the naming pattern
  71. `{timestamp}-{commitSha}.json`.
  72. ```bash
  73. # Interactive (prompts for branch/commit if not in git)
  74. napi generate
  75. # Non-interactive (for CI)
  76. napi generate --branch main --commit-sha abc1234 --commit-sha-date 2026-01-01T00:00:00Z
  77. ```
  78. Options:
  79. - `--branch` -- Git branch name (auto-detected if omitted)
  80. - `--commit-sha` -- Git commit hash (auto-detected if omitted)
  81. - `--commit-sha-date` -- Commit date in ISO 8601 format (auto-detected if
  82. omitted)
  83. - `--labelingApiKey` -- API key for AI labeling (overrides global config)
  84. ### `napi view`
  85. Starts a local web server and opens an interactive dependency visualizer in your
  86. browser.
  87. ```bash
  88. napi view
  89. napi view --port 8080
  90. ```
  91. The viewer provides:
  92. - **Manifest list** -- browse all locally stored manifests by branch, commit,
  93. and date
  94. - **Project graph** -- file-level dependency map with Cytoscape.js
  95. - **File graph** -- symbol-level view within a file (functions, classes,
  96. variables)
  97. - **Symbol graph** -- transitive dependency chain for a specific symbol
  98. - **File explorer sidebar** -- navigate your codebase structure
  99. - **Audit alerts** -- visual indicators for files/symbols exceeding thresholds
  100. ### `napi extract`
  101. Extracts specific symbols from your codebase into separate files using a local
  102. manifest.
  103. ```bash
  104. # Extract a function from a specific file
  105. napi extract --symbol "src/auth/login.py|authenticate"
  106. # Extract multiple symbols
  107. napi extract --symbol "src/models.py|User" --symbol "src/models.py|Session"
  108. # Use a specific manifest (defaults to latest)
  109. napi extract --symbol "src/main.py|run" --manifestId 1712500000000-a1b2c3d
  110. ```
  111. Output is written to `{outDir}/extracted-{timestamp}/`.
  112. ### `napi set apiKey`
  113. Configure API keys for AI-powered dependency labeling. Keys are stored in the
  114. global config (not in your project).
  115. ```bash
  116. napi set apiKey
  117. ```
  118. Prompts for:
  119. - **Provider** -- Google, OpenAI, or Anthropic
  120. - **API key** -- your provider API key
  121. ## Local Manifest Storage
  122. All manifests are stored in `.napi/manifests/` relative to your project root.
  123. Each manifest is a self-contained JSON file:
  124. ```json
  125. {
  126. "id": "1712500000000-a1b2c3d",
  127. "branch": "main",
  128. "commitSha": "a1b2c3d4e5f6...",
  129. "commitShaDate": "2026-04-07T10:00:00Z",
  130. "createdAt": "2026-04-07T10:01:00Z",
  131. "manifest": {}
  132. }
  133. ```
  134. Add `.napi/` to your `.gitignore` or commit it to track architecture history in
  135. version control -- your choice.
  136. ## CI/CD Integration
  137. Generate manifests automatically on every push:
  138. ```yaml
  139. # .github/workflows/napi.yml
  140. name: Generate Manifest
  141. on: [push]
  142. jobs:
  143. manifest:
  144. runs-on: ubuntu-latest
  145. steps:
  146. - uses: actions/checkout@v4
  147. - name: Install napi
  148. run: curl -fsSL https://raw.githubusercontent.com/nanoapi-io/napi/refs/heads/main/install_scripts/install.sh | bash
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 204 on GitHub
  149. - name: Generate manifest
  150. run: napi generate --branch ${{ github.ref_name }} --commit-sha ${{ github.sha }} --commit-sha-date "$(git log -1 --format=%cI)"
  151. ```
  152. ## Configuration Reference
  153. ### `.napirc`
  154. Project-level configuration created by `napi init`:
  155. ```json
  156. {
  157. "language": "python",
  158. "python": { "version": "3.10" },
  159. "project": {
  160. "include": ["src/**/*.py"],
  161. "exclude": [".git/**", "**/__pycache__/**", "napi_out/**"]
  162. },
  163. "outDir": "napi_out",
  164. "labeling": {
  165. "modelProvider": "openai",
  166. "maxConcurrency": 5
  167. }
  168. }
  169. ```
  170. ### Global Config
  171. Stored in your OS config directory (`~/.config/napi/config.json` on Linux,
  172. `~/Library/Application Support/napi/config.json` on macOS). Managed via
  173. `napi set apiKey`.
  174. ```json
  175. {
  176. "labeling": {
  177. "apiKeys": {
  178. "openai": "sk-...",
  179. "google": "AIza...",
  180. "anthropic": "sk-ant-..."
  181. }
  182. }
  183. }
  184. ```
  185. ## Development
  186. Requires [Deno](https://deno.land/) v2.4+.
  187. ```bash
  188. # Install dependencies
  189. deno install --allow-scripts
  190. # Run CLI in dev mode
  191. deno task dev
  192. # Run viewer dev server (hot-reload)
  193. deno task dev:viewer
  194. # Build viewer for production
  195. deno task build:viewer
  196. # Compile binary (includes viewer)
  197. deno task compile
  198. # Run tests
  199. deno task test
  200. # Lint
  201. deno lint
  202. # Format
  203. deno fmt
  204. ```
  205. ## Contributing
  206. We welcome contributions from the community. Please read our
  207. [contributing guide](https://github.com/nanoapi-io/napi/blob/main/.github/CONTRIBUTING.md)
  208. for details on how to get involved.
  209. ## License
  210. `napi` is licensed under the
  211. [Sustainable Use License](https://github.com/nanoapi-io/napi/blob/main/LICENSE.md).
  212. ## Further Reading
  213. - [Automating the Strangler Pattern with Microlithic Development](https://medium.com/@joel_40950/automating-the-strangler-pattern-with-microlithic-development-241e4e0dd79b)
  214. - [Rise of the "Microlith": Rethinking Microservices for Modern Developers](https://dev.to/nanojoel/open-sourcing-nanoapi-rethinking-microservices-for-modern-developers-14m2)
  215. ## Donations
  216. NanoAPI is a fair-source project. Because of this, we feel it would be unethical
  217. to keep any donations to ourselves. Instead, here is how we will handle
  218. donations:
  219. - Donations go into a pool
  220. - Money from the pool will be distributed to contributors
  221. - At the end of the year, any remaining money will be donated to a charity of
  222. the community's choice
  223. We will post regular updates on how much money is in the pool and how it is
  224. being distributed.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.