ocs-stats 1.1.6 → 1.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocs-stats",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "OpenCode Skills - One-click installer with gamified XP stats",
5
5
  "type": "module",
6
6
  "bin": {
package/src/merge.js CHANGED
@@ -65,7 +65,7 @@ function compareVersion(v1, v2) {
65
65
 
66
66
  function smartMergeXp(userXp, templateXp) {
67
67
  const preserveFields = [
68
- 'xp', 'level', 'title', 'totalTests', 'totalAudits',
68
+ 'xp', 'totalTests', 'totalAudits',
69
69
  'testsWritten', 'issuesFixed', 'testsFixed', 'patternsAdded',
70
70
  'completedSuites', 'completedAudits', 'seenPatterns', 'seenIssues',
71
71
  'mistakes', 'mistakeHistory', 'levelHistory'
@@ -79,6 +79,25 @@ function smartMergeXp(userXp, templateXp) {
79
79
  }
80
80
  }
81
81
 
82
+ merged.xpTable = templateXp.xpTable;
83
+ merged.levelThresholds = templateXp.levelThresholds;
84
+
85
+ const userXpValue = userXp.xp || 0;
86
+ merged.xp = userXpValue;
87
+
88
+ const thresholds = templateXp.levelThresholds || [];
89
+ let newLevel = 1;
90
+ let newTitle = 'Novice';
91
+ for (let i = thresholds.length - 1; i >= 0; i--) {
92
+ if (userXpValue >= thresholds[i].xpRequired) {
93
+ newLevel = thresholds[i].level;
94
+ newTitle = thresholds[i].title;
95
+ break;
96
+ }
97
+ }
98
+ merged.level = newLevel;
99
+ merged.title = newTitle;
100
+
82
101
  return merged;
83
102
  }
84
103
 
@@ -1,3 +1,4 @@
1
+ 1.1.7: Fix level recalculation during smart merge
1
2
  1.1.6: Smart merge - preserves XP, level, memories; updates template fields
2
3
  1.1.5: Git-like update - version tracking, --check/--force flags
3
4
  1.1.4: Testing agent - XP system, Playwright integration