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,193 @@
1
+ /**
2
+ * `github_ajan` model aracinin mantigi (kur | durum | mod | durdur). SIFIR SORU kuru:
3
+ * gh girisi yoksa TEK sade adim (tarayicida "Onayla"), depo cwd'deki git uzagindan ya da kullanicinin tek deposundan secilir,
4
+ * birden cok depo varsa numarali kisa liste (TEK soru). Izin listesi = kullanicinin kendi GitHub girisi; mod = act:
5
+ * yalniz izinli kisinin verdigi is komutuyla (@sera / sera etiketi) calisir, komut yoksa hicbir sey yapmaz. Arka plan izleyici kurulur.
6
+ * Kullaniciya giden metin teknik terim icermez. Tum dis cagrilar enjekte (testte sahte gh/exec).
7
+ */
8
+ import { mkdirSync, writeFileSync } from "node:fs";
9
+ import { join } from "node:path";
10
+ import {
11
+ type GhAgentConfig,
12
+ loadConfig,
13
+ loadState,
14
+ type Runner,
15
+ releaseLock,
16
+ saveConfig,
17
+ statusText,
18
+ } from "./github-agent.ts";
19
+ import { setupGithub } from "./github-agent-engine.ts";
20
+ import { type Exec, installSchedule, removeSchedule, scheduleInstalled } from "./github-agent-schedule.ts";
21
+
22
+ export type AkisAction = "kur" | "durum" | "mod" | "durdur";
23
+ export interface AkisParams {
24
+ action: AkisAction;
25
+ /** owner/name ya da listeden numara. */
26
+ depo?: string;
27
+ mod?: "act" | "observe";
28
+ }
29
+ export interface AkisDeps {
30
+ run: Runner;
31
+ exec: Exec;
32
+ home: string;
33
+ now: () => number;
34
+ platform: NodeJS.Platform;
35
+ /** Kullanicinin calistigi klasor (git uzagindan depo secimi). */
36
+ cwd: string;
37
+ /** `gh auth login --web` baslatir; tarayici kodunu (varsa) dondurur. */
38
+ startLogin: () => Promise<{ started: boolean; code?: string }>;
39
+ /** Zamanlayici bilgisi: tick betigi ve motor giris noktasi. */
40
+ node: string;
41
+ tickScript: string;
42
+ engine: { entry: string; args: string[] };
43
+ launchAgentsDir?: string;
44
+ }
45
+ export type AkisStatus = "ok" | "login-needed" | "choose" | "not-setup" | "error" | "stopped";
46
+ export interface AkisResult {
47
+ status: AkisStatus;
48
+ text: string;
49
+ }
50
+
51
+ /** https://github.com/o/r(.git) | git@github.com:o/r(.git) | ssh://git@github.com/o/r -> o/r */
52
+ export function parseGithubRemote(url: string): string | undefined {
53
+ const m = url.trim().match(/github\.com[:/]+([\w.-]+)\/([\w.-]+?)(?:\.git)?\/?$/i);
54
+ return m ? `${m[1]}/${m[2]}` : undefined;
55
+ }
56
+
57
+ const NOT_SETUP = "GitHub izleme henüz kurulu değil. İstersen 'GitHub projemi takip et' de, hemen kurarım.";
58
+ const projectName = (repo: string) => repo.split("/")[1] ?? repo;
59
+
60
+ async function ghLoggedIn(d: AkisDeps): Promise<boolean> {
61
+ const r = await d.run("gh", ["auth", "status"], { timeoutMs: 30_000 });
62
+ return r.code === 0;
63
+ }
64
+
65
+ async function listRepos(d: AkisDeps): Promise<string[]> {
66
+ const r = await d.run("gh", ["repo", "list", "--limit", "30", "--no-archived", "--json", "nameWithOwner"], {
67
+ timeoutMs: 60_000,
68
+ });
69
+ if (r.code !== 0) return [];
70
+ try {
71
+ return (JSON.parse(r.stdout) as Array<{ nameWithOwner?: string }>)
72
+ .map((x) => x.nameWithOwner ?? "")
73
+ .filter(Boolean);
74
+ } catch {
75
+ return [];
76
+ }
77
+ }
78
+
79
+ async function cwdRepo(d: AkisDeps): Promise<string | undefined> {
80
+ const r = await d.run("git", ["remote", "get-url", "origin"], { cwd: d.cwd, timeoutMs: 15_000 });
81
+ return r.code === 0 ? parseGithubRemote(r.stdout) : undefined;
82
+ }
83
+
84
+ async function kur(p: AkisParams, d: AkisDeps): Promise<AkisResult> {
85
+ if (!(await ghLoggedIn(d))) {
86
+ const l = await d.startLogin();
87
+ if (!l.started)
88
+ return {
89
+ status: "error",
90
+ text: "GitHub'a giriş açılamadı. GitHub'ın bilgisayarda kurulu olması gerekiyor; kurulumu ben yapabilirim, devam etmemi ister misin?",
91
+ };
92
+ return {
93
+ status: "login-needed",
94
+ text:
95
+ `GitHub'a giriş gerekiyor. Tarayıcı açıldı${l.code ? `; sayfada şu kodu gir: ${l.code}` : ""} ve yeşil "Onayla" düğmesine bas. ` +
96
+ "Bittiğinde bana 'tamam' yaz, gerisini ben hallederim.",
97
+ };
98
+ }
99
+ let repo = p.depo?.trim();
100
+ let list: string[] | undefined;
101
+ if (repo && /^\d{1,2}$/.test(repo)) {
102
+ list = await listRepos(d);
103
+ repo = list[Number(repo) - 1];
104
+ if (!repo) return { status: "choose", text: "Bu numarada proje yok. Listedeki numaralardan birini yaz." };
105
+ }
106
+ if (!repo) {
107
+ const here = await cwdRepo(d);
108
+ if (here) repo = here;
109
+ else {
110
+ list = await listRepos(d);
111
+ if (list.length === 0)
112
+ return { status: "error", text: "GitHub hesabında izleyebileceğim bir proje bulamadım." };
113
+ if (list.length === 1) repo = list[0];
114
+ else
115
+ return {
116
+ status: "choose",
117
+ text: `Hangi projeni izleyeyim? Numarasını yaz:\n${list
118
+ .slice(0, 10)
119
+ .map((r, i) => `${i + 1}. ${r}`)
120
+ .join("\n")}`,
121
+ };
122
+ }
123
+ }
124
+ if (!/^[\w.-]+\/[\w.-]+$/.test(repo)) return { status: "error", text: "Proje adı anlaşılamadı." };
125
+ try {
126
+ const { cfg } = await setupGithub({ action: "kur", repo, mode: "act" } as never, d);
127
+ saveConfig(d.home, { ...cfg, mode: "act" as const });
128
+ // Bildirim/ek motor bilgisi: tick betigi motoru buradan baslatir.
129
+ mkdirSync(d.home, { recursive: true });
130
+ writeFileSync(join(d.home, "engine.json"), JSON.stringify({ node: d.node, ...d.engine }, null, 2), {
131
+ mode: 0o600,
132
+ });
133
+ const s = await installSchedule(d.exec, {
134
+ platform: d.platform,
135
+ home: d.home,
136
+ node: d.node,
137
+ tickScript: d.tickScript,
138
+ launchAgentsDir: d.launchAgentsDir,
139
+ });
140
+ const tail = s.ok
141
+ ? "Sera kapalıyken de arka planda bakmaya devam ederim."
142
+ : "Arka planda otomatik bakma kurulamadı; Sera açıkken izlerim.";
143
+ return {
144
+ status: "ok",
145
+ text:
146
+ `Artık GitHub'daki ${projectName(repo)} projeni izliyorum. Bir sorun kaydına '@sera ...' yazman yeterli. ` +
147
+ `${tail} Sen iş vermeden hiçbir şeye dokunmam.`,
148
+ };
149
+ } catch (e) {
150
+ return { status: "error", text: `Kurulamadı: ${(e instanceof Error ? e.message : String(e)).slice(0, 200)}` };
151
+ }
152
+ }
153
+
154
+ export async function githubAjan(p: AkisParams, d: AkisDeps): Promise<AkisResult> {
155
+ if (p.action === "kur") return kur(p, d);
156
+ const cfg = loadConfig(d.home);
157
+ if (p.action === "durum") {
158
+ if (!cfg) return { status: "not-setup", text: NOT_SETUP };
159
+ const st = loadState(d.home, d.now());
160
+ const on = await scheduleInstalled(d.exec, d);
161
+ const done = Object.values(st.processed);
162
+ const pr = done.filter((x) => x.status === "pr-opened").length;
163
+ return {
164
+ status: "ok",
165
+ text:
166
+ `${projectName(cfg.repo)} projeni ${on ? "arka planda de " : ""}izliyorum` +
167
+ `${cfg.mode === "act" ? " ve istenen işleri yapıyorum" : " (şimdilik yalnız izliyorum)"}. ` +
168
+ `Şimdiye kadar ${done.length} istek gördüm, ${pr} değişiklik önerisi hazırladım.\n${statusText(d.home, d.now())}`,
169
+ };
170
+ }
171
+ if (!cfg) return { status: "not-setup", text: NOT_SETUP };
172
+ if (p.action === "mod") {
173
+ if (!p.mod) return { status: "error", text: "Hangi mod? act (işleri yap) ya da observe (yalnız izle)." };
174
+ const n: GhAgentConfig = { ...cfg, mode: p.mod };
175
+ saveConfig(d.home, n);
176
+ return {
177
+ status: "ok",
178
+ text:
179
+ p.mod === "act"
180
+ ? `Tamam, ${projectName(cfg.repo)} projesinde '@sera' dediğinde işleri yapıp değişiklik önerisi hazırlayacağım.`
181
+ : `Tamam, yalnızca izleyeceğim, hiçbir şeye dokunmayacağım.`,
182
+ };
183
+ }
184
+ // durdur
185
+ const r = await removeSchedule(d.exec, d);
186
+ releaseLock(d.home);
187
+ return {
188
+ status: "stopped",
189
+ text: r.ok
190
+ ? `GitHub izlemesini durdurdum. ${projectName(cfg.repo)} projesine artık bakmıyorum. Yeniden başlatmak için 'GitHub projemi takip et' de.`
191
+ : `Arka plan izlemeyi tam kapatamadım (${r.detail.slice(0, 120)}).`,
192
+ };
193
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * github_ajan icin GERCEK bagimliliklar: gh girisini baslatma (tarayici akisi), Exec, varsayilan AkisDeps.
3
+ * Mantik github-ajan-akis.ts'te; burasi I/O (testte kullanilmaz, sahte bagimlilik verilir).
4
+ */
5
+ import { spawn } from "node:child_process";
6
+ import { fileURLToPath } from "node:url";
7
+ import { defaultHome } from "./github-agent.ts";
8
+ import { makeRunner } from "./github-agent-engine.ts";
9
+ import type { Exec } from "./github-agent-schedule.ts";
10
+ import type { AkisDeps } from "./github-ajan-akis.ts";
11
+
12
+ export const realExec: Exec = (cmd, args, opts = {}) =>
13
+ new Promise((resolve) => {
14
+ let out = "";
15
+ let err = "";
16
+ let done = false;
17
+ const fin = (code: number) => {
18
+ if (done) return;
19
+ done = true;
20
+ clearTimeout(t);
21
+ resolve({ code, stdout: out, stderr: err });
22
+ };
23
+ const child = spawn(cmd, args, { windowsHide: true, stdio: ["pipe", "pipe", "pipe"] });
24
+ const t = setTimeout(() => {
25
+ err += "\n[zaman asimi]";
26
+ try {
27
+ child.kill();
28
+ } catch {
29
+ // kapanmis
30
+ }
31
+ fin(124);
32
+ }, opts.timeoutMs ?? 30_000);
33
+ child.stdout.setEncoding("utf8").on("data", (d: string) => {
34
+ out += d;
35
+ });
36
+ child.stderr.setEncoding("utf8").on("data", (d: string) => {
37
+ err += d;
38
+ });
39
+ child.on("error", (e) => {
40
+ err += String(e);
41
+ fin(127);
42
+ });
43
+ child.on("close", (c) => fin(c ?? 1));
44
+ child.stdin.on("error", () => {});
45
+ child.stdin.end(opts.input ?? "");
46
+ });
47
+
48
+ /** `gh auth login --web`: tek kullanimlik kodu yakalar, surec tarayici onayini beklerken arka planda kalir. */
49
+ export function startGhLogin(): Promise<{ started: boolean; code?: string }> {
50
+ return new Promise((resolve) => {
51
+ let buf = "";
52
+ let settled = false;
53
+ const fin = (v: { started: boolean; code?: string }) => {
54
+ if (settled) return;
55
+ settled = true;
56
+ clearTimeout(t);
57
+ resolve(v);
58
+ };
59
+ let child: ReturnType<typeof spawn>;
60
+ try {
61
+ child = spawn("gh", ["auth", "login", "--web", "-h", "github.com", "-p", "https", "-s", "repo,read:org"], {
62
+ windowsHide: true,
63
+ detached: true,
64
+ stdio: ["pipe", "pipe", "pipe"],
65
+ });
66
+ } catch {
67
+ return resolve({ started: false });
68
+ }
69
+ const onData = (d: Buffer) => {
70
+ buf += d.toString("utf8");
71
+ const m = buf.match(/\b([A-Z0-9]{4}-[A-Z0-9]{4})\b/);
72
+ if (m) {
73
+ child.unref();
74
+ fin({ started: true, code: m[1] });
75
+ }
76
+ };
77
+ child.stdout?.on("data", onData);
78
+ child.stderr?.on("data", onData);
79
+ child.on("error", () => fin({ started: false }));
80
+ child.stdin?.on("error", () => {});
81
+ child.stdin?.write("\n"); // "Enter'a bas, tarayici acilsin"
82
+ const t = setTimeout(() => {
83
+ child.unref();
84
+ fin({ started: true });
85
+ }, 15_000);
86
+ });
87
+ }
88
+
89
+ export function realAkisDeps(cwd: string, engine: { entry: string; args: string[] }): AkisDeps {
90
+ return {
91
+ run: makeRunner(),
92
+ exec: realExec,
93
+ home: defaultHome(),
94
+ now: () => Date.now(),
95
+ platform: process.platform,
96
+ cwd,
97
+ startLogin: startGhLogin,
98
+ node: process.execPath,
99
+ tickScript: fileURLToPath(new URL("./github-tick.ts", import.meta.url)),
100
+ engine,
101
+ };
102
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * GitHub ajani BASSIZ tek-tur (zamanlayici bunu her 5 dk cagirir): `node github-tick.ts`.
3
+ * Tek ornek kilidi (acquireLock) + gunluk butce tavani (runOnce/processEvent) + PR acilinca bildirim.
4
+ * Mantik tick() icinde (bagimliliklar enjekte; testte sahte). Yapilandirma yoksa sessizce cikar.
5
+ */
6
+ import { existsSync, readFileSync } from "node:fs";
7
+ import { join } from "node:path";
8
+ import { fileURLToPath, pathToFileURL } from "node:url";
9
+ import {
10
+ acquireLock,
11
+ type Deps,
12
+ defaultHome,
13
+ loadConfig,
14
+ releaseLock,
15
+ runOnce,
16
+ type TicketOutcome,
17
+ } from "./github-agent.ts";
18
+ import { makeEngine, makeRunner } from "./github-agent-engine.ts";
19
+ import { type Exec, notifyPr } from "./github-agent-schedule.ts";
20
+ import { realExec } from "./github-ajan-gercek.ts";
21
+
22
+ export interface TickResult {
23
+ ran: boolean;
24
+ reason?: string;
25
+ outcomes: TicketOutcome[];
26
+ notified: number;
27
+ }
28
+
29
+ export async function tick(
30
+ home: string,
31
+ d: Pick<Deps, "run" | "engine">,
32
+ opts: { now?: () => number; exec?: Exec; platform?: NodeJS.Platform } = {},
33
+ ): Promise<TickResult> {
34
+ const now = opts.now ?? (() => Date.now());
35
+ const cfg = loadConfig(home);
36
+ if (!cfg) return { ran: false, reason: "kurulu değil", outcomes: [], notified: 0 };
37
+ if (!acquireLock(home, now())) return { ran: false, reason: "başka bir tur çalışıyor", outcomes: [], notified: 0 };
38
+ try {
39
+ const r = await runOnce(cfg, { run: d.run, engine: d.engine, home, now });
40
+ let notified = 0;
41
+ for (const o of r.outcomes) {
42
+ if (
43
+ o.pr &&
44
+ o.status === "pr-opened" &&
45
+ opts.exec &&
46
+ (await notifyPr(opts.exec, opts.platform ?? process.platform, cfg.repo, o.pr))
47
+ )
48
+ notified++;
49
+ }
50
+ return { ran: true, reason: r.error, outcomes: r.outcomes, notified };
51
+ } finally {
52
+ releaseLock(home);
53
+ }
54
+ }
55
+
56
+ async function main(): Promise<void> {
57
+ const home = defaultHome();
58
+ const ej = join(home, "engine.json");
59
+ if (!existsSync(ej)) return;
60
+ const e = JSON.parse(readFileSync(ej, "utf8")) as { node: string; entry: string; args?: string[] };
61
+ const engine = makeEngine({
62
+ node: e.node,
63
+ entry: e.entry,
64
+ extensions: [fileURLToPath(new URL("./extension.ts", import.meta.url))],
65
+ args: e.args ?? [],
66
+ });
67
+ const r = await tick(home, { run: makeRunner(), engine }, { exec: realExec });
68
+ process.stderr.write(
69
+ `${new Date().toISOString()} tick ran=${r.ran} ${r.reason ?? ""} outcomes=${r.outcomes.length} notified=${r.notified}\n`,
70
+ );
71
+ }
72
+
73
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
74
+ main().catch((e) => {
75
+ process.stderr.write(`${new Date().toISOString()} tick HATA ${e instanceof Error ? e.message : String(e)}\n`);
76
+ process.exitCode = 1;
77
+ });
78
+ }
@@ -0,0 +1,269 @@
1
+ /**
2
+ * Proje yedegi (GitHub baglama teklifi): Sera bir proje URETTIKTEN VE TESLIM ETTIKTEN sonra, proje basina BIR kez, GitHub bagli degilse
3
+ * sade bir teklif sunulur. "Simdi degil" = o proje icin bir daha sorulmaz. "Bagla" = tarayicida onay, sir taramasi + gizli dosyalari
4
+ * haric tutma, kullanicinin hesabinda OZEL (private) depo, itme, GitHub ajani kurulumu. Sonraki degisiklikler sir taramasindan gecerek
5
+ * otomatik itilir; sir bulunursa itme ENGELLENIR. Tum dis cagrilar (gh/git) enjekte: testte sahte GitHub, gercek depo acilmaz.
6
+ */
7
+ import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
8
+ import { basename, join, relative, resolve } from "node:path";
9
+ import { ASSIGN_RE, SECRET_PATTERNS } from "./export.ts";
10
+ import { type AkisDeps, githubAjan } from "./github-ajan-akis.ts";
11
+
12
+ export const TEKLIF_METNI =
13
+ "Projeni GitHub hesabına bağlarsan güvenle yedeklenir, her değişiklik saklanır ve bir sorun yazdığında Sera kendisi düzeltir.";
14
+
15
+ interface Kayit {
16
+ asked?: boolean;
17
+ declined?: boolean;
18
+ connected?: boolean;
19
+ repo?: string;
20
+ }
21
+ const dosya = (home: string) => join(home, "github-yedek.json");
22
+ const anahtar = (dir: string) => resolve(dir).replaceAll("\\", "/").toLowerCase();
23
+ function oku(home: string): Record<string, Kayit> {
24
+ try {
25
+ return JSON.parse(readFileSync(dosya(home), "utf8")) as Record<string, Kayit>;
26
+ } catch {
27
+ return {};
28
+ }
29
+ }
30
+ function yaz(home: string, dir: string, k: Kayit): void {
31
+ const all = oku(home);
32
+ all[anahtar(dir)] = { ...all[anahtar(dir)], ...k };
33
+ mkdirSync(home, { recursive: true });
34
+ writeFileSync(dosya(home), JSON.stringify(all, null, 2), { mode: 0o600 });
35
+ }
36
+ export const kayitOku = (home: string, dir: string): Kayit => oku(home)[anahtar(dir)] ?? {};
37
+
38
+ // ---- Sir taramasi
39
+ const SIR_DOSYA =
40
+ /(^|\/)(\.env(\..*)?|.*\.(pem|key|p12|pfx|jks|keystore)|id_(rsa|dsa|ecdsa|ed25519)|credentials(\.json)?|\.npmrc|\.netrc|secrets?\.(json|ya?ml))$/i;
41
+ /** Sera'nin dis-aktarim maskeleyicisiyle AYNI desen kumesi (export.ts) + ozel anahtar basligi + yuksek entropili .env tarzi atama. */
42
+ const SIR_ICERIK: Array<[string, RegExp]> = [
43
+ ["özel anahtar", /-----BEGIN [A-Z ]*PRIVATE KEY-----/],
44
+ ...SECRET_PATTERNS.map(({ re, label }): [string, RegExp] => [
45
+ label,
46
+ new RegExp(re.source, re.flags.replace("g", "")),
47
+ ]),
48
+ ["parola/anahtar ataması", new RegExp(ASSIGN_RE.source, ASSIGN_RE.flags.replace("g", ""))],
49
+ ];
50
+ const ENV_ATAMA =
51
+ /^\s*(?:export\s+)?[A-Za-z0-9_.-]*(?:key|token|secret|passw(?:or)?d|pwd|credential|auth|private)[A-Za-z0-9_.-]*\s*[=:]\s*["']?([^\s"'#]{16,})/gim;
52
+ const YER_TUTUCU =
53
+ /^(?:x+|\*+|<.*>|\$\{.*\}|your[_-].*|change[_-]?me.*|example.*|placeholder.*|todo.*|process\.env.*)$/i;
54
+ /** Shannon entropisi (bit/karakter). */
55
+ export function entropi(s: string): number {
56
+ const f = new Map<string, number>();
57
+ for (const c of s) f.set(c, (f.get(c) ?? 0) + 1);
58
+ let h = 0;
59
+ for (const n of f.values()) h -= (n / s.length) * Math.log2(n / s.length);
60
+ return h;
61
+ }
62
+ export function yuksekEntropiliAtama(t: string): boolean {
63
+ ENV_ATAMA.lastIndex = 0;
64
+ for (let m = ENV_ATAMA.exec(t); m; m = ENV_ATAMA.exec(t)) {
65
+ const v = m[1] ?? "";
66
+ if (!YER_TUTUCU.test(v) && entropi(v) >= 3.5 && /\d/.test(v) && /[A-Za-z]/.test(v)) return true;
67
+ }
68
+ return false;
69
+ }
70
+ const ATLA_DIZIN = new Set([".git", "node_modules", "dist", "build", ".next", ".venv", "__pycache__"]);
71
+
72
+ function ignoreKurallari(dir: string): string[] {
73
+ try {
74
+ return readFileSync(join(dir, ".gitignore"), "utf8")
75
+ .split(/\r?\n/)
76
+ .map((s) => s.trim())
77
+ .filter((s) => s && !s.startsWith("#"));
78
+ } catch {
79
+ return [];
80
+ }
81
+ }
82
+ function yoksayilir(rel: string, kurallar: string[]): boolean {
83
+ const ad = rel.split("/").pop() ?? rel;
84
+ return kurallar.some((k) => {
85
+ const p = k.replace(/^\//, "").replace(/\/$/, "");
86
+ if (p.startsWith("*.")) return ad.endsWith(p.slice(1));
87
+ if (p.endsWith("*")) return ad.startsWith(p.slice(0, -1));
88
+ return rel === p || ad === p || rel.startsWith(`${p}/`);
89
+ });
90
+ }
91
+
92
+ export interface TaramaSonucu {
93
+ /** Gizli dosya adlari (haric tutulacak). */
94
+ gizliDosyalar: string[];
95
+ /** Icerigi sir iceren, haric tutulmamis dosyalar: [yol, tur]. */
96
+ icerikSirlari: Array<[string, string]>;
97
+ }
98
+ export function sirTara(dir: string): TaramaSonucu {
99
+ const kurallar = ignoreKurallari(dir);
100
+ const r: TaramaSonucu = { gizliDosyalar: [], icerikSirlari: [] };
101
+ const gez = (d: string) => {
102
+ for (const e of readdirSync(d, { withFileTypes: true })) {
103
+ const p = join(d, e.name);
104
+ const rel = relative(dir, p).replaceAll("\\", "/");
105
+ if (e.isDirectory()) {
106
+ if (!ATLA_DIZIN.has(e.name) && !yoksayilir(rel, kurallar)) gez(p);
107
+ continue;
108
+ }
109
+ if (!e.isFile() || yoksayilir(rel, kurallar)) continue;
110
+ if (SIR_DOSYA.test(rel)) {
111
+ r.gizliDosyalar.push(rel);
112
+ continue;
113
+ }
114
+ try {
115
+ if (statSync(p).size > 1_000_000) continue;
116
+ const t = readFileSync(p, "utf8");
117
+ if (t.includes("\0")) continue;
118
+ const hit = SIR_ICERIK.find(([, re]) => re.test(t));
119
+ if (hit) r.icerikSirlari.push([rel, hit[0]]);
120
+ else if (yuksekEntropiliAtama(t)) r.icerikSirlari.push([rel, "yüksek entropili anahtar"]);
121
+ } catch {
122
+ // okunamayan dosya
123
+ }
124
+ }
125
+ };
126
+ if (existsSync(dir)) gez(dir);
127
+ return r;
128
+ }
129
+
130
+ /** Gizli dosyalari/sir iceren dosyalari .gitignore'a ekler (varolani bozmaz). */
131
+ function haricTut(dir: string, yollar: string[]): void {
132
+ if (!yollar.length) return;
133
+ const p = join(dir, ".gitignore");
134
+ const mevcut = existsSync(p) ? readFileSync(p, "utf8") : "";
135
+ const eklenecek = yollar.filter((y) => !mevcut.split(/\r?\n/).includes(y));
136
+ if (!eklenecek.length) return;
137
+ writeFileSync(
138
+ p,
139
+ `${mevcut}${mevcut && !mevcut.endsWith("\n") ? "\n" : ""}# Sera: gizli dosyalar\n${eklenecek.join("\n")}\n`,
140
+ );
141
+ }
142
+
143
+ /** gitleaks PATH'teyse EK katman: bulgu dosyalarini [yol, "gitleaks"] dondurur (yoksa/hata -> bos). */
144
+ export async function gitleaksTara(dir: string, d: Pick<AkisDeps, "exec">): Promise<Array<[string, string]>> {
145
+ try {
146
+ const v = await d.exec("gitleaks", ["version"], { timeoutMs: 10_000 });
147
+ if (v.code !== 0) return [];
148
+ const r = await d.exec(
149
+ "gitleaks",
150
+ ["detect", "--no-git", "--source", dir, "--no-banner", "--report-format", "json", "--report-path", "-"],
151
+ { timeoutMs: 120_000 },
152
+ );
153
+ if (r.code === 0) return [];
154
+ const j = JSON.parse(r.stdout || "[]") as Array<{ File?: string }>;
155
+ const out = new Set<string>();
156
+ for (const x of j) if (x.File) out.add(relative(dir, resolve(dir, x.File)).replaceAll("\\", "/"));
157
+ return [...out].map((f) => [f, "gitleaks"] as [string, string]);
158
+ } catch {
159
+ return [];
160
+ }
161
+ }
162
+ /** Yerlesik tarama + gitleaks (varsa). */
163
+ export async function tumSirlar(dir: string, d: Pick<AkisDeps, "exec">): Promise<TaramaSonucu> {
164
+ const t = sirTara(dir);
165
+ const var_ = new Set(t.icerikSirlari.map(([y]) => y));
166
+ for (const [y, n] of await gitleaksTara(dir, d))
167
+ if (!var_.has(y) && !t.gizliDosyalar.includes(y)) t.icerikSirlari.push([y, n]);
168
+ return t;
169
+ }
170
+
171
+ // ---- Akis
172
+ export type YedekAction = "durum" | "baglan" | "simdi-degil" | "gonder";
173
+ export type YedekStatus = "ask" | "none" | "login-needed" | "connected" | "pushed" | "blocked" | "error";
174
+ export interface YedekResult {
175
+ status: YedekStatus;
176
+ text: string;
177
+ }
178
+
179
+ const depoAdi = (dir: string) =>
180
+ basename(resolve(dir))
181
+ .toLowerCase()
182
+ .replace(/[^a-z0-9._-]+/g, "-")
183
+ .replace(/^[-.]+|[-.]+$/g, "")
184
+ .slice(0, 80) || "sera-projem";
185
+
186
+ const git = (d: AkisDeps, dir: string, args: string[]) => d.run("git", args, { cwd: dir, timeoutMs: 120_000 });
187
+
188
+ export async function githubYedek(action: YedekAction, dir: string, d: AkisDeps): Promise<YedekResult> {
189
+ const k = kayitOku(d.home, dir);
190
+ if (action === "durum") {
191
+ if (k.connected || k.declined || k.asked) return { status: "none", text: "" };
192
+ const r = await d.run("git", ["remote", "get-url", "origin"], { cwd: dir, timeoutMs: 15_000 });
193
+ if (r.code === 0 && /github\.com/i.test(r.stdout)) return { status: "none", text: "" };
194
+ yaz(d.home, dir, { asked: true });
195
+ return { status: "ask", text: `${TEKLIF_METNI}\n[Bağla] [Şimdi değil]` };
196
+ }
197
+ if (action === "simdi-degil") {
198
+ yaz(d.home, dir, { asked: true, declined: true });
199
+ return { status: "none", text: "Tamam, bu proje için bir daha sormayacağım." };
200
+ }
201
+ if (action === "gonder") return gonder(dir, d, k);
202
+ // baglan
203
+ if (k.connected) return { status: "connected", text: "Bu proje zaten GitHub'a bağlı." };
204
+ const auth = await d.run("gh", ["auth", "status"], { timeoutMs: 30_000 });
205
+ if (auth.code !== 0) {
206
+ const l = await d.startLogin();
207
+ if (!l.started) return { status: "error", text: "GitHub'a giriş açılamadı." };
208
+ return {
209
+ status: "login-needed",
210
+ text: `Tarayıcı açıldı${l.code ? `; sayfada şu kodu gir: ${l.code}` : ""} ve yeşil "Onayla" düğmesine bas. Bittiğinde 'tamam' yaz, gerisini ben hallederim.`,
211
+ };
212
+ }
213
+ // 1) sir taramasi + gizli dosyalari haric tutma (depo acilmadan ONCE)
214
+ const t = await tumSirlar(dir, d);
215
+ haricTut(dir, [...t.gizliDosyalar, ...t.icerikSirlari.map(([y]) => y)]);
216
+ const haric = t.gizliDosyalar.length + t.icerikSirlari.length;
217
+ // 2) ozel depo + itme
218
+ if (!existsSync(join(dir, ".git"))) await git(d, dir, ["init", "-b", "main"]);
219
+ await git(d, dir, ["add", "-A"]);
220
+ await git(d, dir, ["commit", "-m", "İlk sürüm (Sera)", "--allow-empty"]);
221
+ const who = await d.run("gh", ["api", "user", "--jq", ".login"], { timeoutMs: 30_000 });
222
+ const owner = who.stdout.trim();
223
+ if (who.code !== 0 || !/^[\w-]+$/.test(owner)) return { status: "error", text: "GitHub hesabını doğrulayamadım." };
224
+ const ad = depoAdi(dir);
225
+ const c = await d.run("gh", ["repo", "create", ad, "--private", "--source", ".", "--remote", "origin", "--push"], {
226
+ cwd: dir,
227
+ timeoutMs: 180_000,
228
+ });
229
+ if (c.code !== 0) return { status: "error", text: `Depo oluşturulamadı: ${c.stderr.trim().slice(0, 160)}` };
230
+ const repo = `${owner}/${ad}`;
231
+ yaz(d.home, dir, { asked: true, connected: true, repo });
232
+ // 3) GitHub ajani
233
+ const a = await githubAjan({ action: "kur", depo: repo }, { ...d, cwd: dir });
234
+ const hariciMetin = haric ? ` ${haric} gizli dosyayı yüklemedim.` : "";
235
+ return {
236
+ status: "connected",
237
+ text:
238
+ a.status === "ok"
239
+ ? `Projen GitHub hesabında özel olarak yedeklendi ve sorunlarını artık ben takip ediyorum.${hariciMetin}`
240
+ : `Projen GitHub hesabında özel olarak yedeklendi.${hariciMetin} Sorun takibini şimdilik kuramadım.`,
241
+ };
242
+ }
243
+
244
+ /** Sonraki degisiklikler: sir taramasi; sir varsa ITME ENGELLENIR. */
245
+ async function gonder(dir: string, d: AkisDeps, k: Kayit): Promise<YedekResult> {
246
+ if (!k.connected) return { status: "none", text: "" };
247
+ const t = await tumSirlar(dir, d);
248
+ // gizli dosya adlari haric tutulur (itilmez); ICERIGINDE sir olan dosya varsa itme tamamen ENGELLENIR
249
+ haricTut(dir, t.gizliDosyalar);
250
+ if (t.icerikSirlari.length) {
251
+ const adlar = t.icerikSirlari
252
+ .map(([y]) => y)
253
+ .slice(0, 3)
254
+ .join(", ");
255
+ return {
256
+ status: "blocked",
257
+ text: `Değişiklikleri yedeklemedim: ${adlar} içinde bir şifre/anahtar var. Onu kaldırırsan hemen yedeklerim.`,
258
+ };
259
+ }
260
+ await git(d, dir, ["add", "-A"]);
261
+ const st = await git(d, dir, ["status", "--porcelain"]);
262
+ if (!st.stdout.trim()) return { status: "none", text: "" };
263
+ const cm = await git(d, dir, ["commit", "-m", "Sera: değişiklikler"]);
264
+ if (cm.code !== 0) return { status: "error", text: "Değişiklikler kaydedilemedi." };
265
+ const p = await git(d, dir, ["push", "origin", "HEAD"]);
266
+ return p.code === 0
267
+ ? { status: "pushed", text: "Değişiklikler GitHub'a yedeklendi." }
268
+ : { status: "error", text: "Yedekleme şimdilik yapılamadı; bir sonraki değişiklikte tekrar denerim." };
269
+ }