oh-aicoding-tool:基于 AI 生态的编码工具一体化安装入口项目

用户可通过该项目一键安装和配置多种 AI 编码支持工具。它提供终端 UI 和命令门面,目前可编排 Langfuse 追踪配置与问题报告插件安装,支持交互式安装及直接命令操作。【此简介由AI生成】

Branch3Tags0
FilesLast commitLast update
2 months ago
3 months ago
2 months ago
2 months ago
4 months ago
5 months ago
5 months ago
2 months ago
4 months ago
2 months ago
2 months ago
2 months ago
5 months ago
5 months ago

oh-aicoding-tool

oh-aicoding-tool 是 AI 编码工具的一体化安装入口,当前聚合三类能力:

  • Langfuse 追踪:为 Claude Code、OpenCode、Codex 配置本地 hook、插件、命令 shim 和运行时更新。
  • SkillHub (OpenHarmony):安装 OpenHarmony 官方 Skill 到 Codex、Claude Code、OpenCode,涵盖开发规范、测试生成、代码审查等场景。
  • AI 问题反馈:为 OpenCode 安装 /report-ai-issue 命令和插件,为 Claude Code 安装命令与可选 hook,为 Codex 安装 oh-ai-report skill,并通过 oh-aireport 生成结构化问题报告。

当前 npm 版本:1.0.0

快速使用

建议始终带 @latest,避免 npx 使用本地旧缓存:

npx oh-aicoding-tool@latest

直接命令:

npx oh-aicoding-tool@latest langfuse setup
npx oh-aicoding-tool@latest langfuse setup opencode
npx oh-aicoding-tool@latest langfuse update all
npx oh-aicoding-tool@latest langfuse verify-update all
npx oh-aicoding-tool@latest langfuse check opencode

npx oh-aicoding-tool@latest report install opencode --email name@company.com
npx oh-aicoding-tool@latest report install claude --email name@company.com
npx oh-aicoding-tool@latest report install codex --email name@company.com
npx oh-aicoding-tool@latest report doctor

npx oh-aicoding-tool@latest skill
npx oh-aicoding-tool@latest skill clean

本地开发运行:

node bin/cli.js
node bin/cli.js langfuse update all
node bin/cli.js langfuse verify-update all
node bin/cli.js langfuse check
node bin/cli.js report doctor
node bin/cli.js skill
node bin/cli.js skill clean

交互式菜单

运行 npx oh-aicoding-tool@latest 会打开交互式菜单:

  • Langfuse 追踪配置:进入内置 Langfuse 安装向导,选择 Claude Code、OpenCode、Codex。
  • 更新 Langfuse 运行时:刷新已安装的 Claude / OpenCode / Codex Langfuse hooks、plugins、launchers 和命令 shim。
  • SkillHub (OpenHarmony):浏览并安装 OpenHarmony Skill 到 Codex、Claude Code、OpenCode,或卸载已安装的 Skill。
  • 问题反馈插件:安装 OpenCode、Claude Code、Codex 的问题反馈入口。

菜单默认不勾选安装项,避免误写本地配置。TTY 终端里可用方向键移动、Space 勾选、Enter 确认;不支持原始按键输入时会降级为数字输入。

Langfuse 追踪

Langfuse 能力来自内置的 oh-langfuse 运行时,支持:

  • Claude Code:安装 Stop hook,读取 transcript 并写入 Langfuse。
  • OpenCode:安装并 patch opencode-plugin-langfuse,开启 OpenTelemetry,并生成直接 opencode 命令 shim。
  • Codex:安装 notify hook,增量读取 session JSONL 并写入 Langfuse。

Codex notify 会读取 ~/.codex/langfuse/config.json(或 CODEX_HOME/langfuse/config.json)中的 baseUrl / host,用于补齐直连 Langfuse 服务时的 NO_PROXY。

verify-update 会读取 ~/.config/oh-langfuse/runtime.json 并对比 npm 上安装来源包的 latest 版本,用于确认本机已安装 runtime 是否已经更新到最新版本。check 只检查配置完整性,不能单独证明已更新到最新版。

员工号必须匹配:

^[a-z]((30|00|60)\d{6}|wx\d{6,})$

示例:h00613222、j60109775、hwx123456。

常用命令:

oh-aicoding-tool langfuse setup
oh-aicoding-tool langfuse setup claude
oh-aicoding-tool langfuse setup opencode
oh-aicoding-tool langfuse setup codex
oh-aicoding-tool langfuse update all
oh-aicoding-tool langfuse update opencode
oh-aicoding-tool langfuse verify-update all
oh-aicoding-tool langfuse verify-update opencode
oh-aicoding-tool langfuse check
oh-aicoding-tool langfuse check environment
oh-aicoding-tool langfuse check claude
oh-aicoding-tool langfuse check opencode
oh-aicoding-tool langfuse check codex

OpenCode 安装后会生成:

  • Windows:%USERPROFILE%\.config\opencode\bin\opencode.cmd
  • Linux/macOS:~/.config/opencode/bin/opencode

新开终端后直接运行 opencode,会先注入 LANGFUSE_*,再转发到真实 OpenCode CLI。命令 shim 会做轻量更新检查;如果发现新版本,会提示运行 npx oh-aicoding-tool@latest langfuse update opencode。

SkillHub (OpenHarmony Skill)

SkillHub 提供 OpenHarmony 官方 Skill 的交互式安装和卸载,支持以下 AI 编码工具:

  • Codex:安装到 ~/.codex/skills
  • Claude Code:安装到 ~/.claude/skills
  • OpenCode:安装到 ~/.config/opencode/skill

