Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1291 commits
Select commit Hold shift + click to select a range
1322161
chore(openclaw): rename api manage option 4 label
Mar 15, 2026
12751f7
chore(openclaw): reorder api type label
Mar 15, 2026
c5c469b
chore(openclaw): swap api manage options 3 and 4
Mar 15, 2026
b24d699
Update git config URLs to use proxy settings
kejilion Mar 16, 2026
7a7a046
Change git config to use proxy for GitHub URLs
kejilion Mar 16, 2026
ddb1bac
chore(openclaw): print sync overview before model diff details
Mar 17, 2026
0b60f59
chore(openclaw): update menu header title
Mar 17, 2026
911a965
chore(openclaw): menu title include by KEJILION
Mar 17, 2026
20dbc81
chore(openclaw): refine menu title wording
Mar 17, 2026
3a57634
fix: keep provider when adding only default openclaw model
Mar 18, 2026
e9e67aa
feat: probe openclaw model before switching
Mar 18, 2026
d372fd5
refactor: keep legacy model switch flow without gum
Mar 18, 2026
3751eee
fix: read openclaw probe config from models map
Mar 18, 2026
bcc441d
fix: split provider prefix from openclaw model id
Mar 18, 2026
3b29263
fix: use openclaw models.providers config path
Mar 18, 2026
8e9aa4b
fix: keep legacy flow when gum is unavailable
Mar 18, 2026
fbdf026
fix: detect unusable gum and fallback to legacy flow
Mar 18, 2026
611acf6
refactor: use keyboard choice for model switch confirm
Mar 18, 2026
c2f91e1
feat: use arrow-key confirm for model switching
Mar 18, 2026
288ec8c
fix: render arrow-key confirm interactively
Mar 18, 2026
8b1295f
refactor: support fallback keys for model confirm
Mar 18, 2026
2103561
style: colorize model probe result
Mar 18, 2026
ee4c5e0
fix: restore stable model switch confirmation
Mar 18, 2026
f81e405
fix: inline probe result colors without extra helpers
Mar 18, 2026
6fd7ad6
fix(openclaw): add dual probe for model switch
Mar 18, 2026
3f14580
fix(openclaw): prefer responses in model probe
Mar 18, 2026
7406c37
chore(openclaw): reorder sync summary counts
Mar 19, 2026
e95549f
release: bump version to 4.4.8
Mar 19, 2026
91c31b2
Update sh_v version from 4.4.7 to 4.4.8
kejilion Mar 19, 2026
04b3a60
Update kejilion.sh
kejilion Mar 19, 2026
48c662d
Enable elevated tools in OpenClaw configuration
kejilion Mar 19, 2026
c0ab58f
feat: add openclaw permission management menu
Mar 20, 2026
78e7a81
Fix OpenClaw permission management flow
Mar 20, 2026
a96daab
sync openclaw permission management to main and cn
Mar 20, 2026
d14437d
fix: harden OpenClaw permission mode switching
Mar 20, 2026
4a318e9
fix: handle missing OpenClaw config paths
Mar 20, 2026
3235805
add openclaw multi-agent management menu
Mar 20, 2026
aab810c
fix openclaw multi-agent status fallback
Mar 20, 2026
a2357b5
优化多智能体管理菜单展示
Mar 20, 2026
bb48820
perf: 优化多智能体菜单本地解析
Mar 20, 2026
ae3504d
Add multiagent functions for OpenClaw configuration
kejilion Mar 20, 2026
5f7138e
menu: group memory/auth/multi-agent together
Mar 20, 2026
c29f6fe
fix: compatibility with 'name' field for multi-agent identity display
Mar 20, 2026
38ce54a
fix: look deeper into 'identity.name' for agent identity display
Mar 20, 2026
f9885a8
refactor: merge agent identity setup into creation flow and slim down…
Mar 20, 2026
3ec7d49
fix: false positive 'MISSING' status for main agent in health check
Mar 20, 2026
bfa0aec
style: highlight agent ID with color and remove redundant fields
Mar 20, 2026
3f1ef39
fix: use official 'agents set-identity' command in agent creation flow
Mar 20, 2026
e2543a6
feat: upgrade memory backup/restore to support multi-agent seamlessly
Mar 20, 2026
e023878
perf: use local python parser for permission status display to avoid …
Mar 20, 2026
640718f
feat: restore openclaw menu shortcut and permission menu perf fixes
Mar 20, 2026
49bc572
chore: install git jq gum before openclaw setup
Mar 20, 2026
9f829df
chore: drop gum from openclaw setup dependencies
Mar 20, 2026
751c6b1
Change installation check from file to command
kejilion Mar 21, 2026
782cd2a
Check for 'apt' command in install_gum function
kejilion Mar 21, 2026
a754c5a
Remove redundant install_gum calls
kejilion Mar 21, 2026
f3fe75d
Remove redundant gum installation commands
kejilion Mar 21, 2026
238d5bc
fix: update ecs.sh source to GitHub
Mar 22, 2026
7e19b67
feat(openclaw): detect weixin integration status
Mar 23, 2026
b83aa78
feat(openclaw): add weixin install menu option
Mar 23, 2026
b7b8149
feat(openclaw): add qq menu entry above weixin
Mar 23, 2026
32e7753
feat(openclaw): use official lark integration flow
Mar 23, 2026
8f618e2
Update shell version from 4.4.8 to 4.4.9
kejilion Mar 23, 2026
60d01c0
Update shell version from 4.4.8 to 4.4.9
kejilion Mar 23, 2026
0f03d39
Update kejilion_sh_log.txt with new features and optimizations
kejilion Mar 23, 2026
f4ba949
fix(openclaw): remove invalid lark restart script
Mar 23, 2026
32d8dc0
fix(openclaw): compat lark feishu status detection
Mar 23, 2026
3ecafd8
fix(openclaw): prefer user paths over root in module
Mar 23, 2026
62e5014
fix(openclaw): keep config path in user home for non-root
Mar 23, 2026
d6301fa
feat(openclaw): support multi-agent memory management
Mar 23, 2026
b5d88f5
fix(openclaw): use runtime agent list for memory rebuild
Mar 23, 2026
fbde51c
fix(openclaw): pass agents json correctly in memory menu
Mar 23, 2026
a9ba4a7
fix(openclaw): fix memory index fix_index setting includeDefaultMemor…
Mar 23, 2026
db24e32
fix(openclaw): preheat index in auto-setup also covers all agents
Mar 23, 2026
c5b671c
fix(openclaw): verify qmd module integrity before skipping install
Mar 23, 2026
ad34ab5
fix(openclaw): use npm to install qmd instead of bun+github
Mar 23, 2026
ce47e0e
feat(openclaw): auto-sync all sessions model when switching default m…
Mar 23, 2026
7874ffc
feat(openclaw): auto-update MEMORY.md agent routes on create/delete
Mar 23, 2026
a67d374
Revert "feat(openclaw): auto-update MEMORY.md agent routes on create/…
Mar 23, 2026
1a6f770
feat(openclaw): add API providers showcase menu option
Mar 24, 2026
6e1c680
feat(openclaw): add API providers showcase with AFF links
Mar 24, 2026
1443579
feat(openclaw): add 优云智算 to API providers showcase
Mar 24, 2026
dfcdc10
fix(openclaw): move 白山云 to bottom as official entry
Mar 24, 2026
a9ff8e8
Add API provider showcase function and menu option
kejilion Mar 24, 2026
1e199cc
Change canshu variable from 'CN' to 'default'
kejilion Mar 24, 2026
bcf5705
feat(openclaw): add PackyAPI to API provider recommendations
Mar 25, 2026
bae47c6
feat(openclaw): add Yunwu API to provider recommendations
Mar 25, 2026
ea90636
feat(openclaw): add Plato AI to provider recommendations
Mar 25, 2026
2e475a1
feat(openclaw): add SCNet to provider recommendations
Mar 25, 2026
087a74a
openclaw模块: API模型同步支持直接回车同步全部
Mar 27, 2026
0dce270
Fix break_end call placement in kejilion.sh
kejilion Mar 27, 2026
7fd138d
Translate API sync prompts to Chinese
kejilion Mar 27, 2026
bfdf002
🌐 Weekly translation update - 2026-03-27 16:50:12
actions-user Mar 27, 2026
fe0f37f
refactor: 全面重构 OpenClaw 安全权限管理,适配最新双层拦截架构
Mar 28, 2026
ada2608
fix: 修复 bash 条件语句中错误的 else: 语法
Mar 28, 2026
5d7f330
feat: 在 OpenClaw 权限管理菜单增加『当前综合安全等级』的状态预判及高亮显示
Mar 28, 2026
8c504e9
🌐 Weekly translation update - 2026-03-29 05:29:41
actions-user Mar 29, 2026
11f56db
refactor: 全面优化记忆/权限/多智能体三大模块,适配 OpenClaw 2026.3.28
Mar 29, 2026
3a25ae5
feat: 三大模块新增 6 个实用功能
Mar 29, 2026
ff436b7
refactor: 加固脚本自动更新机制
Mar 29, 2026
265b84b
fix: 自动更新后设置丢失导致重新弹许可确认
Mar 30, 2026
1c0759e
优化 openclaw session 配置:移除冗余 resetTriggers,dmScope 改用 setdefault
Mar 31, 2026
8454498
fix: 权限管理菜单开发增强模式判断与确认逻辑修复
Apr 3, 2026
e4f9f7b
sync: 覆盖 cn/kejilion.sh 并设置 canshu=CN
Apr 3, 2026
25016f5
refactor: install_moltbot 不再预设权限,交由用户后期自行调整
Apr 3, 2026
144c357
Remove configure_openclaw_session_policy function
kejilion Apr 3, 2026
5d19467
Remove configure_openclaw_session_policy function
kejilion Apr 3, 2026
d971388
🌐 Weekly translation update - 2026-04-05 05:34:14
actions-user Apr 5, 2026
b8949aa
Add files via upload
kejilion Apr 9, 2026
20fcfeb
Update kejilion.sh
kejilion Apr 9, 2026
d353ed1
Bump version to 4.4.10 and remove extra whitespace
kejilion Apr 9, 2026
1e7536b
Update kejilion_sh_log.txt with new features
kejilion Apr 9, 2026
dd18971
Update hermes_manager.sh
kejilion Apr 9, 2026
e671cea
Update hermes_manager.sh
kejilion Apr 9, 2026
3503765
Start hermes-gateway service before running gateway
kejilion Apr 9, 2026
8f4fe21
Remove '未安装' message from get_version function
kejilion Apr 9, 2026
5697abf
feat: upgrade hermes_manager.sh to v2.0 with OpenClaw logic and fix c…
kejilion Apr 9, 2026
2c57291
chore: remove redundant sync_openclaw_api_models logic in health check
kejilion Apr 23, 2026
aee6941
🌐 Weekly translation update - 2026-04-26 05:47:12
actions-user Apr 26, 2026
e6064fb
Fix regex in get_running_status function
kejilion Apr 30, 2026
44c6e62
Fix regex in get_running_status function
kejilion Apr 30, 2026
22d0543
Change 'canshu' value from 'CN' to 'default'
kejilion Apr 30, 2026
d9a56a9
fix: refine BBRv3 XanMod lifecycle logic
May 1, 2026
1139a3d
fix: keep CN fallback for XanMod key download
May 1, 2026
6268b2e
fix(bbrv3): update XanMod repo logic and add package fallback
May 2, 2026
5c233ae
fix(bbrv3): keep fallback to 'releases' repo for unsupported legacy O…
May 2, 2026
f83c21b
Update shell version from 4.4.10 to 4.5.0
kejilion May 2, 2026
2a4f16d
Update shell version from 4.4.10 to 4.5.0
kejilion May 2, 2026
0637bf6
Fix punctuation in kejilion_sh_log.txt
kejilion May 2, 2026
17bb046
🌐 Weekly translation update - 2026-05-03 06:03:50
actions-user May 3, 2026
3cf20f1
fix(bbr3): add explicit error for dropped xanmod distributions like j…
May 3, 2026
2f74189
🌐 Weekly translation update - 2026-05-10 05:58:54
actions-user May 10, 2026
3f8bc3a
feat: add Ubuntu 26.04 reinstall option
May 11, 2026
5f41873
Add one-click system reinstall feature for Ubuntu 26.04
kejilion May 11, 2026
8dee090
feat: update Fedora reinstall versions
May 11, 2026
969cc7a
Update kejilion_sh_log.txt
kejilion May 11, 2026
5510fa8
🌐 Weekly translation update - 2026-05-17 06:09:02
actions-user May 17, 2026
ee7c7e0
feat: add Hermes update notice
kejilion May 20, 2026
9a2e11e
fix: suppress Hermes version pipe errors
kejilion May 20, 2026
79460c0
feat: add Hermes API model sync menu
kejilion May 20, 2026
18afc4f
Update kejilion.sh
kejilion May 20, 2026
6a8bd49
Update kejilion.sh
kejilion May 20, 2026
8e69c76
Update kejilion_sh_log.txt
kejilion May 20, 2026
4fd2abd
fix: resolve PyYAML ModuleNotFoundError by prioritizing hermes venv p…
kejilion May 20, 2026
0d87ea4
feat: group API display in submenu with model count and latency
kejilion May 20, 2026
e9ea1ab
fix: bulletproof virtualenv python and config.yaml detection to preve…
kejilion May 20, 2026
9094065
perf: skip URL probe and set to N/A if API base_url is invalid or empty
kejilion May 20, 2026
80d6ee7
fix: trace bash wrappers for hermes cmd and add /usr/local/lib/hermes…
kejilion May 20, 2026
8031eb7
perf: speed up hermes manager status checks
kejilion May 20, 2026
a820bef
Update hermes_manager.sh
kejilion May 21, 2026
7b13859
Update Windows 7 reinstall ISO source
kejilion May 23, 2026
27c8e80
Fix Windows 7 reinstall image name
kejilion May 24, 2026
f353e45
🌐 Weekly translation update - 2026-05-24 06:19:57
actions-user May 24, 2026
195c79f
feat: 可道云(kodbox)部署改为动态获取最新版本
kejilion May 30, 2026
7b4cac1
feat: Discuz论坛部署改为从Gitee官方源动态获取最新版本
kejilion May 30, 2026
64358ab
🌐 Weekly translation update - 2026-05-31 05:58:40
actions-user May 31, 2026
26d12d5
fix: SSH端口写入位置修复 避免落入Match块导致sshd启动失败
kejilion Jun 4, 2026
05aa733
🌐 Weekly translation update - 2026-06-07 06:26:01
actions-user Jun 7, 2026
43b831d
🌐 Weekly translation update - 2026-06-14 06:49:28
actions-user Jun 14, 2026
f94ac69
Fix Jitsi Meet reverse proxy deployment
kejilion Jun 17, 2026
ad4ec58
Fix Jitsi web container lookup after proxy setup
kejilion Jun 17, 2026
51f8cb4
Update kejilion_sh_log.txt
kejilion Jun 18, 2026
32f2bff
Update shell version from 4.5.1 to 4.5.2
kejilion Jun 18, 2026
dd99267
Update kejilion.sh
kejilion Jun 18, 2026
74a8069
🌐 Weekly translation update - 2026-06-21 06:33:16
actions-user Jun 21, 2026
3c0074a
重装系统: Debian/Ubuntu 全部改用 bin456789 reinstall.sh
kejilion Jun 26, 2026
0c57aae
🌐 Weekly translation update - 2026-06-28 06:21:24
actions-user Jun 28, 2026
1c41255
🌐 Weekly translation update - 2026-07-05 05:50:58
actions-user Jul 5, 2026
42bd359
Add TcpQuality test script
kejilion Jul 6, 2026
02de3ec
🌐 Weekly translation update - 2026-07-12 06:17:58
actions-user Jul 12, 2026
de32968
🌐 Weekly translation update - 2026-07-19 05:56:14
actions-user Jul 19, 2026
fdf771a
🌐 Weekly translation update - 2026-07-26 06:07:22
actions-user Jul 26, 2026
db7dc2a
fix: guard app lifecycle registration
kejilion Jul 26, 2026
14c84fe
feat: add noninteractive KPanel app installs
kejilion Jul 26, 2026
bee1829
fix: preserve low app default ports
kejilion Jul 26, 2026
cfe5c2e
feat: expose native app management to KPanel
kejilion Jul 26, 2026
a056fec
feat: add KPanel website recipe protocol
kejilion Jul 26, 2026
af8fe7c
fix: reject stale application catalog
kejilion Jul 27, 2026
5cf46fc
feat: expose WordPress and proxy to KPanel
kejilion Jul 27, 2026
2296c8c
feat: add KPanel interactive app protocol
kejilion Jul 27, 2026
486625b
feat: expose DNS settings to KPanel
kejilion Jul 27, 2026
6f6a1a7
feat: expose diagnostic tests to KPanel
kejilion Jul 27, 2026
4732d87
fix: replace retired GB5 endpoint
kejilion Jul 27, 2026
5361f8f
feat: allow interactive KPanel website recovery
kejilion Jul 27, 2026
727d681
feat: expose safe website delete command
kejilion Jul 27, 2026
7555b4c
fix: preserve interactive panel script input
kejilion Jul 27, 2026
a06bbc0
fix: isolate KPanel script protocols
kejilion Jul 28, 2026
ded5af1
feat: add KPanel LDNMP environment protocol
kejilion Jul 28, 2026
8ad705b
feat: expose SSH defense protocol for KPanel
kejilion Jul 28, 2026
cd4a978
feat: expose interactive app management for KPanel
kejilion Jul 28, 2026
9c19fc3
feat: support KPanel marker recovery terminal
kejilion Jul 28, 2026
4ee3f96
fix: detect Docker Hub latest image updates
kejilion Jul 28, 2026
229355b
feat: accept KPanel application install ports
kejilion Jul 28, 2026
fe199df
chore: release kejilion.sh 4.5.3
kejilion Jul 29, 2026
6832893
docs: refresh project README
kejilion Jul 29, 2026
4864058
Revert "docs: refresh project README"
kejilion Jul 29, 2026
689d622
docs: align README with KPanel layout
kejilion Jul 29, 2026
f031d12
feat(kpanel): expose interactive site recipes
kejilion Jul 29, 2026
5fb0315
fix(ldnmp): normalize new site permissions
kejilion Jul 29, 2026
4174a83
fix(ldnmp): avoid shadowed install helper
kejilion Jul 30, 2026
84e2e9c
fix(ldnmp): expose web mount root
kejilion Jul 30, 2026
e46c616
revert: restore repository to f031d12
kejilion Jul 30, 2026
b1c17c2
fix(ldnmp): normalize new site permissions
kejilion Jul 30, 2026
b792ba9
feat(kpanel): add managed BBRv3 protocol
kejilion Jul 30, 2026
f14c276
fix(kpanel): detect pending BBRv3 kernel switch
kejilion Jul 30, 2026
4a6e5b5
fix(kpanel): synchronize BBRv3 reboot state
kejilion Jul 30, 2026
4b3df93
fix: follow Komari setup wizard
kejilion Aug 2, 2026
b4641e3
🌐 Weekly translation update - 2026-08-02 06:09:01
actions-user Aug 2, 2026
60b7982
feat: install KPanel lightweight nodes
kejilion Aug 2, 2026
4f23412
fix(kpanel): support minimal systemd node hosts
kejilion Aug 2, 2026
e9f1670
fix(kpanel): synchronize regional node bootstrap
kejilion Aug 2, 2026
3f91034
fix(kpanel): make lightweight node join resumable
kejilion Aug 2, 2026
82aaa87
docs: require root and CN script synchronization
kejilion Aug 2, 2026
17871d2
feat(kpanel): add SSH port noninteractive adapter
kejilion Aug 5, 2026
3e2ff75
fix(kpanel): handle multi-network container firewall rules
kejilion Aug 4, 2026
d1b95fa
chore: release kejilion.sh 4.5.5
kejilion Aug 5, 2026
dd26cf7
fix(kpanel): verify SSH port listener
kejilion Aug 5, 2026
1f51116
🌐 Weekly translation update - 2026-08-09 04:21:24
actions-user Aug 9, 2026
0deb895
feat(kpanel): add system resource adapters
kejilion Aug 10, 2026
8a47f33
fix(kpanel): secure cron command transport
kejilion Aug 10, 2026
f6732cc
fix(kpanel): version system resource protocol
kejilion Aug 10, 2026
f8b9e3b
fix(kpanel): stabilize system resource protocol v2
kejilion Aug 10, 2026
3972217
fix(kpanel): secure system resource lock
kejilion Aug 10, 2026
a978abe
feat(kpanel): add network and account management protocols
kejilion Aug 10, 2026
a01067d
fix(account): stabilize management resource versions
kejilion Aug 10, 2026
d82f043
fix(account): count only protocol usernames
kejilion Aug 10, 2026
e9c3078
feat(kpanel): add SSH defense manager protocol
kejilion Aug 11, 2026
28f89c1
feat(kpanel): add one-click system tuning protocol
kejilion Aug 11, 2026
73c9090
feat(app): add lightweight DeepSeek Hermes manager
kejilion Aug 15, 2026
6015948
fix(hermes): report stopped gateway correctly
kejilion Aug 15, 2026
a7db8ea
fix(app): replace Hermes option with DeepSeek Harness
kejilion Aug 15, 2026
9d718cb
fix(app): align DeepSeek Harness catalog label
kejilion Aug 15, 2026
d1e210d
fix(harness): allow required npm install scripts
kejilion Aug 15, 2026
a3820af
feat(harness): add protected WebUI domain access
kejilion Aug 15, 2026
a70793a
chore: release kejilion.sh 4.5.6
kejilion Aug 15, 2026
2e3a39e
fix(harness): grant nginx scoped auth access
kejilion Aug 16, 2026
c5fc243
chore: release kejilion.sh 4.5.7
kejilion Aug 16, 2026
70a36d7
fix(harness): explicitly remove domain credentials
kejilion Aug 16, 2026
e79796b
fix(kpanel): harden one-click system tuning
kejilion Aug 17, 2026
f34e6d0
fix(kpanel): keep tuning changes isolated
kejilion Aug 17, 2026
4d72653
fix(kpanel): bootstrap SSH in one-click tuning
kejilion Aug 17, 2026
d132a93
fix(kpanel): support minimal rhel tuning hosts
kejilion Aug 17, 2026
4211d57
fix(kpanel): persist WSL tuning DNS
kejilion Aug 17, 2026
fdb0ac0
fix(kpanel): synchronize SSH tuning scripts
kejilion Aug 17, 2026
6fa7bcc
fix(kpanel): keep system tuning network direct
kejilion Aug 20, 2026
2d1a374
feat: add VMRack affiliate offer
kejilion Aug 21, 2026
3d45e51
fix(hermes): preserve named provider when switching models
Su-cyber-art Aug 21, 2026
ca91f4d
fix(kpanel): make mirror optimization non-blocking
kejilion Aug 23, 2026
9fec61b
feat(kpanel): add safe disk management protocol
kejilion Aug 23, 2026
ab6ea73
Merge pull request #122 from Su-cyber-art/fix/hermes-named-custom-pro…
kejilion Aug 25, 2026
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
181 changes: 72 additions & 109 deletions .github/workflows/translate.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@

name: Weekly Translation Workflow

on:
schedule:
# 每周日 UTC 02:00 执行 (北京时间周日 10:00)
- cron: '0 2 * * 0'
workflow_dispatch: # 允许手动触发

workflow_dispatch:

permissions:
contents: write


jobs:
translate:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -50,148 +46,115 @@ jobs:
return bool(re.search(r'[\u4e00-\u9fff]', text))

def translate_text(text, target_lang):
if not text.strip() or not is_chinese(text):
return text
try:
return GoogleTranslator(source='zh-CN', target=target_lang).translate(text)
# 过滤掉一些不该翻译的特殊符号
clean_text = text.strip()
result = GoogleTranslator(source='zh-CN', target=target_lang).translate(clean_text)
return result
except Exception as e:
print(f"\nTranslation error: {e}")
print(f"\n[Error] {e}")
return text
def translate_line_preserving_variables(line, target_lang):

def process_content_with_vars(content, target_lang):
"""
Translate only Chinese parts in echo/read/send_stats commands, excluding shell variables
核心逻辑:保护 ${var} 和 $var,翻译其中的中文部分
"""
# Match double or single quoted strings
def repl(match):
full_string = match.group(0)
quote = full_string[0]
content = full_string[1:-1]
# Split by variable expressions
parts = re.split(r'(\$\{?\w+\}?)', content)
translated_parts = [
translate_text(p, target_lang) if is_chinese(p) else p
for p in parts
]
return quote + ''.join(translated_parts) + quote

return re.sub(r'(?:\'[^\']*\'|"[^"]*")', repl, line)
# 匹配 ${var} 或 $var (字母数字下划线)
parts = re.split(r'(\$\{\w+\}|\$\w+)', content)
translated_parts = []
for p in parts:
if p.startswith('$'): # 变量部分,保持原样
translated_parts.append(p)
elif is_chinese(p): # 中文部分,翻译
translated_parts.append(translate_text(p, target_lang))
else: # 其他英文/符号,保持原样
translated_parts.append(p)
return "".join(translated_parts)

def universal_translator(line, target_lang):
"""
通用翻译引擎:识别行内所有引号内容并翻译
"""
# 1. 保护注释行
leading_space = re.match(r'^(\s*)', line).group(1)
stripped = line.strip()
if stripped.startswith('#'):
comment_content = stripped[1:].strip()
if is_chinese(comment_content):
return f"{leading_space}# {translate_text(comment_content, target_lang)}\n"
return line

# 2. 识别所有引号内的内容 (双引号或单引号)
# 使用正则匹配引号对,同时处理转义引号 \"
def replacer(match):
quote_type = match.group(1) # ' 或 "
content = match.group(2) # 引号内的文本内容
if is_chinese(content):
# 翻译内容,但保护里面的变量
translated = process_content_with_vars(content, target_lang)
return f"{quote_type}{translated}{quote_type}"
return match.group(0)

# 匹配 "content" 或 'content'
new_line = re.sub(r'([\'"])(.*?)(?<!\\)\1', replacer, line)
return new_line

def translate_file(input_file, output_file, target_lang):
print(f"Translating to {target_lang}...")
if not os.path.exists(input_file): return False

if not os.path.exists(input_file):
print(f"Error: Input file {input_file} not found")
return False

total_lines = sum(1 for _ in open(input_file, 'r', encoding='utf-8'))
processed_lines = 0
with open(input_file, 'r', encoding='utf-8') as f:
lines = f.readlines()

with open(input_file, 'r', encoding='utf-8') as f_in, \
open(output_file, 'w', encoding='utf-8') as f_out:

for line in f_in:
processed_lines += 1
progress = processed_lines / total_lines * 100
print(f"\rProcessing: {progress:.1f}% ({processed_lines}/{total_lines})", end='')

leading_space = re.match(r'^(\s*)', line).group(1)
stripped = line.strip()
total = len(lines)
with open(output_file, 'w', encoding='utf-8') as f_out:
for i, line in enumerate(lines):
if (i + 1) % 10 == 0 or i + 1 == total:
print(f"\rProgress: {(i+1)/total*100:.1f}%", end='')

if stripped.startswith('#') and is_chinese(stripped):
comment_mark = '#'
comment_text = stripped[1:].strip()
if comment_text:
translated = translate_text(comment_text, target_lang)
f_out.write(f"{leading_space}{comment_mark} {translated}\n")
else:
f_out.write(line)
elif any(cmd in stripped for cmd in ['echo', 'read', 'send_stats']) and is_chinese(stripped):
translated_line = translate_line_preserving_variables(line, target_lang)
f_out.write(translated_line)
# 只要行内有中文,就尝试用通用引擎翻译
if is_chinese(line):
f_out.write(universal_translator(line, target_lang))
else:
f_out.write(line)

