Showing preview only (1,654K chars total). Download the full file or copy to clipboard to get everything.
Repository: nanoapi-io/napi
Branch: main
Commit: 1827e3b087e5
Files: 308
Total size: 1.5 MB
Directory structure:
gitextract_l1fkgvec/
├── .github/
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.md
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ └── feature_request.md
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── SECURITY.md
│ └── workflows/
│ ├── lint_test_compile.yml
│ └── release.yml
├── .gitignore
├── .vscode/
│ └── settings.json
├── CLA/
│ ├── CORPORATE_CONTRIBUTOR_LICENSE_AGREEMENT.md
│ └── INDIVIDUAL_CONTRIBUTOR_LICENSE_AGREEMENT.md
├── LICENSE.md
├── LICENSE_EE.md
├── README.md
├── SUPPORT.md
├── USERS.md
├── WEEKLY_UPDATE_LOG.md
├── deno.json
├── examples/
│ ├── README.md
│ ├── c/
│ │ └── network/
│ │ ├── .napirc
│ │ ├── makefile
│ │ └── src/
│ │ ├── cartographie/
│ │ │ ├── cartographie.c
│ │ │ ├── cartographie.h
│ │ │ ├── tnmap.c
│ │ │ └── tnmap.h
│ │ ├── main.c
│ │ └── tcp_cs/
│ │ ├── clientTCP.c
│ │ ├── clientTCP.h
│ │ ├── serveurTCP.c
│ │ └── serveurTCP.h
│ ├── csharp/
│ │ └── EndpointExample/
│ │ ├── .napirc
│ │ ├── EndpointExample.csproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── appsettings.Development.json
│ │ ├── appsettings.json
│ │ └── src/
│ │ ├── MyEndpoint.cs
│ │ ├── MyRequest.cs
│ │ └── MyResponse.cs
│ ├── java/
│ │ └── websocket/
│ │ ├── README.md
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── samples/
│ │ │ │ └── websocket/
│ │ │ │ ├── client/
│ │ │ │ │ ├── GreetingService.java
│ │ │ │ │ ├── SimpleClientWebSocketHandler.java
│ │ │ │ │ └── SimpleGreetingService.java
│ │ │ │ ├── config/
│ │ │ │ │ └── SampleWebSocketsApplication.java
│ │ │ │ ├── echo/
│ │ │ │ │ ├── DefaultEchoService.java
│ │ │ │ │ ├── EchoService.java
│ │ │ │ │ └── EchoWebSocketHandler.java
│ │ │ │ └── snake/
│ │ │ │ ├── Direction.java
│ │ │ │ ├── Location.java
│ │ │ │ ├── Snake.java
│ │ │ │ ├── SnakeTimer.java
│ │ │ │ ├── SnakeUtils.java
│ │ │ │ └── SnakeWebSocketHandler.java
│ │ │ └── resources/
│ │ │ └── static/
│ │ │ ├── echo.html
│ │ │ ├── index.html
│ │ │ └── snake.html
│ │ └── test/
│ │ └── java/
│ │ └── samples/
│ │ └── websocket/
│ │ ├── echo/
│ │ │ ├── CustomContainerWebSocketsApplicationTests.java
│ │ │ └── SampleWebSocketsApplicationTests.java
│ │ └── snake/
│ │ └── SnakeTimerTests.java
│ └── python/
│ └── flask/
│ ├── .napi/
│ │ └── manifests/
│ │ └── 1775598176791-d5c2217.json
│ ├── .napirc
│ ├── api/
│ │ ├── data/
│ │ │ ├── elves.py
│ │ │ └── hobbits.py
│ │ ├── services/
│ │ │ ├── elves.py
│ │ │ └── hobbits.py
│ │ ├── views/
│ │ │ ├── elves.py
│ │ │ └── hobbits.py
│ │ └── wizards/
│ │ ├── data.py
│ │ ├── services.py
│ │ └── views.py
│ ├── app.py
│ └── pyproject.toml
├── install_scripts/
│ ├── install.ps1
│ └── install.sh
├── media/
│ └── README.md
├── scripts/
│ └── get_version.ts
├── src/
│ ├── cli/
│ │ ├── handlers/
│ │ │ ├── extract/
│ │ │ │ └── index.ts
│ │ │ ├── generate/
│ │ │ │ └── index.ts
│ │ │ ├── init/
│ │ │ │ └── index.ts
│ │ │ ├── set/
│ │ │ │ ├── apiKey.ts
│ │ │ │ └── index.ts
│ │ │ └── view/
│ │ │ └── index.ts
│ │ ├── index.ts
│ │ └── middlewares/
│ │ ├── checkVersion.ts
│ │ ├── globalConfig.ts
│ │ └── napiConfig.ts
│ ├── helpers/
│ │ ├── fileSystem/
│ │ │ └── index.ts
│ │ ├── sourceCode/
│ │ │ ├── index.test.ts
│ │ │ └── index.ts
│ │ └── treeSitter/
│ │ └── parsers.ts
│ ├── index.test.ts
│ ├── index.ts
│ ├── languagePlugins/
│ │ ├── c/
│ │ │ ├── README.md
│ │ │ ├── dependencyFormatting/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── types.ts
│ │ │ ├── extractor/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── headerResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── includeResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── invocationResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── metrics/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── symbolRegistry/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── testFiles/
│ │ │ │ ├── cFiles/
│ │ │ │ │ ├── .clangd
│ │ │ │ │ ├── .napirc
│ │ │ │ │ ├── all.h
│ │ │ │ │ ├── burgers.c
│ │ │ │ │ ├── burgers.h
│ │ │ │ │ ├── crashcases.h
│ │ │ │ │ ├── errors.h
│ │ │ │ │ ├── main.c
│ │ │ │ │ ├── oldman.h
│ │ │ │ │ ├── personnel.c
│ │ │ │ │ └── personnel.h
│ │ │ │ └── index.ts
│ │ │ └── warnings/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ ├── queries.ts
│ │ │ └── types.ts
│ │ ├── csharp/
│ │ │ ├── README.md
│ │ │ ├── dependencyFormatting/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── extensionResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── extractor/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── invocationResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── metricsAnalyzer/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── namespaceMapper/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── namespaceResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── projectMapper/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── testFiles/
│ │ │ │ ├── csharpFiles/
│ │ │ │ │ ├── 2Namespaces1File.cs
│ │ │ │ │ ├── Models.cs
│ │ │ │ │ ├── Namespaced.cs
│ │ │ │ │ ├── Nested.cs
│ │ │ │ │ ├── OtherFileSameNamespace.cs
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ ├── SemiNamespaced.cs
│ │ │ │ │ ├── Subfolder/
│ │ │ │ │ │ ├── GlobalUsings.cs
│ │ │ │ │ │ └── TestFiles.Subfolder.csproj
│ │ │ │ │ ├── TestFiles.csproj
│ │ │ │ │ └── Usage.cs
│ │ │ │ └── index.ts
│ │ │ └── usingResolver/
│ │ │ ├── index.test.ts
│ │ │ └── index.ts
│ │ ├── java/
│ │ │ ├── dependencyFormatting/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── types.ts
│ │ │ ├── extractor/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── types.ts
│ │ │ ├── importResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── types.ts
│ │ │ ├── invocationResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── metrics/
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── packageMapper/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── types.ts
│ │ │ ├── packageResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ └── testFiles/
│ │ │ ├── constants.ts
│ │ │ ├── index.ts
│ │ │ └── napi-tests/
│ │ │ ├── .project
│ │ │ └── src/
│ │ │ └── main/
│ │ │ └── java/
│ │ │ └── io/
│ │ │ └── nanoapi/
│ │ │ └── testfiles/
│ │ │ ├── App.java
│ │ │ ├── food/
│ │ │ │ ├── Burger.java
│ │ │ │ ├── Condiment.java
│ │ │ │ ├── DoubleBurger.java
│ │ │ │ ├── Food.java
│ │ │ │ ├── Steak.java
│ │ │ │ └── goron/
│ │ │ │ └── Pebble.java
│ │ │ └── medication/
│ │ │ └── Wormkiller.java
│ │ └── python/
│ │ ├── dependencyResolver/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── exportExtractor/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── importExtractor/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── itemResolver/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── metricAnalyzer/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── moduleResolver/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── symbolExtractor/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ └── usageResolver/
│ │ ├── index.test.ts
│ │ ├── index.ts
│ │ └── types.ts
│ ├── manifest/
│ │ ├── auditManifest/
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ └── dependencyManifest/
│ │ ├── c/
│ │ │ └── index.ts
│ │ ├── csharp/
│ │ │ ├── index.test.ts
│ │ │ └── index.ts
│ │ ├── index.ts
│ │ ├── java/
│ │ │ └── index.ts
│ │ ├── labeling/
│ │ │ ├── graph.ts
│ │ │ ├── grouping.ts
│ │ │ ├── index.ts
│ │ │ ├── model.ts
│ │ │ └── types.ts
│ │ ├── python/
│ │ │ └── index.ts
│ │ └── types.ts
│ ├── scripts/
│ │ └── generate_python_stdlib_list/
│ │ ├── output.json
│ │ └── script.sh
│ └── symbolExtractor/
│ ├── c/
│ │ └── index.ts
│ ├── csharp/
│ │ └── index.ts
│ ├── index.ts
│ ├── java/
│ │ └── index.ts
│ ├── python/
│ │ └── index.ts
│ └── types.ts
└── viewer/
├── .gitignore
├── README.md
├── index.html
├── src/
│ ├── App.tsx
│ ├── api.ts
│ ├── components/
│ │ ├── DependencyVisualizer/
│ │ │ ├── DependencyVisualizer.tsx
│ │ │ ├── components/
│ │ │ │ ├── BreadcrumbNav.tsx
│ │ │ │ ├── DisplayNameWithTooltip.tsx
│ │ │ │ ├── FileExplorerSidebar.tsx
│ │ │ │ ├── SymbolExtractionDialog.tsx
│ │ │ │ ├── contextMenu/
│ │ │ │ │ ├── FileContextMenu.tsx
│ │ │ │ │ └── SymbolContextMenu.tsx
│ │ │ │ ├── controls/
│ │ │ │ │ ├── ControlExtensions/
│ │ │ │ │ │ ├── FiltersExtension.tsx
│ │ │ │ │ │ ├── GraphDepthExtension.tsx
│ │ │ │ │ │ └── MetricsExtension.tsx
│ │ │ │ │ └── Controls.tsx
│ │ │ │ └── detailsPanes/
│ │ │ │ ├── AlertBadge.tsx
│ │ │ │ ├── FileDetailsPane.tsx
│ │ │ │ ├── Metrics.tsx
│ │ │ │ └── SymbolDetailsPane.tsx
│ │ │ └── visualizers/
│ │ │ ├── FileVisualizer.tsx
│ │ │ ├── ProjectVisualizer.tsx
│ │ │ └── SymbolVisualizer.tsx
│ │ └── shadcn/
│ │ ├── Alert.tsx
│ │ ├── Breadcrumb.tsx
│ │ ├── Button.tsx
│ │ ├── Card.tsx
│ │ ├── Dialog.tsx
│ │ ├── Dropdownmenu.tsx
│ │ ├── Input.tsx
│ │ ├── Label.tsx
│ │ ├── Scrollarea.tsx
│ │ ├── Separator.tsx
│ │ ├── Sheet.tsx
│ │ ├── Sidebar.tsx
│ │ ├── Skeleton.tsx
│ │ ├── Slider.tsx
│ │ ├── Tooltip.tsx
│ │ └── hooks/
│ │ └── use-mobile.tsx
│ ├── contexts/
│ │ └── ThemeProvider.tsx
│ ├── cytoscape/
│ │ ├── elements/
│ │ │ ├── file.ts
│ │ │ ├── project.ts
│ │ │ ├── symbol.ts
│ │ │ └── types.ts
│ │ ├── fileDependencyVisualizer/
│ │ │ └── index.ts
│ │ ├── label/
│ │ │ └── index.ts
│ │ ├── layout/
│ │ │ └── index.ts
│ │ ├── metrics/
│ │ │ └── index.ts
│ │ ├── projectDependencyVisualizer/
│ │ │ └── index.ts
│ │ ├── styles/
│ │ │ └── index.ts
│ │ └── symbolDependencyVisualizer/
│ │ └── index.ts
│ ├── index.css
│ ├── lib/
│ │ └── utils.ts
│ ├── main.tsx
│ ├── pages/
│ │ ├── ManifestList.tsx
│ │ └── ManifestView.tsx
│ └── types/
│ ├── auditManifest.ts
│ └── dependencyManifest.ts
└── vite.config.ts
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/CODE_OF_CONDUCT.md
================================================
## Code of Conduct
### Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of
experience, nationality, personal appearance, race, religion, or sexual identity
and orientation.
### Our Standards
Examples of behavior that contributes to creating a positive environment
include:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
- Other conduct which falls outside of
[NanoAPI's Open-Source Manifesto](https://github.com/Nano-API/oss-manifesto/blob/main/README.md)
### Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.
### Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at
[info@nanoapi.io](mailto:info@nanoapi.io). All complaints will be reviewed and
investigated and will result in a response that is deemed necessary and
appropriate to the circumstances. The project team is obligated to maintain
confidentiality with regard to the reporter of an incident. Further details of
specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
### Attribution
This Code of Conduct is adapted from the
[ncc CoC](https://github.com/vercel/ncc/blob/main/CODE_OF_CONDUCT.md) which is
itself adapted from the [Contributor Covenant][homepage], version 1.4, available
at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
================================================
FILE: .github/CONTRIBUTING.md
================================================
# How to Contribute to NanoAPI
## Contributor License Agreement
<!-- This section always comes first -->
- By submitting code as an individual you agree to the
[individual contributor license agreement](/CLA/INDIVIDUAL_CONTRIBUTOR_LICENSE_AGREEMENT.md).
- By submitting code as an entity you agree to the
[corporate contributor license agreement](/CLA/CORPORATE_CONTRIBUTOR_LICENSE_AGREEMENT.md).
## Housekeeping
First off, thank you for being here. You dropped this: 👑
Here are some guidelines to help you get started contributing to NanoAPI.
1. Follow our [Code of Conduct](/.github/CODE_OF_CONDUCT.md).
2. Check for open issues before creating a new one.
3. We require an open issue for all pull requests.
4. Help others by reviewing their pull requests.
5. All donations we receive go directly back to our contributors. We’re here to
support you when you successfully submit a PR to us. Your efforts help the
community grow, and we want to give back to those who help make that
possible!
## How to File Issues
Make use of the issue templates, and label your issues appropriately. If you’re
unsure about which label to use, don’t worry! We will help you choose the right
one.
## How to Submit a Pull Request
1. Don't panic.
2. Ensure an issue exists for the changes you want to make.
3. Fork the repository.
4. Create a new branch.
5. Make your changes.
6. Test your changes.
7. Push your changes to your fork.
1. Make sure to rebase before pushing.
8. Submit a pull request.
9. Follow the template and fill in all the sections.
10. Wait for feedback.
11. Make changes if necessary.
12. Celebrate your success after your PR gets merged. The Codex Astartes
supports this action.
## Development Environment
You will need the following tools to develop NanoAPI:
- [Node.js](https://nodejs.org/en/) version 22 or higher.
### Environment Set Up
We use the fork-and-pull model for contributions. Here’s how you can set up your
development environment:
1. Fork the repository.
2. Clone your fork locally:
```bash
$ git clone https://github.com/<your_username>/napi.git
```
3. Enter the folder:
```bash
$ cd napi
```
4. Add the original repository as a remote:
```bash
$ git remote add upstream https://github.com/nanoapi-io/napi.git
```
5. Install the dependencies:
```bash
$ npm install
```
> [!NOTE]
> You may encounter issues on a second or third install of dependencies. If this
> happens, install with `npm i --no-cache --force` to fix these issues.
### Running the Project
When running locally, the shared libraries and the UI must be built before the
CLI can be run.
To build them:
```bash
$ npm run build
```
Next, we want to run the CLI and the UI with hot reload. You will need two
terminal windows for this.
1. In the first terminal, run the CLI. This command should be run in the `napi`
directory with a `workdir` pointing to the project you want to work on. For
example, if you want to work on Apache Airflow, run:
```bash
$ npm run dev:cli -- audit view -- --workdir=/path/to/airflow
```
Running the `audit view` command from the CLI will spin up a web server on your
localhost. You can access the UI by navigating to `http://localhost:3000`.
> [!NOTE]
> In case of port collisions, the UI will automatically switch to the next
> available port.
2. In the second terminal, run the UI. This command should be run in the `napi`
directory as well:
```bash
$ npm run dev:app
```
This controls the hot reload functionality for the UI. You can now make changes
to the UI and see them reflected in real-time.
> [!IMPORTANT]
> The react UI elements (sidebar, header, etc.) will automatically reload when
> you make changes. However any Cytoscape elements will not. You will need to
> refresh the page to see those changes.
### Project Setup
You can use any project (in a supported language) to test the CLI. There are
some steps that must be taken to set up the project:
1. Clone or CD to the repo you want to work on/test with. For this example we'll
use Apache Airflow.
```bash
git clone https://github.com/apache/airflow.git
cd airflow
```
2. From the `napi` repo initialize the project using the CLI, which will create
a `.napirc` file in the project root. This file contains the configuration
for the project and is required for the CLI to work.:
```bash
cd /path/to/napi # or just use a different terminal
npm start -- init -- --workdir=/path/to/airflow
```
> [!NOTE]
> If you encounter any issues with the config file, you can
> [check the reference for the file on our documentation](https://docs.nanoapi.io/default-guide/reference/napirc).
### Testing
```bash
$ npm test
```
### Linting
```bash
$ npm run lint
```
### Release Process
We are currently formalizing the release process. For now, the NanoAPI team will
handle making regular releases.
To ensure releases run smoothly, put the content of your changes in our
[CHANGELOG](/packages/cli/CHANGELOG.md) file.
### Documentation
We are also building on the documentation process. For now, include any
documentation changes in your PRs and we will add them into the main
documentation.
The critical documentation to maintain is for any changes that impact the
following:
- CLI commands
- Configuration file
- Local development setup
- Release process
- Testing
- Linting
### Discussions vs Issues
We use GitHub Discussions for general questions, ideas, and feedback. If you
have a question, please use the Discussions tab. If you have a bug report or
feature request, please use the Issues tab.
---
That's it for this guide for now. So long, and thanks for all the fish! 🚀
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report for a bug, regression, or unexpected behavior
title: "[BUG] "
labels: bug
assignees: ""
---
<!--- Provide a general summary of the issue in the Title above -->
## Description
<!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug -->
## Expected Behavior
<!--- Tell us what should happen -->
## Actual Behavior
<!--- Tell us what happens instead -->
## Possible Fix
<!--- Not obligatory, but suggest a fix or reason for the bug -->
## Steps to Reproduce
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1.
2.
3.
4.
## Context
<!--- How has this bug affected you? What were you trying to accomplish? -->
## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
- Version used:
- Environment name and version (e.g. Chrome 39, node.js 5.4):
- Operating System and version (desktop or mobile):
- Link to your project:
### Config File
Paste your `.napirc` below
```json
{
"your": "config"
}
```
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: "[FEATURE] "
labels: enhancement
assignees: ""
---
<!--- Provide a general summary of the issue in the Title above -->
## Detailed Description
<!--- Provide a detailed description of the change or addition you are proposing -->
## Context
<!--- Why is this change important to you? How would you use it? -->
<!--- How can it benefit other users? -->
## Possible Implementation
<!--- Not obligatory, but suggest an idea for implementing addition or change -->
## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
- Version used:
- Environment name and version (e.g. Chrome 39, node.js 5.4):
- Operating System and version (desktop or mobile):
- Link to your project:
### Config File
Paste your `.napirc` below
```json
{
"your": "config"
}
```
================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
## Type of change
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to
not work as expected)
- [ ] Documentation update
## Description
Please include a summary of the changes and the related issue. Explain the
motivation behind this change.
## Related Issue
<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->
Issue Number: #<issue_number>
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->
## Screenshots (if appropriate):
## Checklist
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] I have read the [contributing guidelines](CONTRIBUTING.md)
- [ ] My code follows the code style of this project.
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] Any dependent changes have been merged and published
================================================
FILE: .github/SECURITY.md
================================================
# Security Policy
Please report any suspected security vulnerabilities privately to
[security@nanoapi.io](mailto:security@nanoapi.io). Please do NOT create publicly
viewable issues for suspected security vulnerabilities.
We will acknowledge receipt of your vulnerability report as soon as possible and
strive to send you regular updates about our progress. If you're curious about
the status of your disclosure please feel free to email us again. If you want to
encrypt your disclosure email please email us to ask for our PGP key.
Please refrain from requesting compensation for reporting vulnerabilities. If
you want we will publicly acknowledge your responsible disclosure. We also try
to make the issue public after the vulnerability is announced. Usually bug
reports are made public after 72 hours, if possible.
You are not allowed to search for security vulnerabilities on any hosted service
of NanoAPI without the consent of the party hosting it. NanoAPI is open source
software and can be installed for testing and security issues on your own
infrastructure.
================================================
FILE: .github/workflows/lint_test_compile.yml
================================================
name: Lint, tests and build
on:
push:
branches-ignore: ["main"]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Deno
uses: denoland/setup-deno@v2
with:
deno-version: "2.4.0"
- name: Install dependencies
run: |
deno install --allow-scripts --reload
- name: Deno lint
run: deno lint
- name: Deno fmt (check)
run: deno fmt --check
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Deno
uses: denoland/setup-deno@v2
with:
deno-version: "2.4.0"
- name: Install dependencies
run: |
deno install --allow-scripts --reload
- name: Tests
run: deno test -A
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Deno
uses: denoland/setup-deno@v2
with:
deno-version: "2.4.0"
- name: Install dependencies
run: |
deno install --allow-scripts --reload
- name: Compile
run: deno task compile:all
================================================
FILE: .github/workflows/release.yml
================================================
name: Release Packages
permissions:
contents: write
packages: write
on: [workflow_dispatch]
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Deno
uses: denoland/setup-deno@v2
with:
deno-version: "2.4.0"
- name: Get new version and bump deno.json
id: get_version
run: |
VERSION=$(deno run -A scripts/get_version.ts)
echo "release_version=$VERSION" >> $GITHUB_OUTPUT
- name: Install dependencies
run: |
deno install --reload --allow-scripts
- name: Compile
run: |
deno task compile:all
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.get_version.outputs.release_version }}
files: |
dist/*
================================================
FILE: .gitignore
================================================
node_modules
dist
.env
napi_dist
__pycache__
.ruff_cache
.OPENAIKEY
examples/csharp/EndpointExample/obj
examples/csharp/EndpointExample/bin
src/languagePlugins/csharp/testFiles/csharpFiles/**/obj
napi.sln
examples/csharp/EndpointExample/bin
auditResponse.json
.extracted/
napi-output/
coverage/
.vite/
.mvn/
target/
.settings/
.classpath
================================================
FILE: .vscode/settings.json
================================================
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "denoland.vscode-deno"
}
================================================
FILE: CLA/CORPORATE_CONTRIBUTOR_LICENSE_AGREEMENT.md
================================================
# Corporate contributor license agreement
You accept and agree to the following terms and conditions for Your present and
future Contributions submitted to Nano API B.V. Except for the license granted
herein to Nano API B.V. and recipients of software distributed by Nano API B.V.,
You reserve all right, title, and interest in and to Your Contributions.
1. Definitions.
"You" (or "Your") shall mean the copyright owner or legal entity authorized
by the copyright owner that is making this Agreement with Nano API B.V. For
legal entities, the entity making a Contribution and all other entities that
control, are controlled by, or are under common control with that entity are
considered to be a single Contributor. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the direction or
management of such entity, whether by contract or otherwise, or (ii)
ownership of fifty percent (50%) or more of the outstanding shares, or (iii)
beneficial ownership of such entity.
"Contribution" shall mean the code, documentation or other original works of
authorship, including any modifications or additions to an existing work,
that is submitted by You to Nano API B.V. for inclusion in, or documentation
of, any of the products owned or managed by Nano API B.V. (the "Work"). For
the purposes of this definition, "submitted" means any form of electronic,
verbal, or written communication sent to Nano API B.V. or its
representatives, including but not limited to communication on electronic
mailing lists, source code control systems, and issue tracking systems that
are managed by, or on behalf of, Nano API B.V. for the purpose of discussing
and improving the Work, but excluding communication that is conspicuously
marked or otherwise designated in writing by You as "Not a Contribution."
2. Grant of Copyright License.
Subject to the terms and conditions of this Agreement, You hereby grant to Nano
API B.V. and to recipients of software distributed by Nano API B.V. a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license
to reproduce, prepare derivative works of, publicly display, publicly perform,
sublicense, and distribute Your Contributions and such derivative works.
3. Grant of Patent License.
Subject to the terms and conditions of this Agreement, You hereby grant to Nano
API B.V. and to recipients of software distributed by Nano API B.V. a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated
in this section) patent license to make, have made, use, offer to sell, sell,
import, and otherwise transfer the Work, where such license applies only to
those patent claims licensable by You that are necessarily infringed by Your
Contribution(s) alone or by combination of Your Contribution(s) with the Work to
which such Contribution(s) was submitted. If any entity institutes patent
litigation against You or any other entity (including a cross-claim or
counterclaim in a lawsuit) alleging that your Contribution, or the Work to which
you have contributed, constitutes direct or contributory patent infringement,
then any patent licenses granted to that entity under this Agreement for that
Contribution or Work shall terminate as of the date such litigation is filed.
1. You represent that You are legally entitled to grant the above license. You
represent further that each of Your employees is authorized to submit
Contributions on Your behalf, but excluding employees that are designated in
writing by You as "Not authorized to submit Contributions on behalf of [name
of Your corporation here]." Such designations of exclusion for unauthorized
employees are to be submitted via email to
[legal@nanoapi.io](mailto:legal@nanoapi.io).
2. You represent that each of Your Contributions is Your original creation (see
section 7 for submissions on behalf of others).
3. You are not expected to provide support for Your Contributions, except to the
extent You desire to provide support. You may provide support for free, for a
fee, or not at all. Unless required by applicable law or agreed to in
writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including,
without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
4. Should You wish to submit work that is not Your original creation, You may
submit it to Nano API B.V. separately from any Contribution, identifying the
complete details of its source and of any license or other restriction
(including, but not limited to, related patents, trademarks, and license
agreements) of which you are personally aware, and conspicuously marking the
work as "Submitted on behalf of a third-party: [named here]".
5. It is Your responsibility to notify Nano API B.V. when any change is required
to the list of designated employees excluded from submitting Contributions on
Your behalf per Section 4. Such notification should be sent via email to
[legal@nanoapi.io](mailto:legal@nanoapi.io).
This text is licensed under the
[Creative Commons Attribution 3.0 License](https://creativecommons.org/licenses/by/3.0/)
and the original source is the Google Open Source Programs Office.
================================================
FILE: CLA/INDIVIDUAL_CONTRIBUTOR_LICENSE_AGREEMENT.md
================================================
# Individual contributor license agreement
You accept and agree to the following terms and conditions for Your present and
future Contributions submitted to Nano API B.V. Except for the license granted
herein to Nano API B.V. and recipients of software distributed by Nano API B.V.,
You reserve all right, title, and interest in and to Your Contributions.
1. Definitions.
"You" (or "Your") shall mean the copyright owner or legal entity authorized
by the copyright owner that is making this Agreement with Nano API B.V. For
legal entities, the entity making a Contribution and all other entities that
control, are controlled by, or are under common control with that entity are
considered to be a single Contributor. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the direction or
management of such entity, whether by contract or otherwise, or (ii)
ownership of fifty percent (50%) or more of the outstanding shares, or (iii)
beneficial ownership of such entity.
"Contribution" shall mean any original work of authorship, including any
modifications or additions to an existing work, that is intentionally
submitted by You to Nano API B.V. for inclusion in, or documentation of, any
of the products owned or managed by Nano API B.V. (the "Work"). For the
purposes of this definition, "submitted" means any form of electronic,
verbal, or written communication sent to Nano API B.V. or its
representatives, including but not limited to communication on electronic
mailing lists, source code control systems, and issue tracking systems that
are managed by, or on behalf of, Nano API B.V. for the purpose of discussing
and improving the Work, but excluding communication that is conspicuously
marked or otherwise designated in writing by You as "Not a Contribution."
2. Grant of Copyright License. Subject to the terms and conditions of this
Agreement, You hereby grant to Nano API B.V. and to recipients of software
distributed by Nano API B.V. a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable copyright license to reproduce, prepare
derivative works of, publicly display, publicly perform, sublicense, and
distribute Your Contributions and such derivative works.
3. Grant of Patent License. Subject to the terms and conditions of this
Agreement, You hereby grant to Nano API B.V. and to recipients of software
distributed by Nano API B.V. a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this section)
patent license to make, have made, use, offer to sell, sell, import, and
otherwise transfer the Work, where such license applies only to those patent
claims licensable by You that are necessarily infringed by Your
Contribution(s) alone or by combination of Your Contribution(s) with the Work
to which such Contribution(s) was submitted. If any entity institutes patent
litigation against You or any other entity (including a cross-claim or
counterclaim in a lawsuit) alleging that your Contribution, or the Work to
which you have contributed, constitutes direct or contributory patent
infringement, then any patent licenses granted to that entity under this
Agreement for that Contribution or Work shall terminate as of the date such
litigation is filed.
4. You represent that you are legally entitled to grant the above license. If
your employer(s) has rights to intellectual property that you create that
includes your Contributions, you represent that you have received permission
to make Contributions on behalf of that employer, that your employer has
waived such rights for your Contributions to Nano API B.V., or that your
employer has executed a separate Corporate CLA with Nano API B.V.
5. You represent that each of Your Contributions is Your original creation (see
section 7 for submissions on behalf of others). You represent that Your
Contribution submissions include complete details of any third-party license
or other restriction (including, but not limited to, related patents and
trademarks) of which you are personally aware and which are associated with
any part of Your Contributions.
6. You are not expected to provide support for Your Contributions, except to the
extent You desire to provide support. You may provide support for free, for a
fee, or not at all. Unless required by applicable law or agreed to in
writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including,
without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT,
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
7. Should You wish to submit work that is not Your original creation, You may
submit it to Nano API B.V. separately from any Contribution, identifying the
complete details of its source and of any license or other restriction
(including, but not limited to, related patents, trademarks, and license
agreements) of which you are personally aware, and conspicuously marking the
work as "Submitted on behalf of a third-party: [insert_name_here]".
8. You agree to notify Nano API B.V. of any facts or circumstances of which you
become aware that would make these representations inaccurate in any respect.
This text is licensed under the
[Creative Commons Attribution 3.0 License](https://creativecommons.org/licenses/by/3.0/)
and the original source is the Google Open Source Programs Office.
================================================
FILE: LICENSE.md
================================================
# License
Portions of this software are licensed as follows:
- Content of branches other than the main branch (i.e. "master") are not
licensed.
- Source code files that contain ".ee." in their filename are NOT licensed under
the Sustainable Use License. To use source code files that contain ".ee." in
their filename you must hold a valid NanoAPI Enterprise License specifically
allowing you access to such source code files and as defined in
"LICENSE_EE.md".
- All third party components incorporated into the NanoAPI Software are licensed
under the original license provided by the owner of the applicable component.
- Content outside of the above mentioned files or restrictions is available
under the "Sustainable Use License" as defined below.
## Sustainable Use License
Version 1.0
### Acceptance
By using the software, you agree to all of the terms and conditions below.
### Copyright License
The licensor grants you a non-exclusive, royalty-free, worldwide,
non-sublicensable, non-transferable license to use, copy, distribute, make
available, and prepare derivative works of the software, in each case subject to
the limitations below.
### Limitations
You may use or modify the software only for your own internal business purposes
or for non-commercial or personal use. You may distribute the software or
provide it to others only if you do so free of charge for non-commercial
purposes. You may not alter, remove, or obscure any licensing, copyright, or
other notices of the licensor in the software. Any use of the licensor’s
trademarks is subject to applicable law.
### Patents
The licensor grants you a license, under any patent claims the licensor can
license, or becomes able to license, to make, have made, use, sell, offer for
sale, import and have imported the software, in each case subject to the
limitations and conditions in this license. This license does not cover any
patent claims that you cause to be infringed by modifications or additions to
the software. If you or your company make any written claim that the software
infringes or contributes to infringement of any patent, your patent license for
the software granted under these terms ends immediately. If your company makes
such a claim, your patent license ends immediately for work on behalf of your
company.
### Notices
You must ensure that anyone who gets a copy of any part of the software from you
also gets a copy of these terms. If you modify the software, you must include in
any modified copies of the software a prominent notice stating that you have
modified the software.
### No Other Rights
These terms do not imply any licenses other than those expressly granted in
these terms.
### Termination
If you use the software in violation of these terms, such use is not licensed,
and your license will automatically terminate. If the licensor provides you with
a notice of your violation, and you cease all violation of this license no later
than 30 days after you receive that notice, your license will be reinstated
retroactively. However, if you violate these terms after such reinstatement, any
additional violation of these terms will cause your license to terminate
automatically and permanently.
### No Liability
As far as the law allows, the software comes as is, without any warranty or
condition, and the licensor will not be liable to you for any damages arising
out of these terms or the use or nature of the software, under any kind of legal
claim.
### Definitions
The “licensor” is the entity offering these terms.
The “software” is the software the licensor makes available under these terms,
including any portion of it.
“You” refers to the individual or entity agreeing to these terms.
“Your company” is any legal entity, sole proprietorship, or other kind of
organization that you work for, plus all organizations that have control over,
are under the control of, or are under common control with that organization.
Control means ownership of substantially all the assets of an entity, or the
power to direct its management and policies by vote, contract, or otherwise.
Control can be direct or indirect.
“Your license” is the license granted to you for the software under these terms.
“Use” means anything you do with the software requiring your license.
“Trademark” means trademarks, service marks, and similar rights.
================================================
FILE: LICENSE_EE.md
================================================
# The NanoAPI Enterprise License (the “Enterprise License”)
Copyright (c) 2024-present Nano API B.V.
With regard to the NanoAPI Software:
This software and associated documentation files (the "Software") may only be
used in production, if you (and any entity that you represent) hold a valid
NanoAPI Enterprise license corresponding to your usage. Subject to the foregoing
sentence, you are free to modify this Software and publish patches to the
Software. You agree that NanoAPI and/or its licensors (as applicable) retain all
right, title and interest in and to all such modifications and/or patches, and
all such modifications and/or patches may only be used, copied, modified,
displayed, distributed, or otherwise exploited with a valid NanoAPI Enterprise
license for the corresponding usage. Notwithstanding the foregoing, you may copy
and modify the Software for development and testing purposes, without requiring
a subscription. You agree that NanoAPI and/or its licensors (as applicable)
retain all right, title and interest in and to all such modifications. You are
not granted any other rights beyond what is expressly stated herein. Subject to
the foregoing, it is forbidden to copy, merge, publish, distribute, sublicense,
and/or sell the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For all third party components incorporated into the NanoAPI Software, those
components are licensed under the original license provided by the owner of the
applicable component.
================================================
FILE: README.md
================================================

# napi - Better Software Architecture for the AI Age
`napi` is a fully offline CLI that analyzes your codebase's architecture --
dependencies, complexity, and structure -- then lets you visualize and refactor
it, all without sending your code anywhere.
It generates dependency manifests from your source code, stores them locally,
and serves an interactive graph visualizer directly from the CLI.

## Features
- **🔍 Dependency Analysis**: Map every file, symbol, and dependency in your
codebase automatically.
- **🚨 Audit**: Detect files and symbols that exceed complexity, size, or
coupling thresholds.
- **📊 Interactive Visualizer**: Explore your architecture through Cytoscape.js
graphs served locally in your browser.
- **📝 Symbol Extraction**: Extract specific functions, classes, or symbols into
standalone files for refactoring.
- **🏷️ AI Labeling** (optional): Use OpenAI, Google, or Anthropic models to
auto-label dependencies.
- **⚙️ CI/CD Ready**: Integrates into any pipeline -- generate manifests on
every push and track architecture over time.
- **🔒 Fully Offline**: No accounts, no servers, no data leaves your machine.
## Supported Languages
| Language | Status |
| -------- | -------------- |
| Python | ✅ Supported |
| C# | ✅ Supported |
| C | ✅ Supported |
| Java | ✅ Supported |
| C++ | 🚧 In Progress |
| PHP | 🚧 In Progress |
| JS/TS | 🚧 In Progress |
## Installation
### Unix (macOS, Linux)
```bash
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.
## Quick Start
```bash
# 1. Initialize your project (creates .napirc)
napi init
# 2. Generate a dependency manifest
napi generate
# 3. Open the visualizer in your browser
napi view
```
That's it. Your manifest is saved locally in `.napi/manifests/` and the
visualizer opens at `http://localhost:3000`.
## CLI Commands
### `napi init`
Interactive setup that creates a `.napirc` configuration file in your project
root.
Prompts you for:
- **Language** -- Python, C#, C, or Java
- **Include/exclude patterns** -- which files to analyze
- **Output directory** -- where extracted symbols are written
- **AI labeling** (optional) -- provider and concurrency settings
```bash
napi init
```
### `napi generate`
Analyzes your codebase and generates a dependency manifest. The manifest
captures every file, symbol, dependency, and metric (lines, complexity,
coupling).
Manifests are saved as JSON files in `.napi/manifests/` with the naming pattern
`{timestamp}-{commitSha}.json`.
```bash
# Interactive (prompts for branch/commit if not in git)
napi generate
# Non-interactive (for CI)
napi generate --branch main --commit-sha abc1234 --commit-sha-date 2026-01-01T00:00:00Z
```
Options:
- `--branch` -- Git branch name (auto-detected if omitted)
- `--commit-sha` -- Git commit hash (auto-detected if omitted)
- `--commit-sha-date` -- Commit date in ISO 8601 format (auto-detected if
omitted)
- `--labelingApiKey` -- API key for AI labeling (overrides global config)
### `napi view`
Starts a local web server and opens an interactive dependency visualizer in your
browser.
```bash
napi view
napi view --port 8080
```
The viewer provides:
- **Manifest list** -- browse all locally stored manifests by branch, commit,
and date
- **Project graph** -- file-level dependency map with Cytoscape.js
- **File graph** -- symbol-level view within a file (functions, classes,
variables)
- **Symbol graph** -- transitive dependency chain for a specific symbol
- **File explorer sidebar** -- navigate your codebase structure
- **Audit alerts** -- visual indicators for files/symbols exceeding thresholds
### `napi extract`
Extracts specific symbols from your codebase into separate files using a local
manifest.
```bash
# Extract a function from a specific file
napi extract --symbol "src/auth/login.py|authenticate"
# Extract multiple symbols
napi extract --symbol "src/models.py|User" --symbol "src/models.py|Session"
# Use a specific manifest (defaults to latest)
napi extract --symbol "src/main.py|run" --manifestId 1712500000000-a1b2c3d
```
Output is written to `{outDir}/extracted-{timestamp}/`.
### `napi set apiKey`
Configure API keys for AI-powered dependency labeling. Keys are stored in the
global config (not in your project).
```bash
napi set apiKey
```
Prompts for:
- **Provider** -- Google, OpenAI, or Anthropic
- **API key** -- your provider API key
## Local Manifest Storage
All manifests are stored in `.napi/manifests/` relative to your project root.
Each manifest is a self-contained JSON file:
```json
{
"id": "1712500000000-a1b2c3d",
"branch": "main",
"commitSha": "a1b2c3d4e5f6...",
"commitShaDate": "2026-04-07T10:00:00Z",
"createdAt": "2026-04-07T10:01:00Z",
"manifest": {}
}
```
Add `.napi/` to your `.gitignore` or commit it to track architecture history in
version control -- your choice.
## CI/CD Integration
Generate manifests automatically on every push:
```yaml
# .github/workflows/napi.yml
name: Generate Manifest
on: [push]
jobs:
manifest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install napi
run: curl -fsSL https://raw.githubusercontent.com/nanoapi-io/napi/refs/heads/main/install_scripts/install.sh | bash
- name: Generate manifest
run: napi generate --branch ${{ github.ref_name }} --commit-sha ${{ github.sha }} --commit-sha-date "$(git log -1 --format=%cI)"
```
## Configuration Reference
### `.napirc`
Project-level configuration created by `napi init`:
```json
{
"language": "python",
"python": { "version": "3.10" },
"project": {
"include": ["src/**/*.py"],
"exclude": [".git/**", "**/__pycache__/**", "napi_out/**"]
},
"outDir": "napi_out",
"labeling": {
"modelProvider": "openai",
"maxConcurrency": 5
}
}
```
### Global Config
Stored in your OS config directory (`~/.config/napi/config.json` on Linux,
`~/Library/Application Support/napi/config.json` on macOS). Managed via
`napi set apiKey`.
```json
{
"labeling": {
"apiKeys": {
"openai": "sk-...",
"google": "AIza...",
"anthropic": "sk-ant-..."
}
}
}
```
## Development
Requires [Deno](https://deno.land/) v2.4+.
```bash
# Install dependencies
deno install --allow-scripts
# Run CLI in dev mode
deno task dev
# Run viewer dev server (hot-reload)
deno task dev:viewer
# Build viewer for production
deno task build:viewer
# Compile binary (includes viewer)
deno task compile
# Run tests
deno task test
# Lint
deno lint
# Format
deno fmt
```
## Contributing
We welcome contributions from the community. Please read our
[contributing guide](https://github.com/nanoapi-io/napi/blob/main/.github/CONTRIBUTING.md)
for details on how to get involved.
## License
`napi` is licensed under the
[Sustainable Use License](https://github.com/nanoapi-io/napi/blob/main/LICENSE.md).
## Further Reading
- [Automating the Strangler Pattern with Microlithic Development](https://medium.com/@joel_40950/automating-the-strangler-pattern-with-microlithic-development-241e4e0dd79b)
- [Rise of the "Microlith": Rethinking Microservices for Modern Developers](https://dev.to/nanojoel/open-sourcing-nanoapi-rethinking-microservices-for-modern-developers-14m2)
## Donations
NanoAPI is a fair-source project. Because of this, we feel it would be unethical
to keep any donations to ourselves. Instead, here is how we will handle
donations:
- Donations go into a pool
- Money from the pool will be distributed to contributors
- At the end of the year, any remaining money will be donated to a charity of
the community's choice
We will post regular updates on how much money is in the pool and how it is
being distributed.
================================================
FILE: SUPPORT.md
================================================
# Support using napi
Welcome to NanoAPI! We use Github for tracking bugs and feature requests. There
are helpful volunteers who may be able to help you.
If it happens that you know the solution to an existing bug, please first open
the issue in order to keep track of it. Afterwards open the relevant pull/merge
request that potentially fixes it.
Please remember this is a community project and you are not entitled to free
support. Be kind to anyone helping out.
For commercial support reach out to [info@nanoapi.io](mailto:info@nanoapi.io).
## Documentation
- [User Documentation](https://nanoapi.io/docs)
================================================
FILE: USERS.md
================================================
- [Ainur](https://ainurhq.cloud/)
================================================
FILE: WEEKLY_UPDATE_LOG.md
================================================
# Weekly Update Log
This log tracks significant changes, improvements, and new features implemented
in the NAPI project on a weekly basis. It serves as a quick reference for team
members and users to stay informed about the project's progress and recent
developments.
## April 27th to May 16th, 2024
### Deno Migration & Performance Optimization
- Migrate from Node to Deno for improved performance and ease of development
- Replaced Node.js dependencies with native Deno modules, reducing bundle size
and performance
- Migrated from Express to Oak framework (JSR:@oak/oak) for improved Deno
compatibility
- Eliminated external dependencies (uuid, express, http-proxy-middleware,
octokit) for built-in Deno modules
- Switched to JSR registry for standard libraries (@std/path@^1.0.9) to leverage
Deno's ecosystem
### Build System & Deployment
- Change release from npm registry to Deno executables published on GitHub
- Created convenience installation scripts
- Streamlined GitHub Actions release workflow to reduce complexity and build
times
- Enhanced installation instructions in README to facilitate installation
### API & Development Experience
- Refactored version checking to use native fetch API with timeout control (5s)
to prevent blocking the use of the tool when being rate limited by GitHub API
- Updated version checking to check against our GitHub release instead of npm
registry
- Implemented platform-specific browser launching with Deno.Command for better
cross-OS compatibility
- Enhanced port detection using Deno's native networking APIs
### Frontend
- Improved API integration between frontend and backend components
- Optimized frontend routing to work seamlessly with Oak middleware
- Move from bare Radix UI component to more comprehensive Shadcn/UI component
- Simplify some UX flow
- Improve highlighting logic from the file explorer to the graph
## April 21st to 27th, 2024
### Feature Improvements
- Improved Python symbol extraction with better handling of partial imports
- Enhanced visual representation of nodes for large codebases
- Updated highlighting mechanism for better code navigation
- Implemented extraction mode with API integration and symbol editing
capabilities
- Fixed Python error AST node cleanup for more reliable extraction
- Added C# metrics feature for enhanced code analysis capabilities
### Build System and Package Management Improvements
- Switched from using published `@nanoapi.io/shared` package to bundling it
directly with the CLI
- Added `tsup` for improved bundling configuration
- Updated package versions and dependencies across the workspace
- Made the root package private and updated workspace configurations
### CLI Enhancements
- Enhanced version checking with detailed update instructions
- Fixed path resolution for static file serving
- Improved build process with better bundling configuration
- Added proper shebang handling for the CLI executable
### Build System Updates
- Removed separate build step for shared package
- Updated build scripts to use tsup for better bundling
- Fixed path resolution in development and production environments
- Improved static file serving configuration
### Version Management
- Updated CLI version to 1.0.3
- Set shared package version to 0.0.0 since it's now bundled
- Added proper version checking middleware with detailed update instructions
================================================
FILE: deno.json
================================================
{
"version": "1.0.15",
"name": "@napi/cli",
"exports": "./src/index.ts",
"nodeModulesDir": "auto",
"lock": false,
"imports": {
"@deno/vite-plugin": "npm:@deno/vite-plugin@^1.0.4",
"@inquirer/prompts": "npm:@inquirer/prompts@^7.5.3",
"@langchain/anthropic": "npm:@langchain/anthropic@^0.3.23",
"@langchain/core": "npm:@langchain/core@^0.3.61",
"@langchain/google-genai": "npm:@langchain/google-genai@^0.2.14",
"@langchain/google-vertexai": "npm:@langchain/google-vertexai@^0.2.14",
"@langchain/langgraph": "npm:@langchain/langgraph@^0.3.5",
"@langchain/openai": "npm:@langchain/openai@^0.5.15",
"@oak/oak": "jsr:@oak/oak@^17.1.4",
"@radix-ui/react-dialog": "npm:@radix-ui/react-dialog@^1.1.14",
"@radix-ui/react-dropdown-menu": "npm:@radix-ui/react-dropdown-menu@^2.1.15",
"@radix-ui/react-label": "npm:@radix-ui/react-label@^2.1.7",
"@radix-ui/react-scroll-area": "npm:@radix-ui/react-scroll-area@^1.2.9",
"@radix-ui/react-separator": "npm:@radix-ui/react-separator@^1.1.7",
"@radix-ui/react-slider": "npm:@radix-ui/react-slider@^1.3.5",
"@radix-ui/react-slot": "npm:@radix-ui/react-slot@^1.2.3",
"@radix-ui/react-tooltip": "npm:@radix-ui/react-tooltip@^1.2.7",
"@std/expect": "jsr:@std/expect@^1.0.16",
"@std/path": "jsr:@std/path@^1.0.9",
"@std/testing": "jsr:@std/testing@^1.0.14",
"@tailwindcss/vite": "npm:@tailwindcss/vite@^4.1.8",
"@types/cytoscape-fcose": "npm:@types/cytoscape-fcose@^2.2.4",
"@types/react": "npm:@types/react@^19.1.6",
"@types/react-dom": "npm:@types/react-dom@^19.1.3",
"@vitejs/plugin-react": "npm:@vitejs/plugin-react@^4.4.1",
"class-variance-authority": "npm:class-variance-authority@^0.7.1",
"clsx": "npm:clsx@^2.1.1",
"cytoscape": "npm:cytoscape@^3.32.0",
"cytoscape-fcose": "npm:cytoscape-fcose@^2.2.0",
"glob": "npm:glob@^11.0.2",
"lucide-react": "npm:lucide-react@^0.513.0",
"react": "npm:react@^19.1.0",
"react-dom": "npm:react-dom@^19.1.0",
"react-router-dom": "npm:react-router-dom@^7.5.3",
"tailwind-merge": "npm:tailwind-merge@^3.3.0",
"tailwindcss": "npm:tailwindcss@^4.1.8",
"tree-sitter": "npm:tree-sitter@^0.22.4",
"tree-sitter-c": "npm:tree-sitter-c@0.23.6",
"tree-sitter-c-sharp": "npm:tree-sitter-c-sharp@^0.23.1",
"tree-sitter-python": "npm:tree-sitter-python@^0.23.6",
"tree-sitter-java": "npm:tree-sitter-java@^0.23.5",
"tw-animate-css": "npm:tw-animate-css@^1.3.4",
"vite": "npm:vite@^6.3.5",
"yargs": "https://deno.land/x/yargs@v18.0.0-deno/deno.ts",
"yargs-types": "https://deno.land/x/yargs@v18.0.0-deno/deno-types.ts",
"zod": "npm:zod@^3.24.4"
},
"exclude": ["viewer/"],
"tasks": {
"dev": "deno run -A src/index.ts",
"dev:viewer": "cd viewer && deno run -A npm:vite",
"build:viewer": "cd viewer && deno run -A npm:vite build",
"compile": "deno task build:viewer && deno compile -A --include=viewer/dist --output=dist/napi src/index.ts",
"compile-linux": "deno compile -A --include=viewer/dist --output=dist/napi.linux --target=x86_64-unknown-linux-gnu src/index.ts",
"compile-macos": "deno compile -A --include=viewer/dist --output=dist/napi.macos --target=x86_64-apple-darwin src/index.ts",
"compile-windows": "deno compile -A --include=viewer/dist --output=dist/napi.exe --target=x86_64-pc-windows-msvc src/index.ts",
"compile:all": "deno task build:viewer && deno task 'compile-*'",
"test": "deno test -A"
},
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "react",
"jsxImportSourceTypes": "@types/react"
}
}
================================================
FILE: examples/README.md
================================================
## Quickstart
Each example is already setup and initialize to use napi.
### To view the project on the UI
```
napi split configure
```
### Or to split the APIs from the command line directly
```
napi split
```
================================================
FILE: examples/c/network/.napirc
================================================
{
"language": "c",
"project": {
"include": [
"**/*.c",
"**/*.h"
],
"exclude": [
".git/**",
"**/dist/**",
"**/build/**",
"**/bin/**",
"**/obj/**",
"**/napi_out/**"
]
},
"outDir": "napi_out",
"audit": {
"file": { "maxCodeChar": 5000, "maxCodeLine": 300, "maxDependency": 20, "maxCyclomaticComplexity": 50 },
"symbol": { "maxCodeChar": 1000, "maxCodeLine": 80, "maxDependency": 10, "maxCyclomaticComplexity": 15 }
}
}
================================================
FILE: examples/c/network/makefile
================================================
# --- Macros ---
# compilation
exec = gcc -Wall -Wextra -pedantic -O3 -g3 -fopenmp -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls
comp = gcc -c -Wall -Wextra -pedantic -O3 -g3 -fopenmp -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls
toexe = -o
toobj = -o
# sources
SRCSC= $(wildcard src/*/*.c)
SRCSH= $(wildcard src/*/*.h)
TSTSC= $(wildcard tst/*.c)
# objects
OBJS= $(wildcard obj/*.o)
OBJBM= $(wildcard src/*/*.o)
# --- Functions ---
all: test main
main: create_exe_main to_obj_src
test: bin_mkdir create_exe_new to_obj
clean: clean_o clean_bin
bin_mkdir:
mkdir -p bin;
obj_mkdir:
mkdir -p obj;
tst_mov:
mv $(foreach exe, $(TSTSC:tst/%.c=%) , $(exe) ) bin
create_exe_new: create_obj
$(foreach test_obj,$(TSTSC:%.c=%.o), $(exec) $(test_obj) $(SRCSC:%.c=%.o) $(toexe) $(test_obj:%.o=%);)
create_exe_main: create_obj_main
$(exec) obj/main.o $(SRCSC:%.c=%.o) $(toexe) app
to_obj: obj_mkdir to_obj_src to_obj_tst
to_obj_src:
mv $(foreach obj,$(SRCSC:%.c=%.o), $(obj) ) obj
to_obj_tst:
mv $(foreach obj,$(TSTSC:%.c=%.o), $(obj) ) obj
create_obj: create_obj_src create_obj_tst
create_obj_src:
$(foreach cfl, $(SRCSC), $(comp) $(cfl) $(toobj) $(cfl:%.c=%).o;)
create_obj_tst:
$(foreach cfl, $(TSTSC), $(comp) $(cfl) $(toobj) $(cfl:%.c=%).o;)
create_obj_main: obj_mkdir create_obj_src
$(comp) src/main.c $(toobj) obj/main.o
================================================
FILE: examples/c/network/src/cartographie/cartographie.c
================================================
#include "cartographie.h"
void scanHorizontal(const char* network) {
struct sockaddr_in addr;
int sockfd, ttl = 64, timeout = 1000;
char ip[INET_ADDRSTRLEN];
// Création du socket
sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
if (sockfd < 0) {
perror("socket");
exit(EXIT_FAILURE);
}
// Définition de l'option TTL
if (setsockopt(sockfd, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl)) < 0) {
perror("setsockopt");
exit(EXIT_FAILURE);
}
// Définition de l'option de timeout
struct timeval tv;
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
if (setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) {
perror("setsockopt");
exit(EXIT_FAILURE);
}
// Scan du réseau
for (int i = 1; i <= 255; i++) {
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
// Adresse --> octets
int octet1, octet2, octet3, octet4;
sscanf(network, "%d.%d.%d.%d", &octet1, &octet2, &octet3, &octet4);
// Dernier octet --> i
octet4 = i;
// Réassemblement de l'adresse
char host[INET_ADDRSTRLEN];
sprintf(host, "%d.%d.%d.%d", octet1, octet2, octet3, octet4);
// Conversion adresse en binaire
inet_pton(AF_INET, host, &(addr.sin_addr));
// Conversion adresse en texte
inet_ntop(AF_INET, &(addr.sin_addr), ip, INET_ADDRSTRLEN);
// Envoi du paquet ICMP
struct icmphdr icmp;
memset(&icmp, 0, sizeof(icmp));
icmp.type = ICMP_ECHO;
icmp.code = 0;
icmp.checksum = htons(~(ICMP_ECHO << 8));
if (sendto(sockfd, &icmp, sizeof(icmp), 0, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
perror("sendto");
continue;
}
// Attente de la réponse
fd_set read_set;
FD_ZERO(&read_set);
FD_SET(sockfd, &read_set);
struct timeval timeout;
timeout.tv_sec = 1;
timeout.tv_usec = 0;
int select_result = select(sockfd + 1, &read_set, NULL, NULL, &timeout);
if (select_result < 0) {
perror("select");
continue;
} else if (select_result == 0) {
printf("Aucune réponse de %s\n", ip);
continue;
}
// Réception de la réponse
char buffer[IP_MAXPACKET];
struct sockaddr_in sender;
socklen_t sender_len = sizeof(sender);
ssize_t packet_len = recvfrom(sockfd, buffer, sizeof(buffer), 0, (struct sockaddr*)&sender, &sender_len);
if (packet_len < 0) {
perror("recvfrom");
continue;
}
// Affichage de l'adresse
printf("L'hôte %s est en ligne\n", ip);
}
// Fermeture socket
close(sockfd);
}
================================================
FILE: examples/c/network/src/cartographie/cartographie.h
================================================
#ifndef CARTOGRAPHIE_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include "tnmap.h"
void scanHorizontal(const char* network);
#define CARTOGRAPHIE_H
#endif
================================================
FILE: examples/c/network/src/cartographie/tnmap.c
================================================
#include "tnmap.h"
// Vérifie si un hôte est actif
// Retourne un socket si l'hôte est actif, 1 sinon
int tnmap(const char* ip_addr) {
int sock;
struct sockaddr_in server;
int port;
int result[MAX_PORTS] = {0};
// Création du socket
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == -1) {
perror("Échec de la création du socket");
return -1;
}
server.sin_addr.s_addr = inet_addr(ip_addr);
server.sin_family = AF_INET;
// Scan des ports
for (port = 1; port <= MAX_PORTS; port++) {
server.sin_port = htons(port);
// Connexion à l'hôte distant
if (connect(sock, (struct sockaddr *)&server, sizeof(server)) < 0) {
result[port - 1] = 0; // Port fermé
} else {
result[port - 1] = 1; // Port ouvert
close(sock);
sock = socket(AF_INET, SOCK_STREAM, 0); // Socket pour le prochain port
if (sock == -1) {
perror("Échec de la création du socket");
return -1;
}
}
}
#pragma omp parallel for
// Affichage des résultats
for (port = 1; port <= MAX_PORTS; port++) {
if (result[port - 1] == 1) {
printf("Le port %d de %s est ouvert\n", port, ip_addr);
}
}
return 1;
}
void scanVertical(const char* ip_addr) {
for (int i = 0; i < 255; i++) {
tnmap(ip_addr);
}
}
================================================
FILE: examples/c/network/src/cartographie/tnmap.h
================================================
#ifndef TNMAP_H
#define TNMAP_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#define MAX_PORTS 65535
#endif
int tnmap(const char* ip_addr);
void scanVertical(const char* ip_addr);
================================================
FILE: examples/c/network/src/main.c
================================================
#include "cartographie/cartographie.h"
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
if (argc < 3) {
fprintf(stderr, "Utilisation : %s <mode> <ip>\n", argv[0]);
fprintf(stderr, "Modes :\n");
fprintf(stderr, " -h: Scan horizontal\n");
fprintf(stderr, " -v: Scan vertical\n");
fprintf(stderr, "Option:\n");
fprintf(stderr, " <ip>: IP à scanner verticalemnet or horizontalement (adresse de réseau)\n");
return 1;
}
if (strcmp(argv[1], "-h") == 0) {
scanHorizontal(argv[2]);
} else if (strcmp(argv[1], "-v") == 0) {
scanVertical(argv[2]);
} else {
fprintf(stderr, "Mode invalide\n");
return 1;
}
return 0;
}
================================================
FILE: examples/c/network/src/tcp_cs/clientTCP.c
================================================
#include "clientTCP.h"
int startClient(int argc, char *argv[]) {
int serverSocket;
/*
* Ouvrir socket (socket STREAM)
*/
if ((serverSocket = socket(PF_INET, SOCK_STREAM, 0)) <0) {
perror ("erreur socket");
exit (1);
}
struct sockaddr_in serv_addr;
/*
* Lier l'adresse locale à la socket
*/;
memset(&serv_addr, 0, sizeof(serv_addr) );
serv_addr.sin_family = AF_INET ;
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(CLIENT_PORT);
if (bind(serverSocket,(struct sockaddr *)&serv_addr, sizeof(serv_addr) ) <0) {
perror ("servecho: erreur bind\n");
exit (1);
}
/*
* Remplir la structure serv_addr avec
l'adresse du serveur
*/
bzero( (char *) &serv_addr, sizeof(serv_addr) );
serv_addr.sin_family = AF_INET;
if (argc != 3) {
fprintf(stderr, "usage : %s <adresse IP> <port>\n", argv[0]);
exit(1);
}
serv_addr.sin_port = htons((uint16_t) atoi(argv[2]));
serv_addr.sin_addr.s_addr = inet_addr(argv[1]);
if (connect(serverSocket, (struct sockaddr *) &serv_addr, sizeof(serv_addr) ) < 0){
perror ("cliecho : erreur connect");
return 1;
}
char buffer[280];
int n;
while (1) {
printf("cliecho : message à envoyer : ");
memset(buffer, 0, sizeof(buffer));
scanf("%s", buffer);
n = write(serverSocket, buffer, strlen(buffer));
if (n < 0) {
perror("cliecho : erreur write\n");
close(serverSocket);
return 1;
}
memset(buffer, 0, sizeof(buffer));
n = read(serverSocket, buffer, 280);
if (n < 0) {
perror("cliecho : erreur read\n");
close(serverSocket);
return 1;
}
printf("cliecho : message reçu : %s\n", buffer);
}
}
================================================
FILE: examples/c/network/src/tcp_cs/clientTCP.h
================================================
#ifndef CLIENTTCP_H
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <netinet/in.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdint.h>
#include <stdlib.h>
#define CLIENT_PORT 7776
int startClient(int argc, char *argv[]);
#define CLIENTTCP_H
#endif
================================================
FILE: examples/c/network/src/tcp_cs/serveurTCP.c
================================================
#include "serveurTCP.h"
int startServer(void) {
int serverSocket;
struct sockaddr_in serv_addr;
/*
* Ouvrir socket (socket STREAM)
*/
if ((serverSocket = socket(PF_INET, SOCK_STREAM, 0))<0) {
perror("erreur socket");
return 1;
}
memset(&serv_addr, 0, sizeof(serv_addr) );
serv_addr.sin_family = AF_INET ;
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(SERV_PORT);
if (bind(serverSocket,(struct sockaddr *)&serv_addr, sizeof(serv_addr) ) <0) {
perror ("servecho: erreur bind\n");
return 1;
}
if (listen(serverSocket, SOMAXCONN) <0) {
perror ("servecho: erreur listen\n");
return 1;
}
int dialogSocket;
int clilen;
struct sockaddr_in cli_addr;
clilen = sizeof(cli_addr);
dialogSocket = accept(serverSocket, (struct sockaddr *)&cli_addr, (socklen_t *)&clilen);
if (dialogSocket < 0) {
perror("servecho : erreur accep\n");
close(serverSocket);
return 1;
}
while (1) {
char buffer[280];
int n;
n = read(dialogSocket, buffer, 280);
if (n < 0) {
perror("servecho : erreur read\n");
close(dialogSocket);
return 1;
}
printf("servecho : message reçu : %s\n", buffer);
n = write(dialogSocket, buffer, strlen(buffer));
if (n < 0) {
perror("servecho : erreur write\n");
close(dialogSocket);
return 1;
}
}
close(dialogSocket);
return 0;
}
================================================
FILE: examples/c/network/src/tcp_cs/serveurTCP.h
================================================
#ifndef SERVEURTCP_H
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <netinet/in.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdint.h>
#include <stdlib.h>
#define SERV_PORT 7777
int startServer(void);
#define SERVEURTCP_H
#endif
================================================
FILE: examples/csharp/EndpointExample/.napirc
================================================
{
"language": "c-sharp",
"project": {
"include": ["**/*"],
"exclude": ["bin/**", "obj/**", "napi-output/**"]
},
"outDir": "napi-output",
"audit": {
"file": { "maxCodeChar": 5000, "maxCodeLine": 300, "maxDependency": 20, "maxCyclomaticComplexity": 50 },
"symbol": { "maxCodeChar": 1000, "maxCodeLine": 80, "maxDependency": 10, "maxCyclomaticComplexity": 15 }
}
}
================================================
FILE: examples/csharp/EndpointExample/EndpointExample.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FastEndpoints" Version="5.35.0" />
</ItemGroup>
</Project>
================================================
FILE: examples/csharp/EndpointExample/Program.cs
================================================
using FastEndpoints;
var bld = WebApplication.CreateBuilder();
bld.Services.AddFastEndpoints();
var app = bld.Build();
app.UseFastEndpoints();
app.Run();
================================================
FILE: examples/csharp/EndpointExample/Properties/launchSettings.json
================================================
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5288",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7299;http://localhost:5288",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
================================================
FILE: examples/csharp/EndpointExample/appsettings.Development.json
================================================
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
================================================
FILE: examples/csharp/EndpointExample/appsettings.json
================================================
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
================================================
FILE: examples/csharp/EndpointExample/src/MyEndpoint.cs
================================================
public class MyEndpoint : Endpoint<MyRequest, MyResponse>
{
public override void Configure()
{
Post("/api/user/create");
AllowAnonymous();
}
public override async Task HandleAsync(MyRequest req, CancellationToken ct)
{
await SendAsync(new()
{
FullName = req.FirstName + " " + req.LastName,
IsOver18 = req.Age > 18
});
}
}
================================================
FILE: examples/csharp/EndpointExample/src/MyRequest.cs
================================================
public class MyRequest
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
}
================================================
FILE: examples/csharp/EndpointExample/src/MyResponse.cs
================================================
public class MyResponse
{
public string FullName { get; set; }
public bool IsOver18 { get; set; }
}
================================================
FILE: examples/java/websocket/README.md
================================================
# NAPI Java example
This example uses Spring's websocket sample artifact from the Maven repository.
To experiment with it, simply run :
```Bash
napi init
```
in this folder and follow the instructions.
================================================
FILE: examples/java/websocket/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<artifactId>websocket</artifactId>
<parent>
<!-- Your own application should inherit from spring-boot-starter-parent -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.0.2.RELEASE</version>
</parent>
<groupId>napi</groupId>
<name>Spring Boot WebSocket Sample</name>
<description>Spring Boot WebSocket Sample</description>
<version>1.0-SNAPSHOT</version>
<url>http://projects.spring.io/spring-boot/</url>
<organization>
<name>Pivotal Software, Inc.</name>
<url>http://www.spring.io</url>
</organization>
<properties>
<main.basedir>${basedir}/../..</main.basedir>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
================================================
FILE: examples/java/websocket/src/main/java/samples/websocket/client/GreetingService.java
================================================
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.client;
public interface GreetingService {
String getGreeting();
}
================================================
FILE: examples/java/websocket/src/main/java/samples/websocket/client/SimpleClientWebSocketHandler.java
================================================
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.client;
import java.util.concurrent.CountDownLatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
public class SimpleClientWebSocketHandler extends TextWebSocketHandler {
protected Log logger = LogFactory.getLog(SimpleClientWebSocketHandler.class);
private final GreetingService greetingService;
private final CountDownLatch latch;
@Autowired
public SimpleClientWebSocketHandler(GreetingService greetingService,
CountDownLatch latch) {
this.greetingService = greetingService;
this.latch = latch;
}
@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
TextMessage message = new TextMessage(this.greetingService.getGreeting());
session.sendMessage(message);
}
@Override
public void handleTextMessage(WebSocketSession session, TextMessage message)
throws Exception {
this.logger.info("Received: " + message + " (" + this.latch.getCount() + ")");
session.close();
this.latch.countDown();
}
}
================================================
FILE: examples/java/websocket/src/main/java/samples/websocket/client/SimpleGreetingService.java
================================================
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.client;
public class SimpleGreetingService implements GreetingService {
@Override
public String getGreeting() {
return "Hello world!";
}
}
================================================
FILE: examples/java/websocket/src/main/java/samples/websocket/config/SampleWebSocketsApplication.java
================================================
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.handler.PerConnectionWebSocketHandler;
import samples.websocket.client.GreetingService;
import samples.websocket.client.SimpleGreetingService;
import samples.websocket.echo.DefaultEchoService;
import samples.websocket.echo.EchoService;
import samples.websocket.echo.EchoWebSocketHandler;
import samples.websocket.snake.SnakeWebSocketHandler;
@Configuration
@EnableAutoConfiguration
@EnableWebSocket
public class SampleWebSocketsApplication extends SpringBootServletInitializer implements
WebSocketConfigurer {
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(echoWebSocketHandler(), "/echo").withSockJS();
registry.addHandler(snakeWebSocketHandler(), "/snake").withSockJS();
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SampleWebSocketsApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(SampleWebSocketsApplication.class, args);
}
@Bean
public EchoService echoService() {
return new DefaultEchoService("Did you say \"%s\"?");
}
@Bean
public GreetingService greetingService() {
return new SimpleGreetingService();
}
@Bean
public WebSocketHandler echoWebSocketHandler() {
return new EchoWebSocketHandler(echoService());
}
@Bean
public WebSocketHandler snakeWebSocketHandler() {
return new PerConnectionWebSocketHandler(SnakeWebSocketHandler.class);
}
}
================================================
FILE: examples/java/websocket/src/main/java/samples/websocket/echo/DefaultEchoService.java
================================================
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.echo;
public class DefaultEchoService implements EchoService {
private final String echoFormat;
public DefaultEchoService(String echoFormat) {
this.echoFormat = (echoFormat != null) ? echoFormat : "%s";
}
@Override
public String getMessage(String message) {
return String.format(this.echoFormat, message);
}
}
================================================
FILE: examples/java/websocket/src/main/java/samples/websocket/echo/EchoService.java
================================================
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.echo;
public interface EchoService {
String getMessage(String message);
}
================================================
FILE: examples/java/websocket/src/main/java/samples/websocket/echo/EchoWebSocketHandler.java
================================================
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.echo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
/**
* Echo messages by implementing a Spring {@link WebSocketHandler} abstraction.
*/
public class EchoWebSocketHandler extends TextWebSocketHandler {
private static Logger logger = LoggerFactory.getLogger(EchoWebSocketHandler.class);
private final EchoService echoService;
@Autowired
public EchoWebSocketHandler(EchoService echoService) {
this.echoService = echoService;
}
@Override
public void afterConnectionEstablished(WebSocketSession session) {
logger.debug("Opened new session in instance " + this);
}
@Override
public void handleTextMessage(WebSocketSession session, TextMessage message)
throws Exception {
String echoMessage = this.echoService.getMessage(message.getPayload());
logger.debug(echoMessage);
session.sendMessage(new TextMessage(echoMessage));
}
@Override
public void handleTransportError(WebSocketSession session, Throwable exception)
throws Exception {
session.close(CloseStatus.SERVER_ERROR);
}
}
================================================
FILE: examples/java/websocket/src/main/java/samples/websocket/snake/Direction.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.snake;
public enum Direction {
NONE, NORTH, SOUTH, EAST, WEST
}
================================================
FILE: examples/java/websocket/src/main/java/samples/websocket/snake/Location.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.snake;
public class Location {
public int x;
public int y;
public static final int GRID_SIZE = 10;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int PLAYFIELD_WIDTH = 640;
public Location(int x, int y) {
this.x = x;
this.y = y;
}
public Location getAdjacentLocation(Direction direction) {
switch (direction) {
case NORTH:
return new Location(this.x, this.y - Location.GRID_SIZE);
case SOUTH:
return new Location(this.x, this.y + Location.GRID_SIZE);
case EAST:
return new Location(this.x + Location.GRID_SIZE, this.y);
case WEST:
return new Location(this.x - Location.GRID_SIZE, this.y);
case NONE:
// fall through
default:
return this;
}
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Location location = (Location) o;
if (this.x != location.x) {
return false;
}
if (this.y != location.y) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = this.x;
result = 31 * result + this.y;
return result;
}
}
================================================
FILE: examples/java/websocket/src/main/java/samples/websocket/snake/Snake.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.snake;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Deque;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
public class Snake {
private static final int DEFAULT_LENGTH = 5;
private final int id;
private final WebSocketSession session;
private Direction direction;
private int length = DEFAULT_LENGTH;
private Location head;
private final Deque<Location> tail = new ArrayDeque<Location>();
private final String hexColor;
public Snake(int id, WebSocketSession session) {
this.id = id;
this.session = session;
this.hexColor = SnakeUtils.getRandomHexColor();
resetState();
}
private void resetState() {
this.direction = Direction.NONE;
this.head = SnakeUtils.getRandomLocation();
this.tail.clear();
this.length = DEFAULT_LENGTH;
}
private synchronized void kill() throws Exception {
resetState();
sendMessage("{'type': 'dead'}");
}
private synchronized void reward() throws Exception {
this.length++;
sendMessage("{'type': 'kill'}");
}
protected void sendMessage(String msg) throws Exception {
this.session.sendMessage(new TextMessage(msg));
}
public synchronized void update(Collection<Snake> snakes) throws Exception {
Location nextLocation = this.head.getAdjacentLocation(this.direction);
if (nextLocation.x >= SnakeUtils.PLAYFIELD_WIDTH) {
nextLocation.x = 0;
}
if (nextLocation.y >= SnakeUtils.PLAYFIELD_HEIGHT) {
nextLocation.y = 0;
}
if (nextLocation.x < 0) {
nextLocation.x = SnakeUtils.PLAYFIELD_WIDTH;
}
if (nextLocation.y < 0) {
nextLocation.y = SnakeUtils.PLAYFIELD_HEIGHT;
}
if (this.direction != Direction.NONE) {
this.tail.addFirst(this.head);
if (this.tail.size() > this.length) {
this.tail.removeLast();
}
this.head = nextLocation;
}
handleCollisions(snakes);
}
private void handleCollisions(Collection<Snake> snakes) throws Exception {
for (Snake snake : snakes) {
boolean headCollision = this.id != snake.id
&& snake.getHead().equals(this.head);
boolean tailCollision = snake.getTail().contains(this.head);
if (headCollision || tailCollision) {
kill();
if (this.id != snake.id) {
snake.reward();
}
}
}
}
public synchronized Location getHead() {
return this.head;
}
public synchronized Collection<Location> getTail() {
return this.tail;
}
public synchronized void setDirection(Direction direction) {
this.direction = direction;
}
public synchronized String getLocationsJson() {
StringBuilder sb = new StringBuilder();
sb.append(String.format("{x: %d, y: %d}", Integer.valueOf(this.head.x),
Integer.valueOf(this.head.y)));
for (Location location : this.tail) {
sb.append(',');
sb.append(String.format("{x: %d, y: %d}", Integer.valueOf(location.x),
Integer.valueOf(location.y)));
}
return String.format("{'id':%d,'body':[%s]}", Integer.valueOf(this.id),
sb.toString());
}
public int getId() {
return this.id;
}
public String getHexColor() {
return this.hexColor;
}
}
================================================
FILE: examples/java/websocket/src/main/java/samples/websocket/snake/SnakeTimer.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.snake;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
/**
* Sets up the timer for the multi-player snake game WebSocket example.
*/
public class SnakeTimer {
private static final Log log = LogFactory.getLog(SnakeTimer.class);
private static Timer gameTimer = null;
private static final long TICK_DELAY = 100;
private static final ConcurrentHashMap<Integer, Snake> snakes = new ConcurrentHashMap<Integer, Snake>();
public static synchronized void addSnake(Snake snake) {
if (snakes.size() == 0) {
startTimer();
}
snakes.put(Integer.valueOf(snake.getId()), snake);
}
public static Collection<Snake> getSnakes() {
return Collections.unmodifiableCollection(snakes.values());
}
public static synchronized void removeSnake(Snake snake) {
snakes.remove(Integer.valueOf(snake.getId()));
if (snakes.size() == 0) {
stopTimer();
}
}
public static void tick() throws Exception {
StringBuilder sb = new StringBuilder();
for (Iterator<Snake> iterator = SnakeTimer.getSnakes().iterator(); iterator
.hasNext();) {
Snake snake = iterator.next();
snake.update(SnakeTimer.getSnakes());
sb.append(snake.getLocationsJson());
if (iterator.hasNext()) {
sb.append(',');
}
}
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
}
public static void broadcast(String message) throws Exception {
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
for (Snake snake : snakes) {
try {
snake.sendMessage(message);
}
catch (Throwable ex) {
// if Snake#sendMessage fails the client is removed
removeSnake(snake);
}
}
}
public static void startTimer() {
gameTimer = new Timer(SnakeTimer.class.getSimpleName() + " Timer");
gameTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
try {
tick();
}
catch (Throwable ex) {
log.error("Caught to prevent timer from shutting down", ex);
}
}
}, TICK_DELAY, TICK_DELAY);
}
public static void stopTimer() {
if (gameTimer != null) {
gameTimer.cancel();
}
}
}
================================================
FILE: examples/java/websocket/src/main/java/samples/websocket/snake/SnakeUtils.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.snake;
import java.awt.Color;
import java.util.Random;
public class SnakeUtils {
public static final int PLAYFIELD_WIDTH = 640;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int GRID_SIZE = 10;
private static final Random random = new Random();
public static String getRandomHexColor() {
float hue = random.nextFloat();
// sat between 0.1 and 0.3
float saturation = (random.nextInt(2000) + 1000) / 10000f;
float luminance = 0.9f;
Color color = Color.getHSBColor(hue, saturation, luminance);
return '#' + Integer.toHexString((color.getRGB() & 0xffffff) | 0x1000000)
.substring(1);
}
public static Location getRandomLocation() {
int x = roundByGridSize(random.nextInt(PLAYFIELD_WIDTH));
int y = roundByGridSize(random.nextInt(PLAYFIELD_HEIGHT));
return new Location(x, y);
}
private static int roundByGridSize(int value) {
value = value + (GRID_SIZE / 2);
value = value / GRID_SIZE;
value = value * GRID_SIZE;
return value;
}
}
================================================
FILE: examples/java/websocket/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.snake;
import java.awt.Color;
import java.util.Iterator;
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
public class SnakeWebSocketHandler extends TextWebSocketHandler {
public static final int PLAYFIELD_WIDTH = 640;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int GRID_SIZE = 10;
private static final AtomicInteger snakeIds = new AtomicInteger(0);
private static final Random random = new Random();
private final int id;
private Snake snake;
public static String getRandomHexColor() {
float hue = random.nextFloat();
// sat between 0.1 and 0.3
float saturation = (random.nextInt(2000) + 1000) / 10000f;
float luminance = 0.9f;
Color color = Color.getHSBColor(hue, saturation, luminance);
return '#' + Integer.toHexString((color.getRGB() & 0xffffff) | 0x1000000)
.substring(1);
}
public static Location getRandomLocation() {
int x = roundByGridSize(random.nextInt(PLAYFIELD_WIDTH));
int y = roundByGridSize(random.nextInt(PLAYFIELD_HEIGHT));
return new Location(x, y);
}
private static int roundByGridSize(int value) {
value = value + (GRID_SIZE / 2);
value = value / GRID_SIZE;
value = value * GRID_SIZE;
return value;
}
public SnakeWebSocketHandler() {
this.id = snakeIds.getAndIncrement();
}
@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
this.snake = new Snake(this.id, session);
SnakeTimer.addSnake(this.snake);
StringBuilder sb = new StringBuilder();
for (Iterator<Snake> iterator = SnakeTimer.getSnakes().iterator(); iterator
.hasNext();) {
Snake snake = iterator.next();
sb.append(String.format("{id: %d, color: '%s'}",
Integer.valueOf(snake.getId()), snake.getHexColor()));
if (iterator.hasNext()) {
sb.append(',');
}
}
SnakeTimer
.broadcast(String.format("{'type': 'join','data':[%s]}", sb.toString()));
}
@Override
protected void handleTextMessage(WebSocketSession session, TextMessage message)
throws Exception {
String payload = message.getPayload();
if ("west".equals(payload)) {
this.snake.setDirection(Direction.WEST);
}
else if ("north".equals(payload)) {
this.snake.setDirection(Direction.NORTH);
}
else if ("east".equals(payload)) {
this.snake.setDirection(Direction.EAST);
}
else if ("south".equals(payload)) {
this.snake.setDirection(Direction.SOUTH);
}
}
@Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus status)
throws Exception {
SnakeTimer.removeSnake(this.snake);
SnakeTimer.broadcast(String.format("{'type': 'leave', 'id': %d}",
Integer.valueOf(this.id)));
}
}
================================================
FILE: examples/java/websocket/src/main/resources/static/echo.html
================================================
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<html>
<head>
<title>Apache Tomcat WebSocket Examples: Echo</title>
<style type="text/css">
#connect-container {
float: left;
width: 400px;
}
#connect-container div {
padding: 5px;
}
#console-container {
float: left;
margin-left: 15px;
width: 400px;
}
#console {
border: 1px solid #cccccc;
border-right-color: #999999;
border-bottom-color: #999999;
height: 170px;
overflow-y: scroll;
padding: 5px;
width: 100%;
}
#console p {
padding: 0;
margin: 0;
}
</style>
<script src="http://cdn.sockjs.org/sockjs-0.3.min.js"></script>
<script type="text/javascript">
var ws = null;
function setConnected(connected) {
document.getElementById("connect").disabled = connected;
document.getElementById("disconnect").disabled = !connected;
document.getElementById("echo").disabled = !connected;
}
function connect() {
var target = document.getElementById("target").value;
ws = new SockJS(target);
ws.onopen = function () {
setConnected(true);
log("Info: WebSocket connection opened.");
};
ws.onmessage = function (event) {
log("Received: " + event.data);
};
ws.onclose = function () {
setConnected(false);
log("Info: WebSocket connection closed.");
};
}
function disconnect() {
if (ws != null) {
ws.close();
ws = null;
}
setConnected(false);
}
function echo() {
if (ws != null) {
var message = document.getElementById("message").value;
log("Sent: " + message);
ws.send(message);
} else {
alert(
"WebSocket connection not established, please connect.",
);
}
}
function log(message) {
var console = document.getElementById("console");
var p = document.createElement("p");
p.style.wordWrap = "break-word";
p.appendChild(document.createTextNode(message));
console.appendChild(p);
while (console.childNodes.length > 25) {
console.removeChild(console.firstChild);
}
console.scrollTop = console.scrollHeight;
}
</script>
</head>
<body>
<noscript><h2 style="color: #ff0000">
Seems your browser doesn't support Javascript! Websockets rely on
Javascript being enabled. Please enable Javascript and reload this page!
</h2></noscript>
<div>
<div id="connect-container">
<div>
<input
id="target"
type="text"
size="40"
style="width: 350px"
value="/echo"
/>
</div>
<div>
<button id="connect" onclick="connect()">Connect</button>
<button id="disconnect" disabled="disabled" onclick="disconnect()">
Disconnect
</button>
</div>
<div>
<textarea id="message" style="width: 350px"
>Here is a message!</textarea>
</div>
<div>
<button id="echo" onclick="echo()" disabled="disabled">
Echo message
</button>
</div>
</div>
<div id="console-container">
<div id="console"></div>
</div>
</div>
</body>
</html>
================================================
FILE: examples/java/websocket/src/main/resources/static/index.html
================================================
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<html>
<head>
<title>Apache Tomcat WebSocket Examples: Index</title>
</head>
<body>
<noscript><h2 style="color: #ff0000">
Seems your browser doesn't support Javascript! Websockets rely on
Javascript being enabled. Please enable Javascript and reload this page!
</h2></noscript>
<p>Please select the sample you would like to try.</p>
<ul>
<li><a href="./echo.html">Echo</a></li>
<li><a href="./snake.html">Snake</a></li>
</ul>
</body>
</html>
================================================
FILE: examples/java/websocket/src/main/resources/static/snake.html
================================================
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Apache Tomcat WebSocket Examples: Multiplayer Snake</title>
<style type="text/css">
#playground {
width: 640px;
height: 480px;
background-color: #000;
}
#console-container {
float: left;
margin-left: 15px;
width: 300px;
}
#console {
border: 1px solid #cccccc;
border-right-color: #999999;
border-bottom-color: #999999;
height: 480px;
overflow-y: scroll;
padding-left: 5px;
padding-right: 5px;
width: 100%;
}
#console p {
padding: 0;
margin: 0;
}
</style>
<script src="http://cdn.sockjs.org/sockjs-0.3.min.js"></script>
</head>
<body>
<noscript><h2 style="color: #ff0000">
Seems your browser doesn't support Javascript! Websockets rely on
Javascript being enabled. Please enable Javascript and reload this page!
</h2></noscript>
<div style="float: left">
<canvas id="playground" width="640" height="480"></canvas>
</div>
<div id="console-container">
<div id="console"></div>
</div>
<script type="text/javascript">
var Game = {};
Game.fps = 30;
Game.socket = null;
Game.nextFrame = null;
Game.interval = null;
Game.direction = "none";
Game.gridSize = 10;
function Snake() {
this.snakeBody = [];
this.color = null;
}
Snake.prototype.draw = function (context) {
for (var id in this.snakeBody) {
context.fillStyle = this.color;
context.fillRect(
this.snakeBody[id].x,
this.snakeBody[id].y,
Game.gridSize,
Game.gridSize,
);
}
};
Game.initialize = function () {
this.entities = [];
canvas = document.getElementById("playground");
if (!canvas.getContext) {
Console.log(
"Error: 2d canvas not supported by this browser.",
);
return;
}
this.context = canvas.getContext("2d");
window.addEventListener("keydown", function (e) {
var code = e.keyCode;
if (code > 36 && code < 41) {
switch (code) {
case 37:
if (Game.direction != "east") Game.setDirection("west");
break;
case 38:
if (Game.direction != "south") {
Game.setDirection("north");
}
break;
case 39:
if (Game.direction != "west") Game.setDirection("east");
break;
case 40:
if (Game.direction != "north") {
Game.setDirection("south");
}
break;
}
}
}, false);
Game.connect();
};
Game.setDirection = function (direction) {
Game.direction = direction;
Game.socket.send(direction);
Console.log("Sent: Direction " + direction);
};
Game.startGameLoop = function () {
if (window.webkitRequestAnimationFrame) {
Game.nextFrame = function () {
webkitRequestAnimationFrame(Game.run);
};
} else if (window.mozRequestAnimationFrame) {
Game.nextFrame = function () {
mozRequestAnimationFrame(Game.run);
};
} else {
Game.interval = setInterval(Game.run, 1000 / Game.fps);
}
if (Game.nextFrame != null) {
Game.nextFrame();
}
};
Game.stopGameLoop = function () {
Game.nextFrame = null;
if (Game.interval != null) {
clearInterval(Game.interval);
}
};
Game.draw = function () {
this.context.clearRect(0, 0, 640, 480);
for (var id in this.entities) {
this.entities[id].draw(this.context);
}
};
Game.addSnake = function (id, color) {
Game.entities[id] = new Snake();
Game.entities[id].color = color;
};
Game.updateSnake = function (id, snakeBody) {
if (typeof Game.entities[id] != "undefined") {
Game.entities[id].snakeBody = snakeBody;
}
};
Game.removeSnake = function (id) {
Game.entities[id] = null;
// Force GC.
delete Game.entities[id];
};
Game.run = (function () {
var skipTicks = 1000 / Game.fps,
nextGameTick = (new Date()).getTime();
return function () {
while ((new Date()).getTime() > nextGameTick) {
nextGameTick += skipTicks;
}
Game.draw();
if (Game.nextFrame != null) {
Game.nextFrame();
}
};
})();
Game.connect = function () {
Game.socket = new SockJS("/snake");
Game.socket.onopen = function () {
// Socket open.. start the game loop.
Console.log("Info: WebSocket connection opened.");
Console.log("Info: Press an arrow key to begin.");
Game.startGameLoop();
setInterval(function () {
// Prevent server read timeout.
Game.socket.send("ping");
}, 5000);
};
Game.socket.onclose = function () {
Console.log("Info: WebSocket closed.");
Game.stopGameLoop();
};
Game.socket.onmessage = function (message) {
// _Potential_ security hole, consider using json lib to parse data in production.
var packet = eval("(" + message.data + ")");
switch (packet.type) {
case "update":
for (var i = 0; i < packet.data.length; i++) {
Game.updateSnake(
packet.data[i].id,
packet.data[i].body,
);
}
break;
case "join":
for (var j = 0; j < packet.data.length; j++) {
Game.addSnake(packet.data[j].id, packet.data[j].color);
}
break;
case "leave":
Game.removeSnake(packet.id);
break;
case "dead":
Console.log("Info: Your snake is dead, bad luck!");
Game.direction = "none";
break;
case "kill":
Console.log("Info: Head shot!");
break;
}
};
};
var Console = {};
Console.log = function (message) {
var console = document.getElementById("console");
var p = document.createElement("p");
p.style.wordWrap = "break-word";
p.innerHTML = message;
console.appendChild(p);
while (console.childNodes.length > 25) {
console.removeChild(console.firstChild);
}
console.scrollTop = console.scrollHeight;
};
Game.initialize();
</script>
</body>
</html>
================================================
FILE: examples/java/websocket/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java
================================================
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.echo;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.util.SocketUtils;
import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import samples.websocket.client.GreetingService;
import samples.websocket.client.SimpleClientWebSocketHandler;
import samples.websocket.client.SimpleGreetingService;
import samples.websocket.config.SampleWebSocketsApplication;
import samples.websocket.echo.CustomContainerWebSocketsApplicationTests.CustomContainerConfiguration;
import static org.junit.Assert.assertEquals;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = { SampleWebSocketsApplication.class,
CustomContainerConfiguration.class })
@WebAppConfiguration
@IntegrationTest
@DirtiesContext
public class CustomContainerWebSocketsApplicationTests {
private static Log logger = LogFactory
.getLog(CustomContainerWebSocketsApplicationTests.class);
private static int PORT = SocketUtils.findAvailableTcpPort();
private static final String WS_URI = "ws://localhost:" + PORT + "/ws/echo/websocket";
@Configuration
protected static class CustomContainerConfiguration {
@Bean
public EmbeddedServletContainerFactory embeddedServletContainerFactory() {
return new TomcatEmbeddedServletContainerFactory("/ws", PORT);
}
}
@Test
public void runAndWait() throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(
ClientConfiguration.class, "--spring.main.web_environment=false");
long count = context.getBean(ClientConfiguration.class).latch.getCount();
context.close();
assertEquals(0, count);
}
@Configuration
static class ClientConfiguration implements CommandLineRunner {
private final CountDownLatch latch = new CountDownLatch(1);
@Override
public void run(String... args) throws Exception {
logger.info("Waiting for response: latch=" + this.latch.getCount());
this.latch.await(10, TimeUnit.SECONDS);
logger.info("Got response: latch=" + this.latch.getCount());
}
@Bean
public WebSocketConnectionManager wsConnectionManager() {
WebSocketConnectionManager manager = new WebSocketConnectionManager(client(),
handler(), WS_URI);
manager.setAutoStartup(true);
return manager;
}
@Bean
public StandardWebSocketClient client() {
return new StandardWebSocketClient();
}
@Bean
public SimpleClientWebSocketHandler handler() {
return new SimpleClientWebSocketHandler(greetingService(), this.latch);
}
@Bean
public GreetingService greetingService() {
return new SimpleGreetingService();
}
}
}
================================================
FILE: examples/java/websocket/src/test/java/samples/websocket/echo/SampleWebSocketsApplicationTests.java
================================================
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.echo;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import samples.websocket.client.GreetingService;
import samples.websocket.client.SimpleClientWebSocketHandler;
import samples.websocket.client.SimpleGreetingService;
import samples.websocket.config.SampleWebSocketsApplication;
import static org.junit.Assert.assertEquals;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SampleWebSocketsApplication.class)
@WebAppConfiguration
@IntegrationTest("server.port:0")
@DirtiesContext
public class SampleWebSocketsApplicationTests {
private static Log logger = LogFactory.getLog(SampleWebSocketsApplicationTests.class);
private static String WS_URI;
@Value("${local.server.port}")
private int port;
@Before
public void init() {
WS_URI = "ws://localhost:" + this.port + "/echo/websocket";
}
@Test
public void runAndWait() throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(
ClientConfiguration.class, "--spring.main.web_environment=false");
long count = context.getBean(ClientConfiguration.class).latch.getCount();
context.close();
assertEquals(0, count);
}
@Configuration
static class ClientConfiguration implements CommandLineRunner {
private final CountDownLatch latch = new CountDownLatch(1);
@Override
public void run(String... args) throws Exception {
logger.info("Waiting for response: latch=" + this.latch.getCount());
this.latch.await(10, TimeUnit.SECONDS);
logger.info("Got response: latch=" + this.latch.getCount());
}
@Bean
public WebSocketConnectionManager wsConnectionManager() {
WebSocketConnectionManager manager = new WebSocketConnectionManager(client(),
handler(), WS_URI);
manager.setAutoStartup(true);
return manager;
}
@Bean
public StandardWebSocketClient client() {
return new StandardWebSocketClient();
}
@Bean
public SimpleClientWebSocketHandler handler() {
return new SimpleClientWebSocketHandler(greetingService(), this.latch);
}
@Bean
public GreetingService greetingService() {
return new SimpleGreetingService();
}
}
}
================================================
FILE: examples/java/websocket/src/test/java/samples/websocket/snake/SnakeTimerTests.java
================================================
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package samples.websocket.snake;
import java.io.IOException;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
public class SnakeTimerTests {
@Test
public void removeDysfunctionalSnakes() throws Exception {
Snake snake = mock(Snake.class);
doThrow(new IOException()).when(snake).sendMessage(anyString());
SnakeTimer.addSnake(snake);
SnakeTimer.broadcast("");
assertThat(SnakeTimer.getSnakes().size(), is(0));
}
}
================================================
FILE: examples/python/flask/.napi/manifests/1775598176791-d5c2217.json
================================================
{
"id": "1775598176791-d5c2217",
"branch": "main",
"commitSha": "d5c22175a36c5de08482bfa3e1ea59758e888405",
"commitShaDate": "2025-07-07T11:42:05+02:00",
"createdAt": "2026-04-07T21:42:56.791Z",
"manifest": {
"api/data/elves.py": {
"id": "api/data/elves.py",
"filePath": "api/data/elves.py",
"metrics": {
"linesCount": 11,
"codeLineCount": 11,
"characterCount": 297,
"codeCharacterCount": 239,
"dependencyCount": 0,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"language": "python",
"dependencies": {},
"dependents": {
"api/services/elves.py": {
"id": "api/services/elves.py",
"symbols": {
"Elf": "Elf",
"elves": "elves",
"ElfService": "ElfService"
}
}
},
"symbols": {
"Elf": {
"id": "Elf",
"type": "class",
"positions": [
{
"start": {
"index": 0,
"row": 0,
"column": 0
},
"end": {
"index": 176,
"row": 6,
"column": 36
}
}
],
"description": "",
"metrics": {
"linesCount": 7,
"codeLineCount": 6,
"characterCount": 176,
"codeCharacterCount": 138,
"dependencyCount": 0,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {},
"dependents": {
"api/services/elves.py": {
"id": "api/services/elves.py",
"symbols": {
"ElfService": "ElfService"
}
}
}
},
"elves": {
"id": "elves",
"type": "variable",
"positions": [
{
"start": {
"index": 179,
"row": 9,
"column": 0
},
"end": {
"index": 296,
"row": 13,
"column": 1
}
}
],
"description": "",
"metrics": {
"linesCount": 5,
"codeLineCount": 5,
"characterCount": 117,
"codeCharacterCount": 101,
"dependencyCount": 0,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {},
"dependents": {
"api/services/elves.py": {
"id": "api/services/elves.py",
"symbols": {
"ElfService": "ElfService"
}
}
}
}
}
},
"api/data/hobbits.py": {
"id": "api/data/hobbits.py",
"filePath": "api/data/hobbits.py",
"metrics": {
"linesCount": 11,
"codeLineCount": 11,
"characterCount": 323,
"codeCharacterCount": 265,
"dependencyCount": 0,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"language": "python",
"dependencies": {},
"dependents": {
"api/services/hobbits.py": {
"id": "api/services/hobbits.py",
"symbols": {
"Hobbit": "Hobbit",
"hobbits": "hobbits",
"HobbitService": "HobbitService"
}
}
},
"symbols": {
"Hobbit": {
"id": "Hobbit",
"type": "class",
"positions": [
{
"start": {
"index": 0,
"row": 0,
"column": 0
},
"end": {
"index": 179,
"row": 6,
"column": 36
}
}
],
"description": "",
"metrics": {
"linesCount": 7,
"codeLineCount": 6,
"characterCount": 179,
"codeCharacterCount": 141,
"dependencyCount": 0,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {},
"dependents": {
"api/services/hobbits.py": {
"id": "api/services/hobbits.py",
"symbols": {
"HobbitService": "HobbitService"
}
}
}
},
"hobbits": {
"id": "hobbits",
"type": "variable",
"positions": [
{
"start": {
"index": 182,
"row": 9,
"column": 0
},
"end": {
"index": 322,
"row": 13,
"column": 1
}
}
],
"description": "",
"metrics": {
"linesCount": 5,
"codeLineCount": 5,
"characterCount": 140,
"codeCharacterCount": 124,
"dependencyCount": 0,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {},
"dependents": {
"api/services/hobbits.py": {
"id": "api/services/hobbits.py",
"symbols": {
"HobbitService": "HobbitService"
}
}
}
}
}
},
"api/services/elves.py": {
"id": "api/services/elves.py",
"filePath": "api/services/elves.py",
"metrics": {
"linesCount": 21,
"codeLineCount": 21,
"characterCount": 602,
"codeCharacterCount": 419,
"dependencyCount": 1,
"dependentCount": 1,
"cyclomaticComplexity": 5
},
"language": "python",
"dependencies": {
"api/data/elves.py": {
"id": "api/data/elves.py",
"isExternal": false,
"symbols": {
"Elf": "Elf",
"elves": "elves"
}
}
},
"dependents": {
"api/views/elves.py": {
"id": "api/views/elves.py",
"symbols": {
"ElfService": "ElfService",
"ElfListView": "ElfListView",
"ElfCreateView": "ElfCreateView",
"ElfDetailView": "ElfDetailView",
"ElfUpdateView": "ElfUpdateView",
"ElfDeleteView": "ElfDeleteView"
}
}
},
"symbols": {
"ElfService": {
"id": "ElfService",
"type": "class",
"positions": [
{
"start": {
"index": 40,
"row": 3,
"column": 0
},
"end": {
"index": 601,
"row": 26,
"column": 33
}
}
],
"description": "",
"metrics": {
"linesCount": 24,
"codeLineCount": 20,
"characterCount": 561,
"codeCharacterCount": 382,
"dependencyCount": 1,
"dependentCount": 1,
"cyclomaticComplexity": 5
},
"dependencies": {
"api/data/elves.py": {
"id": "api/data/elves.py",
"isExternal": false,
"symbols": {
"Elf": "Elf",
"elves": "elves"
}
}
},
"dependents": {
"api/views/elves.py": {
"id": "api/views/elves.py",
"symbols": {
"ElfListView": "ElfListView",
"ElfCreateView": "ElfCreateView",
"ElfDetailView": "ElfDetailView",
"ElfUpdateView": "ElfUpdateView",
"ElfDeleteView": "ElfDeleteView"
}
}
}
}
}
},
"api/services/hobbits.py": {
"id": "api/services/hobbits.py",
"filePath": "api/services/hobbits.py",
"metrics": {
"linesCount": 21,
"codeLineCount": 21,
"characterCount": 698,
"codeCharacterCount": 515,
"dependencyCount": 1,
"dependentCount": 1,
"cyclomaticComplexity": 5
},
"language": "python",
"dependencies": {
"api/data/hobbits.py": {
"id": "api/data/hobbits.py",
"isExternal": false,
"symbols": {
"Hobbit": "Hobbit",
"hobbits": "hobbits"
}
}
},
"dependents": {
"api/views/hobbits.py": {
"id": "api/views/hobbits.py",
"symbols": {
"HobbitService": "HobbitService",
"HobbitListView": "HobbitListView",
"HobbitCreateView": "HobbitCreateView",
"HobbitDetailView": "HobbitDetailView",
"HobbitUpdateView": "HobbitUpdateView",
"HobbitDeleteView": "HobbitDeleteView"
}
}
},
"symbols": {
"HobbitService": {
"id": "HobbitService",
"type": "class",
"positions": [
{
"start": {
"index": 47,
"row": 3,
"column": 0
},
"end": {
"index": 697,
"row": 26,
"column": 38
}
}
],
"description": "",
"metrics": {
"linesCount": 24,
"codeLineCount": 20,
"characterCount": 650,
"codeCharacterCount": 471,
"dependencyCount": 1,
"dependentCount": 1,
"cyclomaticComplexity": 5
},
"dependencies": {
"api/data/hobbits.py": {
"id": "api/data/hobbits.py",
"isExternal": false,
"symbols": {
"Hobbit": "Hobbit",
"hobbits": "hobbits"
}
}
},
"dependents": {
"api/views/hobbits.py": {
"id": "api/views/hobbits.py",
"symbols": {
"HobbitListView": "HobbitListView",
"HobbitCreateView": "HobbitCreateView",
"HobbitDetailView": "HobbitDetailView",
"HobbitUpdateView": "HobbitUpdateView",
"HobbitDeleteView": "HobbitDeleteView"
}
}
}
}
}
},
"api/views/elves.py": {
"id": "api/views/elves.py",
"filePath": "api/views/elves.py",
"metrics": {
"linesCount": 39,
"codeLineCount": 39,
"characterCount": 1770,
"codeCharacterCount": 1279,
"dependencyCount": 3,
"dependentCount": 2,
"cyclomaticComplexity": 1
},
"language": "python",
"dependencies": {
"api/services/elves.py": {
"id": "api/services/elves.py",
"isExternal": false,
"symbols": {
"ElfService": "ElfService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"request": "request",
"Blueprint": "Blueprint"
}
}
},
"dependents": {
"app.py": {
"id": "app.py",
"symbols": {
"elves_bp": "elves_bp",
"app": "app"
}
},
"api/views/elves.py": {
"id": "api/views/elves.py",
"symbols": {
"elves_bp": "elves_bp"
}
}
},
"symbols": {
"ElfCreateView": {
"id": "ElfCreateView",
"type": "class",
"positions": [
{
"start": {
"index": 430,
"row": 17,
"column": 0
},
"end": {
"index": 604,
"row": 21,
"column": 22
}
}
],
"description": "",
"metrics": {
"linesCount": 5,
"codeLineCount": 5,
"characterCount": 174,
"codeCharacterCount": 142,
"dependencyCount": 3,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/services/elves.py": {
"id": "api/services/elves.py",
"isExternal": false,
"symbols": {
"ElfService": "ElfService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"request": "request"
}
}
},
"dependents": {
"api/views/elves.py": {
"id": "api/views/elves.py",
"symbols": {
"elves_bp": "elves_bp"
}
}
}
},
"ElfDeleteView": {
"id": "ElfDeleteView",
"type": "class",
"positions": [
{
"start": {
"index": 1450,
"row": 55,
"column": 0
},
"end": {
"index": 1589,
"row": 58,
"column": 19
}
}
],
"description": "",
"metrics": {
"linesCount": 4,
"codeLineCount": 4,
"characterCount": 139,
"codeCharacterCount": 116,
"dependencyCount": 2,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/services/elves.py": {
"id": "api/services/elves.py",
"isExternal": false,
"symbols": {
"ElfService": "ElfService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
}
},
"dependents": {
"api/views/elves.py": {
"id": "api/views/elves.py",
"symbols": {
"elves_bp": "elves_bp"
}
}
}
},
"ElfDetailView": {
"id": "ElfDetailView",
"type": "class",
"positions": [
{
"start": {
"index": 762,
"row": 30,
"column": 0
},
"end": {
"index": 900,
"row": 33,
"column": 18
}
}
],
"description": "",
"metrics": {
"linesCount": 4,
"codeLineCount": 4,
"characterCount": 138,
"codeCharacterCount": 115,
"dependencyCount": 2,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/services/elves.py": {
"id": "api/services/elves.py",
"isExternal": false,
"symbols": {
"ElfService": "ElfService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
}
},
"dependents": {
"api/views/elves.py": {
"id": "api/views/elves.py",
"symbols": {
"elves_bp": "elves_bp"
}
}
}
},
"ElfListView": {
"id": "ElfListView",
"type": "class",
"positions": [
{
"start": {
"index": 157,
"row": 7,
"column": 0
},
"end": {
"index": 285,
"row": 10,
"column": 20
}
}
],
"description": "",
"metrics": {
"linesCount": 4,
"codeLineCount": 4,
"characterCount": 128,
"codeCharacterCount": 105,
"dependencyCount": 2,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/services/elves.py": {
"id": "api/services/elves.py",
"isExternal": false,
"symbols": {
"ElfService": "ElfService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
}
},
"dependents": {
"api/views/elves.py": {
"id": "api/views/elves.py",
"symbols": {
"elves_bp": "elves_bp"
}
}
}
},
"ElfUpdateView": {
"id": "ElfUpdateView",
"type": "class",
"positions": [
{
"start": {
"index": 1076,
"row": 42,
"column": 0
},
"end": {
"index": 1273,
"row": 46,
"column": 26
}
}
],
"description": "",
"metrics": {
"linesCount": 5,
"codeLineCount": 5,
"characterCount": 197,
"codeCharacterCount": 165,
"dependencyCount": 3,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/services/elves.py": {
"id": "api/services/elves.py",
"isExternal": false,
"symbols": {
"ElfService": "ElfService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"request": "request"
}
}
},
"dependents": {
"api/views/elves.py": {
"id": "api/views/elves.py",
"symbols": {
"elves_bp": "elves_bp"
}
}
}
},
"elves_bp": {
"id": "elves_bp",
"type": "variable",
"positions": [
{
"start": {
"index": 115,
"row": 4,
"column": 0
},
"end": {
"index": 154,
"row": 4,
"column": 39
}
},
{
"start": {
"index": 341,
"row": 14,
"column": 0
},
"end": {
"index": 427,
"row": 14,
"column": 86
}
},
{
"start": {
"index": 662,
"row": 25,
"column": 0
},
"end": {
"index": 759,
"row": 27,
"column": 1
}
},
{
"start": {
"index": 965,
"row": 37,
"column": 0
},
"end": {
"index": 1073,
"row": 39,
"column": 1
}
},
{
"start": {
"index": 1339,
"row": 50,
"column": 0
},
"end": {
"index": 1447,
"row": 52,
"column": 1
}
},
{
"start": {
"index": 1658,
"row": 62,
"column": 0
},
"end": {
"index": 1769,
"row": 64,
"column": 1
}
}
],
"description": "",
"metrics": {
"linesCount": 14,
"codeLineCount": 14,
"characterCount": 549,
"codeCharacterCount": 525,
"dependencyCount": 2,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/views/elves.py": {
"id": "api/views/elves.py",
"isExternal": false,
"symbols": {
"ElfListView": "ElfListView",
"ElfCreateView": "ElfCreateView",
"ElfDetailView": "ElfDetailView",
"ElfUpdateView": "ElfUpdateView",
"ElfDeleteView": "ElfDeleteView"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"Blueprint": "Blueprint"
}
}
},
"dependents": {
"app.py": {
"id": "app.py",
"symbols": {
"app": "app"
}
}
}
}
}
},
"api/views/hobbits.py": {
"id": "api/views/hobbits.py",
"filePath": "api/views/hobbits.py",
"metrics": {
"linesCount": 47,
"codeLineCount": 47,
"characterCount": 1979,
"codeCharacterCount": 1418,
"dependencyCount": 3,
"dependentCount": 2,
"cyclomaticComplexity": 1
},
"language": "python",
"dependencies": {
"api/services/hobbits.py": {
"id": "api/services/hobbits.py",
"isExternal": false,
"symbols": {
"HobbitService": "HobbitService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"request": "request",
"Blueprint": "Blueprint"
}
}
},
"dependents": {
"app.py": {
"id": "app.py",
"symbols": {
"hobbits_bp": "hobbits_bp",
"app": "app"
}
},
"api/views/hobbits.py": {
"id": "api/views/hobbits.py",
"symbols": {
"hobbits_bp": "hobbits_bp"
}
}
},
"symbols": {
"HobbitCreateView": {
"id": "HobbitCreateView",
"type": "class",
"positions": [
{
"start": {
"index": 470,
"row": 19,
"column": 0
},
"end": {
"index": 659,
"row": 23,
"column": 25
}
}
],
"description": "",
"metrics": {
"linesCount": 5,
"codeLineCount": 5,
"characterCount": 189,
"codeCharacterCount": 157,
"dependencyCount": 3,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/services/hobbits.py": {
"id": "api/services/hobbits.py",
"isExternal": false,
"symbols": {
"HobbitService": "HobbitService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"request": "request"
}
}
},
"dependents": {
"api/views/hobbits.py": {
"id": "api/views/hobbits.py",
"symbols": {
"hobbits_bp": "hobbits_bp"
}
}
}
},
"HobbitDeleteView": {
"id": "HobbitDeleteView",
"type": "class",
"positions": [
{
"start": {
"index": 1616,
"row": 61,
"column": 0
},
"end": {
"index": 1770,
"row": 64,
"column": 19
}
}
],
"description": "",
"metrics": {
"linesCount": 4,
"codeLineCount": 4,
"characterCount": 154,
"codeCharacterCount": 131,
"dependencyCount": 2,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/services/hobbits.py": {
"id": "api/services/hobbits.py",
"isExternal": false,
"symbols": {
"HobbitService": "HobbitService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
}
},
"dependents": {
"api/views/hobbits.py": {
"id": "api/views/hobbits.py",
"symbols": {
"hobbits_bp": "hobbits_bp"
}
}
}
},
"HobbitDetailView": {
"id": "HobbitDetailView",
"type": "class",
"positions": [
{
"start": {
"index": 830,
"row": 32,
"column": 0
},
"end": {
"index": 989,
"row": 35,
"column": 21
}
}
],
"description": "",
"metrics": {
"linesCount": 4,
"codeLineCount": 4,
"characterCount": 159,
"codeCharacterCount": 136,
"dependencyCount": 2,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/services/hobbits.py": {
"id": "api/services/hobbits.py",
"isExternal": false,
"symbols": {
"HobbitService": "HobbitService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
}
},
"dependents": {
"api/views/hobbits.py": {
"id": "api/views/hobbits.py",
"symbols": {
"hobbits_bp": "hobbits_bp"
}
}
}
},
"HobbitListView": {
"id": "HobbitListView",
"type": "class",
"positions": [
{
"start": {
"index": 166,
"row": 7,
"column": 0
},
"end": {
"index": 306,
"row": 10,
"column": 22
}
}
],
"description": "",
"metrics": {
"linesCount": 4,
"codeLineCount": 4,
"characterCount": 140,
"codeCharacterCount": 117,
"dependencyCount": 2,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/services/hobbits.py": {
"id": "api/services/hobbits.py",
"isExternal": false,
"symbols": {
"HobbitService": "HobbitService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
}
},
"dependents": {
"api/views/hobbits.py": {
"id": "api/views/hobbits.py",
"symbols": {
"hobbits_bp": "hobbits_bp"
}
}
}
},
"hobbits_bp": {
"id": "hobbits_bp",
"type": "variable",
"positions": [
{
"start": {
"index": 120,
"row": 4,
"column": 0
},
"end": {
"index": 163,
"row": 4,
"column": 43
}
},
{
"start": {
"index": 367,
"row": 14,
"column": 0
},
"end": {
"index": 467,
"row": 16,
"column": 1
}
},
{
"start": {
"index": 722,
"row": 27,
"column": 0
},
"end": {
"index": 827,
"row": 29,
"column": 1
}
},
{
"start": {
"index": 1062,
"row": 39,
"column": 0
},
"end": {
"index": 1190,
"row": 43,
"column": 1
}
},
{
"start": {
"index": 1485,
"row": 54,
"column": 0
},
"end": {
"index": 1613,
"row": 58,
"column": 1
}
},
{
"start": {
"index": 1847,
"row": 68,
"column": 0
},
"end": {
"index": 1978,
"row": 72,
"column": 1
}
}
],
"description": "",
"metrics": {
"linesCount": 22,
"codeLineCount": 22,
"characterCount": 635,
"codeCharacterCount": 575,
"dependencyCount": 2,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/views/hobbits.py": {
"id": "api/views/hobbits.py",
"isExternal": false,
"symbols": {
"HobbitListView": "HobbitListView",
"HobbitCreateView": "HobbitCreateView",
"HobbitDetailView": "HobbitDetailView",
"HobbitUpdateView": "HobbitUpdateView",
"HobbitDeleteView": "HobbitDeleteView"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"Blueprint": "Blueprint"
}
}
},
"dependents": {
"app.py": {
"id": "app.py",
"symbols": {
"app": "app"
}
}
}
},
"HobbitUpdateView": {
"id": "HobbitUpdateView",
"type": "class",
"positions": [
{
"start": {
"index": 1193,
"row": 46,
"column": 0
},
"end": {
"index": 1411,
"row": 50,
"column": 29
}
}
],
"description": "",
"metrics": {
"linesCount": 5,
"codeLineCount": 5,
"characterCount": 218,
"codeCharacterCount": 186,
"dependencyCount": 3,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/services/hobbits.py": {
"id": "api/services/hobbits.py",
"isExternal": false,
"symbols": {
"HobbitService": "HobbitService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"request": "request"
}
}
},
"dependents": {
"api/views/hobbits.py": {
"id": "api/views/hobbits.py",
"symbols": {
"hobbits_bp": "hobbits_bp"
}
}
}
}
}
},
"api/wizards/data.py": {
"id": "api/wizards/data.py",
"filePath": "api/wizards/data.py",
"metrics": {
"linesCount": 11,
"codeLineCount": 11,
"characterCount": 316,
"codeCharacterCount": 258,
"dependencyCount": 0,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"language": "python",
"dependencies": {},
"dependents": {
"api/wizards/services.py": {
"id": "api/wizards/services.py",
"symbols": {
"Wizard": "Wizard",
"wizards": "wizards",
"WizardService": "WizardService"
}
}
},
"symbols": {
"Wizard": {
"id": "Wizard",
"type": "class",
"positions": [
{
"start": {
"index": 0,
"row": 0,
"column": 0
},
"end": {
"index": 179,
"row": 6,
"column": 36
}
}
],
"description": "",
"metrics": {
"linesCount": 7,
"codeLineCount": 6,
"characterCount": 179,
"codeCharacterCount": 141,
"dependencyCount": 0,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {},
"dependents": {
"api/wizards/services.py": {
"id": "api/wizards/services.py",
"symbols": {
"WizardService": "WizardService"
}
}
}
},
"wizards": {
"id": "wizards",
"type": "variable",
"positions": [
{
"start": {
"index": 182,
"row": 9,
"column": 0
},
"end": {
"index": 315,
"row": 13,
"column": 1
}
}
],
"description": "",
"metrics": {
"linesCount": 5,
"codeLineCount": 5,
"characterCount": 133,
"codeCharacterCount": 117,
"dependencyCount": 0,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {},
"dependents": {
"api/wizards/services.py": {
"id": "api/wizards/services.py",
"symbols": {
"WizardService": "WizardService"
}
}
}
}
}
},
"api/wizards/services.py": {
"id": "api/wizards/services.py",
"filePath": "api/wizards/services.py",
"metrics": {
"linesCount": 22,
"codeLineCount": 22,
"characterCount": 742,
"codeCharacterCount": 559,
"dependencyCount": 1,
"dependentCount": 1,
"cyclomaticComplexity": 5
},
"language": "python",
"dependencies": {
"api/wizards/data.py": {
"id": "api/wizards/data.py",
"isExternal": false,
"symbols": {
"Wizard": "Wizard",
"wizards": "wizards"
}
}
},
"dependents": {
"api/wizards/views.py": {
"id": "api/wizards/views.py",
"symbols": {
"WizardService": "WizardService",
"WizardListView": "WizardListView",
"WizardCreateView": "WizardCreateView",
"WizardDetailView": "WizardDetailView",
"WizardUpdateView": "WizardUpdateView",
"WizardDeleteView": "WizardDeleteView"
}
}
},
"symbols": {
"WizardService": {
"id": "WizardService",
"type": "class",
"positions": [
{
"start": {
"index": 91,
"row": 3,
"column": 0
},
"end": {
"index": 741,
"row": 26,
"column": 38
}
}
],
"description": "",
"metrics": {
"linesCount": 24,
"codeLineCount": 20,
"characterCount": 650,
"codeCharacterCount": 471,
"dependencyCount": 1,
"dependentCount": 1,
"cyclomaticComplexity": 5
},
"dependencies": {
"api/wizards/data.py": {
"id": "api/wizards/data.py",
"isExternal": false,
"symbols": {
"Wizard": "Wizard",
"wizards": "wizards"
}
}
},
"dependents": {
"api/wizards/views.py": {
"id": "api/wizards/views.py",
"symbols": {
"WizardListView": "WizardListView",
"WizardCreateView": "WizardCreateView",
"WizardDetailView": "WizardDetailView",
"WizardUpdateView": "WizardUpdateView",
"WizardDeleteView": "WizardDeleteView"
}
}
}
}
}
},
"api/wizards/views.py": {
"id": "api/wizards/views.py",
"filePath": "api/wizards/views.py",
"metrics": {
"linesCount": 49,
"codeLineCount": 49,
"characterCount": 2120,
"codeCharacterCount": 1446,
"dependencyCount": 3,
"dependentCount": 2,
"cyclomaticComplexity": 1
},
"language": "python",
"dependencies": {
"api/wizards/services.py": {
"id": "api/wizards/services.py",
"isExternal": false,
"symbols": {
"WizardService": "WizardService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"request": "request",
"Blueprint": "Blueprint"
}
}
},
"dependents": {
"app.py": {
"id": "app.py",
"symbols": {
"get_wizzards_bp": "get_wizzards_bp",
"app": "app"
}
},
"api/wizards/views.py": {
"id": "api/wizards/views.py",
"symbols": {
"get_wizzards_bp": "get_wizzards_bp"
}
}
},
"symbols": {
"get_wizzards_bp": {
"id": "get_wizzards_bp",
"type": "function",
"positions": [
{
"start": {
"index": 984,
"row": 36,
"column": 0
},
"end": {
"index": 2120,
"row": 70,
"column": 21
}
}
],
"description": "",
"metrics": {
"linesCount": 35,
"codeLineCount": 24,
"characterCount": 1136,
"codeCharacterCount": 614,
"dependencyCount": 2,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/wizards/views.py": {
"id": "api/wizards/views.py",
"isExternal": false,
"symbols": {
"WizardListView": "WizardListView",
"WizardCreateView": "WizardCreateView",
"WizardDetailView": "WizardDetailView",
"WizardUpdateView": "WizardUpdateView",
"WizardDeleteView": "WizardDeleteView"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"Blueprint": "Blueprint"
}
}
},
"dependents": {
"app.py": {
"id": "app.py",
"symbols": {
"app": "app"
}
}
}
},
"WizardCreateView": {
"id": "WizardCreateView",
"type": "class",
"positions": [
{
"start": {
"index": 252,
"row": 10,
"column": 0
},
"end": {
"index": 441,
"row": 14,
"column": 25
}
}
],
"description": "",
"metrics": {
"linesCount": 5,
"codeLineCount": 5,
"characterCount": 189,
"codeCharacterCount": 157,
"dependencyCount": 3,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/wizards/services.py": {
"id": "api/wizards/services.py",
"isExternal": false,
"symbols": {
"WizardService": "WizardService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"request": "request"
}
}
},
"dependents": {
"api/wizards/views.py": {
"id": "api/wizards/views.py",
"symbols": {
"get_wizzards_bp": "get_wizzards_bp"
}
}
}
},
"WizardDeleteView": {
"id": "WizardDeleteView",
"type": "class",
"positions": [
{
"start": {
"index": 827,
"row": 30,
"column": 0
},
"end": {
"index": 981,
"row": 33,
"column": 19
}
}
],
"description": "",
"metrics": {
"linesCount": 4,
"codeLineCount": 4,
"characterCount": 154,
"codeCharacterCount": 131,
"dependencyCount": 2,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/wizards/services.py": {
"id": "api/wizards/services.py",
"isExternal": false,
"symbols": {
"WizardService": "WizardService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
}
},
"dependents": {
"api/wizards/views.py": {
"id": "api/wizards/views.py",
"symbols": {
"get_wizzards_bp": "get_wizzards_bp"
}
}
}
},
"WizardDetailView": {
"id": "WizardDetailView",
"type": "class",
"positions": [
{
"start": {
"index": 444,
"row": 17,
"column": 0
},
"end": {
"index": 603,
"row": 20,
"column": 21
}
}
],
"description": "",
"metrics": {
"linesCount": 4,
"codeLineCount": 4,
"characterCount": 159,
"codeCharacterCount": 136,
"dependencyCount": 2,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/wizards/services.py": {
"id": "api/wizards/services.py",
"isExternal": false,
"symbols": {
"WizardService": "WizardService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
}
},
"dependents": {
"api/wizards/views.py": {
"id": "api/wizards/views.py",
"symbols": {
"get_wizzards_bp": "get_wizzards_bp"
}
}
}
},
"WizardListView": {
"id": "WizardListView",
"type": "class",
"positions": [
{
"start": {
"index": 109,
"row": 4,
"column": 0
},
"end": {
"index": 249,
"row": 7,
"column": 22
}
}
],
"description": "",
"metrics": {
"linesCount": 4,
"codeLineCount": 4,
"characterCount": 140,
"codeCharacterCount": 117,
"dependencyCount": 2,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/wizards/services.py": {
"id": "api/wizards/services.py",
"isExternal": false,
"symbols": {
"WizardService": "WizardService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
}
},
"dependents": {
"api/wizards/views.py": {
"id": "api/wizards/views.py",
"symbols": {
"get_wizzards_bp": "get_wizzards_bp"
}
}
}
},
"WizardUpdateView": {
"id": "WizardUpdateView",
"type": "class",
"positions": [
{
"start": {
"index": 606,
"row": 23,
"column": 0
},
"end": {
"index": 824,
"row": 27,
"column": 29
}
}
],
"description": "",
"metrics": {
"linesCount": 5,
"codeLineCount": 5,
"characterCount": 218,
"codeCharacterCount": 186,
"dependencyCount": 3,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/wizards/services.py": {
"id": "api/wizards/services.py",
"isExternal": false,
"symbols": {
"WizardService": "WizardService"
}
},
"flask.views": {
"id": "flask.views",
"isExternal": true,
"symbols": {
"MethodView": "MethodView"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"request": "request"
}
}
},
"dependents": {
"api/wizards/views.py": {
"id": "api/wizards/views.py",
"symbols": {
"get_wizzards_bp": "get_wizzards_bp"
}
}
}
}
}
},
"app.py": {
"id": "app.py",
"filePath": "app.py",
"metrics": {
"linesCount": 17,
"codeLineCount": 17,
"characterCount": 698,
"codeCharacterCount": 538,
"dependencyCount": 4,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"language": "python",
"dependencies": {
"api/wizards/views.py": {
"id": "api/wizards/views.py",
"isExternal": false,
"symbols": {
"get_wizzards_bp": "get_wizzards_bp"
}
},
"api/views/elves.py": {
"id": "api/views/elves.py",
"isExternal": false,
"symbols": {
"elves_bp": "elves_bp"
}
},
"api/views/hobbits.py": {
"id": "api/views/hobbits.py",
"isExternal": false,
"symbols": {
"hobbits_bp": "hobbits_bp"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"Flask": "Flask"
}
}
},
"dependents": {
"app.py": {
"id": "app.py",
"symbols": {
"hello_world": "hello_world",
"liveness": "liveness",
"readiness": "readiness"
}
}
},
"symbols": {
"app": {
"id": "app",
"type": "variable",
"positions": [
{
"start": {
"index": 150,
"row": 5,
"column": 0
},
"end": {
"index": 171,
"row": 5,
"column": 21
}
},
{
"start": {
"index": 451,
"row": 23,
"column": 0
},
"end": {
"index": 519,
"row": 23,
"column": 68
}
},
{
"start": {
"index": 548,
"row": 26,
"column": 0
},
"end": {
"index": 605,
"row": 26,
"column": 57
}
},
{
"start": {
"index": 636,
"row": 29,
"column": 0
},
"end": {
"index": 697,
"row": 29,
"column": 61
}
}
],
"description": "",
"metrics": {
"linesCount": 4,
"codeLineCount": 4,
"characterCount": 207,
"codeCharacterCount": 207,
"dependencyCount": 4,
"dependentCount": 1,
"cyclomaticComplexity": 1
},
"dependencies": {
"api/wizards/views.py": {
"id": "api/wizards/views.py",
"isExternal": false,
"symbols": {
"get_wizzards_bp": "get_wizzards_bp"
}
},
"api/views/elves.py": {
"id": "api/views/elves.py",
"isExternal": false,
"symbols": {
"elves_bp": "elves_bp"
}
},
"api/views/hobbits.py": {
"id": "api/views/hobbits.py",
"isExternal": false,
"symbols": {
"hobbits_bp": "hobbits_bp"
}
},
"flask": {
"id": "flask",
"isExternal": true,
"symbols": {
"Flask": "Flask"
}
}
},
"dependents": {
"app.py": {
"id": "app.py",
"symbols": {
"hello_world": "hello_world",
"liveness": "liveness",
"readiness": "readiness"
}
}
}
},
"hello_world": {
"id": "hello_world",
"type": "function",
"positions": [
{
"start": {
"index": 174,
"row": 8,
"column": 0
},
"end": {
"index": 246,
"row": 10,
"column": 39
}
}
],
"description": "",
"metrics": {
"linesCount": 3,
"codeLineCount": 3,
"characterCount": 72,
"codeCharacterCount": 66,
"dependencyCount": 1,
"dependentCount": 0,
"cyclomaticComplexity": 1
},
"dependencies": {
"app.py": {
"id": "app.py",
"isExternal": false,
"symbols": {
"app": "app"
}
}
},
"dependents": {}
},
"liveness": {
"id": "liveness",
"type": "function",
"positions": [
{
"start": {
"index": 249,
"row": 13,
"column": 0
},
"end": {
"index": 314,
"row": 15,
"column": 27
}
}
],
"description": "",
"metrics": {
"linesCount": 3,
"codeLineCount": 3,
"characterCount": 65,
"codeCharacterCount": 59,
"dependencyCount": 1,
"dependentCount": 0,
"cyclomaticComplexity": 1
},
"dependencies": {
"app.py": {
"id": "app.py",
"isExternal": false,
"symbols": {
"app": "app"
}
}
},
"dependents": {}
},
"readiness": {
"id": "readiness",
"type": "function",
"positions": [
{
"start": {
"index": 353,
"row": 18,
"column": 0
},
"end": {
"index": 420,
"row": 20,
"column": 27
}
}
],
"description": "",
"metrics": {
"linesCount": 3,
"codeLineCount": 3,
"characterCount": 67,
"codeCharacterCount": 61,
"dependencyCount": 1,
"dependentCount": 0,
"cyclomaticComplexity": 1
},
"dependencies": {
"app.py": {
"id": "app.py",
"isExternal": false,
"symbols": {
"app": "app"
}
}
},
"dependents": {}
}
}
}
}
}
================================================
FILE: examples/python/flask/.napirc
================================================
{
"language": "python",
"python": {
"version": "3.12"
},
"project": {
"include": ["app.py", "api/**"],
"exclude": []
},
"outDir": "napi-output",
"audit": {
"file": { "maxCodeChar": 5000, "maxCodeLine": 300, "maxDependency": 20, "maxCyclomaticComplexity": 50 },
"symbol": { "maxCodeChar": 1000, "maxCodeLine": 80, "maxDependency": 10, "maxCyclomaticComplexity": 15 }
}
}
================================================
FILE: examples/python/flask/api/data/elves.py
================================================
class Elf:
def __init__(self, data):
self.id = data.get("id")
self.name = data.get("name")
def update(self, data):
self.name = data.get("name")
elves = [
{"id": 1, "name": "Legolas"},
{"id": 2, "name": "Thranduil"},
{"id": 3, "name": "Galadriel"},
]
================================================
FILE: examples/python/flask/api/data/hobbits.py
================================================
class Hobbit:
def __init__(self, data):
self.id = data.get("id")
self.name = data.get("name")
def update(self, data):
self.name = data.get("name")
hobbits = [
{"id": 1, "name": "Frodo Baggins"},
{"id": 2, "name": "Samwise Gamgee"},
{"id": 3, "name": "Meriadoc Brandybuck"},
]
================================================
FILE: examples/python/flask/api/services/elves.py
================================================
from api.data.elves import Elf, elves
class ElfService:
def get_elves(self):
return elves
def get_elf(self, elf_id):
for elf in elves:
if elf.id == elf_id:
return elf
return None
def create_elf(self, data):
new_elf = Elf(data)
elves.append(new_elf)
return new_elf
def update_elf(self, elf_id, data):
elf: Elf = elves[elf_id]
elf.update(data)
return elf
def delete_elf(self, elf_id):
for elf in elves:
if elf.id == elf_id:
elves.remove(elf)
================================================
FILE: examples/python/flask/api/services/hobbits.py
================================================
from api.data.hobbits import Hobbit, hobbits
class HobbitService:
def get_hobbits(self):
return hobbits
def get_hobbit(self, hobbit_id):
for hobbit in hobbits:
if hobbit.id == hobbit_id:
return hobbit
return None
def create_hobbit(self, data):
new_hobbit = Hobbit(data)
hobbits.append(new_hobbit)
return new_hobbit
def update_hobbit(self, hobbit_id, data):
hobbit: Hobbit = hobbits[hobbit_id]
hobbit.update(data)
return hobbit
def delete_hobbit(self, hobbit_id):
for hobbit in hobbits:
if hobbit.id == hobbit_id:
hobbits.remove(hobbit)
================================================
FILE: examples/python/flask/api/views/elves.py
================================================
from flask.views import MethodView
from flask import request, Blueprint
from api.services.elves import ElfService
elves_bp = Blueprint("elves", __name__)
class ElfListView(MethodView):
def get(self, *args, **kwargs):
elves = ElfService().get_elves()
return elves
# @nanoapi method:GET path:/api/elves group:elf_read
elves_bp.add_url_rule("/", view_func=ElfListView.as_view("elf_list"), methods=["GET"])
class ElfCreateView(MethodView):
def post(self, *args, **kwargs):
data = request.get_json()
new_elf = ElfService().create_elf(data)
return new_elf
# @nanoapi method:POST path:/api/elves group:elf_write
elves_bp.add_url_rule(
"/", view_func=ElfCreateView.as_view("elf_create"), methods=["POST"]
)
class ElfDetailView(MethodView):
def get(self, elf_id, *args, **kwargs):
elf = ElfService().get_elf(elf_id)
return elf
# @nanoapi method:GET path:/api/elves/<elf_id> group:elf_read
elves_bp.add_url_rule(
"/<int:elf_id>", view_func=ElfDetailView.as_view("elf_detail"), methods=["GET"]
)
class ElfUpdateView(MethodView):
def put(self, elf_id, *args, **kwargs):
data = request.get_json()
updated_elf = ElfService().update_elf(elf_id, data)
return updated_elf
# @nanoapi method:PUT path:/api/elves/<elf_id> group:elf_write
elves_bp.add_url_rule(
"/<int:elf_id>", view_func=ElfUpdateView.as_view("elf_update"), methods=["PUT"]
)
class ElfDeleteView(MethodView):
def delete(self, elf_id, *args, **kwargs):
ElfService().delete_elf(elf_id)
return None
# @nanoapi method:DELETE path:/api/elves/<elf_id> group:elf_write
elves_bp.add_url_rule(
"/<int:elf_id>", view_func=ElfDeleteView.as_view("elf_delete"), methods=["DELETE"]
)
================================================
FILE: examples/python/flask/api/views/hobbits.py
================================================
from flask.views import MethodView
from flask import request, Blueprint
from api.services.hobbits import HobbitService
hobbits_bp = Blueprint("hobbits", __name__)
class HobbitListView(MethodView):
def get(self, *args, **kwargs):
hobbits = HobbitService().get_hobbits()
return hobbits
# @nanoapi method:GET path:/api/hobbits group:hobbit_read
hobbits_bp.add_url_rule(
"/", view_func=HobbitListView.as_view("hobbit_list"), methods=["GET"]
)
class HobbitCreateView(MethodView):
def post(self, *args, **kwargs):
data = request.get_json()
new_hobbit = HobbitService().create_hobbit(data)
return new_hobbit
# @nanoapi method:POST path:/api/hobbits group:hobbit_write
hobbits_bp.add_url_rule(
"/", view_func=HobbitCreateView.as_view("hobbit_create"), methods=["POST"]
)
class HobbitDetailView(MethodView):
def get(self, hobbit_id, *args, **kwargs):
hobbit = HobbitService().get_hobbit(hobbit_id)
return hobbit
# @nanoapi method:GET path:/api/hobbits/<hobbit_id> group:hobbit_read
hobbits_bp.add_url_rule(
"/<int:hobbit_id>",
view_func=HobbitDetailView.as_view("hobbit_detail"),
methods=["GET"],
)
class HobbitUpdateView(MethodView):
def put(self, hobbit_id, *args, **kwargs):
data = request.get_json()
updated_hobbit = HobbitService().update_hobbit(hobbit_id, data)
return updated_hobbit
# @nanoapi method:PUT path:/api/hobbits/<hobbit_id> group:hobbit_write
hobbits_bp.add_url_rule(
"/<int:hobbit_id>",
view_func=HobbitUpdateView.as_view("hobbit_update"),
methods=["PUT"],
)
class HobbitDeleteView(MethodView):
def delete(self, hobbit_id, *args, **kwargs):
HobbitService().delete_hobbit(hobbit_id)
return None
# @nanoapi method:DELETE path:/api/hobbits/<hobbit_id> group:hobbit_write
hobbits_bp.add_url_rule(
"/<int:hobbit_id>",
view_func=HobbitDeleteView.as_view("hobbit_delete"),
methods=["DELETE"],
)
================================================
FILE: examples/python/flask/api/wizards/data.py
================================================
class Wizard:
def __init__(self, data):
self.id = data.get("id")
self.name = data.get("name")
def update(self, data):
self.name = data.get("name")
wizards = [
{"id": 1, "name": "Harry Potter"},
{"id": 2, "name": "Hermione Granger"},
{"id": 3, "name": "Ron Weasley"},
]
================================================
FILE: examples/python/flask/api/wizards/services.py
================================================
from api.data.hobbits import Hobbit, hobbits
from api.wizards.data import Wizard, wizards
class WizardService:
def get_wizards(self):
return wizards
def get_wizard(self, wizard_id):
for wizard in wizards:
if wizard.id == wizard_id:
return wizard
return None
def create_wizard(self, data):
new_wizard = Wizard(data)
wizards.append(new_wizard)
return new_wizard
def update_wizard(self, wizard_id, data):
wizard: Wizard = wizards[wizard_id]
wizard.update(data)
return wizard
def delete_wizard(self, wizard_id):
for wizard in wizards:
if wizard.id == wizard_id:
wizards.remove(wizard)
================================================
FILE: examples/python/flask/api/wizards/views.py
================================================
from flask.views import MethodView
from flask import request, Blueprint
from .services import WizardService
class WizardListView(MethodView):
def get(self, *args, **kwargs):
wizards = WizardService().get_wizards()
return wizards
class WizardCreateView(MethodView):
def post(self, *args, **kwargs):
data = request.get_json()
new_wizard = WizardService().create_wizard(data)
return new_wizard
class WizardDetailView(MethodView):
def get(self, wizard_id, *args, **kwargs):
wizard = WizardService().get_wizard(wizard_id)
return wizard
class WizardUpdateView(MethodView):
def put(self, wizard_id, *args, **kwargs):
data = request.get_json()
updated_wizard = WizardService().update_wizard(wizard_id, data)
return updated_wizard
class WizardDeleteView(MethodView):
def delete(self, wizard_id, *args, **kwargs):
WizardService().delete_wizard(wizard_id)
return None
def get_wizzards_bp():
wizards_bp = Blueprint("wizards", __name__)
# @nanoapi method:GET path:/api/wizards group:wizard_read
wizards_bp.add_url_rule(
"/", view_func=WizardListView.as_view("wizard_list"), methods=["GET"]
)
# @nanoapi method:POST path:/api/wizards group:wizard_write
wizards_bp.add_url_rule(
"/", view_func=WizardCreateView.as_view("wizard_create"), methods=["POST"]
)
# @nanoapi method:GET path:/api/wizards/<wizard_id> group:wizard_read
wizards_bp.add_url_rule(
"/<int:wizard_id>",
view_func=WizardDetailView.as_view("wizard_detail"),
methods=["GET"],
)
# @nanoapi method:PUT path:/api/wizards/<wizard_id> group:wizard_write
wizards_bp.add_url_rule(
"/<int:wizard_id>",
view_func=WizardUpdateView.as_view("wizard_update"),
methods=["PUT"],
)
# @nanoapi method:DELETE path:/api/wizards/<wizard_id> group:wizard_write
wizards_bp.add_url_rule(
"/<int:wizard_id>",
view_func=WizardDeleteView.as_view("wizard_delete"),
methods=["DELETE"],
)
return wizards_bp
================================================
FILE: examples/python/flask/app.py
================================================
from flask import Flask
from .api.wizards.views import get_wizzards_bp
from api.views.elves import elves_bp
from api.views.hobbits import hobbits_bp
app = Flask(__name__)
@app.get("/")
def hello_world():
return {"message": "Hello, World!"}
@app.get("/liveness")
def liveness():
return {"status": "ok"}
# @nanoapi method:GET path:readiness
@app.get("/readiness")
def readiness():
return {"status": "ok"}
# @nanoapi path:/api/wizards
app.register_blueprint(get_wizzards_bp(), url_prefix="/api/wizards")
# @nanoapi path:/api/elves
app.register_blueprint(elves_bp, url_prefix="/api/elves")
# @nanoapi path:/api/hobbits
app.register_blueprint(hobbits_bp, url_prefix="/api/hobbits")
================================================
FILE: examples/python/flask/pyproject.toml
================================================
[tool.poetry]
name = "flask-example"
version = "0.1.0"
description = ""
authors = ["florianbgt <florian.bigot321@gmail.com>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.12"
flask = "^3.1.0"
[tool.poetry.group.dev.dependencies]
ruff = "^0.7.4"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
================================================
FILE: install_scripts/install.ps1
================================================
# PowerShell script to install NanoAPI CLI on Windows
$ErrorActionPreference = "Stop"
# Define platform-specific filename
$FILENAME = "napi.exe"
$RELEASE_URL = "https://github.com/nanoapi-io/napi/releases/latest/download/"
$DOWNLOAD_URL = "$RELEASE_URL$FILENAME"
# Define install path (add this path to your system PATH if needed)
$INSTALL_DIR = "$env:ProgramFiles\NanoAPI"
$INSTALL_PATH = Join-Path $INSTALL_DIR "napi.exe"
$BACKUP_PATH = "$INSTALL_PATH.bak"
# Create install directory if it doesn't exist
if (-Not (Test-Path $INSTALL_DIR)) {
New-Item -ItemType Directory -Path $INSTALL_DIR | Out-Null
}
# Backup existing binary
if (Test-Path $INSTALL_PATH) {
Write-Output "Existing version found, creating a backup..."
Move-Item -Force -Path $INSTALL_PATH -Destination $BACKUP_PATH
} else {
Write-Output "No existing version found, proceeding with installation."
}
# Download the binary
$TEMP_PATH = Join-Path $env:TEMP $FILENAME
Write-Output "Downloading the latest version of $FILENAME..."
Invoke-WebRequest -Uri $DOWNLOAD_URL -OutFile $TEMP_PATH
# Install the binary
Write-Output "Installing new version..."
try {
Move-Item -Force -Path $TEMP_PATH -Destination $INSTALL_PATH
Write-Output "Installation/Update successful! You can now use your CLI by typing 'napi' if it's in your PATH."
} catch {
Write-Error "Update failed! Restoring the old version..."
if (Test-Path $BACKUP_PATH) {
Move-Item -Force -Path $BACKUP_PATH -Destination $INSTALL_PATH
Write-Output "Restored the old version. Please try again later."
} else {
Write-Error "Backup not found. Manual intervention required."
}
}
================================================
FILE: install_scripts/install.sh
================================================
#!/bin/bash
# Determine platform and release URL for GitHub
OS=$(uname -s)
RELEASE_URL="https://github.com/nanoapi-io/napi/releases/latest/download/"
# Define the appropriate binary based on the OS
if [ "$OS" == "Darwin" ]; then
FILENAME="napi.macos"
elif [ "$OS" == "Linux" ]; then
FILENAME="napi.linux"
else
echo "Unsupported OS: $OS"
exit 1
fi
# Set the installation path
INSTALL_PATH="/usr/local/bin/napi"
BACKUP_PATH="$INSTALL_PATH.bak"
# Check if the executable already exists
if [ -f "$INSTALL_PATH" ]; then
echo "Existing version found, creating a backup..."
sudo mv "$INSTALL_PATH" "$BACKUP_PATH"
else
echo "No existing version found, proceeding with installation."
fi
# Download the binary
echo "Downloading the latest version of $FILENAME..."
curl -L "$RELEASE_URL$FILENAME" -o "$FILENAME"
# Make it executable
chmod +x "$FILENAME"
# Attempt to install the new version
echo "Installing new version..."
sudo mv "$FILENAME" "$INSTALL_PATH"
# Check if the installation was successful
if [ $? -eq 0 ]; then
echo "Installation/Update successful! You can now use your CLI by typing 'napi' in the terminal."
else
# If the installation failed, restore the backup
echo "Update failed! Restoring the old version..."
sudo mv "$BACKUP_PATH" "$INSTALL_PATH"
echo "Restored the old version. Please try again later."
fi
================================================
FILE: media/README.md
================================================
## Media
The content in this folder is meant to be used when creating content about
NanoAPI. It includes images and other media that can be used to promote the
project.
### Fonts
The main font for the logo is Plus Jakarta Sans. It can be found on
[Google Fonts](https://fonts.google.com/specimen/Plus+Jakarta+Sans).
### Colors
The main colors for the project are:
- Background: #0B0A32
- Secondary Background: #15143D
- Surface: #3A397C
- Secondary Surface: #25235C
- Border: #3A397C
- Text: #FFFFFF
- Gray: #B4B4C9
- Primary: #5848E8
- Secondary: #D62B80
### Mission
NanoAPI is a tool that helps developers refactor their codebase into smaller,
more manageable pieces at build time. It is designed to help developers quickly
refactor large/monolith codebases into smaller, more manageable pieces at build
time. It increases robustness by reducing downtime through isolating. It helps
developers better understand what their codebase is doing today. It creates a
new development paradigm (develop monolith, deploy microservice) for projects
moving fast. We aim to drag developers kicking and screaming into more energy
efficient software.
### Past PR
- [Sustainable Software](https://www.linkedin.com/pulse/nanoapi-founders-sustainable-software-why-our-planet-m63be/)
### Contact
- [info@nanoapi.io](mailto:info@nanoapi.io)
================================================
FILE: scripts/get_version.ts
================================================
import denoJson from "../deno.json" with { type: "json" };
const encoder = new TextEncoder();
const version = encoder.encode(denoJson.version);
Deno.stdout.writeSync(version);
Deno.exit(0);
================================================
FILE: src/cli/handlers/extract/index.ts
================================================
import type { Arguments } from "yargs-types";
import type { localConfigSchema } from "../../middlewares/napiConfig.ts";
import type { z } from "zod";
import { extractSymbols } from "../../../symbolExtractor/index.ts";
import {
getExtensionsForLanguage,
getFilesFromDirectory,
writeFilesToDirectory,
} from "../../../helpers/fileSystem/index.ts";
import { join } from "@std/path";
import { napiConfigMiddleware } from "../../middlewares/napiConfig.ts";
import type { DependencyManifest } from "../../../manifest/dependencyManifest/types.ts";
import type { globalConfigSchema } from "../../middlewares/globalConfig.ts";
const NAPI_DIR = ".napi";
const MANIFESTS_DIR = "manifests";
interface ManifestEnvelope {
id: string;
branch: string;
commitSha: string;
commitShaDate: string;
createdAt: string;
manifest: DependencyManifest;
}
function getLatestManifestId(workdir: string): string | null {
const manifestsDir = join(workdir, NAPI_DIR, MANIFESTS_DIR);
try {
const entries: { name: string }[] = [];
for (const entry of Deno.readDirSync(manifestsDir)) {
if (entry.isFile && entry.name.endsWith(".json")) {
entries.push(entry);
}
}
if (entries.length === 0) return null;
entries.sort((a, b) => b.name.localeCompare(a.name));
return entries[0].name.replace(".json", "");
} catch {
return null;
}
}
function loadManifest(workdir: string, manifestId: string): ManifestEnvelope {
const manifestPath = join(
workdir,
NAPI_DIR,
MANIFESTS_DIR,
`${manifestId}.json`,
);
const content = Deno.readTextFileSync(manifestPath);
return JSON.parse(content) as ManifestEnvelope;
}
function builderFunction(
yargs: Arguments & {
globalConfig: z.infer<typeof globalConfigSchema>;
},
) {
return yargs
.middleware(napiConfigMiddleware)
.option("symbol", {
type: "array" as const,
description:
"Symbols to extract (format: file|symbol where file is absolute path from .napirc and symbol is the symbol name)",
string: true,
requiresArg: true,
demandOption: true,
})
.option("manifestId", {
type: "string",
description:
"The manifest ID to use for the extraction (d
gitextract_l1fkgvec/
├── .github/
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.md
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ └── feature_request.md
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── SECURITY.md
│ └── workflows/
│ ├── lint_test_compile.yml
│ └── release.yml
├── .gitignore
├── .vscode/
│ └── settings.json
├── CLA/
│ ├── CORPORATE_CONTRIBUTOR_LICENSE_AGREEMENT.md
│ └── INDIVIDUAL_CONTRIBUTOR_LICENSE_AGREEMENT.md
├── LICENSE.md
├── LICENSE_EE.md
├── README.md
├── SUPPORT.md
├── USERS.md
├── WEEKLY_UPDATE_LOG.md
├── deno.json
├── examples/
│ ├── README.md
│ ├── c/
│ │ └── network/
│ │ ├── .napirc
│ │ ├── makefile
│ │ └── src/
│ │ ├── cartographie/
│ │ │ ├── cartographie.c
│ │ │ ├── cartographie.h
│ │ │ ├── tnmap.c
│ │ │ └── tnmap.h
│ │ ├── main.c
│ │ └── tcp_cs/
│ │ ├── clientTCP.c
│ │ ├── clientTCP.h
│ │ ├── serveurTCP.c
│ │ └── serveurTCP.h
│ ├── csharp/
│ │ └── EndpointExample/
│ │ ├── .napirc
│ │ ├── EndpointExample.csproj
│ │ ├── Program.cs
│ │ ├── Properties/
│ │ │ └── launchSettings.json
│ │ ├── appsettings.Development.json
│ │ ├── appsettings.json
│ │ └── src/
│ │ ├── MyEndpoint.cs
│ │ ├── MyRequest.cs
│ │ └── MyResponse.cs
│ ├── java/
│ │ └── websocket/
│ │ ├── README.md
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── samples/
│ │ │ │ └── websocket/
│ │ │ │ ├── client/
│ │ │ │ │ ├── GreetingService.java
│ │ │ │ │ ├── SimpleClientWebSocketHandler.java
│ │ │ │ │ └── SimpleGreetingService.java
│ │ │ │ ├── config/
│ │ │ │ │ └── SampleWebSocketsApplication.java
│ │ │ │ ├── echo/
│ │ │ │ │ ├── DefaultEchoService.java
│ │ │ │ │ ├── EchoService.java
│ │ │ │ │ └── EchoWebSocketHandler.java
│ │ │ │ └── snake/
│ │ │ │ ├── Direction.java
│ │ │ │ ├── Location.java
│ │ │ │ ├── Snake.java
│ │ │ │ ├── SnakeTimer.java
│ │ │ │ ├── SnakeUtils.java
│ │ │ │ └── SnakeWebSocketHandler.java
│ │ │ └── resources/
│ │ │ └── static/
│ │ │ ├── echo.html
│ │ │ ├── index.html
│ │ │ └── snake.html
│ │ └── test/
│ │ └── java/
│ │ └── samples/
│ │ └── websocket/
│ │ ├── echo/
│ │ │ ├── CustomContainerWebSocketsApplicationTests.java
│ │ │ └── SampleWebSocketsApplicationTests.java
│ │ └── snake/
│ │ └── SnakeTimerTests.java
│ └── python/
│ └── flask/
│ ├── .napi/
│ │ └── manifests/
│ │ └── 1775598176791-d5c2217.json
│ ├── .napirc
│ ├── api/
│ │ ├── data/
│ │ │ ├── elves.py
│ │ │ └── hobbits.py
│ │ ├── services/
│ │ │ ├── elves.py
│ │ │ └── hobbits.py
│ │ ├── views/
│ │ │ ├── elves.py
│ │ │ └── hobbits.py
│ │ └── wizards/
│ │ ├── data.py
│ │ ├── services.py
│ │ └── views.py
│ ├── app.py
│ └── pyproject.toml
├── install_scripts/
│ ├── install.ps1
│ └── install.sh
├── media/
│ └── README.md
├── scripts/
│ └── get_version.ts
├── src/
│ ├── cli/
│ │ ├── handlers/
│ │ │ ├── extract/
│ │ │ │ └── index.ts
│ │ │ ├── generate/
│ │ │ │ └── index.ts
│ │ │ ├── init/
│ │ │ │ └── index.ts
│ │ │ ├── set/
│ │ │ │ ├── apiKey.ts
│ │ │ │ └── index.ts
│ │ │ └── view/
│ │ │ └── index.ts
│ │ ├── index.ts
│ │ └── middlewares/
│ │ ├── checkVersion.ts
│ │ ├── globalConfig.ts
│ │ └── napiConfig.ts
│ ├── helpers/
│ │ ├── fileSystem/
│ │ │ └── index.ts
│ │ ├── sourceCode/
│ │ │ ├── index.test.ts
│ │ │ └── index.ts
│ │ └── treeSitter/
│ │ └── parsers.ts
│ ├── index.test.ts
│ ├── index.ts
│ ├── languagePlugins/
│ │ ├── c/
│ │ │ ├── README.md
│ │ │ ├── dependencyFormatting/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── types.ts
│ │ │ ├── extractor/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── headerResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── includeResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── invocationResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── metrics/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── symbolRegistry/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── testFiles/
│ │ │ │ ├── cFiles/
│ │ │ │ │ ├── .clangd
│ │ │ │ │ ├── .napirc
│ │ │ │ │ ├── all.h
│ │ │ │ │ ├── burgers.c
│ │ │ │ │ ├── burgers.h
│ │ │ │ │ ├── crashcases.h
│ │ │ │ │ ├── errors.h
│ │ │ │ │ ├── main.c
│ │ │ │ │ ├── oldman.h
│ │ │ │ │ ├── personnel.c
│ │ │ │ │ └── personnel.h
│ │ │ │ └── index.ts
│ │ │ └── warnings/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ ├── queries.ts
│ │ │ └── types.ts
│ │ ├── csharp/
│ │ │ ├── README.md
│ │ │ ├── dependencyFormatting/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── extensionResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── extractor/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── invocationResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── metricsAnalyzer/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── namespaceMapper/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── namespaceResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── projectMapper/
│ │ │ │ ├── index.test.ts
│ │ │ │ └── index.ts
│ │ │ ├── testFiles/
│ │ │ │ ├── csharpFiles/
│ │ │ │ │ ├── 2Namespaces1File.cs
│ │ │ │ │ ├── Models.cs
│ │ │ │ │ ├── Namespaced.cs
│ │ │ │ │ ├── Nested.cs
│ │ │ │ │ ├── OtherFileSameNamespace.cs
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ ├── SemiNamespaced.cs
│ │ │ │ │ ├── Subfolder/
│ │ │ │ │ │ ├── GlobalUsings.cs
│ │ │ │ │ │ └── TestFiles.Subfolder.csproj
│ │ │ │ │ ├── TestFiles.csproj
│ │ │ │ │ └── Usage.cs
│ │ │ │ └── index.ts
│ │ │ └── usingResolver/
│ │ │ ├── index.test.ts
│ │ │ └── index.ts
│ │ ├── java/
│ │ │ ├── dependencyFormatting/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── types.ts
│ │ │ ├── extractor/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── types.ts
│ │ │ ├── importResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── types.ts
│ │ │ ├── invocationResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── metrics/
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ ├── packageMapper/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── types.ts
│ │ │ ├── packageResolver/
│ │ │ │ ├── index.test.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── queries.ts
│ │ │ │ └── types.ts
│ │ │ └── testFiles/
│ │ │ ├── constants.ts
│ │ │ ├── index.ts
│ │ │ └── napi-tests/
│ │ │ ├── .project
│ │ │ └── src/
│ │ │ └── main/
│ │ │ └── java/
│ │ │ └── io/
│ │ │ └── nanoapi/
│ │ │ └── testfiles/
│ │ │ ├── App.java
│ │ │ ├── food/
│ │ │ │ ├── Burger.java
│ │ │ │ ├── Condiment.java
│ │ │ │ ├── DoubleBurger.java
│ │ │ │ ├── Food.java
│ │ │ │ ├── Steak.java
│ │ │ │ └── goron/
│ │ │ │ └── Pebble.java
│ │ │ └── medication/
│ │ │ └── Wormkiller.java
│ │ └── python/
│ │ ├── dependencyResolver/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── exportExtractor/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── importExtractor/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── itemResolver/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── metricAnalyzer/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── moduleResolver/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── symbolExtractor/
│ │ │ ├── index.test.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ └── usageResolver/
│ │ ├── index.test.ts
│ │ ├── index.ts
│ │ └── types.ts
│ ├── manifest/
│ │ ├── auditManifest/
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ └── dependencyManifest/
│ │ ├── c/
│ │ │ └── index.ts
│ │ ├── csharp/
│ │ │ ├── index.test.ts
│ │ │ └── index.ts
│ │ ├── index.ts
│ │ ├── java/
│ │ │ └── index.ts
│ │ ├── labeling/
│ │ │ ├── graph.ts
│ │ │ ├── grouping.ts
│ │ │ ├── index.ts
│ │ │ ├── model.ts
│ │ │ └── types.ts
│ │ ├── python/
│ │ │ └── index.ts
│ │ └── types.ts
│ ├── scripts/
│ │ └── generate_python_stdlib_list/
│ │ ├── output.json
│ │ └── script.sh
│ └── symbolExtractor/
│ ├── c/
│ │ └── index.ts
│ ├── csharp/
│ │ └── index.ts
│ ├── index.ts
│ ├── java/
│ │ └── index.ts
│ ├── python/
│ │ └── index.ts
│ └── types.ts
└── viewer/
├── .gitignore
├── README.md
├── index.html
├── src/
│ ├── App.tsx
│ ├── api.ts
│ ├── components/
│ │ ├── DependencyVisualizer/
│ │ │ ├── DependencyVisualizer.tsx
│ │ │ ├── components/
│ │ │ │ ├── BreadcrumbNav.tsx
│ │ │ │ ├── DisplayNameWithTooltip.tsx
│ │ │ │ ├── FileExplorerSidebar.tsx
│ │ │ │ ├── SymbolExtractionDialog.tsx
│ │ │ │ ├── contextMenu/
│ │ │ │ │ ├── FileContextMenu.tsx
│ │ │ │ │ └── SymbolContextMenu.tsx
│ │ │ │ ├── controls/
│ │ │ │ │ ├── ControlExtensions/
│ │ │ │ │ │ ├── FiltersExtension.tsx
│ │ │ │ │ │ ├── GraphDepthExtension.tsx
│ │ │ │ │ │ └── MetricsExtension.tsx
│ │ │ │ │ └── Controls.tsx
│ │ │ │ └── detailsPanes/
│ │ │ │ ├── AlertBadge.tsx
│ │ │ │ ├── FileDetailsPane.tsx
│ │ │ │ ├── Metrics.tsx
│ │ │ │ └── SymbolDetailsPane.tsx
│ │ │ └── visualizers/
│ │ │ ├── FileVisualizer.tsx
│ │ │ ├── ProjectVisualizer.tsx
│ │ │ └── SymbolVisualizer.tsx
│ │ └── shadcn/
│ │ ├── Alert.tsx
│ │ ├── Breadcrumb.tsx
│ │ ├── Button.tsx
│ │ ├── Card.tsx
│ │ ├── Dialog.tsx
│ │ ├── Dropdownmenu.tsx
│ │ ├── Input.tsx
│ │ ├── Label.tsx
│ │ ├── Scrollarea.tsx
│ │ ├── Separator.tsx
│ │ ├── Sheet.tsx
│ │ ├── Sidebar.tsx
│ │ ├── Skeleton.tsx
│ │ ├── Slider.tsx
│ │ ├── Tooltip.tsx
│ │ └── hooks/
│ │ └── use-mobile.tsx
│ ├── contexts/
│ │ └── ThemeProvider.tsx
│ ├── cytoscape/
│ │ ├── elements/
│ │ │ ├── file.ts
│ │ │ ├── project.ts
│ │ │ ├── symbol.ts
│ │ │ └── types.ts
│ │ ├── fileDependencyVisualizer/
│ │ │ └── index.ts
│ │ ├── label/
│ │ │ └── index.ts
│ │ ├── layout/
│ │ │ └── index.ts
│ │ ├── metrics/
│ │ │ └── index.ts
│ │ ├── projectDependencyVisualizer/
│ │ │ └── index.ts
│ │ ├── styles/
│ │ │ └── index.ts
│ │ └── symbolDependencyVisualizer/
│ │ └── index.ts
│ ├── index.css
│ ├── lib/
│ │ └── utils.ts
│ ├── main.tsx
│ ├── pages/
│ │ ├── ManifestList.tsx
│ │ └── ManifestView.tsx
│ └── types/
│ ├── auditManifest.ts
│ └── dependencyManifest.ts
└── vite.config.ts
SYMBOL INDEX (999 symbols across 211 files)
FILE: examples/c/network/src/cartographie/cartographie.c
function scanHorizontal (line 3) | void scanHorizontal(const char* network) {
FILE: examples/c/network/src/cartographie/tnmap.c
function tnmap (line 5) | int tnmap(const char* ip_addr) {
function scanVertical (line 50) | void scanVertical(const char* ip_addr) {
FILE: examples/c/network/src/main.c
function main (line 5) | int main(int argc, char *argv[]) {
FILE: examples/c/network/src/tcp_cs/clientTCP.c
function startClient (line 3) | int startClient(int argc, char *argv[]) {
FILE: examples/c/network/src/tcp_cs/serveurTCP.c
function startServer (line 3) | int startServer(void) {
FILE: examples/csharp/EndpointExample/src/MyEndpoint.cs
class MyEndpoint (line 1) | public class MyEndpoint : Endpoint<MyRequest, MyResponse>
method Configure (line 3) | public override void Configure()
method HandleAsync (line 9) | public override async Task HandleAsync(MyRequest req, CancellationToke...
FILE: examples/csharp/EndpointExample/src/MyRequest.cs
class MyRequest (line 1) | public class MyRequest
FILE: examples/csharp/EndpointExample/src/MyResponse.cs
class MyResponse (line 1) | public class MyResponse
FILE: examples/java/websocket/src/main/java/samples/websocket/client/GreetingService.java
type GreetingService (line 19) | public interface GreetingService {
method getGreeting (line 21) | String getGreeting();
FILE: examples/java/websocket/src/main/java/samples/websocket/client/SimpleClientWebSocketHandler.java
class SimpleClientWebSocketHandler (line 28) | public class SimpleClientWebSocketHandler extends TextWebSocketHandler {
method SimpleClientWebSocketHandler (line 36) | @Autowired
method afterConnectionEstablished (line 43) | @Override
method handleTextMessage (line 49) | @Override
FILE: examples/java/websocket/src/main/java/samples/websocket/client/SimpleGreetingService.java
class SimpleGreetingService (line 19) | public class SimpleGreetingService implements GreetingService {
method getGreeting (line 21) | @Override
FILE: examples/java/websocket/src/main/java/samples/websocket/config/SampleWebSocketsApplication.java
class SampleWebSocketsApplication (line 38) | @Configuration
method registerWebSocketHandlers (line 44) | @Override
method configure (line 50) | @Override
method main (line 55) | public static void main(String[] args) {
method echoService (line 59) | @Bean
method greetingService (line 64) | @Bean
method echoWebSocketHandler (line 69) | @Bean
method snakeWebSocketHandler (line 74) | @Bean
FILE: examples/java/websocket/src/main/java/samples/websocket/echo/DefaultEchoService.java
class DefaultEchoService (line 19) | public class DefaultEchoService implements EchoService {
method DefaultEchoService (line 23) | public DefaultEchoService(String echoFormat) {
method getMessage (line 27) | @Override
FILE: examples/java/websocket/src/main/java/samples/websocket/echo/EchoService.java
type EchoService (line 19) | public interface EchoService {
method getMessage (line 21) | String getMessage(String message);
FILE: examples/java/websocket/src/main/java/samples/websocket/echo/EchoWebSocketHandler.java
class EchoWebSocketHandler (line 31) | public class EchoWebSocketHandler extends TextWebSocketHandler {
method EchoWebSocketHandler (line 37) | @Autowired
method afterConnectionEstablished (line 42) | @Override
method handleTextMessage (line 47) | @Override
method handleTransportError (line 55) | @Override
FILE: examples/java/websocket/src/main/java/samples/websocket/snake/Direction.java
type Direction (line 20) | public enum Direction {
FILE: examples/java/websocket/src/main/java/samples/websocket/snake/Location.java
class Location (line 20) | public class Location {
method Location (line 28) | public Location(int x, int y) {
method getAdjacentLocation (line 33) | public Location getAdjacentLocation(Direction direction) {
method equals (line 50) | @Override
method hashCode (line 71) | @Override
FILE: examples/java/websocket/src/main/java/samples/websocket/snake/Snake.java
class Snake (line 27) | public class Snake {
method Snake (line 40) | public Snake(int id, WebSocketSession session) {
method resetState (line 47) | private void resetState() {
method kill (line 54) | private synchronized void kill() throws Exception {
method reward (line 59) | private synchronized void reward() throws Exception {
method sendMessage (line 64) | protected void sendMessage(String msg) throws Exception {
method update (line 68) | public synchronized void update(Collection<Snake> snakes) throws Excep...
method handleCollisions (line 93) | private void handleCollisions(Collection<Snake> snakes) throws Excepti...
method getHead (line 107) | public synchronized Location getHead() {
method getTail (line 111) | public synchronized Collection<Location> getTail() {
method setDirection (line 115) | public synchronized void setDirection(Direction direction) {
method getLocationsJson (line 119) | public synchronized String getLocationsJson() {
method getId (line 132) | public int getId() {
method getHexColor (line 136) | public String getHexColor() {
FILE: examples/java/websocket/src/main/java/samples/websocket/snake/SnakeTimer.java
class SnakeTimer (line 34) | public class SnakeTimer {
method addSnake (line 44) | public static synchronized void addSnake(Snake snake) {
method getSnakes (line 51) | public static Collection<Snake> getSnakes() {
method removeSnake (line 55) | public static synchronized void removeSnake(Snake snake) {
method tick (line 62) | public static void tick() throws Exception {
method broadcast (line 76) | public static void broadcast(String message) throws Exception {
method startTimer (line 89) | public static void startTimer() {
method stopTimer (line 104) | public static void stopTimer() {
FILE: examples/java/websocket/src/main/java/samples/websocket/snake/SnakeUtils.java
class SnakeUtils (line 23) | public class SnakeUtils {
method getRandomHexColor (line 31) | public static String getRandomHexColor() {
method getRandomLocation (line 41) | public static Location getRandomLocation() {
method roundByGridSize (line 47) | private static int roundByGridSize(int value) {
FILE: examples/java/websocket/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java
class SnakeWebSocketHandler (line 30) | public class SnakeWebSocketHandler extends TextWebSocketHandler {
method getRandomHexColor (line 42) | public static String getRandomHexColor() {
method getRandomLocation (line 52) | public static Location getRandomLocation() {
method roundByGridSize (line 58) | private static int roundByGridSize(int value) {
method SnakeWebSocketHandler (line 65) | public SnakeWebSocketHandler() {
method afterConnectionEstablished (line 69) | @Override
method handleTextMessage (line 87) | @Override
method afterConnectionClosed (line 105) | @Override
FILE: examples/java/websocket/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java
class CustomContainerWebSocketsApplicationTests (line 50) | @RunWith(SpringJUnit4ClassRunner.class)
class CustomContainerConfiguration (line 65) | @Configuration
method embeddedServletContainerFactory (line 67) | @Bean
method runAndWait (line 73) | @Test
class ClientConfiguration (line 82) | @Configuration
method run (line 87) | @Override
method wsConnectionManager (line 94) | @Bean
method client (line 104) | @Bean
method handler (line 109) | @Bean
method greetingService (line 114) | @Bean
FILE: examples/java/websocket/src/test/java/samples/websocket/echo/SampleWebSocketsApplicationTests.java
class SampleWebSocketsApplicationTests (line 48) | @RunWith(SpringJUnit4ClassRunner.class)
method init (line 62) | @Before
method runAndWait (line 67) | @Test
class ClientConfiguration (line 76) | @Configuration
method run (line 81) | @Override
method wsConnectionManager (line 88) | @Bean
method client (line 98) | @Bean
method handler (line 103) | @Bean
method greetingService (line 108) | @Bean
FILE: examples/java/websocket/src/test/java/samples/websocket/snake/SnakeTimerTests.java
class SnakeTimerTests (line 29) | public class SnakeTimerTests {
method removeDysfunctionalSnakes (line 31) | @Test
FILE: examples/python/flask/api/data/elves.py
class Elf (line 1) | class Elf:
method __init__ (line 2) | def __init__(self, data):
method update (line 6) | def update(self, data):
FILE: examples/python/flask/api/data/hobbits.py
class Hobbit (line 1) | class Hobbit:
method __init__ (line 2) | def __init__(self, data):
method update (line 6) | def update(self, data):
FILE: examples/python/flask/api/services/elves.py
class ElfService (line 4) | class ElfService:
method get_elves (line 5) | def get_elves(self):
method get_elf (line 8) | def get_elf(self, elf_id):
method create_elf (line 14) | def create_elf(self, data):
method update_elf (line 19) | def update_elf(self, elf_id, data):
method delete_elf (line 24) | def delete_elf(self, elf_id):
FILE: examples/python/flask/api/services/hobbits.py
class HobbitService (line 4) | class HobbitService:
method get_hobbits (line 5) | def get_hobbits(self):
method get_hobbit (line 8) | def get_hobbit(self, hobbit_id):
method create_hobbit (line 14) | def create_hobbit(self, data):
method update_hobbit (line 19) | def update_hobbit(self, hobbit_id, data):
method delete_hobbit (line 24) | def delete_hobbit(self, hobbit_id):
FILE: examples/python/flask/api/views/elves.py
class ElfListView (line 8) | class ElfListView(MethodView):
method get (line 9) | def get(self, *args, **kwargs):
class ElfCreateView (line 18) | class ElfCreateView(MethodView):
method post (line 19) | def post(self, *args, **kwargs):
class ElfDetailView (line 31) | class ElfDetailView(MethodView):
method get (line 32) | def get(self, elf_id, *args, **kwargs):
class ElfUpdateView (line 43) | class ElfUpdateView(MethodView):
method put (line 44) | def put(self, elf_id, *args, **kwargs):
class ElfDeleteView (line 56) | class ElfDeleteView(MethodView):
method delete (line 57) | def delete(self, elf_id, *args, **kwargs):
FILE: examples/python/flask/api/views/hobbits.py
class HobbitListView (line 8) | class HobbitListView(MethodView):
method get (line 9) | def get(self, *args, **kwargs):
class HobbitCreateView (line 20) | class HobbitCreateView(MethodView):
method post (line 21) | def post(self, *args, **kwargs):
class HobbitDetailView (line 33) | class HobbitDetailView(MethodView):
method get (line 34) | def get(self, hobbit_id, *args, **kwargs):
class HobbitUpdateView (line 47) | class HobbitUpdateView(MethodView):
method put (line 48) | def put(self, hobbit_id, *args, **kwargs):
class HobbitDeleteView (line 62) | class HobbitDeleteView(MethodView):
method delete (line 63) | def delete(self, hobbit_id, *args, **kwargs):
FILE: examples/python/flask/api/wizards/data.py
class Wizard (line 1) | class Wizard:
method __init__ (line 2) | def __init__(self, data):
method update (line 6) | def update(self, data):
FILE: examples/python/flask/api/wizards/services.py
class WizardService (line 4) | class WizardService:
method get_wizards (line 5) | def get_wizards(self):
method get_wizard (line 8) | def get_wizard(self, wizard_id):
method create_wizard (line 14) | def create_wizard(self, data):
method update_wizard (line 19) | def update_wizard(self, wizard_id, data):
method delete_wizard (line 24) | def delete_wizard(self, wizard_id):
FILE: examples/python/flask/api/wizards/views.py
class WizardListView (line 5) | class WizardListView(MethodView):
method get (line 6) | def get(self, *args, **kwargs):
class WizardCreateView (line 11) | class WizardCreateView(MethodView):
method post (line 12) | def post(self, *args, **kwargs):
class WizardDetailView (line 18) | class WizardDetailView(MethodView):
method get (line 19) | def get(self, wizard_id, *args, **kwargs):
class WizardUpdateView (line 24) | class WizardUpdateView(MethodView):
method put (line 25) | def put(self, wizard_id, *args, **kwargs):
class WizardDeleteView (line 31) | class WizardDeleteView(MethodView):
method delete (line 32) | def delete(self, wizard_id, *args, **kwargs):
function get_wizzards_bp (line 37) | def get_wizzards_bp():
FILE: examples/python/flask/app.py
function hello_world (line 10) | def hello_world():
function liveness (line 15) | def liveness():
function readiness (line 20) | def readiness():
FILE: src/cli/handlers/extract/index.ts
constant NAPI_DIR (line 16) | const NAPI_DIR = ".napi";
constant MANIFESTS_DIR (line 17) | const MANIFESTS_DIR = "manifests";
type ManifestEnvelope (line 19) | interface ManifestEnvelope {
function getLatestManifestId (line 28) | function getLatestManifestId(workdir: string): string | null {
function loadManifest (line 45) | function loadManifest(workdir: string, manifestId: string): ManifestEnve...
function builderFunction (line 56) | function builderFunction(
function handler (line 105) | function handler(
FILE: src/cli/handlers/generate/index.ts
constant NAPI_DIR (line 17) | const NAPI_DIR = ".napi";
constant MANIFESTS_DIR (line 18) | const MANIFESTS_DIR = "manifests";
function builder (line 20) | function builder(
function getGitBranch (line 51) | async function getGitBranch(workDir: string): Promise<string> {
function getGitCommitSha (line 73) | async function getGitCommitSha(workDir: string): Promise<string> {
function getGitCommitDate (line 94) | async function getGitCommitDate(workDir: string): Promise<string> {
function ensureManifestsDir (line 115) | function ensureManifestsDir(workdir: string): string {
function handler (line 127) | async function handler(
FILE: src/cli/handlers/init/index.ts
function builder (line 28) | function builder(
function handler (line 36) | async function handler(
function showMatchingFiles (line 109) | function showMatchingFiles(
function showFinalFileSelection (line 139) | function showFinalFileSelection(
function getProjectStructureOverview (line 174) | function getProjectStructureOverview(workDir: string): string[] {
function collectIncludePatterns (line 211) | async function collectIncludePatterns(
function collectExcludePatterns (line 325) | async function collectExcludePatterns(
function suggestIncludePatterns (line 442) | function suggestIncludePatterns(
function suggestExcludePatterns (line 581) | function suggestExcludePatterns(
function generateConfig (line 628) | async function generateConfig(
FILE: src/cli/handlers/set/apiKey.ts
function handler (line 15) | async function handler(
FILE: src/cli/handlers/set/index.ts
function builder (line 6) | function builder(
FILE: src/cli/handlers/view/index.ts
constant NAPI_DIR (line 16) | const NAPI_DIR = ".napi";
constant MANIFESTS_DIR (line 17) | const MANIFESTS_DIR = "manifests";
type ManifestEnvelope (line 19) | interface ManifestEnvelope {
type ManifestListItem (line 28) | interface ManifestListItem {
function getManifestsDir (line 37) | function getManifestsDir(workdir: string): string {
function listManifests (line 41) | function listManifests(workdir: string): ManifestListItem[] {
function loadManifest (line 72) | function loadManifest(
function getViewerDistDir (line 88) | function getViewerDistDir(): string {
function getContentType (line 93) | function getContentType(path: string): string {
function tryServeStatic (line 106) | async function tryServeStatic(
function jsonResponse (line 131) | function jsonResponse(data: unknown, status = 200): Response {
function openBrowser (line 141) | async function openBrowser(url: string) {
function findAvailablePort (line 163) | function findAvailablePort(startPort: number): number {
function mergeAuditConfig (line 176) | function mergeAuditConfig(
function builder (line 191) | function builder(
function handler (line 205) | async function handler(
FILE: src/cli/index.ts
function initCli (line 22) | function initCli() {
FILE: src/cli/middlewares/checkVersion.ts
function getCurrentVersion (line 4) | function getCurrentVersion() {
function checkVersionMiddleware (line 8) | async function checkVersionMiddleware(_args: Arguments) {
FILE: src/cli/middlewares/globalConfig.ts
function getConfigPath (line 17) | function getConfigPath() {
function globalConfigMiddleware (line 54) | function globalConfigMiddleware(
function setConfig (line 101) | function setConfig(
FILE: src/cli/middlewares/napiConfig.ts
function getConfigFromWorkDir (line 77) | function getConfigFromWorkDir(workdir: string) {
function createConfig (line 99) | function createConfig(
function napiConfigMiddleware (line 107) | function napiConfigMiddleware(
FILE: src/helpers/fileSystem/index.ts
function getExtensionsForLanguage (line 10) | function getExtensionsForLanguage(language: string) {
function getFilesFromDirectory (line 26) | function getFilesFromDirectory(
function writeFilesToDirectory (line 93) | function writeFilesToDirectory(
FILE: src/helpers/sourceCode/index.ts
function removeIndexesFromSourceCode (line 1) | function removeIndexesFromSourceCode(
FILE: src/languagePlugins/c/dependencyFormatting/index.ts
class CDependencyFormatter (line 20) | class CDependencyFormatter {
method constructor (line 26) | constructor(
method #formatSymbolType (line 39) | #formatSymbolType(st: SymbolType): CDepSymbolType {
method #formatDependencies (line 61) | #formatDependencies(
method #formatStandardIncludes (line 81) | #formatStandardIncludes(stdincludes: string[]): Record<string, CDepend...
method #formatSymbols (line 100) | #formatSymbols(fileSymbols: Map<string, Symbol>): Record<string, CDepS...
method formatFile (line 124) | formatFile(filepath: string): CDepFile {
FILE: src/languagePlugins/c/dependencyFormatting/types.ts
type CDependency (line 13) | interface CDependency {
type CDependent (line 22) | interface CDependent {
constant C_DEP_FUNCTION_TYPE (line 27) | const C_DEP_FUNCTION_TYPE = "function";
type CDepSymbolType (line 28) | type CDepSymbolType =
type CDepSymbol (line 39) | interface CDepSymbol {
type CDepFile (line 52) | interface CDepFile {
FILE: src/languagePlugins/c/extractor/index.ts
class CExtractor (line 15) | class CExtractor {
method constructor (line 21) | constructor(
method #findDependencies (line 55) | #findDependencies(symbol: Symbol): Symbol[] {
method #findAllDependencies (line 80) | #findAllDependencies(symbol: Symbol): Symbol[] {
method #buildFileMap (line 103) | #buildFileMap(symbolsToKeep: Symbol[]): Map<string, ExportedFile> {
method #stripFiles (line 172) | #stripFiles(files: Map<string, ExportedFile>) {
method #removeDeletedIncludes (line 231) | #removeDeletedIncludes(
method #compactifyFile (line 260) | #compactifyFile(
method #findDependenciesForMap (line 274) | #findDependenciesForMap(
method extractSymbols (line 302) | extractSymbols(
FILE: src/languagePlugins/c/extractor/queries.ts
constant C_IFDEF_QUERY (line 4) | const C_IFDEF_QUERY = new Parser.Query(
FILE: src/languagePlugins/c/extractor/types.ts
type ExportedFile (line 4) | interface ExportedFile {
FILE: src/languagePlugins/c/headerResolver/index.ts
class CHeaderResolver (line 11) | class CHeaderResolver {
method resolveSymbols (line 20) | resolveSymbols(file: {
FILE: src/languagePlugins/c/headerResolver/queries.ts
constant C_DECLARATION_QUERY (line 7) | const C_DECLARATION_QUERY = new Parser.Query(
FILE: src/languagePlugins/c/headerResolver/types.ts
constant C_STRUCT_TYPE (line 4) | const C_STRUCT_TYPE = "struct";
constant C_UNION_TYPE (line 5) | const C_UNION_TYPE = "union";
constant C_ENUM_TYPE (line 6) | const C_ENUM_TYPE = "enum";
constant C_FUNCTION_DEFINITION_TYPE (line 7) | const C_FUNCTION_DEFINITION_TYPE = "function_definition";
constant C_FUNCTION_SIGNATURE_TYPE (line 8) | const C_FUNCTION_SIGNATURE_TYPE = "function_signature";
constant C_MACRO_FUNCTION_TYPE (line 9) | const C_MACRO_FUNCTION_TYPE = "macro_function";
constant C_MACRO_CONSTANT_TYPE (line 10) | const C_MACRO_CONSTANT_TYPE = "macro_constant";
constant C_VARIABLE_TYPE (line 11) | const C_VARIABLE_TYPE = "variable";
constant C_TYPEDEF_TYPE (line 12) | const C_TYPEDEF_TYPE = "typedef";
constant C_AUTO_SPECIFIER (line 15) | const C_AUTO_SPECIFIER = "auto";
constant C_REGISTER_SPECIFIER (line 16) | const C_REGISTER_SPECIFIER = "register";
constant C_STATIC_SPECIFIER (line 17) | const C_STATIC_SPECIFIER = "static";
constant C_EXTERN_SPECIFIER (line 18) | const C_EXTERN_SPECIFIER = "extern";
constant C_CONST_QUALIFIER (line 21) | const C_CONST_QUALIFIER = "const";
constant C_VOLATILE_QUALIFIER (line 22) | const C_VOLATILE_QUALIFIER = "volatile";
constant C_RESTRICT_QUALIFIER (line 23) | const C_RESTRICT_QUALIFIER = "restrict";
constant C_ATOMIC_QUALIFIER (line 24) | const C_ATOMIC_QUALIFIER = "_Atomic";
type SymbolType (line 27) | type SymbolType =
type StorageClassSpecifier (line 39) | type StorageClassSpecifier =
type TypeQualifier (line 46) | type TypeQualifier =
type ExportedSymbol (line 52) | interface ExportedSymbol {
FILE: src/languagePlugins/c/includeResolver/index.ts
class CIncludeResolver (line 13) | class CIncludeResolver {
method constructor (line 21) | constructor(symbolRegistry: CSymbolRegistry, includeDirs: string[] = [...
method getFile (line 29) | getFile(filepath: string, sourcepath: string): CFile | undefined {
method findInclusionChain (line 61) | findInclusionChain(
method #resolveInclusions (line 96) | #resolveInclusions(
method getInclusions (line 194) | getInclusions() {
FILE: src/languagePlugins/c/includeResolver/queries.ts
constant C_INCLUDE_QUERY (line 4) | const C_INCLUDE_QUERY = new Parser.Query(
constant C_STANDARD_INCLUDE_QUERY (line 13) | const C_STANDARD_INCLUDE_QUERY = new Parser.Query(
FILE: src/languagePlugins/c/includeResolver/types.ts
type Inclusions (line 5) | interface Inclusions {
type IncludedSymbol (line 17) | interface IncludedSymbol {
type InclusionNode (line 27) | interface InclusionNode {
FILE: src/languagePlugins/c/invocationResolver/index.ts
class CInvocationResolver (line 16) | class CInvocationResolver {
method constructor (line 19) | constructor(includeResolver: CIncludeResolver) {
method getInvocationsForNode (line 23) | getInvocationsForNode(
method #getSymbolFile (line 89) | #getSymbolFile(symbol: Symbol): CFile {
method getInvocationsForSymbol (line 100) | getInvocationsForSymbol(symbol: Symbol) {
method getInvocationsForFile (line 146) | getInvocationsForFile(filepath: string): Invocations {
FILE: src/languagePlugins/c/invocationResolver/queries.ts
constant C_INVOCATION_QUERY (line 4) | const C_INVOCATION_QUERY = new Parser.Query(
constant C_MACRO_CONTENT_QUERY (line 12) | const C_MACRO_CONTENT_QUERY = new Parser.Query(
FILE: src/languagePlugins/c/invocationResolver/types.ts
type Invocations (line 4) | interface Invocations {
FILE: src/languagePlugins/c/metrics/index.ts
class CMetricsAnalyzer (line 5) | class CMetricsAnalyzer {
method analyzeNode (line 11) | public analyzeNode(node: Parser.SyntaxNode): CComplexityMetrics {
method getComplexityCount (line 34) | private getComplexityCount(node: Parser.SyntaxNode): number {
method findComments (line 44) | private findComments(
method findEmptyLines (line 103) | private findEmptyLines(
method getCodeCounts (line 118) | private getCodeCounts(node: Parser.SyntaxNode): CodeCounts {
FILE: src/languagePlugins/c/metrics/queries.ts
constant C_COMPLEXITY_QUERY (line 5) | const C_COMPLEXITY_QUERY = new Parser.Query(
constant C_COMMENT_QUERY (line 18) | const C_COMMENT_QUERY = new Parser.Query(
FILE: src/languagePlugins/c/metrics/types.ts
type CodeCounts (line 4) | interface CodeCounts {
type CommentSpan (line 11) | interface CommentSpan {
type CComplexityMetrics (line 19) | interface CComplexityMetrics {
FILE: src/languagePlugins/c/symbolRegistry/index.ts
class CSymbolRegistry (line 16) | class CSymbolRegistry {
method constructor (line 21) | constructor(
method #convertSymbol (line 33) | #convertSymbol(es: ExportedSymbol): Symbol {
method #buildRegistry (line 81) | #buildRegistry() {
method getRegistry (line 174) | getRegistry(): Map<string, CFile> {
FILE: src/languagePlugins/c/symbolRegistry/queries.ts
constant C_FUNCTION_DEF_QUERY (line 4) | const C_FUNCTION_DEF_QUERY = new Parser.Query(
constant C_TYPEDEF_TYPE_QUERY (line 11) | const C_TYPEDEF_TYPE_QUERY = new Parser.Query(
FILE: src/languagePlugins/c/symbolRegistry/types.ts
class Symbol (line 8) | class Symbol {
method constructor (line 13) | constructor(name: string, declaration: ExportedSymbol) {
class FunctionSignature (line 20) | class FunctionSignature extends Symbol {
method constructor (line 25) | constructor(
class FunctionDefinition (line 37) | class FunctionDefinition extends Symbol {
method constructor (line 42) | constructor(name: string, declaration: ExportedSymbol, isMacro: boolea...
class DataType (line 50) | class DataType extends Symbol {
method constructor (line 52) | constructor(name: string, declaration: ExportedSymbol) {
class Typedef (line 59) | class Typedef extends Symbol {
class Variable (line 63) | class Variable extends Symbol {
method constructor (line 66) | constructor(name: string, declaration: ExportedSymbol, isMacro: boolea...
class EnumMember (line 72) | class EnumMember extends Symbol {
method constructor (line 74) | constructor(name: string, declaration: ExportedSymbol, parent: Enum) {
class Enum (line 80) | class Enum extends DataType {
method constructor (line 82) | constructor(name: string, declaration: ExportedSymbol) {
constant C_SOURCE_FILE (line 115) | const C_SOURCE_FILE = ".c";
constant C_HEADER_FILE (line 116) | const C_HEADER_FILE = ".h";
type CFileType (line 117) | type CFileType = typeof C_SOURCE_FILE | typeof C_HEADER_FILE;
class CFile (line 120) | class CFile {
method constructor (line 130) | constructor(
FILE: src/languagePlugins/c/testFiles/cFiles/burgers.c
type Burger (line 8) | struct Burger
type Burger (line 10) | struct Burger
type Condiment (line 10) | enum Condiment
type Burger (line 11) | struct Burger
type Burger (line 11) | struct Burger
function destroy_burger (line 25) | void destroy_burger(struct Burger* burger) {
type Burger (line 31) | struct Burger
type Burger (line 40) | struct Burger
type Burger (line 41) | struct Burger
FILE: src/languagePlugins/c/testFiles/cFiles/burgers.h
type Condiment (line 10) | enum Condiment {
type ClassicSauces (line 19) | enum ClassicSauces {
type ClassicSauces (line 28) | enum ClassicSauces
type Fries (line 32) | typedef struct {
type Drink (line 39) | typedef enum Drink_t {
type Burger (line 47) | struct Burger {
type Burger (line 55) | struct Burger
type Burger (line 65) | struct Burger
type Condiment (line 65) | enum Condiment
type Burger (line 66) | struct Burger
type Burger (line 67) | struct Burger
type Burger (line 68) | struct Burger
FILE: src/languagePlugins/c/testFiles/cFiles/crashcases.h
type ObjectEvent (line 16) | struct ObjectEvent {
type Sprite (line 20) | struct Sprite {
type ObjectEvent (line 25) | struct ObjectEvent
type Sprite (line 25) | struct Sprite
type ObjectEvent (line 27) | struct ObjectEvent
type Sprite (line 27) | struct Sprite
FILE: src/languagePlugins/c/testFiles/cFiles/errors.h
type Salut_t (line 14) | struct Salut_t {
FILE: src/languagePlugins/c/testFiles/cFiles/main.c
function main (line 4) | int main(void) {
FILE: src/languagePlugins/c/testFiles/cFiles/oldman.h
type MauvilleManCommon (line 13) | struct MauvilleManCommon
type MauvilleManBard (line 18) | struct MauvilleManBard
type MauvilleManStoryteller (line 30) | struct MauvilleManStoryteller
type MauvilleManGiddy (line 41) | struct MauvilleManGiddy
type MauvilleManHipster (line 51) | struct MauvilleManHipster
type MauvilleOldManTrader (line 58) | struct MauvilleOldManTrader
type OldMan (line 67) | typedef union OldMan
FILE: src/languagePlugins/c/testFiles/cFiles/personnel.c
function Employee (line 6) | Employee* create_employee(int id, const char* name, const char* position...
function destroy_employee (line 29) | void destroy_employee(Employee* employee) {
function Employee (line 35) | Employee* get_employee_by_id(int id) {
function Employee (line 44) | Employee* get_highest_paid_employee() {
function Employee (line 58) | Employee** get_employees_by_department(enum Department department, int* ...
function print_employee_details (line 75) | void print_employee_details(const Employee* employee) {
FILE: src/languagePlugins/c/testFiles/cFiles/personnel.h
type Department (line 9) | enum Department {
type Employee (line 17) | typedef struct {
type Department (line 28) | enum Department
type Department (line 32) | enum Department
FILE: src/languagePlugins/c/testFiles/index.ts
function findCFiles (line 21) | function findCFiles(dir: string) {
function getCFilesMap (line 45) | function getCFilesMap(): Map<
function getCFilesContentMap (line 53) | function getCFilesContentMap(): Map<
FILE: src/languagePlugins/c/warnings/index.ts
class CWarningManager (line 9) | class CWarningManager {
method constructor (line 11) | constructor(
method getDiagnostics (line 21) | private getDiagnostics(
method printDiagnostics (line 52) | public printDiagnostics(count: number | undefined = undefined): void {
FILE: src/languagePlugins/c/warnings/queries.ts
constant C_ERROR_QUERY (line 4) | const C_ERROR_QUERY = new Parser.Query(
constant C_UNNAMED_DATATYPE_QUERY (line 11) | const C_UNNAMED_DATATYPE_QUERY = new Parser.Query(
FILE: src/languagePlugins/c/warnings/types.ts
type ManifestDiagnostics (line 3) | interface ManifestDiagnostics {
class TreeSitterError (line 10) | class TreeSitterError implements ManifestDiagnostics {
method constructor (line 16) | constructor(
class UnnamedDatatypeWarning (line 28) | class UnnamedDatatypeWarning implements ManifestDiagnostics {
method constructor (line 35) | constructor(
FILE: src/languagePlugins/csharp/dependencyFormatting/index.ts
type CSharpDependency (line 20) | interface CSharpDependency {
type CSharpDependent (line 42) | interface CSharpDependent {
type CSharpSymbol (line 56) | interface CSharpSymbol {
type CSharpFile (line 90) | interface CSharpFile {
class CSharpDependencyFormatter (line 121) | class CSharpDependencyFormatter {
method constructor (line 131) | constructor(
method formatSymbols (line 155) | private formatSymbols(
method formatDependencies (line 187) | private formatDependencies(
method formatExternalUsings (line 226) | private formatExternalUsings(
method formatFile (line 246) | public formatFile(filepath: string): CSharpFile | undefined {
FILE: src/languagePlugins/csharp/extensionResolver/index.ts
type ExtensionMethod (line 32) | interface ExtensionMethod {
type ExtensionMethodMap (line 64) | type ExtensionMethodMap = Record<string, ExtensionMethod[]>;
class CSharpExtensionResolver (line 66) | class CSharpExtensionResolver {
method constructor (line 70) | constructor(namespaceMapper: CSharpNamespaceMapper) {
method getExtensions (line 79) | getExtensions(): ExtensionMethodMap {
method resolveExtensionMethods (line 88) | private resolveExtensionMethods(symbol: SymbolNode): ExtensionMethod[] {
method resolveExtensionMethodsInNamespace (line 136) | private resolveExtensionMethodsInNamespace(
method resolveExtensionMethodsInNamespaceTree (line 153) | private resolveExtensionMethodsInNamespaceTree() {
FILE: src/languagePlugins/csharp/extractor/index.ts
type ExtractedFile (line 20) | interface ExtractedFile {
class CSharpExtractor (line 33) | class CSharpExtractor {
method constructor (line 39) | constructor(
method findDependencies (line 75) | private findDependencies(symbol: SymbolNode): SymbolNode[] {
method findAllDependencies (line 103) | private findAllDependencies(
method getContent (line 126) | public getContent(file: ExtractedFile): string {
method extractSymbol (line 143) | public extractSymbol(symbol: SymbolNode): ExtractedFile[] {
method extractSymbolFromFile (line 191) | public extractSymbolFromFile(
method generateGlobalUsings (line 207) | public generateGlobalUsings(subproject: DotNetProject): string {
FILE: src/languagePlugins/csharp/invocationResolver/index.ts
type Invocations (line 144) | interface Invocations {
class CSharpInvocationResolver (line 151) | class CSharpInvocationResolver {
method constructor (line 159) | constructor(
method #getVariables (line 177) | #getVariables(node: Parser.SyntaxNode): string[] {
method resolveSymbol (line 187) | private resolveSymbol(
method #getCalledClasses (line 235) | #getCalledClasses(
method #resolveMemberAccesses (line 270) | #resolveMemberAccesses(
method #resolveExtensionUses (line 328) | #resolveExtensionUses(
method #resolveAttributeUses (line 352) | #resolveAttributeUses(
method #findExtension (line 398) | #findExtension(ext: string, filepath: string): ExtensionMethod[] {
method getInvocationsFromFile (line 424) | getInvocationsFromFile(filepath: string): Invocations {
method getInvocationsFromNode (line 446) | getInvocationsFromNode(
method isUsedInFile (line 498) | public isUsedInFile(filepath: string, symbol: SymbolNode): boolean {
method isUsingUseful (line 509) | public isUsingUseful(
FILE: src/languagePlugins/csharp/metricsAnalyzer/index.ts
type CodeCounts (line 7) | interface CodeCounts {
type CommentSpan (line 14) | interface CommentSpan {
type CSharpComplexityMetrics (line 22) | interface CSharpComplexityMetrics {
class CSharpMetricsAnalyzer (line 58) | class CSharpMetricsAnalyzer {
method analyzeNode (line 64) | public analyzeNode(node: Parser.SyntaxNode): CSharpComplexityMetrics {
method getComplexityCount (line 81) | private getComplexityCount(node: Parser.SyntaxNode): number {
method findComments (line 91) | private findComments(
method findEmptyLines (line 150) | private findEmptyLines(
method getCodeCounts (line 165) | private getCodeCounts(node: Parser.SyntaxNode): CodeCounts {
FILE: src/languagePlugins/csharp/namespaceMapper/index.ts
type NamespaceNode (line 10) | interface NamespaceNode {
type SymbolNode (line 24) | interface SymbolNode {
constant DEBUG_NAMESPACE (line 39) | const DEBUG_NAMESPACE = "namespace";
constant DEBUG_SYMBOL (line 40) | const DEBUG_SYMBOL = "symbol";
type DebugType (line 41) | type DebugType = typeof DEBUG_NAMESPACE | typeof DEBUG_SYMBOL;
type DebugNode (line 46) | interface DebugNode {
class CSharpNamespaceMapper (line 55) | class CSharpNamespaceMapper {
method constructor (line 62) | constructor(
method getFile (line 75) | getFile(key: string) {
method getFileExports (line 84) | getFileExports(filepath: string): SymbolNode[] {
method #buildFileExports (line 92) | #buildFileExports(tree: NamespaceNode) {
method #addNamespaceToTree (line 110) | #addNamespaceToTree(namespace: NamespaceNode, tree: NamespaceNode) {
method #assignNamespacesToClasses (line 152) | #assignNamespacesToClasses(tree: NamespaceNode, parentNamespace = "") {
method #assignParentNamespaces (line 166) | #assignParentNamespaces(tree: NamespaceNode) {
method buildNamespaceTree (line 177) | buildNamespaceTree(): NamespaceNode {
method #convertNodeToDebug (line 211) | #convertNodeToDebug(node: NamespaceNode | SymbolNode): DebugNode {
method saveDebugTree (line 239) | saveDebugTree(filepath: string): DebugNode {
method findNamespaceInTree (line 251) | findNamespaceInTree(
method getFullNSName (line 281) | getFullNSName(namespace: NamespaceNode): string {
method findClassInTree (line 297) | findClassInTree(tree: NamespaceNode, className: string): SymbolNode | ...
method getExportsForFile (line 360) | getExportsForFile(filepath: string): SymbolNode[] {
FILE: src/languagePlugins/csharp/namespaceResolver/index.ts
constant CSHARP_CLASS_TYPE (line 5) | const CSHARP_CLASS_TYPE = "class";
constant CSHARP_STRUCT_TYPE (line 6) | const CSHARP_STRUCT_TYPE = "struct";
constant CSHARP_ENUM_TYPE (line 7) | const CSHARP_ENUM_TYPE = "enum";
constant CSHARP_INTERFACE_TYPE (line 8) | const CSHARP_INTERFACE_TYPE = "interface";
constant CSHARP_RECORD_TYPE (line 9) | const CSHARP_RECORD_TYPE = "record";
constant CSHARP_DELEGATE_TYPE (line 10) | const CSHARP_DELEGATE_TYPE = "delegate";
type SymbolType (line 13) | type SymbolType =
type File (line 33) | interface File {
type ExportedSymbol (line 43) | interface ExportedSymbol {
type Namespace (line 63) | interface Namespace {
class CSharpNamespaceResolver (line 76) | class CSharpNamespaceResolver {
method constructor (line 81) | constructor() {
method getNamespacesFromFile (line 90) | getNamespacesFromFile(file: File): Namespace[] {
method #getFileScopedNamespaceDeclaration (line 137) | #getFileScopedNamespaceDeclaration(
method #getNamespacesFromNode (line 150) | #getNamespacesFromNode(node: Parser.SyntaxNode): Namespace[] {
method #getDeclarationList (line 170) | #getDeclarationList(node: Parser.SyntaxNode): Parser.SyntaxNode {
method #getIdentifierNode (line 185) | #getIdentifierNode(node: Parser.SyntaxNode): Parser.SyntaxNode {
method #getExportsFromNode (line 199) | #getExportsFromNode(
method getExportsFromNamespaces (line 252) | getExportsFromNamespaces(namespaces: Namespace[]): ExportedSymbol[] {
FILE: src/languagePlugins/csharp/projectMapper/index.ts
type DotNetProject (line 12) | interface DotNetProject {
type GlobalUsings (line 42) | interface GlobalUsings {
class CSharpProjectMapper (line 57) | class CSharpProjectMapper {
method constructor (line 61) | constructor(csprojFiles: Map<string, { path: string; content: string }...
method #makeSubprojects (line 73) | #makeSubprojects(
method #getRootFolder (line 95) | #getRootFolder(filepaths: string[]): string {
method findSubprojectForFile (line 127) | findSubprojectForFile(filePath: string): DotNetProject | null {
method updateGlobalUsings (line 152) | updateGlobalUsings(globalUsings: GlobalUsings, subproject: DotNetProje...
method getGlobalUsings (line 169) | getGlobalUsings(filepath: string): ResolvedImports {
FILE: src/languagePlugins/csharp/testFiles/csharpFiles/2Namespaces1File.cs
class Steak (line 6) | public class Steak
method Steak (line 10) | public Steak(Gordon gordon)
method Cook (line 15) | public void Cook()
class Cheese (line 20) | public static class Cheese
method Melt (line 22) | public static void Melt(this Steak steak)
class Bun (line 27) | public class Bun { }
class Chicken (line 31) | public class Chicken { }
class Salad (line 32) | public class Salad<T>
method Add (line 35) | public void Add(T item)
class Bun (line 40) | public class Bun { }
FILE: src/languagePlugins/csharp/testFiles/csharpFiles/Models.cs
class User (line 2) | public class User
type Order (line 8) | public struct Order
type OrderStatus (line 13) | public enum OrderStatus
type IOrder (line 18) | public interface IOrder
method Process (line 20) | void Process();
FILE: src/languagePlugins/csharp/testFiles/csharpFiles/Namespaced.cs
class MyClass (line 3) | public class MyClass
method MyMethod (line 5) | public void MyMethod()
FILE: src/languagePlugins/csharp/testFiles/csharpFiles/Nested.cs
class OuterClass (line 3) | public class OuterClass
method OuterMethod (line 5) | public void OuterMethod()
class OuterInnerClass (line 13) | public class OuterInnerClass
method OuterInnerMethod (line 15) | public void OuterInnerMethod()
class InnerClass (line 23) | public class InnerClass
method InnerMethod (line 25) | public void InnerMethod()
FILE: src/languagePlugins/csharp/testFiles/csharpFiles/OtherFileSameNamespace.cs
class Salad (line 2) | public class Salad { }
FILE: src/languagePlugins/csharp/testFiles/csharpFiles/Program.cs
class Program (line 10) | class Program
method Main (line 12) | static void Main(string[] args)
FILE: src/languagePlugins/csharp/testFiles/csharpFiles/SemiNamespaced.cs
class Gordon (line 3) | public class Gordon
method Crowbar (line 5) | public void Crowbar()
class Freeman (line 12) | public class Freeman
method Shotgun (line 15) | public void Shotgun()
class HeadCrab (line 21) | static class HeadCrab
method Bite (line 23) | public static void Bite(this Freeman freeman)
method Heal (line 27) | public static void Heal(this Freeman freeman)
FILE: src/languagePlugins/csharp/testFiles/csharpFiles/Usage.cs
class Usage (line 7) | class Usage
method ReadFile (line 9) | public void ReadFile()
FILE: src/languagePlugins/csharp/testFiles/index.ts
function findCSharpFiles (line 20) | function findCSharpFiles(dir: string) {
function findCsprojFiles (line 45) | function findCsprojFiles(dir: string): void {
function getCSharpFilesMap (line 69) | function getCSharpFilesMap() {
function getCsprojFilesMap (line 78) | function getCsprojFilesMap() {
FILE: src/languagePlugins/csharp/usingResolver/index.ts
constant GLOBAL_USING (line 24) | const GLOBAL_USING = "global";
constant LOCAL_USING (line 25) | const LOCAL_USING = "local";
constant USING_STATIC (line 26) | const USING_STATIC = "static";
constant USING_ALIAS (line 27) | const USING_ALIAS = "alias";
constant USING_CURRENT (line 29) | const USING_CURRENT = "current";
type UsingType (line 32) | type UsingType =
type UsingDirective (line 42) | interface UsingDirective {
class InternalSymbol (line 58) | class InternalSymbol {
method constructor (line 70) | constructor(
class ExternalSymbol (line 88) | class ExternalSymbol {
method constructor (line 98) | constructor(
type ResolvedImports (line 114) | interface ResolvedImports {
class CSharpUsingResolver (line 124) | class CSharpUsingResolver {
method constructor (line 140) | constructor(
method parseUsingDirectives (line 153) | public parseUsingDirectives(filepath: string): UsingDirective[] {
method getUsingType (line 190) | private getUsingType(node: Parser.SyntaxNode): UsingType {
method resolveUsingDirective (line 209) | public resolveUsingDirective(
method getCurrentNamespaces (line 234) | private getCurrentNamespaces(filepath: string): string[] {
method resolveUsingDirectives (line 252) | public resolveUsingDirectives(filepath: string): ResolvedImports {
method getGlobalUsings (line 309) | public getGlobalUsings(filepath: string): ResolvedImports {
method findClassInImports (line 319) | public findClassInImports(
FILE: src/languagePlugins/java/dependencyFormatting/index.ts
class JavaDependencyFormatter (line 14) | class JavaDependencyFormatter {
method constructor (line 24) | constructor(files: Map<string, { path: string; content: string }>) {
method #formatDependencies (line 54) | #formatDependencies(
method #formatStandardImports (line 81) | #formatStandardImports(stdimports: string[]): Record<string, JavaDepen...
method #formatSymbol (line 101) | #formatSymbol(fileSymbol: ExportedSymbol): Record<string, JavaDepSymbo...
method formatFile (line 128) | formatFile(filepath: string): JavaDepFile {
FILE: src/languagePlugins/java/dependencyFormatting/types.ts
type JavaDependency (line 7) | interface JavaDependency {
type JavaDependent (line 16) | interface JavaDependent {
type JavaDepSymbol (line 24) | interface JavaDepSymbol {
type JavaDepFile (line 37) | interface JavaDepFile {
FILE: src/languagePlugins/java/extractor/index.ts
class JavaExtractor (line 13) | class JavaExtractor {
method constructor (line 23) | constructor(
method extractSymbols (line 51) | extractSymbols(
FILE: src/languagePlugins/java/extractor/types.ts
class ExportedFile (line 7) | class ExportedFile {
method constructor (line 24) | constructor(filepath: string, resolver: JavaInvocationResolver) {
FILE: src/languagePlugins/java/importResolver/index.ts
class JavaImportResolver (line 8) | class JavaImportResolver {
method constructor (line 16) | constructor(mapper: JavaPackageMapper) {
method getImports (line 29) | getImports(file: JavaFile): JavaImports {
FILE: src/languagePlugins/java/importResolver/types.ts
type JavaImports (line 6) | interface JavaImports {
FILE: src/languagePlugins/java/invocationResolver/index.ts
class JavaInvocationResolver (line 12) | class JavaInvocationResolver {
method constructor (line 22) | constructor(resolver: JavaImportResolver) {
method getInvocations (line 37) | getInvocations(file: JavaFile): Invocations {
FILE: src/languagePlugins/java/invocationResolver/queries.ts
constant JAVA_INVOCATION_QUERY (line 8) | const JAVA_INVOCATION_QUERY = new Parser.Query(
constant JAVA_VARIABLES_QUERY (line 23) | const JAVA_VARIABLES_QUERY = new Parser.Query(
FILE: src/languagePlugins/java/invocationResolver/types.ts
type Invocations (line 6) | interface Invocations {
FILE: src/languagePlugins/java/metrics/index.ts
class JavaMetricsAnalyzer (line 12) | class JavaMetricsAnalyzer {
method analyzeNode (line 18) | public analyzeNode(node: Parser.SyntaxNode): JavaComplexityMetrics {
method getComplexityCount (line 41) | private getComplexityCount(node: Parser.SyntaxNode): number {
method findComments (line 51) | private findComments(
method findEmptyLines (line 110) | private findEmptyLines(
method getCodeCounts (line 125) | private getCodeCounts(node: Parser.SyntaxNode): CodeCounts {
FILE: src/languagePlugins/java/metrics/queries.ts
constant JAVA_COMPLEXITY_QUERY (line 5) | const JAVA_COMPLEXITY_QUERY = new Parser.Query(
constant JAVA_COMMENT_QUERY (line 17) | const JAVA_COMMENT_QUERY = new Parser.Query(
FILE: src/languagePlugins/java/metrics/types.ts
type CodeCounts (line 4) | interface CodeCounts {
type CommentSpan (line 11) | interface CommentSpan {
type JavaComplexityMetrics (line 19) | interface JavaComplexityMetrics {
FILE: src/languagePlugins/java/packageMapper/index.ts
class JavaPackageMapper (line 9) | class JavaPackageMapper {
method constructor (line 22) | constructor(
FILE: src/languagePlugins/java/packageMapper/types.ts
type JavaNode (line 6) | interface JavaNode {
class AbstractNode (line 16) | class AbstractNode implements JavaNode {
method constructor (line 26) | constructor(name: string) {
method constructor (line 50) | constructor(declaration: ExportedSymbol, file: JavaFile) {
class JavaTree (line 61) | class JavaTree extends AbstractNode {
method constructor (line 65) | constructor() {
method addFile (line 73) | addFile(file: JavaFile) {
method getNode (line 90) | getNode(name: string): JavaNode | undefined {
method getImport (line 114) | getImport(name: string): Map<string, ConcreteNode> | undefined {
class FileNode (line 141) | class FileNode extends ConcreteNode {
method constructor (line 146) | constructor(file: JavaFile) {
class NestedSymbol (line 159) | class NestedSymbol extends ConcreteNode {
method constructor (line 165) | constructor(symbol: ExportedSymbol, file: JavaFile) {
FILE: src/languagePlugins/java/packageResolver/index.ts
class JavaPackageResolver (line 9) | class JavaPackageResolver {
method resolveFile (line 22) | resolveFile(file: {
FILE: src/languagePlugins/java/packageResolver/queries.ts
constant JAVA_PROGRAM_QUERY (line 15) | const JAVA_PROGRAM_QUERY = new Parser.Query(
constant JAVA_STATIC_MEMBERS_QUERY (line 34) | const JAVA_STATIC_MEMBERS_QUERY = new Parser.Query(
FILE: src/languagePlugins/java/packageResolver/types.ts
constant JAVA_PUBLIC_MODIFIER (line 7) | const JAVA_PUBLIC_MODIFIER = "public";
constant JAVA_PRIVATE_MODIFIER (line 12) | const JAVA_PRIVATE_MODIFIER = "private";
constant JAVA_PROTECTED_MODIFIER (line 17) | const JAVA_PROTECTED_MODIFIER = "protected";
constant JAVA_ABSTRACT_MODIFIER (line 22) | const JAVA_ABSTRACT_MODIFIER = "abstract";
constant JAVA_FINAL_MODIFIER (line 27) | const JAVA_FINAL_MODIFIER = "final";
constant JAVA_STATIC_MODIFIER (line 32) | const JAVA_STATIC_MODIFIER = "static";
constant JAVA_STRICTFP_MODIFIER (line 37) | const JAVA_STRICTFP_MODIFIER = "strictfp";
constant JAVA_SEALED_MODIFIER (line 42) | const JAVA_SEALED_MODIFIER = "sealed";
constant JAVA_NONSEALED_MODIFIER (line 47) | const JAVA_NONSEALED_MODIFIER = "non-sealed";
type Modifier (line 49) | type Modifier =
constant JAVA_CLASS_TYPE (line 63) | const JAVA_CLASS_TYPE = "class";
constant JAVA_INTERFACE_TYPE (line 68) | const JAVA_INTERFACE_TYPE = "interface";
constant JAVA_ENUM_TYPE (line 73) | const JAVA_ENUM_TYPE = "enum";
constant JAVA_RECORD_TYPE (line 78) | const JAVA_RECORD_TYPE = "record";
constant JAVA_ANNOTATION_TYPE (line 83) | const JAVA_ANNOTATION_TYPE = "annotation";
constant JAVA_FIELD_TYPE (line 88) | const JAVA_FIELD_TYPE = "field";
constant JAVA_METHOD_TYPE (line 93) | const JAVA_METHOD_TYPE = "method";
type SymbolType (line 95) | type SymbolType =
type JavaFile (line 107) | interface JavaFile {
type ExportedSymbol (line 123) | interface ExportedSymbol {
class JavaClass (line 143) | class JavaClass implements ExportedSymbol {
method constructor (line 171) | constructor(node: Parser.SyntaxNode, type: SymbolType, filepath: strin...
class JavaMember (line 229) | class JavaMember implements ExportedSymbol {
method constructor (line 250) | constructor(capture: Parser.QueryCapture, filepath: string) {
FILE: src/languagePlugins/java/testFiles/constants.ts
constant APP (line 5) | const APP = join(javaFilesFolder, "App.java");
constant CONDIMENT (line 8) | const CONDIMENT = join(javaFilesFolder, "food/Condiment.java");
constant FOOD (line 9) | const FOOD = join(javaFilesFolder, "food/Food.java");
constant STEAK (line 10) | const STEAK = join(javaFilesFolder, "food/Steak.java");
constant BURGER (line 11) | const BURGER = join(javaFilesFolder, "food/Burger.java");
constant DOUBLEBURGER (line 12) | const DOUBLEBURGER = join(javaFilesFolder, "food/DoubleBurger.java");
constant PEBBLE (line 13) | const PEBBLE = join(javaFilesFolder, "food/goron/Pebble.java");
constant WORMKILLER (line 16) | const WORMKILLER = join(javaFilesFolder, "medication/Wormkiller.java");
FILE: src/languagePlugins/java/testFiles/index.ts
function findJavaFiles (line 25) | function findJavaFiles(dir: string) {
function getJavaFilesMap (line 48) | function getJavaFilesMap(): Map<
function getJavaFilesContentMap (line 56) | function getJavaFilesContentMap(): Map<
FILE: src/languagePlugins/java/testFiles/napi-tests/src/main/java/io/nanoapi/testfiles/App.java
class App (line 8) | public class App {
method main (line 10) | public static void main(String[] args) {
FILE: src/languagePlugins/java/testFiles/napi-tests/src/main/java/io/nanoapi/testfiles/food/Burger.java
class Burger (line 6) | public class Burger<T> implements Food {
method eat (line 10) | public void eat() {
method getPrice (line 14) | public double getPrice() {
method getCalories (line 18) | public double getCalories() {
method advertisement (line 22) | public static void advertisement() {
FILE: src/languagePlugins/java/testFiles/napi-tests/src/main/java/io/nanoapi/testfiles/food/Condiment.java
type Condiment (line 3) | public enum Condiment {
FILE: src/languagePlugins/java/testFiles/napi-tests/src/main/java/io/nanoapi/testfiles/food/DoubleBurger.java
class DoubleBurger (line 3) | public class DoubleBurger<T, N> extends Burger {}
FILE: src/languagePlugins/java/testFiles/napi-tests/src/main/java/io/nanoapi/testfiles/food/Food.java
type Food (line 3) | public interface Food {
method eat (line 4) | public void eat();
method getPrice (line 6) | public double getPrice();
method getCalories (line 8) | public double getCalories();
FILE: src/languagePlugins/java/testFiles/napi-tests/src/main/java/io/nanoapi/testfiles/food/Steak.java
class Steak (line 3) | public class Steak implements Food {
method eat (line 5) | public void eat() {
method getPrice (line 9) | public double getPrice() {
method getCalories (line 13) | public double getCalories() {
class Tapeworm (line 17) | private static class Tapeworm {
FILE: src/languagePlugins/java/testFiles/napi-tests/src/main/java/io/nanoapi/testfiles/food/goron/Pebble.java
class Pebble (line 5) | public class Pebble implements Food {
method eat (line 7) | public void eat() {
method getPrice (line 11) | public double getPrice() {
method getCalories (line 15) | public double getCalories() {
class Sandworm (line 19) | public class Sandworm {
FILE: src/languagePlugins/java/testFiles/napi-tests/src/main/java/io/nanoapi/testfiles/medication/Wormkiller.java
class Wormkiller (line 6) | public class Wormkiller {
method applyTo (line 8) | public void applyTo(Steak steak) {}
method killWorm (line 10) | public void killWorm(Pebble.Sandworm sandworm) {}
FILE: src/languagePlugins/python/dependencyResolver/index.ts
class PythonDependencyResolver (line 45) | class PythonDependencyResolver {
method constructor (line 55) | constructor(
method getFileDependencies (line 73) | public getFileDependencies(path: string) {
method filterImportStatementsForNode (line 220) | private filterImportStatementsForNode(
method mergeUsageMaps (line 266) | private mergeUsageMaps<T extends InternalUsage | ExternalUsage>(
method analyzeDependenciesForNode (line 324) | private analyzeDependenciesForNode(
method convertInternalUsageToDependencies (line 550) | private convertInternalUsageToDependencies(
method convertExternalUsageToDependencies (line 597) | private convertExternalUsageToDependencies(
FILE: src/languagePlugins/python/dependencyResolver/types.ts
type ModuleDependency (line 7) | interface ModuleDependency {
type SymbolDependency (line 25) | interface SymbolDependency {
type FileDependencies (line 63) | interface FileDependencies {
type FileDependencyMap (line 89) | type FileDependencyMap = Map<string, FileDependencies>;
FILE: src/languagePlugins/python/exportExtractor/index.ts
class PythonExportExtractor (line 22) | class PythonExportExtractor {
method constructor (line 31) | constructor(
method getSymbols (line 204) | public getSymbols(filePath: string) {
FILE: src/languagePlugins/python/exportExtractor/types.ts
constant PYTHON_CLASS_TYPE (line 6) | const PYTHON_CLASS_TYPE = "class";
constant PYTHON_FUNCTION_TYPE (line 7) | const PYTHON_FUNCTION_TYPE = "function";
constant PYTHON_VARIABLE_TYPE (line 8) | const PYTHON_VARIABLE_TYPE = "variable";
type PythonSymbolType (line 17) | type PythonSymbolType =
type PythonSymbol (line 29) | interface PythonSymbol {
FILE: src/languagePlugins/python/importExtractor/index.ts
class PythonImportExtractor (line 36) | class PythonImportExtractor {
method constructor (line 68) | constructor(
method getImportStatements (line 92) | public getImportStatements(filePath: string): ImportStatement[] {
method processNormalImport (line 126) | private processNormalImport(node: Parser.SyntaxNode): ImportStatement {
method processFromImport (line 171) | private processFromImport(node: Parser.SyntaxNode): ImportStatement {
FILE: src/languagePlugins/python/importExtractor/types.ts
type ImportItem (line 11) | interface ImportItem {
type ImportMember (line 29) | interface ImportMember {
constant NORMAL_IMPORT_STATEMENT_TYPE (line 54) | const NORMAL_IMPORT_STATEMENT_TYPE = "normal";
constant FROM_IMPORT_STATEMENT_TYPE (line 55) | const FROM_IMPORT_STATEMENT_TYPE = "from";
type PythonImportStatementType (line 62) | type PythonImportStatementType =
type ImportStatement (line 73) | interface ImportStatement {
FILE: src/languagePlugins/python/itemResolver/index.ts
class PythonItemResolver (line 41) | class PythonItemResolver {
method constructor (line 75) | constructor(
method resolveItem (line 92) | public resolveItem(
method resolveItemImpl (line 126) | private resolveItemImpl(
method getWildcardSymbols (line 374) | public getWildcardSymbols(module: PythonModule): Map<string, ResolvedS...
method collectSymbols (line 411) | private collectSymbols(
FILE: src/languagePlugins/python/itemResolver/types.ts
constant PYTHON_INTERNAL_MODULE_TYPE (line 8) | const PYTHON_INTERNAL_MODULE_TYPE = "internal";
constant PYTHON_EXTERNAL_MODULE_TYPE (line 14) | const PYTHON_EXTERNAL_MODULE_TYPE = "external";
type PythonModuleType (line 24) | type PythonModuleType =
type ResolvedItem (line 37) | interface ResolvedItem {
type ResolvedModule (line 59) | interface ResolvedModule extends ResolvedItem {
type ResolvedInternalModule (line 76) | interface ResolvedInternalModule extends ResolvedModule {
type ResolvedExternalModule (line 93) | interface ResolvedExternalModule extends ResolvedModule {
type ResolvedSymbol (line 110) | interface ResolvedSymbol extends ResolvedItem {
type ResolvedInternalSymbol (line 138) | interface ResolvedInternalSymbol extends ResolvedSymbol {
type ResolvedExternalSymbol (line 164) | interface ResolvedExternalSymbol extends ResolvedSymbol {
FILE: src/languagePlugins/python/metricAnalyzer/index.test.ts
function setupTest (line 12) | function setupTest(code: string, filename = "test.py") {
FILE: src/languagePlugins/python/metricAnalyzer/index.ts
type CommentSpan (line 7) | interface CommentSpan {
class PythonMetricsAnalyzer (line 23) | class PythonMetricsAnalyzer {
method constructor (line 28) | constructor(parser: Parser) {
method analyzeNodes (line 65) | public analyzeNodes(nodes: Parser.SyntaxNode[]) {
method analyzeNode (line 102) | private analyzeNode(node: Parser.SyntaxNode) {
method findComments (line 148) | private findComments(
method findEmptyLines (line 207) | private findEmptyLines(
method calculateCodeCharacters (line 233) | private calculateCodeCharacters(
method calculateComplexity (line 277) | private calculateComplexity(node: Parser.SyntaxNode): number {
FILE: src/languagePlugins/python/metricAnalyzer/types.ts
type PythonComplexityMetrics (line 4) | interface PythonComplexityMetrics {
FILE: src/languagePlugins/python/moduleResolver/index.ts
class PythonModuleResolver (line 29) | class PythonModuleResolver {
method constructor (line 77) | constructor(filePaths: Set<string>, pythonVersion: string) {
method getPythonStdModules (line 86) | private getPythonStdModules(version: string) {
method buildModuleMap (line 129) | private buildModuleMap(filePaths: Set<string>): PythonModule {
method getModuleFromFilePath (line 206) | public getModuleFromFilePath(filePath: string): PythonModule {
method resolveModule (line 255) | public resolveModule(
method resolveRelativeModule (line 294) | private resolveRelativeModule(
method resolveAbsoluteImport (line 348) | private resolveAbsoluteImport(
FILE: src/languagePlugins/python/moduleResolver/types.ts
constant PYTHON_MODULE_TYPE (line 1) | const PYTHON_MODULE_TYPE = "module";
constant PYTHON_PACKAGE_MODULE_TYPE (line 2) | const PYTHON_PACKAGE_MODULE_TYPE = "package";
constant PYTHON_NAMESPACE_MODULE_TYPE (line 3) | const PYTHON_NAMESPACE_MODULE_TYPE = "namespace";
type PythonModuleType (line 12) | type PythonModuleType =
type PythonModule (line 29) | interface PythonModule {
FILE: src/languagePlugins/python/symbolExtractor/index.test.ts
function createParsedFiles (line 21) | function createParsedFiles(
function createDependencyManifest (line 40) | function createDependencyManifest(
function createSymbolExtractor (line 58) | function createSymbolExtractor(
FILE: src/languagePlugins/python/symbolExtractor/index.ts
class PythonSymbolExtractor (line 20) | class PythonSymbolExtractor {
method constructor (line 38) | constructor(
method extractSymbol (line 68) | public extractSymbol(
method identifySymbolsAndDependencies (line 114) | private identifySymbolsAndDependencies(
method addSymbolAndDependencies (line 140) | private addSymbolAndDependencies(
method extractFilesInMemory (line 215) | private extractFilesInMemory(
method cleanErrorNodes (line 271) | private cleanErrorNodes(
method cleanImports (line 308) | private cleanImports(
FILE: src/languagePlugins/python/usageResolver/index.ts
class PythonUsageResolver (line 36) | class PythonUsageResolver {
method constructor (line 60) | constructor(parser: Parser, exportExtractor: PythonExportExtractor) {
method getUsageNode (line 80) | public getUsageNode(
method isNodeInsideAnyExclude (line 130) | private isNodeInsideAnyExclude(
method resolveInternalUsageForSymbol (line 152) | public resolveInternalUsageForSymbol(
method resolveInternalUsageForModule (line 222) | public resolveInternalUsageForModule(
method resolveExternalUsageForItem (line 305) | public resolveExternalUsageForItem(
method resolveExternalUsageSymbolFromUsage (line 341) | private resolveExternalUsageSymbolFromUsage(usageNode: Parser.SyntaxNo...
FILE: src/languagePlugins/python/usageResolver/types.ts
type InternalUsage (line 11) | interface InternalUsage {
type ExternalUsage (line 29) | interface ExternalUsage {
FILE: src/manifest/auditManifest/index.ts
function getSeverityLevel (line 18) | function getSeverityLevel(
function generateAuditManifest (line 35) | function generateAuditManifest(
FILE: src/manifest/auditManifest/types.ts
type AuditAlert (line 3) | type AuditAlert = {
type SymbolAuditManifest (line 12) | type SymbolAuditManifest = {
type FileAuditManifest (line 17) | type FileAuditManifest = {
type AuditManifest (line 23) | type AuditManifest = Record<string, FileAuditManifest>;
type AuditConfig (line 25) | interface AuditConfig {
FILE: src/manifest/dependencyManifest/c/index.ts
function generateCDependencyManifest (line 21) | function generateCDependencyManifest(
FILE: src/manifest/dependencyManifest/csharp/index.ts
function generateCSharpDependencyManifest (line 29) | function generateCSharpDependencyManifest(
FILE: src/manifest/dependencyManifest/index.ts
class UnsupportedLanguageError (line 35) | class UnsupportedLanguageError extends Error {
method constructor (line 36) | constructor(language: string) {
function generateDependencyManifest (line 44) | async function generateDependencyManifest(
FILE: src/manifest/dependencyManifest/java/index.ts
function generateJavaDependencyManifest (line 18) | function generateJavaDependencyManifest(
FILE: src/manifest/dependencyManifest/labeling/graph.ts
function getSymbolDependencyContextMessages (line 13) | function getSymbolDependencyContextMessages(
function generateContentsMessages (line 93) | function generateContentsMessages(
function createGroupSymbolLabelingWorkflow (line 161) | function createGroupSymbolLabelingWorkflow(
FILE: src/manifest/dependencyManifest/labeling/grouping.ts
constant JOINT_SYMBOL_SEPARATOR (line 12) | const JOINT_SYMBOL_SEPARATOR = "::";
function symbolRefToKey (line 25) | function symbolRefToKey(ref: SymbolRef): string {
function keyToSymbolRef (line 38) | function keyToSymbolRef(key: string): SymbolRef {
function getUnprocessedDependencies (line 63) | function getUnprocessedDependencies(
function stronglyConnectedComponents (line 121) | function stronglyConnectedComponents(
function findStronglyConnectedComponents (line 189) | function findStronglyConnectedComponents(
function selectBestSymbol (line 230) | function selectBestSymbol(
function selectCycleBreakers (line 269) | function selectCycleBreakers(
function findIndependentSymbols (line 368) | function findIndependentSymbols(
function processBatch (line 392) | function processBatch(
function generateGroupLayers (line 430) | function generateGroupLayers(
FILE: src/manifest/dependencyManifest/labeling/index.ts
function generateSymbolDescriptions (line 6) | async function generateSymbolDescriptions(
FILE: src/manifest/dependencyManifest/labeling/model.ts
constant GOOGLE_PROVIDER (line 6) | const GOOGLE_PROVIDER = "google";
constant OPENAI_PROVIDER (line 7) | const OPENAI_PROVIDER = "openai";
constant ANTHROPIC_PROVIDER (line 8) | const ANTHROPIC_PROVIDER = "anthropic";
type ModelProvider (line 10) | type ModelProvider =
function getModel (line 15) | function getModel(
FILE: src/manifest/dependencyManifest/labeling/types.ts
type SymbolRef (line 5) | type SymbolRef = {
type GroupLayer (line 17) | type GroupLayer = {
FILE: src/manifest/dependencyManifest/python/index.ts
function generateDependentsForManifest (line 30) | function generateDependentsForManifest(
function generatePythonDependencyManifest (line 149) | function generatePythonDependencyManifest(
FILE: src/manifest/dependencyManifest/types.ts
type SymbolType (line 40) | type SymbolType =
type Metric (line 60) | type Metric =
type DependencyInfo (line 71) | interface DependencyInfo {
type DependentInfo (line 91) | interface DependentInfo {
type SymbolDependencyManifest (line 105) | interface SymbolDependencyManifest {
type FileDependencyManifest (line 153) | interface FileDependencyManifest {
type DependencyManifest (line 191) | type DependencyManifest = Record<string, FileDependencyManifest>;
FILE: src/symbolExtractor/c/index.ts
function extractCSymbols (line 7) | function extractCSymbols(
FILE: src/symbolExtractor/csharp/index.ts
function extractCSharpSymbols (line 30) | function extractCSharpSymbols(
FILE: src/symbolExtractor/index.ts
class UnsupportedLanguageError (line 25) | class UnsupportedLanguageError extends Error {
method constructor (line 26) | constructor(language: string) {
function extractSymbols (line 34) | function extractSymbols(
FILE: src/symbolExtractor/java/index.ts
function extractJavaSymbols (line 7) | function extractJavaSymbols(
FILE: src/symbolExtractor/python/index.ts
function extractPythonSymbols (line 14) | function extractPythonSymbols(
FILE: src/symbolExtractor/types.ts
type ExtractedFilesMap (line 1) | type ExtractedFilesMap = Map<
FILE: viewer/src/App.tsx
function App (line 7) | function App() {
FILE: viewer/src/api.ts
type ManifestListItem (line 4) | interface ManifestListItem {
type ManifestEnvelope (line 13) | interface ManifestEnvelope {
constant BASE (line 22) | const BASE = "/api";
function fetchManifests (line 24) | async function fetchManifests(): Promise<ManifestListItem[]> {
function fetchManifest (line 29) | async function fetchManifest(id: string): Promise<ManifestEnvelope> {
function fetchAudit (line 35) | async function fetchAudit(id: string): Promise<AuditManifest> {
FILE: viewer/src/components/DependencyVisualizer/DependencyVisualizer.tsx
function DependencyVisualizer (line 15) | function DependencyVisualizer(props: {
FILE: viewer/src/components/DependencyVisualizer/components/BreadcrumbNav.tsx
function BreadcrumbNav (line 10) | function BreadcrumbNav(props: {
FILE: viewer/src/components/DependencyVisualizer/components/DisplayNameWithTooltip.tsx
function DisplayNameWithTooltip (line 7) | function DisplayNameWithTooltip(props: {
FILE: viewer/src/components/DependencyVisualizer/components/FileExplorerSidebar.tsx
type ExplorerNodeData (line 34) | interface ExplorerNodeData {
function buildExplorerTree (line 42) | function buildExplorerTree(
function computeFilteredSymbols (line 162) | function computeFilteredSymbols(
function FileExplorerSidebar (line 182) | function FileExplorerSidebar(props: {
function ExplorerNode (line 284) | function ExplorerNode(props: {
FILE: viewer/src/components/DependencyVisualizer/components/SymbolExtractionDialog.tsx
function SymbolExtractionDialog (line 22) | function SymbolExtractionDialog(props: {
FILE: viewer/src/components/DependencyVisualizer/components/contextMenu/FileContextMenu.tsx
function FileContextMenu (line 14) | function FileContextMenu(props: {
FILE: viewer/src/components/DependencyVisualizer/components/contextMenu/SymbolContextMenu.tsx
function SymbolContextMenu (line 14) | function SymbolContextMenu(props: {
FILE: viewer/src/components/DependencyVisualizer/components/controls/ControlExtensions/FiltersExtension.tsx
function FiltersExtension (line 18) | function FiltersExtension(props: {
FILE: viewer/src/components/DependencyVisualizer/components/controls/ControlExtensions/GraphDepthExtension.tsx
function GraphDepthExtension (line 18) | function GraphDepthExtension(props: {
FILE: viewer/src/components/DependencyVisualizer/components/controls/ControlExtensions/MetricsExtension.tsx
function MetricsExtension (line 24) | function MetricsExtension(props: {
FILE: viewer/src/components/DependencyVisualizer/components/controls/Controls.tsx
function Controls (line 11) | function Controls(props: {
FILE: viewer/src/components/DependencyVisualizer/components/detailsPanes/AlertBadge.tsx
function AlertBadge (line 3) | function AlertBadge(props: { count: number }) {
FILE: viewer/src/components/DependencyVisualizer/components/detailsPanes/FileDetailsPane.tsx
function FileDetailsPane (line 23) | function FileDetailsPane(props: {
FILE: viewer/src/components/DependencyVisualizer/components/detailsPanes/Metrics.tsx
function Metrics (line 5) | function Metrics(props: {
FILE: viewer/src/components/DependencyVisualizer/components/detailsPanes/SymbolDetailsPane.tsx
function SymbolDetailsPane (line 24) | function SymbolDetailsPane(props: {
FILE: viewer/src/components/DependencyVisualizer/visualizers/FileVisualizer.tsx
type FileVisualizerProps (line 13) | interface FileVisualizerProps {
function FileVisualizer (line 23) | function FileVisualizer(props: FileVisualizerProps) {
FILE: viewer/src/components/DependencyVisualizer/visualizers/ProjectVisualizer.tsx
type ProjectVisualizerProps (line 12) | interface ProjectVisualizerProps {
function ProjectVisualizer (line 21) | function ProjectVisualizer(props: ProjectVisualizerProps) {
FILE: viewer/src/components/DependencyVisualizer/visualizers/SymbolVisualizer.tsx
type SymbolVisualizerProps (line 12) | interface SymbolVisualizerProps {
function SymbolVisualizer (line 23) | function SymbolVisualizer(props: SymbolVisualizerProps) {
FILE: viewer/src/components/shadcn/Alert.tsx
function Alert (line 22) | function Alert({
function AlertTitle (line 37) | function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
function AlertDescription (line 50) | function AlertDescription({
FILE: viewer/src/components/shadcn/Breadcrumb.tsx
function Breadcrumb (line 7) | function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
function BreadcrumbList (line 11) | function BreadcrumbList({ className, ...props }: React.ComponentProps<"o...
function BreadcrumbItem (line 24) | function BreadcrumbItem({ className, ...props }: React.ComponentProps<"l...
function BreadcrumbLink (line 34) | function BreadcrumbLink({
function BreadcrumbPage (line 52) | function BreadcrumbPage({ className, ...props }: React.ComponentProps<"s...
function BreadcrumbSeparator (line 65) | function BreadcrumbSeparator({
function BreadcrumbEllipsis (line 83) | function BreadcrumbEllipsis({
FILE: viewer/src/components/shadcn/Button.tsx
function Button (line 38) | function Button({
FILE: viewer/src/components/shadcn/Card.tsx
function Card (line 5) | function Card({ className, ...props }: React.ComponentProps<"div">) {
function CardHeader (line 18) | function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
function CardTitle (line 31) | function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
function CardDescription (line 41) | function CardDescription({ className, ...props }: React.ComponentProps<"...
function CardAction (line 51) | function CardAction({ className, ...props }: React.ComponentProps<"div">) {
function CardContent (line 64) | function CardContent({ className, ...props }: React.ComponentProps<"div"...
function CardFooter (line 74) | function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
FILE: viewer/src/components/shadcn/Dialog.tsx
function Dialog (line 7) | function Dialog({
function DialogTrigger (line 13) | function DialogTrigger({
function DialogPortal (line 19) | function DialogPortal({
function DialogClose (line 25) | function DialogClose({
function DialogOverlay (line 31) | function DialogOverlay({
function DialogContent (line 47) | function DialogContent({
function DialogHeader (line 81) | function DialogHeader({ className, ...props }: React.ComponentProps<"div...
function DialogFooter (line 91) | function DialogFooter({ className, ...props }: React.ComponentProps<"div...
function DialogTitle (line 104) | function DialogTitle({
function DialogDescription (line 117) | function DialogDescription({
FILE: viewer/src/components/shadcn/Dropdownmenu.tsx
function DropdownMenu (line 7) | function DropdownMenu({
function DropdownMenuPortal (line 13) | function DropdownMenuPortal({
function DropdownMenuTrigger (line 21) | function DropdownMenuTrigger({
function DropdownMenuContent (line 32) | function DropdownMenuContent({
function DropdownMenuGroup (line 52) | function DropdownMenuGroup({
function DropdownMenuItem (line 60) | function DropdownMenuItem({
function DropdownMenuCheckboxItem (line 83) | function DropdownMenuCheckboxItem({
function DropdownMenuRadioGroup (line 109) | function DropdownMenuRadioGroup({
function DropdownMenuRadioItem (line 120) | function DropdownMenuRadioItem({
function DropdownMenuLabel (line 144) | function DropdownMenuLabel({
function DropdownMenuSeparator (line 164) | function DropdownMenuSeparator({
function DropdownMenuShortcut (line 177) | function DropdownMenuShortcut({
function DropdownMenuSub (line 193) | function DropdownMenuSub({
function DropdownMenuSubTrigger (line 199) | function DropdownMenuSubTrigger({
function DropdownMenuSubContent (line 223) | function DropdownMenuSubContent({
FILE: viewer/src/components/shadcn/Input.tsx
function Input (line 5) | function Input({ className, type, ...props }: React.ComponentProps<"inpu...
FILE: viewer/src/components/shadcn/Label.tsx
function Label (line 6) | function Label({
FILE: viewer/src/components/shadcn/Scrollarea.tsx
function ScrollArea (line 6) | function ScrollArea({
function ScrollBar (line 29) | function ScrollBar({
FILE: viewer/src/components/shadcn/Separator.tsx
function Separator (line 6) | function Separator({
FILE: viewer/src/components/shadcn/Sheet.tsx
function Sheet (line 7) | function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive....
function SheetTrigger (line 11) | function SheetTrigger({
function SheetClose (line 17) | function SheetClose({
function SheetPortal (line 23) | function SheetPortal({
function SheetOverlay (line 29) | function SheetOverlay({
function SheetContent (line 45) | function SheetContent({
function SheetHeader (line 82) | function SheetHeader({ className, ...props }: React.ComponentProps<"div"...
function SheetFooter (line 92) | function SheetFooter({ className, ...props }: React.ComponentProps<"div"...
function SheetTitle (line 102) | function SheetTitle({
function SheetDescription (line 115) | function SheetDescription({
FILE: viewer/src/components/shadcn/Sidebar.tsx
constant SIDEBAR_COOKIE_NAME (line 28) | const SIDEBAR_COOKIE_NAME = "sidebar_state";
constant SIDEBAR_COOKIE_MAX_AGE (line 29) | const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
constant SIDEBAR_WIDTH (line 30) | const SIDEBAR_WIDTH = "16rem";
constant SIDEBAR_WIDTH_MOBILE (line 31) | const SIDEBAR_WIDTH_MOBILE = "18rem";
constant SIDEBAR_WIDTH_ICON (line 32) | const SIDEBAR_WIDTH_ICON = "3rem";
constant SIDEBAR_KEYBOARD_SHORTCUT (line 33) | const SIDEBAR_KEYBOARD_SHORTCUT = "b";
type SidebarContextProps (line 35) | type SidebarContextProps = {
function useSidebar (line 47) | function useSidebar() {
function SidebarProvider (line 56) | function SidebarProvider({
function Sidebar (line 153) | function Sidebar({
function SidebarTrigger (line 253) | function SidebarTrigger({
function SidebarRail (line 279) | function SidebarRail({ className, ...props }: React.ComponentProps<"butt...
function SidebarInset (line 304) | function SidebarInset({ className, ...props }: React.ComponentProps<"mai...
function SidebarInput (line 318) | function SidebarInput({
function SidebarHeader (line 332) | function SidebarHeader({ className, ...props }: React.ComponentProps<"di...
function SidebarFooter (line 343) | function SidebarFooter({ className, ...props }: React.ComponentProps<"di...
function SidebarSeparator (line 354) | function SidebarSeparator({
function SidebarContent (line 368) | function SidebarContent({ className, ...props }: React.ComponentProps<"d...
function SidebarGroup (line 382) | function SidebarGroup({ className, ...props }: React.ComponentProps<"div...
function SidebarGroupLabel (line 393) | function SidebarGroupLabel({
function SidebarGroupAction (line 414) | function SidebarGroupAction({
function SidebarGroupContent (line 437) | function SidebarGroupContent({
function SidebarMenu (line 451) | function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {
function SidebarMenuItem (line 462) | function SidebarMenuItem({ className, ...props }: React.ComponentProps<"...
function SidebarMenuButton (line 495) | function SidebarMenuButton({
function SidebarMenuAction (line 545) | function SidebarMenuAction({
function SidebarMenuBadge (line 577) | function SidebarMenuBadge({
function SidebarMenuSkeleton (line 599) | function SidebarMenuSkeleton({
function SidebarMenuSub (line 635) | function SidebarMenuSub({ className, ...props }: React.ComponentProps<"u...
function SidebarMenuSubItem (line 650) | function SidebarMenuSubItem({
function SidebarMenuSubButton (line 664) | function SidebarMenuSubButton({
FILE: viewer/src/components/shadcn/Skeleton.tsx
function Skeleton (line 3) | function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
FILE: viewer/src/components/shadcn/Slider.tsx
function Slider (line 6) | function Slider({
FILE: viewer/src/components/shadcn/Tooltip.tsx
function TooltipProvider (line 6) | function TooltipProvider({
function Tooltip (line 19) | function Tooltip({
function TooltipTrigger (line 29) | function TooltipTrigger({
function TooltipContent (line 35) | function TooltipContent({
FILE: viewer/src/components/shadcn/hooks/use-mobile.tsx
constant MOBILE_BREAKPOINT (line 3) | const MOBILE_BREAKPOINT = 768;
function useIsMobile (line 5) | function useIsMobile() {
FILE: viewer/src/contexts/ThemeProvider.tsx
type Theme (line 3) | type Theme = "dark" | "light";
type ThemeProviderProps (line 5) | type ThemeProviderProps = {
type ThemeProviderState (line 11) | type ThemeProviderState = {
function getSystemTheme (line 16) | function getSystemTheme() {
function ThemeProvider (line 28) | function ThemeProvider({
FILE: viewer/src/cytoscape/elements/file.ts
function computeNodeId (line 12) | function computeNodeId(fileId: string, symbolId: string) {
function createNodeData (line 16) | function createNodeData(params: {
type CustomNodeDefinition (line 67) | interface CustomNodeDefinition extends NodeDefinition {
function processDependencies (line 71) | function processDependencies(
function processDependents (line 151) | function processDependents(
function getSymbolElementsInFile (line 216) | function getSymbolElementsInFile(
FILE: viewer/src/cytoscape/elements/project.ts
function getFileElementsInProject (line 16) | function getFileElementsInProject(
FILE: viewer/src/cytoscape/elements/symbol.ts
function createNodeData (line 13) | function createNodeData(params: {
type CustomNodeDefinition (line 64) | interface CustomNodeDefinition extends NodeDefinition {
function traverseSymbolGraph (line 68) | function traverseSymbolGraph(
function getSymbolElementsForSymbol (line 261) | function getSymbolElementsForSymbol(
FILE: viewer/src/cytoscape/elements/types.ts
type NapiNodeData (line 3) | interface NapiNodeData {
type FileNapiNodeData (line 27) | interface FileNapiNodeData extends NapiNodeData {
type SymbolNapiNodeData (line 32) | interface SymbolNapiNodeData extends NapiNodeData {
FILE: viewer/src/cytoscape/fileDependencyVisualizer/index.ts
class FileDependencyVisualizer (line 39) | class FileDependencyVisualizer {
method constructor (line 59) | constructor(
method updateTheme (line 136) | public updateTheme(theme: "light" | "dark") {
method highlightNode (line 150) | public highlightNode(ref: { filePath: string; symbolId?: string }) {
method unhighlightNodes (line 166) | public unhighlightNodes() {
method setTargetMetric (line 177) | public setTargetMetric(metric: dependencyManifestTypes.Metric | undefi...
method filterNodes (line 187) | public filterNodes(
method createEventListeners (line 241) | private createEventListeners() {
method layoutGraph (line 349) | public layoutGraph(collection: Collection | Core) {
FILE: viewer/src/cytoscape/label/index.ts
function getNodeWidthAndHeightFromLabel (line 14) | function getNodeWidthAndHeightFromLabel(
function getCollapsedFileNodeLabel (line 56) | function getCollapsedFileNodeLabel(data: {
function getExpandedFileNodeLabel (line 89) | function getExpandedFileNodeLabel(data: {
function getCollapsedSymbolNodeLabel (line 116) | function getCollapsedSymbolNodeLabel(data: {
function getExpandedSymbolNodeLabel (line 137) | function getExpandedSymbolNodeLabel(data: {
FILE: viewer/src/cytoscape/metrics/index.ts
function getMetricsSeverityForNode (line 14) | function getMetricsSeverityForNode(
FILE: viewer/src/cytoscape/projectDependencyVisualizer/index.ts
class ProjectDependencyVisualizer (line 35) | class ProjectDependencyVisualizer {
method constructor (line 62) | constructor(
method updateTheme (line 122) | public updateTheme(theme: "light" | "dark") {
method highlightNode (line 136) | public highlightNode(ref: { filePath: string; symbolId?: string }) {
method unhighlightNodes (line 150) | public unhighlightNodes() {
method createEventListeners (line 162) | private createEventListeners() {
method layoutGraph (line 250) | public layoutGraph(collection: Collection | Core) {
method setTargetMetric (line 260) | public setTargetMetric(metric: dependencyManifestTypes.Metric | undefi...
FILE: viewer/src/cytoscape/styles/index.ts
type CytoscapeStyles (line 5) | interface CytoscapeStyles {
function getSeverityColor (line 49) | function getSeverityColor(styles: CytoscapeStyles, level: number) {
function getCytoscapeStyles (line 58) | function getCytoscapeStyles(theme: "light" | "dark" = "light") {
function getCytoscapeStylesheet (line 104) | function getCytoscapeStylesheet(
FILE: viewer/src/cytoscape/symbolDependencyVisualizer/index.ts
class SymbolDependencyVisualizer (line 39) | class SymbolDependencyVisualizer {
method constructor (line 58) | constructor(
method updateTheme (line 144) | public updateTheme(theme: "light" | "dark") {
method highlightNode (line 158) | public highlightNode(ref: { filePath: string; symbolId?: string }) {
method unhighlightNodes (line 174) | public unhighlightNodes() {
method filterNodes (line 180) | public filterNodes(
method createEventListeners (line 245) | private createEventListeners() {
method layoutGraph (line 296) | public layoutGraph(collection: Collection | Core) {
FILE: viewer/src/lib/utils.ts
function cn (line 4) | function cn(...inputs: ClassValue[]) {
FILE: viewer/src/pages/ManifestList.tsx
function ManifestList (line 15) | function ManifestList() {
FILE: viewer/src/pages/ManifestView.tsx
function ManifestView (line 8) | function ManifestView() {
FILE: viewer/src/types/auditManifest.ts
type AuditAlert (line 3) | type AuditAlert = {
type SymbolAuditManifest (line 12) | type SymbolAuditManifest = {
type FileAuditManifest (line 17) | type FileAuditManifest = {
type AuditManifest (line 23) | type AuditManifest = Record<string, FileAuditManifest>;
FILE: viewer/src/types/dependencyManifest.ts
type SymbolType (line 12) | type SymbolType =
type Metric (line 44) | type Metric =
type DependencyInfo (line 53) | interface DependencyInfo {
type DependentInfo (line 59) | interface DependentInfo {
type SymbolDependencyManifest (line 64) | interface SymbolDependencyManifest {
type FileDependencyManifest (line 85) | interface FileDependencyManifest {
type DependencyManifest (line 103) | type DependencyManifest = Record<string, FileDependencyManifest>;
type DependencyManifestV1 (line 106) | type DependencyManifestV1 = DependencyManifest;
Condensed preview — 308 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,711K chars).
[
{
"path": ".github/CODE_OF_CONDUCT.md",
"chars": 3478,
"preview": "## Code of Conduct\n\n### Our Pledge\n\nIn the interest of fostering an open and welcoming environment, we as\ncontributors a"
},
{
"path": ".github/CONTRIBUTING.md",
"chars": 5635,
"preview": "# How to Contribute to NanoAPI\n\n## Contributor License Agreement\n\n<!-- This section always comes first -->\n\n- By submitt"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 1154,
"preview": "---\nname: Bug report\nabout: Create a report for a bug, regression, or unexpected behavior\ntitle: \"[BUG] \"\nlabels: bug\nas"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.md",
"chars": 889,
"preview": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: \"[FEATURE] \"\nlabels: enhancement\nassignees: \"\"\n"
},
{
"path": ".github/PULL_REQUEST_TEMPLATE.md",
"chars": 1890,
"preview": "## Type of change\n\n<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->\n\n- "
},
{
"path": ".github/SECURITY.md",
"chars": 1071,
"preview": "# Security Policy\n\nPlease report any suspected security vulnerabilities privately to\n[security@nanoapi.io](mailto:securi"
},
{
"path": ".github/workflows/lint_test_compile.yml",
"chars": 1250,
"preview": "name: Lint, tests and build\n\non:\n push:\n branches-ignore: [\"main\"]\n\njobs:\n lint:\n runs-on: ubuntu-latest\n ste"
},
{
"path": ".github/workflows/release.yml",
"chars": 897,
"preview": "name: Release Packages\n\npermissions:\n contents: write\n packages: write\n\non: [workflow_dispatch]\n\njobs:\n release:\n "
},
{
"path": ".gitignore",
"chars": 338,
"preview": "node_modules\ndist\n.env\nnapi_dist\n__pycache__\n.ruff_cache\n.OPENAIKEY\nexamples/csharp/EndpointExample/obj\nexamples/csharp/"
},
{
"path": ".vscode/settings.json",
"chars": 87,
"preview": "{\n \"editor.formatOnSave\": true,\n \"editor.defaultFormatter\": \"denoland.vscode-deno\"\n}\n"
},
{
"path": "CLA/CORPORATE_CONTRIBUTOR_LICENSE_AGREEMENT.md",
"chars": 5436,
"preview": "# Corporate contributor license agreement\n\nYou accept and agree to the following terms and conditions for Your present a"
},
{
"path": "CLA/INDIVIDUAL_CONTRIBUTOR_LICENSE_AGREEMENT.md",
"chars": 5623,
"preview": "# Individual contributor license agreement\n\nYou accept and agree to the following terms and conditions for Your present "
},
{
"path": "LICENSE.md",
"chars": 4375,
"preview": "# License\n\nPortions of this software are licensed as follows:\n\n- Content of branches other than the main branch (i.e. \"m"
},
{
"path": "LICENSE_EE.md",
"chars": 1907,
"preview": "# The NanoAPI Enterprise License (the “Enterprise License”)\n\nCopyright (c) 2024-present Nano API B.V.\n\nWith regard to th"
},
{
"path": "README.md",
"chars": 8117,
"preview": "\n\n# napi - Better Software Architecture for the AI Age\n\n`napi` is a fully off"
},
{
"path": "SUPPORT.md",
"chars": 614,
"preview": "# Support using napi\n\nWelcome to NanoAPI! We use Github for tracking bugs and feature requests. There\nare helpful volunt"
},
{
"path": "USERS.md",
"chars": 34,
"preview": "- [Ainur](https://ainurhq.cloud/)\n"
},
{
"path": "WEEKLY_UPDATE_LOG.md",
"chars": 3400,
"preview": "# Weekly Update Log\n\nThis log tracks significant changes, improvements, and new features implemented\nin the NAPI project"
},
{
"path": "deno.json",
"chars": 3635,
"preview": "{\n \"version\": \"1.0.15\",\n \"name\": \"@napi/cli\",\n \"exports\": \"./src/index.ts\",\n \"nodeModulesDir\": \"auto\",\n \"lock\": fal"
},
{
"path": "examples/README.md",
"chars": 215,
"preview": "## Quickstart\n\nEach example is already setup and initialize to use napi.\n\n### To view the project on the UI\n\n```\nnapi sp"
},
{
"path": "examples/c/network/.napirc",
"chars": 499,
"preview": "{\n \"language\": \"c\",\n \"project\": {\n \"include\": [\n \"**/*.c\",\n \"**/*.h\"\n ],\n \"exclude\": [\n \".git/"
},
{
"path": "examples/c/network/makefile",
"chars": 1417,
"preview": "# --- Macros ---\n\n# compilation\nexec = gcc -Wall -Wextra -pedantic -O3 -g3 -fopenmp -fsanitize=address -fno-omit-frame-p"
},
{
"path": "examples/c/network/src/cartographie/cartographie.c",
"chars": 2832,
"preview": "#include \"cartographie.h\"\n\nvoid scanHorizontal(const char* network) {\n struct sockaddr_in addr;\n int sockfd, ttl ="
},
{
"path": "examples/c/network/src/cartographie/cartographie.h",
"chars": 342,
"preview": "#ifndef CARTOGRAPHIE_H\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n#include <arpa/in"
},
{
"path": "examples/c/network/src/cartographie/tnmap.c",
"chars": 1430,
"preview": "#include \"tnmap.h\"\n\n// Vérifie si un hôte est actif\n// Retourne un socket si l'hôte est actif, 1 sinon\nint tnmap(const c"
},
{
"path": "examples/c/network/src/cartographie/tnmap.h",
"chars": 262,
"preview": "#ifndef TNMAP_H\n#define TNMAP_H\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <sys/socket.h>\n#incl"
},
{
"path": "examples/c/network/src/main.c",
"chars": 752,
"preview": "#include \"cartographie/cartographie.h\"\n#include <stdio.h>\n#include <string.h>\n\nint main(int argc, char *argv[]) {\n if"
},
{
"path": "examples/c/network/src/tcp_cs/clientTCP.c",
"chars": 1881,
"preview": "#include \"clientTCP.h\"\n\nint startClient(int argc, char *argv[]) {\n int serverSocket;\n /*\n * Ouvrir socket (sock"
},
{
"path": "examples/c/network/src/tcp_cs/clientTCP.h",
"chars": 310,
"preview": "#ifndef CLIENTTCP_H\n\n#include <sys/types.h>\n#include <sys/socket.h>\n#include <stdio.h>\n#include <netinet/in.h>\n#include "
},
{
"path": "examples/c/network/src/tcp_cs/serveurTCP.c",
"chars": 1635,
"preview": "#include \"serveurTCP.h\"\r\n\r\nint startServer(void) {\r\n int serverSocket;\r\n struct sockaddr_in serv_addr;\r\n /*\r\n "
},
{
"path": "examples/c/network/src/tcp_cs/serveurTCP.h",
"chars": 292,
"preview": "#ifndef SERVEURTCP_H\n\n#include <sys/types.h>\n#include <sys/socket.h>\n#include <stdio.h>\n#include <netinet/in.h>\n#include"
},
{
"path": "examples/csharp/EndpointExample/.napirc",
"chars": 390,
"preview": "{\n \"language\": \"c-sharp\",\n \"project\": {\n \"include\": [\"**/*\"],\n \"exclude\": [\"bin/**\", \"obj/**\", \"napi-output/**\"]"
},
{
"path": "examples/csharp/EndpointExample/EndpointExample.csproj",
"chars": 306,
"preview": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n\n <PropertyGroup>\n <TargetFramework>net9.0</TargetFramework>\n <Nullable>ena"
},
{
"path": "examples/csharp/EndpointExample/Program.cs",
"chars": 156,
"preview": "using FastEndpoints;\n\nvar bld = WebApplication.CreateBuilder();\nbld.Services.AddFastEndpoints();\n\nvar app = bld.Build();"
},
{
"path": "examples/csharp/EndpointExample/Properties/launchSettings.json",
"chars": 616,
"preview": "{\n \"$schema\": \"https://json.schemastore.org/launchsettings.json\",\n \"profiles\": {\n \"http\": {\n \"commandName\": \"P"
},
{
"path": "examples/csharp/EndpointExample/appsettings.Development.json",
"chars": 119,
"preview": "{\n \"Logging\": {\n \"LogLevel\": {\n \"Default\": \"Information\",\n \"Microsoft.AspNetCore\": \"Warning\"\n }\n }\n}\n"
},
{
"path": "examples/csharp/EndpointExample/appsettings.json",
"chars": 142,
"preview": "{\n \"Logging\": {\n \"LogLevel\": {\n \"Default\": \"Information\",\n \"Microsoft.AspNetCore\": \"Warning\"\n }\n },\n "
},
{
"path": "examples/csharp/EndpointExample/src/MyEndpoint.cs",
"chars": 411,
"preview": "public class MyEndpoint : Endpoint<MyRequest, MyResponse>\n{\n public override void Configure()\n {\n Post(\"/ap"
},
{
"path": "examples/csharp/EndpointExample/src/MyRequest.cs",
"chars": 143,
"preview": "public class MyRequest\n{\n public string FirstName { get; set; }\n public string LastName { get; set; }\n public i"
},
{
"path": "examples/csharp/EndpointExample/src/MyResponse.cs",
"chars": 108,
"preview": "public class MyResponse\n{\n public string FullName { get; set; }\n public bool IsOver18 { get; set; }\n}\n"
},
{
"path": "examples/java/websocket/README.md",
"chars": 205,
"preview": "# NAPI Java example\n\nThis example uses Spring's websocket sample artifact from the Maven repository.\nTo experiment with "
},
{
"path": "examples/java/websocket/pom.xml",
"chars": 1705,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project\n xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www.w3.o"
},
{
"path": "examples/java/websocket/src/main/java/samples/websocket/client/GreetingService.java",
"chars": 719,
"preview": "/*\n * Copyright 2012-2013 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "examples/java/websocket/src/main/java/samples/websocket/client/SimpleClientWebSocketHandler.java",
"chars": 1896,
"preview": "/*\n * Copyright 2012-2013 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "examples/java/websocket/src/main/java/samples/websocket/client/SimpleGreetingService.java",
"chars": 795,
"preview": "/*\n * Copyright 2012-2013 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "examples/java/websocket/src/main/java/samples/websocket/config/SampleWebSocketsApplication.java",
"chars": 2826,
"preview": "/*\n * Copyright 2012-2013 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "examples/java/websocket/src/main/java/samples/websocket/echo/DefaultEchoService.java",
"chars": 973,
"preview": "/*\n * Copyright 2012-2013 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "examples/java/websocket/src/main/java/samples/websocket/echo/EchoService.java",
"chars": 726,
"preview": "/*\n * Copyright 2012-2013 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "examples/java/websocket/src/main/java/samples/websocket/echo/EchoWebSocketHandler.java",
"chars": 2020,
"preview": "/*\n * Copyright 2012-2013 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "examples/java/websocket/src/main/java/samples/websocket/snake/Direction.java",
"chars": 896,
"preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOT"
},
{
"path": "examples/java/websocket/src/main/java/samples/websocket/snake/Location.java",
"chars": 1974,
"preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOT"
},
{
"path": "examples/java/websocket/src/main/java/samples/websocket/snake/Snake.java",
"chars": 3907,
"preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOT"
},
{
"path": "examples/java/websocket/src/main/java/samples/websocket/snake/SnakeTimer.java",
"chars": 3197,
"preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOT"
},
{
"path": "examples/java/websocket/src/main/java/samples/websocket/snake/SnakeUtils.java",
"chars": 1826,
"preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOT"
},
{
"path": "examples/java/websocket/src/main/java/samples/websocket/snake/SnakeWebSocketHandler.java",
"chars": 3729,
"preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOT"
},
{
"path": "examples/java/websocket/src/main/resources/static/echo.html",
"chars": 4302,
"preview": "<!--\n Licensed to the Apache Software Foundation (ASF) under one or more\n contributor license agreements. See the NOT"
},
{
"path": "examples/java/websocket/src/main/resources/static/index.html",
"chars": 1308,
"preview": "<!--\n Licensed to the Apache Software Foundation (ASF) under one or more\n contributor license agreements. See the NOT"
},
{
"path": "examples/java/websocket/src/main/resources/static/snake.html",
"chars": 8040,
"preview": "<!--\n Licensed to the Apache Software Foundation (ASF) under one or more\n contributor license agreements. See the NOT"
},
{
"path": "examples/java/websocket/src/test/java/samples/websocket/echo/CustomContainerWebSocketsApplicationTests.java",
"chars": 4265,
"preview": "/*\n * Copyright 2012-2014 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "examples/java/websocket/src/test/java/samples/websocket/echo/SampleWebSocketsApplicationTests.java",
"chars": 3777,
"preview": "/*\n * Copyright 2012-2014 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "examples/java/websocket/src/test/java/samples/websocket/snake/SnakeTimerTests.java",
"chars": 1243,
"preview": "/*\n * Copyright 2012-2013 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "examples/python/flask/.napi/manifests/1775598176791-d5c2217.json",
"chars": 56429,
"preview": "{\n \"id\": \"1775598176791-d5c2217\",\n \"branch\": \"main\",\n \"commitSha\": \"d5c22175a36c5de08482bfa3e1ea59758e888405\",\n \"com"
},
{
"path": "examples/python/flask/.napirc",
"chars": 406,
"preview": "{\n \"language\": \"python\",\n \"python\": {\n \"version\": \"3.12\"\n },\n \"project\": {\n \"include\": [\"app.py\", \"api/**\"],\n "
},
{
"path": "examples/python/flask/api/data/elves.py",
"chars": 297,
"preview": "class Elf:\n def __init__(self, data):\n self.id = data.get(\"id\")\n self.name = data.get(\"name\")\n\n def "
},
{
"path": "examples/python/flask/api/data/hobbits.py",
"chars": 323,
"preview": "class Hobbit:\n def __init__(self, data):\n self.id = data.get(\"id\")\n self.name = data.get(\"name\")\n\n d"
},
{
"path": "examples/python/flask/api/services/elves.py",
"chars": 602,
"preview": "from api.data.elves import Elf, elves\n\n\nclass ElfService:\n def get_elves(self):\n return elves\n\n def get_elf"
},
{
"path": "examples/python/flask/api/services/hobbits.py",
"chars": 698,
"preview": "from api.data.hobbits import Hobbit, hobbits\n\n\nclass HobbitService:\n def get_hobbits(self):\n return hobbits\n\n "
},
{
"path": "examples/python/flask/api/views/elves.py",
"chars": 1770,
"preview": "from flask.views import MethodView\nfrom flask import request, Blueprint\nfrom api.services.elves import ElfService\n\nelves"
},
{
"path": "examples/python/flask/api/views/hobbits.py",
"chars": 1979,
"preview": "from flask.views import MethodView\nfrom flask import request, Blueprint\nfrom api.services.hobbits import HobbitService\n\n"
},
{
"path": "examples/python/flask/api/wizards/data.py",
"chars": 316,
"preview": "class Wizard:\n def __init__(self, data):\n self.id = data.get(\"id\")\n self.name = data.get(\"name\")\n\n d"
},
{
"path": "examples/python/flask/api/wizards/services.py",
"chars": 742,
"preview": "from api.data.hobbits import Hobbit, hobbits\nfrom api.wizards.data import Wizard, wizards\n\nclass WizardService:\n def "
},
{
"path": "examples/python/flask/api/wizards/views.py",
"chars": 2120,
"preview": "from flask.views import MethodView\nfrom flask import request, Blueprint\nfrom .services import WizardService\n\nclass Wizar"
},
{
"path": "examples/python/flask/app.py",
"chars": 698,
"preview": "from flask import Flask\nfrom .api.wizards.views import get_wizzards_bp\nfrom api.views.elves import elves_bp\nfrom api.vie"
},
{
"path": "examples/python/flask/pyproject.toml",
"chars": 349,
"preview": "[tool.poetry]\nname = \"flask-example\"\nversion = \"0.1.0\"\ndescription = \"\"\nauthors = [\"florianbgt <florian.bigot321@gmail.c"
},
{
"path": "install_scripts/install.ps1",
"chars": 1662,
"preview": "# PowerShell script to install NanoAPI CLI on Windows\n\n$ErrorActionPreference = \"Stop\"\n\n# Define platform-specific filen"
},
{
"path": "install_scripts/install.sh",
"chars": 1372,
"preview": "#!/bin/bash\n\n# Determine platform and release URL for GitHub\nOS=$(uname -s)\nRELEASE_URL=\"https://github.com/nanoapi-io/n"
},
{
"path": "media/README.md",
"chars": 1336,
"preview": "## Media\n\nThe content in this folder is meant to be used when creating content about\nNanoAPI. It includes images and oth"
},
{
"path": "scripts/get_version.ts",
"chars": 191,
"preview": "import denoJson from \"../deno.json\" with { type: \"json\" };\n\nconst encoder = new TextEncoder();\nconst version = encoder.e"
},
{
"path": "src/cli/handlers/extract/index.ts",
"chars": 7190,
"preview": "import type { Arguments } from \"yargs-types\";\nimport type { localConfigSchema } from \"../../middlewares/napiConfig.ts\";\n"
},
{
"path": "src/cli/handlers/generate/index.ts",
"chars": 7926,
"preview": "import type { Arguments } from \"yargs-types\";\nimport {\n type localConfigSchema,\n napiConfigMiddleware,\n} from \"../../m"
},
{
"path": "src/cli/handlers/init/index.ts",
"chars": 27669,
"preview": "import type { Arguments } from \"yargs-types\";\nimport {\n createConfig,\n getConfigFromWorkDir,\n} from \"../../middlewares"
},
{
"path": "src/cli/handlers/set/apiKey.ts",
"chars": 1382,
"preview": "import type { Arguments } from \"yargs-types\";\nimport type { z } from \"zod\";\nimport {\n type globalConfigSchema,\n setCon"
},
{
"path": "src/cli/handlers/set/index.ts",
"chars": 525,
"preview": "import apiKeyHandler from \"./apiKey.ts\";\nimport type { Arguments } from \"yargs-types\";\nimport type { globalConfigSchema "
},
{
"path": "src/cli/handlers/view/index.ts",
"chars": 7720,
"preview": "import type { Arguments } from \"yargs-types\";\nimport type { z } from \"zod\";\nimport type { globalConfigSchema } from \"../"
},
{
"path": "src/cli/index.ts",
"chars": 1242,
"preview": "import yargs from \"yargs\";\nimport {\n checkVersionMiddleware,\n getCurrentVersion,\n} from \"./middlewares/checkVersion.ts"
},
{
"path": "src/cli/middlewares/checkVersion.ts",
"chars": 1785,
"preview": "import type { Arguments } from \"yargs-types\";\nimport localPackageJson from \"../../../deno.json\" with { type: \"json\" };\n\n"
},
{
"path": "src/cli/middlewares/globalConfig.ts",
"chars": 2963,
"preview": "import type { Arguments } from \"yargs-types\";\nimport { dirname, join } from \"@std/path\";\nimport z from \"zod\";\n\nexport co"
},
{
"path": "src/cli/middlewares/napiConfig.ts",
"chars": 5738,
"preview": "import { join } from \"@std/path\";\nimport type { Arguments } from \"yargs-types\";\nimport z from \"zod\";\nimport pythonStdlib"
},
{
"path": "src/helpers/fileSystem/index.ts",
"chars": 3152,
"preview": "import { globSync } from \"glob\";\nimport { dirname, join } from \"@std/path\";\nimport {\n cLanguage,\n csharpLanguage,\n ja"
},
{
"path": "src/helpers/sourceCode/index.test.ts",
"chars": 2410,
"preview": "import { describe, it } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { removeIndexesFromSourceC"
},
{
"path": "src/helpers/sourceCode/index.ts",
"chars": 1205,
"preview": "export function removeIndexesFromSourceCode(\n sourceCode: string,\n indexesToRemove: { startIndex: number; endIndex: nu"
},
{
"path": "src/helpers/treeSitter/parsers.ts",
"chars": 818,
"preview": "import Parser, { type Language } from \"tree-sitter\";\nimport Python from \"tree-sitter-python\";\nimport CSharp from \"tree-s"
},
{
"path": "src/index.test.ts",
"chars": 208,
"preview": "import { describe, it } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\n\ndescribe(\"Dummy Test Suite\", () "
},
{
"path": "src/index.ts",
"chars": 54,
"preview": "import { initCli } from \"./cli/index.ts\";\n\ninitCli();\n"
},
{
"path": "src/languagePlugins/c/README.md",
"chars": 4563,
"preview": "# NanoAPI C Plugin\n\nThis plugin manages parsing and mapping of dependencies in C projects.\n\n**Warning :** This plugin re"
},
{
"path": "src/languagePlugins/c/dependencyFormatting/index.test.ts",
"chars": 2969,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { cFilesFolder, getCFile"
},
{
"path": "src/languagePlugins/c/dependencyFormatting/index.ts",
"chars": 4928,
"preview": "import {\n C_DEP_FUNCTION_TYPE,\n type CDependency,\n type CDepFile,\n type CDepSymbol,\n type CDepSymbolType,\n} from \"."
},
{
"path": "src/languagePlugins/c/dependencyFormatting/types.ts",
"chars": 1258,
"preview": "import type {\n C_ENUM_TYPE,\n C_STRUCT_TYPE,\n C_TYPEDEF_TYPE,\n C_UNION_TYPE,\n C_VARIABLE_TYPE,\n} from \"../headerReso"
},
{
"path": "src/languagePlugins/c/extractor/index.test.ts",
"chars": 4678,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport {\n cFilesFolder,\n dumm"
},
{
"path": "src/languagePlugins/c/extractor/index.ts",
"chars": 11255,
"preview": "import { CSymbolRegistry } from \"../symbolRegistry/index.ts\";\nimport { CIncludeResolver } from \"../includeResolver/index"
},
{
"path": "src/languagePlugins/c/extractor/queries.ts",
"chars": 223,
"preview": "import Parser from \"tree-sitter\";\nimport { cParser } from \"../../../helpers/treeSitter/parsers.ts\";\n\nexport const C_IFDE"
},
{
"path": "src/languagePlugins/c/extractor/types.ts",
"chars": 312,
"preview": "import type { Symbol } from \"../symbolRegistry/types.ts\";\nimport type Parser from \"tree-sitter\";\n\nexport interface Expor"
},
{
"path": "src/languagePlugins/c/headerResolver/index.test.ts",
"chars": 12109,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { cFilesFolder, getCFile"
},
{
"path": "src/languagePlugins/c/headerResolver/index.ts",
"chars": 3764,
"preview": "import type {\n ExportedSymbol,\n StorageClassSpecifier,\n SymbolType,\n TypeQualifier,\n} from \"./types.ts\";\nimport { C_"
},
{
"path": "src/languagePlugins/c/headerResolver/queries.ts",
"chars": 1955,
"preview": "import { cParser } from \"../../../helpers/treeSitter/parsers.ts\";\nimport Parser from \"tree-sitter\";\n\n/** Query that catc"
},
{
"path": "src/languagePlugins/c/headerResolver/types.ts",
"chars": 2421,
"preview": "import type Parser from \"tree-sitter\";\n\n// Constants representing different types of symbols in C\nexport const C_STRUCT_"
},
{
"path": "src/languagePlugins/c/includeResolver/index.test.ts",
"chars": 4073,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { cFilesFolder, getCFile"
},
{
"path": "src/languagePlugins/c/includeResolver/index.ts",
"chars": 6851,
"preview": "import type { InclusionNode, Inclusions } from \"./types.ts\";\nimport { C_INCLUDE_QUERY, C_STANDARD_INCLUDE_QUERY } from \""
},
{
"path": "src/languagePlugins/c/includeResolver/queries.ts",
"chars": 413,
"preview": "import Parser from \"tree-sitter\";\nimport { cParser } from \"../../../helpers/treeSitter/parsers.ts\";\n\nexport const C_INCL"
},
{
"path": "src/languagePlugins/c/includeResolver/types.ts",
"chars": 1313,
"preview": "import type Parser from \"tree-sitter\";\nimport type { CFile, Symbol } from \"../symbolRegistry/types.ts\";\n\n/** Interface r"
},
{
"path": "src/languagePlugins/c/invocationResolver/index.test.ts",
"chars": 6451,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { cFilesFolder, getCFile"
},
{
"path": "src/languagePlugins/c/invocationResolver/index.ts",
"chars": 5350,
"preview": "import type { Invocations } from \"./types.ts\";\nimport { C_INVOCATION_QUERY, C_MACRO_CONTENT_QUERY } from \"./queries.ts\";"
},
{
"path": "src/languagePlugins/c/invocationResolver/queries.ts",
"chars": 412,
"preview": "import Parser from \"tree-sitter\";\nimport { cParser } from \"../../../helpers/treeSitter/parsers.ts\";\n\nexport const C_INVO"
},
{
"path": "src/languagePlugins/c/invocationResolver/types.ts",
"chars": 344,
"preview": "import type { IncludedSymbol } from \"../includeResolver/types.ts\";\n\n/** Interface representing the invoked symbols in a "
},
{
"path": "src/languagePlugins/c/metrics/index.test.ts",
"chars": 1680,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { CMetricsAnalyzer } fro"
},
{
"path": "src/languagePlugins/c/metrics/index.ts",
"chars": 5003,
"preview": "import { C_COMMENT_QUERY, C_COMPLEXITY_QUERY } from \"./queries.ts\";\nimport type { CComplexityMetrics, CodeCounts, Commen"
},
{
"path": "src/languagePlugins/c/metrics/queries.ts",
"chars": 588,
"preview": "import Parser from \"tree-sitter\";\nimport { cParser } from \"../../../helpers/treeSitter/parsers.ts\";\n\n// Tree-sitter quer"
},
{
"path": "src/languagePlugins/c/metrics/types.ts",
"chars": 824,
"preview": "/**\n * Interface for code volumes\n */\nexport interface CodeCounts {\n /** Number of lines of code */\n lines: number;\n "
},
{
"path": "src/languagePlugins/c/symbolRegistry/index.test.ts",
"chars": 7292,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { cFilesFolder, getCFile"
},
{
"path": "src/languagePlugins/c/symbolRegistry/index.ts",
"chars": 5884,
"preview": "import type { ExportedSymbol } from \"../headerResolver/types.ts\";\nimport { CHeaderResolver } from \"../headerResolver/ind"
},
{
"path": "src/languagePlugins/c/symbolRegistry/queries.ts",
"chars": 551,
"preview": "import Parser from \"tree-sitter\";\nimport { cParser } from \"../../../helpers/treeSitter/parsers.ts\";\n\nexport const C_FUNC"
},
{
"path": "src/languagePlugins/c/symbolRegistry/types.ts",
"chars": 3711,
"preview": "import {\n C_VARIABLE_TYPE,\n type ExportedSymbol,\n} from \"../headerResolver/types.ts\";\nimport type Parser from \"tree-si"
},
{
"path": "src/languagePlugins/c/testFiles/cFiles/.clangd",
"chars": 37,
"preview": "CompileFlags:\n Add: [-xc, -std=c99]\n"
},
{
"path": "src/languagePlugins/c/testFiles/cFiles/.napirc",
"chars": 719,
"preview": "{\n \"language\": \"c\",\n \"project\": {\n \"include\": [\n \"**/*.c\",\n \"**/*.h\"\n ],\n \"exclude\": [\n \".git/"
},
{
"path": "src/languagePlugins/c/testFiles/cFiles/all.h",
"chars": 44,
"preview": "#include \"burgers.h\"\n#include \"personnel.h\"\n"
},
{
"path": "src/languagePlugins/c/testFiles/cFiles/burgers.c",
"chars": 1485,
"preview": "// TOTAL SYMBOL COUNT : 1\n// TOTAL FUNCTION COUNT : 0\n#include \"burgers.h\"\n#include <stdio.h>\n#include <stdlib.h>\n#inclu"
},
{
"path": "src/languagePlugins/c/testFiles/cFiles/burgers.h",
"chars": 1267,
"preview": "// TOTAL SYMBOL COUNT : 16\n// TOTAL FUNCTION COUNT : 5\n#ifndef BURGERS_H\n#define BURGERS_H\n#include <stdbool.h>\n\n#define"
},
{
"path": "src/languagePlugins/c/testFiles/cFiles/crashcases.h",
"chars": 1071,
"preview": "// Code segments taken from the Pokémon Fire Red/Leaf Green decomp project\n// https://github.com/pret/pokefirered\n\n#defi"
},
{
"path": "src/languagePlugins/c/testFiles/cFiles/errors.h",
"chars": 267,
"preview": "#include \"thisfiledoesnotexist.h\"\n\n// Unnamed enum\nenum {\n ONE, TWO, THREE, VIVA, L, ALGERIE\n};\nint xbox = ONE;\n\nstru"
},
{
"path": "src/languagePlugins/c/testFiles/cFiles/main.c",
"chars": 695,
"preview": "#include \"all.h\"\n#include <stdio.h>\n\nint main(void) {\n struct Burger* burger = create_burger(\"Cheeseburger\", (enum Co"
},
{
"path": "src/languagePlugins/c/testFiles/cFiles/oldman.h",
"chars": 1847,
"preview": "// Code segments taken from the Pokémon Fire Red/Leaf Green decomp project\n// https://github.com/pret/pokefirered\n#inclu"
},
{
"path": "src/languagePlugins/c/testFiles/cFiles/personnel.c",
"chars": 2669,
"preview": "#include \"personnel.h\"\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nEmployee* create_employee(int id, con"
},
{
"path": "src/languagePlugins/c/testFiles/cFiles/personnel.h",
"chars": 830,
"preview": "// TOTAL SYMBOL COUNT : 12\n// TOTAL FUNCTION COUNT : 6\n#ifndef PERSONNEL_H\n#define PERSONNEL_H\n#include <stdbool.h>\n\n#de"
},
{
"path": "src/languagePlugins/c/testFiles/index.ts",
"chars": 2062,
"preview": "import * as fs from \"node:fs\";\nimport { extname, join } from \"@std/path\";\nimport type Parser from \"tree-sitter\";\nimport "
},
{
"path": "src/languagePlugins/c/warnings/index.test.ts",
"chars": 898,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { CWarningManager } from"
},
{
"path": "src/languagePlugins/c/warnings/index.ts",
"chars": 1813,
"preview": "import {\n type ManifestDiagnostics,\n TreeSitterError,\n UnnamedDatatypeWarning,\n} from \"./types.ts\";\nimport type Parse"
},
{
"path": "src/languagePlugins/c/warnings/queries.ts",
"chars": 509,
"preview": "import Parser from \"tree-sitter\";\nimport { cParser } from \"../../../helpers/treeSitter/parsers.ts\";\n\nexport const C_ERRO"
},
{
"path": "src/languagePlugins/c/warnings/types.ts",
"chars": 1134,
"preview": "import type Parser from \"tree-sitter\";\n\nexport interface ManifestDiagnostics {\n filename: string;\n line: number;\n col"
},
{
"path": "src/languagePlugins/csharp/README.md",
"chars": 8165,
"preview": "# NanoAPI C# Plugin\n\nThis plugin manages parsing and mapping of dependencies in C#/.NET projects.\n\n## Class diagram\n\n```"
},
{
"path": "src/languagePlugins/csharp/dependencyFormatting/index.test.ts",
"chars": 982,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { CSharpDependencyFormat"
},
{
"path": "src/languagePlugins/csharp/dependencyFormatting/index.ts",
"chars": 8868,
"preview": "import type { SymbolType } from \"../namespaceResolver/index.ts\";\nimport {\n CSharpInvocationResolver,\n type Invocations"
},
{
"path": "src/languagePlugins/csharp/extensionResolver/index.test.ts",
"chars": 1042,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { CSharpExtensionResolve"
},
{
"path": "src/languagePlugins/csharp/extensionResolver/index.ts",
"chars": 4833,
"preview": "import type {\n CSharpNamespaceMapper,\n NamespaceNode,\n SymbolNode,\n} from \"../namespaceMapper/index.ts\";\nimport { csh"
},
{
"path": "src/languagePlugins/csharp/extractor/index.test.ts",
"chars": 3389,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { CSharpExtractor } from"
},
{
"path": "src/languagePlugins/csharp/extractor/index.ts",
"chars": 6770,
"preview": "import type Parser from \"tree-sitter\";\nimport {\n CSharpProjectMapper,\n type DotNetProject,\n} from \"../projectMapper/in"
},
{
"path": "src/languagePlugins/csharp/invocationResolver/index.test.ts",
"chars": 6061,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport type { File } from \"../n"
},
{
"path": "src/languagePlugins/csharp/invocationResolver/index.ts",
"chars": 15843,
"preview": "import Parser from \"tree-sitter\";\nimport type { File } from \"../namespaceResolver/index.ts\";\nimport type {\n CSharpNames"
},
{
"path": "src/languagePlugins/csharp/metricsAnalyzer/index.test.ts",
"chars": 3525,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { CSharpMetricsAnalyzer "
},
{
"path": "src/languagePlugins/csharp/metricsAnalyzer/index.ts",
"chars": 6117,
"preview": "import Parser from \"tree-sitter\";\nimport { csharpParser } from \"../../../helpers/treeSitter/parsers.ts\";\n\n/**\n * Interfa"
},
{
"path": "src/languagePlugins/csharp/namespaceMapper/index.test.ts",
"chars": 5876,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { CSharpNamespaceMapper "
},
{
"path": "src/languagePlugins/csharp/namespaceMapper/index.ts",
"chars": 11160,
"preview": "import type Parser from \"tree-sitter\";\nimport {\n CSharpNamespaceResolver,\n type SymbolType,\n} from \"../namespaceResolv"
},
{
"path": "src/languagePlugins/csharp/namespaceResolver/index.test.ts",
"chars": 3489,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { CSharpNamespaceResolve"
},
{
"path": "src/languagePlugins/csharp/namespaceResolver/index.ts",
"chars": 8073,
"preview": "import Parser from \"tree-sitter\";\nimport { csharpParser } from \"../../../helpers/treeSitter/parsers.ts\";\n\n// Constants r"
},
{
"path": "src/languagePlugins/csharp/projectMapper/index.test.ts",
"chars": 1624,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { CSharpProjectMapper } "
},
{
"path": "src/languagePlugins/csharp/projectMapper/index.ts",
"chars": 5194,
"preview": "import { basename, dirname, join } from \"@std/path\";\nimport type {\n ExternalSymbol,\n InternalSymbol,\n ResolvedImports"
},
{
"path": "src/languagePlugins/csharp/testFiles/csharpFiles/2Namespaces1File.cs",
"chars": 784,
"preview": "using HalfNamespace;\nusing MyApp.Models; // Useless using directive\n\nnamespace MyApp.BeefBurger\n{\n public class Steak"
},
{
"path": "src/languagePlugins/csharp/testFiles/csharpFiles/Models.cs",
"chars": 387,
"preview": "namespace MyApp.Models;\npublic class User\n{\n public string Name { get; set; }\n private string Password { get; set;"
},
{
"path": "src/languagePlugins/csharp/testFiles/csharpFiles/Namespaced.cs",
"chars": 304,
"preview": "namespace MyNamespace\n{\n public class MyClass\n {\n public void MyMethod()\n {\n Console.Writ"
},
{
"path": "src/languagePlugins/csharp/testFiles/csharpFiles/Nested.cs",
"chars": 673,
"preview": "namespace OuterNamespace\n{\n public class OuterClass\n {\n public void OuterMethod()\n {\n Con"
},
{
"path": "src/languagePlugins/csharp/testFiles/csharpFiles/OtherFileSameNamespace.cs",
"chars": 51,
"preview": "namespace MyApp.BeefBurger;\npublic class Salad { }\n"
},
{
"path": "src/languagePlugins/csharp/testFiles/csharpFiles/Program.cs",
"chars": 1106,
"preview": "using MyNamespace;\nusing HalfNamespace;\nusing static OuterNamespace.OuterClass;\nusing OuterNamespace.InnerNamespace;\nusi"
},
{
"path": "src/languagePlugins/csharp/testFiles/csharpFiles/SemiNamespaced.cs",
"chars": 507,
"preview": "namespace HalfNamespace\n{\n public class Gordon\n {\n public void Crowbar()\n {\n Console.Writ"
},
{
"path": "src/languagePlugins/csharp/testFiles/csharpFiles/Subfolder/GlobalUsings.cs",
"chars": 48,
"preview": "global using System;\nglobal using MyApp.Models;\n"
},
{
"path": "src/languagePlugins/csharp/testFiles/csharpFiles/Subfolder/TestFiles.Subfolder.csproj",
"chars": 206,
"preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n <PropertyGroup>\n <TargetFramework>net9.0</TargetFramework>\n <Nullable>enable<"
},
{
"path": "src/languagePlugins/csharp/testFiles/csharpFiles/TestFiles.csproj",
"chars": 206,
"preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n <PropertyGroup>\n <TargetFramework>net9.0</TargetFramework>\n <Nullable>enable<"
},
{
"path": "src/languagePlugins/csharp/testFiles/csharpFiles/Usage.cs",
"chars": 575,
"preview": "global using System.IO;\nusing System;\nusing System.Collections.Generic;\nusing static System.Math;\nusing Guy = MyApp.Mode"
},
{
"path": "src/languagePlugins/csharp/testFiles/index.ts",
"chars": 2498,
"preview": "import { extname, join } from \"@std/path\";\nimport type Parser from \"tree-sitter\";\nimport { csharpParser } from \"../../.."
},
{
"path": "src/languagePlugins/csharp/usingResolver/index.test.ts",
"chars": 5122,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport {\n CSharpUsingResolver,"
},
{
"path": "src/languagePlugins/csharp/usingResolver/index.ts",
"chars": 11740,
"preview": "import Parser from \"tree-sitter\";\nimport type {\n CSharpNamespaceMapper,\n NamespaceNode,\n SymbolNode,\n} from \"../names"
},
{
"path": "src/languagePlugins/java/dependencyFormatting/index.test.ts",
"chars": 1271,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { getJavaFilesContentMap"
},
{
"path": "src/languagePlugins/java/dependencyFormatting/index.ts",
"chars": 5149,
"preview": "import type Parser from \"tree-sitter\";\nimport { javaParser } from \"../../../helpers/treeSitter/parsers.ts\";\nimport { Jav"
},
{
"path": "src/languagePlugins/java/dependencyFormatting/types.ts",
"chars": 983,
"preview": "import type { SymbolType } from \"../packageResolver/types.ts\";\nimport type Parser from \"tree-sitter\";\n\n/**\n * Represents"
},
{
"path": "src/languagePlugins/java/extractor/index.test.ts",
"chars": 894,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { getJavaFilesContentMap"
},
{
"path": "src/languagePlugins/java/extractor/index.ts",
"chars": 2775,
"preview": "import type Parser from \"tree-sitter\";\nimport type { DependencyManifest } from \"../../../manifest/dependencyManifest/typ"
},
{
"path": "src/languagePlugins/java/extractor/types.ts",
"chars": 1281,
"preview": "import type { JavaInvocationResolver } from \"../invocationResolver/index.ts\";\nimport type { JavaFile } from \"../packageR"
},
{
"path": "src/languagePlugins/java/importResolver/index.test.ts",
"chars": 2038,
"preview": "import { getJavaFilesMap } from \"../testFiles/index.ts\";\nimport { BURGER, PEBBLE, WORMKILLER } from \"../testFiles/consta"
},
{
"path": "src/languagePlugins/java/importResolver/index.ts",
"chars": 1695,
"preview": "import type { JavaPackageMapper } from \"../packageMapper/index.ts\";\nimport type { JavaFile } from \"../packageResolver/ty"
},
{
"path": "src/languagePlugins/java/importResolver/types.ts",
"chars": 442,
"preview": "import type { ConcreteNode } from \"../packageMapper/types.ts\";\n\n/**\n * Represents a collection of Java imports, categori"
},
{
"path": "src/languagePlugins/java/invocationResolver/index.test.ts",
"chars": 1410,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { getJavaFilesMap } from"
},
{
"path": "src/languagePlugins/java/invocationResolver/index.ts",
"chars": 2310,
"preview": "import type { JavaImportResolver } from \"../importResolver/index.ts\";\nimport type { JavaImports } from \"../importResolve"
},
{
"path": "src/languagePlugins/java/invocationResolver/queries.ts",
"chars": 762,
"preview": "import Parser from \"tree-sitter\";\nimport { javaParser } from \"../../../helpers/treeSitter/parsers.ts\";\n\n/**\n * A Tree-si"
},
{
"path": "src/languagePlugins/java/invocationResolver/types.ts",
"chars": 408,
"preview": "import type { ConcreteNode } from \"../packageMapper/types.ts\";\n\n/**\n * Represents a collection of invocations.\n */\nexpor"
},
{
"path": "src/languagePlugins/java/metrics/index.ts",
"chars": 5145,
"preview": "import { JAVA_COMMENT_QUERY, JAVA_COMPLEXITY_QUERY } from \"./queries.ts\";\nimport type {\n CodeCounts,\n CommentSpan,\n J"
},
{
"path": "src/languagePlugins/java/metrics/queries.ts",
"chars": 615,
"preview": "import Parser from \"tree-sitter\";\nimport { javaParser } from \"../../../helpers/treeSitter/parsers.ts\";\n\n// Tree-sitter q"
},
{
"path": "src/languagePlugins/java/metrics/types.ts",
"chars": 827,
"preview": "/**\n * Interface for code volumes\n */\nexport interface CodeCounts {\n /** Number of lines of code */\n lines: number;\n "
},
{
"path": "src/languagePlugins/java/packageMapper/index.test.ts",
"chars": 3996,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { JavaPackageMapper } fr"
},
{
"path": "src/languagePlugins/java/packageMapper/index.ts",
"chars": 1182,
"preview": "import { JavaTree } from \"./types.ts\";\nimport type Parser from \"tree-sitter\";\nimport { JavaPackageResolver } from \"../pa"
},
{
"path": "src/languagePlugins/java/packageMapper/types.ts",
"chars": 4730,
"preview": "import type { ExportedSymbol, JavaFile } from \"../packageResolver/types.ts\";\n\n/**\n * Represents a node in a Java tree st"
},
{
"path": "src/languagePlugins/java/packageResolver/index.test.ts",
"chars": 4956,
"preview": "import { describe, test } from \"@std/testing/bdd\";\nimport { expect } from \"@std/expect\";\nimport { getJavaFilesMap } from"
},
{
"path": "src/languagePlugins/java/packageResolver/index.ts",
"chars": 1765,
"preview": "import type Parser from \"tree-sitter\";\nimport { JavaClass, type JavaFile, type SymbolType } from \"./types.ts\";\nimport { "
},
{
"path": "src/languagePlugins/java/packageResolver/queries.ts",
"chars": 1152,
"preview": "import Parser from \"tree-sitter\";\nimport { javaParser } from \"../../../helpers/treeSitter/parsers.ts\";\n\n/**\n * A Tree-si"
},
{
"path": "src/languagePlugins/java/packageResolver/types.ts",
"chars": 7631,
"preview": "import type Parser from \"tree-sitter\";\nimport { JAVA_STATIC_MEMBERS_QUERY } from \"./queries.ts\";\n\n/**\n * Represents the "
},
{
"path": "src/languagePlugins/java/testFiles/constants.ts",
"chars": 670,
"preview": "import { javaFilesFolder } from \"./index.ts\";\nimport { join } from \"@std/path\";\n\n// Root\nexport const APP = join(javaFil"
},
{
"path": "src/languagePlugins/java/testFiles/index.ts",
"chars": 1954,
"preview": "import * as fs from \"node:fs\";\nimport { extname, join } from \"@std/path\";\nimport type Parser from \"tree-sitter\";\nimport "
},
{
"path": "src/languagePlugins/java/testFiles/napi-tests/.project",
"chars": 835,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<projectDescription>\n\t<name>napi-tests</name>\n\t<comment></comment>\n\t<projects>\n\t<"
},
{
"path": "src/languagePlugins/java/testFiles/napi-tests/src/main/java/io/nanoapi/testfiles/App.java",
"chars": 250,
"preview": "package io.nanoapi.testfiles;\n\nimport static io.nanoapi.testfiles.food.Burger.*;\n\n/**\n * Hello world!\n */\npublic class A"
},
{
"path": "src/languagePlugins/java/testFiles/napi-tests/src/main/java/io/nanoapi/testfiles/food/Burger.java",
"chars": 458,
"preview": "package io.nanoapi.testfiles.food;\n\nimport java.io.File;\nimport java.lang.System;\n\npublic class Burger<T> implements Foo"
},
{
"path": "src/languagePlugins/java/testFiles/napi-tests/src/main/java/io/nanoapi/testfiles/food/Condiment.java",
"chars": 96,
"preview": "package io.nanoapi.testfiles.food;\n\npublic enum Condiment {\n SALAD,\n TOMATO,\n ONION,\n}\n"
},
{
"path": "src/languagePlugins/java/testFiles/napi-tests/src/main/java/io/nanoapi/testfiles/food/DoubleBurger.java",
"chars": 86,
"preview": "package io.nanoapi.testfiles.food;\n\npublic class DoubleBurger<T, N> extends Burger {}\n"
},
{
"path": "src/languagePlugins/java/testFiles/napi-tests/src/main/java/io/nanoapi/testfiles/food/Food.java",
"chars": 150,
"preview": "package io.nanoapi.testfiles.food;\n\npublic interface Food {\n public void eat();\n\n public double getPrice();\n\n p"
}
]
// ... and 108 more files (download for full content)
About this extraction
This page contains the full source code of the nanoapi-io/napi GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 308 files (1.5 MB), approximately 398.7k tokens, and a symbol index with 999 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.