# jindawn/ai-cli-cheatsheet-extension architecture

> Architecture diagram of the GitHub repository jindawn/ai-cli-cheatsheet-extension, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jindawn/ai-cli-cheatsheet-extension
- Repository: https://github.com/jindawn/ai-cli-cheatsheet-extension

## Overview

AI CLI 速查表是一个本地优先的 Chrome/Edge 扩展：用户搜索工具命令、查看用法并复制适配平台的结果；收藏、最近记录和偏好也保存在浏览器本地。可选维护流程则由扩展请求本机桥接，获取官方清单、生成差异预览，并在用户确认后提交修订。图中涵盖 README 所述搜索、筛选、推荐、质量信息与桥接能力；未展示的源码调用关系不作确定性推断。

Main entry points: [`native-host/host.py`](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/host.py) (Native Host), [`popup.js`](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/popup.js) (弹窗控制器), [`popup-loader.js`](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/popup-loader.js) (数据加载器), [`product-core.js`](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/product-core.js) (搜索与平台逻辑)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["浏览器查阅"]
  node_popup["弹窗控制器<br/>[popup.js]"]
  node_search["搜索与平台逻辑<br/>[product-core.js]"]
  node_initials["拼音匹配表<br/>[pinyin-initials.js]"]
  node_loader["数据加载器<br/>[popup-loader.js]"]
  node_state["偏好与推荐<br/>[popup-state.js]"]
  node_render["结果与证据展示<br/>[popup-render.js]"]
  node_tasks["维护任务状态<br/>[popup-tasks.js]"]
end

subgraph group_content["速查内容"]
  node_tooldata["工具命令数据"]
  node_dataindex["数据目录索引<br/>[index.js]"]
  node_examples["用法示例富化<br/>[usage-examples.js]"]
end

subgraph group_bridge["本机维护桥接"]
  node_background["后台任务桥接<br/>[background.js]"]
  node_host["Native Host<br/>[host.py]"]
  node_protocol["消息帧协议<br/>[protocol.py]"]
  node_providers["Provider 注册表"]
  node_profiles["通用调用配置"]
  node_installers["安装配置"]
end

subgraph group_verification["证据与修订"]
  node_dynamic["动态修订提交<br/>[dynamic-data.js]"]
  node_inventory["官方入口清单"]
  node_catalog["工具目录生成<br/>[catalog.py]"]
end

node_user(("扩展用户"))
node_maintenanceuser(("主动维护用户"))

node_user -->|"查询或复制"| node_popup
node_popup -.->|"加载数据"| node_loader
node_loader -->|"读取清单"| node_dataindex
node_loader -->|"注入数据"| node_tooldata
node_popup -->|"搜索排序"| node_search
node_search -->|"匹配拼音"| node_initials
node_popup -->|"读取偏好"| node_state
node_popup -->|"呈现结果"| node_render
node_render -.->|"展示用法"| node_examples
node_maintenanceuser -->|"发起维护"| node_popup
node_popup -.->|"跟踪任务"| node_tasks
node_tasks -.->|"请求任务"| node_background
node_background -->|"Native Messaging"| node_host
node_host -->|"读写帧"| node_protocol
node_host -->|"读取注册表"| node_providers
node_host -.->|"核验清单"| node_inventory
node_host -.->|"调用配置"| node_profiles
node_host -.->|"安装环境"| node_installers
node_host -->|"生成目录"| node_catalog
node_host -.->|"提交修订"| node_dynamic
node_dynamic -.->|"更新本地数据"| node_tooldata