print(f"\nTranslation to {target_lang} completed.")
print(f"Original file size: {os.path.getsize(input_file)} bytes")
print(f"Translated file size: {os.path.getsize(output_file)} bytes")
print(f"\n{target_lang} Success.")
return True

if __name__ == "__main__":
input_file = 'kejilion.sh'

# 语言映射:目录名 -> Google翻译语言代码
languages = {
'en': 'en', # 英语
'tw': 'zh-TW', # 繁体中文
'kr': 'ko', # 韩语
'jp': 'ja' # 日语
}

success_count = 0

for dir_name, lang_code in languages.items():
output_file = f'{dir_name}/kejilion.sh'
if translate_file(input_file, output_file, lang_code):
success_count += 1
print(f"✓ Successfully translated to {dir_name}")
else:
print(f"✗ Failed to translate to {dir_name}")
print("-" * 50)

print(f"\nTranslation summary: {success_count}/{len(languages)} languages completed")

if success_count == 0:
sys.exit(1)
langs = {'en': 'en', 'tw': 'zh-TW', 'kr': 'ko', 'jp': 'ja'}
for dir_name, lang_code in langs.items():
translate_file(input_file, f'{dir_name}/kejilion.sh', lang_code)
EOF

- name: Run translation
run: |
python translate.py
run: python translate.py

