multi-agents-cli 1.1.35 → 1.1.36
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.
- package/init.js +26 -1
- package/package.json +1 -1
package/init.js
CHANGED
|
@@ -107,15 +107,40 @@ if (isGlobalCLI) {
|
|
|
107
107
|
'utf8'
|
|
108
108
|
);
|
|
109
109
|
|
|
110
|
+
let gitOk = false;
|
|
110
111
|
try {
|
|
111
112
|
execSync('git init -b main', { cwd: targetDir, stdio: 'pipe' });
|
|
112
113
|
execSync('git commit --allow-empty -m "init: project created"', { cwd: targetDir, stdio: 'pipe' });
|
|
114
|
+
gitOk = true;
|
|
113
115
|
} catch {
|
|
114
116
|
try {
|
|
115
117
|
execSync('git init', { cwd: targetDir, stdio: 'pipe' });
|
|
116
118
|
execSync('git checkout -b main', { cwd: targetDir, stdio: 'pipe' });
|
|
117
119
|
execSync('git commit --allow-empty -m "init: project created"', { cwd: targetDir, stdio: 'pipe' });
|
|
118
|
-
|
|
120
|
+
gitOk = true;
|
|
121
|
+
} catch { /* both attempts failed */ }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Hard gate: verify a commit actually exists before proceeding
|
|
125
|
+
if (gitOk) {
|
|
126
|
+
try {
|
|
127
|
+
const commitCount = execSync('git rev-list --count HEAD', { cwd: targetDir, encoding: 'utf8', stdio: 'pipe' }).trim();
|
|
128
|
+
gitOk = parseInt(commitCount, 10) > 0;
|
|
129
|
+
} catch { gitOk = false; }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (!gitOk) {
|
|
133
|
+
console.error(`
|
|
134
|
+
✖ Could not create the initial git commit.
|
|
135
|
+
|
|
136
|
+
This is usually caused by missing git identity configuration. Run:
|
|
137
|
+
|
|
138
|
+
git config --global user.name "Your Name"
|
|
139
|
+
git config --global user.email "you@example.com"
|
|
140
|
+
|
|
141
|
+
Then re-run: multi-agents init ${path.basename(targetDir)}
|
|
142
|
+
`);
|
|
143
|
+
process.exit(1);
|
|
119
144
|
}
|
|
120
145
|
}
|
|
121
146
|
}
|
package/package.json
CHANGED