Skip to content

Commit be4281c

Browse files
committed
docs: 全面修正过时文档与 README SEO 优化
CLAUDE.md: - Asset Synchronization 强化:AI 工作流改动检查 prompts,UI 变化 必须更新使用文档,不再列举具体文档名让 AI 自行查找 - ABI 描述改为按 flavor 拆分,Keystore 描述修正为从 properties 读 - build/test 命令标注耗时与 flavor 聚合问题 - commit scope 补 docs、build,迁移文件示例改为实际文件名 - Architecture 补 core 模块与远程 SSH 执行链路 app-settings-guide.md: - 标题栏补 SSH 连接状态指示与远程连接占位提示 - 新增侧边栏章节(长按会话弹出重命名/删除菜单) - 工具栏补斜杠命令 /status 与 /compress - 容器镜像条目修正为列表单选切换 profile git-page.md: - 新建分支入口改为点击分组标题 + 按钮(非长按) - 补重命名分支、新建标签、删除标签操作 - 长按操作菜单描述统一(切换/重命名/删除) README.md: - 补远程 SSH 模式、BouncyCastle、自定义提示词等遗漏功能 - 修正 assembleDebug 为 assembleUniversalDebug - 补 core 子目录细节与各 feature 模块描述 - SEO: 补中英文项目简介、丰富关键词、改善截图 alt、增加 release/downloads badge proguard-rules.pro: - 补 BouncyCastle keep 规则,防 R8 混淆导致 release 下 BKS not found
1 parent 821f485 commit be4281c

5 files changed

Lines changed: 96 additions & 60 deletions

File tree

CLAUDE.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
99
## Asset Synchronization
1010
项目中的 `app/src/main/assets/prompts/``app/src/main/assets/docs/` 是 AI Agent 的核心知识来源,必须与代码保持同步:
1111

12-
- **工具变更 → 同步 prompts**:当 `app/src/main/java/com/aicode/feature/agent/domain/tool/` 下的工具新增、删除、重命名或参数签名变化时,必须同步更新 `app/src/main/assets/prompts/60-tools-and-paths.md` 中的工具描述,确保模型看到的工具定义与实际注册一致。
13-
- **设置功能变更 → 同步 docs**:当 `app/src/main/java/com/aicode/feature/settings/` 下的设置项新增、删除或行为变化时,必须同步更新 `app/src/main/assets/docs/` 下对应的文档文件:
14-
- AI 服务商与模型配置变更 → `providers-and-models.md`
15-
- MCP 服务器与扩展技能配置变更 → `mcp-and-skills.md`
16-
- 日志、私有目录与保活设置变更 → `logs-and-private-dir.md`
17-
- 远程服务器与同步设置变更 → `remote-servers.md`
18-
- 工作区与模式配置变更 → `app-settings-guide.md`
12+
- **AI 工作流相关改动 → 检查 prompts**:任何与 AI 工作流相关的改动(工具新增/删除/重命名/参数签名变化、agent 行为变化、提示词逻辑调整等),都必须检查 `app/src/main/assets/prompts/` 下的提示词是否需要同步更新,确保模型看到的工具定义与行为说明与实际一致。AI 应自行在 `prompts/` 目录中查找对应的提示词文件;若不存在则新建。
13+
- **功能、工具变化 → 检查 docs**:任何功能新增/删除/行为变化或工具变更,还要检查 `app/src/main/assets/docs/` 下是否有对应使用文档需要更新(如新功能的使用说明、工具行为变化的提示)。
14+
- **UI 变化 → 必须更新对应使用文档**:任何 UI 变化(新增页面、改交互、调布局、改文案)**必须**同步更新 `app/src/main/assets/docs/` 下对应的使用文档,确保用户可见的说明与实际界面一致。AI 应自行在 `docs/` 目录中查找对应的文档;若不存在则新建。
1915

2016
## Git 提交规范
2117

