@boshu2/vibe-check 1.4.0 → 1.6.0

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 (188) hide show
  1. package/.agents/bundles/insight-mining-dashboard-research-2025-11-30.md +400 -0
  2. package/.agents/bundles/storage-enhancement-research-2025-11-30.md +292 -0
  3. package/.agents/bundles/timeline-feature-research-complete-2025-11-30.md +301 -0
  4. package/.agents/plans/insight-dashboard-plan-2025-11-30.md +1130 -0
  5. package/.agents/plans/json-storage-enhancement-plan.md +717 -0
  6. package/.agents/plans/storage-hardening-and-cache-plan.md +592 -0
  7. package/.agents/plans/test-coverage-gaps-plan.md +1117 -0
  8. package/.agents/plans/timeline-feature-plan.md +193 -0
  9. package/.agents/plans/vibe_timeline_research_findings.md +553 -0
  10. package/.claude/settings.local.json +1 -0
  11. package/.vibe-check/.gitignore +6 -0
  12. package/CHANGELOG.md +46 -0
  13. package/CLAUDE.md +24 -0
  14. package/CONTRIBUTING.md +227 -0
  15. package/README.md +200 -143
  16. package/claude-progress.json +200 -12
  17. package/claude-progress.txt +310 -0
  18. package/dashboard/app.js +75 -2
  19. package/dashboard/dashboard-data.json +653 -0
  20. package/dashboard/index.html +13 -0
  21. package/dashboard/styles.css +61 -0
  22. package/dist/analysis/cross-session-analysis.d.ts +68 -0
  23. package/dist/analysis/cross-session-analysis.d.ts.map +1 -0
  24. package/dist/analysis/cross-session-analysis.js +174 -0
  25. package/dist/analysis/cross-session-analysis.js.map +1 -0
  26. package/dist/analysis/index.d.ts +2 -0
  27. package/dist/analysis/index.d.ts.map +1 -0
  28. package/dist/analysis/index.js +12 -0
  29. package/dist/analysis/index.js.map +1 -0
  30. package/dist/cli.js +10 -1
  31. package/dist/cli.js.map +1 -1
  32. package/dist/commands/analyze.d.ts +2 -0
  33. package/dist/commands/analyze.d.ts.map +1 -1
  34. package/dist/commands/analyze.js +105 -2
  35. package/dist/commands/analyze.js.map +1 -1
  36. package/dist/commands/cache.d.ts +6 -0
  37. package/dist/commands/cache.d.ts.map +1 -0
  38. package/dist/commands/cache.js +168 -0
  39. package/dist/commands/cache.js.map +1 -0
  40. package/dist/commands/dashboard.d.ts +8 -0
  41. package/dist/commands/dashboard.d.ts.map +1 -0
  42. package/dist/commands/dashboard.js +109 -0
  43. package/dist/commands/dashboard.js.map +1 -0
  44. package/dist/commands/index.d.ts +3 -0
  45. package/dist/commands/index.d.ts.map +1 -1
  46. package/dist/commands/index.js +8 -1
  47. package/dist/commands/index.js.map +1 -1
  48. package/dist/commands/profile.d.ts.map +1 -1
  49. package/dist/commands/profile.js +140 -31
  50. package/dist/commands/profile.js.map +1 -1
  51. package/dist/commands/timeline.d.ts +14 -0
  52. package/dist/commands/timeline.d.ts.map +1 -0
  53. package/dist/commands/timeline.js +462 -0
  54. package/dist/commands/timeline.js.map +1 -0
  55. package/dist/gamification/badges.d.ts +29 -0
  56. package/dist/gamification/badges.d.ts.map +1 -0
  57. package/dist/gamification/badges.js +114 -0
  58. package/dist/gamification/badges.js.map +1 -0
  59. package/dist/gamification/challenges.d.ts +42 -0
  60. package/dist/gamification/challenges.d.ts.map +1 -0
  61. package/dist/gamification/challenges.js +184 -0
  62. package/dist/gamification/challenges.js.map +1 -0
  63. package/dist/gamification/hall-of-fame.d.ts +17 -0
  64. package/dist/gamification/hall-of-fame.d.ts.map +1 -0
  65. package/dist/gamification/hall-of-fame.js +64 -0
  66. package/dist/gamification/hall-of-fame.js.map +1 -0
  67. package/dist/gamification/leaderboards.d.ts +49 -0
  68. package/dist/gamification/leaderboards.d.ts.map +1 -0
  69. package/dist/gamification/leaderboards.js +179 -0
  70. package/dist/gamification/leaderboards.js.map +1 -0
  71. package/dist/gamification/share.d.ts +29 -0
  72. package/dist/gamification/share.d.ts.map +1 -0
  73. package/dist/gamification/share.js +57 -0
  74. package/dist/gamification/share.js.map +1 -0
  75. package/dist/gamification/stats.d.ts +34 -0
  76. package/dist/gamification/stats.d.ts.map +1 -0
  77. package/dist/gamification/stats.js +91 -0
  78. package/dist/gamification/stats.js.map +1 -0
  79. package/dist/gamification/streaks.d.ts +9 -1
  80. package/dist/gamification/streaks.d.ts.map +1 -1
  81. package/dist/gamification/streaks.js +37 -4
  82. package/dist/gamification/streaks.js.map +1 -1
  83. package/dist/gamification/types.d.ts +35 -0
  84. package/dist/gamification/types.d.ts.map +1 -1
  85. package/dist/gamification/types.js +11 -3
  86. package/dist/gamification/types.js.map +1 -1
  87. package/dist/gamification/xp.d.ts +6 -2
  88. package/dist/gamification/xp.d.ts.map +1 -1
  89. package/dist/gamification/xp.js +27 -5
  90. package/dist/gamification/xp.js.map +1 -1
  91. package/dist/git.d.ts +24 -0
  92. package/dist/git.d.ts.map +1 -1
  93. package/dist/git.js +94 -0
  94. package/dist/git.js.map +1 -1
  95. package/dist/insights/generators.d.ts +44 -0
  96. package/dist/insights/generators.d.ts.map +1 -0
  97. package/dist/insights/generators.js +289 -0
  98. package/dist/insights/generators.js.map +1 -0
  99. package/dist/insights/index.d.ts +16 -0
  100. package/dist/insights/index.d.ts.map +1 -0
  101. package/dist/insights/index.js +171 -0
  102. package/dist/insights/index.js.map +1 -0
  103. package/dist/insights/types.d.ts +93 -0
  104. package/dist/insights/types.d.ts.map +1 -0
  105. package/dist/insights/types.js +6 -0
  106. package/dist/insights/types.js.map +1 -0
  107. package/dist/output/terminal.d.ts.map +1 -1
  108. package/dist/output/terminal.js +39 -0
  109. package/dist/output/terminal.js.map +1 -1
  110. package/dist/output/timeline-html.d.ts +6 -0
  111. package/dist/output/timeline-html.d.ts.map +1 -0
  112. package/dist/output/timeline-html.js +389 -0
  113. package/dist/output/timeline-html.js.map +1 -0
  114. package/dist/output/timeline-markdown.d.ts +6 -0
  115. package/dist/output/timeline-markdown.d.ts.map +1 -0
  116. package/dist/output/timeline-markdown.js +167 -0
  117. package/dist/output/timeline-markdown.js.map +1 -0
  118. package/dist/output/timeline.d.ts +9 -0
  119. package/dist/output/timeline.d.ts.map +1 -0
  120. package/dist/output/timeline.js +318 -0
  121. package/dist/output/timeline.js.map +1 -0
  122. package/dist/patterns/detour.d.ts +32 -0
  123. package/dist/patterns/detour.d.ts.map +1 -0
  124. package/dist/patterns/detour.js +137 -0
  125. package/dist/patterns/detour.js.map +1 -0
  126. package/dist/patterns/flow-state.d.ts +16 -0
  127. package/dist/patterns/flow-state.d.ts.map +1 -0
  128. package/dist/patterns/flow-state.js +40 -0
  129. package/dist/patterns/flow-state.js.map +1 -0
  130. package/dist/patterns/index.d.ts +8 -0
  131. package/dist/patterns/index.d.ts.map +1 -0
  132. package/dist/patterns/index.js +22 -0
  133. package/dist/patterns/index.js.map +1 -0
  134. package/dist/patterns/intervention-effectiveness.d.ts +42 -0
  135. package/dist/patterns/intervention-effectiveness.d.ts.map +1 -0
  136. package/dist/patterns/intervention-effectiveness.js +196 -0
  137. package/dist/patterns/intervention-effectiveness.js.map +1 -0
  138. package/dist/patterns/late-night.d.ts +30 -0
  139. package/dist/patterns/late-night.d.ts.map +1 -0
  140. package/dist/patterns/late-night.js +141 -0
  141. package/dist/patterns/late-night.js.map +1 -0
  142. package/dist/patterns/post-delete-sprint.d.ts +28 -0
  143. package/dist/patterns/post-delete-sprint.d.ts.map +1 -0
  144. package/dist/patterns/post-delete-sprint.js +85 -0
  145. package/dist/patterns/post-delete-sprint.js.map +1 -0
  146. package/dist/patterns/spiral-regression.d.ts +49 -0
  147. package/dist/patterns/spiral-regression.d.ts.map +1 -0
  148. package/dist/patterns/spiral-regression.js +219 -0
  149. package/dist/patterns/spiral-regression.js.map +1 -0
  150. package/dist/patterns/thrashing.d.ts +25 -0
  151. package/dist/patterns/thrashing.d.ts.map +1 -0
  152. package/dist/patterns/thrashing.js +111 -0
  153. package/dist/patterns/thrashing.js.map +1 -0
  154. package/dist/storage/atomic.d.ts +40 -0
  155. package/dist/storage/atomic.d.ts.map +1 -0
  156. package/dist/storage/atomic.js +155 -0
  157. package/dist/storage/atomic.js.map +1 -0
  158. package/dist/storage/commit-log.d.ts +35 -0
  159. package/dist/storage/commit-log.d.ts.map +1 -0
  160. package/dist/storage/commit-log.js +128 -0
  161. package/dist/storage/commit-log.js.map +1 -0
  162. package/dist/storage/index.d.ts +5 -0
  163. package/dist/storage/index.d.ts.map +1 -0
  164. package/dist/storage/index.js +33 -0
  165. package/dist/storage/index.js.map +1 -0
  166. package/dist/storage/schema.d.ts +32 -0
  167. package/dist/storage/schema.d.ts.map +1 -0
  168. package/dist/storage/schema.js +37 -0
  169. package/dist/storage/schema.js.map +1 -0
  170. package/dist/storage/timeline-store.d.ts +117 -0
  171. package/dist/storage/timeline-store.d.ts.map +1 -0
  172. package/dist/storage/timeline-store.js +438 -0
  173. package/dist/storage/timeline-store.js.map +1 -0
  174. package/dist/types.d.ts +96 -0
  175. package/dist/types.d.ts.map +1 -1
  176. package/docs/ARCHITECTURE.md +458 -0
  177. package/docs/DATA-ARCHITECTURE.md +565 -0
  178. package/docs/GAMIFICATION.md +564 -0
  179. package/docs/JSON-STORAGE-PATTERNS.md +512 -0
  180. package/docs/METRICS-EXPLAINED.md +394 -0
  181. package/docs/UNIFIED-ECOSYSTEM.md +560 -0
  182. package/docs/VIBE-ECOSYSTEM.md +406 -0
  183. package/feature-list.json +103 -1
  184. package/package.json +2 -1
  185. package/vitest.config.ts +1 -5
  186. package/.vibe-check/calibration.json +0 -38
  187. package/.vibe-check/latest.json +0 -114
  188. package/.vibe-check/sessions.json +0 -34
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.getCommitLogPath = getCommitLogPath;
37
+ exports.appendCommits = appendCommits;
38
+ exports.readCommitLog = readCommitLog;
39
+ exports.getLastLoggedCommitHash = getLastLoggedCommitHash;
40
+ exports.getCommitLogCount = getCommitLogCount;
41
+ /**
42
+ * Append-only commit log using NDJSON format.
43
+ * This is the source of truth - timeline.json is derived from this.
44
+ */
45
+ const path = __importStar(require("path"));
46
+ const atomic_1 = require("./atomic");
47
+ const STORE_DIR = '.vibe-check';
48
+ const COMMIT_LOG_FILE = 'commits.ndjson';
49
+ /**
50
+ * Get commit log file path
51
+ */
52
+ function getCommitLogPath(repoPath = process.cwd()) {
53
+ return path.join(repoPath, STORE_DIR, COMMIT_LOG_FILE);
54
+ }
55
+ /**
56
+ * Convert Commit to StoredCommit (compressed format)
57
+ */
58
+ function toStoredCommit(commit) {
59
+ return {
60
+ h: commit.hash,
61
+ d: commit.date.toISOString(),
62
+ m: commit.message,
63
+ t: commit.type,
64
+ s: commit.scope,
65
+ a: commit.author,
66
+ };
67
+ }
68
+ /**
69
+ * Convert StoredCommit back to Commit
70
+ */
71
+ function fromStoredCommit(stored) {
72
+ return {
73
+ hash: stored.h,
74
+ date: new Date(stored.d),
75
+ message: stored.m,
76
+ type: stored.t,
77
+ scope: stored.s,
78
+ author: stored.a,
79
+ };
80
+ }
81
+ /**
82
+ * Append new commits to the log.
83
+ * Skips commits that already exist (by hash).
84
+ */
85
+ function appendCommits(commits, repoPath = process.cwd()) {
86
+ const logPath = getCommitLogPath(repoPath);
87
+ // Load existing hashes to prevent duplicates
88
+ const existingHashes = new Set((0, atomic_1.readNdjsonSync)(logPath).map(c => c.h));
89
+ let appendedCount = 0;
90
+ for (const commit of commits) {
91
+ if (!existingHashes.has(commit.hash)) {
92
+ const stored = toStoredCommit(commit);
93
+ (0, atomic_1.appendLineSync)(logPath, JSON.stringify(stored));
94
+ existingHashes.add(commit.hash);
95
+ appendedCount++;
96
+ }
97
+ }
98
+ return appendedCount;
99
+ }
100
+ /**
101
+ * Read all commits from the log.
102
+ */
103
+ function readCommitLog(repoPath = process.cwd()) {
104
+ const logPath = getCommitLogPath(repoPath);
105
+ const stored = (0, atomic_1.readNdjsonSync)(logPath);
106
+ return stored.map(fromStoredCommit);
107
+ }
108
+ /**
109
+ * Get the most recent commit hash from the log.
110
+ * Returns empty string if log is empty.
111
+ */
112
+ function getLastLoggedCommitHash(repoPath = process.cwd()) {
113
+ const commits = readCommitLog(repoPath);
114
+ if (commits.length === 0)
115
+ return '';
116
+ // Sort by date descending and return most recent
117
+ const sorted = commits.sort((a, b) => b.date.getTime() - a.date.getTime());
118
+ return sorted[0].hash;
119
+ }
120
+ /**
121
+ * Get commit count in the log.
122
+ */
123
+ function getCommitLogCount(repoPath = process.cwd()) {
124
+ const logPath = getCommitLogPath(repoPath);
125
+ const commits = (0, atomic_1.readNdjsonSync)(logPath);
126
+ return commits.length;
127
+ }
128
+ //# sourceMappingURL=commit-log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-log.js","sourceRoot":"","sources":["../../src/storage/commit-log.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;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,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,WAAmB,OAAO,CAAC,GAAG,EAAE;IAChE,MAAM,OAAO,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,IAAA,uBAAc,EAAe,OAAO,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC,MAAM,CAAC;AACxB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { TimelineStore, StoredSession, StoredInsight, PatternStats, TrendData, WeekTrend, MonthTrend, loadStore, saveStore, createInitialStore, updateStore, getLastCommitHash, getStorePath, getStoreDir, } from './timeline-store';
2
+ export { atomicWriteSync, appendLineSync, readNdjsonSync, readNdjsonWithErrors, safeReadJsonSync, ensureGitignore, NdjsonReadResult, } from './atomic';
3
+ export { StoredCommit, getCommitLogPath, appendCommits, readCommitLog, getLastLoggedCommitHash, getCommitLogCount, } from './commit-log';
4
+ export { SchemaVersion, CURRENT_SCHEMA_VERSION, VersionedStore, migrateStore, needsMigration, } from './schema';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,cAAc,GACf,MAAM,UAAU,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.needsMigration = exports.migrateStore = exports.CURRENT_SCHEMA_VERSION = exports.getCommitLogCount = exports.getLastLoggedCommitHash = exports.readCommitLog = exports.appendCommits = exports.getCommitLogPath = exports.ensureGitignore = exports.safeReadJsonSync = exports.readNdjsonWithErrors = exports.readNdjsonSync = exports.appendLineSync = exports.atomicWriteSync = exports.getStoreDir = exports.getStorePath = exports.getLastCommitHash = exports.updateStore = exports.createInitialStore = exports.saveStore = exports.loadStore = void 0;
4
+ // Timeline store (computed view)
5
+ var timeline_store_1 = require("./timeline-store");
6
+ Object.defineProperty(exports, "loadStore", { enumerable: true, get: function () { return timeline_store_1.loadStore; } });
7
+ Object.defineProperty(exports, "saveStore", { enumerable: true, get: function () { return timeline_store_1.saveStore; } });
8
+ Object.defineProperty(exports, "createInitialStore", { enumerable: true, get: function () { return timeline_store_1.createInitialStore; } });
9
+ Object.defineProperty(exports, "updateStore", { enumerable: true, get: function () { return timeline_store_1.updateStore; } });
10
+ Object.defineProperty(exports, "getLastCommitHash", { enumerable: true, get: function () { return timeline_store_1.getLastCommitHash; } });
11
+ Object.defineProperty(exports, "getStorePath", { enumerable: true, get: function () { return timeline_store_1.getStorePath; } });
12
+ Object.defineProperty(exports, "getStoreDir", { enumerable: true, get: function () { return timeline_store_1.getStoreDir; } });
13
+ // Atomic file operations
14
+ var atomic_1 = require("./atomic");
15
+ Object.defineProperty(exports, "atomicWriteSync", { enumerable: true, get: function () { return atomic_1.atomicWriteSync; } });
16
+ Object.defineProperty(exports, "appendLineSync", { enumerable: true, get: function () { return atomic_1.appendLineSync; } });
17
+ Object.defineProperty(exports, "readNdjsonSync", { enumerable: true, get: function () { return atomic_1.readNdjsonSync; } });
18
+ Object.defineProperty(exports, "readNdjsonWithErrors", { enumerable: true, get: function () { return atomic_1.readNdjsonWithErrors; } });
19
+ Object.defineProperty(exports, "safeReadJsonSync", { enumerable: true, get: function () { return atomic_1.safeReadJsonSync; } });
20
+ Object.defineProperty(exports, "ensureGitignore", { enumerable: true, get: function () { return atomic_1.ensureGitignore; } });
21
+ // Commit log (NDJSON source of truth)
22
+ var commit_log_1 = require("./commit-log");
23
+ Object.defineProperty(exports, "getCommitLogPath", { enumerable: true, get: function () { return commit_log_1.getCommitLogPath; } });
24
+ Object.defineProperty(exports, "appendCommits", { enumerable: true, get: function () { return commit_log_1.appendCommits; } });
25
+ Object.defineProperty(exports, "readCommitLog", { enumerable: true, get: function () { return commit_log_1.readCommitLog; } });
26
+ Object.defineProperty(exports, "getLastLoggedCommitHash", { enumerable: true, get: function () { return commit_log_1.getLastLoggedCommitHash; } });
27
+ Object.defineProperty(exports, "getCommitLogCount", { enumerable: true, get: function () { return commit_log_1.getCommitLogCount; } });
28
+ // Schema versioning
29
+ var schema_1 = require("./schema");
30
+ Object.defineProperty(exports, "CURRENT_SCHEMA_VERSION", { enumerable: true, get: function () { return schema_1.CURRENT_SCHEMA_VERSION; } });
31
+ Object.defineProperty(exports, "migrateStore", { enumerable: true, get: function () { return schema_1.migrateStore; } });
32
+ Object.defineProperty(exports, "needsMigration", { enumerable: true, get: function () { return schema_1.needsMigration; } });
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,mDAe0B;AAPxB,2GAAA,SAAS,OAAA;AACT,2GAAA,SAAS,OAAA;AACT,oHAAA,kBAAkB,OAAA;AAClB,6GAAA,WAAW,OAAA;AACX,mHAAA,iBAAiB,OAAA;AACjB,8GAAA,YAAY,OAAA;AACZ,6GAAA,WAAW,OAAA;AAGb,yBAAyB;AACzB,mCAQkB;AAPhB,yGAAA,eAAe,OAAA;AACf,wGAAA,cAAc,OAAA;AACd,wGAAA,cAAc,OAAA;AACd,8GAAA,oBAAoB,OAAA;AACpB,0GAAA,gBAAgB,OAAA;AAChB,yGAAA,eAAe,OAAA;AAIjB,sCAAsC;AACtC,2CAOsB;AALpB,8GAAA,gBAAgB,OAAA;AAChB,2GAAA,aAAa,OAAA;AACb,2GAAA,aAAa,OAAA;AACb,qHAAA,uBAAuB,OAAA;AACvB,+GAAA,iBAAiB,OAAA;AAGnB,oBAAoB;AACpB,mCAMkB;AAJhB,gHAAA,sBAAsB,OAAA;AAEtB,sGAAA,YAAY,OAAA;AACZ,wGAAA,cAAc,OAAA"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Schema versioning and migration utilities
3
+ */
4
+ export type SchemaVersion = '1.0.0' | '1.1.0' | '2.0.0';
5
+ export declare const CURRENT_SCHEMA_VERSION: SchemaVersion;
6
+ /**
7
+ * Base interface for all versioned stores
8
+ */
9
+ export interface VersionedStore {
10
+ version: SchemaVersion;
11
+ lastUpdated: string;
12
+ }
13
+ /**
14
+ * Migration function type
15
+ */
16
+ export type MigrationFn<T> = (store: T) => T;
17
+ /**
18
+ * Migration registry
19
+ */
20
+ export interface MigrationRegistry<T> {
21
+ '1.0.0_to_1.1.0'?: MigrationFn<T>;
22
+ '1.1.0_to_2.0.0'?: MigrationFn<T>;
23
+ }
24
+ /**
25
+ * Apply migrations to bring store to current version
26
+ */
27
+ export declare function migrateStore<T extends VersionedStore>(store: T, migrations: MigrationRegistry<T>): T;
28
+ /**
29
+ * Check if store needs migration
30
+ */
31
+ export declare function needsMigration(store: VersionedStore): boolean;
32
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/storage/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAExD,eAAO,MAAM,sBAAsB,EAAE,aAAuB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,aAAa,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,gBAAgB,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAClC,gBAAgB,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,cAAc,EACnD,KAAK,EAAE,CAAC,EACR,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC/B,CAAC,CAqBH;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAE7D"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /**
3
+ * Schema versioning and migration utilities
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CURRENT_SCHEMA_VERSION = void 0;
7
+ exports.migrateStore = migrateStore;
8
+ exports.needsMigration = needsMigration;
9
+ exports.CURRENT_SCHEMA_VERSION = '2.0.0';
10
+ /**
11
+ * Apply migrations to bring store to current version
12
+ */
13
+ function migrateStore(store, migrations) {
14
+ let currentStore = store;
15
+ // Migration path
16
+ const migrationPath = [
17
+ '1.0.0_to_1.1.0',
18
+ '1.1.0_to_2.0.0',
19
+ ];
20
+ for (const migrationKey of migrationPath) {
21
+ const [fromVersion] = migrationKey.split('_to_');
22
+ if (currentStore.version === fromVersion) {
23
+ const migration = migrations[migrationKey];
24
+ if (migration) {
25
+ currentStore = migration(currentStore);
26
+ }
27
+ }
28
+ }
29
+ return currentStore;
30
+ }
31
+ /**
32
+ * Check if store needs migration
33
+ */
34
+ function needsMigration(store) {
35
+ return store.version !== exports.CURRENT_SCHEMA_VERSION;
36
+ }
37
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/storage/schema.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA8BH,oCAwBC;AAKD,wCAEC;AAzDY,QAAA,sBAAsB,GAAkB,OAAO,CAAC;AAuB7D;;GAEG;AACH,SAAgB,YAAY,CAC1B,KAAQ,EACR,UAAgC;IAEhC,IAAI,YAAY,GAAG,KAAK,CAAC;IAEzB,iBAAiB;IACjB,MAAM,aAAa,GAAsC;QACvD,gBAAgB;QAChB,gBAAgB;KACjB,CAAC;IAEF,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE,CAAC;QACzC,MAAM,CAAC,WAAW,CAAC,GAAI,YAAuB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE7D,IAAI,YAAY,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;YACzC,MAAM,SAAS,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;YAC3C,IAAI,SAAS,EAAE,CAAC;gBACd,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,KAAqB;IAClD,OAAO,KAAK,CAAC,OAAO,KAAK,8BAAsB,CAAC;AAClD,CAAC"}
@@ -0,0 +1,117 @@
1
+ import { TimelineResult, TimelineSession } from '../types';
2
+ import { SchemaVersion } from './schema';
3
+ export interface TimelineStore {
4
+ version: SchemaVersion;
5
+ lastUpdated: string;
6
+ lastCommitHash: string;
7
+ sessions: StoredSession[];
8
+ insights: StoredInsight[];
9
+ patterns: PatternStats;
10
+ trends: TrendData;
11
+ }
12
+ export interface StoredSession {
13
+ id: string;
14
+ date: string;
15
+ start: string;
16
+ end: string;
17
+ duration: number;
18
+ commitCount: number;
19
+ commitHashes: string[];
20
+ overall: string;
21
+ trustPassRate: number;
22
+ reworkRatio: number;
23
+ xpEarned: number;
24
+ flowState: boolean;
25
+ spiralCount: number;
26
+ spiralComponents: string[];
27
+ }
28
+ export interface StoredInsight {
29
+ id: string;
30
+ type: 'pattern' | 'trend' | 'recommendation';
31
+ category: string;
32
+ message: string;
33
+ firstSeen: string;
34
+ lastSeen: string;
35
+ occurrences: number;
36
+ metadata?: Record<string, unknown>;
37
+ }
38
+ export interface PatternStats {
39
+ totalFlowStates: number;
40
+ avgFlowDuration: number;
41
+ peakFlowHour: number;
42
+ totalSpirals: number;
43
+ avgSpiralDuration: number;
44
+ spiralsByComponent: Record<string, number>;
45
+ spiralsByHour: Record<number, number>;
46
+ lateNightSessions: number;
47
+ lateNightAvgDuration: number;
48
+ totalDetours: number;
49
+ totalTimeLostToDetours: number;
50
+ postDeleteSprints: number;
51
+ avgVelocityIncrease: number;
52
+ }
53
+ export interface TrendData {
54
+ weekly: WeekTrend[];
55
+ monthly: MonthTrend[];
56
+ improvements: {
57
+ metric: string;
58
+ direction: 'up' | 'down' | 'stable';
59
+ change: number;
60
+ period: string;
61
+ }[];
62
+ }
63
+ export interface WeekTrend {
64
+ weekStart: string;
65
+ sessions: number;
66
+ commits: number;
67
+ flowStates: number;
68
+ spirals: number;
69
+ avgScore: number;
70
+ activeMinutes: number;
71
+ }
72
+ export interface MonthTrend {
73
+ month: string;
74
+ sessions: number;
75
+ commits: number;
76
+ flowStates: number;
77
+ spirals: number;
78
+ avgScore: number;
79
+ activeMinutes: number;
80
+ }
81
+ /**
82
+ * Get store directory path (repo-local)
83
+ */
84
+ export declare function getStoreDir(repoPath?: string): string;
85
+ /**
86
+ * Get timeline store file path
87
+ */
88
+ export declare function getStorePath(repoPath?: string): string;
89
+ /**
90
+ * Create initial empty store
91
+ */
92
+ export declare function createInitialStore(): TimelineStore;
93
+ /**
94
+ * Load timeline store from disk
95
+ */
96
+ export declare function loadStore(repoPath?: string): TimelineStore;
97
+ /**
98
+ * Save timeline store to disk
99
+ */
100
+ export declare function saveStore(store: TimelineStore, repoPath?: string): void;
101
+ /**
102
+ * Get last known commit hash for incremental sync
103
+ */
104
+ export declare function getLastCommitHash(repoPath?: string): string;
105
+ /**
106
+ * Check if a session already exists (by commit hashes)
107
+ */
108
+ export declare function sessionExists(store: TimelineStore, commitHashes: string[]): boolean;
109
+ /**
110
+ * Convert TimelineSession to StoredSession for persistence
111
+ */
112
+ export declare function sessionToStored(session: TimelineSession): StoredSession;
113
+ /**
114
+ * Update store with new timeline data
115
+ */
116
+ export declare function updateStore(store: TimelineStore, timeline: TimelineResult, lastCommitHash: string): TimelineStore;
117
+ //# sourceMappingURL=timeline-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline-store.d.ts","sourceRoot":"","sources":["../../src/storage/timeline-store.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,eAAe,EAGhB,MAAM,UAAU,CAAC;AAElB,OAAO,EAA0B,aAAa,EAAE,MAAM,UAAU,CAAC;AAKjE,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,aAAa,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IAGvB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAG1B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IAGvB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IAGjB,SAAS,EAAE,OAAO,C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