Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)。

## [0.0.32] — 2026-11-25

### 修复

- **移除旧工具链残留说明**:删除 `app/src/main/assets/README.txt`。该文件仍在教用户下载 441MB 的 `usrtar.zip`,属于已废弃的 Termux 方案;当前运行时是原生 CPython + JGit,继续随 APK 分发会误导用户以为安装包漏文件。
- **标准库瘦身**:`scripts/package_native.sh` 打包时剔除 `test`、`idlelib`、`turtledemo` 三个目录,共 1,740 个文件、约 7.1MB 压缩体积;`python-stdlib.zip` 从 11.43MB 降到 4.32MB。运行时模块、`ensurepip` 与 53 个 C 扩展均未改动。
- **修正 Git 能力表述**:官网与文档不再写“完整 Git 能力”,改为实际支持的 init / commit / push / pull;clone 尚未实现,避免过度承诺。
- **修正官网链接**:README 的 Website 链接从 `x33834.github.io` 改为实际部署的 `badhope.github.io`。

### 构建

- `versionCode 32` / `versionName 0.0.32`。
- release APK **24,284,004 B**,SHA-256 `4dd471de80afd7fcd11f4e40a086e408788e31293c1f0d5835c3c0f40e44697d`;debug APK **43,360,958 B**,SHA-256 `46403e44938788b397400748e9907fd0ee754c62180060babe3d29ce02a124df`。
- `python-stdlib.zip` 从 11.43MB 降到 4.32MB,APK 解压内容 55.6MB / 1,138 文件。
- JVM 单测 **137 通过**,lintRelease **0 Error / 37 Warning**;两个包均通过签名与 `versionCode=32` 校验。

## [0.0.31] — 2026-11-25

### 修复
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Three runtimes are bundled inside the APK: a natively cross-compiled CPython 3.1
[![Runtime](https://img.shields.io/badge/Runtime-100%25%20bundled-orange?style=flat-square)]()
[![Ads](https://img.shields.io/badge/Ads-0-red?style=flat-square)]()

**[Download APK](https://gitcode.com/badhope/CodePocket/releases)** · **[Website](https://x33834.github.io/CodePocket/)** · **[Gitee Mirror](https://gitee.com/badhope/CodePocket)**
**[Download APK](https://gitcode.com/badhope/CodePocket/releases)** · **[Website](https://badhope.github.io/CodePocket/)** · **[Gitee Mirror](https://gitee.com/badhope/CodePocket)**

> Keep your IDE in your pocket — code offline, anywhere.

Expand Down Expand Up @@ -94,7 +94,7 @@ Three runtimes are bundled inside the APK: a natively cross-compiled CPython 3.1
- **6 editor themes** (Darcula / Monokai / Tomorrow Night Blue / Solarized…)

### Run code
- **Python**: native CPython 3.13 (arm64 + x86_64), full stdlib (pure-Python part + C extensions)
- **Python**: native CPython 3.13 (arm64 + x86_64), standard library (test/idlelib/turtledemo trimmed) + C extensions
- **JavaScript**: Rhino 1.7.15, pure Java, `console.log` / `input`
- **Lua**: LuaJ 3.0.1, pure Java, `print` / `input`
- **Streaming output** · **`input()` interaction** · arrow-key / Tab soft keyboard
Expand All @@ -107,6 +107,11 @@ Three runtimes are bundled inside the APK: a natively cross-compiled CPython 3.1
- **Python pdb debugger**: real stdlib `pdb`; breakpoints, next/step/continue, `p locals()`, stack, quit; quick-action bar in output panel
- **Offline by design**: no language server process, no model download, hard caps at 300 `.py` files / 512KB per file

### Packaging cleanup (0.0.32)
- **Stale toolchain note removed**: the 441MB `usrtar.zip` instructions are gone; the app uses the bundled native CPython runtime and JGit, not the retired Termux bundle
- **Stdlib slimmed**: CPython `test`, `idlelib` and `turtledemo` are excluded from `python-stdlib.zip`; 1740 files / 7.1MB removed, all runtime modules and 53 C extensions untouched
- **Git wording fixed**: docs and site now say init / commit / push / pull (no clone) instead of "full Git capability"

### Data safety & lifecycle (0.0.31)
- **No silent data loss**: with auto-save off, switching files/tabs/projects now asks Save / Discard / Cancel instead of overwriting the dirty buffer
- **Atomic saves**: temp file + `fsync` + `rename` for editor files, workspace writes and Agent checkpoints; a crash leaves the old version, not half a file
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ android {
applicationId = "com.devterminal"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
versionCode = 31
versionName = "0.0.31"
versionCode = 32
versionName = "0.0.32"
vectorDrawables { useSupportLibrary = true }
// 原生 CPython 引擎:同时打 arm64 与 x86_64(后者用于模拟器/ChromeOS)
ndk { abiFilters += listOf("arm64-v8a", "x86_64") }
Expand Down
45 changes: 0 additions & 45 deletions app/src/main/assets/README.txt

This file was deleted.

Binary file modified app/src/main/assets/python-stdlib.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ sink(AtomicReference) —— C 回调 → Flow 的事件出口

## 5. 标准库与 C 扩展的打包

- **纯 Python 标准库**:`assets/python-stdlib.zip`(约 60MB,`noCompress` 保证 AAPT 不压缩),首次运行解压到 `files/python-stdlib`,校验标记 `.unpacked_ok`;
- **纯 Python 标准库**:`assets/python-stdlib.zip`(约 12.5MB 未压缩内容 / 4.32MB 打包体积,`noCompress` 保证 AAPT 不压缩;已剔除 test/idlelib/turtledemo),首次运行解压到 `files/python-stdlib`,校验标记 `.unpacked_ok`;
- **C 扩展**:`jniLibs/arm64-v8a/` 与 `jniLibs/x86_64/` 下的 `*.so`(math、_json、_socket、_ssl、_sqlite3、_ctypes 等),APK 安装后落在 `nativeLibraryDir`,`initialize` 时插入 `sys.path`;
- **依赖库**:`libssl_python.so` / `libcrypto_python.so` / `libsqlite3_python.so` 一并打包;
- 重新打包/重编脚本:`scripts/package_native.sh`(需 NDK 27.3 + CPython 3.13 交叉编译环境)。
Expand Down
4 changes: 2 additions & 2 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

## 安装与运行

**Q:APK 为什么这么大(约 31MB / debug 49MB)?**
A:内置了完整的 CPython 3.13 原生运行时(`libpython3.13.so`)+ 标准库(纯 Python + C 扩展),同时打了 arm64-v8a 与 x86_64。装完即离线,之后不需要下载任何东西。本地模型权重按需下载,不打包进 APK。
**Q:APK 为什么这么大(约 24MB / debug 43MB)?**
A:内置了 CPython 3.13 原生运行时(`libpython3.13.so`)+ 运行用标准库(纯 Python + C 扩展),同时打了 arm64-v8a 与 x86_64。0.0.32 剔除了 test/idlelib/turtledemo 等不参与运行的目录,所以 release 从约 31MB 降到约 24MB。装完即离线,之后不需要下载任何东西;本地模型权重按需下载,不打包进 APK。

**Q:安装时提示"未知来源"?**
A:在手机 设置 → 安全/隐私 → 允许安装未知来源应用(不同厂商路径不同)。
Expand Down
4 changes: 3 additions & 1 deletion docs/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

---

## 已实现(v0.0.31 数据安全加固)
## 已实现(v0.0.32 包装清理)

- ✅ 移除旧 `usrtar.zip` 工具链说明,避免“安装包漏文件”的误解;标准库剔除 test/idlelib/turtledemo,`python-stdlib.zip` 从 11.43MB 降到 4.32MB
- ✅ Git 文案对齐实际能力:init / commit / push / pull,不宣称 clone
- ✅ 全局面板 edge-to-edge + IME 安全布局:标题/输入框/按钮固定,正文滚动;设置、AI、Agent、Git、搜索、终端在软键盘上方完整可见
- ✅ 终端全屏自适应:PTY 主体按剩余高度伸缩,Esc/Tab/Ctrl/方向键条贴键盘上方;非 PTY 输入框固定底部
- ✅ 输出面板高度分离用户偏好与当前可见值,键盘弹起不覆盖设置;展开 stdin 输入行通常至少 220dp,极矮屏降至 150dp
Expand Down
8 changes: 4 additions & 4 deletions docs/USER_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# CodePocket「口袋码」用户手册

> 版本:v0.0.31 · 适用:Android 8.0+(Python 支持 ARM64 / x86_64;JavaScript/Lua 任意 ABI)
> 版本:v0.0.32 · 适用:Android 8.0+(Python 支持 ARM64 / x86_64;JavaScript/Lua 任意 ABI)

---

## 1. 安装

1. 从 [Releases](https://gitcode.com/badhope/CodePocket/releases) 下载 release APK(双 ABI 约 31MB,debug 包约 49MB);
1. 从 [Releases](https://gitcode.com/badhope/CodePocket/releases) 下载 release APK(双 ABI 约 24MB,debug 包约 43MB);
2. 手机允许"安装未知来源应用"(不同厂商路径不同,一般在 设置 → 安全 → 未知来源);
3. 安装后打开,首次运行会自动解压内置 Python 标准库(约 1~5 秒,之后秒开)。

> 提示:release 约 31MB,因为内置了完整 CPython 3.13 原生运行时(arm64 + x86_64)、标准库与本地推理桥。装完即离线,无需再下载任何东西;本地模型权重按需下载。
> 提示:release 约 24MB,因为内置了 CPython 3.13 原生运行时(arm64 + x86_64)、运行用标准库与本地推理桥。标准库已剔除 test/idlelib/turtledemo 等不参与运行的测试/演示目录;本地模型权重仍按需下载。

---

Expand Down Expand Up @@ -119,7 +119,7 @@ Agent 面板底部有「历史会话」。点开后列出最近 20 次任务的

### 6.3 小屏与软键盘:哪些东西不会被挡住了

0.0.31 重点补数据安全与后台生命周期:关闭自动保存后切文件/关 Tab/切项目会先询问保存或放弃;保存改为临时文件 + fsync + rename;编辑器拒绝打开超过 5MB 的文件和二进制文件;返回键关终端会停止 PTY,关闭 Agent 面板会取消任务;Agent 修改/撤销检查点不再覆盖未保存编辑;检查点 blob 与会话日志有回收/上限;运行时持有 partial wakelock,熄屏跑长脚本不被挂起。仍建议在真机上确认终端、软键盘与文件选择器的最终手感。
0.0.32 重点做包体清理:删除旧 usrtar 工具链说明,标准库剔除 test/idlelib/turtledemo 共 1740 个文件,运行模块与 53 个 C 扩展未动;Git 文案改为实际支持的 init/commit/push/pull。0.0.31 重点补数据安全与后台生命周期:关闭自动保存后切文件/关 Tab/切项目会先询问保存或放弃;保存改为临时文件 + fsync + rename;编辑器拒绝打开超过 5MB 的文件和二进制文件;返回键关终端会停止 PTY,关闭 Agent 面板会取消任务;Agent 修改/撤销检查点不再覆盖未保存编辑;检查点 blob 与会话日志有回收/上限;运行时持有 partial wakelock,熄屏跑长脚本不被挂起。仍建议在真机上确认终端、软键盘与文件选择器的最终手感。

0.0.30 把手机端最容易出问题的几个位置重做了一遍:

Expand Down
4 changes: 3 additions & 1 deletion scripts/package_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ with zipfile.ZipFile(out, "w", zipfile.ZIP_DEFLATED) as z:
for root, dirs, files in os.walk(src):
# __pycache__ 是字节码缓存,占标准库体积 3/4,却能在首次 import 时自动重建;
# 不进 zip 可把 60MB 降到 12MB 左右,显著缩短首启解压时间。
dirs[:] = [d for d in dirs if d != "__pycache__"]
# test / idlelib / turtledemo 是 CPython 自测与演示代码,Android 端不运行,
# 共约 1750 个文件、6.8MB 压缩体积,打包时剔除。
dirs[:] = [d for d in dirs if d != "__pycache__" and d not in {"test", "idlelib", "turtledemo"}]
if "lib-dynload" in root:
continue # C 扩展走 jniLibs,不进 zip
for f in files:
Expand Down
8 changes: 4 additions & 4 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@

<header>
<h1>手机上真正离线的 <span class="grad">编程终端</span></h1>
<p class="sub">在手机上直接写、跑、调试 Python、JavaScript 与 Lua。内嵌原生 CPython 3.13 引擎与完整 Git 能力,现代 IDE 体验——全程零网络、零广告。</p>
<p class="sub">在手机上直接写、跑、调试 Python、JavaScript 与 Lua。内嵌原生 CPython 3.13 引擎与离线 Git 工作流(init/commit/push/pull),现代 IDE 体验——全程零网络、零广告。</p>
<div class="badges">
<span class="badge"><b>100%</b> 离线运行</span>
<span class="badge"><b>Python 3.13</b> · <b>JS</b> · <b>Lua</b></span>
<span class="badge"><b>v0.0.31</b> 数据安全加固</span>
<span class="badge"><b>v0.0.32</b> 包装清理</span>
<span class="badge"><b>0</b> 广告 · 免费开源</span>
</div>
<div class="cta">
Expand Down Expand Up @@ -169,7 +169,7 @@ <h3>开箱即用,装完即离线</h3>
<div class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 9l-5 3 5 3M16 9l5 3-5 3M14 4l-4 16"/></svg></div>
<h3>现代 IDE 体验</h3>
<p>多文件 Tab、全局搜索、正则计数跳转、报错行点击直达源码、自动闭合括号、行号开关、自动换行、跳行、图片预览、双指缩放字号,还有 Git 面板、命令面板与分屏预览。</p>
<p><b>0.0.31 新增:</b>关闭自动保存后切文件/关 Tab/切项目先询问保存或放弃;文件保存改为临时文件 + fsync + rename;返回键关终端会停止 PTY,关闭 Agent 面板会取消任务;Agent 修改/撤销检查点不再覆盖未保存编辑;检查点 blob、会话日志和分享文本都有硬上限。</p>
<p><b>0.0.32 新增:</b>移除旧版 441MB usrtar 工具链说明,标准库剔除 test/idlelib/turtledemo 共 1740 个文件,APK 更小;运行模块与 53 个 C 扩展保持不变。Git 文案改为实际支持的 init/commit/push/pull。</p>
<p><b>0.0.30:</b>手机端遮挡治理:所有面板按键盘上方可用高度布局,标题/输入框/按钮固定,只有正文滚动;终端全屏自适应、按键条贴键盘;键盘不再误触发布局切换。</p>
<p><b>0.0.29:</b>本地 xterm.js ANSI 终端模拟器:真 PTY + 颜色/光标/全屏重绘,<code>vim</code>/<code>top</code>/<code>less</code> 正常显示;移动端方向键与 Ctrl 键、亮暗双主题。</p>
</div>
Expand Down Expand Up @@ -232,7 +232,7 @@ <h2>看一眼就知道</h2>

<section id="download">
<h2>下载 APK</h2>
<p class="lead"><b>v0.0.31 数据安全加固版</b>:APK 内嵌完整 CPython 3.13 引擎、标准库与 50+ 原生 C 扩展,安装即用;支持 arm64 手机与 x86_64 模拟器,release 包约 31MB。本版补数据安全与后台生命周期:关闭自动保存后切文件/关 Tab/切项目先询问;保存原子落盘;返回键关终端真正停 PTY;Agent 不再覆盖未保存编辑;检查点与会话日志自动回收;熄屏跑长脚本持有 partial wakelock。</p>
<p class="lead"><b>v0.0.32 包装清理版</b>:APK 内嵌 CPython 3.13 引擎、运行用标准库与 50+ 原生 C 扩展,安装即用;支持 arm64 手机与 x86_64 模拟器。本版移除旧 usrtar 工具链说明,剔除不参与运行的 test/idlelib/turtledemo,release 包约 24MB,包体更小但不缺运行时。</p>
<div class="dl">
<div class="card">
<h3>GitCode Release</h3>
Expand Down
Loading