click node_popup "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/popup.js"
click node_search "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/product-core.js"
click node_initials "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/pinyin-initials.js"
click node_tooldata "https://github.com/jindawn/ai-cli-cheatsheet-extension/tree/main/data"
click node_dataindex "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/data/index.js"
click node_loader "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/popup-loader.js"
click node_state "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/popup-state.js"
click node_render "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/popup-render.js"
click node_examples "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/usage-examples.js"
click node_tasks "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/popup-tasks.js"
click node_background "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/background.js"
click node_dynamic "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/dynamic-data.js"
click node_host "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/host.py"
click node_protocol "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/protocol.py"
click node_inventory "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/official_inventory.py"
click node_providers "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/provider_registry.py"
click node_profiles "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/generic_profiles.py"
click node_installers "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/provider_installers.py"
click node_catalog "https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/catalog.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_popup,node_search,node_initials,node_loader,node_state,node_render,node_tasks toneBlue
class node_tooldata,node_dataindex,node_examples toneAmber
class node_background,node_host,node_protocol,node_providers,node_profiles,node_installers toneMint
class node_dynamic,node_inventory,node_catalog toneRose
class node_user,node_maintenanceuser toneIndigo
```

## Components

### 浏览器查阅

- [弹窗控制器](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/popup.js): `popup.js`
- [搜索与平台逻辑](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/product-core.js): `product-core.js`
- [拼音匹配表](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/pinyin-initials.js): `pinyin-initials.js`
- [数据加载器](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/popup-loader.js): `popup-loader.js`
- [偏好与推荐](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/popup-state.js): `popup-state.js`
- [结果与证据展示](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/popup-render.js): `popup-render.js`
- [维护任务状态](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/popup-tasks.js): `popup-tasks.js`

### 速查内容

- [工具命令数据](https://github.com/jindawn/ai-cli-cheatsheet-extension/tree/main/data): `data`
- [数据目录索引](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/data/index.js): `data/index.js`
- [用法示例富化](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/usage-examples.js): `usage-examples.js`

### 本机维护桥接

- [后台任务桥接](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/background.js): `background.js`
- [Native Host](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/host.py): `native-host/host.py`
- [消息帧协议](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/protocol.py): `native-host/protocol.py`
- [Provider 注册表](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/provider_registry.py): `native-host/provider_registry.py`
- [通用调用配置](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/generic_profiles.py): `native-host/generic_profiles.py`
- [安装配置](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/provider_installers.py): `native-host/provider_installers.py`

### 证据与修订

- [动态修订提交](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/dynamic-data.js): `dynamic-data.js`
- [官方入口清单](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/official_inventory.py): `native-host/official_inventory.py`
- [工具目录生成](https://github.com/jindawn/ai-cli-cheatsheet-extension/blob/main/native-host/catalog.py): `native-host/catalog.py`

### Other components

- **扩展用户**
- **主动维护用户**

## Connections

- 扩展用户 → 弹窗控制器: 查询或复制 (evidence: `README.md`)
- 弹窗控制器 → 数据加载器: 加载数据 (evidence: `README.md`)
- 数据加载器 → 数据目录索引: 读取清单 (evidence: `README.md`)
- 数据加载器 → 工具命令数据: 注入数据 (evidence: `README.md`)
- 弹窗控制器 → 搜索与平台逻辑: 搜索排序 (evidence: `README.md`)
- 搜索与平台逻辑 → 拼音匹配表: 匹配拼音 (evidence: `product-core.js`)
- 弹窗控制器 → 偏好与推荐: 读取偏好 (evidence: `README.md`)
- 弹窗控制器 → 结果与证据展示: 呈现结果 (evidence: `README.md`)
- 结果与证据展示 → 用法示例富化: 展示用法 (evidence: `README.md`)
- 主动维护用户 → 弹窗控制器: 发起维护 (evidence: `README.md`)
- 弹窗控制器 → 维护任务状态: 跟踪任务 (evidence: `README.md`)
- 维护任务状态 → 后台任务桥接: 请求任务 (evidence: `README.md`)
- 后台任务桥接 → Native Host: Native Messaging (evidence: `README.md`)
- Native Host → 消息帧协议: 读写帧 (evidence: `native-host/host.py`)
- Native Host → Provider 注册表: 读取注册表 (evidence: `native-host/host.py`)
- Native Host → 官方入口清单: 核验清单 (evidence: `README.md`)
- Native Host → 通用调用配置: 调用配置 (evidence: `native-host/host.py`)
- Native Host → 安装配置: 安装环境 (evidence: `README.md`)
- Native Host → 工具目录生成: 生成目录 (evidence: `native-host/host.py`)
- Native Host → 动态修订提交: 提交修订 (evidence: `README.md`)
- 动态修订提交 → 工具命令数据: 更新本地数据 (evidence: `README.md`)