- name: Check for changes
id: check_changes
run: |
git add .
if git diff --staged --quiet; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
git diff --staged --quiet || echo "has_changes=true" >> $GITHUB_OUTPUT

- name: Commit and push changes
if: steps.check_changes.outputs.has_changes == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "🌐 Weekly translation update - $(date +'%Y-%m-%d %H:%M:%S')"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create summary
if: always()
run: |
echo "## Translation Summary 📊" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Language | Directory | Status |" >> $GITHUB_STEP_SUMMARY
echo "|----------|-----------|--------|" >> $GITHUB_STEP_SUMMARY

echo "| Language | Status |" >> $GITHUB_STEP_SUMMARY
echo "|----------|--------|" >> $GITHUB_STEP_SUMMARY
for dir in en tw kr jp; do
if [ -f "$dir/kejilion.sh" ]; then
size=$(stat -c%s "$dir/kejilion.sh")
echo "| $dir | /$dir/ | ✅ Success (${size} bytes) |" >> $GITHUB_STEP_SUMMARY
else
echo "| $dir | /$dir/ | ❌ Failed |" >> $GITHUB_STEP_SUMMARY
fi
[ -f "$dir/kejilion.sh" ] && status="✅ Success" || status="❌ Failed"
echo "| $dir | $status |" >> $GITHUB_STEP_SUMMARY
done

