openmatrix 0.1.78 → 0.1.79

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.
@@ -225,9 +225,25 @@ class GitCommitManager {
225
225
  return { success: false, message: 'Auto-commit is disabled' };
226
226
  }
227
227
  try {
228
- // 检查是否在 Git 仓库中
228
+ // 检查是否在 Git 仓库中,如果不是则自动初始化
229
229
  if (!await this.isGitRepo()) {
230
- return { success: false, error: 'Not a git repository' };
230
+ await execAsync('git init', { cwd: this.repoPath });
231
+ // 确保 .gitignore 存在并包含 .openmatrix
232
+ const gitignorePath = path.join(this.repoPath, '.gitignore');
233
+ let gitignoreContent = '';
234
+ try {
235
+ gitignoreContent = await fs.readFile(gitignorePath, 'utf-8');
236
+ }
237
+ catch {
238
+ // 文件不存在
239
+ }
240
+ if (!gitignoreContent.includes('.openmatrix')) {
241
+ const addition = (gitignoreContent && !gitignoreContent.endsWith('\n') ? '\n' : '') + '.openmatrix/\n';
242
+ await fs.writeFile(gitignorePath, gitignoreContent + addition, 'utf-8');
243
+ }
244
+ // 初始提交
245
+ await execAsync('git add .gitignore', { cwd: this.repoPath });
246
+ await execAsync('git commit -m "initial commit" --allow-empty', { cwd: this.repoPath }).catch(() => { });
231
247
  }
232
248
  // 获取未提交的文件
233
249
  const files = await this.getUncommittedFiles();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmatrix",
3
- "version": "0.1.78",
3
+ "version": "0.1.79",
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",