oh-aicoding-tool 0.1.2 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +79 -80
  2. package/bin/cli.js +257 -384
  3. package/package.json +27 -55
  4. package/CODEX_LANGFUSE_PLAN.md +0 -62
  5. package/bin/langfuse-cli.js +0 -718
  6. package/codex_langfuse_notify.py +0 -591
  7. package/langfuse_hook.py +0 -603
  8. package/opencode-ohai-report/.claude/commands/report-ai-issue.md +0 -60
  9. package/opencode-ohai-report/.opencode/commands/report-ai-issue.md +0 -30
  10. package/opencode-ohai-report/.opencode/plugins/oh-ai-report.ts +0 -569
  11. package/opencode-ohai-report/README.md +0 -45
  12. package/opencode-ohai-report/bin/cli.js +0 -421
  13. package/opencode-ohai-report/docs/opencode-ai-issue-collection-architecture.md +0 -313
  14. package/opencode-ohai-report/docs/opencode-ai-issue-collection-best-practices.md +0 -476
  15. package/opencode-ohai-report/docs/opencode-ai-issue-collection-phase1-summary.md +0 -405
  16. package/opencode-ohai-report/examples/issue_output.json +0 -4
  17. package/opencode-ohai-report/package.json +0 -40
  18. package/opencode-ohai-report/scripts/claude_report_hook.py +0 -257
  19. package/opencode-ohai-report/scripts/create_issue.py +0 -34
  20. package/opencode-ohai-report/scripts/install-claude-plugin.ps1 +0 -254
  21. package/opencode-ohai-report/scripts/install-opencode-plugin.ps1 +0 -264
  22. package/opencode-ohai-report/scripts/install-opencode-plugin.sh +0 -218
  23. package/opencode-ohai-report/scripts/merge-claude-settings.py +0 -99
  24. package/opencode-ohai-report/tools/ohai-report/README.md +0 -151
  25. package/opencode-ohai-report/tools/ohai-report/examples/issue-input.json +0 -26
  26. package/opencode-ohai-report/tools/ohai-report/ohai_report/__init__.py +0 -5
  27. package/opencode-ohai-report/tools/ohai-report/ohai_report/__main__.py +0 -9
  28. package/opencode-ohai-report/tools/ohai-report/ohai_report/cli.py +0 -319
  29. package/opencode-ohai-report/tools/ohai-report/ohai_report/git_context.py +0 -32
  30. package/opencode-ohai-report/tools/ohai-report/ohai_report/gitcode_defaults.py +0 -14
  31. package/opencode-ohai-report/tools/ohai-report/ohai_report/issue_markdown.py +0 -313
  32. package/opencode-ohai-report/tools/ohai-report/ohai_report/metadata.py +0 -360
  33. package/opencode-ohai-report/tools/ohai-report/ohai_report/observability/__init__.py +0 -1
  34. package/opencode-ohai-report/tools/ohai-report/ohai_report/observability/langfuse.py +0 -38
  35. package/opencode-ohai-report/tools/ohai-report/ohai_report/payload.py +0 -64
  36. package/opencode-ohai-report/tools/ohai-report/ohai_report/schema.py +0 -80
  37. package/opencode-ohai-report/tools/ohai-report/ohai_report/sinks/__init__.py +0 -1
  38. package/opencode-ohai-report/tools/ohai-report/ohai_report/sinks/base.py +0 -15
  39. package/opencode-ohai-report/tools/ohai-report/ohai_report/sinks/gitcode.py +0 -405
  40. package/opencode-ohai-report/tools/ohai-report/ohai_report/sinks/local.py +0 -21
  41. package/opencode-ohai-report/tools/ohai-report/ohai_report/sinks/webhook.py +0 -354
  42. package/opencode-ohai-report/tools/ohai-report/ohai_report/webhook_defaults.py +0 -9
  43. package/opencode-ohai-report/tools/ohai-report/ohai_report/workspace.py +0 -61
  44. package/opencode-ohai-report/tools/ohai-report/ohai_report.py +0 -10
  45. package/opencode-ohai-report/tools/ohai-report/schemas/report_issue.schema.json +0 -166
  46. package/scripts/codex-langfuse-check.mjs +0 -101
  47. package/scripts/codex-langfuse-setup.mjs +0 -181
  48. package/scripts/langfuse-check.mjs +0 -90
  49. package/scripts/langfuse-setup.mjs +0 -278
  50. package/scripts/opencode-langfuse-check.mjs +0 -94
  51. package/scripts/opencode-langfuse-run.mjs +0 -96
  52. package/scripts/opencode-langfuse-setup.mjs +0 -478
  53. package/scripts/resolve-opencode-cli.mjs +0 -58
  54. package/setup-langfuse.bat +0 -163
  55. package/setup-langfuse.sh +0 -130
