@bonesofspring/ai-rules 0.2.38 → 0.2.39

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.
Files changed (110) hide show
  1. package/CHANGELOG.md +249 -6
  2. package/package.json +1 -1
  3. package/presets/_shared/ai-local/scripts/derive-gate-signals.mjs +4 -6
  4. package/presets/_shared/ai-local/scripts/efficacy-oracle.mjs +5 -0
  5. package/presets/_shared/ai-local/scripts/lock.mjs +101 -73
  6. package/presets/_shared/ai-local/scripts/rule-improver.mjs +1 -1
  7. package/presets/_shared/ai-local/scripts/run.mjs +13 -4
  8. package/presets/_shared/ai-local/scripts/signals.mjs +38 -8
  9. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +4 -5
  10. package/presets/_shared/hooks/check-preset-update.mjs +1 -1
  11. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +4 -5
  12. package/presets/claude/android-kotlin/hooks/check-preset-update.mjs +1 -1
  13. package/presets/claude/go/hooks/chain-team-phases.sh +4 -5
  14. package/presets/claude/go/hooks/check-preset-update.mjs +1 -1
  15. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +4 -5
  16. package/presets/claude/ios-swift/hooks/check-preset-update.mjs +1 -1
  17. package/presets/claude/java/hooks/chain-team-phases.sh +4 -5
  18. package/presets/claude/java/hooks/check-preset-update.mjs +1 -1
  19. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +4 -5
  20. package/presets/claude/mcp-ts/hooks/check-preset-update.mjs +1 -1
  21. package/presets/claude/next/hooks/chain-team-phases.sh +4 -5
  22. package/presets/claude/next/hooks/check-preset-update.mjs +1 -1
  23. package/presets/claude/nuxt/hooks/chain-team-phases.sh +4 -5
  24. package/presets/claude/nuxt/hooks/check-preset-update.mjs +1 -1
  25. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +4 -5
  26. package/presets/claude/php-hexagonal/hooks/check-preset-update.mjs +1 -1
  27. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +4 -5
  28. package/presets/claude/php-laravel/hooks/check-preset-update.mjs +1 -1
  29. package/presets/claude/svelte/hooks/chain-team-phases.sh +4 -5
  30. package/presets/claude/svelte/hooks/check-preset-update.mjs +1 -1
  31. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +4 -5
  32. package/presets/cursor/android-kotlin/hooks/check-preset-update.mjs +1 -1
  33. package/presets/cursor/go/hooks/chain-team-phases.sh +4 -5
  34. package/presets/cursor/go/hooks/check-preset-update.mjs +1 -1
  35. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +4 -5
  36. package/presets/cursor/ios-swift/hooks/check-preset-update.mjs +1 -1
  37. package/presets/cursor/java/hooks/chain-team-phases.sh +4 -5
  38. package/presets/cursor/java/hooks/check-preset-update.mjs +1 -1
  39. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +4 -5
  40. package/presets/cursor/mcp-ts/hooks/check-preset-update.mjs +1 -1
  41. package/presets/cursor/next/hooks/chain-team-phases.sh +4 -5
  42. package/presets/cursor/next/hooks/check-preset-update.mjs +1 -1
  43. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +4 -5
  44. package/presets/cursor/nuxt/hooks/check-preset-update.mjs +1 -1
  45. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +4 -5
  46. package/presets/cursor/php-hexagonal/hooks/check-preset-update.mjs +1 -1
  47. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +4 -5
  48. package/presets/cursor/php-laravel/hooks/check-preset-update.mjs +1 -1
  49. package/presets/cursor/svelte/hooks/chain-team-phases.sh +4 -5
  50. package/presets/cursor/svelte/hooks/check-preset-update.mjs +1 -1
  51. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  52. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +4 -5
  53. package/presets/mavis/android-kotlin/hooks/check-preset-update.mjs +1 -1
  54. package/presets/mavis/go/adapter-map.json +1 -1
  55. package/presets/mavis/go/hooks/chain-team-phases.sh +4 -5
  56. package/presets/mavis/go/hooks/check-preset-update.mjs +1 -1
  57. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  58. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +4 -5
  59. package/presets/mavis/ios-swift/hooks/check-preset-update.mjs +1 -1
  60. package/presets/mavis/java/adapter-map.json +1 -1
  61. package/presets/mavis/java/hooks/chain-team-phases.sh +4 -5
  62. package/presets/mavis/java/hooks/check-preset-update.mjs +1 -1
  63. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  64. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +4 -5
  65. package/presets/mavis/mcp-ts/hooks/check-preset-update.mjs +1 -1
  66. package/presets/mavis/next/adapter-map.json +1 -1
  67. package/presets/mavis/next/hooks/chain-team-phases.sh +4 -5
  68. package/presets/mavis/next/hooks/check-preset-update.mjs +1 -1
  69. package/presets/mavis/nuxt/adapter-map.json +1 -1
  70. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +4 -5
  71. package/presets/mavis/nuxt/hooks/check-preset-update.mjs +1 -1
  72. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  73. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +4 -5
  74. package/presets/mavis/php-hexagonal/hooks/check-preset-update.mjs +1 -1
  75. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  76. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +4 -5
  77. package/presets/mavis/php-laravel/hooks/check-preset-update.mjs +1 -1
  78. package/presets/mavis/svelte/adapter-map.json +1 -1
  79. package/presets/mavis/svelte/hooks/chain-team-phases.sh +4 -5
  80. package/presets/mavis/svelte/hooks/check-preset-update.mjs +1 -1
  81. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  82. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +4 -5
  83. package/presets/opencode/android-kotlin/hooks/check-preset-update.mjs +1 -1
  84. package/presets/opencode/go/adapter-map.json +1 -1
  85. package/presets/opencode/go/hooks/chain-team-phases.sh +4 -5
  86. package/presets/opencode/go/hooks/check-preset-update.mjs +1 -1
  87. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  88. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +4 -5
  89. package/presets/opencode/ios-swift/hooks/check-preset-update.mjs +1 -1
  90. package/presets/opencode/java/adapter-map.json +1 -1
  91. package/presets/opencode/java/hooks/chain-team-phases.sh +4 -5
  92. package/presets/opencode/java/hooks/check-preset-update.mjs +1 -1
  93. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  94. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +4 -5
  95. package/presets/opencode/mcp-ts/hooks/check-preset-update.mjs +1 -1
  96. package/presets/opencode/next/adapter-map.json +1 -1
  97. package/presets/opencode/next/hooks/chain-team-phases.sh +4 -5
  98. package/presets/opencode/next/hooks/check-preset-update.mjs +1 -1
  99. package/presets/opencode/nuxt/adapter-map.json +1 -1
  100. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +4 -5
  101. package/presets/opencode/nuxt/hooks/check-preset-update.mjs +1 -1
  102. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  103. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +4 -5
  104. package/presets/opencode/php-hexagonal/hooks/check-preset-update.mjs +1 -1
  105. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  106. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +4 -5
  107. package/presets/opencode/php-laravel/hooks/check-preset-update.mjs +1 -1
  108. package/presets/opencode/svelte/adapter-map.json +1 -1
  109. package/presets/opencode/svelte/hooks/chain-team-phases.sh +4 -5
  110. package/presets/opencode/svelte/hooks/check-preset-update.mjs +1 -1
