fivocell 6.2.0 → 7.0.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 (248) hide show
  1. package/README.md +229 -120
  2. package/dist/__tests__/cell-mirror.test.js +2 -2
  3. package/dist/__tests__/cell-mirror.test.js.map +1 -1
  4. package/dist/__tests__/cli-regression.test.js +1 -1
  5. package/dist/__tests__/cli-regression.test.js.map +1 -1
  6. package/dist/__tests__/teach-context.test.d.ts +2 -0
  7. package/dist/__tests__/teach-context.test.d.ts.map +1 -0
  8. package/dist/__tests__/teach-context.test.js +44 -0
  9. package/dist/__tests__/teach-context.test.js.map +1 -0
  10. package/dist/__tests__/teach-parser.test.d.ts +2 -0
  11. package/dist/__tests__/teach-parser.test.d.ts.map +1 -0
  12. package/dist/__tests__/teach-parser.test.js +56 -0
  13. package/dist/__tests__/teach-parser.test.js.map +1 -0
  14. package/dist/__tests__/teach-store.test.d.ts +2 -0
  15. package/dist/__tests__/teach-store.test.d.ts.map +1 -0
  16. package/dist/__tests__/teach-store.test.js +68 -0
  17. package/dist/__tests__/teach-store.test.js.map +1 -0
  18. package/dist/__tests__/vibe-engine.test.d.ts +2 -0
  19. package/dist/__tests__/vibe-engine.test.d.ts.map +1 -0
  20. package/dist/__tests__/vibe-engine.test.js +132 -0
  21. package/dist/__tests__/vibe-engine.test.js.map +1 -0
  22. package/dist/core/search-engine.d.ts.map +1 -1
  23. package/dist/core/search-engine.js +8 -11
  24. package/dist/core/search-engine.js.map +1 -1
  25. package/dist/walls/01-context/context/prompt-builder.d.ts +1 -0
  26. package/dist/walls/01-context/context/prompt-builder.d.ts.map +1 -1
  27. package/dist/walls/01-context/context/prompt-builder.js +15 -1
  28. package/dist/walls/01-context/context/prompt-builder.js.map +1 -1
  29. package/dist/walls/02-scanner/blindspots/code-scanner.d.ts +11 -0
  30. package/dist/walls/02-scanner/blindspots/code-scanner.d.ts.map +1 -1
  31. package/dist/walls/02-scanner/blindspots/code-scanner.js +63 -0
  32. package/dist/walls/02-scanner/blindspots/code-scanner.js.map +1 -1
  33. package/dist/walls/03-knowledge/decisions/branch-snapshot.d.ts +14 -0
  34. package/dist/walls/03-knowledge/decisions/branch-snapshot.d.ts.map +1 -1
  35. package/dist/walls/03-knowledge/decisions/branch-snapshot.js +88 -21
  36. package/dist/walls/03-knowledge/decisions/branch-snapshot.js.map +1 -1
  37. package/dist/walls/03-knowledge/decisions/failure-memory.d.ts +15 -0
  38. package/dist/walls/03-knowledge/decisions/failure-memory.d.ts.map +1 -1
  39. package/dist/walls/03-knowledge/decisions/failure-memory.js +141 -54
  40. package/dist/walls/03-knowledge/decisions/failure-memory.js.map +1 -1
  41. package/dist/walls/03-knowledge/decisions/predictive-engine.d.ts +8 -0
  42. package/dist/walls/03-knowledge/decisions/predictive-engine.d.ts.map +1 -1
  43. package/dist/walls/03-knowledge/decisions/predictive-engine.js +41 -0
  44. package/dist/walls/03-knowledge/decisions/predictive-engine.js.map +1 -1
  45. package/dist/walls/06-memory/archive/blob-vault.d.ts.map +1 -1
  46. package/dist/walls/06-memory/archive/blob-vault.js +1 -3
  47. package/dist/walls/06-memory/archive/blob-vault.js.map +1 -1
  48. package/dist/walls/06-memory/archive/memory-archive.d.ts.map +1 -1
  49. package/dist/walls/06-memory/archive/memory-archive.js +38 -48
  50. package/dist/walls/06-memory/archive/memory-archive.js.map +1 -1
  51. package/dist/walls/06-memory/mirror/cell-mirror.d.ts +2 -0
  52. package/dist/walls/06-memory/mirror/cell-mirror.d.ts.map +1 -1
  53. package/dist/walls/06-memory/mirror/cell-mirror.js +76 -35
  54. package/dist/walls/06-memory/mirror/cell-mirror.js.map +1 -1
  55. package/dist/walls/06-memory/privacy/key-provider.d.ts +29 -0
  56. package/dist/walls/06-memory/privacy/key-provider.d.ts.map +1 -1
  57. package/dist/walls/06-memory/privacy/key-provider.js +79 -0
  58. package/dist/walls/06-memory/privacy/key-provider.js.map +1 -1
  59. package/dist/walls/06-memory/retrieval/context-pipeline.d.ts +2 -0
  60. package/dist/walls/06-memory/retrieval/context-pipeline.d.ts.map +1 -1
  61. package/dist/walls/06-memory/retrieval/context-pipeline.js +81 -13
  62. package/dist/walls/06-memory/retrieval/context-pipeline.js.map +1 -1
  63. package/dist/walls/06-memory/stores/memory-search.d.ts +9 -0
  64. package/dist/walls/06-memory/stores/memory-search.d.ts.map +1 -1
  65. package/dist/walls/06-memory/stores/memory-search.js +62 -13
  66. package/dist/walls/06-memory/stores/memory-search.js.map +1 -1
  67. package/dist/walls/06-memory/stores/sync-engine.d.ts.map +1 -1
  68. package/dist/walls/06-memory/stores/sync-engine.js +56 -49
  69. package/dist/walls/06-memory/stores/sync-engine.js.map +1 -1
  70. package/dist/walls/06-memory/stores/weekly-report.d.ts +5 -0
  71. package/dist/walls/06-memory/stores/weekly-report.d.ts.map +1 -1
  72. package/dist/walls/06-memory/stores/weekly-report.js +24 -2
  73. package/dist/walls/06-memory/stores/weekly-report.js.map +1 -1
  74. package/dist/walls/06-memory/teach/teach-context.d.ts +8 -0
  75. package/dist/walls/06-memory/teach/teach-context.d.ts.map +1 -0
  76. package/dist/walls/06-memory/teach/teach-context.js +25 -0
  77. package/dist/walls/06-memory/teach/teach-context.js.map +1 -0
  78. package/dist/walls/06-memory/teach/teach-parser.d.ts +6 -0
  79. package/dist/walls/06-memory/teach/teach-parser.d.ts.map +1 -0
  80. package/dist/walls/06-memory/teach/teach-parser.js +42 -0
  81. package/dist/walls/06-memory/teach/teach-parser.js.map +1 -0
  82. package/dist/walls/06-memory/teach/teach-sections.d.ts +10 -0
  83. package/dist/walls/06-memory/teach/teach-sections.d.ts.map +1 -0
  84. package/dist/walls/06-memory/teach/teach-sections.js +67 -0
  85. package/dist/walls/06-memory/teach/teach-sections.js.map +1 -0
  86. package/dist/walls/06-memory/teach/teach-store.d.ts +25 -0
  87. package/dist/walls/06-memory/teach/teach-store.d.ts.map +1 -0
  88. package/dist/walls/06-memory/teach/teach-store.js +95 -0
  89. package/dist/walls/06-memory/teach/teach-store.js.map +1 -0
  90. package/dist/walls/06-memory/vibe/vibe-cli.d.ts +2 -0
  91. package/dist/walls/06-memory/vibe/vibe-cli.d.ts.map +1 -0
  92. package/dist/walls/06-memory/vibe/vibe-cli.js +217 -0
  93. package/dist/walls/06-memory/vibe/vibe-cli.js.map +1 -0
  94. package/dist/walls/06-memory/vibe/vibe-confidence.d.ts +24 -0
  95. package/dist/walls/06-memory/vibe/vibe-confidence.d.ts.map +1 -0
  96. package/dist/walls/06-memory/vibe/vibe-confidence.js +91 -0
  97. package/dist/walls/06-memory/vibe/vibe-confidence.js.map +1 -0
  98. package/dist/walls/06-memory/vibe/vibe-context.d.ts +8 -0
  99. package/dist/walls/06-memory/vibe/vibe-context.d.ts.map +1 -0
  100. package/dist/walls/06-memory/vibe/vibe-context.js +88 -0
  101. package/dist/walls/06-memory/vibe/vibe-context.js.map +1 -0
  102. package/dist/walls/06-memory/vibe/vibe-engine.d.ts +38 -0
  103. package/dist/walls/06-memory/vibe/vibe-engine.d.ts.map +1 -0
  104. package/dist/walls/06-memory/vibe/vibe-engine.js +587 -0
  105. package/dist/walls/06-memory/vibe/vibe-engine.js.map +1 -0
  106. package/dist/walls/06-memory/vibe/vibe-signals.d.ts +24 -0
  107. package/dist/walls/06-memory/vibe/vibe-signals.d.ts.map +1 -0
  108. package/dist/walls/06-memory/vibe/vibe-signals.js +138 -0
  109. package/dist/walls/06-memory/vibe/vibe-signals.js.map +1 -0
  110. package/dist/walls/07-runtime/cli/cli.js +116 -4677
  111. package/dist/walls/07-runtime/cli/cli.js.map +1 -1
  112. package/dist/walls/07-runtime/cli/commands/branch.d.ts +7 -0
  113. package/dist/walls/07-runtime/cli/commands/branch.d.ts.map +1 -0
  114. package/dist/walls/07-runtime/cli/commands/branch.js +169 -0
  115. package/dist/walls/07-runtime/cli/commands/branch.js.map +1 -0
  116. package/dist/walls/07-runtime/cli/commands/ci.d.ts +2 -0
  117. package/dist/walls/07-runtime/cli/commands/ci.d.ts.map +1 -0
  118. package/dist/walls/07-runtime/cli/commands/ci.js +57 -0
  119. package/dist/walls/07-runtime/cli/commands/ci.js.map +1 -0
  120. package/dist/walls/07-runtime/cli/commands/community.d.ts +2 -0
  121. package/dist/walls/07-runtime/cli/commands/community.d.ts.map +1 -0
  122. package/dist/walls/07-runtime/cli/commands/community.js +64 -0
  123. package/dist/walls/07-runtime/cli/commands/community.js.map +1 -0
  124. package/dist/walls/07-runtime/cli/commands/dashboard.d.ts +3 -0
  125. package/dist/walls/07-runtime/cli/commands/dashboard.d.ts.map +1 -0
  126. package/dist/walls/07-runtime/cli/commands/dashboard.js +45 -0
  127. package/dist/walls/07-runtime/cli/commands/dashboard.js.map +1 -0
  128. package/dist/walls/07-runtime/cli/commands/help.d.ts +4 -0
  129. package/dist/walls/07-runtime/cli/commands/help.d.ts.map +1 -0
  130. package/dist/walls/07-runtime/cli/commands/help.js +91 -0
  131. package/dist/walls/07-runtime/cli/commands/help.js.map +1 -0
  132. package/dist/walls/07-runtime/cli/commands/memory.d.ts +5 -0
  133. package/dist/walls/07-runtime/cli/commands/memory.d.ts.map +1 -0
  134. package/dist/walls/07-runtime/cli/commands/memory.js +252 -0
  135. package/dist/walls/07-runtime/cli/commands/memory.js.map +1 -0
  136. package/dist/walls/07-runtime/cli/commands/repl.d.ts +2 -0
  137. package/dist/walls/07-runtime/cli/commands/repl.d.ts.map +1 -0
  138. package/dist/walls/07-runtime/cli/commands/repl.js +63 -0
  139. package/dist/walls/07-runtime/cli/commands/repl.js.map +1 -0
  140. package/dist/walls/07-runtime/cli/commands/scan.d.ts +4 -0
  141. package/dist/walls/07-runtime/cli/commands/scan.d.ts.map +1 -0
  142. package/dist/walls/07-runtime/cli/commands/scan.js +263 -0
  143. package/dist/walls/07-runtime/cli/commands/scan.js.map +1 -0
  144. package/dist/walls/07-runtime/cli/commands/session.d.ts +4 -0
  145. package/dist/walls/07-runtime/cli/commands/session.d.ts.map +1 -0
  146. package/dist/walls/07-runtime/cli/commands/session.js +80 -0
  147. package/dist/walls/07-runtime/cli/commands/session.js.map +1 -0
  148. package/dist/walls/07-runtime/cli/commands/setup.d.ts +4 -0
  149. package/dist/walls/07-runtime/cli/commands/setup.d.ts.map +1 -0
  150. package/dist/walls/07-runtime/cli/commands/setup.js +216 -0
  151. package/dist/walls/07-runtime/cli/commands/setup.js.map +1 -0
  152. package/dist/walls/07-runtime/cli/commands/status.d.ts +4 -0
  153. package/dist/walls/07-runtime/cli/commands/status.d.ts.map +1 -0
  154. package/dist/walls/07-runtime/cli/commands/status.js +352 -0
  155. package/dist/walls/07-runtime/cli/commands/status.js.map +1 -0
  156. package/dist/walls/07-runtime/cli/commands/sync.d.ts +4 -0
  157. package/dist/walls/07-runtime/cli/commands/sync.d.ts.map +1 -0
  158. package/dist/walls/07-runtime/cli/commands/sync.js +116 -0
  159. package/dist/walls/07-runtime/cli/commands/sync.js.map +1 -0
  160. package/dist/walls/07-runtime/cli/commands/teach.d.ts +3 -0
  161. package/dist/walls/07-runtime/cli/commands/teach.d.ts.map +1 -0
  162. package/dist/walls/07-runtime/cli/commands/teach.js +203 -0
  163. package/dist/walls/07-runtime/cli/commands/teach.js.map +1 -0
  164. package/dist/walls/07-runtime/cli/commands/team.d.ts +2 -0
  165. package/dist/walls/07-runtime/cli/commands/team.d.ts.map +1 -0
  166. package/dist/walls/07-runtime/cli/commands/team.js +58 -0
  167. package/dist/walls/07-runtime/cli/commands/team.js.map +1 -0
  168. package/dist/walls/07-runtime/cli/commands/watch.d.ts +4 -0
  169. package/dist/walls/07-runtime/cli/commands/watch.d.ts.map +1 -0
  170. package/dist/walls/07-runtime/cli/commands/watch.js +129 -0
  171. package/dist/walls/07-runtime/cli/commands/watch.js.map +1 -0
  172. package/dist/walls/07-runtime/cli/utils.d.ts +26 -0
  173. package/dist/walls/07-runtime/cli/utils.d.ts.map +1 -0
  174. package/dist/walls/07-runtime/cli/utils.js +217 -0
  175. package/dist/walls/07-runtime/cli/utils.js.map +1 -0
  176. package/dist/walls/07-runtime/daemon/routes/community.d.ts +3 -0
  177. package/dist/walls/07-runtime/daemon/routes/community.d.ts.map +1 -0
  178. package/dist/walls/07-runtime/daemon/routes/community.js +191 -0
  179. package/dist/walls/07-runtime/daemon/routes/community.js.map +1 -0
  180. package/dist/walls/07-runtime/daemon/routes/cost.d.ts +3 -0
  181. package/dist/walls/07-runtime/daemon/routes/cost.d.ts.map +1 -0
  182. package/dist/walls/07-runtime/daemon/routes/cost.js +73 -0
  183. package/dist/walls/07-runtime/daemon/routes/cost.js.map +1 -0
  184. package/dist/walls/07-runtime/daemon/routes/health.d.ts +3 -0
  185. package/dist/walls/07-runtime/daemon/routes/health.d.ts.map +1 -0
  186. package/dist/walls/07-runtime/daemon/routes/health.js +40 -0
  187. package/dist/walls/07-runtime/daemon/routes/health.js.map +1 -0
  188. package/dist/walls/07-runtime/daemon/routes/memory.d.ts +3 -0
  189. package/dist/walls/07-runtime/daemon/routes/memory.d.ts.map +1 -0
  190. package/dist/walls/07-runtime/daemon/routes/memory.js +75 -0
  191. package/dist/walls/07-runtime/daemon/routes/memory.js.map +1 -0
  192. package/dist/walls/07-runtime/daemon/routes/privacy.d.ts +3 -0
  193. package/dist/walls/07-runtime/daemon/routes/privacy.d.ts.map +1 -0
  194. package/dist/walls/07-runtime/daemon/routes/privacy.js +160 -0
  195. package/dist/walls/07-runtime/daemon/routes/privacy.js.map +1 -0
  196. package/dist/walls/07-runtime/daemon/routes/project.d.ts +3 -0
  197. package/dist/walls/07-runtime/daemon/routes/project.d.ts.map +1 -0
  198. package/dist/walls/07-runtime/daemon/routes/project.js +59 -0
  199. package/dist/walls/07-runtime/daemon/routes/project.js.map +1 -0
  200. package/dist/walls/07-runtime/daemon/routes/session.d.ts +3 -0
  201. package/dist/walls/07-runtime/daemon/routes/session.d.ts.map +1 -0
  202. package/dist/walls/07-runtime/daemon/routes/session.js +101 -0
  203. package/dist/walls/07-runtime/daemon/routes/session.js.map +1 -0
  204. package/dist/walls/07-runtime/daemon/routes/signal.d.ts +3 -0
  205. package/dist/walls/07-runtime/daemon/routes/signal.d.ts.map +1 -0
  206. package/dist/walls/07-runtime/daemon/routes/signal.js +60 -0
  207. package/dist/walls/07-runtime/daemon/routes/signal.js.map +1 -0
  208. package/dist/walls/07-runtime/daemon/routes/workflow.d.ts +3 -0
  209. package/dist/walls/07-runtime/daemon/routes/workflow.d.ts.map +1 -0
  210. package/dist/walls/07-runtime/daemon/routes/workflow.js +105 -0
  211. package/dist/walls/07-runtime/daemon/routes/workflow.js.map +1 -0
  212. package/dist/walls/07-runtime/daemon/server.d.ts.map +1 -1
  213. package/dist/walls/07-runtime/daemon/server.js +22 -0
  214. package/dist/walls/07-runtime/daemon/server.js.map +1 -1
  215. package/package.json +1 -1
  216. package/scripts/deep-audit.js +103 -0
  217. package/dist/walls/03-knowledge/decisions/cross-model-engine.d.ts +0 -38
  218. package/dist/walls/03-knowledge/decisions/cross-model-engine.d.ts.map +0 -1
  219. package/dist/walls/03-knowledge/decisions/cross-model-engine.js +0 -98
  220. package/dist/walls/03-knowledge/decisions/cross-model-engine.js.map +0 -1
  221. package/dist/walls/03-knowledge/decisions/insight-generator.d.ts +0 -58
  222. package/dist/walls/03-knowledge/decisions/insight-generator.d.ts.map +0 -1
  223. package/dist/walls/03-knowledge/decisions/insight-generator.js +0 -314
  224. package/dist/walls/03-knowledge/decisions/insight-generator.js.map +0 -1
  225. package/dist/walls/05-community/stats/community-advanced-engine.d.ts +0 -30
  226. package/dist/walls/05-community/stats/community-advanced-engine.d.ts.map +0 -1
  227. package/dist/walls/05-community/stats/community-advanced-engine.js +0 -103
  228. package/dist/walls/05-community/stats/community-advanced-engine.js.map +0 -1
  229. package/dist/walls/05-community/stats/community-engine.d.ts +0 -62
  230. package/dist/walls/05-community/stats/community-engine.d.ts.map +0 -1
  231. package/dist/walls/05-community/stats/community-engine.js +0 -194
  232. package/dist/walls/05-community/stats/community-engine.js.map +0 -1
  233. package/dist/walls/05-community/stats/community-v2.d.ts +0 -106
  234. package/dist/walls/05-community/stats/community-v2.d.ts.map +0 -1
  235. package/dist/walls/05-community/stats/community-v2.js +0 -378
  236. package/dist/walls/05-community/stats/community-v2.js.map +0 -1
  237. package/dist/walls/08-cloud-bridge/sync/ai-bridge.d.ts +0 -20
  238. package/dist/walls/08-cloud-bridge/sync/ai-bridge.d.ts.map +0 -1
  239. package/dist/walls/08-cloud-bridge/sync/ai-bridge.js +0 -250
  240. package/dist/walls/08-cloud-bridge/sync/ai-bridge.js.map +0 -1
  241. package/dist/walls/08-cloud-bridge/sync/cloud-client.d.ts +0 -40
  242. package/dist/walls/08-cloud-bridge/sync/cloud-client.d.ts.map +0 -1
  243. package/dist/walls/08-cloud-bridge/sync/cloud-client.js +0 -126
  244. package/dist/walls/08-cloud-bridge/sync/cloud-client.js.map +0 -1
  245. package/dist/walls/08-cloud-bridge/sync/cloud-sync.d.ts +0 -66
  246. package/dist/walls/08-cloud-bridge/sync/cloud-sync.d.ts.map +0 -1
  247. package/dist/walls/08-cloud-bridge/sync/cloud-sync.js +0 -328
  248. package/dist/walls/08-cloud-bridge/sync/cloud-sync.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fivocell",