package/README.md CHANGED
@@ -1,115 +1,114 @@
1
1
  # oh-aicoding-tool
2
2
 
3
- One npm package for AI coding tooling:
3
+ `oh-aicoding-tool` AI Coding 工具的一站式聚合安装器。它本身不承载具体
4
+ 产品逻辑,而是提供统一的终端菜单和命令转发能力,调用各功能包完成安装和配置。
4
5
 
5
- - Langfuse tracing setup for Claude Code, OpenCode, and Codex.
6
- - `oh-ai-report` issue feedback plugin installer for OpenCode and Claude Code.
6
+ ## 项目定位
7
7
 
8
- ## Usage
8
+ 本仓是用户侧入口,适合在一次流程中安装或配置多个 AI Coding 辅助能力。
9
9
 
10
- Run locally from this project:
10
+ 当前聚合两个功能包:
11
11
 
12
- ```sh
13
- node bin/cli.js
14
- node bin/cli.js langfuse
15
- node bin/cli.js report doctor
16
- ```
12
+ | 能力 | npm 包 | 说明 |
13
+ | --- | --- | --- |
14
+ | Langfuse 追踪 | `oh-langfuse` | 配置 Claude Code、OpenCode、Codex 的 Langfuse 链路追踪 |
15
+ | 问题上报插件 | `oh-aireport` | 安装 `/report-ai-issue`,配置 OpenCode / Claude Code 问题上报 |
17
16
 
18
- After publishing to npm:
17
+ CLI 运行时会解析依赖包暴露的 bin 并转发参数。因此功能逻辑变更应优先在对应功能包中完成:
19
18
 
20
- ```sh
21
- npx oh-aicoding-tool
22
- npx oh-aicoding-tool langfuse setup
23
- npx oh-aicoding-tool report install opencode --email user@company.com
24
- ```
19
+ - Langfuse 相关能力维护在 `oh-langfuse`;
20
+ - 问题上报相关能力维护在 `oh-aireport`;
21
+ - 聚合菜单、编排逻辑、依赖版本维护在本仓。
22
+
23
+ ## 使用方式
25
24
 
26
- Running `npx oh-aicoding-tool` with no subcommand opens a highlighted TUI.
27
- Use arrow keys to move, `Space` to select one or more tools, and `Enter` to
28
- continue. The report path also supports multi-select install targets and guides
29
- company email configuration before installing.
30
-
31
- ## Commands
32
-
33
- ```sh
34
- oh-aicoding-tool # guided menu
35
- oh-aicoding-tool langfuse setup
36
- oh-aicoding-tool langfuse setup claude
37
- oh-aicoding-tool langfuse setup opencode
38
- oh-aicoding-tool langfuse setup codex
39
- oh-aicoding-tool langfuse check
40
- oh-aicoding-tool langfuse check environment
41
- oh-aicoding-tool langfuse check claude
42
- oh-aicoding-tool langfuse check opencode
43
- oh-aicoding-tool langfuse check codex
44
- oh-aicoding-tool report install opencode
45
- oh-aicoding-tool report install claude
46
- oh-aicoding-tool report install both
47
- oh-aicoding-tool report doctor
25
+ 运行交互式安装器:
26
+
27
+ ```bash
28
+ npx oh-aicoding-tool@latest
48
29
  ```
49
30
 
50
- Compatibility binaries are still published:
31
+ 从当前仓库运行:
51
32
 
52
- ```sh
53
- code-tool-langfuse
54
- opencode-ohai-report
55
- ohai-report
33
+ ```bash
34
+ npm install
35
+ npm start
56
36
  ```