@@ -457,6 +457,10 @@ function completePipeline(statusPatch) {
457
457
  out(`Pipeline blocked for "${slug}": .ai.local/pipeline-gates.json requireArtifacts missing completed receipt(s): ${missing.join(', ')}.`);
458
458
  process.exit(0);
459
459
  }
460
+ // task_completed is written only on this branch. A missing receipt blocks
461
+ // above and must not be counted as a finished task.
462
+ status.state = 'completed';
463
+ completeTaskMetrics();
460
464
  writeStatus(statusPatch);
461
465
  out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
462
466
  process.exit(0);
@@ -968,7 +972,6 @@ if (hookInput.action === 'end_human_gate') {
968
972
  if (dispatchReadyWave()) process.exit(0);
969
973
  if (pendingStepIndexes().length === 0) {
970
974
  status.state = 'completed';
971
- completeTaskMetrics();
972
975
  completePipeline({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
973
976
  }
974
977
  out(noProgressNotice());
@@ -994,7 +997,6 @@ if (hookInput.action === 'end_human_gate') {
994
997
  // Gate on the final step: no executable step remains. Complete the
995
998
  // pipeline instead of leaving it in_progress forever.
996
999
  status.state = 'completed';
997
- completeTaskMetrics();
998
1000
  completePipeline({
999
1001
  pipelineIndex: resumeSteps.length,
1000
1002
  phase: 'done',
@@ -1305,7 +1307,6 @@ if (waveIndexes) {
1305
1307
  process.exit(0);
1306
1308
  }
1307
1309
  if (pendingStepIndexes().length === 0) {
1308
- completeTaskMetrics();
1309
1310
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1310
1311
  }
1311
1312
  out(noProgressNotice());
@@ -1419,7 +1420,6 @@ if (isGraphMode()) {
1419
1420
  }
1420
1421
  if (dispatchReadyWave()) process.exit(0);
1421
1422
  if (pendingStepIndexes().length === 0) {
1422
- completeTaskMetrics();
1423
1423
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1424
1424
  }
1425
1425
  out(noProgressNotice());
@@ -1428,7 +1428,6 @@ if (isGraphMode()) {
1428
1428
 
1429
1429
  const next = findNextExecutableStep(steps, idx + 1, taskDir);
1430
1430
  if (!next) {
1431
- completeTaskMetrics();
1432
1431
  completePipeline({
1433
1432
  pipelineIndex: steps.length,
1434
1433
  phase: 'done',
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
 
10
10
  export const PACKAGE_NAME = '@bonesofspring/ai-rules';
11
11
  export const REGISTRY_URL = 'https://registry.npmjs.org/@bonesofspring/ai-rules/latest';
12
- export const CACHE_TTL_MS = 12 * 60 * 60 * 1000;
12
+ export const CACHE_TTL_MS = 60 * 60 * 1000;
13
13
  export const TOOL_ROOTS = ['.cursor', '.claude', '.mavis', '.opencode'];
14
14
 
15
15
  const RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
@@ -457,6 +457,10 @@ function completePipeline(statusPatch) {
457
457
  out(`Pipeline blocked for "${slug}": .ai.local/pipeline-gates.json requireArtifacts missing completed receipt(s): ${missing.join(', ')}.`);
458
458
  process.exit(0);
459
459
  }
460
+ // task_completed is written only on this branch. A missing receipt blocks
461
+ // above and must not be counted as a finished task.
462
+ status.state = 'completed';
463
+ completeTaskMetrics();
460
464
  writeStatus(statusPatch);
461
465
  out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
462
466
  process.exit(0);
@@ -970,7 +974,6 @@ if (hookInput.action === 'end_human_gate') {
970
974
  if (dispatchReadyWave()) process.exit(0);
971
975
  if (pendingStepIndexes().length === 0) {
972
976
  status.state = 'completed';
973
- completeTaskMetrics();
974
977
  completePipeline({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
975
978
  }
976
979
  out(noProgressNotice());
@@ -996,7 +999,6 @@ if (hookInput.action === 'end_human_gate') {
996
999
  // Gate on the final step: no executable step remains. Complete the
997
1000
  // pipeline instead of leaving it in_progress forever.
998
1001
  status.state = 'completed';
999
- completeTaskMetrics();
1000
1002
  completePipeline({
1001
1003
  pipelineIndex: resumeSteps.length,
1002
1004
  phase: 'done',
@@ -1307,7 +1309,6 @@ if (waveIndexes) {
1307
1309
  process.exit(0);
1308
1310
  }
1309
1311
  if (pendingStepIndexes().length === 0) {
1310
- completeTaskMetrics();
1311
1312
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1312
1313
  }
1313
1314
  out(noProgressNotice());
@@ -1421,7 +1422,6 @@ if (isGraphMode()) {
1421
1422
  }
1422
1423
  if (dispatchReadyWave()) process.exit(0);
1423
1424
  if (pendingStepIndexes().length === 0) {
1424
- completeTaskMetrics();
1425
1425
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1426
1426
  }
1427
1427
  out(noProgressNotice());
@@ -1430,7 +1430,6 @@ if (isGraphMode()) {
1430
1430
 
1431
1431
  const next = findNextExecutableStep(steps, idx + 1, taskDir);
1432
1432
  if (!next) {
1433
- completeTaskMetrics();
1434
1433
  completePipeline({
1435
1434
  pipelineIndex: steps.length,
1436
1435
  phase: 'done',
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
 
10
10
  export const PACKAGE_NAME = '@bonesofspring/ai-rules';
11
11
  export const REGISTRY_URL = 'https://registry.npmjs.org/@bonesofspring/ai-rules/latest';
12
- export const CACHE_TTL_MS = 12 * 60 * 60 * 1000;
12
+ export const CACHE_TTL_MS = 60 * 60 * 1000;
13
13
  export const TOOL_ROOTS = ['.cursor', '.claude', '.mavis', '.opencode'];
14
14
 
15
15
  const RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
@@ -439,6 +439,10 @@ function completePipeline(statusPatch) {
439
439
  out(`Pipeline blocked for "${slug}": .ai.local/pipeline-gates.json requireArtifacts missing completed receipt(s): ${missing.join(', ')}.`);
440
440
  process.exit(0);
441
441
  }
442
+ // task_completed is written only on this branch. A missing receipt blocks
443
+ // above and must not be counted as a finished task.
444
+ status.state = 'completed';
445
+ completeTaskMetrics();
442
446
  writeStatus(statusPatch);
443
447
  out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
444
448
  process.exit(0);
@@ -954,7 +958,6 @@ if (hookInput.action === 'end_human_gate') {
954
958
  if (dispatchReadyWave()) process.exit(0);
955
959
  if (pendingStepIndexes().length === 0) {
956
960
  status.state = 'completed';
957
- completeTaskMetrics();
958
961
  completePipeline({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
959
962
  }
960
963
  out(noProgressNotice());
@@ -980,7 +983,6 @@ if (hookInput.action === 'end_human_gate') {
980
983
  // Gate on the final step: no executable step remains. Complete the
981
984
  // pipeline instead of leaving it in_progress forever.
982
985
  status.state = 'completed';
983
- completeTaskMetrics();
984
986
  completePipeline({
985
987
  pipelineIndex: resumeSteps.length,
986
988
  phase: 'done',
@@ -1291,7 +1293,6 @@ if (waveIndexes) {
1291
1293
  process.exit(0);
1292
1294
  }
1293
1295
  if (pendingStepIndexes().length === 0) {
1294
- completeTaskMetrics();
1295
1296
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1296
1297
  }
1297
1298
  out(noProgressNotice());
@@ -1405,7 +1406,6 @@ if (isGraphMode()) {
1405
1406
  }
1406
1407
  if (dispatchReadyWave()) process.exit(0);
1407
1408
  if (pendingStepIndexes().length === 0) {
1408
- completeTaskMetrics();
1409
1409
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1410
1410
  }
1411
1411
  out(noProgressNotice());
@@ -1414,7 +1414,6 @@ if (isGraphMode()) {
1414
1414
 
1415
1415
  const next = findNextExecutableStep(steps, idx + 1, taskDir);
1416
1416
  if (!next) {
1417
- completeTaskMetrics();
1418
1417
  completePipeline({
1419
1418
  pipelineIndex: steps.length,
1420
1419
  phase: 'done',
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
 
10
10
  export const PACKAGE_NAME = '@bonesofspring/ai-rules';
11
11
  export const REGISTRY_URL = 'https://registry.npmjs.org/@bonesofspring/ai-rules/latest';
12
- export const CACHE_TTL_MS = 12 * 60 * 60 * 1000;
12
+ export const CACHE_TTL_MS = 60 * 60 * 1000;
13
13
  export const TOOL_ROOTS = ['.cursor', '.claude', '.mavis', '.opencode'];
14
14
 
15
15
  const RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
@@ -438,6 +438,10 @@ function completePipeline(statusPatch) {
438
438
  out(`Pipeline blocked for "${slug}": .ai.local/pipeline-gates.json requireArtifacts missing completed receipt(s): ${missing.join(', ')}.`);
439
439
  process.exit(0);
440
440
  }
441
+ // task_completed is written only on this branch. A missing receipt blocks
442
+ // above and must not be counted as a finished task.
443
+ status.state = 'completed';
444
+ completeTaskMetrics();
441
445
  writeStatus(statusPatch);
442
446
  out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
443
447
  process.exit(0);
@@ -949,7 +953,6 @@ if (hookInput.action === 'end_human_gate') {
949
953
  if (dispatchReadyWave()) process.exit(0);
950
954
  if (pendingStepIndexes().length === 0) {
951
955
  status.state = 'completed';
952
- completeTaskMetrics();
953
956
  completePipeline({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
954
957
  }
955
958
  out(noProgressNotice());
@@ -975,7 +978,6 @@ if (hookInput.action === 'end_human_gate') {
975
978
  // Gate on the final step: no executable step remains. Complete the
976
979
  // pipeline instead of leaving it in_progress forever.
977
980
  status.state = 'completed';
978
- completeTaskMetrics();
979
981
  completePipeline({
980
982
  pipelineIndex: resumeSteps.length,
981
983
  phase: 'done',
@@ -1286,7 +1288,6 @@ if (waveIndexes) {
1286
1288
  process.exit(0);
1287
1289
  }
1288
1290
  if (pendingStepIndexes().length === 0) {
1289
- completeTaskMetrics();
1290
1291
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1291
1292
  }
1292
1293
  out(noProgressNotice());
@@ -1400,7 +1401,6 @@ if (isGraphMode()) {
1400
1401
  }
1401
1402
  if (dispatchReadyWave()) process.exit(0);
1402
1403
  if (pendingStepIndexes().length === 0) {
1403
- completeTaskMetrics();
1404
1404
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1405
1405
  }
1406
1406
  out(noProgressNotice());
@@ -1409,7 +1409,6 @@ if (isGraphMode()) {
1409
1409
 
1410
1410
  const next = findNextExecutableStep(steps, idx + 1, taskDir);
1411
1411
  if (!next) {
1412
- completeTaskMetrics();
1413
1412
  completePipeline({
1414
1413
  pipelineIndex: steps.length,
1415
1414
  phase: 'done',
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
 
10
10
  export const PACKAGE_NAME = '@bonesofspring/ai-rules';
11
11
  export const REGISTRY_URL = 'https://registry.npmjs.org/@bonesofspring/ai-rules/latest';
12
- export const CACHE_TTL_MS = 12 * 60 * 60 * 1000;
12
+ export const CACHE_TTL_MS = 60 * 60 * 1000;
13
13
  export const TOOL_ROOTS = ['.cursor', '.claude', '.mavis', '.opencode'];
14
14
 
15
15
  const RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
@@ -439,6 +439,10 @@ function completePipeline(statusPatch) {
439
439
  out(`Pipeline blocked for "${slug}": .ai.local/pipeline-gates.json requireArtifacts missing completed receipt(s): ${missing.join(', ')}.`);
440
440
  process.exit(0);
441
441
  }
442
+ // task_completed is written only on this branch. A missing receipt blocks
443
+ // above and must not be counted as a finished task.
444
+ status.state = 'completed';
445
+ completeTaskMetrics();
442
446
  writeStatus(statusPatch);
443
447
  out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
444
448
  process.exit(0);
@@ -954,7 +958,6 @@ if (hookInput.action === 'end_human_gate') {
954
958
  if (dispatchReadyWave()) process.exit(0);
955
959
  if (pendingStepIndexes().length === 0) {
956
960
  status.state = 'completed';
957
- completeTaskMetrics();
958
961
  completePipeline({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
959
962
  }
960
963
  out(noProgressNotice());
@@ -980,7 +983,6 @@ if (hookInput.action === 'end_human_gate') {
980
983
  // Gate on the final step: no executable step remains. Complete the
981
984
  // pipeline instead of leaving it in_progress forever.
982
985
  status.state = 'completed';
983
- completeTaskMetrics();
984
986
  completePipeline({
985
987
  pipelineIndex: resumeSteps.length,
986
988
  phase: 'done',
@@ -1291,7 +1293,6 @@ if (waveIndexes) {
1291
1293
  process.exit(0);
1292
1294
  }
1293
1295
  if (pendingStepIndexes().length === 0) {
1294
- completeTaskMetrics();
1295
1296
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1296
1297
  }
1297
1298
  out(noProgressNotice());
@@ -1405,7 +1406,6 @@ if (isGraphMode()) {
1405
1406
  }
1406
1407
  if (dispatchReadyWave()) process.exit(0);
1407
1408
  if (pendingStepIndexes().length === 0) {
1408
- completeTaskMetrics();
1409
1409
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1410
1410
  }
1411
1411
  out(noProgressNotice());
@@ -1414,7 +1414,6 @@ if (isGraphMode()) {
1414
1414
 
1415
1415
  const next = findNextExecutableStep(steps, idx + 1, taskDir);
1416
1416
  if (!next) {
1417
- completeTaskMetrics();
1418
1417
  completePipeline({
1419
1418
  pipelineIndex: steps.length,
1420
1419
  phase: 'done',
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
 
10
10
  export const PACKAGE_NAME = '@bonesofspring/ai-rules';
11
11
  export const REGISTRY_URL = 'https://registry.npmjs.org/@bonesofspring/ai-rules/latest';
12
- export const CACHE_TTL_MS = 12 * 60 * 60 * 1000;
12
+ export const CACHE_TTL_MS = 60 * 60 * 1000;
13
13
  export const TOOL_ROOTS = ['.cursor', '.claude', '.mavis', '.opencode'];
14
14
 
15
15
  const RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
@@ -438,6 +438,10 @@ function completePipeline(statusPatch) {
438
438
  out(`Pipeline blocked for "${slug}": .ai.local/pipeline-gates.json requireArtifacts missing completed receipt(s): ${missing.join(', ')}.`);
439
439
  process.exit(0);
440
440
  }
441
+ // task_completed is written only on this branch. A missing receipt blocks
442
+ // above and must not be counted as a finished task.
443
+ status.state = 'completed';
444
+ completeTaskMetrics();
441
445
  writeStatus(statusPatch);
442
446
  out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
443
447
  process.exit(0);
@@ -949,7 +953,6 @@ if (hookInput.action === 'end_human_gate') {
949
953
  if (dispatchReadyWave()) process.exit(0);
950
954
  if (pendingStepIndexes().length === 0) {
951
955
  status.state = 'completed';
952
- completeTaskMetrics();
953
956
  completePipeline({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
954
957
  }
955
958
  out(noProgressNotice());
@@ -975,7 +978,6 @@ if (hookInput.action === 'end_human_gate') {
975
978
  // Gate on the final step: no executable step remains. Complete the
976
979
  // pipeline instead of leaving it in_progress forever.
977
980
  status.state = 'completed';
978
- completeTaskMetrics();
979
981
  completePipeline({
980
982
  pipelineIndex: resumeSteps.length,
981
983
  phase: 'done',
@@ -1286,7 +1288,6 @@ if (waveIndexes) {
1286
1288
  process.exit(0);
1287
1289
  }
1288
1290
  if (pendingStepIndexes().length === 0) {
1289
- completeTaskMetrics();
1290
1291
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1291
1292
  }
1292
1293
  out(noProgressNotice());
@@ -1400,7 +1401,6 @@ if (isGraphMode()) {
1400
1401
  }
1401
1402
  if (dispatchReadyWave()) process.exit(0);
1402
1403
  if (pendingStepIndexes().length === 0) {
1403
- completeTaskMetrics();
1404
1404
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1405
1405
  }
1406
1406
  out(noProgressNotice());
@@ -1409,7 +1409,6 @@ if (isGraphMode()) {
1409
1409
 
1410
1410
  const next = findNextExecutableStep(steps, idx + 1, taskDir);
1411
1411
  if (!next) {
1412
- completeTaskMetrics();
1413
1412
  completePipeline({
1414
1413
  pipelineIndex: steps.length,
1415
1414
  phase: 'done',
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
 
10
10
  export const PACKAGE_NAME = '@bonesofspring/ai-rules';
11
11
  export const REGISTRY_URL = 'https://registry.npmjs.org/@bonesofspring/ai-rules/latest';
12
- export const CACHE_TTL_MS = 12 * 60 * 60 * 1000;
12
+ export const CACHE_TTL_MS = 60 * 60 * 1000;
13
13
  export const TOOL_ROOTS = ['.cursor', '.claude', '.mavis', '.opencode'];
14
14
 
15
15
  const RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
@@ -426,6 +426,10 @@ function completePipeline(statusPatch) {
426
426
  out(`Pipeline blocked for "${slug}": .ai.local/pipeline-gates.json requireArtifacts missing completed receipt(s): ${missing.join(', ')}.`);
427
427
  process.exit(0);
428
428
  }
429
+ // task_completed is written only on this branch. A missing receipt blocks
430
+ // above and must not be counted as a finished task.
431
+ status.state = 'completed';
432
+ completeTaskMetrics();
429
433
  writeStatus(statusPatch);
430
434
  out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
431
435
  process.exit(0);
@@ -896,7 +900,6 @@ if (hookInput.action === 'end_human_gate') {
896
900
  if (dispatchReadyWave()) process.exit(0);
897
901
  if (pendingStepIndexes().length === 0) {
898
902
  status.state = 'completed';
899
- completeTaskMetrics();
900
903
  completePipeline({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
901
904
  }
902
905
  out(noProgressNotice());
@@ -922,7 +925,6 @@ if (hookInput.action === 'end_human_gate') {
922
925
  // Gate on the final step: no executable step remains. Complete the
923
926
  // pipeline instead of leaving it in_progress forever.
924
927
  status.state = 'completed';
925
- completeTaskMetrics();
926
928
  completePipeline({
927
929
  pipelineIndex: resumeSteps.length,
928
930
  phase: 'done',
@@ -1233,7 +1235,6 @@ if (waveIndexes) {
1233
1235
  process.exit(0);
1234
1236
  }
1235
1237
  if (pendingStepIndexes().length === 0) {
1236
- completeTaskMetrics();
1237
1238
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1238
1239
  }
1239
1240
  out(noProgressNotice());
@@ -1347,7 +1348,6 @@ if (isGraphMode()) {
1347
1348
  }
1348
1349
  if (dispatchReadyWave()) process.exit(0);
1349
1350
  if (pendingStepIndexes().length === 0) {
1350
- completeTaskMetrics();
1351
1351
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1352
1352
  }
1353
1353
  out(noProgressNotice());
@@ -1356,7 +1356,6 @@ if (isGraphMode()) {
1356
1356
 
1357
1357
  const next = findNextExecutableStep(steps, idx + 1, taskDir);
1358
1358
  if (!next) {
1359
- completeTaskMetrics();
1360
1359
  completePipeline({
1361
1360
  pipelineIndex: steps.length,
1362
1361
  phase: 'done',
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
 
10
10
  export const PACKAGE_NAME = '@bonesofspring/ai-rules';
11
11
  export const REGISTRY_URL = 'https://registry.npmjs.org/@bonesofspring/ai-rules/latest';
12
- export const CACHE_TTL_MS = 12 * 60 * 60 * 1000;
12
+ export const CACHE_TTL_MS = 60 * 60 * 1000;
13
13
  export const TOOL_ROOTS = ['.cursor', '.claude', '.mavis', '.opencode'];
14
14
 
15
15
  const RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
@@ -439,6 +439,10 @@ function completePipeline(statusPatch) {
439
439
  out(`Pipeline blocked for "${slug}": .ai.local/pipeline-gates.json requireArtifacts missing completed receipt(s): ${missing.join(', ')}.`);
440
440
  process.exit(0);
441
441
  }
442
+ // task_completed is written only on this branch. A missing receipt blocks
443
+ // above and must not be counted as a finished task.
444
+ status.state = 'completed';
445
+ completeTaskMetrics();
442
446
  writeStatus(statusPatch);
443
447
  out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
444
448
  process.exit(0);
@@ -952,7 +956,6 @@ if (hookInput.action === 'end_human_gate') {
952
956
  if (dispatchReadyWave()) process.exit(0);
953
957
  if (pendingStepIndexes().length === 0) {
954
958
  status.state = 'completed';
955
- completeTaskMetrics();
956
959
  completePipeline({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
957
960
  }
958
961
  out(noProgressNotice());
@@ -978,7 +981,6 @@ if (hookInput.action === 'end_human_gate') {
978
981
  // Gate on the final step: no executable step remains. Complete the
979
982
  // pipeline instead of leaving it in_progress forever.
980
983
  status.state = 'completed';
981
- completeTaskMetrics();
982
984
  completePipeline({
983
985
  pipelineIndex: resumeSteps.length,
984
986
  phase: 'done',
@@ -1289,7 +1291,6 @@ if (waveIndexes) {
1289
1291
  process.exit(0);
1290
1292
  }
1291
1293
  if (pendingStepIndexes().length === 0) {
1292
- completeTaskMetrics();
1293
1294
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1294
1295
  }
1295
1296
  out(noProgressNotice());
@@ -1403,7 +1404,6 @@ if (isGraphMode()) {
1403
1404
  }
1404
1405
  if (dispatchReadyWave()) process.exit(0);
1405
1406
  if (pendingStepIndexes().length === 0) {
1406
- completeTaskMetrics();
1407
1407
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1408
1408
  }
1409
1409
  out(noProgressNotice());
@@ -1412,7 +1412,6 @@ if (isGraphMode()) {
1412
1412
 
1413
1413
  const next = findNextExecutableStep(steps, idx + 1, taskDir);
1414
1414
  if (!next) {
1415
- completeTaskMetrics();
1416
1415
  completePipeline({
1417
1416
  pipelineIndex: steps.length,
1418
1417
  phase: 'done',
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
 
10
10
  export const PACKAGE_NAME = '@bonesofspring/ai-rules';
11
11
  export const REGISTRY_URL = 'https://registry.npmjs.org/@bonesofspring/ai-rules/latest';
12
- export const CACHE_TTL_MS = 12 * 60 * 60 * 1000;
12
+ export const CACHE_TTL_MS = 60 * 60 * 1000;
13
13
  export const TOOL_ROOTS = ['.cursor', '.claude', '.mavis', '.opencode'];
14
14
 
15
15
  const RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
@@ -439,6 +439,10 @@ function completePipeline(statusPatch) {
439
439
  out(`Pipeline blocked for "${slug}": .ai.local/pipeline-gates.json requireArtifacts missing completed receipt(s): ${missing.join(', ')}.`);
440
440
  process.exit(0);
441
441
  }
442
+ // task_completed is written only on this branch. A missing receipt blocks
443
+ // above and must not be counted as a finished task.
444
+ status.state = 'completed';
445
+ completeTaskMetrics();
442
446
  writeStatus(statusPatch);
443
447
  out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
444
448
  process.exit(0);
@@ -952,7 +956,6 @@ if (hookInput.action === 'end_human_gate') {
952
956
  if (dispatchReadyWave()) process.exit(0);
953
957
  if (pendingStepIndexes().length === 0) {
954
958
  status.state = 'completed';
955
- completeTaskMetrics();
956
959
  completePipeline({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
957
960
  }
958
961
  out(noProgressNotice());
@@ -978,7 +981,6 @@ if (hookInput.action === 'end_human_gate') {
978
981
  // Gate on the final step: no executable step remains. Complete the
979
982
  // pipeline instead of leaving it in_progress forever.
980
983
  status.state = 'completed';
981
- completeTaskMetrics();
982
984
  completePipeline({
983
985
  pipelineIndex: resumeSteps.length,
984
986
  phase: 'done',
@@ -1289,7 +1291,6 @@ if (waveIndexes) {
1289
1291
  process.exit(0);
1290
1292
  }
1291
1293
  if (pendingStepIndexes().length === 0) {
1292
- completeTaskMetrics();
1293
1294
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1294
1295
  }
1295
1296
  out(noProgressNotice());
@@ -1403,7 +1404,6 @@ if (isGraphMode()) {
1403
1404
  }
1404
1405
  if (dispatchReadyWave()) process.exit(0);
1405
1406
  if (pendingStepIndexes().length === 0) {
1406
- completeTaskMetrics();
1407
1407
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1408
1408
  }
1409
1409
  out(noProgressNotice());
@@ -1412,7 +1412,6 @@ if (isGraphMode()) {
1412
1412
 
1413
1413
  const next = findNextExecutableStep(steps, idx + 1, taskDir);
1414
1414
  if (!next) {
1415
- completeTaskMetrics();
1416
1415
  completePipeline({
1417
1416
  pipelineIndex: steps.length,
1418
1417
  phase: 'done',
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
 
10
10
  export const PACKAGE_NAME = '@bonesofspring/ai-rules';
11
11
  export const REGISTRY_URL = 'https://registry.npmjs.org/@bonesofspring/ai-rules/latest';
12
- export const CACHE_TTL_MS = 12 * 60 * 60 * 1000;
12
+ export const CACHE_TTL_MS = 60 * 60 * 1000;
13
13
  export const TOOL_ROOTS = ['.cursor', '.claude', '.mavis', '.opencode'];
14
14
 
15
15
  const RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
@@ -439,6 +439,10 @@ function completePipeline(statusPatch) {
439
439
  out(`Pipeline blocked for "${slug}": .ai.local/pipeline-gates.json requireArtifacts missing completed receipt(s): ${missing.join(', ')}.`);
440
440
  process.exit(0);
441
441
  }
442
+ // task_completed is written only on this branch. A missing receipt blocks
443
+ // above and must not be counted as a finished task.
444
+ status.state = 'completed';
445
+ completeTaskMetrics();
442
446
  writeStatus(statusPatch);
443
447
  out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
444
448
  process.exit(0);
@@ -950,7 +954,6 @@ if (hookInput.action === 'end_human_gate') {
950
954
  if (dispatchReadyWave()) process.exit(0);
951
955
  if (pendingStepIndexes().length === 0) {
952
956
  status.state = 'completed';
953
- completeTaskMetrics();
954
957
  completePipeline({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
955
958
  }
956
959
  out(noProgressNotice());
@@ -976,7 +979,6 @@ if (hookInput.action === 'end_human_gate') {
976
979
  // Gate on the final step: no executable step remains. Complete the
977
980
  // pipeline instead of leaving it in_progress forever.
978
981
  status.state = 'completed';
979
- completeTaskMetrics();
980
982
  completePipeline({
981
983
  pipelineIndex: resumeSteps.length,
982
984
  phase: 'done',
@@ -1287,7 +1289,6 @@ if (waveIndexes) {
1287
1289
  process.exit(0);
1288
1290
  }
1289
1291
  if (pendingStepIndexes().length === 0) {
1290
- completeTaskMetrics();
1291
1292
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1292
1293
  }
1293
1294
  out(noProgressNotice());
@@ -1401,7 +1402,6 @@ if (isGraphMode()) {
1401
1402
  }
1402
1403
  if (dispatchReadyWave()) process.exit(0);
1403
1404
  if (pendingStepIndexes().length === 0) {
1404
- completeTaskMetrics();
1405
1405
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1406
1406
  }
1407
1407
  out(noProgressNotice());
@@ -1410,7 +1410,6 @@ if (isGraphMode()) {
1410
1410
 
1411
1411
  const next = findNextExecutableStep(steps, idx + 1, taskDir);
1412
1412
  if (!next) {
1413
- completeTaskMetrics();
1414
1413
  completePipeline({
1415
1414
  pipelineIndex: steps.length,
1416
1415
  phase: 'done',
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
 
10
10
  export const PACKAGE_NAME = '@bonesofspring/ai-rules';
11
11
  export const REGISTRY_URL = 'https://registry.npmjs.org/@bonesofspring/ai-rules/latest';
12
- export const CACHE_TTL_MS = 12 * 60 * 60 * 1000;
12
+ export const CACHE_TTL_MS = 60 * 60 * 1000;
13
13
  export const TOOL_ROOTS = ['.cursor', '.claude', '.mavis', '.opencode'];
14
14
 
15
15
  const RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
@@ -439,6 +439,10 @@ function completePipeline(statusPatch) {
439
439
  out(`Pipeline blocked for "${slug}": .ai.local/pipeline-gates.json requireArtifacts missing completed receipt(s): ${missing.join(', ')}.`);
440
440
  process.exit(0);
441
441
  }
442
+ // task_completed is written only on this branch. A missing receipt blocks
443
+ // above and must not be counted as a finished task.
444
+ status.state = 'completed';
445
+ completeTaskMetrics();
442
446
  writeStatus(statusPatch);
443
447
  out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
444
448
  process.exit(0);
@@ -950,7 +954,6 @@ if (hookInput.action === 'end_human_gate') {
950
954
  if (dispatchReadyWave()) process.exit(0);
951
955
  if (pendingStepIndexes().length === 0) {
952
956
  status.state = 'completed';
953
- completeTaskMetrics();
954
957
  completePipeline({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
955
958
  }
956
959
  out(noProgressNotice());
@@ -976,7 +979,6 @@ if (hookInput.action === 'end_human_gate') {
976
979
  // Gate on the final step: no executable step remains. Complete the
977
980
  // pipeline instead of leaving it in_progress forever.
978
981
  status.state = 'completed';
979
- completeTaskMetrics();
980
982
  completePipeline({
981
983
  pipelineIndex: resumeSteps.length,
982
984
  phase: 'done',
@@ -1287,7 +1289,6 @@ if (waveIndexes) {
1287
1289
  process.exit(0);
1288
1290
  }
1289
1291
  if (pendingStepIndexes().length === 0) {
1290
- completeTaskMetrics();
1291
1292
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1292
1293
  }
1293
1294
  out(noProgressNotice());
@@ -1401,7 +1402,6 @@ if (isGraphMode()) {
1401
1402
  }
1402
1403
  if (dispatchReadyWave()) process.exit(0);
1403
1404
  if (pendingStepIndexes().length === 0) {
1404
- completeTaskMetrics();
1405
1405
  completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
1406
1406
  }
1407
1407
  out(noProgressNotice());
@@ -1410,7 +1410,6 @@ if (isGraphMode()) {
1410
1410
 
1411
1411
  const next = findNextExecutableStep(steps, idx + 1, taskDir);
1412
1412
  if (!next) {
1413
- completeTaskMetrics();
1414
1413
  completePipeline({
1415
1414
  pipelineIndex: steps.length,
1416
1415
  phase: 'done',
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
 
10
10
  export const PACKAGE_NAME = '@bonesofspring/ai-rules';
11
11
  export const REGISTRY_URL = 'https://registry.npmjs.org/@bonesofspring/ai-rules/latest';
12
- export const CACHE_TTL_MS = 12 * 60 * 60 * 1000;
12
+ export const CACHE_TTL_MS = 60 * 60 * 1000;
13
13
  export const TOOL_ROOTS = ['.cursor', '.claude', '.mavis', '.opencode'];
14
14
 
15
15
  const RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;