multi-agents-cli 1.0.76 → 1.0.78

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.
@@ -791,7 +791,9 @@ const main = async () => {
791
791
  let timestamp, sanitizedName, worktreeName, branchName, worktreePath;
792
792
  let contextSection = '';
793
793
 
794
+ let userSeedingContracts = false;
794
795
  flowLoop: while (true) {
796
+ userSeedingContracts = false; // reset each iteration
795
797
 
796
798
  // ── Select scope ─────────────────────────────────────────────────────────────
797
799
 
@@ -1025,8 +1027,6 @@ const main = async () => {
1025
1027
  }
1026
1028
  }
1027
1029
 
1028
- let userSeedingContracts = false;
1029
-
1030
1030
  // Contracts check — only for relevant agents, optional for senior devs
1031
1031
 
1032
1032
  const CONTRACTS_SEED_AGENTS = ['LOGIC', 'INIT', 'API'];
@@ -268,13 +268,48 @@ const main = async () => {
268
268
  separator();
269
269
  console.log(`\n${bold('Completing task...')}\n`);
270
270
 
271
- // ── Auto-commit uncommitted changes in worktree ──────────────────────────────
271
+ // ── Auto-commit uncommitted changes in worktree (scope-aware staging) ─────────
272
272
 
273
273
  try {
274
274
  const status = execSync('git status --porcelain', { cwd: worktreePath, stdio: 'pipe' }).toString().trim();
275
275
  if (status) {
276
276
  console.log(` ${yellow('!')} Uncommitted changes detected - committing before merge...`);
277
- execSync('git add .', { cwd: worktreePath, stdio: 'pipe' });
277
+
278
+ // Stage only files matching the allowed scope patterns — never root-level framework files
279
+ const scopeJsonPath = path.join(worktreePath, 'scope.json');
280
+ const scopePolicyPath = path.join(ROOT, '.scaffold', 'scope-policy.json');
281
+ let stagedWithScope = false;
282
+
283
+ if (fs.existsSync(scopeJsonPath) && fs.existsSync(scopePolicyPath)) {
284
+ const scopeMeta = JSON.parse(fs.readFileSync(scopeJsonPath, 'utf8'));
285
+ const scopePolicy = JSON.parse(fs.readFileSync(scopePolicyPath, 'utf8'));
286
+ const policyScope = scopePolicy[scopeMeta.policy];
287
+ const agentKey = scopeMeta.agent && scopeMeta.agent.toUpperCase();
288
+ const override = policyScope && policyScope.agentOverrides && policyScope.agentOverrides[agentKey];
289
+ const cfg = JSON.parse(fs.readFileSync(path.join(ROOT, '.scaffold', '.config.json'), 'utf8'));
290
+ const scaffolded = (cfg.scaffolded || {})[scopeMeta.scope];
291
+ const overrideActive = override && (!override.onlyBeforeScaffolded || !scaffolded);
292
+ const allowed = (overrideActive && override.allowed) || (policyScope && policyScope.allowed) || [];
293
+
294
+ if (allowed.length > 0) {
295
+ // Stage each allowed pattern individually
296
+ for (const pat of allowed) {
297
+ const target = pat.endsWith('/**') ? pat.slice(0, -3) : pat;
298
+ try {
299
+ execSync(`git add ${target}`, { cwd: worktreePath, stdio: 'pipe' });
300
+ } catch { /* pattern may not exist in this worktree */ }
301
+ }
302
+ stagedWithScope = true;
303
+ console.log(` ${green('✓')} Staged scope-allowed files only (${allowed.join(', ')})`);
304
+ }
305
+ }
306
+
307
+ if (!stagedWithScope) {
308
+ // Fallback — no scope info, stage everything
309
+ execSync('git add .', { cwd: worktreePath, stdio: 'pipe' });
310
+ console.log(` ${yellow('!')} No scope info found - staged all files`);
311
+ }
312
+
278
313
  execSync(`git commit -m "feat: task completion commit [${branchName}]"`, { cwd: worktreePath, stdio: 'pipe' });
279
314
  console.log(` ${green('✓')} Changes committed`);
280
315
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multi-agents-cli",
3
- "version": "1.0.76",
3
+ "version": "1.0.78",
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",