multi-agents-cli 1.1.44 → 1.1.45
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/core/workflow/restart.js +20 -18
- package/package.json +1 -1
package/core/workflow/restart.js
CHANGED
|
@@ -152,30 +152,32 @@ const wipeAgent = ({ scope, agent, branch, worktreePath }) => {
|
|
|
152
152
|
const scopeContents = fs.readdirSync(scopeDir).filter(f => f !== 'CLAUDE.md');
|
|
153
153
|
if (scopeContents.length > 0) {
|
|
154
154
|
try {
|
|
155
|
-
// Delete each entry individually - preserve CLAUDE.md
|
|
156
155
|
for (const entry of scopeContents) {
|
|
157
156
|
fs.rmSync(require('path').join(scopeDir, entry), { recursive: true, force: true });
|
|
158
157
|
}
|
|
159
|
-
// Restore CLAUDE.md from CLI templates if missing
|
|
160
|
-
const claudePath = require('path').join(scopeDir, 'CLAUDE.md');
|
|
161
|
-
if (!fs.existsSync(claudePath)) {
|
|
162
|
-
try {
|
|
163
|
-
const globalPkg = require('child_process').execSync('npm root -g', { stdio: 'pipe', encoding: 'utf8' }).trim();
|
|
164
|
-
const tmplPath = require('path').join(globalPkg, 'multi-agents-cli', 'core', 'templates', scope, 'CLAUDE.md');
|
|
165
|
-
if (fs.existsSync(tmplPath)) {
|
|
166
|
-
fs.mkdirSync(scopeDir, { recursive: true });
|
|
167
|
-
fs.copyFileSync(tmplPath, claudePath);
|
|
168
|
-
}
|
|
169
|
-
} catch {}
|
|
170
|
-
}
|
|
171
|
-
require('child_process').execSync('git add -A', { cwd: ROOT, stdio: 'pipe' });
|
|
172
|
-
require('child_process').execSync(
|
|
173
|
-
`git commit --no-gpg-sign --no-verify -m "chore: remove ${scope} scope content for restart"`,
|
|
174
|
-
{ cwd: ROOT, stdio: 'pipe' }
|
|
175
|
-
);
|
|
176
158
|
} catch {}
|
|
177
159
|
}
|
|
178
160
|
}
|
|
161
|
+
// Always ensure scope CLAUDE.md exists - restore from CLI templates if missing or folder gone
|
|
162
|
+
try {
|
|
163
|
+
const claudePath = require('path').join(scopeDir, 'CLAUDE.md');
|
|
164
|
+
if (!fs.existsSync(claudePath)) {
|
|
165
|
+
const globalPkg = require('child_process').execSync('npm root -g', { stdio: 'pipe', encoding: 'utf8' }).trim();
|
|
166
|
+
const tmplPath = require('path').join(globalPkg, 'multi-agents-cli', 'core', 'templates', scope, 'CLAUDE.md');
|
|
167
|
+
if (fs.existsSync(tmplPath)) {
|
|
168
|
+
fs.mkdirSync(scopeDir, { recursive: true });
|
|
169
|
+
fs.copyFileSync(tmplPath, claudePath);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
} catch {}
|
|
173
|
+
// Commit any scope changes to main
|
|
174
|
+
try {
|
|
175
|
+
require('child_process').execSync('git add -A', { cwd: ROOT, stdio: 'pipe' });
|
|
176
|
+
require('child_process').execSync(
|
|
177
|
+
`git commit --no-gpg-sign --no-verify -m "chore: remove ${scope} scope content for restart"`,
|
|
178
|
+
{ cwd: ROOT, stdio: 'pipe' }
|
|
179
|
+
);
|
|
180
|
+
} catch {}
|
|
179
181
|
|
|
180
182
|
if (tracking[scope]?.[agent]) {
|
|
181
183
|
tracking[scope][agent] = { branch: null, timestamp: null, launchedAt: null, status: null, missingCount: 0, worktreePath: null };
|
package/package.json
CHANGED