Skip to content

refactor: replace process.cwd() with ExtensionContext.cwd in coding/web-tools#26

Merged
yandy merged 1 commit into
mainfrom
fix/use-extension-context-cwd
Jun 25, 2026
Merged

refactor: replace process.cwd() with ExtensionContext.cwd in coding/web-tools#26
yandy merged 1 commit into
mainfrom
fix/use-extension-context-cwd

Conversation

@yandy

@yandy yandy commented Jun 25, 2026

Copy link
Copy Markdown
Owner

变更背景

之前 pi-coding-toolspi-web-toolsloadConfig 在未传参时回退到 process.cwd()。工具 execute 层已能通过 ExtensionContext.cwd 获取正确的工作目录,但调用点未传入。

变更内容

  • pi-coding-tools/src/lsp/manager.ts: getClientForFileroot 改为必填,删除 process.cwd() 回退
  • pi-coding-tools/src/tools/lsp-tools.ts: createLspToolsgetConfig 回调改为接收 cwd,传给 loadConfiggetClientForFile
  • pi-coding-tools/src/config.ts: loadConfig 参数从可选改为必填,移除 process.cwd() 回退
  • pi-coding-tools/index.ts: session_start 事件和 createLspTools 调用点传入 ctx.cwd
  • pi-web-tools/src/config.ts: 同上,移除 process.cwd() 回退
  • 测试同步: 更新模拟数据签名以匹配新的必填参数

影响范围

pi-coding-toolspi-web-toolspi-container-sandboxprocess.cwd() 使用保持不变(按讨论结果)。

验证

  • npm run typecheck — 全部通过
  • npm run test — 290/290 测试通过

…eb-tools

- pi-coding-tools/src/lsp/manager.ts: make root required, remove process.cwd() fallback
- pi-coding-tools/src/tools/lsp-tools.ts: getConfig callback takes cwd, passes to loadConfig
- pi-coding-tools/src/config.ts: loadConfig requires cwd, removes process.cwd() fallback
- pi-coding-tools/index.ts: session_start and createLspTools pass ctx.cwd
- pi-web-tools/src/config.ts: loadConfig requires cwd, removes process.cwd() fallback
- Sync tests to match new signatures
@yandy yandy merged commit 58123e5 into main Jun 25, 2026
2 checks passed
@yandy yandy deleted the fix/use-extension-context-cwd branch June 26, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant