multi-agents-cli 1.1.36 → 1.1.38

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/init.js +69 -6
  2. package/package.json +1 -1
package/init.js CHANGED
@@ -77,11 +77,51 @@ const isReInit = args[0] === 'init' && !args[1];
77
77
  const projectArg = isGlobalCLI ? args[1] : null;
78
78
 
79
79
  if (isReInit) {
80
+ let inGitRepo = false;
80
81
  try {
81
82
  const gitCommonDir = execSync('git rev-parse --git-common-dir', { encoding: 'utf8', stdio: 'pipe' }).trim();
82
83
  const repoRoot = path.resolve(gitCommonDir, '..');
83
84
  process.chdir(repoRoot);
84
- } catch { /* stay in current directory */ }
85
+ inGitRepo = true;
86
+ } catch { /* not yet a git repo - stay in current directory */ }
87
+
88
+ if (!inGitRepo) {
89
+ const targetDir = process.cwd();
90
+ let gitOk = false;
91
+ try {
92
+ execSync('git init -b main', { cwd: targetDir, stdio: 'pipe' });
93
+ execSync('git commit --no-gpg-sign --allow-empty -m "init: project created"', { cwd: targetDir, stdio: 'pipe' });
94
+ gitOk = true;
95
+ } catch {
96
+ try {
97
+ execSync('git init', { cwd: targetDir, stdio: 'pipe' });
98
+ execSync('git checkout -b main', { cwd: targetDir, stdio: 'pipe' });
99
+ execSync('git commit --no-gpg-sign --allow-empty -m "init: project created"', { cwd: targetDir, stdio: 'pipe' });
100
+ gitOk = true;
101
+ } catch { /* both attempts failed */ }
102
+ }
103
+
104
+ if (gitOk) {
105
+ try {
106
+ const commitCount = execSync('git rev-list --count HEAD', { cwd: targetDir, encoding: 'utf8', stdio: 'pipe' }).trim();
107
+ gitOk = parseInt(commitCount, 10) > 0;
108
+ } catch { gitOk = false; }
109
+ }
110
+
111
+ if (!gitOk) {
112
+ console.error(`
113
+ ✖ Could not create the initial git commit.
114
+
115
+ This is usually caused by missing git identity configuration. Run:
116
+
117
+ git config --global user.name "Your Name"
118
+ git config --global user.email "you@example.com"
119
+
120
+ Then re-run: npm run init
121
+ `);
122
+ process.exit(1);
123
+ }
124
+ }
85
125
  }
86
126
 
87
127
  if (isGlobalCLI) {
@@ -110,13 +150,13 @@ if (isGlobalCLI) {
110
150
  let gitOk = false;
111
151
  try {
112
152
  execSync('git init -b main', { cwd: targetDir, stdio: 'pipe' });
113
- execSync('git commit --allow-empty -m "init: project created"', { cwd: targetDir, stdio: 'pipe' });
153
+ execSync('git commit --no-gpg-sign --allow-empty -m "init: project created"', { cwd: targetDir, stdio: 'pipe' });
114
154
  gitOk = true;
115
155
  } catch {
116
156
  try {
117
157
  execSync('git init', { cwd: targetDir, stdio: 'pipe' });
118
158
  execSync('git checkout -b main', { cwd: targetDir, stdio: 'pipe' });
119
- execSync('git commit --allow-empty -m "init: project created"', { cwd: targetDir, stdio: 'pipe' });
159
+ execSync('git commit --no-gpg-sign --allow-empty -m "init: project created"', { cwd: targetDir, stdio: 'pipe' });
120
160
  gitOk = true;
121
161
  } catch { /* both attempts failed */ }
122
162
  }
@@ -691,13 +731,36 @@ Before starting any task, verify:
691
731
 
692
732
  // ── Auto-commit ───────────────────────────────────────────────────────────────
693
733
 
734
+ let configCommitOk = false;
694
735
  try {
695
736
  execSync('git add .', { cwd: ROOT, stdio: 'pipe' });
696
- execSync('git commit -m "init: project configuration"', { cwd: ROOT, stdio: 'pipe' });
737
+ execSync('git commit --no-gpg-sign -m "init: project configuration"', { cwd: ROOT, stdio: 'pipe' });
697
738
  console.log(` ${green('✓')} Project configuration committed`);
739
+ configCommitOk = true;
698
740
  } catch {
699
- console.log(` ${yellow('!')} Could not auto-commit. Run manually:`);
700
- console.log(dim(' git add . && git commit -m "init: project configuration"'));
741
+ console.log(` ${yellow('!')} Could not auto-commit.`);
742
+ }
743
+
744
+ if (!configCommitOk) {
745
+ try {
746
+ const commitCount = execSync('git rev-list --count HEAD', { cwd: ROOT, encoding: 'utf8', stdio: 'pipe' }).trim();
747
+ configCommitOk = parseInt(commitCount, 10) > 0;
748
+ } catch { configCommitOk = false; }
749
+ }
750
+
751
+ if (!configCommitOk) {
752
+ console.error(`
753
+ ✖ Project could not be committed to git.
754
+
755
+ This is usually caused by missing git identity configuration. Run:
756
+
757
+ git config --global user.name "Your Name"
758
+ git config --global user.email "you@example.com"
759
+
760
+ Then run: git add . && git commit -m "init: project configuration"
761
+ And re-run: npm run agent
762
+ `);
763
+ process.exit(1);
701
764
  }
702
765
 
703
766
  // ── Pre-commit hook ───────────────────────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multi-agents-cli",
3
- "version": "1.1.36",
3
+ "version": "1.1.38",
4
4
  "description": "Multi-agent workflow orchestration for Claude Code — isolated git worktrees, structured state tracking, autonomous task chaining",
5
5
  "keywords": [
6
6
  "claude-code",