multi-agents-cli 1.1.45 → 1.1.46
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 +43 -0
- package/init.js +30 -0
- package/package.json +1 -1
package/core/workflow/restart.js
CHANGED
|
@@ -167,6 +167,49 @@ const wipeAgent = ({ scope, agent, branch, worktreePath }) => {
|
|
|
167
167
|
if (fs.existsSync(tmplPath)) {
|
|
168
168
|
fs.mkdirSync(scopeDir, { recursive: true });
|
|
169
169
|
fs.copyFileSync(tmplPath, claudePath);
|
|
170
|
+
// Substitute @config values from .config.json (primary) or git history (secondary)
|
|
171
|
+
try {
|
|
172
|
+
let restored = fs.readFileSync(claudePath, 'utf8');
|
|
173
|
+
const scopeCfg = config[scope] || {};
|
|
174
|
+
const configMap = {
|
|
175
|
+
PROJECT_NAME: config.projectName,
|
|
176
|
+
FRAMEWORK: scopeCfg.framework,
|
|
177
|
+
FRAMEWORK_VERSION: scopeCfg.frameworkVersion,
|
|
178
|
+
LANGUAGE: scopeCfg.language,
|
|
179
|
+
UI_LIBRARY: scopeCfg.uiLibrary,
|
|
180
|
+
STATE: scopeCfg.state,
|
|
181
|
+
STYLING: scopeCfg.styling,
|
|
182
|
+
ORM: scopeCfg.orm,
|
|
183
|
+
AUTH: scopeCfg.auth,
|
|
184
|
+
};
|
|
185
|
+
for (const [key, val] of Object.entries(configMap)) {
|
|
186
|
+
if (val) restored = restored.replace(
|
|
187
|
+
new RegExp(`(# @config ${key}\\s*:).*$`, 'm'), `$1 ${val}`
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
// Secondary: git history fallback if config values still missing
|
|
191
|
+
try {
|
|
192
|
+
const firstCommit = require('child_process').execSync(
|
|
193
|
+
`git log --all --reverse --format=%H -- ${scope}/CLAUDE.md`,
|
|
194
|
+
{ cwd: ROOT, stdio: 'pipe', encoding: 'utf8' }
|
|
195
|
+
).trim().split('\n')[0];
|
|
196
|
+
if (firstCommit) {
|
|
197
|
+
const oldContent = require('child_process').execSync(
|
|
198
|
+
`git show ${firstCommit}:${scope}/CLAUDE.md`,
|
|
199
|
+
{ cwd: ROOT, stdio: 'pipe', encoding: 'utf8' }
|
|
200
|
+
);
|
|
201
|
+
for (const line of oldContent.split('\n').filter(l => /^# @config \w/.test(l))) {
|
|
202
|
+
const m = line.match(/^# @config (\w+)\s*:\s*(.+)$/);
|
|
203
|
+
if (m && !configMap[m[1].trim()]) {
|
|
204
|
+
restored = restored.replace(
|
|
205
|
+
new RegExp(`(# @config ${m[1].trim()}\\s*:).*$`, 'm'), `$1 ${m[2].trim()}`
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
} catch {}
|
|
211
|
+
fs.writeFileSync(claudePath, restored, 'utf8');
|
|
212
|
+
} catch {}
|
|
170
213
|
}
|
|
171
214
|
}
|
|
172
215
|
} catch {}
|
package/init.js
CHANGED
|
@@ -503,6 +503,36 @@ const main = async () => {
|
|
|
503
503
|
});
|
|
504
504
|
console.log(` ${green('✓')} client/CLAUDE.md configured`);
|
|
505
505
|
|
|
506
|
+
// Persist resolved config to .scaffold/.config.json for recovery by restart/sync
|
|
507
|
+
try {
|
|
508
|
+
const scaffoldConfig = {
|
|
509
|
+
projectName,
|
|
510
|
+
client: {
|
|
511
|
+
framework: clientFw.value,
|
|
512
|
+
frameworkVersion: clientFwVersion || '',
|
|
513
|
+
language: clientLang,
|
|
514
|
+
state: clientState,
|
|
515
|
+
uiLibrary: clientUi,
|
|
516
|
+
styling: clientStyle,
|
|
517
|
+
},
|
|
518
|
+
};
|
|
519
|
+
if (backendType === 'separate') {
|
|
520
|
+
scaffoldConfig.backend = {
|
|
521
|
+
framework: backendFw,
|
|
522
|
+
frameworkVersion: answers.backendFwVersion || '',
|
|
523
|
+
language: backendLang,
|
|
524
|
+
orm: backendOrm,
|
|
525
|
+
auth: backendAuth,
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
fs.writeFileSync(
|
|
529
|
+
path.join(ROOT, '.scaffold', '.config.json'),
|
|
530
|
+
JSON.stringify(scaffoldConfig, null, 2) + '\n',
|
|
531
|
+
'utf8'
|
|
532
|
+
);
|
|
533
|
+
console.log(` ${green('✓')} .scaffold/.config.json written`);
|
|
534
|
+
} catch {}
|
|
535
|
+
|
|
506
536
|
if (backendType === 'separate') {
|
|
507
537
|
writeConfig(path.join(ROOT, 'backend', 'CLAUDE.md'), {
|
|
508
538
|
PROJECT_NAME: projectName,
|
package/package.json
CHANGED