@@ -28,7 +24,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
2824
```
2925

3026
- **type**`feat | fix | refactor | docs | style | chore | ci | build | perf | test`
31-
- **scope** 可选,建议用功能模块:`agent | settings | terminal | workspace | git | ui | mcp | db | core | deps`
27+
- **scope** 可选,建议用功能模块:`agent | settings | terminal | workspace | git | ui | mcp | db | core | docs | build | deps`
3228
- **subject** 一行简述,中英文均可,句末不加句号。
3329
- 跳过校验(仅紧急):`git commit --no-verify ...`
3430

@@ -83,19 +79,17 @@ RC 与正式版共享同一 `versionName`,`versionCode` 由 commit count 自
8379

8480
This is an Android application built with Kotlin, Jetpack Compose, and Hilt. It uses Gradle as the build system.
8581

86-
- **Build the project:** `./gradlew build`
87-
- **Assemble Debug APK:** `./gradlew assembleDebug`
82+
- **Build the project:** `./gradlew build` —— 完整构建,含三 flavor 全量编译 + lint + 测试,耗时极长,日常开发不用。
8883
- **单 flavor 冒烟(AI 改完代码默认跑这个):** `./gradlew :app:assembleUniversalDebug` —— `assembleDebug`/`assembleRelease` 是 flavor 聚合任务,会把 universal/armsolo/x86solo 三个 APK 各构一遍(三倍 Kotlin 编译 + 资源处理,慢)。AI 改完**编译型代码**`.kt` / `.gradle.kts` / `AndroidManifest.xml`)后、提交前,默认只构 **universal debug** 单个 APK 做冒烟验证,不要触发全量三 flavor。仅改文档/资源/纯 `.md` 时可跳过。完整发版才用 `assembleRelease` 构三个。
8984
- **Assemble Release APK:** `./gradlew assembleRelease` —— 按容器镜像/CPU 拆三个 flavor,输出到 `app/build/outputs/apk/<flavor>/release/app-<flavor>-release.apk`(flavor ∈ universal/armsolo/x86solo)
9085
- **Assemble Release AAB:** `./gradlew bundleRelease` —— 输出到 `app/build/outputs/bundle/<flavor>/release/app-<flavor>-release.aab`
91-
- **Run Unit Tests:** `./gradlew test`
92-
- **Run Android Tests:** `./gradlew connectedAndroidTest`
86+
- **Run Unit Tests:** `./gradlew test` —— 跨 flavor 聚合测试任务,日常用 `./gradlew :app:testUniversalDebugUnitTest` 单 flavor 即可。
9387

9488
### Release Packaging & Signing
9589
The release signing configuration is automatically handled in `app/build.gradle.kts`:
96-
- **Keystore File:** `app/aicode.jks`
97-
- **Credentials:** Loaded from `app/keystore.properties` (`storePassword`, `keyAlias`, `keyPassword`).
98-
- **Target ABI:** Only `arm64-v8a` is packaged to keep APK size reasonable while supporting Termux/PRoot rootfs.
90+
- **Keystore File:** 路径由 `app/keystore.properties``storeFile` 字段指定(文件名不固定为 `aicode.jks`)。本地通常不存放签名文件,CI 从 GitHub secret 还原到 `app/aicode.jks`
91+
- **Credentials:** Loaded from `app/keystore.properties` (`storeFile`, `storePassword`, `keyAlias`, `keyPassword`)
92+
- **Target ABI:** 按 flavor 拆分:`universal``arm64-v8a` + `x86_64``armsolo``arm64-v8a``x86solo``x86_64`
9993

10094
*Note: The project locks `targetSdk = 28` intentionally to allow PRoot execution (W^X policy bypass on Android 10+).*
10195

@@ -106,12 +100,14 @@ The application is structured using a feature-based architecture with Domain-Dri
106100
### Key Components
107101

108102
- **App Core:** `AIEditorApp` initializes core services like `FileLogger`, `TerminalKeepaliveService`, and `McpManager`.
103+
- **Core Module:** `app/src/main/java/com/aicode/core/` hosts cross-feature infrastructure: `FileLogger`, `db/MigrationLoader.kt`, etc.
109104
- **Feature Modules:** Code is organized by feature under `app/src/main/java/com/aicode/feature/`:
110105
- `agent`: The core AI agent system. Includes prompt management, MCP (Model Context Protocol) integration, tool registry (file tools, shell execution, etc.), permission handling, and adapters for different AI providers (Anthropic, OpenAI).
111106
- `git`: Git integration and operations.
112107
- `settings`: Application configuration, including AI provider setup, logging, and keepalive settings.
113-
- `terminal`: Terminal emulation and session management, leveraging Termux components (`terminal-emulator`, `terminal-view`) and PRoot via `LinuxContainerEngine`.
114-
- `workspace`: Workspace and document provider management.
108+
- `terminal`: Terminal emulation and session management. Local mode leverages Termux components (`terminal-emulator`, `terminal-view`) and PRoot via `LinuxContainerEngine`; remote SSH mode uses sshj (`SshShellBackend`, `RemoteTerminalSessionManager`).
109+
- `workspace`: Workspace and document provider management. Remote SSH file access via `RemoteSftpFileAccess`.
110+
- **Remote SSH Link:** `RemoteSshConnection`(共享 sshj `SSHClient`)+ `RemoteSshEngine`(exec channel 执行命令)+ `RemoteSftpFileAccess`(文件操作)+ `RemoteTerminalSessionManager`(终端会话),构成远程模式下的执行链路。
115111

116112
### Database
117113

@@ -121,7 +117,7 @@ The app uses Room for local database storage, primarily found in `feature/agent/
121117
We use a custom, lightweight file-based migration system (`MigrationLoader.kt`).
122118
To update the database schema:
123119
1. Increment the database version in `AgentDatabase.kt`.
124-
2. Create a new SQL file in `app/src/main/assets/migrations/` named `{VERSION}_description.sql` (e.g., `8_add_new_table.sql`).
120+
2. Create a new SQL file in `app/src/main/assets/migrations/` named `{VERSION}_description.sql` (e.g., `8_add_remote_servers.sql``26_add_session_last_input_tokens.sql`).
125121
3. Add the necessary DDL/SQL statements to this file. The system will automatically execute it on startup and record it in the `migration_history` table.
126122

