git-ai-control 0.4.9 → 0.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  本项目的所有重要变更都会记录在此文件中。
4
4
 
5
+ ## [0.4.12] - 2026-08-12
6
+
7
+ ### 变更
8
+
9
+ - 英文 README 改用完整英文界面截图,并移除末尾误附的中文重复内容;中文说明继续由 `README.zh-CN.md` 提供。
10
+
11
+ ## [0.4.11] - 2026-08-12
12
+
13
+ ### 修复
14
+
15
+ - 将配置中心的构建时间固化为随版本提交的元数据,确保本地与发布流水线生成一致的静态资源。
16
+
17
+ ## [0.4.10] - 2026-08-12
18
+
19
+ ### 新增
20
+
21
+ - 配置中心支持中文与英文:首次按系统语言显示,右上角可手动切换并记住选择;状态、设置、插件、审计、验证提示和日期格式均随语言更新。
22
+ - `README.md` 改为英文默认文档,并新增 `README.zh-CN.md` 中文文档入口。
23
+ - Git AI 状态卡展示 Git AI 二进制版本与更新时间;过滤服务状态卡展示 git-ai-control 版本与构建更新时间。
24
+
25
+ ### 变更
26
+
27
+ - 状态卡中的版本号调整为紧随“已开启 / 已在线”状态文本,缩短信息阅读距离。
28
+
5
29
  ## [0.4.9] - 2026-08-12
6
30
 
7
31
  ### 修复
package/README.md CHANGED
@@ -1,183 +1,146 @@
1
1
  # Git AI Control Panel
2
2
 
3
- 公司统一安装了 Git AI,但不想让私人 GitHub 项目的仓库名、路径、分支或 Skill 使用情况被上报?可以试试 Git AI Control Panel。
3
+ [Chinese documentation](README.zh-CN.md)
4
4
 
5
- 它是一个支持 macOSLinux Windows Git AI 本地配置与上传策略管理页面:不用手改 JSON,也不用为每条隐私规则编写脚本,就能按仓库主机控制允许上传的数据类型和字段。前端使用 ReactVite shadcn/ui,Web 服务只监听 `127.0.0.1:38742`,不会向局域网或公网开放。
5
+ Git AI Control Panel is a local settings and upload-policy manager for Git AI on macOS, Linux, and Windows. It lets you control report event types and fields by repository host without manually editing JSON or writing a script for every privacy rule. The React/Vite control page listens only on `127.0.0.1:38742`; it is never exposed to your LAN or the public internet.
6
6
 
7
7
  > [!IMPORTANT]
8
- > 项目可以识别 `custom_metrics` 定制版和官方 [`git-ai-project/git-ai`](https://github.com/git-ai-project/git-ai),但两者支持层级不同。仓库级事件开关、字段脱敏和 Skill 过滤目前需要 `custom_metrics` 扩展点;官方版只能管理 Git AI 已公开的原生配置。安装前请阅读[兼容性说明](COMPATIBILITY.md)
8
+ > The project detects both custom `custom_metrics` builds and the upstream [`git-ai-project/git-ai`](https://github.com/git-ai-project/git-ai), but their capabilities differ. Repository-level event controls, field redaction, and Skill filtering require the `custom_metrics` extension point. Read the [compatibility guide](COMPATIBILITY.md) before installing.
9
9
 
10
- ## 功能
10
+ ## Features
11
11
 
12
- - 可视化管理 Git AI 自动更新、版本检查、仓库排除和提示词排除;
13
- - 通过“匹配仓库主机”统一处理 GitHubGitLabGitee 或其他 Git 服务;
14
- - 分别控制 TokenSkillsCommitCheckpointAgent、提示耗时和提示报告;
15
- - 可删除仓库信息、项目路径和分支名称等敏感字段;
16
- - 可将允许上传的 Skill 项目目录替换为固定目录;
17
- - 可按关键词或正则拦截指定 Skill;
18
- - 仓库插件可按不同主机添加多个,并支持全局兜底、仓库、目录、分支与优先级;
19
- - 敏感内容脱敏插件可识别 API Key、私钥、凭据,并按规则脱敏或拦截;
20
- - Agent / 模型治理插件支持允许名单、阻止正则及审计/拦截模式;
21
- - Skill、敏感内容和 Agent / 模型治理均使用独立配置表单;
22
- - 支持配置验证、运行状态检查和本机过滤服务重启。
12
+ - Manage Git AI automatic updates, version checks, repository exclusions, and prompt exclusions.
13
+ - Apply a common policy to GitHub, GitLab, Gitee, or another Git host.
14
+ - Control Token, Skills, Commit, Checkpoint, Agent, prompt-duration, and prompt-report uploads independently.
15
+ - Remove repository, project-path, and branch fields before a report leaves the device.
16
+ - Replace the reporting directory for allowed Skill uploads with a fixed directory.
17
+ - Block Skills by keyword or regular expression.
18
+ - Add repository plugins with a global fallback plus repository, directory, branch, and priority matching.
19
+ - Redact or block sensitive content such as API keys, private keys, and credentials.
20
+ - Govern Agent and model usage with allowlists, regex rules, audit mode, or blocking mode.
21
+ - Review the last 24 hours of locally blocked reports without storing report bodies.
22
+ - Show Git AI and filter-service status, version, and update time.
23
23
 
24
- ## 界面截图
24
+ ## Screenshots
25
25
 
26
- ### Git AI 原生设置
26
+ ### Native Git AI settings
27
27
 
28
- ![Git AI 原生设置页面](docs/images/git-ai-settings.jpg)
28
+ ![Native Git AI settings](docs/images/git-ai-settings-en.png)
29
29
 
30
- ### 插件管理
30
+ ### Plugin management
31
31
 
32
- ![仓库插件与 Skill 过滤插件管理页面](docs/images/plugin-management.jpg)
32
+ ![Repository and Skill filter plugin management](docs/images/plugin-management-en.png)
33
33
 
34
- 仓库插件可以同时配置匹配主机、允许上传的数据类型和允许保留的字段,也可以按不同主机添加多个。主机规则重叠时按列表顺序使用第一个命中插件;Skill 过滤插件使用独立表单管理名称规则,且只能添加一次。
34
+ ## Quick start
35
35
 
36
- 插件管理页面按添加顺序展示全部插件。无论添加仓库插件还是独立插件,新卡片都会追加到现有列表最后;这只影响页面展示顺序,不改变仓库规则的匹配优先级。
36
+ ### 1. Run one command
37
37
 
38
- ## 快速开始
39
-
40
- ### 1. 一条命令启动
41
-
42
- 支持 macOS、Linux 和 Windows,需要 Node.js 18+、Python 3,并要求 Git AI 已安装在默认目录:
38
+ macOS, Linux, and Windows are supported. You need Node.js 18+, Python 3, and Git AI installed in its default location:
43
39
 
44
40
  ```text
45
41
  macOS / Linux: ~/.git-ai/bin/git-ai
46
42
  Windows: %USERPROFILE%\.git-ai\bin\git-ai.exe
47
43
  ```
48
44
 
49
- 确认文件存在后运行:
45
+ Then run:
50
46
 
51
47
  ```bash
52
48
  npx git-ai-control
53
49
  ```
54
50
 
55
- 首次运行时,该命令会自动下载最新版本、安装本机服务,并打开 Git AI 配置中心;之后检测到已运行的配置中心时,会直接复用现有进程。
56
-
57
- 首次安装过程会:
58
-
59
- 1. 识别当前 Git AI 是否支持 `custom_metrics` 扩展;
60
- 2. 将原始上报端点备份到仅当前用户可读的本机配置;
61
- 3. 安装控制页面和上传过滤运行时;
62
- 4. 保留已有的 `config.json` 与 `filter_plugins.json`;
63
- 5. 通过当前系统的用户级服务管理器创建并启动两个本机服务;
64
- 6. 等待控制页面和过滤服务通过健康检查。
65
-
66
- 如果浏览器没有自动打开,可以手动访问:
51
+ The first run downloads the latest version, installs local services, and opens the control center. Later runs reuse the active local control center when it is already running. If the browser does not open automatically, visit:
67
52
 
68
53
  ```text
69
54
  http://127.0.0.1:38742
70
55
  ```
71
56
 
72
- 页面顶部会显示当前 Git AI 发行版、过滤接管状态和服务状态。
57
+ The installer detects whether Git AI supports `custom_metrics`, backs up original reporting endpoints for the current user only, keeps existing `config.json` and `filter_plugins.json`, installs the control page and filter runtime, and waits for both local health checks.
73
58
 
74
- 各系统使用的服务管理方式:
75
-
76
- | 系统 | 服务管理器 | 使用条件 |
59
+ | OS | Service manager | Requirement |
77
60
  | --- | --- | --- |
78
- | macOS | LaunchAgent | 当前图形用户会话 |
79
- | Linux | systemd user | 可用的 systemd 用户会话 |
80
- | Windows | 任务计划程序 | Windows 10/11,当前用户可创建登录任务 |
81
-
82
- ### 2. 配置仓库插件
83
-
84
- 以“GitHub 私人仓库只允许上传 Token”为例:
85
-
86
- 1. 在“仓库插件”中添加或打开现有仓库插件;
87
- 2. 在“匹配仓库主机”中填写 `github.com`;
88
- 3. 只打开 `Token`,关闭 `Skills`、`Commit`、`Checkpoint`、`Agent`、提示耗时和提示报告;
89
- 4. 关闭“仓库信息”“项目路径”和“分支名称”;
90
- 5. 保存配置。
61
+ | macOS | LaunchAgent | Current graphical user session |
62
+ | Linux | systemd user | Available systemd user session |
63
+ | Windows | Task Scheduler | Current user can create a logon task |
91
64
 
92
- 同一个仓库插件也可以填写多个主机,每行一个;也可以为不同主机分别添加仓库插件。GitLab、Gitee 和自建 Git 服务不需要单独开发插件。
65
+ ### 2. Configure a repository policy
93
66
 
94
- 仓库策略会先匹配特定规则,再匹配“全部仓库”全局规则;特定规则之间优先级数字越大越靠前,同优先级按插件列表顺序处理。仓库、目录、分支同时填写时需要全部命中。
67
+ For example, to allow only Token uploads for private GitHub repositories:
95
68
 
96
- ### 3. 配置敏感内容与 Agent
69
+ 1. Add or open a repository plugin.
70
+ 2. Enter `github.com` under **Matching repository hosts**.
71
+ 3. Enable **Token** only; disable Skills, Commit, Checkpoint, Agent, prompt duration, and prompt reports.
72
+ 4. Disable repository information, project path, and branch name.
73
+ 5. Save changes.
97
74
 
98
- 在“插件管理”中可分别添加以下独立插件:
75
+ Specific rules are matched before the global **All repositories** rule. Higher priorities win; equal priorities follow plugin list order. Repository, directory, and branch conditions must all match when populated.
99
76
 
100
- 1. “敏感内容脱敏”:选择作用事件、内置规则和自定义正则;命中后可脱敏或阻止上报;
101
- 2. “Agent / 模型治理”:配置允许的 Agent、模型与阻止正则;先使用“仅审计”确认命中情况,再按需改为阻止。
77
+ ### 3. Configure sensitive-content and Agent/model protection
102
78
 
103
- ### 4. 配置 Skill 过滤插件
79
+ From **Plugin management**, add either of these independent plugins:
104
80
 
105
- 需要按名称拦截 Skill 时:
81
+ 1. **Sensitive data redaction** — select event types, built-in rules, and custom regex; then redact or block matching reports.
82
+ 2. **Agent / model governance** — configure allowed Agents, models, and blocking regex. Start with audit mode, then use blocking mode if appropriate.
106
83
 
107
- 1. 添加“Skill 过滤插件”;
108
- 2. 打开插件;
109
- 3. 每行填写一个关键词或正则;
110
- 4. 保存配置。
84
+ ### 4. Configure Skill filtering
111
85
 
112
- Skill 过滤插件只负责名称规则。仓库匹配、上传类型和目录替换仍由仓库插件负责。
86
+ 1. Add the **Skill filter plugin**.
87
+ 2. Enable it.
88
+ 3. Enter one keyword or regular expression per line.
89
+ 4. Save changes.
113
90
 
114
- ### 5. 验证配置
91
+ ### 5. Verify local services
115
92
 
116
- 点击页面中的“验证配置”。结果会通过右上角 Toast 显示,不会占用配置表单空间。
117
-
118
- 也可以在终端检查两个本机服务:
93
+ Use **Validate settings** in the page, or run:
119
94
 
120
95
  ```bash
121
96
  curl -fsS http://127.0.0.1:38742/api/status
122
97
  curl -fsS http://127.0.0.1:38741/health
123
98
  ```
124
99
 
125
- ## 工作方式
100
+ ## How it works
126
101
 
127
- 本项目不会修改 `~/.git-ai/bin/git-ai` 二进制。检测到 `custom_metrics` 扩展点后,安装脚本会将 Git AI 的自定义上报端点指向本机过滤服务:
102
+ The project does not modify the `~/.git-ai/bin/git-ai` binary. When the `custom_metrics` extension point is available, the installer redirects Git AI custom reporting endpoints to the local filter service:
128
103
 
129
104
  ```text
130
105
  Git AI
131
106
  -> ~/.git-ai/custom_metrics.json
132
107
  -> http://127.0.0.1:38741
133
- -> 读取 ~/.git-ai/filter_plugins.json
134
- -> 读取 ~/.git-ai/upstream_metrics.json
135
- -> 拦截,或脱敏后转发至原上报服务
108
+ -> reads ~/.git-ai/filter_plugins.json
109
+ -> reads ~/.git-ai/upstream_metrics.json
110
+ -> blocks, or redacts and forwards to the original reporting service
136
111
  ```
137
112
 
138
- 两个页签中的“查看配置”会重新读取当前磁盘内容,不会显示未保存的表单修改。Git AI 原生配置只展示本页面安全管理的字段,插件策略展示完整已写入策略。
139
-
140
- 控制页面保存时只更新:
113
+ Saving from the control page only updates:
141
114
 
142
- - `~/.git-ai/config.json`:Git AI 原生设置;
143
- - `~/.git-ai/filter_plugins.json`:仓库插件和 Skill 过滤插件策略。
115
+ - `~/.git-ai/config.json` — native Git AI settings;
116
+ - `~/.git-ai/filter_plugins.json` — repository and Skill filter policies.
144
117
 
145
- 过滤逻辑来自仓库中的 `plugins/upload-filter/plugin_filter_runtime.py`。控制页面不会动态生成或改写 Python 脚本,`~/.git-ai` 只保存安装副本和用户配置。
118
+ The filter runtime is installed from `plugins/upload-filter/plugin_filter_runtime.py`. The page does not generate or modify the Python runtime; `~/.git-ai` contains only the installed copy and user configuration.
146
119
 
147
- ## 文件位置
120
+ ## Files
148
121
 
149
- | 内容 | 位置 |
122
+ | Item | Location |
150
123
  | --- | --- |
151
- | 过滤运行时源码 | `plugins/upload-filter/plugin_filter_runtime.py` |
152
- | 跨平台安装器 | `scripts/install.mjs`、`scripts/uninstall.mjs` |
153
- | 服务适配器 | `scripts/platform-services.mjs` |
154
- | Git AI 原生配置 | `~/.git-ai/config.json` |
155
- | 插件策略 | `~/.git-ai/filter_plugins.json` |
156
- | 原上报端点本机备份 | `~/.git-ai/upstream_metrics.json` |
157
- | 过滤运行时安装副本 | `~/.git-ai/filters/plugin_filter_runtime.py` |
158
- | Web 服务安装副本 | `~/.git-ai/control-panel` |
159
- | macOS 服务定义 | `~/Library/LaunchAgents/com.git-ai.*.plist` |
160
- | Linux 服务定义 | `~/.config/systemd/user/git-ai-*.service` |
161
- | Windows 服务定义 | `%USERPROFILE%\.git-ai\services\*.ps1` 与任务计划程序 |
162
-
163
- ## 卸载
124
+ | Filter runtime source | `plugins/upload-filter/plugin_filter_runtime.py` |
125
+ | Cross-platform installer | `scripts/install.mjs`, `scripts/uninstall.mjs` |
126
+ | Service adapters | `scripts/platform-services.mjs` |
127
+ | Native Git AI configuration | `~/.git-ai/config.json` |
128
+ | Plugin policy | `~/.git-ai/filter_plugins.json` |
129
+ | Original reporting-endpoint backup | `~/.git-ai/upstream_metrics.json` |
130
+ | Installed filter runtime | `~/.git-ai/filters/plugin_filter_runtime.py` |
131
+ | Installed control page | `~/.git-ai/control-panel` |
132
+
133
+ ## Uninstall
164
134
 
165
135
  ```bash
166
136
  npx git-ai-control uninstall
167
137
  ```
168
138
 
169
- 卸载命令会停止两个服务、删除本项目安装的程序副本,并将上报端点恢复为 Git AI 原地址。`config.json`、`filter_plugins.json` 和日志会保留。
170
-
171
- ## 参与贡献
172
-
173
- 欢迎提交 Issue 和 Pull Request,尤其欢迎:
139
+ Uninstall stops the two services, removes this project's installed runtime copies, and restores the original Git AI reporting endpoints. It keeps `config.json`, `filter_plugins.json`, and logs.
174
140
 
175
- - 补充不同 Git AI 版本的兼容性验证;
176
- - 新增与仓库过滤不同类型的独立插件;
177
- - 改进过滤规则的测试覆盖;
178
- - 修正文档、交互和无障碍问题。
141
+ ## Contributing
179
142
 
180
- 开发前请先 Fork 仓库并创建主题分支。前端源码位于 `frontend/git-ai-control-panel`,shadcn/ui 组件位于 `src/components/ui`。
143
+ Contributions are welcome, especially compatibility verification for different Git AI versions, independent plugin types, test coverage, documentation, interaction, and accessibility improvements.
181
144
 
182
145
  ```bash
183
146
  cd frontend/git-ai-control-panel
@@ -188,32 +151,18 @@ cd ../..
188
151
  npm run check
189
152
  ```
190
153
 
191
- 提交 Pull Request 时请说明:
192
-
193
- 1. 解决的问题和使用场景;
194
- 2. 对配置结构或过滤行为的影响;
195
- 3. 已执行的验证命令;
196
- 4. 涉及界面变化时附上前后截图。
197
-
198
- 新增插件类型时,请为它设计独立的数据结构和配置表单;不要复用仓库插件表单来表达无关能力。涉及上报兼容性时,应基于实际 Git AI 版本和请求路径验证,避免把“页面可配置”误写成“运行时已接管”。
199
-
200
- ## 发布
201
-
202
- 项目只发布一个跨平台 npm 包,不分别生成 macOS、Linux 或 Windows 安装包。推送与 `package.json` 版本一致的 Git 标签后,GitHub Actions 会:
154
+ When opening a pull request, explain the scenario, configuration or filtering impact, validation commands, and include before/after screenshots for UI changes.
203
155
 
204
- 1. 在 macOS、Ubuntu 和 Windows 上检查同一份安装器与运行时源码;
205
- 2. 在 Ubuntu 上只构建一次前端静态资源;
206
- 3. 确认构建产物与仓库内容一致;
207
- 4. 通过 npm Trusted Publishing(OIDC)发布到 npmjs.com。
156
+ ## Releases
208
157
 
209
- 发布工作流不使用长期 npm Access Token。npm 包需要将 `.github/workflows/publish.yml` 配置为可信发布者。
158
+ The project publishes one cross-platform npm package. Pushing a Git tag matching the `package.json` version triggers GitHub Actions to validate macOS, Ubuntu, and Windows, build the frontend once, verify committed static assets, and publish to npm through Trusted Publishing (OIDC).
210
159
 
211
- ## 安全边界
160
+ ## Security boundaries
212
161
 
213
- - Web 服务只绑定本机回环地址;
214
- - 不读取或展示 Git AI API key 等敏感字段;
215
- - 原始上报端点不会写入项目源码,只保存在权限为 `0600` 的本机配置中;
216
- - 配置保存采用临时文件替换,避免写入中断产生不完整文件;
217
- - 页面没有跨域权限,拒绝非本页面来源的修改请求;
218
- - 插件配置缺失或损坏时,GitHub 默认策略保持全部阻断;
219
- - 官方版缺少细粒度过滤扩展点时,页面会显示“仅原生配置兼容”,不会把空闲代理误报为已接管。
162
+ - The web service binds only to loopback.
163
+ - Git AI API keys and other sensitive fields are not read or shown.
164
+ - Original reporting endpoints are never committed to source; they are stored only in a local user configuration with `0600` permissions.
165
+ - Saves use temporary-file replacement to avoid partial configuration writes.
166
+ - The page rejects modification requests from non-page origins.
167
+ - If plugin configuration is missing or invalid, the default GitHub policy remains fully blocking.
168
+ - Without the granular filtering extension point, the page reports native-settings compatibility instead of claiming filtering is active.
@@ -0,0 +1,170 @@
1
+ # Git AI 配置中心
2
+
3
+ [English documentation](README.md)
4
+
5
+ 公司统一安装了 Git AI,但不想让私人 GitHub 项目的仓库名、路径、分支或 Skill 使用情况被上报?可以试试 Git AI 配置中心。
6
+
7
+ 它是一个支持 macOS、Linux 和 Windows 的 Git AI 本地配置与上传策略管理页面:不用手改 JSON,也不用为每条隐私规则编写脚本,就能按仓库主机控制允许上传的数据类型和字段。前端使用 React、Vite 与 shadcn/ui,Web 服务只监听 `127.0.0.1:38742`,不会向局域网或公网开放。
8
+
9
+ > [!IMPORTANT]
10
+ > 项目可以识别 `custom_metrics` 定制版和官方 [`git-ai-project/git-ai`](https://github.com/git-ai-project/git-ai),但两者支持层级不同。仓库级事件开关、字段脱敏和 Skill 过滤目前需要 `custom_metrics` 扩展点;官方版只能管理 Git AI 已公开的原生配置。安装前请阅读[兼容性说明](COMPATIBILITY.md)。
11
+
12
+ ## 功能
13
+
14
+ - 可视化管理 Git AI 自动更新、版本检查、仓库排除和提示词排除;
15
+ - 通过“匹配仓库主机”统一处理 GitHub、GitLab、Gitee 或其他 Git 服务;
16
+ - 分别控制 Token、Skills、Commit、Checkpoint、Agent、提示耗时和提示报告;
17
+ - 可删除仓库信息、项目路径和分支名称等敏感字段;
18
+ - 可将允许上传的 Skill 项目目录替换为固定目录;
19
+ - 可按关键词或正则拦截指定 Skill;
20
+ - 仓库插件可按不同主机添加多个,并支持全局兜底、仓库、目录、分支与优先级;
21
+ - 敏感内容脱敏插件可识别 API Key、私钥、凭据,并按规则脱敏或拦截;
22
+ - Agent / 模型治理插件支持允许名单、阻止正则及审计/拦截模式;
23
+ - 可查看最近 24 小时的本机拦截记录,且不保存上报正文;
24
+ - 展示 Git AI 与过滤服务的状态、版本和更新时间。
25
+
26
+ ## 界面截图
27
+
28
+ ### Git AI 原生设置
29
+
30
+ ![Git AI 原生设置页面](docs/images/git-ai-settings.jpg)
31
+
32
+ ### 插件管理
33
+
34
+ ![仓库插件与 Skill 过滤插件管理页面](docs/images/plugin-management.jpg)
35
+
36
+ ## 快速开始
37
+
38
+ ### 1. 一条命令启动
39
+
40
+ 支持 macOS、Linux 和 Windows,需要 Node.js 18+、Python 3,并要求 Git AI 已安装在默认目录:
41
+
42
+ ```text
43
+ macOS / Linux: ~/.git-ai/bin/git-ai
44
+ Windows: %USERPROFILE%\.git-ai\bin\git-ai.exe
45
+ ```
46
+
47
+ 确认文件存在后运行:
48
+
49
+ ```bash
50
+ npx git-ai-control
51
+ ```
52
+
53
+ 首次运行时,该命令会自动下载最新版本、安装本机服务,并打开 Git AI 配置中心;之后检测到已运行的配置中心时,会直接复用现有进程。若浏览器没有自动打开,可手动访问:
54
+
55
+ ```text
56
+ http://127.0.0.1:38742
57
+ ```
58
+
59
+ 首次安装过程会识别 `custom_metrics` 扩展、备份当前用户的原始上报端点、保留已有的 `config.json` 与 `filter_plugins.json`、安装控制页面和过滤运行时,并等待两个本机服务通过健康检查。
60
+
61
+ | 系统 | 服务管理器 | 使用条件 |
62
+ | --- | --- | --- |
63
+ | macOS | LaunchAgent | 当前图形用户会话 |
64
+ | Linux | systemd user | 可用的 systemd 用户会话 |
65
+ | Windows | 任务计划程序 | 当前用户可创建登录任务 |
66
+
67
+ ### 2. 配置仓库插件
68
+
69
+ 以“GitHub 私人仓库只允许上传 Token”为例:
70
+
71
+ 1. 在“仓库插件”中添加或打开现有仓库插件;
72
+ 2. 在“匹配仓库主机”中填写 `github.com`;
73
+ 3. 只打开 `Token`,关闭 `Skills`、`Commit`、`Checkpoint`、`Agent`、提示耗时和提示报告;
74
+ 4. 关闭“仓库信息”“项目路径”和“分支名称”;
75
+ 5. 保存配置。
76
+
77
+ 仓库策略会先匹配特定规则,再匹配“全部仓库”全局规则;特定规则之间优先级数字越大越靠前,同优先级按插件列表顺序处理。仓库、目录、分支同时填写时需要全部命中。
78
+
79
+ ### 3. 配置敏感内容与 Agent
80
+
81
+ 在“插件管理”中可分别添加以下独立插件:
82
+
83
+ 1. “敏感内容脱敏”:选择作用事件、内置规则和自定义正则;命中后可脱敏或阻止上报;
84
+ 2. “Agent / 模型治理”:配置允许的 Agent、模型与阻止正则;先使用“仅审计”确认命中情况,再按需改为阻止。
85
+
86
+ ### 4. 配置 Skill 过滤插件
87
+
88
+ 1. 添加“Skill 过滤插件”;
89
+ 2. 打开插件;
90
+ 3. 每行填写一个关键词或正则;
91
+ 4. 保存配置。
92
+
93
+ ### 5. 验证配置
94
+
95
+ 点击页面中的“验证配置”,或在终端检查两个本机服务:
96
+
97
+ ```bash
98
+ curl -fsS http://127.0.0.1:38742/api/status
99
+ curl -fsS http://127.0.0.1:38741/health
100
+ ```
101
+
102
+ ## 工作方式
103
+
104
+ 本项目不会修改 `~/.git-ai/bin/git-ai` 二进制。检测到 `custom_metrics` 扩展点后,安装脚本会将 Git AI 的自定义上报端点指向本机过滤服务:
105
+
106
+ ```text
107
+ Git AI
108
+ -> ~/.git-ai/custom_metrics.json
109
+ -> http://127.0.0.1:38741
110
+ -> 读取 ~/.git-ai/filter_plugins.json
111
+ -> 读取 ~/.git-ai/upstream_metrics.json
112
+ -> 拦截,或脱敏后转发至原上报服务
113
+ ```
114
+
115
+ 控制页面保存时只更新:
116
+
117
+ - `~/.git-ai/config.json`:Git AI 原生设置;
118
+ - `~/.git-ai/filter_plugins.json`:仓库和 Skill 过滤插件策略。
119
+
120
+ 过滤逻辑来自仓库中的 `plugins/upload-filter/plugin_filter_runtime.py`。控制页面不会动态生成或改写 Python 脚本,`~/.git-ai` 只保存安装副本和用户配置。
121
+
122
+ ## 文件位置
123
+
124
+ | 内容 | 位置 |
125
+ | --- | --- |
126
+ | 过滤运行时源码 | `plugins/upload-filter/plugin_filter_runtime.py` |
127
+ | 跨平台安装器 | `scripts/install.mjs`、`scripts/uninstall.mjs` |
128
+ | 服务适配器 | `scripts/platform-services.mjs` |
129
+ | Git AI 原生配置 | `~/.git-ai/config.json` |
130
+ | 插件策略 | `~/.git-ai/filter_plugins.json` |
131
+ | 原上报端点本机备份 | `~/.git-ai/upstream_metrics.json` |
132
+ | 过滤运行时安装副本 | `~/.git-ai/filters/plugin_filter_runtime.py` |
133
+ | Web 服务安装副本 | `~/.git-ai/control-panel` |
134
+
135
+ ## 卸载
136
+
137
+ ```bash
138
+ npx git-ai-control uninstall
139
+ ```
140
+
141
+ 卸载命令会停止两个服务、删除本项目安装的程序副本,并将上报端点恢复为 Git AI 原地址。`config.json`、`filter_plugins.json` 和日志会保留。
142
+
143
+ ## 参与贡献
144
+
145
+ 欢迎提交 Issue 和 Pull Request,尤其欢迎补充不同 Git AI 版本的兼容性验证、新增独立插件、改进测试覆盖、文档、交互和无障碍能力。
146
+
147
+ ```bash
148
+ cd frontend/git-ai-control-panel
149
+ npm ci
150
+ npm run lint
151
+ npm run build
152
+ cd ../..
153
+ npm run check
154
+ ```
155
+
156
+ 提交 Pull Request 时请说明使用场景、对配置结构或过滤行为的影响、已执行的验证命令;涉及界面变化时请附前后截图。
157
+
158
+ ## 发布
159
+
160
+ 项目只发布一个跨平台 npm 包。推送与 `package.json` 版本一致的 Git 标签后,GitHub Actions 会在 macOS、Ubuntu 和 Windows 上验证安装器与运行时源码,在 Ubuntu 构建一次前端,校验静态资源,并通过 npm Trusted Publishing(OIDC)发布。
161
+
162
+ ## 安全边界
163
+
164
+ - Web 服务只绑定本机回环地址;
165
+ - 不读取或展示 Git AI API key 等敏感字段;
166
+ - 原始上报端点不会写入项目源码,只保存在权限为 `0600` 的本机配置中;
167
+ - 配置保存采用临时文件替换,避免写入中断产生不完整文件;
168
+ - 页面拒绝非本页面来源的修改请求;
169
+ - 插件配置缺失或损坏时,GitHub 默认策略保持全部阻断;
170
+ - 官方版缺少细粒度过滤扩展点时,页面会显示“仅原生配置兼容”,不会把空闲代理误报为已接管。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-ai-control",
3
- "version": "0.4.9",
3
+ "version": "0.4.12",
4
4
  "description": "Git AI 本地配置与上传隐私控制面板",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,6 +15,7 @@
15
15
  "CHANGELOG.md",
16
16
  "COMPATIBILITY.md",
17
17
  "README.md",
18
+ "README.zh-CN.md",
18
19
  "policy.example.json",
19
20
  "server.py"
20
21
  ],
package/server.py CHANGED
@@ -522,6 +522,18 @@ def git_ai_version() -> str:
522
522
  return "unknown"
523
523
 
524
524
 
525
+ def git_ai_updated_at() -> str:
526
+ try:
527
+ timestamp = git_ai_binary_path().stat().st_mtime
528
+ return (
529
+ datetime.fromtimestamp(timestamp, timezone.utc)
530
+ .isoformat()
531
+ .replace("+00:00", "Z")
532
+ )
533
+ except OSError:
534
+ return ""
535
+
536
+
525
537
  @lru_cache(maxsize=1)
526
538
  def custom_metrics_supported() -> bool:
527
539
  binary = git_ai_binary_path()
@@ -584,6 +596,7 @@ def runtime_status() -> dict:
584
596
  "service": service,
585
597
  "platform": platform.system().lower(),
586
598
  "gitAiVersion": git_ai_version(),
599
+ "gitAiUpdatedAt": git_ai_updated_at(),
587
600
  "paths": {
588
601
  "nativeConfig": str(NATIVE_CONFIG_PATH),
589
602
  "policyConfig": str(POLICY_CONFIG_PATH),