oh-aicoding-tool
v0.1.74
Published
Configure AI coding tools with Langfuse tracing and install the oh-ai-report issue feedback plugin.
Readme
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-reportskill,并通过oh-aireport生成结构化问题报告。
当前 npm 版本:0.1.54
快速使用
建议始终带 @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 [email protected]
npx oh-aicoding-tool@latest report install claude --email [email protected]
npx oh-aicoding-tool@latest report install codex --email [email protected]
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:安装
Stophook,读取 transcript 并写入 Langfuse。 - OpenCode:安装并 patch
opencode-plugin-langfuse,开启 OpenTelemetry,并生成直接opencode命令 shim。 - Codex:安装
notifyhook,增量读取 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 oh-langfuse@latest,用于确认本机已安装 runtime 是否已经更新到最新版本。check 只检查配置完整性,不能单独证明已更新到最新版。
员工号必须匹配:
^[a-z](?:\d{8}|wx\d{7})$示例:h00613222、hwx1234567。
常用命令:
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 codexOpenCode 安装后会生成:
- 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:ArkWebdistributed:分布式graphics:图形kernel:内核security:安全
常用命令
oh-aicoding-tool skill
oh-aicoding-tool skill install
oh-aicoding-tool skill clean
oh-skillhub交互式安装流程
- 运行
oh-aicoding-tool skill启动安装向导 - 使用
Space展开/选择 Skill 分组,Up/Down移动光标 - 选择要安装的 Skill 后按
Enter确认 - 选择安装目标(Codex / Claude / OpenCode,可多选)
- 确认安装计划,完成安装
卸载 Skill
oh-aicoding-tool skill clean启动卸载向导,扫描已安装的 Skill 并选择移除。卸载时默认移入回收站 ~/.oh-skillhub/trash/,可手动恢复。
遥测
SkillHub 会匿名上报安装事件用于统计,可通过环境变量禁用:
OH_SKILLHUB_NO_TELEMETRY=1 oh-aicoding-tool skillSkill 使用统计
当前版本不再单独生成 Skill Use observation。Skill 使用信息统一写入每轮 agent-specific Agent Turn observation 的 metadata。
Agent Turn 的 observation name 会带上来源,方便在 Langfuse 后台直接区分:
Claude Agent TurnOpenCode Agent TurnCodex 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 [email protected]
oh-aicoding-tool report install claude --email [email protected]
oh-aicoding-tool report install codex --email [email protected]
oh-aicoding-tool report install both --email [email protected]
oh-aicoding-tool report install all --email [email protected]
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:安装 Codexoh-ai-reportskill、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 [email protected] --expect-langfuse