openmatrix 0.1.94 → 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.
|
@@ -342,8 +342,34 @@ class GitCommitManager {
|
|
|
342
342
|
const commitMessage = this.generateCommitMessage(fullInfo, filesWithStatus);
|
|
343
343
|
// 暂存所有文件(.gitignore 已更新,.openmatrix/ 等目录会被排除)
|
|
344
344
|
await execAsync('git add .', { cwd: this.repoPath });
|
|
345
|
-
//
|
|
346
|
-
|
|
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()) {
|