3
- "version": "6.2.0",
3
+ "version": "7.0.0",
4
4
  "description": "FIVO Cell — Permanent Developer Memory. Learns how you think, build, fail, and grow.",
5
5
  "main": "dist/walls/07-runtime/cli/cli.js",
6
6
  "types": "dist/walls/07-runtime/cli/cli.d.ts",
@@ -0,0 +1,103 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ let results = {
5
+ secrets: [],
6
+ dynamicRequire: [],
7
+ unsafeFs: [],
8
+ noValidation: [],
9
+ processExit: [],
10
+ evalUsage: [],
11
+ rawSqlInjection: [],
12
+ pathTraversal: [],
13
+ };
14
+
15
+ function walk(dir) {
16
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
17
+ for (const e of entries) {
18
+ if (e.name.startsWith('.') || e.name === 'node_modules' || e.name === 'dist' || e.name === 'coverage') continue;
19
+ const p = path.join(dir, e.name);
20
+ if (e.isDirectory()) {
21
+ walk(p);
22
+ } else if (e.name.endsWith('.ts') && !e.name.includes('.test.')) {
23
+ const content = fs.readFileSync(p, 'utf8');
24
+ const lines = content.split('\n');
25
+ const short = p.replace(/^.*[\\/]Fivo-Cell[\\/]/, '');
26
+
27
+ for (let i = 0; i < lines.length; i++) {
28
+ const l = lines[i];
29
+ const ln = i + 1;
30
+
31
+ // Hardcoded secrets
32
+ if (l.match(/password\s*[:=]\s*['"`][^'"`]{3,}['"`]/i) && !l.includes('example') && !l.includes('//') && !l.includes('TODO')) {
33
+ results.secrets.push(`${short}:${ln}: HARDCODED: ${l.trim().substring(0, 100)}`);
34
+ }
35
+
36
+ // Dynamic require from user input
37
+ if (l.includes('require(') && (l.includes('req.query') || l.includes('req.body') || l.includes('req.params') || l.includes('args['))) {
38
+ results.dynamicRequire.push(`${short}:${ln}: ${l.trim().substring(0, 120)}`);
39
+ }
40
+
41
+ // Unsafe file operations
42
+ if ((l.includes('writeFileSync') || l.includes('unlinkSync') || l.includes('rmSync') || l.includes('mkdirSync')) && (l.includes('req.query') || l.includes('req.body') || l.includes('req.params'))) {
43
+ results.unsafeFs.push(`${short}:${ln}: ${l.trim().substring(0, 120)}`);
44
+ }
45
+
46
+ // Process exit in non-CLI code
47
+ if (l.includes('process.exit(') && !short.includes('cli') && !short.includes('validation') && !short.includes('setup') && !short.includes('watcher') && !short.includes('repl')) {
48
+ results.processExit.push(`${short}:${ln}: ${l.trim().substring(0, 120)}`);
49
+ }
50
+
51
+ // Eval
52
+ if (l.includes('eval(') && !l.includes('//')) {
53
+ results.evalUsage.push(`${short}:${ln}: ${l.trim().substring(0, 120)}`);
54
+ }
55
+
56
+ // Raw SQL injection
57
+ if ((l.includes('.exec(') || l.includes('.prepare(') || l.includes('.run(')) && (l.includes('req.query') || l.includes('req.body') || l.includes('req.params')) && !l.includes('String(') && !l.includes('parseInt(') && !l.includes('parseFloat(') && !l.includes('Number(')) {
58
+ results.rawSqlInjection.push(`${short}:${ln}: ${l.trim().substring(0, 150)}`);
59
+ }
60
+
61
+ // Path traversal
62
+ if (l.includes('path.join(') && (l.includes('req.query') || l.includes('req.body') || l.includes('req.params')) && !l.includes('os.homedir') && !l.includes('process.cwd')) {
63
+ results.pathTraversal.push(`${short}:${ln}: ${l.trim().substring(0, 150)}`);
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ walk('src');
71
+
72
+ console.log('=== HARCODED SECRETS ===');
73
+ results.secrets.forEach(s => console.log(' ' + s));
74
+ console.log(' Count: ' + results.secrets.length);
75
+
76
+ console.log('\n=== DYNAMIC REQUIRE FROM INPUT ===');
77
+ results.dynamicRequire.forEach(s => console.log(' ' + s));
78
+ console.log(' Count: ' + results.dynamicRequire.length);
79
+
80
+ console.log('\n=== UNSAFE FS WITH USER INPUT ===');
81
+ results.unsafeFs.forEach(s => console.log(' ' + s));
82
+ console.log(' Count: ' + results.unsafeFs.length);
83
+
84
+ console.log('\n=== PROCESS.EXIT IN NON-CLI ===');
85
+ results.processExit.forEach(s => console.log(' ' + s));
86
+ console.log(' Count: ' + results.processExit.length);
87
+
88
+ console.log('\n=== EVAL USAGE ===');
89
+ results.evalUsage.forEach(s => console.log(' ' + s));
90
+ console.log(' Count: ' + results.evalUsage.length);
91
+
92
+ console.log('\n=== RAW SQL INJECTION RISK ===');
93
+ results.rawSqlInjection.forEach(s => console.log(' ' + s));
94
+ console.log(' Count: ' + results.rawSqlInjection.length);
95
+
96
+ console.log('\n=== PATH TRAVERSAL ===');
97
+ results.pathTraversal.forEach(s => console.log(' ' + s));
98
+ console.log(' Count: ' + results.pathTraversal.length);
99
+
100
+ const total = results.secrets.length + results.dynamicRequire.length + results.unsafeFs.length + results.processExit.length + results.evalUsage.length + results.rawSqlInjection.length + results.pathTraversal.length;
101
+ console.log('\n========================================');
102
+ console.log('TOTAL SECURITY FINDINGS: ' + total);
103
+ if (total === 0) console.log('CLEAN — No security vulnerabilities found.');
@@ -1,38 +0,0 @@
1
- export interface ModelProfile {
2
- modelName: string;
3
- taskType: string;
4
- totalCalls: number;
5
- acceptedCount: number;
6
- rejectedCount: number;
7
- avgResponseTimeMs: number;
8
- trustScore: number;
9
- }
10
- export interface ModelRecommendation {
11
- taskType: string;
12
- bestModel: string;
13
- trustScore: number;
14
- reason: string;
15
- alternatives: Array<{
16
- model: string;
17
- trustScore: number;
18
- }>;
19
- }
20
- export interface CrossModelReport {
21
- profiles: ModelProfile[];
22
- recommendations: ModelRecommendation[];
23
- bestOverall: string;
24
- totalInteractions: number;
25
- generatedAt: string;
26
- }
27
- export declare function recordModelInteraction(params: {
28
- modelName: string;
29
- taskType: string;
30
- accepted: boolean;
31
- responseTimeMs?: number;
32
- project?: string;
33
- suggestion?: string;
34
- }): void;
35
- export declare function getModelProfiles(): ModelProfile[];
36
- export declare function getModelRecommendations(): ModelRecommendation[];
37
- export declare function generateCrossModelReport(): CrossModelReport;
38
- //# sourceMappingURL=cross-model-engine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cross-model-engine.d.ts","sourceRoot":"","sources":["../../../../src/walls/03-knowledge/decisions/cross-model-engine.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,eAAe,EAAE,mBAAmB,EAAE,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB;AAID,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,IAAI,CA2BP;AAID,wBAAgB,gBAAgB,IAAI,YAAY,EAAE,CA8BjD;AAED,wBAAgB,uBAAuB,IAAI,mBAAmB,EAAE,CAgC/D;AAED,wBAAgB,wBAAwB,IAAI,gBAAgB,CAkB3D"}
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.recordModelInteraction = recordModelInteraction;
4
- exports.getModelProfiles = getModelProfiles;
5
- exports.getModelRecommendations = getModelRecommendations;
6
- exports.generateCrossModelReport = generateCrossModelReport;
7
- const database_1 = require("../../06-memory/database/database");
8
- // ─── Engine ──────────────────────────────────────────────────────────────────
9
- function recordModelInteraction(params) {
10
- const db = (0, database_1.getDb)();
11
- db.exec(`
12
- CREATE TABLE IF NOT EXISTS model_interactions (
13
- id INTEGER PRIMARY KEY AUTOINCREMENT,
14
- model_name TEXT NOT NULL,
15
- task_type TEXT NOT NULL,
16
- accepted INTEGER DEFAULT 0,
17
- response_time_ms INTEGER,
18
- project TEXT,
19
- suggestion TEXT,
20
- created_at TEXT DEFAULT (datetime('now'))
21
- );
22
- CREATE INDEX IF NOT EXISTS idx_model_interactions_model ON model_interactions(model_name, task_type);
23
- `);
24
- db.prepare('INSERT INTO model_interactions (model_name, task_type, accepted, response_time_ms, project, suggestion) VALUES (?, ?, ?, ?, ?, ?)').run(params.modelName, params.taskType, params.accepted ? 1 : 0, params.responseTimeMs || null, params.project || null, params.suggestion || null);
25
- }
26
- // ─── Analysis ────────────────────────────────────────────────────────────────
27
- function getModelProfiles() {
28
- const db = (0, database_1.getDb)();
29
- const rows = db.prepare(`
30
- SELECT model_name, task_type,
31
- COUNT(*) as total,
32
- SUM(accepted) as accepted,
33
- SUM(CASE WHEN accepted = 0 THEN 1 ELSE 0 END) as rejected,
34
- AVG(response_time_ms) as avg_time
35
- FROM model_interactions
36
- GROUP BY model_name, task_type
37
- HAVING total >= 2
38
- ORDER BY model_name, accepted DESC
39
- `).all();
40
- return rows.map((r) => {
41
- const total = r.total;
42
- const accepted = r.accepted;
43
- const trustScore = total > 0 ? Math.round((accepted / total) * 100) : 50;
44
- return {
45
- modelName: r.model_name,
46
- taskType: r.task_type,
47
- totalCalls: total,
48
- acceptedCount: accepted,
49
- rejectedCount: r.rejected,
50
- avgResponseTimeMs: Math.round(r.avg_time || 0),
51
- trustScore,
52
- };
53
- });
54
- }
55
- function getModelRecommendations() {
56
- const profiles = getModelProfiles();
57
- const byTask = new Map();
58
- for (const p of profiles) {
59
- const list = byTask.get(p.taskType) || [];
60
- list.push(p);
61
- byTask.set(p.taskType, list);
62
- }
63
- const recommendations = [];
64
- for (const [taskType, models] of byTask) {
65
- models.sort((a, b) => b.trustScore - a.trustScore);
66
- const best = models[0];
67
- const alternatives = models.slice(1, 3).map(m => ({ model: m.modelName, trustScore: m.trustScore }));
68
- let reason = '';
69
- if (best.trustScore >= 90)
70
- reason = `"${best.modelName}" consistently delivers — ${best.acceptedCount}/${best.totalCalls} accepted.`;
71
- else if (best.trustScore >= 70)
72
- reason = `"${best.modelName}" works well — ${best.trustScore}/100 trust. ${alternatives.length > 0 ? `Better than ${alternatives.map(a => a.model).join(', ')}.` : ''}`;
73
- else
74
- reason = `Mixed results (${best.trustScore}/100). Try different tool for this task.`;
75
- recommendations.push({
76
- taskType,
77
- bestModel: best.modelName,
78
- trustScore: best.trustScore,
79
- reason,
80
- alternatives,
81
- });
82
- }
83
- return recommendations;
84
- }
85
- function generateCrossModelReport() {
86
- const profiles = getModelProfiles();
87
- const recommendations = getModelRecommendations();
88
- const topModel = profiles.reduce((best, p) => p.trustScore > (best?.trustScore || 0) ? p : best, profiles[0]);
89
- const total = profiles.reduce((s, p) => s + p.totalCalls, 0);
90
- return {
91
- profiles: profiles.sort((a, b) => b.trustScore - a.trustScore).slice(0, 20),
92
- recommendations: recommendations.slice(0, 10),
93
- bestOverall: topModel?.modelName || 'unknown',
94
- totalInteractions: total,
95
- generatedAt: new Date().toISOString(),
96
- };
97
- }
98
- //# sourceMappingURL=cross-model-engine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cross-model-engine.js","sourceRoot":"","sources":["../../../../src/walls/03-knowledge/decisions/cross-model-engine.ts"],"names":[],"mappings":";;AAgCA,wDAkCC;AAID,4CA8BC;AAED,0DAgCC;AAED,4DAkBC;AA1JD,gEAA0D;AA8B1D,gFAAgF;AAEhF,SAAgB,sBAAsB,CAAC,MAOtC;IACC,MAAM,EAAE,GAAG,IAAA,gBAAK,GAAE,CAAC;IAEnB,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;GAYP,CAAC,CAAC;IAEH,EAAE,CAAC,OAAO,CACR,mIAAmI,CACpI,CAAC,GAAG,CACH,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACvB,MAAM,CAAC,cAAc,IAAI,IAAI,EAC7B,MAAM,CAAC,OAAO,IAAI,IAAI,EACtB,MAAM,CAAC,UAAU,IAAI,IAAI,CAC1B,CAAC;AACJ,CAAC;AAED,gFAAgF;AAEhF,SAAgB,gBAAgB;IAC9B,MAAM,EAAE,GAAG,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AAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,eAAe,GAAG,uBAAuB,EAAE,CAAC;IAElD,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAC9B,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,IAAI,EAAE,UAAU,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAC9D,QAAQ,CAAC,CAAC,CAAC,CACZ,CAAC;IAEF,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAE7D,OAAO;QACL,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QAC3E,eAAe,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QAC7C,WAAW,EAAE,QAAQ,EAAE,SAAS,IAAI,SAAS;QAC7C,iBAAiB,EAAE,KAAK;QACxB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACtC,CAAC;AACJ,CAAC"}
@@ -1,58 +0,0 @@
1
- export interface Trend {
2
- metric: string;
3
- direction: 'improving' | 'stable' | 'declining' | 'insufficient-data';
4
- details: string;
5
- firstValue: string;
6
- latestValue: string;
7
- }
8
- export interface ProgressMetrics {
9
- independence: {
10
- score: number;
11
- detail: string;
12
- trend: Trend['direction'];
13
- };
14
- speed: {
15
- score: number;
16
- detail: string;
17
- trend: Trend['direction'];
18
- };
19
- quality: {
20
- score: number;
21
- detail: string;
22
- trend: Trend['direction'];
23
- };
24
- repeatMistakes: {
25
- count: number;
26
- detail: string;
27
- trend: Trend['direction'];
28
- };
29
- testCoverage: {
30
- percentage: number;
31
- detail: string;
32
- trend: Trend['direction'];
33
- };
34
- }
35
- export interface LevelAssessment {
36
- currentLevel: 'junior' | 'mid' | 'senior' | 'unclear';
37
- confidence: number;
38
- evidence: string[];
39
- missingSkills: string[];
40
- timeToNextLevel: string;
41
- nextLevel: 'mid' | 'senior' | 'staff' | 'done';
42
- }
43
- export interface InsightReport {
44
- trends: Trend[];
45
- progress: ProgressMetrics;
46
- level: LevelAssessment;
47
- growthStory: string[];
48
- strengths: string[];
49
- weaknesses: string[];
50
- recommendations: string[];
51
- nextFocus: string[];
52
- snapshotCount: number;
53
- daysTracked: number;
54
- generatedAt: string;
55
- }
56
- export declare function buildInsightReport(): InsightReport;
57
- export declare function saveInsightReport(report: InsightReport): string;
58
- //# sourceMappingURL=insight-generator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insight-generator.d.ts","sourceRoot":"","sources":["../../../../src/walls/03-knowledge/decisions/insight-generator.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,mBAAmB,CAAC;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC;IAC3E,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC;IACpE,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM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(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.buildInsightReport = buildInsightReport;
37
- exports.saveInsightReport = saveInsightReport;
38
- const fs = __importStar(require("fs"));
39
- const path = __importStar(require("path"));
40
- const os = __importStar(require("os"));
41
- function memoryDir() { return path.join(os.homedir(), '.fivo', 'cell', 'memory'); }
42
- function readSnapshots(prefix) {
43
- const dir = memoryDir();
44
- if (!fs.existsSync(dir))
45
- return [];
46
- const files = fs.readdirSync(dir).filter(f => f.startsWith(prefix) && f.endsWith('.json')).sort();
47
- return files.map(f => {
48
- try {
49
- return JSON.parse(fs.readFileSync(path.join(dir, f), 'utf-8'));
50
- }
51
- catch {
52
- return null;
53
- }
54
- }).filter(Boolean);
55
- }
56
- function trending(values) {
57
- if (values.length < 2)
58
- return 'insufficient-data';
59
- const first = values[0];
60
- const last = values[values.length - 1];
61
- const diff = last - first;
62
- if (diff > 0)
63
- return values.length >= 3 ? 'improving' : 'stable';
64
- if (diff < 0)
65
- return 'declining';
66
- return 'stable';
67
- }
68
- function buildInsightReport() {
69
- const intelSnaps = readSnapshots('intelligence-');
70
- const journeySnaps = readSnapshots('journey-');
71
- const allSnaps = [...intelSnaps, ...journeySnaps].filter(s => s.generatedAt);
72
- allSnaps.sort((a, b) => new Date(a.generatedAt).getTime() - new Date(b.generatedAt).getTime());
73
- const daysTracked = allSnaps.length > 1
74
- ? Math.ceil((new Date(allSnaps[allSnaps.length - 1].generatedAt).getTime() - new Date(allSnaps[0].generatedAt).getTime()) / (24 * 60 * 60 * 1000))
75
- : 0;
76
- const latest = allSnaps[allSnaps.length - 1] || null;
77
- const trends = [];
78
- const metricsFromIntels = [];
79
- const bugCounts = [];
80
- const mistakeCounts = [];
81
- const blindCounts = [];
82
- const totalFiles = [];
83
- for (const snap of intelSnaps) {
84
- if (snap.bugHistory)
85
- bugCounts.push(snap.bugHistory.length);
86
- if (snap.mistakes)
87
- mistakeCounts.push(snap.mistakes.length);
88
- if (snap.blindSpots)
89
- blindCounts.push(snap.blindSpots.length);
90
- if (snap.totalFiles)
91
- totalFiles.push(snap.totalFiles);
92
- metricsFromIntels.push(1);
93
- }
94
- trends.push({ metric: 'Bugs found', direction: trending(bugCounts), details: bugCounts.length > 1 ? `Changed from ${bugCounts[0]} to ${bugCounts[bugCounts.length - 1]}` : 'Single snapshot', firstValue: String(bugCounts[0] || 0), latestValue: String(bugCounts[bugCounts.length - 1] || 0) });
95
- trends.push({ metric: 'Repeat mistakes', direction: trending(mistakeCounts), details: mistakeCounts.length > 1 ? `Changed from ${mistakeCounts[0]} to ${mistakeCounts[mistakeCounts.length - 1]}` : 'Single snapshot', firstValue: String(mistakeCounts[0] || 0), latestValue: String(mistakeCounts[mistakeCounts.length - 1] || 0) });
96
- trends.push({ metric: 'Blind spots', direction: trending(blindCounts).replace('improving', 'declining').replace('declining', 'improving'), details: blindCounts.length > 1 ? `Changed from ${blindCounts[0]} to ${blindCounts[blindCounts.length - 1]}` : 'Single snapshot', firstValue: String(blindCounts[0] || 0), latestValue: String(blindCounts[blindCounts.length - 1] || 0) });
97
- const progress = {
98
- independence: { score: daysTracked > 30 ? 75 : 50, detail: 'Still building baseline data', trend: 'stable' },
99
- speed: { score: daysTracked > 30 ? 70 : 50, detail: `${bugCounts.length > 0 ? 'Bug fixing tracked' : 'No bug data yet'}`, trend: 'stable' },
100
- quality: { score: daysTracked > 30 ? 80 : 50, detail: `${blindCounts.length > 0 && blindCounts[0] > 0 ? `${blindCounts[0]} blind spots detected` : 'Clean code detected'}`, trend: 'stable' },
101
- repeatMistakes: { count: mistakeCounts[mistakeCounts.length - 1] || 0, detail: 'Tracking started', trend: 'stable' },
102
- testCoverage: { percentage: 0, detail: 'Not yet measured', trend: 'stable' },
103
- };
104
- let levelScore = 0;
105
- const evidence = [];
106
- const missingSk = [];
107
- if (latest) {
108
- const skills = latest.skills || [];
109
- const mastered = skills.filter((s) => s.currentLevel === 'mastered').length;
110
- const proficient = skills.filter((s) => s.currentLevel === 'proficient' || s.currentLevel === 'mastered').length;
111
- const total = skills.length || 1;
112
- if (mastered >= 1) {
113
- levelScore += 30;
114
- evidence.push(`${mastered} languages/skills at MASTERED level`);
115
- }
116
- else if (proficient >= 2) {
117
- levelScore += 20;
118
- evidence.push(`${proficient} languages at proficient+ level`);
119
- }
120
- else {
121
- levelScore += 10;
122
- missingSk.push('Master or become proficient in at least 1 language');
123
- }
124
- if (latest.summary && latest.summary.totalCommits > 200) {
125
- levelScore += 20;
126
- evidence.push(`${latest.summary.totalCommits} commits across projects`);
127
- }
128
- else {
129
- levelScore += 10;
130
- missingSk.push('More consistent commits needed');
131
- }
132
- if (latest.summary && latest.summary.totalProjects >= 5) {
133
- levelScore += 15;
134
- evidence.push(`${latest.summary.totalProjects} projects built`);
135
- }
136
- else {
137
- missingSk.push('Build more projects (currently <5)');
138
- }
139
- if (bugCounts.length > 0 && bugCounts[bugCounts.length - 1] < 10) {
140
- levelScore += 15;
141
- evidence.push('Low bug count — quality code');
142
- }
143
- else if (bugCounts.length > 0) {
144
- levelScore += 5;
145
- evidence.push(`${bugCounts[bugCounts.length - 1]} bugs found — moderate quality`);
146
- }
147
- const chainsCount = latest.chains ? latest.chains.length : 0;
148
- if (chainsCount >= 2) {
149
- levelScore += 10;
150
- evidence.push(`${chainsCount} solution patterns reused across projects`);
151
- }
152
- else {
153
- missingSk.push('Reuse more patterns across projects');
154
- }
155
- if (daysTracked > 30) {
156
- levelScore += 10;
157
- evidence.push(`${daysTracked}+ days of tracked development`);
158
- }
159
- else {
160
- missingSk.push('Need 30+ days of tracking for accurate assessment');
161
- }
162
- }
163
- let currentLevel = 'unclear';
164
- let nextLevel = 'mid';
165
- let timeToNext = 'Needs more data (run `cell intelligence` regularly)';
166
- if (levelScore >= 80) {
167
- currentLevel = 'senior';
168
- nextLevel = 'done';
169
- timeToNext = 'At peak — focus on leadership/architecture';
170
- }
171
- else if (levelScore >= 50) {
172
- currentLevel = 'mid';
173
- nextLevel = 'senior';
174
- timeToNext = '~6 months to senior with consistent practice';
175
- }
176
- else if (levelScore >= 20) {
177
- currentLevel = 'junior';
178
- nextLevel = 'mid';
179
- timeToNext = '~3-6 months to mid-level';
180
- }
181
- else {
182
- currentLevel = 'junior';
183
- nextLevel = 'mid';
184
- timeToNext = 'Build more projects to establish baseline';
185
- }
186
- const level = { currentLevel, confidence: Math.min(100, levelScore), evidence, missingSkills: missingSk, timeToNextLevel: timeToNext, nextLevel };
187
- const strengths = [];
188
- const weaknesses = [];
189
- if (latest) {
190
- const skills = latest.skills || [];
191
- for (const s of skills) {
192
- if (s.currentLevel === 'mastered' || s.currentLevel === 'proficient')
193
- strengths.push(s.area);
194
- else
195
- weaknesses.push(s.area);
196
- }
197
- if (latest.summary && latest.summary.totalProjects >= 5)
198
- strengths.push('Serial builder (builds many projects)');
199
- if (bugCounts.length > 0 && bugCounts[bugCounts.length - 1] < 5)
200
- strengths.push('Low bug rate — produces quality code');
201
- }
202
- const recommendations = [];
203
- const nextFocus = [];
204
- if (weaknesses.length > 0) {
205
- recommendations.push(`Improve ${weaknesses.join(', ')}`);
206
- nextFocus.push(weaknesses[0]);
207
- }
208
- if (level.currentLevel === 'junior') {
209
- recommendations.push('Build 2-3 more production projects with real users');
210
- nextFocus.push('Ship a real product');
211
- }
212
- if (level.currentLevel === 'mid') {
213
- recommendations.push('Lead a project end-to-end or mentor someone');
214
- nextFocus.push('Leadership experience');
215
- }
216
- if (blindCounts.length > 0 && blindCounts[blindCounts.length - 1] > 10) {
217
- recommendations.push(`Fix the ${blindCounts[blindCounts.length - 1]} blind spots in your codebase`);
218
- nextFocus.push('Clean up technical debt');
219
- }
220
- if (daysTracked < 30) {
221
- recommendations.push('Run `cell intelligence` and `cell journey` weekly to build your profile');
222
- nextFocus.push('Keep tracking (run cell weekly)');
223
- }
224
- if (strengths.length > 0) {
225
- recommendations.push(`Double down on your strengths: ${strengths.slice(0, 3).join(', ')}`);
226
- }
227
- const growthStory = [];
228
- if (daysTracked > 0) {
229
- growthStory.push(`Tracked for ${daysTracked} days across ${latest.summary ? latest.summary.totalProjects : 0} projects`);
230
- if (strengths.length > 0)
231
- growthStory.push(`Built strong skills in: ${strengths.slice(0, 3).join(', ')}`);
232
- if (bugCounts.length > 0 && bugCounts[bugCounts.length - 1] < 10)
233
- growthStory.push(`Maintains good code quality — bug count is low`);
234
- }
235
- else {
236
- growthStory.push('Just started tracking — check back in a month for meaningful trends');
237
- growthStory.push('Run `cell intelligence` and `cell journey` weekly to build your profile');
238
- }
239
- return { trends, progress, level, growthStory, strengths, weaknesses, recommendations, nextFocus, snapshotCount: allSnaps.length, daysTracked, generatedAt: new Date().toISOString() };
240
- }
241
- function saveInsightReport(report) {
242
- const dir = path.join(os.homedir(), '.fivo', 'cell');
243
- if (!fs.existsSync(dir))
244
- fs.mkdirSync(dir, { recursive: true });
245
- const fp = path.join(dir, 'insights.json');
246
- fs.writeFileSync(fp, JSON.stringify(report, null, 2), 'utf-8');
247
- const mdPath = path.join(dir, 'insights.md');
248
- fs.writeFileSync(mdPath, renderInsightsMd(report), 'utf-8');
249
- return fp;
250
- }
251
- function renderInsightsMd(r) {
252
- const l = [];
253
- l.push('# 🔮 FIVO Cell — Your Growth Insights');
254
- l.push('');
255
- l.push(`> Generated: ${r.generatedAt}`);
256
- l.push(`> Snapshots: ${r.snapshotCount} | Days tracked: ${r.daysTracked}`);
257
- l.push('');
258
- const levelIcons = { senior: '🏆', mid: '🔥', junior: '🌱', unclear: '❓' };
259
- l.push(`## 🎯 Current Level: ${levelIcons[r.level.currentLevel]} ${r.level.currentLevel.toUpperCase()} (${r.level.confidence}% confidence)`);
260
- l.push('');
261
- if (r.level.evidence.length > 0) {
262
- l.push('### Evidence');
263
- for (const e of r.level.evidence)
264
- l.push(`- ✅ ${e}`);
265
- l.push('');
266
- }
267
- if (r.level.missingSkills.length > 0) {
268
- l.push('### Missing for next level');
269
- for (const m of r.level.missingSkills)
270
- l.push(`- ⏳ ${m}`);
271
- l.push('');
272
- }
273
- l.push(`**Next level:** ${r.level.nextLevel} | **ETA:** ${r.level.timeToNextLevel}`);
274
- l.push('');
275
- l.push('## 📈 Trends');
276
- l.push('');
277
- for (const t of r.trends) {
278
- const dirIcon = t.direction === 'improving' ? '📈' : t.direction === 'declining' ? '📉' : '➡️';
279
- l.push(`- ${dirIcon} **${t.metric}**: ${t.direction} — ${t.details}`);
280
- }
281
- l.push('');
282
- if (r.strengths.length > 0) {
283
- l.push('## 💪 Strengths');
284
- for (const s of r.strengths)
285
- l.push(`- ${s}`);
286
- l.push('');
287
- }
288
- if (r.weaknesses.length > 0) {
289
- l.push('## 🎯 Areas to improve');
290
- for (const w of r.weaknesses)
291
- l.push(`- ${w}`);
292
- l.push('');
293
- }
294
- if (r.growthStory.length > 0) {
295
- l.push('## 📖 Your Growth Story');
296
- for (const g of r.growthStory)
297
- l.push(`- ${g}`);
298
- l.push('');
299
- }
300
- if (r.recommendations.length > 0) {
301
- l.push('## 💡 Recommendations');
302
- for (const rec of r.recommendations)
303
- l.push(`- ${rec}`);
304
- l.push('');
305
- }
306
- if (r.nextFocus.length > 0) {
307
- l.push('## 🎯 Next to focus on');
308
- for (const nf of r.nextFocus)
309
- l.push(`- 🔥 ${nf}`);
310
- l.push('');
311
- }
312
- return l.join('\n');
313
- }
314
- //# sourceMappingURL=insight-generator.js.map