job51-gitlab-cr-node-jt-1 2.1.4 → 2.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 (2) hide show
  1. package/index.js +3 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -119,7 +119,7 @@ class GitLabCodeReviewer {
119
119
  const processBlock = async (diffObject, blockIndex) => {
120
120
  // 创建临时文件存储diff内容,文件地址选择当前文件夹下,避免权限问题
121
121
  const fileName = `temp-diff-block-${Date.now()}-${blockIndex}.diff`;
122
- const tmpFileName = path.join(__dirname, fileName);
122
+ const tmpFileName = path.join(process.cwd(), fileName);
123
123
 
124
124
  try {
125
125
  // 构造包含元数据的 diff 内容
@@ -542,8 +542,8 @@ async function main() {
542
542
  function runClaudeCommand(promptContent) {
543
543
  return new Promise((resolve, reject) => {
544
544
 
545
- // 优先使用项目目录,如果未设置则使用当前脚本目录
546
- const projectDir = process.env.GITLAB_CR_PROJECT_DIR || __dirname;
545
+ // 使用当前工作目录,确保 Claude 能访问临时文件和项目代码
546
+ const projectDir = process.cwd();
547
547
  debugLog("AI review命令开始时间, 工作目录:" + projectDir);
548
548
 
549
549
  // 使用spawn替代exec,更安全地处理命令执行并实现环境隔离
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "job51-gitlab-cr-node-jt-1",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "description": "GitLab merge request code review tool with AI-powered analysis and project context support",
5
5
  "main": "index.js",
6
6
  "bin": {