127123
### AI Agent & Tools

README.md

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
<p align="center">
22
<h1 align="center">AiCode</h1>
33
<p align="center">
4-
Android 设备上运行的 AI 编程工具
4+
Android AI 编程工具 · 内置 Linux 终端 · AI Agent · MCP 协议 · Git 集成
55
<br />
6-
内置终端 · AI Agent · MCP 协议
6+
<em>An AI-powered coding assistant for Android with built-in Linux terminal, agent tools, and MCP support.</em>
77
</p>
88
</p>
99

1010
<p align="center">
11-
<a href="LICENSE"><img src="https://img.shields.io/badge/License-GPL--3.0-blue.svg" alt="License" /></a>
12-
<img src="https://img.shields.io/badge/Platform-Android-green.svg" alt="Platform" />
13-
<img src="https://img.shields.io/badge/Language-Kotlin-purple.svg" alt="Language" />
14-
<img src="https://img.shields.io/badge/UI-Jetpack%20Compose-4285F4.svg" alt="UI" />
15-
<img src="https://img.shields.io/badge/MinSDK-26-orange.svg" alt="MinSDK" />
11+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-GPL--3.0-blue.svg" alt="License GPL-3.0" /></a>
12+
<img src="https://img.shields.io/badge/Platform-Android-green.svg" alt="Android Platform" />
13+
<img src="https://img.shields.io/badge/Language-Kotlin-purple.svg" alt="Kotlin" />
14+
<img src="https://img.shields.io/badge/UI-Jetpack%20Compose-4285F4.svg" alt="Jetpack Compose UI" />
15+
<img src="https://img.shields.io/badge/MinSDK-26-orange.svg" alt="Min SDK 26 (Android 8.0)" />
16+
<a href="https://github.com/jieapi/aicode/releases/latest"><img src="https://img.shields.io/github/v/release/jieapi/aicode?display_name=tag&include_prereleases" alt="Latest Release" /></a>
17+
<a href="https://github.com/jieapi/aicode/releases"><img src="https://img.shields.io/github/downloads/jieapi/aicode/total" alt="Total Downloads" /></a>
1618
</p>
1719