57
37
 
58
- ## Langfuse
38
+ 交互界面支持:
59
39
 
60
- The interactive UI supports arrow-key navigation in terminals that support raw input. Use `Up` / `Down` to move, number keys for quick selection, `Enter` to select, and `q` or `Esc` to exit. In multi-select setup screens, use `Space` to toggle targets and `Enter` to continue. It uses a soft color palette and falls back to plain numeric prompts when raw terminal input is unavailable.
40
+ - `Up` / `Down`:移动选项;
41
+ - `Space`:选择或取消选择;
42
+ - `Enter`:继续;
43
+ - `q` 或 `Esc`:退出。
61
44
 
62
- `Setup Langfuse` supports selecting one or more setup targets:
45
+ 在不支持 raw input 的终端中,会自动退回到数字输入模式。
63
46
 
64
- - Claude Code Langfuse
65
- - OpenCode Langfuse
66
- - Codex Langfuse
47
+ ## 直接命令
67
48
 
68
- During setup, the only required input is `User ID`, which should be your employee number, for example `h00613222`. Other setup values use the built-in defaults.
49
+ Langfuse 命令会转发给 `oh-langfuse`:
69
50
 
70
- Before setup, the CLI checks required local tools and prints install hints when something is missing:
51
+ ```bash
52
+ npx oh-aicoding-tool@latest langfuse setup
53
+ npx oh-aicoding-tool@latest langfuse setup claude
54
+ npx oh-aicoding-tool@latest langfuse setup opencode
55
+ npx oh-aicoding-tool@latest langfuse setup codex
56
+ npx oh-aicoding-tool@latest langfuse check
57
+ npx oh-aicoding-tool@latest langfuse check environment
58
+ ```
71
59
 
72
- - Node.js / npm
73
- - Python / pip for Claude Code setup
74
- - Python / pip for Codex setup
75
- - OpenCode CLI for OpenCode setup
60
+ 也支持 Langfuse 的短命令别名:
76
61
 
77
- Python package installation uses pip's default package index by default. If you need a custom PyPI mirror, set `CODE_TOOL_PIP_INDEX_URL` or pass `--pipIndexUrl=...`.
62
+ ```bash
63
+ npx oh-aicoding-tool@latest setup
64
+ npx oh-aicoding-tool@latest check
65
+ ```
78
66
 
79
- Use dry-run mode to preview the script calls without modifying files, installing packages, or writing environment variables:
67
+ 问题上报命令会转发给 `oh-aireport`:
80
68
 
81
- ```sh
82
- oh-aicoding-tool langfuse setup --dry-run
69
+ ```bash
70
+ npx oh-aicoding-tool@latest report install opencode --email xxxxx@huawei.com
71
+ npx oh-aicoding-tool@latest report install claude
72
+ npx oh-aicoding-tool@latest report install both
83
73
  ```
84
74
 
85
- ## Issue Report Plugin
75
+ 如果交互流程中未填写邮箱,聚合器会向 `oh-aireport` 传递 `--skip-email`,
76
+ 邮箱配置可后续单独补充。
86
77
 
87
- The report installer copies the packaged runtime to `~/.config/ohai-report/runtime`, installs OpenCode/Claude command files, and sets `OHAI_REPORT_CLI` to a stable path outside the temporary npx cache.
78
+ ## 运行依赖
88
79
 
89
- The guided menu prompts for company email and saves it into the corresponding
90
- tool config so issue reports can carry a stable user identity.
80
+ 聚合器自身需要 Node.js npm。各功能包可能额外需要:
91
81
 
92
- ```sh
93
- oh-aicoding-tool report install opencode --email user@company.com
94
- oh-aicoding-tool report install claude --email user@company.com
95
- oh-aicoding-tool report install both --email user@company.com
96
- oh-aicoding-tool report doctor
97
- ```
82
+ | 流程 | 额外依赖 |
83
+ | --- | --- |
84
+ | Claude Code Langfuse | Python、pip |
85
+ | OpenCode Langfuse | OpenCode CLI |
86
+ | Codex Langfuse | Python、pip |
87
+ | OpenCode 问题上报 | OpenCode 配置目录和插件文件 |
88
+ | Claude Code 问题上报 | Claude Code 配置目录和 Python hook |
98
89
 
99
- ## What It Configures
90
+ ## 目录结构
100
91
 
101
- For Claude Code Langfuse setup, the CLI installs `langfuse_hook.py`, creates `~/.claude/langfuse-venv`, installs `langfuse` into that virtual environment, updates `~/.claude/settings.json`, and configures the hook environment. On Ubuntu/Debian, install `python3-venv` first if the setup reports that venv support is missing.
92
+ | 路径 | 说明 |
93
+ | --- | --- |
94
+ | `bin/cli.js` | 聚合菜单和命令转发入口 |
95
+ | `package.json` | npm 包元数据和功能包依赖 |
96
+ | `README.md` | 使用和维护说明 |
102
97
 
103
- For OpenCode Langfuse setup, the CLI installs and patches `opencode-plugin-langfuse`, updates `~/.config/opencode/opencode.json`, and can write `LANGFUSE_*` values to the user environment.
98
+ ## 发布顺序
104
99
 
105
- For Codex Langfuse setup, the CLI installs `codex_langfuse_notify.py`, creates `~/.codex/langfuse-venv`, installs `langfuse` into that virtual environment, writes Langfuse credentials to `~/.codex/langfuse/config.json`, and updates the top-level `notify` command in `~/.codex/config.toml`. Restart Codex after setup so the notify command is loaded.
100
+ 因为本包依赖两个功能包,发布时建议按以下顺序:
106
101
 
107
- The Codex integration is implemented as a notify-hook exporter. On each notify event it incrementally reads the matching `~/.codex/sessions/**/*.jsonl` file, converts new user/assistant/tool/token events into Langfuse observations, and then saves its offset in `~/.codex/langfuse/state.json`. If Codex does not provide a session path in the notify payload, the exporter falls back to the latest session JSONL file.
102
+ 1. 发布 `oh-langfuse`。
103
+ 2. 发布 `oh-aireport`。
104
+ 3. 更新本仓 `package.json` 中两个依赖版本。
105
+ 4. 发布 `oh-aicoding-tool`。
108
106
 
109
- ## Notes
107
+ 发布前建议运行:
108
+
109
+ ```bash
110
+ npm run check
111
+ npm run pack:check
112
+ ```
110
113
 
111
- - Langfuse Base URL, Public Key, and Secret Key have built-in defaults for this internal setup. You can override them with `LANGFUSE_BASEURL`, `LANGFUSE_PUBLIC_KEY`, and `LANGFUSE_SECRET_KEY`.
112
- - The default secret key is not printed in the terminal UI.
113
- - The CLI calls the Node setup/check scripts directly, so it avoids PowerShell `npm.ps1` execution-policy failures.
114
- - The Python hook reads `userId` from hook payload first, then from configured environment variables.
115
- - The Codex hook fails open: tracing errors are logged to `~/.codex/langfuse/codex_langfuse_notify.log` and do not block Codex.
114
+ 本仓应保持轻量,只在菜单、编排逻辑、依赖版本或聚合入口行为变化时修改。