sera-code 0.0.0-stage → 0.1.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 (456) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE-SERA.md +25 -0
  3. package/README.md +27 -2
  4. package/THIRD_PARTY_NOTICES.md +68 -0
  5. package/bin/sera.mjs +137 -0
  6. package/dist/bundle/chunks/anthropic-messages-RD7GXOQL.js +6 -0
  7. package/dist/bundle/chunks/anthropic.js +75 -0
  8. package/dist/bundle/chunks/azure-openai-responses-CJT3KTVK.js +2 -0
  9. package/dist/bundle/chunks/bedrock-converse-stream.js +89 -0
  10. package/dist/bundle/chunks/chunk-46WGNYIE.js +82 -0
  11. package/dist/bundle/chunks/chunk-4UNN5OGR.js +4 -0
  12. package/dist/bundle/chunks/chunk-53H5DPHA.js +16 -0
  13. package/dist/bundle/chunks/chunk-5AGIVGSV.js +6 -0
  14. package/dist/bundle/chunks/chunk-6JXVX6Q2.js +2 -0
  15. package/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
  16. package/dist/bundle/chunks/chunk-7CBJINYJ.js +20 -0
  17. package/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
  18. package/dist/bundle/chunks/chunk-7RZ5BS7U.js +2 -0
  19. package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
  20. package/dist/bundle/chunks/chunk-BPHHHEET.js +9 -0
  21. package/dist/bundle/chunks/chunk-BSS6T6KQ.js +2 -0
  22. package/dist/bundle/chunks/chunk-CF5GWZHW.js +31 -0
  23. package/dist/bundle/chunks/chunk-EDSQGWII.js +44 -0
  24. package/dist/bundle/chunks/chunk-FFMDRXC4.js +10 -0
  25. package/dist/bundle/chunks/chunk-GUGC72EB.js +1222 -0
  26. package/dist/bundle/chunks/chunk-HODJBMOY.js +9 -0
  27. package/dist/bundle/chunks/chunk-HQBQWHLD.js +7 -0
  28. package/dist/bundle/chunks/chunk-HQJBN2MC.js +2 -0
  29. package/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
  30. package/dist/bundle/chunks/chunk-KXU77PUU.js +4 -0
  31. package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
  32. package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
  33. package/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
  34. package/dist/bundle/chunks/chunk-M3LEVT3X.js +2 -0
  35. package/dist/bundle/chunks/chunk-P7FPUEYA.js +2 -0
  36. package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
  37. package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
  38. package/dist/bundle/chunks/chunk-PMRZO46Y.js +2 -0
  39. package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
  40. package/dist/bundle/chunks/chunk-QTM7S6TH.js +2 -0
  41. package/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
  42. package/dist/bundle/chunks/chunk-TLNP2BSO.js +2 -0
  43. package/dist/bundle/chunks/chunk-TMKHGABX.js +2 -0
  44. package/dist/bundle/chunks/chunk-TMTOQ7H7.js +2 -0
  45. package/dist/bundle/chunks/chunk-UKVNB6C4.js +2 -0
  46. package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
  47. package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
  48. package/dist/bundle/chunks/chunk-ZLAHUYDW.js +131 -0
  49. package/dist/bundle/chunks/chunk-ZNCN2NGY.js +60 -0
  50. package/dist/bundle/chunks/cli-MML2DU4A.js +51 -0
  51. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-QPZQRBK5.js +2 -0
  52. package/dist/bundle/chunks/codemode-worker.js +478 -0
  53. package/dist/bundle/chunks/dist-ZNZCJI7B.js +7 -0
  54. package/dist/bundle/chunks/easter-egg-3d-VOETWRJO.js +2 -0
  55. package/dist/bundle/chunks/execute-HXDNZ26B.js +505 -0
  56. package/dist/bundle/chunks/github-copilot.js +2 -0
  57. package/dist/bundle/chunks/google-generative-ai-SJXMIEPZ.js +2 -0
  58. package/dist/bundle/chunks/google-vertex-VSXQ3BDH.js +2 -0
  59. package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +13 -0
  60. package/dist/bundle/chunks/image-resize-worker.js +2 -0
  61. package/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +21 -0
  62. package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +2 -0
  63. package/dist/bundle/chunks/kimi-coding.js +2 -0
  64. package/dist/bundle/chunks/lib-4AVRLBHM.js +9 -0
  65. package/dist/bundle/chunks/llama-cpp-classify-4KFSGAMH.js +22 -0
  66. package/dist/bundle/chunks/meta.js +2 -0
  67. package/dist/bundle/chunks/mistral-conversations-JYWDZV2K.js +5 -0
  68. package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
  69. package/dist/bundle/chunks/node-AUOGOBCN.js +2 -0
  70. package/dist/bundle/chunks/node-KCMANYC2.js +16 -0
  71. package/dist/bundle/chunks/openai-chatgpt.js +75 -0
  72. package/dist/bundle/chunks/openai-codex-responses-OQV5DCFA.js +10 -0
  73. package/dist/bundle/chunks/openai-codex.js +75 -0
  74. package/dist/bundle/chunks/openai-completions-RFDJM2W5.js +7 -0
  75. package/dist/bundle/chunks/openai-decisions-O6PHBSCB.js +5 -0
  76. package/dist/bundle/chunks/openai-responses-LVNAPALQ.js +4 -0
  77. package/dist/bundle/chunks/openrouter-images-4WG6OOLH.js +2 -0
  78. package/dist/bundle/chunks/openrouter.js +75 -0
  79. package/dist/bundle/chunks/pdfjs-BETXZQ7A.js +108 -0
  80. package/dist/bundle/chunks/pdfjs-decoders-37HBPYHX.js +2 -0
  81. package/dist/bundle/chunks/pdfjs-jbig2-MH7WRXUP.js +2 -0
  82. package/dist/bundle/chunks/pdfjs-jbig2_nowasm_fallback-UVK7AQLA.js +2 -0
  83. package/dist/bundle/chunks/pdfjs-openjpeg-TC2QHC4G.js +2 -0
  84. package/dist/bundle/chunks/pdfjs-openjpeg_nowasm_fallback-ZC2FTHCZ.js +3 -0
  85. package/dist/bundle/chunks/pi-messages-EZXKVRR6.js +8 -0
  86. package/dist/bundle/chunks/radius.js +75 -0
  87. package/dist/bundle/chunks/runtime-JAH75CB5.js +2 -0
  88. package/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
  89. package/dist/bundle/chunks/typesafe-system-one-X3JT6ECA.js +2 -0
  90. package/dist/bundle/chunks/virtual-modules-I5QRIHN6.js +2 -0
  91. package/dist/bundle/chunks/xai.js +2 -0
  92. package/dist/bundle/cli-runtime.js +3 -0
  93. package/dist/bundle/cli.js +5 -0
  94. package/dist/bundle/index.js +2 -0
  95. package/dist/bundle/rpc-entry.js +3 -0
  96. package/dist/core/export-html/ansi-to-html.d.ts +22 -0
  97. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  98. package/dist/core/export-html/ansi-to-html.js +249 -0
  99. package/dist/core/export-html/ansi-to-html.js.map +1 -0
  100. package/dist/core/export-html/index.d.ts +37 -0
  101. package/dist/core/export-html/index.d.ts.map +1 -0
  102. package/dist/core/export-html/index.js +228 -0
  103. package/dist/core/export-html/index.js.map +1 -0
  104. package/dist/core/export-html/template.css +1085 -0
  105. package/dist/core/export-html/template.html +56 -0
  106. package/dist/core/export-html/template.js +2044 -0
  107. package/dist/core/export-html/tool-renderer.d.ts +34 -0
  108. package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  109. package/dist/core/export-html/tool-renderer.js +110 -0
  110. package/dist/core/export-html/tool-renderer.js.map +1 -0
  111. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  112. package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
  113. package/dist/core/export-html/vendor/marked.min.js +79 -0
  114. package/dist/modes/interactive/assets/clankolas.png +0 -0
  115. package/dist/modes/interactive/theme/dark.json +81 -0
  116. package/dist/modes/interactive/theme/light.json +81 -0
  117. package/dist/modes/interactive/theme/system-theme.d.ts +55 -0
  118. package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
  119. package/dist/modes/interactive/theme/system-theme.js +546 -0
  120. package/dist/modes/interactive/theme/system-theme.js.map +1 -0
  121. package/dist/modes/interactive/theme/theme-controller.d.ts +81 -0
  122. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
  123. package/dist/modes/interactive/theme/theme-controller.js +210 -0
  124. package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
  125. package/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
  126. package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
  127. package/dist/modes/interactive/theme/theme-schema.js +105 -0
  128. package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
  129. package/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
  130. package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
  131. package/dist/modes/interactive/theme/theme-tokens.js +94 -0
  132. package/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
  133. package/dist/modes/interactive/theme/theme.d.ts +155 -0
  134. package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  135. package/dist/modes/interactive/theme/theme.js +905 -0
  136. package/dist/modes/interactive/theme/theme.js.map +1 -0
  137. package/docs/cli-integration.md +106 -0
  138. package/docs/cli.md +333 -0
  139. package/docs/codemode.md +230 -0
  140. package/docs/compaction.md +463 -0
  141. package/docs/configuration.md +47 -0
  142. package/docs/containerization.md +183 -0
  143. package/docs/custom-provider.md +227 -0
  144. package/docs/docs.json +220 -0
  145. package/docs/environment-variables.md +102 -0
  146. package/docs/extensions.md +400 -0
  147. package/docs/how-pi-works.md +49 -0
  148. package/docs/index.md +39 -0
  149. package/docs/json.md +226 -0
  150. package/docs/keybindings.md +195 -0
  151. package/docs/llama-cpp.md +121 -0
  152. package/docs/mcp.md +272 -0
  153. package/docs/message-types.md +279 -0
  154. package/docs/models-configuration.md +196 -0
  155. package/docs/models.md +225 -0
  156. package/docs/nvidia-rtx-llama-cpp.md +96 -0
  157. package/docs/packages.md +131 -0
  158. package/docs/prompt-templates.md +59 -0
  159. package/docs/providers.md +247 -0
  160. package/docs/quickstart.md +136 -0
  161. package/docs/rpc-commands.md +860 -0
  162. package/docs/rpc-extension-ui.md +200 -0
  163. package/docs/rpc.md +193 -0
  164. package/docs/sdk.md +147 -0
  165. package/docs/security.md +99 -0
  166. package/docs/session-format.md +293 -0
  167. package/docs/sessions.md +66 -0
  168. package/docs/settings.md +172 -0
  169. package/docs/shell-aliases.md +93 -0
  170. package/docs/skills.md +93 -0
  171. package/docs/slash-commands.md +61 -0
  172. package/docs/terminal-setup.md +233 -0
  173. package/docs/termux.md +117 -0
  174. package/docs/themes.md +138 -0
  175. package/docs/tmux.md +55 -0
  176. package/docs/tui.md +195 -0
  177. package/docs/usage.md +94 -0
  178. package/docs/virtual-models.md +114 -0
  179. package/docs/windows.md +81 -0
  180. package/lib/auth.js +190 -0
  181. package/lib/provider.js +52 -0
  182. package/package.json +43 -5
  183. package/sera-core/skills/apple-tasarim/SKILL.md +48 -0
  184. package/sera-core/skills/apple-tasarim/referanslar/apple-hig.md +55 -0
  185. package/sera-core/skills/belge-yarat/SKILL.md +64 -0
  186. package/sera-core/skills/belge-yarat/referanslar/belge-yazim.md +60 -0
  187. package/sera-core/skills/derin-arastirma/SKILL.md +52 -0
  188. package/sera-core/skills/derin-arastirma/referanslar/arastirma-yontem.md +50 -0
  189. package/sera-core/skills/dusunme-dogrulama/SKILL.md +59 -0
  190. package/sera-core/skills/dusunme-dogrulama/referanslar/dusunme-kontrol.md +54 -0
  191. package/sera-core/skills/film-stilleri/SKILL.md +51 -0
  192. package/sera-core/skills/hyperframes/LICENSE-UPSTREAM +190 -0
  193. package/sera-core/skills/hyperframes/SKILL.md +79 -0
  194. package/sera-core/skills/hyperframes/assets/frame-presets/biennale-yellow/FRAME.md +289 -0
  195. package/sera-core/skills/hyperframes/assets/frame-presets/blockframe/FRAME.md +275 -0
  196. package/sera-core/skills/hyperframes/assets/frame-presets/blue-professional/FRAME.md +307 -0
  197. package/sera-core/skills/hyperframes/assets/frame-presets/bold-poster/FRAME.md +275 -0
  198. package/sera-core/skills/hyperframes/assets/frame-presets/broadside/FRAME.md +284 -0
  199. package/sera-core/skills/hyperframes/assets/frame-presets/capsule/FRAME.md +284 -0
  200. package/sera-core/skills/hyperframes/assets/frame-presets/cartesian/FRAME.md +278 -0
  201. package/sera-core/skills/hyperframes/assets/frame-presets/cobalt-grid/FRAME.md +265 -0
  202. package/sera-core/skills/hyperframes/assets/frame-presets/code-editorial/FRAME.md +277 -0
  203. package/sera-core/skills/hyperframes/assets/frame-presets/coral/FRAME.md +314 -0
  204. package/sera-core/skills/hyperframes/assets/frame-presets/creative-mode/FRAME.md +333 -0
  205. package/sera-core/skills/hyperframes/assets/frame-presets/daisy-days/FRAME.md +274 -0
  206. package/sera-core/skills/hyperframes/assets/frame-presets/editorial-forest/FRAME.md +265 -0
  207. package/sera-core/skills/hyperframes/references/captions.md +46 -0
  208. package/sera-core/skills/hyperframes/references/film.md +48 -0
  209. package/sera-core/skills/hyperframes/references/format.md +159 -0
  210. package/sera-core/skills/hyperframes/references/look.md +69 -0
  211. package/sera-core/skills/hyperframes/references/motion.md +95 -0
  212. package/sera-core/skills/hyperframes/references/overlays.md +39 -0
  213. package/sera-core/skills/hyperframes/references/path-tracing.md +36 -0
  214. package/sera-core/skills/hyperframes/references/plugin-installation.md +42 -0
  215. package/sera-core/skills/hyperframes/references/review.md +51 -0
  216. package/sera-core/skills/hyperframes/references/runtimes.md +69 -0
  217. package/sera-core/skills/hyperframes/references/skill-lifecycle.md +54 -0
  218. package/sera-core/skills/hyperframes/references/sound.md +43 -0
  219. package/sera-core/skills/hyperframes/references/spec.md +76 -0
  220. package/sera-core/skills/hyperframes/references/story.md +103 -0
  221. package/sera-core/skills/hyperframes/references/storyboard-format.md +107 -0
  222. package/sera-core/skills/hyperframes/references/storyboard.md +36 -0
  223. package/sera-core/skills/hyperframes/references/types/3d.md +25 -0
  224. package/sera-core/skills/hyperframes/references/types/character.md +20 -0
  225. package/sera-core/skills/hyperframes/references/types/data.md +19 -0
  226. package/sera-core/skills/hyperframes/references/types/explainer.md +34 -0
  227. package/sera-core/skills/hyperframes/references/types/launch.md +41 -0
  228. package/sera-core/skills/hyperframes/references/types/music.md +24 -0
  229. package/sera-core/skills/hyperframes/references/types/vertical.md +23 -0
  230. package/sera-core/skills/hyperframes-cli/LICENSE-UPSTREAM +190 -0
  231. package/sera-core/skills/hyperframes-cli/SKILL.md +99 -0
  232. package/sera-core/skills/hyperframes-cli/references/beats.md +17 -0
  233. package/sera-core/skills/hyperframes-cli/references/compare-and-batch.md +105 -0
  234. package/sera-core/skills/hyperframes-cli/references/conventions.md +16 -0
  235. package/sera-core/skills/hyperframes-cli/references/doctor-browser.md +80 -0
  236. package/sera-core/skills/hyperframes-cli/references/feedback.md +14 -0
  237. package/sera-core/skills/hyperframes-cli/references/init-and-scaffold.md +75 -0
  238. package/sera-core/skills/hyperframes-cli/references/lint-validate-inspect.md +164 -0
  239. package/sera-core/skills/hyperframes-cli/references/preview-render.md +204 -0
  240. package/sera-core/skills/hyperframes-cli/references/upgrade-info-misc.md +134 -0
  241. package/sera-core/skills/impeccable/LICENSE-UPSTREAM +191 -0
  242. package/sera-core/skills/impeccable/NOTICE-UPSTREAM.md +11 -0
  243. package/sera-core/skills/impeccable/SKILL.md +89 -0
  244. package/sera-core/skills/impeccable/reference/adapt.md +318 -0
  245. package/sera-core/skills/impeccable/reference/adapt.native.md +58 -0
  246. package/sera-core/skills/impeccable/reference/android.md +46 -0
  247. package/sera-core/skills/impeccable/reference/animate.md +89 -0
  248. package/sera-core/skills/impeccable/reference/audit.md +139 -0
  249. package/sera-core/skills/impeccable/reference/audit.native.md +139 -0
  250. package/sera-core/skills/impeccable/reference/bolder.md +33 -0
  251. package/sera-core/skills/impeccable/reference/clarify.md +94 -0
  252. package/sera-core/skills/impeccable/reference/colorize.md +86 -0
  253. package/sera-core/skills/impeccable/reference/component-review.md +63 -0
  254. package/sera-core/skills/impeccable/reference/craft-floor.md +44 -0
  255. package/sera-core/skills/impeccable/reference/craft.md +5 -0
  256. package/sera-core/skills/impeccable/reference/critique.md +819 -0
  257. package/sera-core/skills/impeccable/reference/degraded/asset-producer.md +42 -0
  258. package/sera-core/skills/impeccable/reference/degraded/documenter.md +24 -0
  259. package/sera-core/skills/impeccable/reference/degraded/finish-reviewer.md +38 -0
  260. package/sera-core/skills/impeccable/reference/degraded/manual-edit-applier.md +93 -0
  261. package/sera-core/skills/impeccable/reference/delight.md +70 -0
  262. package/sera-core/skills/impeccable/reference/distill.md +111 -0
  263. package/sera-core/skills/impeccable/reference/doctor.md +54 -0
  264. package/sera-core/skills/impeccable/reference/document.md +416 -0
  265. package/sera-core/skills/impeccable/reference/extract.md +69 -0
  266. package/sera-core/skills/impeccable/reference/generate.md +101 -0
  267. package/sera-core/skills/impeccable/reference/harden.md +362 -0
  268. package/sera-core/skills/impeccable/reference/hooks.md +120 -0
  269. package/sera-core/skills/impeccable/reference/init.md +133 -0
  270. package/sera-core/skills/impeccable/reference/ios.md +51 -0
  271. package/sera-core/skills/impeccable/reference/layout.md +84 -0
  272. package/sera-core/skills/impeccable/reference/live-setup.md +104 -0
  273. package/sera-core/skills/impeccable/reference/live.md +327 -0
  274. package/sera-core/skills/impeccable/reference/mode-operate.md +21 -0
  275. package/sera-core/skills/impeccable/reference/mode-persuade.md +19 -0
  276. package/sera-core/skills/impeccable/reference/mode-read.md +21 -0
  277. package/sera-core/skills/impeccable/reference/new-work.md +152 -0
  278. package/sera-core/skills/impeccable/reference/onboard.md +234 -0
  279. package/sera-core/skills/impeccable/reference/operate.md +61 -0
  280. package/sera-core/skills/impeccable/reference/optimize.md +257 -0
  281. package/sera-core/skills/impeccable/reference/overdrive.md +127 -0
  282. package/sera-core/skills/impeccable/reference/polish.md +105 -0
  283. package/sera-core/skills/impeccable/reference/quieter.md +99 -0
  284. package/sera-core/skills/impeccable/reference/region-map.md +26 -0
  285. package/sera-core/skills/impeccable/reference/routing.md +24 -0
  286. package/sera-core/skills/impeccable/reference/shape.md +59 -0
  287. package/sera-core/skills/impeccable/reference/typeset.md +90 -0
  288. package/sera-core/skills/impeccable/reference/visualize.md +47 -0
  289. package/sera-core/skills/oyun-yarat/SKILL.md +106 -0
  290. package/sera-core/skills/oyun-yarat/referanslar/3b-yaris.md +74 -0
  291. package/sera-core/skills/oyun-yarat/referanslar/kaplay.md +99 -0
  292. package/sera-core/skills/oyun-yarat/referanslar/oyun-desenleri.md +73 -0
  293. package/sera-core/skills/oyun-yarat/sablonlar/kaplay-2d.html +164 -0
  294. package/sera-core/skills/oyun-yarat/sablonlar/three-yaris.html +149 -0
  295. package/sera-core/skills/oyun-yarat/sablonlar/tuval-minimal.html +77 -0
  296. package/sera-core/skills/receiving-code-review/LICENSE-UPSTREAM +21 -0
  297. package/sera-core/skills/receiving-code-review/SKILL.md +205 -0
  298. package/sera-core/skills/refero-design/LICENSE-UPSTREAM +21 -0
  299. package/sera-core/skills/refero-design/SKILL.md +534 -0
  300. package/sera-core/skills/refero-design/references/anti-ai-slop.md +292 -0
  301. package/sera-core/skills/refero-design/references/color.md +563 -0
  302. package/sera-core/skills/refero-design/references/copywriting.md +222 -0
  303. package/sera-core/skills/refero-design/references/craft-details.md +525 -0
  304. package/sera-core/skills/refero-design/references/example-workflow.md +264 -0
  305. package/sera-core/skills/refero-design/references/icons.md +166 -0
  306. package/sera-core/skills/refero-design/references/mcp-tools.md +258 -0
  307. package/sera-core/skills/refero-design/references/motion.md +504 -0
  308. package/sera-core/skills/refero-design/references/typography.md +737 -0
  309. package/sera-core/skills/refero-design/references/visual-workflow.md +105 -0
  310. package/sera-core/skills/requesting-code-review/LICENSE-UPSTREAM +21 -0
  311. package/sera-core/skills/requesting-code-review/SKILL.md +95 -0
  312. package/sera-core/skills/requesting-code-review/code-reviewer.md +198 -0
  313. package/sera-core/skills/reverse-engineer-anything/DISCLAIMER.md +136 -0
  314. package/sera-core/skills/reverse-engineer-anything/LICENSE-REA-MIT +21 -0
  315. package/sera-core/skills/reverse-engineer-anything/SKILL.md +363 -0
  316. package/sera-core/skills/reverse-engineer-anything/THIRD_PARTY_NOTICES.md +135 -0
  317. package/sera-core/skills/reverse-engineer-anything/references/android-applications.md +36 -0
  318. package/sera-core/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
  319. package/sera-core/skills/reverse-engineer-anything/references/evidence-workflows.md +71 -0
  320. package/sera-core/skills/reverse-engineer-anything/references/javascript-applications.md +218 -0
  321. package/sera-core/skills/reverse-engineer-anything/references/native-and-artifacts.md +297 -0
  322. package/sera-core/skills/reverse-engineer-anything/references/runtime-observation.md +78 -0
  323. package/sera-core/skills/seo-audit/LICENSE-UPSTREAM +21 -0
  324. package/sera-core/skills/seo-audit/SKILL.md +210 -0
  325. package/sera-core/skills/sera-guvenlik-denetim/SKILL.md +44 -0
  326. package/sera-core/skills/sera-guvenlik-denetim/referanslar/guvenlik-listesi.md +33 -0
  327. package/sera-core/skills/sera-hata-ayikla/SKILL.md +27 -0
  328. package/sera-core/skills/sera-hata-ayikla/referanslar/hata-ayiklama.md +37 -0
  329. package/sera-core/skills/sera-kod-inceleme/SKILL.md +44 -0
  330. package/sera-core/skills/sera-kod-inceleme/referanslar/inceleme-listesi.md +62 -0
  331. package/sera-core/skills/sera-ofis-dosya/SKILL.md +27 -0
  332. package/sera-core/skills/sera-ofis-dosya/referanslar/ofis-dosya.md +93 -0
  333. package/sera-core/skills/sera-research/SKILL.md +90 -0
  334. package/sera-core/skills/sera-tasarim/SKILL.md +149 -0
  335. package/sera-core/skills/sera-teslim-sozlesmesi/SKILL.md +592 -0
  336. package/sera-core/skills/sera-test-yaz/SKILL.md +26 -0
  337. package/sera-core/skills/sera-test-yaz/referanslar/test-yazimi.md +35 -0
  338. package/sera-core/skills/sera-veri-gorsel/SKILL.md +65 -0
  339. package/sera-core/skills/sera-web-test/SKILL.md +26 -0
  340. package/sera-core/skills/sera-web-test/referanslar/web-test.md +44 -0
  341. package/sera-core/skills/sera-zamanli-gorev/SKILL.md +22 -0
  342. package/sera-core/skills/sera-zamanli-gorev/referanslar/zamanli-gorev.md +58 -0
  343. package/sera-core/skills/systematic-debugging/LICENSE-UPSTREAM +21 -0
  344. package/sera-core/skills/systematic-debugging/SKILL.md +283 -0
  345. package/sera-core/skills/systematic-debugging/condition-based-waiting.md +115 -0
  346. package/sera-core/skills/systematic-debugging/defense-in-depth.md +122 -0
  347. package/sera-core/skills/systematic-debugging/root-cause-tracing.md +169 -0
  348. package/sera-core/skills/test-driven-development/LICENSE-UPSTREAM +21 -0
  349. package/sera-core/skills/test-driven-development/SKILL.md +330 -0
  350. package/sera-core/skills/test-driven-development/writing-good-tests.md +198 -0
  351. package/sera-core/skills/ticaret-icerik/SKILL.md +49 -0
  352. package/sera-core/skills/ticaret-icerik/referanslar/ticaret-icerik.md +54 -0
  353. package/sera-core/skills/uygulama-yarat/SKILL.md +95 -0
  354. package/sera-core/skills/uygulama-yarat/referanslar/uygulama-desenleri.md +63 -0
  355. package/sera-core/skills/uygulama-yarat/sablonlar/uygulama-tek-dosya.html +121 -0
  356. package/sera-core/skills/uyumluluk-denetim/SKILL.md +56 -0
  357. package/sera-core/skills/uyumluluk-denetim/referanslar/mevzuat-tablosu.md +65 -0
  358. package/sera-core/skills/veri-analizi/SKILL.md +54 -0
  359. package/sera-core/skills/veri-analizi/referanslar/veri-analizi-yontem.md +49 -0
  360. package/sera-core/skills/veri-analizi/sablonlar/profil.mjs +79 -0
  361. package/sera-core/skills/video-duzen/SKILL.md +50 -0
  362. package/sera-core/skills/video-duzen/referanslar/video-duzen.md +100 -0
  363. package/sera-core/skills/web-yayin-listesi/SKILL.md +115 -0
  364. package/sera-core/skills/writing-plans/LICENSE-UPSTREAM +21 -0
  365. package/sera-core/skills/writing-plans/SKILL.md +204 -0
  366. package/sera-core/src/action-nudge.ts +200 -0
  367. package/sera-core/src/agent-mode.ts +143 -0
  368. package/sera-core/src/agents.ts +185 -0
  369. package/sera-core/src/app-master.ts +275 -0
  370. package/sera-core/src/app-verify.ts +551 -0
  371. package/sera-core/src/approval.ts +131 -0
  372. package/sera-core/src/budget.ts +136 -0
  373. package/sera-core/src/command-policy.ts +808 -0
  374. package/sera-core/src/config.ts +135 -0
  375. package/sera-core/src/context-diet.ts +272 -0
  376. package/sera-core/src/device-id.ts +48 -0
  377. package/sera-core/src/dogal-arac.ts +203 -0
  378. package/sera-core/src/dogal-niyet.ts +173 -0
  379. package/sera-core/src/egress-allow.ts +52 -0
  380. package/sera-core/src/export.ts +124 -0
  381. package/sera-core/src/exposure.ts +8 -0
  382. package/sera-core/src/extension.ts +2416 -0
  383. package/sera-core/src/fs-tools.ts +444 -0
  384. package/sera-core/src/generated/build-rules.ts +26 -0
  385. package/sera-core/src/generated/zero-knowledge.ts +170 -0
  386. package/sera-core/src/github-agent-command.ts +133 -0
  387. package/sera-core/src/github-agent-engine.ts +198 -0
  388. package/sera-core/src/github-agent-schedule.ts +180 -0
  389. package/sera-core/src/github-agent.ts +669 -0
  390. package/sera-core/src/github-ajan-akis.ts +193 -0
  391. package/sera-core/src/github-ajan-gercek.ts +102 -0
  392. package/sera-core/src/github-tick.ts +78 -0
  393. package/sera-core/src/github-yedek.ts +269 -0
  394. package/sera-core/src/goal.ts +119 -0
  395. package/sera-core/src/handoff.ts +132 -0
  396. package/sera-core/src/hooks.ts +284 -0
  397. package/sera-core/src/image-tool.ts +118 -0
  398. package/sera-core/src/intake-brief.ts +82 -0
  399. package/sera-core/src/intake-core.ts +1152 -0
  400. package/sera-core/src/intake-hook.ts +88 -0
  401. package/sera-core/src/ios-build-tool.ts +134 -0
  402. package/sera-core/src/lazy-capability.ts +125 -0
  403. package/sera-core/src/lazy-mcp.ts +300 -0
  404. package/sera-core/src/limit-command.ts +51 -0
  405. package/sera-core/src/loop-brake.ts +129 -0
  406. package/sera-core/src/lsp.ts +618 -0
  407. package/sera-core/src/mcp-bridge.ts +159 -0
  408. package/sera-core/src/mcp-pin.ts +105 -0
  409. package/sera-core/src/mcp-ssrf.ts +124 -0
  410. package/sera-core/src/message-cap.ts +45 -0
  411. package/sera-core/src/no-progress.ts +177 -0
  412. package/sera-core/src/notebook-tool.ts +179 -0
  413. package/sera-core/src/ofis.ts +473 -0
  414. package/sera-core/src/path-guard.ts +139 -0
  415. package/sera-core/src/permission-bridge.ts +228 -0
  416. package/sera-core/src/policy-chain.ts +122 -0
  417. package/sera-core/src/pricing.ts +71 -0
  418. package/sera-core/src/proc.ts +149 -0
  419. package/sera-core/src/rea.ts +188 -0
  420. package/sera-core/src/repo-map.ts +230 -0
  421. package/sera-core/src/research.ts +347 -0
  422. package/sera-core/src/rules-memory.ts +227 -0
  423. package/sera-core/src/sandbox.ts +445 -0
  424. package/sera-core/src/server-error.ts +78 -0
  425. package/sera-core/src/skills.ts +268 -0
  426. package/sera-core/src/snapshot.ts +143 -0
  427. package/sera-core/src/spec-gate.ts +112 -0
  428. package/sera-core/src/subagent.ts +261 -0
  429. package/sera-core/src/teslim.ts +120 -0
  430. package/sera-core/src/test-fix.ts +184 -0
  431. package/sera-core/src/todo-question.ts +163 -0
  432. package/sera-core/src/turn-snapshots.ts +126 -0
  433. package/sera-core/src/tuval/arac.ts +338 -0
  434. package/sera-core/src/tuval/arsiv.ts +106 -0
  435. package/sera-core/src/tuval/belge.ts +216 -0
  436. package/sera-core/src/tuval/birlestir.ts +282 -0
  437. package/sera-core/src/tuval/disa.ts +235 -0
  438. package/sera-core/src/tuval/editor.ts +583 -0
  439. package/sera-core/src/tuval/film-cekirdek.ts +170 -0
  440. package/sera-core/src/tuval/film-disa.ts +188 -0
  441. package/sera-core/src/tuval/film-oynatici.ts +307 -0
  442. package/sera-core/src/tuval/kimlik.ts +156 -0
  443. package/sera-core/src/tuval/pano.ts +763 -0
  444. package/sera-core/src/tuval/proje.ts +728 -0
  445. package/sera-core/src/tuval/sistem-cekirdek.ts +167 -0
  446. package/sera-core/src/tuval/sistem.ts +328 -0
  447. package/sera-core/src/tuval/sunucu.ts +413 -0
  448. package/sera-core/src/tuval/uretim.ts +24 -0
  449. package/sera-core/src/tuval/veri-cekirdek.ts +477 -0
  450. package/sera-core/src/tuval/xlsx.ts +215 -0
  451. package/sera-core/src/tuval/zip.ts +163 -0
  452. package/sera-core/src/untrusted.ts +201 -0
  453. package/sera-core/src/video-edit-tool.ts +411 -0
  454. package/sera-core/src/video-tool.ts +217 -0
  455. package/sera-core/src/web-tools.ts +257 -0
  456. package/sera-core/src/zk.ts +104 -0
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Arka plan surec yoneticisi ("proc" araci): dev sunucusu, izleyici, uzun test gibi surecleri bloke etmeden calistirir;
3
+ * cikti okunur, stdin'e yazilir, kapatilir. Pi'nin yerlesik `bash` araci her komutu bitene kadar bekler; bu arac onun tamamlayicisidir.
4
+ *
5
+ * SINIR (durust): gercek PTY DEGIL. stdin/stdout/stderr boru (pipe) ile yonetilir; TTY isteyen etkilesimli programlar
6
+ * (vim, ssh parola istemi, renkli ilerleme cubuklari) boru modunda calisir. Yerel native PTY bagimliligi eklenmedi.
7
+ * Guvenlik: komutlar "bash" ile AYNI izin/komut-politikasindan gecer (command-policy, permission-bridge, plan modu).
8
+ */
9
+ import { type ChildProcess, spawn, spawnSync } from "node:child_process";
10
+ import { resolveCommand } from "./lsp.ts";
11
+
12
+ export interface ProcInfo {
13
+ id: string;
14
+ command: string;
15
+ status: "running" | "exited" | "killed";
16
+ exitCode: number | null;
17
+ startedAt: number;
18
+ bytes: number;
19
+ }
20
+
21
+ interface Entry extends ProcInfo {
22
+ child: ChildProcess;
23
+ buf: string;
24
+ /** buf'in basindan atilan karakter sayisi (ofset hesabi icin). */
25
+ dropped: number;
26
+ }
27
+
28
+ const MAX_BUF = 64 * 1024;
29
+
30
+ export class ProcManager {
31
+ private procs = new Map<string, Entry>();
32
+ private seq = 0;
33
+ private readonly max: number;
34
+
35
+ constructor(max = 5) {
36
+ this.max = max;
37
+ }
38
+
39
+ private shellFor(command: string): { cmd: string; args: string[] } {
40
+ if (process.platform !== "win32") return { cmd: "sh", args: ["-c", command] };
41
+ const bash = resolveCommand("bash", process.cwd());
42
+ // Git Bash varsa onu kullan (Pi'nin bash araciyla ayni sozdizimi); yoksa cmd.exe
43
+ return bash ? { cmd: bash, args: ["-c", command] } : { cmd: "cmd.exe", args: ["/d", "/s", "/c", command] };
44
+ }
45
+
46
+ start(command: string, cwd: string, env: Record<string, string | undefined> = process.env): ProcInfo {
47
+ const running = [...this.procs.values()].filter((p) => p.status === "running").length;
48
+ if (running >= this.max)
49
+ throw new Error(`Zaten ${running} arka plan sureci calisiyor (en fazla ${this.max}); birini kapat.`);
50
+ const { cmd, args } = this.shellFor(command);
51
+ const child = spawn(cmd, args, {
52
+ cwd,
53
+ env: env as NodeJS.ProcessEnv,
54
+ windowsHide: true,
55
+ detached: process.platform !== "win32",
56
+ stdio: ["pipe", "pipe", "pipe"],
57
+ });
58
+ const e: Entry = {
59
+ id: `p${++this.seq}`,
60
+ command,
61
+ status: "running",
62
+ exitCode: null,
63
+ startedAt: Date.now(),
64
+ bytes: 0,
65
+ child,
66
+ buf: "",
67
+ dropped: 0,
68
+ };
69
+ const add = (c: Buffer) => {
70
+ const t = c.toString("utf8");
71
+ e.bytes += t.length;
72
+ e.buf += t;
73
+ if (e.buf.length > MAX_BUF) {
74
+ const cut = e.buf.length - MAX_BUF;
75
+ e.buf = e.buf.slice(cut);
76
+ e.dropped += cut;
77
+ }
78
+ };
79
+ child.stdout?.on("data", add);
80
+ child.stderr?.on("data", add);
81
+ child.on("error", (err) => {
82
+ add(Buffer.from(`[surec baslatilamadi: ${err.message}]`));
83
+ if (e.status === "running") e.status = "exited";
84
+ });
85
+ child.on("close", (code) => {
86
+ if (e.status === "running") e.status = "exited";
87
+ e.exitCode = code;
88
+ });
89
+ this.procs.set(e.id, e);
90
+ return this.info(e);
91
+ }
92
+
93
+ private info(e: Entry): ProcInfo {
94
+ return {
95
+ id: e.id,
96
+ command: e.command,
97
+ status: e.status,
98
+ exitCode: e.exitCode,
99
+ startedAt: e.startedAt,
100
+ bytes: e.bytes,
101
+ };
102
+ }
103
+
104
+ list(): ProcInfo[] {
105
+ return [...this.procs.values()].map((e) => this.info(e));
106
+ }
107
+
108
+ /** Cikti: `since` (onceki okumadan donen `next`) sonrasi; yeni baslamissa hepsi. Tampondan dusenler "[...]" ile belirtilir. */
109
+ read(id: string, since = 0): { info: ProcInfo; text: string; next: number } {
110
+ const e = this.procs.get(id);
111
+ if (!e) throw new Error(`Bilinmeyen surec: ${id}`);
112
+ const total = e.dropped + e.buf.length;
113
+ const from = Math.max(since, e.dropped);
114
+ const lost = since < e.dropped ? "[... eski cikti tampondan dustu ...]\n" : "";
115
+ return { info: this.info(e), text: lost + e.buf.slice(from - e.dropped), next: total };
116
+ }
117
+
118
+ write(id: string, text: string): void {
119
+ const e = this.procs.get(id);
120
+ if (!e) throw new Error(`Bilinmeyen surec: ${id}`);
121
+ if (e.status !== "running") throw new Error(`${id} calismiyor (${e.status}).`);
122
+ e.child.stdin?.write(text.endsWith("\n") ? text : `${text}\n`);
123
+ }
124
+
125
+ kill(id: string): ProcInfo {
126
+ const e = this.procs.get(id);
127
+ if (!e) throw new Error(`Bilinmeyen surec: ${id}`);
128
+ if (e.status === "running") {
129
+ e.status = "killed";
130
+ killTree(e.child);
131
+ }
132
+ return this.info(e);
133
+ }
134
+
135
+ killAll(): void {
136
+ for (const e of this.procs.values()) if (e.status === "running") this.kill(e.id);
137
+ }
138
+ }
139
+
140
+ export function killTree(child: ChildProcess): void {
141
+ if (child.pid === undefined) return;
142
+ try {
143
+ if (process.platform === "win32")
144
+ spawnSync("taskkill", ["/pid", String(child.pid), "/T", "/F"], { windowsHide: true });
145
+ else process.kill(-child.pid, "SIGKILL");
146
+ } catch {
147
+ // zaten kapali
148
+ }
149
+ }
@@ -0,0 +1,188 @@
1
+ /**
2
+ * REA (morluto/rea, npm: rea-agents, MIT): tersine muhendislik MCP sunucusu. Sera'da TEMBEL tek giris noktasi olarak gelir
3
+ * (lazy-mcp.ts): acilista surec/sema yok; ilk kullanimda `node <rea>/scripts/rea.mjs mcp` baslar, bosta kapanir.
4
+ * Surum SABIT (@latest yok). Analiz yereldir; dis hizmete veri gonderilmez (egress kapisi yine gecerlidir).
5
+ */
6
+
7
+ import { spawnSync } from "node:child_process";
8
+ import { existsSync, readFileSync } from "node:fs";
9
+ import { homedir } from "node:os";
10
+ import { basename, delimiter, dirname, join } from "node:path";
11
+ import { fileURLToPath } from "node:url";
12
+ import type { LazyMcpDef } from "./lazy-mcp.ts";
13
+
14
+ export const REA_VERSION = "6.7.0";
15
+ export const REA_PACKAGE = `rea-agents@${REA_VERSION}`;
16
+ export const REA_SERVER = "rea";
17
+ /** `SERA_REA=0` ile tamamen kapatilir. */
18
+ export const reaEnabled = (env: Record<string, string | undefined> = process.env): boolean => env.SERA_REA !== "0";
19
+
20
+ export const REA_SUMMARY = "REA: ikili/APK/Electron/firmware tersine muhendisligi (yalniz yetkili, yasal analiz).";
21
+
22
+ export const REA_DISCLAIMER =
23
+ "Yalnız yasal ve yetkili analiz için: DRM/lisans kırma, hile geliştirme ve yetkisiz erişim REA kapsamı dışındadır, Sera bunlara yardım etmez.";
24
+
25
+ /** Arac adi -> grup (token tasarrufu: model yalniz ilgili grubun listesini acar). */
26
+ export function reaGroupOf(tool: string): string {
27
+ if (/android|adb|apk|jeb|apktool|flutter|dart/.test(tool)) return "android";
28
+ if (/web|browser/.test(tool)) return "web";
29
+ if (/javascript|electron|application_(graph|version)|source_to_bundle|trace_application/.test(tool))
30
+ return "javascript";
31
+ if (/firmware|signal|pcap|packet|sqlite|evm|wasm/.test(tool)) return "firmware";
32
+ if (/frida|gdb|rizin|cutter|debug/.test(tool)) return "debug";
33
+ if (/managed|macho|objc|swift|native|hopper|procedure|dylib|plist|keyed|asset_catalog|interface_builder/.test(tool))
34
+ return "native";
35
+ if (
36
+ /evidence|compare|reconstruction|unknown|verify|correlate|changed_behavior|call_path|navigation|process_scenario|artifact|bundle/.test(
37
+ tool,
38
+ )
39
+ )
40
+ return "evidence";
41
+ return "native";
42
+ }
43
+
44
+ export interface ReaInstall {
45
+ dir: string;
46
+ bin: string;
47
+ version: string;
48
+ }
49
+
50
+ function pathDirs(env: Record<string, string | undefined>): string[] {
51
+ return (env.PATH ?? env.Path ?? "").split(delimiter).filter(Boolean);
52
+ }
53
+
54
+ /** PATH'te yurutulebilir bul (uzantili adaylar Windows'ta). */
55
+ export function whichSync(cmd: string, env: Record<string, string | undefined> = process.env): string | undefined {
56
+ const exts = process.platform === "win32" ? ["", ".exe", ".cmd", ".bat", ".ps1"] : [""];
57
+ for (const d of pathDirs(env))
58
+ for (const e of exts) {
59
+ const f = join(d, cmd + e);
60
+ if (existsSync(f)) return f;
61
+ }
62
+ return undefined;
63
+ }
64
+
65
+ /** Kurulu rea-agents'i bulur: SERA_REA_DIR, Sera arac klasoru (~/.sera/tools/rea), genel npm (PATH'teki `rea` yaninda). */
66
+ export function findRea(
67
+ env: Record<string, string | undefined> = process.env,
68
+ home = homedir(),
69
+ ): ReaInstall | undefined {
70
+ const cands: string[] = [];
71
+ if (env.SERA_REA_DIR) cands.push(env.SERA_REA_DIR);
72
+ // Sera paketi: <motor>/sera-core/src -> <motor>/tools/rea (sera-sync.ps1 sabit surumu buraya koyar)
73
+ cands.push(join(dirname(fileURLToPath(import.meta.url)), "..", "..", "tools", "rea", "node_modules", "rea-agents"));
74
+ cands.push(join(env.SERA_HOME ?? join(home, ".sera"), "tools", "rea", "node_modules", "rea-agents"));
75
+ const rea = whichSync("rea", env);
76
+ if (rea) {
77
+ const d = dirname(rea);
78
+ cands.push(join(d, "node_modules", "rea-agents"), join(d, "..", "lib", "node_modules", "rea-agents"));
79
+ }
80
+ for (const dir of cands) {
81
+ try {
82
+ const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
83
+ const bin = join(dir, "scripts", "rea.mjs");
84
+ if (pkg?.name === "rea-agents" && existsSync(bin)) return { dir, bin, version: String(pkg.version) };
85
+ } catch {}
86
+ }
87
+ return undefined;
88
+ }
89
+
90
+ /** Node 22.23+ ya da 24.22.1+ (REA gereksinimi). */
91
+ export function nodeOk(v = process.versions.node): boolean {
92
+ const [a = 0, b = 0, c = 0] = v.split(".").map(Number);
93
+ if (a > 24) return true;
94
+ if (a === 24) return b > 22 || (b === 22 && c >= 1) || b > 22;
95
+ if (a === 22) return b >= 23;
96
+ return false;
97
+ }
98
+
99
+ export interface ExternalTool {
100
+ id: string;
101
+ label: string;
102
+ found: boolean;
103
+ }
104
+
105
+ const EXTERNALS: Array<[string, string, string[]]> = [
106
+ ["hopper", "Hopper", ["hopper", "Hopper"]],
107
+ ["ghidra", "Ghidra", ["analyzeHeadless", "ghidraRun"]],
108
+ ["jadx", "JADX", ["jadx"]],
109
+ ["apktool", "apktool", ["apktool"]],
110
+ ["adb", "adb (Android)", ["adb"]],
111
+ ["rizin", "Rizin", ["rizin", "rz-bin"]],
112
+ ["gdb", "GDB", ["gdb"]],
113
+ ];
114
+
115
+ export function externalTools(env: Record<string, string | undefined> = process.env): ExternalTool[] {
116
+ return EXTERNALS.map(([id, label, names]) => ({ id, label, found: names.some((n) => !!whichSync(n, env)) }));
117
+ }
118
+
119
+ export interface ReaStatus {
120
+ /** off: kapali (sonuk); open: kullanici actı, surec yok; running: surec calisiyor. */
121
+ state: "off" | "open" | "running";
122
+ installed: boolean;
123
+ }
124
+ export const REA_STATUS_KEY = "sera-rea";
125
+ export const REA_STATUS_PREFIX = "sera-rea:";
126
+
127
+ /** Sade Turkce karsilama (kisa). */
128
+ export function reaGreeting(
129
+ install: ReaInstall | undefined,
130
+ ext: ExternalTool[],
131
+ nodeVer = process.versions.node,
132
+ ): string {
133
+ const lines: string[] = [
134
+ "◆ REA açıldı: derlenmiş uygulamaları ve ikili dosyaları çözümleyen tersine mühendislik aracı.",
135
+ ];
136
+ lines.push(REA_DISCLAIMER);
137
+ if (!install) lines.push(`REA henüz kurulu değil; ilk kullanımda sorarak kurulur (sabit sürüm ${REA_VERSION}).`);
138
+ else {
139
+ if (install.version !== REA_VERSION)
140
+ lines.push(`Uyarı: kurulu sürüm ${install.version}, Sera'nın sabitlediği ${REA_VERSION} değil.`);
141
+ const ok = ext.filter((e) => e.found).map((e) => e.label);
142
+ const miss = ext.filter((e) => !e.found).map((e) => e.label);
143
+ lines.push(`Kurulu harici araçlar: ${ok.length ? ok.join(", ") : "hiçbiri"}.`);
144
+ if (miss.length)
145
+ lines.push(
146
+ `Eksikler (${miss.join(", ")}) isteğe bağlıdır; yokken REA sınırlı çalışır, ilgili analizler yapılamaz.`,
147
+ );
148
+ }
149
+ if (!nodeOk(nodeVer)) lines.push(`Uyarı: Node ${nodeVer} eski; REA için Node 22.23+ ya da 24.22.1+ gerekir.`);
150
+ lines.push("Araçlar ihtiyaç oldukça yüklenir, 10 dk boşta kalınca kapanır. Kapatmak için: /rea kapat");
151
+ return lines.join("\n");
152
+ }
153
+
154
+ export const NOT_INSTALLED_MSG = `REA kurulu değil. Kullanıcıdan /rea ile kurulumu onaylamasını iste (sabit sürüm ${REA_VERSION}); kurulmadan çalışmaz.`;
155
+
156
+ /** `rea-agents@6.7.0` kurar. Kurulum betikleri (frida vb.) CALISTIRILMAZ (--ignore-scripts). */
157
+ export function installReaArgs(): string[] {
158
+ return ["install", "-g", REA_PACKAGE, "--ignore-scripts", "--no-audit", "--no-fund"];
159
+ }
160
+
161
+ export function installRea(run: typeof spawnSync = spawnSync): { ok: boolean; message: string } {
162
+ const r = run("npm", installReaArgs(), {
163
+ shell: process.platform === "win32",
164
+ encoding: "utf8",
165
+ timeout: 300_000,
166
+ windowsHide: true,
167
+ });
168
+ if (r.status === 0) return { ok: true, message: `REA ${REA_VERSION} kuruldu.` };
169
+ return { ok: false, message: `REA kurulamadı: ${String(r.stderr ?? r.error ?? "").slice(0, 300)}` };
170
+ }
171
+
172
+ /** Tembel MCP tanimi. Kurulu degilse etkinlesme "kurulu degil" hatasiyla durur. */
173
+ export function reaDef(env: Record<string, string | undefined> = process.env): LazyMcpDef {
174
+ return {
175
+ name: REA_SERVER,
176
+ summary: REA_SUMMARY,
177
+ groupOf: reaGroupOf,
178
+ notice: `REA: ${REA_DISCLAIMER}`,
179
+ spec: { command: "", timeout: 120 }, // preflight ile cozulur
180
+ preflight() {
181
+ const inst = findRea(env);
182
+ if (!inst) throw new Error(NOT_INSTALLED_MSG);
183
+ const node = /^node(\.exe)?$/i.test(basename(process.execPath)) ? process.execPath : "node";
184
+ this.spec.command = node;
185
+ this.spec.args = [inst.bin, "mcp"];
186
+ },
187
+ };
188
+ }
@@ -0,0 +1,230 @@
1
+ /**
2
+ * Depo haritası (Dalga 2, matris madde 7; rakipler: Aider PageRank sembol indeksi, Cursor indeks).
3
+ *
4
+ * Amaç: modele, projeyi okumadan önce "nerede ne var" özeti vermek — hangi dosyada hangi üst düzey semboller
5
+ * tanımlı, ve hangi dosyalar daha merkezi (başka dosyalarca çok kullanılan). Böylece model gereksiz dosya okumadan
6
+ * doğru yere gider (token ekonomisi). Bağlama enjekte edilir (rules-memory gibi), token tavanlıdır.
7
+ *
8
+ * Tasarım kararı (v1): tree-sitter/ctags BAĞIMLILIĞI YOK. Sembol çıkarımı dile göre hafif regex ile yapılır
9
+ * (üst düzey tanımlar: fonksiyon/sınıf/tip/arayüz/enum). Sıralama: tanım zenginliği + kaç FARKLI dosyanın o dosyanın
10
+ * sembollerine atıfta bulunduğu (PageRank-lite, deterministik). Kendi dosyasına atıf sayılmaz.
11
+ *
12
+ * Güvenlik/maliyet: node_modules/.git/dist gibi klasörler atlanır; büyük/ikili dosyalar atlanır; taranan dosya ve
13
+ * üretilen harita token sayısı tavanlıdır. Varsayılan KAPALI (config.repoMap.enabled=false): açılınca sıfır olmayan
14
+ * maliyet oturum başına bir kez ödenir (sonuç cwd'ye göre önbelleğe alınır).
15
+ */
16
+
17
+ import { readdirSync, readFileSync, statSync } from "node:fs";
18
+ import { extname, join, relative } from "node:path";
19
+ import { CHARS_PER_TOKEN, type ContextFile } from "./rules-memory.ts";
20
+
21
+ export interface RepoMapOptions {
22
+ /** Üretilen haritanın token tavanı (chars/4). Varsayılan 1500. */
23
+ maxTokens?: number;
24
+ /** Taranacak en fazla dosya. Varsayılan 1500. */
25
+ maxFiles?: number;
26
+ /** Bu bayttan büyük dosya atlanır (ikili/üretilmiş). Varsayılan 262144 (256 KB). */
27
+ maxFileBytes?: number;
28
+ /** Her dosyada gösterilecek en fazla sembol. Varsayılan 24. */
29
+ maxSymbolsPerFile?: number;
30
+ }
31
+
32
+ const DEFAULTS = { maxTokens: 1500, maxFiles: 1500, maxFileBytes: 262_144, maxSymbolsPerFile: 24 };
33
+
34
+ const IGNORE_DIRS: ReadonlySet<string> = new Set([
35
+ "node_modules",
36
+ ".git",
37
+ "dist",
38
+ "build",
39
+ "out",
40
+ ".next",
41
+ ".nuxt",
42
+ "coverage",
43
+ ".turbo",
44
+ ".cache",
45
+ "vendor",
46
+ "__pycache__",
47
+ ".venv",
48
+ "venv",
49
+ ".pytest_cache",
50
+ "target",
51
+ ".idea",
52
+ ".vscode",
53
+ ".sera",
54
+ ".gradle",
55
+ ".svelte-kit",
56
+ ]);
57
+
58
+ /** Dil başına üst düzey sembol desenleri. Yakalama grubu 1 = sembol adı. */
59
+ const LANG: { exts: ReadonlySet<string>; patterns: RegExp[] }[] = [
60
+ {
61
+ exts: new Set([".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"]),
62
+ patterns: [
63
+ /\bexport\s+(?:default\s+)?(?:async\s+)?function\s*\*?\s*([A-Za-z_$][\w$]*)/g,
64
+ /\bexport\s+(?:abstract\s+)?class\s+([A-Za-z_$][\w$]*)/g,
65
+ /\bexport\s+(?:const|let|var)\s+([A-Za-z_$][\w$]*)/g,
66
+ /\bexport\s+interface\s+([A-Za-z_$][\w$]*)/g,
67
+ /\bexport\s+type\s+([A-Za-z_$][\w$]*)/g,
68
+ /\bexport\s+enum\s+([A-Za-z_$][\w$]*)/g,
69
+ /^(?:async\s+)?function\s*\*?\s*([A-Za-z_$][\w$]*)/gm,
70
+ /^(?:abstract\s+)?class\s+([A-Za-z_$][\w$]*)/gm,
71
+ ],
72
+ },
73
+ {
74
+ exts: new Set([".py"]),
75
+ patterns: [/^class\s+([A-Za-z_]\w*)/gm, /^(?:async\s+)?def\s+([A-Za-z_]\w*)/gm],
76
+ },
77
+ {
78
+ exts: new Set([".go"]),
79
+ patterns: [/^func\s+(?:\([^)]*\)\s*)?([A-Za-z_]\w*)/gm, /^type\s+([A-Za-z_]\w*)/gm],
80
+ },
81
+ {
82
+ exts: new Set([".rs"]),
83
+ patterns: [
84
+ /^\s*(?:pub\s+)?(?:async\s+)?fn\s+([A-Za-z_]\w*)/gm,
85
+ /^\s*(?:pub\s+)?(?:struct|enum|trait)\s+([A-Za-z_]\w*)/gm,
86
+ ],
87
+ },
88
+ {
89
+ exts: new Set([".c", ".h", ".cpp", ".cc", ".hpp", ".cs", ".java", ".kt", ".swift", ".scala"]),
90
+ patterns: [/\b(?:class|struct|interface|enum|trait|protocol)\s+([A-Za-z_]\w*)/g],
91
+ },
92
+ ];
93
+
94
+ function langFor(ext: string): RegExp[] | undefined {
95
+ return LANG.find((l) => l.exts.has(ext))?.patterns;
96
+ }
97
+
98
+ /** Bir dosyanın üst düzey sembollerini (sırayı koruyarak, tekrarsız) döndürür. */
99
+ export function extractSymbols(path: string, content: string, max = DEFAULTS.maxSymbolsPerFile): string[] {
100
+ const patterns = langFor(extname(path).toLowerCase());
101
+ if (!patterns) return [];
102
+ const seen = new Set<string>();
103
+ for (const re of patterns) {
104
+ re.lastIndex = 0;
105
+ for (let m = re.exec(content); m !== null; m = re.exec(content)) {
106
+ const name = m[1];
107
+ if (name && !seen.has(name)) seen.add(name);
108
+ if (m.index === re.lastIndex) re.lastIndex++; // sıfır uzunluklu eşleşmede sonsuz döngüyü önle
109
+ }
110
+ }
111
+ return [...seen].slice(0, max);
112
+ }
113
+
114
+ function walk(root: string, maxFiles: number, maxBytes: number): string[] {
115
+ const out: string[] = [];
116
+ const stack = [root];
117
+ while (stack.length && out.length < maxFiles) {
118
+ const dir = stack.pop()!;
119
+ let entries: import("node:fs").Dirent[];
120
+ try {
121
+ entries = readdirSync(dir, { withFileTypes: true });
122
+ } catch {
123
+ continue;
124
+ }
125
+ entries.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)); // deterministik
126
+ for (const e of entries) {
127
+ if (e.name.startsWith(".") && e.name !== ".") {
128
+ if (e.isDirectory() && IGNORE_DIRS.has(e.name)) continue;
129
+ }
130
+ const full = join(dir, e.name);
131
+ if (e.isDirectory()) {
132
+ if (!IGNORE_DIRS.has(e.name)) stack.push(full);
133
+ continue;
134
+ }
135
+ if (!e.isFile()) continue;
136
+ if (!langFor(extname(e.name).toLowerCase())) continue;
137
+ try {
138
+ if (statSync(full).size > maxBytes) continue;
139
+ } catch {
140
+ continue;
141
+ }
142
+ out.push(full);
143
+ if (out.length >= maxFiles) break;
144
+ }
145
+ }
146
+ return out;
147
+ }
148
+
149
+ interface Ranked {
150
+ rel: string;
151
+ symbols: string[];
152
+ refBy: number;
153
+ score: number;
154
+ }
155
+
156
+ /**
157
+ * Deterministik sıralama: önce sembollerini en çok FARKLI dosyanın kullandığı dosyalar (merkeziyet), sonra
158
+ * tanım zenginliği; eşitlikte yol (a→z). score = symbols.length + 2 * refBy.
159
+ */
160
+ export function rankFiles(files: { rel: string; content: string }[], max = DEFAULTS.maxSymbolsPerFile): Ranked[] {
161
+ const defs = files.map((f) => ({ rel: f.rel, content: f.content, symbols: extractSymbols(f.rel, f.content, max) }));
162
+ // sembol adı -> onu tanımlayan dosyalar
163
+ const owners = new Map<string, Set<string>>();
164
+ for (const f of defs) for (const s of f.symbols) (owners.get(s) ?? owners.set(s, new Set()).get(s)!).add(f.rel);
165
+ // her dosya için: o dosyanın sembollerine atıfta bulunan FARKLI dosyalar (kendisi hariç)
166
+ const referers = new Map<string, Set<string>>();
167
+ for (const f of defs) {
168
+ const ids = f.content.match(/[A-Za-z_$][\w$]*/g);
169
+ if (!ids) continue;
170
+ const used = new Set(ids);
171
+ for (const id of used) {
172
+ const os = owners.get(id);
173
+ if (!os) continue;
174
+ for (const owner of os) {
175
+ if (owner === f.rel) continue; // kendi dosyasına atıf sayılmaz
176
+ (referers.get(owner) ?? referers.set(owner, new Set()).get(owner)!).add(f.rel);
177
+ }
178
+ }
179
+ }
180
+ const ranked: Ranked[] = defs
181
+ .filter((f) => f.symbols.length > 0)
182
+ .map((f) => {
183
+ const refBy = referers.get(f.rel)?.size ?? 0;
184
+ return { rel: f.rel, symbols: f.symbols, refBy, score: f.symbols.length + 2 * refBy };
185
+ });
186
+ ranked.sort((a, b) => b.score - a.score || (a.rel < b.rel ? -1 : a.rel > b.rel ? 1 : 0));
187
+ return ranked;
188
+ }
189
+
190
+ const HEADER = "Sera depo haritası (salt bilgi; dosya → üst düzey semboller, en merkezi dosyalar önce):";
191
+
192
+ /** Sıralanmış dosyaları token tavanına göre satır satır biçimler; sığmayanlar düşer, not eklenir. */
193
+ export function formatRepoMap(ranked: Ranked[], maxTokens: number): { content: string; shown: number; total: number } {
194
+ const maxChars = Math.max(0, maxTokens) * CHARS_PER_TOKEN;
195
+ const lines: string[] = [];
196
+ let used = HEADER.length + 1;
197
+ let shown = 0;
198
+ for (const r of ranked) {
199
+ const line = `${r.rel}: ${r.symbols.join(", ")}`;
200
+ if (used + line.length + 1 > maxChars) break;
201
+ lines.push(line);
202
+ used += line.length + 1;
203
+ shown++;
204
+ }
205
+ const dropped = ranked.length - shown;
206
+ const note = dropped > 0 ? `\n…(Sera: ${dropped} dosya bağlam sınırına sığmadı)` : "";
207
+ return { content: `${HEADER}\n${lines.join("\n")}${note}`, shown, total: ranked.length };
208
+ }
209
+
210
+ /**
211
+ * cwd altındaki kod deposundan bir bağlam dosyası üretir. Kod deposu değilse (yeterli sembol yoksa) undefined.
212
+ * Enjeksiyon rules-memory ile aynı {path, content} biçiminde.
213
+ */
214
+ export function buildRepoMap(cwd: string, opts: RepoMapOptions = {}): ContextFile | undefined {
215
+ const o = { ...DEFAULTS, ...opts };
216
+ const paths = walk(cwd, o.maxFiles, o.maxFileBytes);
217
+ if (paths.length < 2) return undefined;
218
+ const files: { rel: string; content: string }[] = [];
219
+ for (const p of paths) {
220
+ try {
221
+ files.push({ rel: relative(cwd, p).split("\\").join("/"), content: readFileSync(p, "utf8") });
222
+ } catch {
223
+ // okunamadı: atla
224
+ }
225
+ }
226
+ const ranked = rankFiles(files, o.maxSymbolsPerFile);
227
+ if (ranked.length < 2) return undefined;
228
+ const { content } = formatRepoMap(ranked, o.maxTokens);
229
+ return { path: "(Sera depo haritası)", content };
230
+ }