fivocell 7.0.0 → 7.1.1

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 (75) hide show
  1. package/README.md +120 -237
  2. package/dist/__tests__/cli-regression.test.js +2 -2
  3. package/dist/__tests__/cli-regression.test.js.map +1 -1
  4. package/dist/walls/01-context/context/agents-md.d.ts +1 -1
  5. package/dist/walls/01-context/context/agents-md.d.ts.map +1 -1
  6. package/dist/walls/01-context/context/agents-md.js +33 -1
  7. package/dist/walls/01-context/context/agents-md.js.map +1 -1
  8. package/dist/walls/01-context/context/context-bridge.d.ts +39 -0
  9. package/dist/walls/01-context/context/context-bridge.d.ts.map +1 -0
  10. package/dist/walls/01-context/context/context-bridge.js +224 -0
  11. package/dist/walls/01-context/context/context-bridge.js.map +1 -0
  12. package/dist/walls/01-context/context/context-continuity.d.ts +54 -0
  13. package/dist/walls/01-context/context/context-continuity.d.ts.map +1 -0
  14. package/dist/walls/01-context/context/context-continuity.js +350 -0
  15. package/dist/walls/01-context/context/context-continuity.js.map +1 -0
  16. package/dist/walls/01-context/context/context-predictor.d.ts +24 -0
  17. package/dist/walls/01-context/context/context-predictor.d.ts.map +1 -0
  18. package/dist/walls/01-context/context/context-predictor.js +322 -0
  19. package/dist/walls/01-context/context/context-predictor.js.map +1 -0
  20. package/dist/walls/01-context/context/prompt-builder.d.ts.map +1 -1
  21. package/dist/walls/01-context/context/prompt-builder.js +53 -0
  22. package/dist/walls/01-context/context/prompt-builder.js.map +1 -1
  23. package/dist/walls/01-context/sessions/session-memory.d.ts.map +1 -1
  24. package/dist/walls/01-context/sessions/session-memory.js +47 -1
  25. package/dist/walls/01-context/sessions/session-memory.js.map +1 -1
  26. package/dist/walls/04-team/collab/team-supreme.d.ts +70 -0
  27. package/dist/walls/04-team/collab/team-supreme.d.ts.map +1 -0
  28. package/dist/walls/04-team/collab/team-supreme.js +357 -0
  29. package/dist/walls/04-team/collab/team-supreme.js.map +1 -0
  30. package/dist/walls/05-community/share/cloud-connector.d.ts +83 -0
  31. package/dist/walls/05-community/share/cloud-connector.d.ts.map +1 -0
  32. package/dist/walls/05-community/share/cloud-connector.js +385 -0
  33. package/dist/walls/05-community/share/cloud-connector.js.map +1 -0
  34. package/dist/walls/05-community/stats/community-supreme.d.ts +83 -0
  35. package/dist/walls/05-community/stats/community-supreme.d.ts.map +1 -0
  36. package/dist/walls/05-community/stats/community-supreme.js +221 -0
  37. package/dist/walls/05-community/stats/community-supreme.js.map +1 -0
  38. package/dist/walls/06-memory/vibe/vibe-confidence.js +6 -6
  39. package/dist/walls/06-memory/vibe/vibe-confidence.js.map +1 -1
  40. package/dist/walls/06-memory/vibe/vibe-engine.d.ts +7 -0
  41. package/dist/walls/06-memory/vibe/vibe-engine.d.ts.map +1 -1
  42. package/dist/walls/06-memory/vibe/vibe-engine.js +323 -240
  43. package/dist/walls/06-memory/vibe/vibe-engine.js.map +1 -1
  44. package/dist/walls/06-memory/vibe/vibe-intelligence.d.ts +19 -0
  45. package/dist/walls/06-memory/vibe/vibe-intelligence.d.ts.map +1 -0
  46. package/dist/walls/06-memory/vibe/vibe-intelligence.js +264 -0
  47. package/dist/walls/06-memory/vibe/vibe-intelligence.js.map +1 -0
  48. package/dist/walls/06-memory/vibe/vibe-signals.d.ts +3 -0
  49. package/dist/walls/06-memory/vibe/vibe-signals.d.ts.map +1 -1
  50. package/dist/walls/06-memory/vibe/vibe-signals.js +122 -9
  51. package/dist/walls/06-memory/vibe/vibe-signals.js.map +1 -1
  52. package/dist/walls/07-runtime/cli/cli.js +8 -0
  53. package/dist/walls/07-runtime/cli/cli.js.map +1 -1
  54. package/dist/walls/07-runtime/cli/commands/cloud.d.ts +3 -0
  55. package/dist/walls/07-runtime/cli/commands/cloud.d.ts.map +1 -0
  56. package/dist/walls/07-runtime/cli/commands/cloud.js +219 -0
  57. package/dist/walls/07-runtime/cli/commands/cloud.js.map +1 -0
  58. package/dist/walls/07-runtime/cli/commands/community.d.ts.map +1 -1
  59. package/dist/walls/07-runtime/cli/commands/community.js +6 -0
  60. package/dist/walls/07-runtime/cli/commands/community.js.map +1 -1
  61. package/dist/walls/07-runtime/cli/commands/help.d.ts.map +1 -1
  62. package/dist/walls/07-runtime/cli/commands/help.js +85 -75
  63. package/dist/walls/07-runtime/cli/commands/help.js.map +1 -1
  64. package/dist/walls/07-runtime/cli/commands/setup.d.ts.map +1 -1
  65. package/dist/walls/07-runtime/cli/commands/setup.js +20 -4
  66. package/dist/walls/07-runtime/cli/commands/setup.js.map +1 -1
  67. package/dist/walls/07-runtime/cli/utils.js +2 -2
  68. package/dist/walls/07-runtime/daemon/lifecycle.d.ts.map +1 -1
  69. package/dist/walls/07-runtime/daemon/lifecycle.js +13 -1
  70. package/dist/walls/07-runtime/daemon/lifecycle.js.map +1 -1
  71. package/dist/walls/07-runtime/setup/setup.d.ts +1 -0
  72. package/dist/walls/07-runtime/setup/setup.d.ts.map +1 -1
  73. package/dist/walls/07-runtime/setup/setup.js +2 -1
  74. package/dist/walls/07-runtime/setup/setup.js.map +1 -1
  75. package/package.json +1 -1
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
- // vibe-engine.ts — Core Vibe Learning Engine
3
- // Analyzes sessions, detects signals, generates natural language rules,
4
- // writes to .cell/vibe/ folder
2
+ // vibe-engine.ts — Core Vibe Learning Engine v3 Supreme
3
+ // Analyzes sessions, detects signals, generates rules, builds identity
5
4
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
5
  if (k2 === undefined) k2 = k;
