openmatrix 0.1.93 → 0.1.95

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.
@@ -323,7 +323,7 @@ class GitCommitManager {
323
323
  }
324
324
  // 确保 .gitignore 中包含 .openmatrix(写入到 git 根目录)
325
325
  await (0, gitignore_js_1.ensureOpenmatrixGitignore)(this.repoPath);
326
- // 获取未提交的文件
326
+ // 获取未提交的文件(用于生成 commit message,在 git add 之前获取)
327
327
  const files = await this.getUncommittedFiles();
328
328
  if (files.length === 0) {
329
329
  return { success: false, message: 'No changes to commit' };
@@ -340,10 +340,36 @@ class GitCommitManager {
340
340
  };
341
341
  // 生成提交信息
342
342
  const commitMessage = this.generateCommitMessage(fullInfo, filesWithStatus);
343
- // 添加文件 - 使用 git add . 而不是 git add -A
344
- // git add . 只添加当前目录及子目录的文件,不会添加上级目录的文件
345
- // 同时通过 .gitignore 排除不需要的文件
343
+ // 暂存所有文件(.gitignore 已更新,.openmatrix/ 等目录会被排除)
346
344
  await execAsync('git add .', { cwd: this.repoPath });
345
+ // 安全措施:从暂存区移除所有不应被跟踪的目录和文件
346
+ // 即使 .gitignore 已更新,也显式 unstage 防止遗漏(特别是任务创建新项目时)
347
+ const unstagePatterns = [
348
+ '.openmatrix/',
349
+ 'node_modules/',
350
+ 'dist/',
351
+ 'build/',
352
+ '.next/',
353
+ '.nuxt/',
354
+ '.output/',
355
+ '.vite/',
356
+ '.cache/',
357
+ 'coverage/',
358
+ 'target/',
359
+ '__pycache__/',
360
+ '.pytest_cache/',
361
+ '.mypy_cache/',
362
+ '.gradle/',
363
+ 'vendor/',
364
+ '.env',
365
+ '.env.local',
366
+ '.env.*.local',
367
+ '*.tsbuildinfo',
368
+ '*.pyc',
369
+ ];
370
+ for (const pattern of unstagePatterns) {
371
+ await execAsync(`git reset HEAD -- "${pattern}"`, { cwd: this.repoPath }).catch(() => { });
372
+ }
347
373
  // 检查是否有文件被暂存(避免空提交)
348
374
  const { stdout: staged } = await execAsync('git diff --cached --name-only', { cwd: this.repoPath });
349
375
  if (!staged.trim()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmatrix",
3
- "version": "0.1.93",
3
+ "version": "0.1.95",
4
4
  "description": "AI Agent task orchestration system with Claude Code Skills integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -52,4 +52,4 @@
52
52
  "engines": {
53
53
  "node": ">=18.0.0"
54
54
  }
55
- }
55
+ }