opencode无网环境-引用上下文失效问题

问题

由于公司在内网环境开发,没有网络,安装了 opencode 后发现用 @ 无法自动索引出项目文件,导致每次要指定项目文件的时候都得复制全路径。

环境

opencode=1.3.6

原因

opencode 是用 ripgrep 扫描和索引文件系统的,启动 opencode 的时候会从网上自动下载 ripgrep 并进行安装,会安装到 ${xdgCache}/opencode/bin 里

我1.3.6 window版放的目录是 %USERPROFILE%/.cache/opencode/bin 里即 c:/Users/${username}/.cache/opencode/bin ,相关代码在 packages\opencode\src\global\index.ts 里

最新版的 dev 相关代码在 packages\opencode\src\file\ripgrep.ts

解压路径的代码如下图所示

解决

自己从网上下载 ripgrep,下面为下载链接,我下载的是 ripgrep-15.1.0-x86_64-pc-windows-msvc.zip

https://github.com/BurntSushi/ripgrep/releases

下载完后有两种配置方法

方法1

解压到上面提到的 %USERPROFILE%/.cache/opencode/bin 目录下,如下图所示,然后重启opencode 就可以搜索引用项目文件了。

方法2

解压到自己想要的文件夹,然后在环境变量 path 配置解压文件夹的路径,怎么配我就不多说了,懂的都懂。

注意: 如果用 opencode 桌面版的,配完环境变量需要重启电脑才能生效,可能任务管理器结束某个进程也行,但我没找到

相关推荐
guslegend8 天前
AI 编程范式转换与 Memory 工程:从无状态模型到 AGENTS.md 声明式配置
人工智能·大模型·agent·ai编程·opencode
我才是银古9 天前
单模型执行器 与 OpenCode v2配置迁移 笔记
deepseek·ai平台·opencode
liulilittle12 天前
多智能体编排的三个点
ai·llm·agent·tools·opencode
VIP_CQCRE17 天前
在 OpenCode IDE 中接入 Ace Data Cloud:让 VS Code、Cursor、Windsurf 都能调用统一 AI Coding 能力
vscode·ai编程·开发工具·opencode·acedatacloud
VIP_CQCRE17 天前
把 OpenCode 接入 Ace Data Cloud:让 VS Code、Cursor、Windsurf 统一调用 AI 编程模型
vscode·大模型·ai编程·opencode·acedatacloud
瑶山24 天前
开源编程Agent-OpenCode完整使用教程
开源·agent·ai编程·opencode
slacker-kian25 天前
[实践]-让 SAP 工程 Skill 脱离 opencode跑在自定义Agent 上
ai·llm·sap·agent·abap·adt·opencode
VIP_CQCRE1 个月前
OpenCode IDE 插件接入 Ace Data Cloud:把主流编辑器里的 AI Coding 能力统一到一个模型入口
大模型·ai编程·开发工具·opencode·acedatacloud
liulilittle1 个月前
Linux AI 开发环境搭建实录
linux·ai·llm·agent·hyper-v·dev·opencode
孟郎郎1 个月前
Windows 环境使用 OpenCode 配置使用大模型
人工智能·windows·ai·大模型·开源软件·opencode