@ikunin/sprintpilot 2.2.29 → 2.2.30

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.
@@ -1380,18 +1380,66 @@ function cmdStart(opts) {
1380
1380
  }
1381
1381
 
1382
1382
  // Resume detection: if a prior session left a fingerprint, diff.
1383
+ // Two escape hatches let cmdStart proceed despite a divergent fingerprint:
1384
+ //
1385
+ // 1. External completion (auto): if the last halt's `current_story`
1386
+ // is now marked `done` in sprint-status, the divergence is the
1387
+ // EXPECTED result of completing that story outside the autopilot
1388
+ // (manual merge, hot-fix, PR landed via the UI). Clear the
1389
+ // stale story identity from persisted state and proceed —
1390
+ // composeRuntimeState's resolver will pick the next pending story.
1391
+ //
1392
+ // 2. Explicit --accept-divergence flag: catch-all for cases (1) doesn't
1393
+ // cover (multiple stories completed, branch heads moved, etc.). The
1394
+ // flag is logged into the ledger so the audit trail records that
1395
+ // the user opted in to bypass.
1383
1396
  const lastHalt = ledger.last({ projectRoot }, 'halt');
1384
1397
  if (lastHalt && lastHalt.fingerprint) {
1385
1398
  const d = divergence.detect({ projectRoot }, lastHalt.fingerprint);
1386
1399
  if (!d.identical) {
1387
- const result = {
1388
- kind: 'resume_divergence',
1389
- differences: d.differences,
1390
- last_phase: persisted.current_bmad_step || null,
1391
- };
1392
- ledger.append({ kind: 'resume', divergence: result }, { projectRoot });
1393
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
1394
- return 0;
1400
+ let autoAck = null;
1401
+ const persistedStory = persisted.current_story || null;
1402
+ if (persistedStory) {
1403
+ const stories = readSprintStatuses(projectRoot);
1404
+ const status = stories && stories[persistedStory]
1405
+ ? String(stories[persistedStory].status || '').trim().toLowerCase()
1406
+ : null;
1407
+ if (status === 'done') {
1408
+ autoAck = { reason: 'external_completion', story: persistedStory };
1409
+ }
1410
+ }
1411
+ const accepted = autoAck || (opts['accept-divergence'] ? { reason: 'explicit_accept' } : null);
1412
+ if (!accepted) {
1413
+ const result = {
1414
+ kind: 'resume_divergence',
1415
+ differences: d.differences,
1416
+ last_phase: persisted.current_bmad_step || null,
1417
+ hint:
1418
+ 'Pass --accept-divergence to proceed despite the diff, or finish externally-merged stories so sprint-status reflects reality before resuming.',
1419
+ };
1420
+ ledger.append({ kind: 'resume', divergence: result }, { projectRoot });
1421
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
1422
+ return 0;
1423
+ }
1424
+ // Clear the stale story identity before composeRuntimeState runs.
1425
+ // Without this the runtime would re-enter the same story (which is
1426
+ // now done) and verifyStoryDone would loop on "already complete".
1427
+ persisted.current_story = null;
1428
+ persisted.story_file_path = null;
1429
+ persisted.current_epic = null;
1430
+ persisted.current_bmad_step = null;
1431
+ ledger.append(
1432
+ {
1433
+ kind: 'resume',
1434
+ divergence: {
1435
+ kind: 'divergence_accepted',
1436
+ ...accepted,
1437
+ differences: d.differences,
1438
+ last_phase: lastHalt.phase || null,
1439
+ },
1440
+ },
1441
+ { projectRoot },
1442
+ );
1395
1443
  }
1396
1444
  }
1397
1445
 
@@ -1,6 +1,6 @@
1
1
  addon:
2
2
  name: sprintpilot
3
- version: 2.2.29
3
+ version: 2.2.30
4
4
  description: Sprintpilot — autopilot and multi-agent addon for BMad Method (git workflow, parallel agents, autonomous story execution)
5
5
  bmad_compatibility: ">=6.2.0"
6
6
  modules:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikunin/sprintpilot",
3
- "version": "2.2.29",
3
+ "version": "2.2.30",
4
4
  "description": "Sprintpilot — autopilot and multi-agent addon for BMad Method v6: git workflow, parallel agents, autonomous story execution",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {