multi-agents-cli 1.1.41 → 1.1.43
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 -0
- package/package.json +1 -1
package/core/workflow/restart.js
CHANGED
|
@@ -145,6 +145,26 @@ const wipeAgent = ({ scope, agent, branch, worktreePath }) => {
|
|
|
145
145
|
try { execSync(`git branch -D ${branch}`, { cwd: ROOT, stdio: 'pipe' }); } catch {}
|
|
146
146
|
try { execSync(`git push origin --delete ${branch}`, { cwd: ROOT, stdio: 'pipe' }); } catch {}
|
|
147
147
|
|
|
148
|
+
// If scope folder has agent-built content on main, remove it so new branch starts clean
|
|
149
|
+
// Use filesystem truth, not tracking status (tracking may already be cleared by prior restart)
|
|
150
|
+
const scopeDir = require('path').join(ROOT, scope);
|
|
151
|
+
if (fs.existsSync(scopeDir)) {
|
|
152
|
+
const scopeContents = fs.readdirSync(scopeDir).filter(f => f !== 'CLAUDE.md');
|
|
153
|
+
if (scopeContents.length > 0) {
|
|
154
|
+
try {
|
|
155
|
+
// Delete each entry individually - preserve CLAUDE.md
|
|
156
|
+
for (const entry of scopeContents) {
|
|
157
|
+
fs.rmSync(require('path').join(scopeDir, entry), { recursive: true, force: true });
|
|
158
|
+
}
|
|
159
|
+
require('child_process').execSync('git add -A', { cwd: ROOT, stdio: 'pipe' });
|
|
160
|
+
require('child_process').execSync(
|
|
161
|
+
`git commit --no-gpg-sign --no-verify -m "chore: remove ${scope} scope content for restart"`,
|
|
162
|
+
{ cwd: ROOT, stdio: 'pipe' }
|
|
163
|
+
);
|
|
164
|
+
} catch {}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
148
168
|
if (tracking[scope]?.[agent]) {
|
|
149
169
|
tracking[scope][agent] = { branch: null, timestamp: null, launchedAt: null, status: null, missingCount: 0, worktreePath: null };
|
|
150
170
|
fs.writeFileSync(TRACKING_PATH, JSON.stringify(tracking, null, 2), 'utf8');
|
package/package.json
CHANGED