1820
<p align="center">
1921
<table>
2022
<tr>
21-
<td align="center"><img src="docs/screenshots/home.png" alt="主页 · AI 对话" width="270"/></td>
22-
<td align="center"><img src="docs/screenshots/terminal.png" alt="终端 · Alpine Linux" width="270"/></td>
23+
<td align="center"><img src="docs/screenshots/home.png" alt="AiCode 主页 - AI 对话界面,支持代码生成与 Markdown 渲染" width="270"/></td>
24+
<td align="center"><img src="docs/screenshots/terminal.png" alt="AiCode 终端 - 内置 Alpine Linux 容器,完整命令行环境" width="270"/></td>
2325
</tr>
2426
<tr>
2527
<td align="center">主页 · AI 对话</td>
@@ -30,14 +32,22 @@
3032

3133
---
3234

35+
## 简介
36+
37+
AiCode 是一款在 Android 手机上运行的 AI 编程工具(Android IDE / mobile coding assistant),将大语言模型与本地 Linux 开发环境深度集成。它内置 Alpine Linux 容器和终端模拟器,让 AI 能直接读写文件、执行 Shell 命令、运行构建工具;同时支持远程 SSH 服务器作为执行后端,把手机变成远程项目的移动工作站。
38+
39+
**English**: AiCode is an AI-powered coding assistant that runs natively on Android. It integrates LLMs with a built-in Linux terminal (PRoot + Alpine) and a tool-calling agent system — the AI can read/write files, execute shell commands, and manage Git, all from your phone. It also supports remote SSH servers as the execution backend, turning your phone into a mobile workstation for remote projects.
40+
3341
## Features
3442

35-
- **AI Agent** — 支持 Anthropic、OpenAI 等多家提供商,通过工具系统(文件操作、Shell 执行等)与开发环境深度交互
36-
- **内置终端** — 基于 Termux 组件 + PRoot Alpine Linux 容器,提供完整 Linux 命令行环境
37-
- **MCP 协议** — Model Context Protocol 客户端,连接远程 MCP 服务器动态扩展工具能力
38-
- **Git 集成** — 内置 Git 操作
39-
- **远程同步** — 支持 SFTP / FTP 工作区同步
40-
- **Markdown 渲染** — AI 对话中实时渲染 Markdown 内容
43+
- **AI Agent** — 支持 Anthropic(Claude)、OpenAI(GPT)、Gemini 等多家提供商,通过工具系统(文件操作、Shell 执行、终端管理、网页搜索等)与开发环境深度交互;支持流式输出、上下文压缩、多会话管理
44+
- **内置终端** — 基于 Termux 组件 + PRoot Alpine Linux 容器,提供完整 Linux 命令行环境,支持后台常驻、多标签管理
45+
- **远程 SSH 模式** — 连接远程 SSH 服务器作为执行后端,命令走 exec channel、文件读写走 SFTP、终端走 shell channel,支持自动重连与状态指示
46+
- **MCP 协议** — Model Context Protocol 客户端,连接本地(stdio)或远程(HTTP)MCP 服务器动态扩展工具能力
47+
- **Git 集成** — 内置可视化 Git 操作(状态/分支/提交/标签管理),支持长按操作菜单
48+
- **远程同步** — 支持 SFTP / FTP 工作区同步,内置 FTP 服务器方便电脑端管理
49+
- **Markdown 渲染** — AI 对话中实时渲染 Markdown,支持代码高亮
50+
- **自定义提示词** — 系统提示词支持用户自定义覆盖,App 升级不丢失
4151

4252
## Tech Stack
4353