Skill 分组

Skill 按 common 和 domain 分组:

common(通用):按开发阶段分类

  • cicd:CI/CD 相关,如 GitCode CLI 使用、OpenHarmony CI 分析
  • design:设计阶段
  • development:开发阶段,如 ArkTS 静态规范、C++ 代码风格、NAPI 模块开发、安全代码审查
  • testing:测试阶段,如 XTS 测试生成、Fuzz 测试生成

domain(领域):按技术领域分类

  • arkui:ArkUI 相关
  • arkruntime:Ark 运行时
  • arkweb:ArkWeb
  • distributed:分布式
  • graphics:图形
  • kernel:内核
  • security:安全

常用命令

oh-aicoding-tool skill
oh-aicoding-tool skill install
oh-aicoding-tool skill clean
oh-skillhub

交互式安装流程

  1. 运行 oh-aicoding-tool skill 启动安装向导
  2. 使用 Space 展开/选择 Skill 分组,Up/Down 移动光标
  3. 选择要安装的 Skill 后按 Enter 确认
  4. 选择安装目标(Codex / Claude / OpenCode,可多选)
  5. 确认安装计划,完成安装

卸载 Skill

oh-aicoding-tool skill clean

启动卸载向导,扫描已安装的 Skill 并选择移除。卸载时默认移入回收站 ~/.oh-skillhub/trash/,可手动恢复。

遥测

SkillHub 会匿名上报安装事件用于统计,可通过环境变量禁用:

OH_SKILLHUB_NO_TELEMETRY=1 oh-aicoding-tool skill

Skill 使用统计

当前版本不再单独生成 Skill Use observation。Skill 使用信息统一写入每轮 agent-specific Agent Turn observation 的 metadata。

Agent Turn 的 observation name 会带上来源,方便在 Langfuse 后台直接区分:

  • Claude Agent Turn
  • OpenCode Agent Turn
  • Codex Agent Turn
skill_use_count
unique_skill_count
repeated_skill_count
skill_names
skill_names_all
skill_invocation_modes
skill_agent_paths

在 Langfuse Dashboard 中统计 skill 使用量时,建议:

View: Observations
Filter: Observation Name contains Agent Turn
Metric: Sum skill_use_count

如需按 skill 名称聚合,可使用 metadata.skill_names 或导出数据中的 metadata.skill_names_all。

问题反馈插件

问题反馈能力来自内置的 oh-aireport,会按目标安装对应入口,并将 Python 运行时复制到稳定目录,避免依赖临时 npx 缓存。

oh-aicoding-tool report install opencode --email name@company.com
oh-aicoding-tool report install claude --email name@company.com
oh-aicoding-tool report install codex --email name@company.com
oh-aicoding-tool report install both --email name@company.com
oh-aicoding-tool report install all --email name@company.com
oh-aicoding-tool report doctor

目标含义:

  • opencode:安装 OpenCode slash command、oh-ai-report.ts 插件、插件 argv helper,并自动把 ./plugins/oh-ai-report.ts 写入 ~/.config/opencode/opencode.json 的 plugin 列表。
  • claude:安装 Claude Code /report-ai-issue 命令;默认同时安装 ohai-report-hook.py 并合并 ~/.claude/settings.json,可用 --skip-hook 跳过。
  • codex:安装 Codex oh-ai-report skill、PowerShell wrapper 和 sandbox-visible runtime fallback;支持 CODEX_HOME 指向自定义 Codex 配置目录。
  • both:安装 OpenCode + Claude Code。
  • all:安装 OpenCode + Claude Code + Codex。

常用安装选项:

选项 说明
--email <email> 非交互式写入公司邮箱;默认要求 @huawei.com 或 @h-partners.com
--skip-email 不询问、不写入邮箱配置
--dry-run 只打印安装动作,不修改文件
--skip-env 不写入用户级 OHAI_REPORT_CLI 等环境变量
--plugin-only OpenCode only:只复制插件,跳过 slash command
--skip-hook Claude only:跳过 hook 和 settings 合并

邮箱用于标识提交人,会保存到对应工具的本地配置中。交互式安装会显示当前保存值,默认保留不改;非交互安装可用 --email 或 OHAI_INSTALL_USER_EMAIL 更新,也可以使用 --skip-email 跳过。

安装会写入的稳定运行时和环境变量:

  • ~/.config/ohai-report/runtime/tools/ohai-report/
  • 用户级 OHAI_REPORT_CLI
  • Codex 额外写入用户级 OHAI_REPORT_CODEX_SCRIPT

安装后请完整退出并重启对应工具,让命令、插件、hook、skill 和用户级环境变量生效。

兼容入口

code-tool-langfuse
opencode-ohai-report
ohai-report
oh-skillhub

开发与验证

node --check bin/cli.js
npm test
npm pack --dry-run

涉及 Langfuse 安装、hook、CLI、包装或 tracing 行为的修改,应运行真实闭环验证:

npm run self:verify -- --targets=opencode --userId=h00613222

涉及问题反馈插件安装、report CLI、sink 或本地 issue artifact 行为的修改,应运行:

npm run self:verify -- --targets=opencode --email name@huawei.com --expect-langfuse

Introduction

用户可通过该项目一键安装和配置多种 AI 编码支持工具。它提供终端 UI 和命令门面,目前可编排 Langfuse 追踪配置与问题报告插件安装,支持交互式安装及直接命令操作。【此简介由AI生成】

Customize your domain