# akgondber/npm-check-extras architecture

> Architecture diagram of the GitHub repository akgondber/npm-check-extras, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akgondber/npm-check-extras
- Repository: https://github.com/akgondber/npm-check-extras

## Overview

##### Project type and purpose
- This is a Node.js command-line application (“npm-check-extras”) that scans project or global dependencies for outdated or unused packages, lets the user select packages to update/delete, and can record history of those actions.
- It uses Ink (React for CLI) for its UI, execa for spawning external commands, and npm-check under the hood.

##### File structure
- Top-level:
- loadr.mjs: likely an ES module loader or bootstrap
- cli.tsx: CLI entry point (Ink-based)
- app.tsx: the React root component for the CLI UI
- source/actions: business logic for package checks, update, delete
- source/components: Ink-based UI pieces (OperationsHistory, TextItem)
- source/store: application state (options, history, status, user input, etc.)
- source/helpers.ts / ramda-utils.ts: pure helper functions
- source/history.ts: persistence layer for .npm-check-history.json
- defaults, types: configuration and TypeScript definitions
- Tests mirror source structure for unit testing of actions and store modules.

##### README for additional insights
- Indicates supported CLI flags, use of npm-check, how history is stored
- Shows that the core flow is: parse flags → run checks → render results → capture user input → execute actions → optionally record history → display stats

##### Summary
- Break the system into six core components and show how data and control flow among them
- Unidirectional Flux flow, Ink/React UI, and external integrations

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "CLI Layer"
        loadr["loadr.mjs"]:::cli_ui
        cli["cli.tsx"]:::cli_ui
    end

    subgraph "UI Layer"
        app["app.tsx"]:::cli_ui
        OH["OperationsHistory.tsx"]:::cli_ui
        TI["TextItem.tsx"]:::cli_ui
    end

    subgraph "State Store"
        store["store.ts"]:::biz
        fi["focusable-items.ts"]:::biz
        hi["history-items.ts"]:::biz
        os["options-stepper.ts"]:::biz
        optStore["options.ts"]:::biz
        pkgStore["packages.ts"]:::biz
        ps["panel-stepper.ts"]:::biz
        st["status.ts"]:::biz
        si["submitted-input.ts"]:::biz
        uiStore["user-input.ts"]:::biz
    end

    subgraph "Actions / Business Logic"
        optMgr["options-manager.ts"]:::biz
        pkgAct["packages.ts"]:::biz
    end

    subgraph "Helpers / Utilities"
        hlp["helpers.ts"]:::biz
        rgu["ramda-utils.ts"]:::biz
    end

    subgraph "Config & Types"
        def["defaults.ts"]:::biz
        types["types.ts"]:::biz
    end

    subgraph "Persistence"
        hist["history.ts"]:::persistence
    end

    subgraph "External Services"
        nc["npm-check"]:::external
        ex["execa (shell)"]:::external
    end

    loadr -->|"bootstrap CLI"| cli
    cli -->|"initialize UI"| app
    app -->|"subscribe"| store
    store -->|"update UI"| app
    app -->|"dispatch fetchDeps"| optMgr
    app -->|"dispatch packageActions"| pkgAct
    optMgr -->|"update options"| store
    pkgAct -->|"npm-check output"| nc
    pkgAct -->|"run shell commands"| ex
    pkgAct -->|"store results"| store
    pkgAct -->|"write history"| hist

    classDef cli_ui fill:#e0ffe0,stroke:#009900;
    classDef biz fill:#e0f0ff,stroke:#0066cc;
    classDef persistence fill:#fff0e0,stroke:#ff9900;
    classDef external fill:#f0f0f0,stroke:#999999;

    click loadr "https://github.com/akgondber/npm-check-extras/blob/main/loadr.mjs"
    click cli "https://github.com/akgondber/npm-check-extras/blob/main/source/cli.tsx"
    click app "https://github.com/akgondber/npm-check-extras/blob/main/source/app.tsx"
    click OH "https://github.com/akgondber/npm-check-extras/blob/main/source/components/OperationsHistory.tsx"
    click TI "https://github.com/akgondber/npm-check-extras/blob/main/source/components/TextItem.tsx"
    click store "https://github.com/akgondber/npm-check-extras/blob/main/source/store.ts"
    click fi "https://github.com/akgondber/npm-check-extras/blob/main/source/store/focusable-items.ts"
    click hi "https://github.com/akgondber/npm-check-extras/blob/main/source/store/history-items.ts"
    click os "https://github.com/akgondber/npm-check-extras/blob/main/source/store/options-stepper.ts"
    click optStore "https://github.com/akgondber/npm-check-extras/blob/main/source/store/options.ts"
    click pkgStore "https://github.com/akgondber/npm-check-extras/blob/main/source/store/packages.ts"
    click ps "https://github.com/akgondber/npm-check-extras/blob/main/source/store/panel-stepper.ts"
    click st "https://github.com/akgondber/npm-check-extras/blob/main/source/store/status.ts"
    click si "https://github.com/akgondber/npm-check-extras/blob/main/source/store/submitted-input.ts"
    click uiStore "https://github.com/akgondber/npm-check-extras/blob/main/source/store/user-input.ts"
    click optMgr "https://github.com/akgondber/npm-check-extras/blob/main/source/actions/options-manager.ts"
    click pkgAct "https://github.com/akgondber/npm-check-extras/blob/main/source/actions/packages.ts"
    click hlp "https://github.com/akgondber/npm-check-extras/blob/main/source/helpers.ts"
    click rgu "https://github.com/akgondber/npm-check-extras/blob/main/source/ramda-utils.ts"
    click hist "https://github.com/akgondber/npm-check-extras/blob/main/source/history.ts"
    click def "https://github.com/akgondber/npm-check-extras/blob/main/source/defaults.ts"
    click types "https://github.com/akgondber/npm-check-extras/blob/main/source/types.ts"
```