@@ -51,20 +61,22 @@
5161
| Async | Kotlin Coroutines / Flow |
5262
| Terminal | Termux terminal-emulator + terminal-view |
5363
| Container | PRoot + Alpine Linux rootfs |
54-
| Remote Sync | SSHJ (SFTP) + Commons Net (FTP) |
64+
| Remote SSH | SSHJ (exec channel + SFTP + shell channel) |
65+
| Crypto | BouncyCastle (bcprov-jdk18on,sshj X25519 密钥交换依赖) |
66+
| FTP | Commons Net |
5567

5668
## Getting Started
5769

5870
### Prerequisites
5971

60-
- Android 8.0+ (API 26) arm64-v8a 设备
72+
- Android 8.0+ (API 26) arm64-v8a 或 x86_64 设备
6173
- JDK 17
6274

6375
### Build
6476

6577
```bash
66-
# Debug(默认走 universal 变体
67-
./gradlew assembleDebug
78+
# 单 flavor 冒烟(日常开发推荐,只构 universal debug 一个 APK
79+
./gradlew :app:assembleUniversalDebug
6880

6981
# Release(需配置签名;构全部三个 flavor)
7082
./gradlew assembleRelease
@@ -97,21 +109,21 @@ keyPassword=your_key_password
97109
### Test
98110

99111
```bash
100-
./gradlew test # 单元测试
101-
./gradlew connectedAndroidTest # 集成测试
112+
./gradlew :app:testUniversalDebugUnitTest # 单 flavor 单元测试(日常推荐)
113+
./gradlew test # 全 flavor 单元测试
102114
```
103115

104116
## Project Structure
105117

106118
```
107119
app/src/main/java/com/aicode/
108-
├── core/ # 核心模块(主题、通用组件)
120+
├── core/ # 核心基础设施(FileLogger、db/MigrationLoader、主题、通用组件)
109121
├── feature/
110-
│ ├── agent/ # AI Agent(提示词、MCP、工具注册、多提供商适配)
111-
│ ├── git/ # Git 集成
112-
│ ├── settings/ # 应用设置
113-
│ ├── terminal/ # 终端模拟与会话管理
114-
│ └── workspace/ # 工作区与文档管理
122+
│ ├── agent/ # AI Agent(提示词、MCP、工具注册、多提供商适配、斜杠命令
123+
│ ├── git/ # Git 集成(状态/分支/提交/标签)
124+
│ ├── settings/ # 应用设置(提供商、容器、MCP、远程、日志等)
125+
│ ├── terminal/ # 终端模拟与会话管理(本地 Termux + 远程 SSH)
126+
│ └── workspace/ # 工作区与文档管理(本地 + 远程 SFTP/FTP)
115127
├── AIEditorApp.kt # Application 入口
116128
└── MainActivity.kt # 主 Activity
117129
```

app/proguard-rules.pro

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@
2323
-dontwarn org.bouncycastle.**
2424
-dontwarn org.openjsse.**
2525

26+
# ---- BouncyCastle (bcprov-jdk18on) ----
27+
# AIEditorApp.registerBouncyCastle() 在启动时注册完整版 BC 取代 Android 裁剪版,供 sshj 做 X25519 密钥交换。
28+
# JCE 框架通过反射按类名加载 Provider 注册的各算法 SPI(KeyStore/Cipher/Signature/AlgorithmParameters 等),
29+
# 类名一旦被 R8 混淆,BouncyCastleProvider 注册的 BKS KeyStore 等类型实例化失败,
30+
# 表现为 release 下 HTTPS 请求抛 KeyStoreException: BKS not found(debug 不开 R8 故正常)。
31+
# 故保留整个 BC provider 包及其内部 *Mappings(BouncyCastleProvider 靠反射加载这些注册类)。
32+
-keep class org.bouncycastle.jce.provider.** { *; }
33+
-keep class org.bouncycastle.jce.provider.BouncyCastleProvider
34+
-keepclassmembers class org.bouncycastle.jce.provider.BouncyCastleProvider {
35+
<init>();
36+
}
37+
2638
# ---- Gson(Retrofit converter + AILogger 用 GsonBuilder 反射序列化)----
2739
# Retrofit/Gson 通过反射读写 data class 字段,类名与字段名不可混淆/裁剪。
2840
#

0 commit comments

Comments
 (0)