7
6
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -38,6 +37,7 @@ var __importStar = (this && this.__importStar) || (function () {
38
37
  Object.defineProperty(exports, "__esModule", { value: true });
39
38
  exports.analyzeSession = analyzeSession;
40
39
  exports.buildVibeSummary = buildVibeSummary;
40
+ exports.getVibeSummaryFromVibeEngine_forTests = buildVibeSummary;
41
41
  exports.getVibeData = getVibeData;
42
42
  exports.getVibeSummary = getVibeSummary;
43
43
  exports.getVibeMarkdown = getVibeMarkdown;
@@ -47,7 +47,7 @@ const path = __importStar(require("path"));
47
47
  const database_1 = require("../database/database");
48
48
  const vibe_signals_1 = require("./vibe-signals");
49
49
  const vibe_confidence_1 = require("./vibe-confidence");
50
- // ─── Path Helpers ────────────────────────────────────────────────
50
+ const vibe_intelligence_1 = require("./vibe-intelligence");
51
51
  function getVibeDir(projectDir) {
52
52
  return path.join(projectDir, '.cell', 'vibe');
53
53
  }
@@ -57,69 +57,95 @@ function ensureVibeDir(projectDir) {
57
57
  fs.mkdirSync(dir, { recursive: true });
58
58
  return dir;
59
59
  }
60
- // ─── Signal Detection from Sessions ──────────────────────────────
61
60
  function analyzeSession(project, projectDir, totalSessions) {
62
61
  const existing = loadSignals(projectDir);
63
62
  const db = (0, database_1.getDb)();
64
- // Phase 1: Read session data
65
63
  const sessions = db.prepare('SELECT id, tool_name, files_touched, key_decisions, start_time FROM sessions WHERE project = ? ORDER BY id DESC LIMIT 20').all(project);
66
- // Phase 2: Read memory events
67
64
  const events = db.prepare('SELECT type, topic, summary, details_json, importance FROM memory_events WHERE project = ? ORDER BY id DESC LIMIT 500').all(project);
68
- // Phase 3: Read decisions
69
65
  const decisions = db.prepare('SELECT decision, approach, worked FROM decision_log WHERE project = ? ORDER BY id DESC LIMIT 100').all(project);
70
- // Phase 4: Read teach profile for explicit preferences
71
66
  let teachData = {};
72
67
  try {
73
- const teach = db.prepare("SELECT section, raw_text FROM developer_profile ORDER BY updated_at DESC").all();
74
- teach.forEach((t) => { teachData[t.section] = t.raw_text; });
68
+ const t = db.prepare("SELECT section, raw_text FROM developer_profile ORDER BY updated_at DESC").all();
69
+ t.forEach((x) => { teachData[x.section] = x.raw_text; });
75
70
  }
76
- catch { /* teach may not be populated */ }
77
- // Phase 5: Read style profile
71
+ catch { }
78
72
  let styleData = {};
79
73
  try {
80
- const style = db.prepare('SELECT pattern_key, pattern_value FROM style_profiles ORDER BY detection_count DESC').all();
81
- style.forEach((s) => { styleData[s.pattern_key] = s.pattern_value; });
74
+ const s = db.prepare('SELECT pattern_key, pattern_value FROM style_profiles ORDER BY detection_count DESC').all();
75
+ s.forEach((x) => { styleData[x.pattern_key] = x.pattern_value; });
82
76
  }
83
- catch { /* style may not be populated */ }
84
- // Phase 6: Detect signals from all data
85
- const signals = detectAllSignals(existing, sessions, events, decisions, teachData, styleData, totalSessions);
86
- // Phase 7: Generate natural language rules
77
+ catch { }
78
+ let sessionTextRaw = '';
79
+ try {
80
+ const apps = db.prepare('SELECT approach, status, reason FROM session_approaches ORDER BY id DESC LIMIT 50').all();
81
+ for (const a of apps)
82
+ sessionTextRaw += (a.approach || '') + ' ' + (a.reason || '') + ' ' + (a.status || '') + '\n';
83
+ const qs = db.prepare('SELECT question, priority FROM session_questions ORDER BY id DESC LIMIT 50').all();
84
+ for (const q of qs)
85
+ sessionTextRaw += (q.question || '') + ' ' + (q.priority || '') + '\n';
86
+ }
87
+ catch { }
88
+ let deepAnalysisData = { totalApproaches: 0, accepted: 0, rejected: 0, tried: 0, approachTexts: '' };
89
+ try {
90
+ const apps = db.prepare('SELECT approach, status, reason FROM session_approaches ORDER BY id DESC LIMIT 100').all();
91
+ deepAnalysisData.totalApproaches = apps.length;
92
+ for (const a of apps) {
93
+ deepAnalysisData.approachTexts += (a.approach || '') + ' ' + (a.reason || '') + ' ';
94
+ if (a.status === 'accepted' || a.status === 'worked')
95
+ deepAnalysisData.accepted++;
96
+ else if (a.status === 'rejected' || a.status === 'failed')
97
+ deepAnalysisData.rejected++;
98
+ else if (a.status === 'tried')
99
+ deepAnalysisData.tried++;
100
+ }
101
+ }
102
+ catch { }
103
+ const signals = detectAllSignals(existing, sessions, events, decisions, teachData, styleData, sessionTextRaw, deepAnalysisData, totalSessions);
87
104
  const rules = generateVibeRules(signals);
88
- // Phase 8: Write to disk
89
- const vibeData = {
90
- sessionsAnalyzed: totalSessions,
91
- lastUpdated: new Date().toISOString(),
92
- signals,
93
- rules,
94
- };
105
+ const correlated = (0, vibe_intelligence_1.generateCorrelatedInsights)(signals);
106
+ const traits = (0, vibe_intelligence_1.generateTraitInsights)(signals);
107
+ const allInsights = (0, vibe_intelligence_1.rankInsights)([...correlated, ...traits]);
108
+ const identitySummary = (0, vibe_intelligence_1.generateIdentitySummary)(signals, allInsights);
109
+ const aiGuide = (0, vibe_intelligence_1.generateAiGuide)(signals);
110
+ const vibeData = { sessionsAnalyzed: totalSessions, lastUpdated: new Date().toISOString(), signals, rules, insights: allInsights, identitySummary, aiGuide };
95
111
  writeSignalsJson(projectDir, vibeData);
96
112
  writeVibeMarkdown(projectDir, vibeData);
97
113
  writeVibeSummary(projectDir, vibeData);
98
114
  return vibeData;
99
115
  }
100
- // ─── Signal Detection ────────────────────────────────────────────
101
- function detectAllSignals(existingSignals, sessions, events, decisions, teachData, styleData, totalSessions) {
116
+ // ─── All signal detection + rule generation + file I/O from existing code ───
117
+ // (preserved from previous version — same detectAllSignals, generateVibeRules, etc.)
118
+ function loadSignals(projectDir) {
119
+ try {
120
+ const p = path.join(getVibeDir(projectDir), 'signals.json');
121
+ if (!fs.existsSync(p))
122
+ return [];
123
+ const d = JSON.parse(fs.readFileSync(p, 'utf-8'));
124
+ return d.signals || [];
125
+ }
126
+ catch {
127
+ return [];
128
+ }
129
+ }
130
+ function detectAllSignals(existingSignals, sessions, events, decisions, teachData, styleData, sessionTextRaw, deepAnalysisData, totalSessions) {
102
131
  const signalMap = new Map();
103
132
  existingSignals.forEach(s => signalMap.set(s.id, s));
104
133
  const now = new Date().toISOString();
105
- const allText = [
106
- ...sessions.map((s) => (s.files_touched || '') + (s.key_decisions || '')),
107
- ...events.map((e) => (e.summary || '') + (e.topic || '') + (e.details_json || '')),
108
- ...decisions.map((d) => (d.decision || '') + (d.approach || '')),
109
- ...Object.values(teachData),
110
- ...Object.values(styleData),
111
- ].join(' ').toLowerCase();
134
+ const allText = [...sessions.map((s) => (s.files_touched || '') + (s.key_decisions || '')), ...events.map((e) => (e.summary || '') + (e.topic || '') + (e.details_json || '')), ...decisions.map((d) => (d.decision || '') + (d.approach || '')), ...Object.values(teachData), ...Object.values(styleData), sessionTextRaw].join(' ').toLowerCase();
112
135
  for (const sig of vibe_signals_1.VIBE_SIGNALS) {
113
136
  let detected = false;
114
- // Check based on signal type
115
137
  switch (sig.id) {
116
- // ── Communication ──
117
138
  case 'language_hindi':
118
139
  detected = /[अ-ह]|hinglish|hindi|kar\b|de\b|bata\b|hai\b/.test(allText);
119
140
  break;
120
141
  case 'language_english':
121
142
  detected = !/[अ-ह]/.test(allText) && allText.length > 500;
122
143
  break;
144
+ case 'language_mix_ratio':
145
+ const hc = (allText.match(/[अ-ह]|hinglish|hindi|kar\b|de\b|bata\b|hai\b/g) || []).length;
146
+ const ec = (allText.match(/[a-z]{3,}/g) || []).length;
147
+ detected = hc > 0 && ec > 0 && (hc / Math.max(ec, 1)) > 0.3;
148
+ break;
123
149
  case 'structure_bullets':
124
150
  detected = (allText.match(/^[-•*]\s|\d+[.)]\s/gm) || []).length > sessions.length * 2;
125
151
  break;
@@ -138,25 +164,36 @@ function detectAllSignals(existingSignals, sessions, events, decisions, teachDat
138
164
  case 'verbosity_high':
139
165
  detected = allText.length / Math.max(sessions.length, 1) > 1500;
140
166
  break;
141
- // ── Code Philosophy ──
167
+ case 'communication_cadence':
168
+ detected = sessions.length >= 3 && (allText.length / Math.max(sessions.length, 1)) < 400;
169
+ break;
142
170
  case 'changes_minimal':
143
171
  detected = /minimal|small change|patch|fix only|don't refactor|no rewrite/.test(allText);
144
172
  break;
145
173
  case 'changes_thorough':
146
174
  detected = /rewrite|refactor entirely|full change|restructure/.test(allText);
147
175
  break;
176
+ case 'change_size_from_diffs':
177
+ detected = /under 50 lines|small diff|minimal change|single file|one file|small patch/.test(allText);
178
+ break;
148
179
  case 'abstraction_low':
149
180
  detected = /keep flat|no abstraction|simple code|don't abstract|no util/.test(allText);
150
181
  break;
151
182
  case 'abstraction_high':
152
183
  detected = /base class|abstract|interface|generic|util|helper/.test(allText);
153
184
  break;
185
+ case 'abstraction_threshold':
186
+ detected = /duplication|dry after|third time|3rd occurrence|DRY/.test(allText) && allText.includes('abstraction');
187
+ break;
154
188
  case 'testing_after':
155
189
  detected = /code first|test later|write tests? after/.test(allText);
156
190
  break;
157
191
  case 'testing_first':
158
192
  detected = /tdd|test first|write test|test-driven/.test(allText);
159
193
  break;
194
+ case 'test_priority':
195
+ detected = /integration test|e2e|unit test|coverage|jest|vitest/.test(allText);
196
+ break;
160
197
  case 'typescript_strict':
161
198
  detected = /strict.*true|no any|explicit type|type safety/.test(allText);
162
199
  break;
@@ -169,13 +206,18 @@ function detectAllSignals(existingSignals, sessions, events, decisions, teachDat
169
206
  case 'oop_style':
170
207
  detected = /class |extends|implements|private|public|protected/.test(allText);
171
208
  break;
172
- // ── Workflow ──
209
+ case 'naming_philosophy':
210
+ detected = /short name|descriptive|domain language|single word|clear name/.test(allText);
211
+ break;
173
212
  case 'audit_first':
174
213
  detected = /audit|analyze|scan|review|understand first|check first/.test(allText);
175
214
  break;
176
215
  case 'code_first':
177
216
  detected = /just build|start coding|implement now|bana de|seedha code/.test(allText);
178
217
  break;
218
+ case 'workflow_sequence':
219
+ detected = allText.includes('audit') && allText.includes('plan') && (allText.includes('code') || allText.includes('implement'));
220
+ break;
179
221
  case 'plan_phased':
180
222
  detected = /phase|step by step|roadmap|plan first|milestone|iteration/.test(allText);
181
223
  break;
@@ -194,7 +236,18 @@ function detectAllSignals(existingSignals, sessions, events, decisions, teachDat
194
236
  case 'ship_fast':
195
237
  detected = /good enough|launch kar|ship it|mvp|80%|working hai|release now/.test(allText);
196
238
  break;
197
- // ── Decisions ──
239
+ case 'session_time_pattern':
240
+ const hrs = sessions.map((s) => s.start_time ? new Date(s.start_time).getHours() : -1).filter((h) => h >= 0);
241
+ const nc = hrs.filter((h) => h >= 20 || h <= 4).length;
242
+ const mc = hrs.filter((h) => h >= 5 && h <= 11).length;
243
+ detected = sessions.length >= 3 && (nc > mc * 2 || mc > nc * 2);
244
+ break;
245
+ case 'deadline_behavior':
246
+ detected = /deadline|urgent|asap|time is tight|rush|fast/.test(allText) && /ship|launch|release|deploy/.test(allText);
247
+ break;
248
+ case 'completion_discipline':
249
+ detected = deepAnalysisData.totalApproaches > 0 && (deepAnalysisData.accepted + deepAnalysisData.rejected) > deepAnalysisData.tried;
250
+ break;
198
251
  case 'roi_first':
199
252
  detected = /revenue|paisa|monetize|customer pays|profit|business value|making money/.test(allText);
200
253
  break;
@@ -204,6 +257,12 @@ function detectAllSignals(existingSignals, sessions, events, decisions, teachDat
204
257
  case 'tech_first':
205
258
  detected = /architecture|performance|scale|clean code|best practice|properly/.test(allText);
206
259
  break;
260
+ case 'decision_argument_type':
261
+ const ar = (allText.match(/revenue|paisa|profit|money|business/g) || []).length;
262
+ const au = (allText.match(/user experience|ux|design|flow|usability/g) || []).length;
263
+ const at = (allText.match(/performance|scale|architecture|clean/g) || []).length;
264
+ detected = Math.max(ar, au, at) > 3;
265
+ break;
207
266
  case 'speed_over_quality':
208
267
  detected = /deadline|urgent|asap|quick fix|fast|time pressure/.test(allText);
209
268
  break;
@@ -216,16 +275,30 @@ function detectAllSignals(existingSignals, sessions, events, decisions, teachDat
216
275
  case 'explore_new':
217
276
  detected = /new framework|try new|experiment|latest|bleeding edge|cutting edge/.test(allText);
218
277
  break;
219
- // ── AI Interaction ──
278
+ case 'monetization_thinking':
279
+ detected = /monetize|pricing|revenue|paid|subscription|tier|freemium/.test(allText);
280
+ break;
281
+ case 'growth_strategy':
282
+ detected = /community|viral|organic|ads|marketing|github stars|growth/.test(allText);
283
+ break;
284
+ case 'user_focus':
285
+ detected = /power user|enterprise|casual|developer|end user/.test(allText);
286
+ break;
220
287
  case 'trust_high':
221
288
  detected = /accepted|good output|works perfectly|no changes needed/.test(allText);
222
289
  break;
223
290
  case 'trust_low':
224
291
  detected = /verify|test karo|check|make sure|confirm|validate|double check/.test(allText);
225
292
  break;
293
+ case 'acceptance_pattern':
294
+ detected = deepAnalysisData.totalApproaches >= 5 && (deepAnalysisData.accepted / deepAnalysisData.totalApproaches > 0.7 || deepAnalysisData.rejected / deepAnalysisData.totalApproaches > 0.5);
295
+ break;
226
296
  case 'iterative_prompter':
227
297
  detected = /edit|refine|modify|improve|tweak|update the|change that|redo/.test(allText);
228
298
  break;
299
+ case 'prompt_iteration_count':
300
+ detected = deepAnalysisData.totalApproaches >= 5 && deepAnalysisData.tried > deepAnalysisData.accepted;
301
+ break;
229
302
  case 'one_shot_user':
230
303
  detected = sessions.length > 0 && allText.length / sessions.length < 200;
231
304
  break;
@@ -235,34 +308,43 @@ function detectAllSignals(existingSignals, sessions, events, decisions, teachDat
235
308
  case 'edit_accepted_code':
236
309
  detected = /modify output|tweak|adjust the code|change .* implementation/.test(allText);
237
310
  break;
311
+ case 'output_modification_pattern':
312
+ detected = /modify|adjust|tweak|change that|update the|fix the|rework/.test(allText) && deepAnalysisData.accepted > 0;
313
+ break;
238
314
  case 'model_switcher':
239
315
  detected = /claude|gpt|gemini|sonar|copilot|codex|windsurf|cursor/.test(allText);
240
316
  break;
241
- // ── Project Behavior ──
242
- case 'exploration_bias': {
317
+ case 'feedback_specificity':
318
+ detected = deepAnalysisData.approachTexts.length > 500 && (deepAnalysisData.approachTexts.match(/\b(because|due to|since|as the|should|instead of)\b/g) || []).length > 3;
319
+ break;
320
+ case 'prompt_complexity':
321
+ detected = allText.split(/[.!?]\s/).length / Math.max(sessions.length, 1) > 8;
322
+ break;
323
+ case 'exploration_bias':
243
324
  try {
244
- const db2 = (0, database_1.getDb)();
245
- const projectCount = db2.prepare('SELECT COUNT(*) as c FROM projects').get()?.c || 1;
246
- const completedCount = events.filter((e) => e.type === 'verification' && /complete|done|finished|launched/.test(e.summary || '')).length;
247
- detected = projectCount > completedCount * 2;
325
+ const d2 = (0, database_1.getDb)();
326
+ const pc = d2.prepare('SELECT COUNT(*) as c FROM projects').get()?.c || 1;
327
+ const cc = events.filter((e) => e.type === 'verification' && /complete|done|finished|launched/.test(e.summary || '')).length;
328
+ detected = pc > cc * 2;
248
329
  }
249
330
  catch {
250
331
  detected = false;
251
332
  }
252
333
  break;
253
- }
254
- case 'completion_focused': {
334
+ case 'completion_focused':
255
335
  try {
256
- const db2 = (0, database_1.getDb)();
257
- const pCount = db2.prepare('SELECT COUNT(*) as c FROM projects').get()?.c || 1;
258
- const doneCount = events.filter((e) => e.type === 'verification' && /complete|done|finished|launched/.test(e.summary || '')).length;
259
- detected = doneCount > 0 && pCount <= doneCount + 2;
336
+ const d2 = (0, database_1.getDb)();
337
+ const pc = d2.prepare('SELECT COUNT(*) as c FROM projects').get()?.c || 1;
338
+ const dc = events.filter((e) => e.type === 'verification' && /complete|done|finished|launched/.test(e.summary || '')).length;
339
+ detected = dc > 0 && pc <= dc + 2;
260
340
  }
261
341
  catch {
262
342
  detected = false;
263
343
  }
264
344
  break;
265
- }
345
+ case 'completion_rate':
346
+ detected = deepAnalysisData.totalApproaches > 10 && deepAnalysisData.tried < deepAnalysisData.accepted + deepAnalysisData.rejected;
347
+ break;
266
348
  case 'scope_creep':
267
349
  detected = /also add|and also|while we're at|might as well|ek aur|1 more thing/.test(allText);
268
350
  break;
@@ -275,7 +357,9 @@ function detectAllSignals(existingSignals, sessions, events, decisions, teachDat
275
357
  case 'team_player':
276
358
  detected = /team|pair programming|collaborate|review|standup|sprint|pr review/.test(allText);
277
359
  break;
278
- // ── Git & Output ──
360
+ case 'refactor_trigger':
361
+ detected = /bug|fix|broken|error/.test(allText) && /refactor|rewrite|restructure/.test(allText);
362
+ break;
279
363
  case 'commit_small':
280
364
  detected = /small commit|atomic|single change|one thing|single file/.test(allText);
281
365
  break;
@@ -288,85 +372,127 @@ function detectAllSignals(existingSignals, sessions, events, decisions, teachDat
288
372
  case 'docs_skipper':
289
373
  detected = !/readme|documentation|docs|comment|wiki/.test(allText) && allText.length > 1000;
290
374
  break;
291
- default:
292
- detected = false;
375
+ case 'documentation_style':
376
+ detected = /README|documentation|docs|comment|JSDoc|wiki/.test(allText);
377
+ break;
378
+ case 'review_style':
379
+ detected = /nitpick|minor|approve|LGTM|ship it|looks good/.test(allText);
380
+ break;
381
+ case 'error_response_pattern':
382
+ detected = /fix immediately|fix now|quick fix|hotfix|patch/.test(allText) || /log and|note and|track and|later/.test(allText);
383
+ break;
384
+ case 'dependency_attitude':
385
+ detected = /no dependency|zero dep|add dep|new package|npm install|new library/.test(allText);
386
+ break;
387
+ case 'stack_loyalty':
388
+ detected = /same stack|consistent|tried and tested|proven|familiar/.test(allText) || /new framework|try something new|different/.test(allText);
389
+ break;
390
+ case 'learning_approach':
391
+ detected = /deep dive|source code|understand|learn|tutorial|guide|docs/.test(allText);
392
+ break;
393
+ case 'ui_preference_dark':
394
+ detected = /dark mode|dark theme|dark ui|dark background|never light/.test(allText);
395
+ break;
396
+ case 'ui_preference_minimal':
397
+ detected = /minimalist|minimal|simple|clean|no clutter|single column|fewer/.test(allText);
398
+ break;
399
+ case 'design_philosophy':
400
+ detected = /function over form|ugly.*fast|fast.*ugly|form over function|pretty|beautiful/.test(allText);
401
+ break;
402
+ case 'frustration_signal':
403
+ detected = /[!]{2,}|are yaar|yaar|damn|pagal|gussa|frustrat|what the|bc\b/i.test(allText);
404
+ break;
405
+ case 'correction_style':
406
+ detected = /galat hai|ye galat|nahi chahiye|dont do|stop that|mat kar|never do/i.test(allText);
407
+ break;
408
+ case 'satisfaction_signal':
409
+ detected = /sahi hai|perfect|bas yahi|exactly|correct|spot on|finally|thats it|acha hai/i.test(allText);
410
+ break;
411
+ case 'urgency_detection':
412
+ detected = /jaldi kar|jaldi se|fast|abhi karo|time nahi|asap|rush|urgent|hurry|jaldi/i.test(allText);
413
+ break;
414
+ case 'patience_level':
415
+ detected = deepAnalysisData.tried > deepAnalysisData.rejected && deepAnalysisData.tried > 2;
416
+ break;
417
+ case 'appreciation_style':
418
+ detected = /thanks|thank you|good job|great|nice work|awesome|accha|badhiya/i.test(allText);
419
+ break;
420
+ case 'thinking_aloud':
421
+ detected = /soch raha|let me think|hmm|wait|actually|i think|mujhe lagta|lagna/i.test(allText);
422
+ break;
423
+ case 'example_request_style':
424
+ detected = /example de|dikha|dikhao|samjha|samjhao|show me|example|give me example/i.test(allText);
425
+ break;
426
+ case 'comparison_style':
427
+ detected = /vs\.?|compared|better way|faster way|alternative|which one|difference between/i.test(allText);
428
+ break;
429
+ case 'certainty_language':
430
+ detected = /pakka|definitely|100%|absolutely|sure|for sure|shayad|maybe|ho sakta|might be|probably|not sure/i.test(allText);
431
+ break;
432
+ case 'ownership_language':
433
+ const oc = (allText.match(/maine\b|main\s+ne|mera\b/i) || []).length;
434
+ const wc = (allText.match(/hum\b|we\b|hamara\b/i) || []).length;
435
+ detected = oc > 3 || wc > 3;
436
+ break;
437
+ case 'pattern_recognition_skill':
438
+ detected = /pichli baar|last time|remember|jaise pahle|similar|same pattern|kabhi kiya/i.test(allText);
439
+ break;
440
+ case 'architecture_question_depth':
441
+ const wc2 = (allText.match(/kyun\b|why\b|reason|what if|what about/i) || []).length;
442
+ const hc2 = (allText.match(/kaise\b|how\b|karo|banao|create/i) || []).length;
443
+ detected = wc2 > 2 || hc2 > 5;
444
+ break;
445
+ case 'refactoring_motivation':
446
+ detected = (/refactor|rewrite|restructure/i.test(allText) && (/clean|performance|bug|fix|slow|ugly/i.test(allText)));
447
+ break;
448
+ case 'tech_curiosity':
449
+ detected = /try karte|try karo|explore|naya|latest|new tech|what about|check out|dekhte/i.test(allText);
450
+ break;
451
+ case 'simplicity_bias':
452
+ detected = /simple\b|easy\b|seedha\b|straightforward\b|minimal\b|no complexity|keep it simple/i.test(allText);
453
+ break;
454
+ case 'context_switch_frequency':
455
+ detected = deepAnalysisData.totalApproaches > 5 && deepAnalysisData.totalApproaches < 15;
456
+ break;
457
+ case 'deep_work_detection':
458
+ detected = sessions.length === 1 && deepAnalysisData.totalApproaches >= 3 && allText.length > 500;
459
+ break;
460
+ case 'break_pattern':
461
+ detected = sessions.length >= 2;
462
+ break;
463
+ case 'task_chaining':
464
+ detected = /ab ye|next\b|after this|fir\b|then\b|now this|ab ise|uske baad/i.test(allText);
465
+ break;
466
+ default: detected = false;
293
467
  }
294
- // Update or create signal
295
468
  const existing = signalMap.get(sig.id);
296
469
  const count = detected ? (existing?.count || 0) + 1 : (existing?.count || 0);
297
470
  const vibe = (0, vibe_confidence_1.evolveVibe)(existing?.vibe || 0, detected, count, totalSessions, sig.multiplier);
298
- signalMap.set(sig.id, {
299
- id: sig.id,
300
- group: sig.group,
301
- category: sig.category,
302
- count,
303
- vibe,
304
- firstSeen: existing?.firstSeen || (detected ? now : ''),
305
- lastSeen: detected ? now : existing?.lastSeen || '',
306
- });
471
+ signalMap.set(sig.id, { id: sig.id, group: sig.group, category: sig.category, count, vibe, firstSeen: existing?.firstSeen || (detected ? now : ''), lastSeen: detected ? now : existing?.lastSeen || '' });
307
472
  }
308
473
  return [...signalMap.values()].sort((a, b) => b.vibe - a.vibe);
309
474
  }
310
- // ─── Rule Generation ─────────────────────────────────────────────
311
475
  function generateVibeRules(signals) {
312
- const rules = [];
313
- // Rule templates for high-vibe signals
314
- const ruleTemplates = {
315
- language_hindi: (s) => `Hinglish preferred Hindi explanations, English code, mixed casually. Vibe: ${s.vibe}`,
316
- language_english: (s) => `English only communication. Code and explanations both in English. Vibe: ${s.vibe}`,
317
- structure_bullets: (s) => `Bullet points over paragraphs. Max 3 lines per bullet. Short, scannable output. Vibe: ${s.vibe}`,
318
- structure_paragraphs: (s) => `Detailed paragraphs preferred. Thorough explanations expected. Vibe: ${s.vibe}`,
319
- tone_direct: (s) => `Seedha bolo, no sugar-coating. Direct imperatives over polite requests. Vibe: ${s.vibe}`,
320
- tone_formal: (s) => `Formal, polite communication preferred. Please/thank you expected. Vibe: ${s.vibe}`,
321
- verbosity_low: (s) => `Short answers only. Explain only when explicitly asked. Vibe: ${s.vibe}`,
322
- verbosity_high: (s) => `Detailed, thorough explanations expected with every answer. Vibe: ${s.vibe}`,
323
- changes_minimal: (s) => `Changes must be minimal — diff under 50 lines. Never propose full rewrites. Vibe: ${s.vibe}`,
324
- changes_thorough: (s) => `Full rewrites accepted. Large-scope changes preferred over patches. Vibe: ${s.vibe}`,
325
- abstraction_low: (s) => `Keep code flat. No abstraction until 3rd duplication. Vibe: ${s.vibe}`,
326
- abstraction_high: (s) => `Well-abstracted code. Use interfaces, base classes, utils. Vibe: ${s.vibe}`,
327
- testing_after: (s) => `Code first, tests after. Integration tests over unit tests. Vibe: ${s.vibe}`,
328
- testing_first: (s) => `TDD approach. Write tests before implementation. Vibe: ${s.vibe}`,
329
- typescript_strict: (s) => `TypeScript strict mode always. any only with documented reason. Vibe: ${s.vibe}`,
330
- ship_fast: (s) => `Ship at 80%. Polish is infinite, shipping is finite. Good enough beats perfect. Vibe: ${s.vibe}`,
331
- audit_first: (s) => `Always audit before code: scan → understand → plan → implement. Vibe: ${s.vibe}`,
332
- roi_first: (s) => `Revenue-first decision making. Ask "kya paisa dega?" before any feature. Vibe: ${s.vibe}`,
333
- trust_low: (s) => `Verify everything. Never accept first AI output without testing. Vibe: ${s.vibe}`,
334
- trust_high: (s) => `High trust in AI output. Accepts suggestions readily. Vibe: ${s.vibe}`,
335
- iterative_prompter: (s) => `Iterative refiner. Edits prompts 3-5 times until exact result. Vibe: ${s.vibe}`,
336
- exploration_bias: (s) => `Starts many projects. Exploration over completion. Vibe: ${s.vibe}`,
337
- completion_focused: (s) => `Finishes projects before starting new ones. Completion-driven. Vibe: ${s.vibe}`,
338
- commit_small: (s) => `Small atomic commits. Present tense. Each commit does exactly one thing. Vibe: ${s.vibe}`,
339
- solo_developer: (s) => `Solo developer. Works independently. Full ownership. Vibe: ${s.vibe}`,
340
- team_player: (s) => `Team player. Collaborates, reviews PRs, pairs frequently. Vibe: ${s.vibe}`,
341
- overnight_mode: (s) => `Autonomous overnight mode active. "Crack on going to bed" — work independently. Vibe: ${s.vibe}`,
342
- focus_mode: (s) => `Single focus mode — one task at a time, strict scope. Vibe: ${s.vibe}`,
343
- task_list_mode: (s) => `Task list mode — create checklist, work through systematically. Vibe: ${s.vibe}`,
344
- scope_creep: (s) => `Scope creep tendency — expands features during implementation. Vibe: ${s.vibe}`,
345
- docs_writer: (s) => `Documentation writer. READMEs, comments, wikis well-maintained. Vibe: ${s.vibe}`,
346
- verify_always: (s) => `Always verifies. Runs tests after every change. Quality gate mandatory. Vibe: ${s.vibe}`,
476
+ const tmpl = {
477
+ language_hindi: (s) => `Hinglish preferred — Hindi explanations, English code, mixed casually. Vibe: ${s.vibe}`, language_english: (s) => `English only communication. Code and explanations both in English. Vibe: ${s.vibe}`, structure_bullets: (s) => `Bullet points over paragraphs. Max 3 lines per bullet. Vibe: ${s.vibe}`, structure_paragraphs: (s) => `Detailed paragraphs preferred. Vibe: ${s.vibe}`, tone_direct: (s) => `Seedha bolo, no sugar-coating. Direct imperatives over polite requests. Vibe: ${s.vibe}`, tone_formal: (s) => `Formal, polite communication preferred. Vibe: ${s.vibe}`, verbosity_low: (s) => `Short answers only. Explain only when explicitly asked. Vibe: ${s.vibe}`, verbosity_high: (s) => `Detailed, thorough explanations expected with every answer. Vibe: ${s.vibe}`,
478
+ changes_minimal: (s) => `Changes must be minimal — diff under 50 lines. Never propose full rewrites. Vibe: ${s.vibe}`, changes_thorough: (s) => `Full rewrites accepted. Large-scope changes preferred over patches. Vibe: ${s.vibe}`, abstraction_low: (s) => `Keep code flat. No abstraction until 3rd duplication. Vibe: ${s.vibe}`, abstraction_high: (s) => `Well-abstracted code. Use interfaces, base classes, utils. Vibe: ${s.vibe}`, testing_after: (s) => `Code first, tests after. Integration tests over unit tests. Vibe: ${s.vibe}`, testing_first: (s) => `TDD approach. Write tests before implementation. Vibe: ${s.vibe}`, typescript_strict: (s) => `TypeScript strict mode always. any only with documented reason. Vibe: ${s.vibe}`,
479
+ ship_fast: (s) => `Ship at 80%. Polish is infinite, shipping is finite. Good enough beats perfect. Vibe: ${s.vibe}`, audit_first: (s) => `Always audit before code: scan → understand → plan → implement. Vibe: ${s.vibe}`, roi_first: (s) => `Revenue-first decision making. Ask "kya paisa dega?" before any feature. Vibe: ${s.vibe}`, trust_low: (s) => `Verify everything. Never accept first AI output without testing. Vibe: ${s.vibe}`, trust_high: (s) => `High trust in AI output. Accepts suggestions readily. Vibe: ${s.vibe}`, iterative_prompter: (s) => `Iterative refiner. Edits prompts 3-5 times until exact result. Vibe: ${s.vibe}`, exploration_bias: (s) => `Starts many projects. Exploration over completion. Vibe: ${s.vibe}`, completion_focused: (s) => `Finishes projects before starting new ones. Completion-driven. Vibe: ${s.vibe}`, commit_small: (s) => `Small atomic commits. Present tense. Each commit does exactly one thing. Vibe: ${s.vibe}`, solo_developer: (s) => `Solo developer. Works independently. Full ownership. Vibe: ${s.vibe}`, team_player: (s) => `Team player. Collaborates, reviews PRs, pairs frequently. Vibe: ${s.vibe}`, overnight_mode: (s) => `Autonomous overnight mode active. Vibe: ${s.vibe}`, focus_mode: (s) => `Single focus mode — one task at a time, strict scope. Vibe: ${s.vibe}`, task_list_mode: (s) => `Task list mode — create checklist, work through systematically. Vibe: ${s.vibe}`, scope_creep: (s) => `Scope creep tendency — expands features during implementation. Vibe: ${s.vibe}`, docs_writer: (s) => `Documentation writer. READMEs, comments, wikis well-maintained. Vibe: ${s.vibe}`, verify_always: (s) => `Always verifies. Runs tests after every change. Vibe: ${s.vibe}`,
480
+ language_mix_ratio: (s) => `Mixed language communication — Hinglish pattern. Vibe: ${s.vibe}`, change_size_from_diffs: (s) => `Small, focused code changes — single files, minimal diffs. Vibe: ${s.vibe}`, test_priority: (s) => `Testing-aware developer — actively tracks coverage. Vibe: ${s.vibe}`, workflow_sequence: (s) => `Structured workflow: audit → plan → implement. Vibe: ${s.vibe}`, deadline_behavior: (s) => `Deadline-driven — shifts to speed mode under time pressure. Vibe: ${s.vibe}`, completion_discipline: (s) => `Completes what is started — high session resolution rate. Vibe: ${s.vibe}`, decision_argument_type: (s) => `Uses multiple argument types — balanced thinking. Vibe: ${s.vibe}`, monetization_thinking: (s) => `Business-aware — thinks about monetization in technical decisions. Vibe: ${s.vibe}`, acceptance_pattern: (s) => `Distinct AI acceptance pattern. Vibe: ${s.vibe}`, prompt_iteration_count: (s) => `Iterative prompter — refines through multiple edits. Vibe: ${s.vibe}`, output_modification_pattern: (s) => `Always enhances AI output. Vibe: ${s.vibe}`, feedback_specificity: (s) => `Detailed feedback giver — specific, actionable rejection reasons. Vibe: ${s.vibe}`, completion_rate: (s) => `High task completion rate. Vibe: ${s.vibe}`, refactor_trigger: (s) => `Bug-driven refactorer — changes structure when bugs force it. Vibe: ${s.vibe}`, documentation_style: (s) => `Documentation-conscious. Vibe: ${s.vibe}`, error_response_pattern: (s) => `Immediate error responder — fixes bugs quickly. Vibe: ${s.vibe}`, ui_preference_dark: (s) => `Dark mode devotee. Vibe: ${s.vibe}`, ui_preference_minimal: (s) => `Minimalist aesthetic. Vibe: ${s.vibe}`, design_philosophy: (s) => `Function-first designer. Vibe: ${s.vibe}`,
481
+ frustration_signal: (s) => `Shows frustration directly — uses strong language when things go wrong. Vibe: ${s.vibe}`, correction_style: (s) => `Direct corrector — gives blunt, undiplomatic feedback. Vibe: ${s.vibe}`, satisfaction_signal: (s) => `Expresses satisfaction — gives clear positive signals. Vibe: ${s.vibe}`, urgency_detection: (s) => `Urgency-aware — frequently operates under time pressure. Vibe: ${s.vibe}`, patience_level: (s) => `Patient iterater — refines through edits rather than immediately rejecting. Vibe: ${s.vibe}`, appreciation_style: (s) => `Expresses appreciation — acknowledges good work. Vibe: ${s.vibe}`, thinking_aloud: (s) => `Visible thinker — shares thought process openly. Vibe: ${s.vibe}`, example_request_style: (s) => `Example-driven learner — prefers concrete examples. Vibe: ${s.vibe}`, comparison_style: (s) => `Comparison-driven — evaluates by comparing alternatives. Vibe: ${s.vibe}`, certainty_language: (s) => `Uses certainty markers — expresses confidence through language. Vibe: ${s.vibe}`, ownership_language: (s) => `Distinct ownership voice. Vibe: ${s.vibe}`, pattern_recognition_skill: (s) => `Pattern-aware — references past experiences. Vibe: ${s.vibe}`, architecture_question_depth: (s) => `Deep questioner — asks why, not just how. Vibe: ${s.vibe}`, refactoring_motivation: (s) => `Purposeful refactorer — specific motivation behind changes. Vibe: ${s.vibe}`, tech_curiosity: (s) => `Tech-curious — explores new technologies. Vibe: ${s.vibe}`, simplicity_bias: (s) => `Simplicity-first — values simple solutions. Vibe: ${s.vibe}`, context_switch_frequency: (s) => `Moderate context switcher. Vibe: ${s.vibe}`, deep_work_detection: (s) => `Deep worker — capable of long focused sessions. Vibe: ${s.vibe}`, task_chaining: (s) => `Sequential planner — chains tasks together. Vibe: ${s.vibe}`,
347
482
  };
483
+ const rules = [];
348
484
  for (const s of signals) {
349
485
  if (!(0, vibe_confidence_1.shouldWriteToFile)(s.vibe))
350
486
  continue;
351
- const template = ruleTemplates[s.id];
352
- if (template) {
353
- rules.push({
354
- text: template(s),
355
- category: s.category,
356
- vibe: s.vibe,
357
- count: s.count,
358
- level: (0, vibe_confidence_1.getVibeLevel)(s.vibe),
359
- });
360
- }
487
+ const t = tmpl[s.id];
488
+ if (t)
489
+ rules.push({ text: t(s), category: s.category, vibe: s.vibe, count: s.count, level: (0, vibe_confidence_1.getVibeLevel)(s.vibe) });
361
490
  }
362
- // Sort by vibe descending within each category
363
491
  return rules.sort((a, b) => b.vibe - a.vibe);
364
492
  }
365
- // ─── Build Vibe Summary ──────────────────────────────────────────
366
493
  function buildVibeSummary(signals, rules) {
367
494
  const sigMap = new Map(signals.map(s => [s.id, s]));
368
495
  const g = (id) => sigMap.get(id)?.vibe ?? 0;
369
- // Communication
370
496
  const comm = {};
371
497
  if (g('language_hindi') >= 65)
372
498
  comm.language = 'hinglish';
@@ -378,7 +504,6 @@ function buildVibeSummary(signals, rules) {
378
504
  comm.tone = 'direct';
379
505
  if (g('verbosity_low') >= 65)
380
506
  comm.verbosity = 'low';
381
- // Coding
382
507
  const coding = {};
383
508
  if (g('changes_minimal') >= 65)
384
509
  coding.changeSize = 'minimal';
@@ -388,7 +513,6 @@ function buildVibeSummary(signals, rules) {
388
513
  coding.testing = 'after-code';
389
514
  if (g('typescript_strict') >= 65)
390
515
  coding.typescript = 'strict';
391
- // Decision driver
392
516
  let decisionDriver = 'balanced';
393
517
  if (g('roi_first') >= 65)
394
518
  decisionDriver = 'roi';
@@ -396,20 +520,17 @@ function buildVibeSummary(signals, rules) {
396
520
  decisionDriver = 'ux';
397
521
  else if (g('tech_first') >= 65)
398
522
  decisionDriver = 'tech';
399
- // UI preference
400
523
  let uiPreference = 'unknown';
401
- // Will be enhanced when we add dark_mode signal in future
402
- // Ship style
524
+ if (g('ui_preference_dark') >= 65)
525
+ uiPreference = 'dark';
403
526
  let shipStyle = 'balanced';
404
527
  if (g('ship_fast') >= 65)
405
528
  shipStyle = 'fast';
406
- // AI trust
407
529
  let aiTrust = 'balanced';
408
530
  if (g('trust_low') >= 65 || g('verify_always') >= 65)
409
531
  aiTrust = 'verify_always';
410
532
  else if (g('trust_high') >= 65)
411
533
  aiTrust = 'high';
412
- // Strengths
413
534
  const strengths = [];
414
535
  if (g('audit_first') >= 65)
415
536
  strengths.push('Systematic auditor');
@@ -421,13 +542,17 @@ function buildVibeSummary(signals, rules) {
421
542
  strengths.push('Clean git hygiene');
422
543
  if (g('completion_focused') >= 65)
423
544
  strengths.push('Completion driven');
424
- // Risks
545
+ if (g('simplicity_bias') >= 65)
546
+ strengths.push('Simplicity advocate');
547
+ if (g('deep_work_detection') >= 65)
548
+ strengths.push('Deep focus capability');
425
549
  const risks = (0, vibe_confidence_1.detectRisks)(signals);
426
550
  if (g('exploration_bias') >= 65)
427
551
  risks.push('Exploration bias — starts more than finishes');
428
552
  if (g('scope_creep') >= 65)
429
553
  risks.push('Scope creep — features expand during work');
430
- // Avoid list
554
+ if (g('frustration_signal') >= 65)
555
+ risks.push('Frustration under pressure — communication may intensify');
431
556
  const avoid = [];
432
557
  if (g('changes_minimal') >= 65)
433
558
  avoid.push('Large rewrites');
@@ -437,151 +562,109 @@ function buildVibeSummary(signals, rules) {
437
562
  avoid.push('Corporate/formal language');
438
563
  if (g('language_hindi') >= 65)
439
564
  avoid.push('Pure English responses');
440
- // Best workflow
565
+ if (g('simplicity_bias') >= 65)
566
+ avoid.push('Over-engineering');
441
567
  let bestWorkflow = 'Standard workflow';
442
- if (g('audit_first') >= 65 && g('ship_fast') >= 65) {
568
+ if (g('audit_first') >= 65 && g('ship_fast') >= 65)
443
569
  bestWorkflow = 'Audit → phased plan → incremental delivery → ship at 80%';
444
- }
445
- else if (g('audit_first') >= 65) {
570
+ else if (g('audit_first') >= 65)
446
571
  bestWorkflow = 'Audit → plan → thorough implementation';
447
- }
448
- else if (g('ship_fast') >= 65) {
572
+ else if (g('ship_fast') >= 65)
449
573
  bestWorkflow = 'Build fast → test → ship';
450
- }
451
- // Risk profile
452
574
  let riskProfile = 'medium';
453
575
  if (g('ship_fast') >= 65 && g('speed_over_quality') >= 60)
454
576
  riskProfile = 'high';
455
577
  else if (g('quality_over_speed') >= 65)
456
578
  riskProfile = 'low';
457
- // Category averages
458
- const categoryAverages = [];
579
+ const catAvgs = [];
459
580
  for (const cat of (0, vibe_signals_1.getAllCategories)()) {
460
- const catSignals = signals.filter(s => s.category === cat);
461
- const avg = (0, vibe_confidence_1.categoryVibeAverage)(catSignals);
462
- if (avg > 0)
463
- categoryAverages.push({ cat, avg });
581
+ const cs = signals.filter(s => s.category === cat);
582
+ const a = (0, vibe_confidence_1.categoryVibeAverage)(cs);
583
+ if (a > 0)
584
+ catAvgs.push({ cat, avg: a });
464
585
  }
465
- const topCategories = categoryAverages
466
- .sort((a, b) => b.avg - a.avg)
467
- .slice(0, 5)
468
- .map(c => c.cat);
469
- // One-line summary
470
- const summaryParts = [];
586
+ const topCats = catAvgs.sort((a, b) => b.avg - a.avg).slice(0, 5).map(c => c.cat);
587
+ const sp = [];
471
588
  if (decisionDriver === 'roi')
472
- summaryParts.push('ROI-driven');
589
+ sp.push('ROI-driven');
473
590
  if (decisionDriver === 'ux')
474
- summaryParts.push('UX-focused');
591
+ sp.push('UX-focused');
475
592
  if (shipStyle === 'fast')
476
- summaryParts.push('ships fast');
593
+ sp.push('ships fast');
477
594
  if (comm.language === 'hinglish')
478
- summaryParts.push('Hinglish communicator');
595
+ sp.push('Hinglish communicator');
479
596
  if (aiTrust === 'verify_always')
480
- summaryParts.push('verification-obsessed');
481
- const summary = summaryParts.length > 0
482
- ? summaryParts.join(', ') + '.'
483
- : 'Style still learning.';
484
- return {
485
- summary,
486
- strengths: strengths.length > 0 ? strengths : ['Still discovering strengths'],
487
- risks: risks.length > 0 ? risks : ['No risks detected yet'],
488
- bestWorkflow,
489
- avoid: avoid.length > 0 ? avoid : ['Nothing specific yet'],
490
- communication: comm,
491
- coding,
492
- decisionDriver,
493
- riskProfile,
494
- uiPreference,
495
- shipStyle,
496
- aiTrust,
497
- totalRules: rules.length,
498
- averageVibe: Math.round(signals.reduce((acc, s) => acc + s.vibe, 0) / Math.max(signals.length, 1)),
499
- topCategories,
500
- };
501
- }
502
- // ─── File I/O ─────────────────────────────────────────────────────
503
- function loadSignals(projectDir) {
504
- try {
505
- const p = path.join(getVibeDir(projectDir), 'signals.json');
506
- if (!fs.existsSync(p))
507
- return [];
508
- const data = JSON.parse(fs.readFileSync(p, 'utf-8'));
509
- return data.signals || [];
510
- }
511
- catch {
512
- return [];
513
- }
514
- }
515
- function writeSignalsJson(projectDir, data) {
516
- ensureVibeDir(projectDir);
517
- fs.writeFileSync(path.join(getVibeDir(projectDir), 'signals.json'), JSON.stringify(data, null, 2), 'utf-8');
597
+ sp.push('verification-obsessed');
598
+ const summary = sp.length > 0 ? sp.join(', ') + '.' : 'Style still learning.';
599
+ return { summary, strengths: strengths.length > 0 ? strengths : ['Still discovering strengths'], risks: risks.length > 0 ? risks : ['No risks detected yet'], bestWorkflow, avoid: avoid.length > 0 ? avoid : ['Nothing specific yet'], communication: comm, coding, decisionDriver, riskProfile, uiPreference, shipStyle, aiTrust, totalRules: rules.length, averageVibe: Math.round(signals.reduce((acc, s) => acc + s.vibe, 0) / Math.max(signals.length, 1)), topCategories: topCats };
518
600
  }
601
+ function writeSignalsJson(projectDir, data) { ensureVibeDir(projectDir); fs.writeFileSync(path.join(getVibeDir(projectDir), 'signals.json'), JSON.stringify(data, null, 2), 'utf-8'); }
519
602
  function writeVibeMarkdown(projectDir, data) {
520
603
  ensureVibeDir(projectDir);
521
- const lines = [];
522
- lines.push('# Cell Vibe — Your Developer Personality\n');
523
- lines.push(`*Learned from ${data.sessionsAnalyzed} sessions. Last updated: ${data.lastUpdated}*\n`);
524
- // Group by category
525
- const byCategory = new Map();
604
+ const lines = ['# Cell Vibe — Your Developer Personality\n', `*Learned from ${data.sessionsAnalyzed} sessions. Last updated: ${data.lastUpdated}*\n`];
605
+ if (data.identitySummary) {
606
+ lines.push(`## 🔮 Identity`);
607
+ lines.push('');
608
+ lines.push(data.identitySummary);
609
+ lines.push('');
610
+ }
611
+ const byCat = new Map();
526
612
  for (const r of data.rules) {
527
- const existing = byCategory.get(r.category) || [];
528
- existing.push(r);
529
- byCategory.set(r.category, existing);
613
+ const e = byCat.get(r.category) || [];
614
+ e.push(r);
615
+ byCat.set(r.category, e);
530
616
  }
531
- for (const [cat, rules] of byCategory) {
617
+ for (const [cat, rules] of byCat) {
532
618
  lines.push(`## ${cat}\n`);
533
- for (const r of rules.sort((a, b) => b.vibe - a.vibe)) {
619
+ for (const r of rules.sort((a, b) => b.vibe - a.vibe))
534
620
  lines.push(`- ${r.text}`);
535
- }
536
621
  lines.push('');
537
622
  }
538
- fs.writeFileSync(path.join(getVibeDir(projectDir), 'vibe.md'), lines.join('\n'), 'utf-8');
539
- }
540
- function writeVibeSummary(projectDir, data) {
541
- ensureVibeDir(projectDir);
542
- const summary = buildVibeSummary(data.signals, data.rules);
543
- fs.writeFileSync(path.join(getVibeDir(projectDir), 'vibe-summary.json'), JSON.stringify(summary, null, 2), 'utf-8');
544
- }
545
- // ─── Public API ──────────────────────────────────────────────────
546
- function getVibeData(projectDir) {
547
- try {
548
- const p = path.join(getVibeDir(projectDir), 'signals.json');
549
- if (!fs.existsSync(p))
550
- return null;
551
- return JSON.parse(fs.readFileSync(p, 'utf-8'));
623
+ if (data.insights && data.insights.length > 0) {
624
+ lines.push('## 🧬 Deep Insights');
625
+ lines.push('');
626
+ for (const i of data.insights.slice(0, 5))
627
+ lines.push(`- ${i.text} (${i.confidence}/100)`);
628
+ lines.push('');
552
629
  }
553
- catch {
554
- return null;
630
+ if (data.aiGuide) {
631
+ lines.push('## 🤖 AI Guide — How To Work With This Developer');
632
+ lines.push('');
633
+ lines.push(data.aiGuide);
634
+ lines.push('');
555
635
  }
636
+ fs.writeFileSync(path.join(getVibeDir(projectDir), 'vibe.md'), lines.join('\n'), 'utf-8');
556
637
  }
557
- function getVibeSummary(projectDir) {
558
- try {
559
- const p = path.join(getVibeDir(projectDir), 'vibe-summary.json');
560
- if (!fs.existsSync(p))
561
- return null;
562
- return JSON.parse(fs.readFileSync(p, 'utf-8'));
563
- }
564
- catch {
638
+ function writeVibeSummary(projectDir, data) { ensureVibeDir(projectDir); const s = buildVibeSummary(data.signals, data.rules); if (data.identitySummary)
639
+ s.summary = data.identitySummary; fs.writeFileSync(path.join(getVibeDir(projectDir), 'vibe-summary.json'), JSON.stringify(s, null, 2), 'utf-8'); }
640
+ function getVibeData(projectDir) { try {
641
+ const p = path.join(getVibeDir(projectDir), 'signals.json');
642
+ if (!fs.existsSync(p))
565
643
  return null;
566
- }
644
+ return JSON.parse(fs.readFileSync(p, 'utf-8'));
567
645
  }
568
- function getVibeMarkdown(projectDir) {
569
- try {
570
- const p = path.join(getVibeDir(projectDir), 'vibe.md');
571
- if (!fs.existsSync(p))
572
- return '# Vibe\n\nNo vibe data yet. Vibe learns automatically from your sessions. Just keep working and Cell will learn your style.';
573
- return fs.readFileSync(p, 'utf-8');
574
- }
575
- catch {
576
- return '# Vibe\n\nCould not read vibe data.';
577
- }
646
+ catch {
647
+ return null;
648
+ } }
649
+ function getVibeSummary(projectDir) { try {
650
+ const p = path.join(getVibeDir(projectDir), 'vibe-summary.json');
651
+ if (!fs.existsSync(p))
652
+ return null;
653
+ return JSON.parse(fs.readFileSync(p, 'utf-8'));
578
654
  }
579
- function resetVibe(projectDir) {
580
- const dir = getVibeDir(projectDir);
581
- if (fs.existsSync(dir)) {
582
- for (const f of fs.readdirSync(dir)) {
583
- fs.unlinkSync(path.join(dir, f));
584
- }
585
- }
655
+ catch {
656
+ return null;
657
+ } }
658
+ function getVibeMarkdown(projectDir) { try {
659
+ const p = path.join(getVibeDir(projectDir), 'vibe.md');
660
+ if (!fs.existsSync(p))
661
+ return '# Vibe\n\nNo vibe data yet.';
662
+ return fs.readFileSync(p, 'utf-8');
586
663
  }
664
+ catch {
665
+ return '# Vibe\n\nCould not read.';
666
+ } }
667
+ function resetVibe(projectDir) { const d = getVibeDir(projectDir); if (fs.existsSync(d))
668
+ for (const f of fs.readdirSync(d))
669
+ fs.unlinkSync(path.join(d, f)); }
587
670
  //# sourceMappingURL=vibe-engine.js.map