echo "" >> $GITHUB_STEP_SUMMARY
echo "**Execution time:** $(date)" >> $GITHUB_STEP_SUMMARY

if [ "${{ steps.check_changes.outputs.has_changes }}" == "true" ]; then
echo "**Changes:** New translations committed and pushed" >> $GITHUB_STEP_SUMMARY
else
echo "**Changes:** No changes detected" >> $GITHUB_STEP_SUMMARY
fi


13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 贡献与同步规则

## 主脚本与中文脚本

- 修改根目录 `kejilion.sh` 的业务逻辑、协议、命令、依赖或修复时,必须在同一提交中同步更新 `cn/kejilion.sh`。
- 两份脚本除区域入口参数外必须保持一致:根脚本使用 `canshu="default"`,中文脚本使用 `canshu="CN"`。
- 提交前必须运行:

```bash
bash tests/test_cn_script_sync.sh
```

- 同步检查失败时不得合并或发布;不能通过跳过测试、复制旧版脚本或仅修改其中一份来规避。
2 changes: 1 addition & 1 deletion README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bash <(curl -sL kejilion.sh) jp
***
## 🖼️ 実際のスクリーンショット

<img src="https://kejilion.sh/kejilionsh_jp.webp" alt="日本語版プレビュー" width="75%"/>
<img src="https://kejilion.sh/img/screenshots/kejilionsh_jp.webp" alt="日本語版プレビュー" width="75%"/>


***
Expand Down
2 changes: 1 addition & 1 deletion README.kr.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ bash <(curl -sL kejilion.sh) kr

## 🖼️ 실제 화면 미리보기 (Preview)

<img src="https://kejilion.sh/kejilionsh_kr.webp" alt="한국어 버전 미리보기" width="75%"/>
<img src="https://kejilion.sh/img/screenshots/kejilionsh_kr.webp" alt="한국어 버전 미리보기" width="75%"/>



Expand Down
Loading