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.
- package/LICENSE +21 -0
- package/NOTICE-SERA.md +25 -0
- package/README.md +27 -2
- package/THIRD_PARTY_NOTICES.md +68 -0
- package/bin/sera.mjs +137 -0
- package/dist/bundle/chunks/anthropic-messages-RD7GXOQL.js +6 -0
- package/dist/bundle/chunks/anthropic.js +75 -0
- package/dist/bundle/chunks/azure-openai-responses-CJT3KTVK.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +89 -0
- package/dist/bundle/chunks/chunk-46WGNYIE.js +82 -0
- package/dist/bundle/chunks/chunk-4UNN5OGR.js +4 -0
- package/dist/bundle/chunks/chunk-53H5DPHA.js +16 -0
- package/dist/bundle/chunks/chunk-5AGIVGSV.js +6 -0
- package/dist/bundle/chunks/chunk-6JXVX6Q2.js +2 -0
- package/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
- package/dist/bundle/chunks/chunk-7CBJINYJ.js +20 -0
- package/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
- package/dist/bundle/chunks/chunk-7RZ5BS7U.js +2 -0
- package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
- package/dist/bundle/chunks/chunk-BPHHHEET.js +9 -0
- package/dist/bundle/chunks/chunk-BSS6T6KQ.js +2 -0
- package/dist/bundle/chunks/chunk-CF5GWZHW.js +31 -0
- package/dist/bundle/chunks/chunk-EDSQGWII.js +44 -0
- package/dist/bundle/chunks/chunk-FFMDRXC4.js +10 -0
- package/dist/bundle/chunks/chunk-GUGC72EB.js +1222 -0
- package/dist/bundle/chunks/chunk-HODJBMOY.js +9 -0
- package/dist/bundle/chunks/chunk-HQBQWHLD.js +7 -0
- package/dist/bundle/chunks/chunk-HQJBN2MC.js +2 -0
- package/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
- package/dist/bundle/chunks/chunk-KXU77PUU.js +4 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
- package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
- package/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
- package/dist/bundle/chunks/chunk-M3LEVT3X.js +2 -0
- package/dist/bundle/chunks/chunk-P7FPUEYA.js +2 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
- package/dist/bundle/chunks/chunk-PMRZO46Y.js +2 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
- package/dist/bundle/chunks/chunk-QTM7S6TH.js +2 -0
- package/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
- package/dist/bundle/chunks/chunk-TLNP2BSO.js +2 -0
- package/dist/bundle/chunks/chunk-TMKHGABX.js +2 -0
- package/dist/bundle/chunks/chunk-TMTOQ7H7.js +2 -0
- package/dist/bundle/chunks/chunk-UKVNB6C4.js +2 -0
- package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
- package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
- package/dist/bundle/chunks/chunk-ZLAHUYDW.js +131 -0
- package/dist/bundle/chunks/chunk-ZNCN2NGY.js +60 -0
- package/dist/bundle/chunks/cli-MML2DU4A.js +51 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-QPZQRBK5.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +478 -0
- package/dist/bundle/chunks/dist-ZNZCJI7B.js +7 -0
- package/dist/bundle/chunks/easter-egg-3d-VOETWRJO.js +2 -0
- package/dist/bundle/chunks/execute-HXDNZ26B.js +505 -0
- package/dist/bundle/chunks/github-copilot.js +2 -0
- package/dist/bundle/chunks/google-generative-ai-SJXMIEPZ.js +2 -0
- package/dist/bundle/chunks/google-vertex-VSXQ3BDH.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +13 -0
- package/dist/bundle/chunks/image-resize-worker.js +2 -0
- package/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +21 -0
- package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +2 -0
- package/dist/bundle/chunks/kimi-coding.js +2 -0
- package/dist/bundle/chunks/lib-4AVRLBHM.js +9 -0
- package/dist/bundle/chunks/llama-cpp-classify-4KFSGAMH.js +22 -0
- package/dist/bundle/chunks/meta.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-JYWDZV2K.js +5 -0
- package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
- package/dist/bundle/chunks/node-AUOGOBCN.js +2 -0
- package/dist/bundle/chunks/node-KCMANYC2.js +16 -0
- package/dist/bundle/chunks/openai-chatgpt.js +75 -0
- package/dist/bundle/chunks/openai-codex-responses-OQV5DCFA.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +75 -0
- package/dist/bundle/chunks/openai-completions-RFDJM2W5.js +7 -0
- package/dist/bundle/chunks/openai-decisions-O6PHBSCB.js +5 -0
- package/dist/bundle/chunks/openai-responses-LVNAPALQ.js +4 -0
- package/dist/bundle/chunks/openrouter-images-4WG6OOLH.js +2 -0
- package/dist/bundle/chunks/openrouter.js +75 -0
- package/dist/bundle/chunks/pdfjs-BETXZQ7A.js +108 -0
- package/dist/bundle/chunks/pdfjs-decoders-37HBPYHX.js +2 -0
- package/dist/bundle/chunks/pdfjs-jbig2-MH7WRXUP.js +2 -0
- package/dist/bundle/chunks/pdfjs-jbig2_nowasm_fallback-UVK7AQLA.js +2 -0
- package/dist/bundle/chunks/pdfjs-openjpeg-TC2QHC4G.js +2 -0
- package/dist/bundle/chunks/pdfjs-openjpeg_nowasm_fallback-ZC2FTHCZ.js +3 -0
- package/dist/bundle/chunks/pi-messages-EZXKVRR6.js +8 -0
- package/dist/bundle/chunks/radius.js +75 -0
- package/dist/bundle/chunks/runtime-JAH75CB5.js +2 -0
- package/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
- package/dist/bundle/chunks/typesafe-system-one-X3JT6ECA.js +2 -0
- package/dist/bundle/chunks/virtual-modules-I5QRIHN6.js +2 -0
- package/dist/bundle/chunks/xai.js +2 -0
- package/dist/bundle/cli-runtime.js +3 -0
- package/dist/bundle/cli.js +5 -0
- package/dist/bundle/index.js +2 -0
- package/dist/bundle/rpc-entry.js +3 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +249 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +37 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +228 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +1085 -0
- package/dist/core/export-html/template.html +56 -0
- package/dist/core/export-html/template.js +2044 -0
- package/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +110 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/dist/core/export-html/vendor/marked.min.js +79 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/theme/dark.json +81 -0
- package/dist/modes/interactive/theme/light.json +81 -0
- package/dist/modes/interactive/theme/system-theme.d.ts +55 -0
- package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/system-theme.js +546 -0
- package/dist/modes/interactive/theme/system-theme.js.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +81 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.js +210 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.js +105 -0
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.js +94 -0
- package/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts +155 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +905 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/docs/cli-integration.md +106 -0
- package/docs/cli.md +333 -0
- package/docs/codemode.md +230 -0
- package/docs/compaction.md +463 -0
- package/docs/configuration.md +47 -0
- package/docs/containerization.md +183 -0
- package/docs/custom-provider.md +227 -0
- package/docs/docs.json +220 -0
- package/docs/environment-variables.md +102 -0
- package/docs/extensions.md +400 -0
- package/docs/how-pi-works.md +49 -0
- package/docs/index.md +39 -0
- package/docs/json.md +226 -0
- package/docs/keybindings.md +195 -0
- package/docs/llama-cpp.md +121 -0
- package/docs/mcp.md +272 -0
- package/docs/message-types.md +279 -0
- package/docs/models-configuration.md +196 -0
- package/docs/models.md +225 -0
- package/docs/nvidia-rtx-llama-cpp.md +96 -0
- package/docs/packages.md +131 -0
- package/docs/prompt-templates.md +59 -0
- package/docs/providers.md +247 -0
- package/docs/quickstart.md +136 -0
- package/docs/rpc-commands.md +860 -0
- package/docs/rpc-extension-ui.md +200 -0
- package/docs/rpc.md +193 -0
- package/docs/sdk.md +147 -0
- package/docs/security.md +99 -0
- package/docs/session-format.md +293 -0
- package/docs/sessions.md +66 -0
- package/docs/settings.md +172 -0
- package/docs/shell-aliases.md +93 -0
- package/docs/skills.md +93 -0
- package/docs/slash-commands.md +61 -0
- package/docs/terminal-setup.md +233 -0
- package/docs/termux.md +117 -0
- package/docs/themes.md +138 -0
- package/docs/tmux.md +55 -0
- package/docs/tui.md +195 -0
- package/docs/usage.md +94 -0
- package/docs/virtual-models.md +114 -0
- package/docs/windows.md +81 -0
- package/lib/auth.js +190 -0
- package/lib/provider.js +52 -0
- package/package.json +43 -5
- package/sera-core/skills/apple-tasarim/SKILL.md +48 -0
- package/sera-core/skills/apple-tasarim/referanslar/apple-hig.md +55 -0
- package/sera-core/skills/belge-yarat/SKILL.md +64 -0
- package/sera-core/skills/belge-yarat/referanslar/belge-yazim.md +60 -0
- package/sera-core/skills/derin-arastirma/SKILL.md +52 -0
- package/sera-core/skills/derin-arastirma/referanslar/arastirma-yontem.md +50 -0
- package/sera-core/skills/dusunme-dogrulama/SKILL.md +59 -0
- package/sera-core/skills/dusunme-dogrulama/referanslar/dusunme-kontrol.md +54 -0
- package/sera-core/skills/film-stilleri/SKILL.md +51 -0
- package/sera-core/skills/hyperframes/LICENSE-UPSTREAM +190 -0
- package/sera-core/skills/hyperframes/SKILL.md +79 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/biennale-yellow/FRAME.md +289 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/blockframe/FRAME.md +275 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/blue-professional/FRAME.md +307 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/bold-poster/FRAME.md +275 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/broadside/FRAME.md +284 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/capsule/FRAME.md +284 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/cartesian/FRAME.md +278 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/cobalt-grid/FRAME.md +265 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/code-editorial/FRAME.md +277 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/coral/FRAME.md +314 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/creative-mode/FRAME.md +333 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/daisy-days/FRAME.md +274 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/editorial-forest/FRAME.md +265 -0
- package/sera-core/skills/hyperframes/references/captions.md +46 -0
- package/sera-core/skills/hyperframes/references/film.md +48 -0
- package/sera-core/skills/hyperframes/references/format.md +159 -0
- package/sera-core/skills/hyperframes/references/look.md +69 -0
- package/sera-core/skills/hyperframes/references/motion.md +95 -0
- package/sera-core/skills/hyperframes/references/overlays.md +39 -0
- package/sera-core/skills/hyperframes/references/path-tracing.md +36 -0
- package/sera-core/skills/hyperframes/references/plugin-installation.md +42 -0
- package/sera-core/skills/hyperframes/references/review.md +51 -0
- package/sera-core/skills/hyperframes/references/runtimes.md +69 -0
- package/sera-core/skills/hyperframes/references/skill-lifecycle.md +54 -0
- package/sera-core/skills/hyperframes/references/sound.md +43 -0
- package/sera-core/skills/hyperframes/references/spec.md +76 -0
- package/sera-core/skills/hyperframes/references/story.md +103 -0
- package/sera-core/skills/hyperframes/references/storyboard-format.md +107 -0
- package/sera-core/skills/hyperframes/references/storyboard.md +36 -0
- package/sera-core/skills/hyperframes/references/types/3d.md +25 -0
- package/sera-core/skills/hyperframes/references/types/character.md +20 -0
- package/sera-core/skills/hyperframes/references/types/data.md +19 -0
- package/sera-core/skills/hyperframes/references/types/explainer.md +34 -0
- package/sera-core/skills/hyperframes/references/types/launch.md +41 -0
- package/sera-core/skills/hyperframes/references/types/music.md +24 -0
- package/sera-core/skills/hyperframes/references/types/vertical.md +23 -0
- package/sera-core/skills/hyperframes-cli/LICENSE-UPSTREAM +190 -0
- package/sera-core/skills/hyperframes-cli/SKILL.md +99 -0
- package/sera-core/skills/hyperframes-cli/references/beats.md +17 -0
- package/sera-core/skills/hyperframes-cli/references/compare-and-batch.md +105 -0
- package/sera-core/skills/hyperframes-cli/references/conventions.md +16 -0
- package/sera-core/skills/hyperframes-cli/references/doctor-browser.md +80 -0
- package/sera-core/skills/hyperframes-cli/references/feedback.md +14 -0
- package/sera-core/skills/hyperframes-cli/references/init-and-scaffold.md +75 -0
- package/sera-core/skills/hyperframes-cli/references/lint-validate-inspect.md +164 -0
- package/sera-core/skills/hyperframes-cli/references/preview-render.md +204 -0
- package/sera-core/skills/hyperframes-cli/references/upgrade-info-misc.md +134 -0
- package/sera-core/skills/impeccable/LICENSE-UPSTREAM +191 -0
- package/sera-core/skills/impeccable/NOTICE-UPSTREAM.md +11 -0
- package/sera-core/skills/impeccable/SKILL.md +89 -0
- package/sera-core/skills/impeccable/reference/adapt.md +318 -0
- package/sera-core/skills/impeccable/reference/adapt.native.md +58 -0
- package/sera-core/skills/impeccable/reference/android.md +46 -0
- package/sera-core/skills/impeccable/reference/animate.md +89 -0
- package/sera-core/skills/impeccable/reference/audit.md +139 -0
- package/sera-core/skills/impeccable/reference/audit.native.md +139 -0
- package/sera-core/skills/impeccable/reference/bolder.md +33 -0
- package/sera-core/skills/impeccable/reference/clarify.md +94 -0
- package/sera-core/skills/impeccable/reference/colorize.md +86 -0
- package/sera-core/skills/impeccable/reference/component-review.md +63 -0
- package/sera-core/skills/impeccable/reference/craft-floor.md +44 -0
- package/sera-core/skills/impeccable/reference/craft.md +5 -0
- package/sera-core/skills/impeccable/reference/critique.md +819 -0
- package/sera-core/skills/impeccable/reference/degraded/asset-producer.md +42 -0
- package/sera-core/skills/impeccable/reference/degraded/documenter.md +24 -0
- package/sera-core/skills/impeccable/reference/degraded/finish-reviewer.md +38 -0
- package/sera-core/skills/impeccable/reference/degraded/manual-edit-applier.md +93 -0
- package/sera-core/skills/impeccable/reference/delight.md +70 -0
- package/sera-core/skills/impeccable/reference/distill.md +111 -0
- package/sera-core/skills/impeccable/reference/doctor.md +54 -0
- package/sera-core/skills/impeccable/reference/document.md +416 -0
- package/sera-core/skills/impeccable/reference/extract.md +69 -0
- package/sera-core/skills/impeccable/reference/generate.md +101 -0
- package/sera-core/skills/impeccable/reference/harden.md +362 -0
- package/sera-core/skills/impeccable/reference/hooks.md +120 -0
- package/sera-core/skills/impeccable/reference/init.md +133 -0
- package/sera-core/skills/impeccable/reference/ios.md +51 -0
- package/sera-core/skills/impeccable/reference/layout.md +84 -0
- package/sera-core/skills/impeccable/reference/live-setup.md +104 -0
- package/sera-core/skills/impeccable/reference/live.md +327 -0
- package/sera-core/skills/impeccable/reference/mode-operate.md +21 -0
- package/sera-core/skills/impeccable/reference/mode-persuade.md +19 -0
- package/sera-core/skills/impeccable/reference/mode-read.md +21 -0
- package/sera-core/skills/impeccable/reference/new-work.md +152 -0
- package/sera-core/skills/impeccable/reference/onboard.md +234 -0
- package/sera-core/skills/impeccable/reference/operate.md +61 -0
- package/sera-core/skills/impeccable/reference/optimize.md +257 -0
- package/sera-core/skills/impeccable/reference/overdrive.md +127 -0
- package/sera-core/skills/impeccable/reference/polish.md +105 -0
- package/sera-core/skills/impeccable/reference/quieter.md +99 -0
- package/sera-core/skills/impeccable/reference/region-map.md +26 -0
- package/sera-core/skills/impeccable/reference/routing.md +24 -0
- package/sera-core/skills/impeccable/reference/shape.md +59 -0
- package/sera-core/skills/impeccable/reference/typeset.md +90 -0
- package/sera-core/skills/impeccable/reference/visualize.md +47 -0
- package/sera-core/skills/oyun-yarat/SKILL.md +106 -0
- package/sera-core/skills/oyun-yarat/referanslar/3b-yaris.md +74 -0
- package/sera-core/skills/oyun-yarat/referanslar/kaplay.md +99 -0
- package/sera-core/skills/oyun-yarat/referanslar/oyun-desenleri.md +73 -0
- package/sera-core/skills/oyun-yarat/sablonlar/kaplay-2d.html +164 -0
- package/sera-core/skills/oyun-yarat/sablonlar/three-yaris.html +149 -0
- package/sera-core/skills/oyun-yarat/sablonlar/tuval-minimal.html +77 -0
- package/sera-core/skills/receiving-code-review/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/receiving-code-review/SKILL.md +205 -0
- package/sera-core/skills/refero-design/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/refero-design/SKILL.md +534 -0
- package/sera-core/skills/refero-design/references/anti-ai-slop.md +292 -0
- package/sera-core/skills/refero-design/references/color.md +563 -0
- package/sera-core/skills/refero-design/references/copywriting.md +222 -0
- package/sera-core/skills/refero-design/references/craft-details.md +525 -0
- package/sera-core/skills/refero-design/references/example-workflow.md +264 -0
- package/sera-core/skills/refero-design/references/icons.md +166 -0
- package/sera-core/skills/refero-design/references/mcp-tools.md +258 -0
- package/sera-core/skills/refero-design/references/motion.md +504 -0
- package/sera-core/skills/refero-design/references/typography.md +737 -0
- package/sera-core/skills/refero-design/references/visual-workflow.md +105 -0
- package/sera-core/skills/requesting-code-review/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/requesting-code-review/SKILL.md +95 -0
- package/sera-core/skills/requesting-code-review/code-reviewer.md +198 -0
- package/sera-core/skills/reverse-engineer-anything/DISCLAIMER.md +136 -0
- package/sera-core/skills/reverse-engineer-anything/LICENSE-REA-MIT +21 -0
- package/sera-core/skills/reverse-engineer-anything/SKILL.md +363 -0
- package/sera-core/skills/reverse-engineer-anything/THIRD_PARTY_NOTICES.md +135 -0
- package/sera-core/skills/reverse-engineer-anything/references/android-applications.md +36 -0
- package/sera-core/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/sera-core/skills/reverse-engineer-anything/references/evidence-workflows.md +71 -0
- package/sera-core/skills/reverse-engineer-anything/references/javascript-applications.md +218 -0
- package/sera-core/skills/reverse-engineer-anything/references/native-and-artifacts.md +297 -0
- package/sera-core/skills/reverse-engineer-anything/references/runtime-observation.md +78 -0
- package/sera-core/skills/seo-audit/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/seo-audit/SKILL.md +210 -0
- package/sera-core/skills/sera-guvenlik-denetim/SKILL.md +44 -0
- package/sera-core/skills/sera-guvenlik-denetim/referanslar/guvenlik-listesi.md +33 -0
- package/sera-core/skills/sera-hata-ayikla/SKILL.md +27 -0
- package/sera-core/skills/sera-hata-ayikla/referanslar/hata-ayiklama.md +37 -0
- package/sera-core/skills/sera-kod-inceleme/SKILL.md +44 -0
- package/sera-core/skills/sera-kod-inceleme/referanslar/inceleme-listesi.md +62 -0
- package/sera-core/skills/sera-ofis-dosya/SKILL.md +27 -0
- package/sera-core/skills/sera-ofis-dosya/referanslar/ofis-dosya.md +93 -0
- package/sera-core/skills/sera-research/SKILL.md +90 -0
- package/sera-core/skills/sera-tasarim/SKILL.md +149 -0
- package/sera-core/skills/sera-teslim-sozlesmesi/SKILL.md +592 -0
- package/sera-core/skills/sera-test-yaz/SKILL.md +26 -0
- package/sera-core/skills/sera-test-yaz/referanslar/test-yazimi.md +35 -0
- package/sera-core/skills/sera-veri-gorsel/SKILL.md +65 -0
- package/sera-core/skills/sera-web-test/SKILL.md +26 -0
- package/sera-core/skills/sera-web-test/referanslar/web-test.md +44 -0
- package/sera-core/skills/sera-zamanli-gorev/SKILL.md +22 -0
- package/sera-core/skills/sera-zamanli-gorev/referanslar/zamanli-gorev.md +58 -0
- package/sera-core/skills/systematic-debugging/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/systematic-debugging/SKILL.md +283 -0
- package/sera-core/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/sera-core/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/sera-core/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/sera-core/skills/test-driven-development/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/test-driven-development/SKILL.md +330 -0
- package/sera-core/skills/test-driven-development/writing-good-tests.md +198 -0
- package/sera-core/skills/ticaret-icerik/SKILL.md +49 -0
- package/sera-core/skills/ticaret-icerik/referanslar/ticaret-icerik.md +54 -0
- package/sera-core/skills/uygulama-yarat/SKILL.md +95 -0
- package/sera-core/skills/uygulama-yarat/referanslar/uygulama-desenleri.md +63 -0
- package/sera-core/skills/uygulama-yarat/sablonlar/uygulama-tek-dosya.html +121 -0
- package/sera-core/skills/uyumluluk-denetim/SKILL.md +56 -0
- package/sera-core/skills/uyumluluk-denetim/referanslar/mevzuat-tablosu.md +65 -0
- package/sera-core/skills/veri-analizi/SKILL.md +54 -0
- package/sera-core/skills/veri-analizi/referanslar/veri-analizi-yontem.md +49 -0
- package/sera-core/skills/veri-analizi/sablonlar/profil.mjs +79 -0
- package/sera-core/skills/video-duzen/SKILL.md +50 -0
- package/sera-core/skills/video-duzen/referanslar/video-duzen.md +100 -0
- package/sera-core/skills/web-yayin-listesi/SKILL.md +115 -0
- package/sera-core/skills/writing-plans/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/writing-plans/SKILL.md +204 -0
- package/sera-core/src/action-nudge.ts +200 -0
- package/sera-core/src/agent-mode.ts +143 -0
- package/sera-core/src/agents.ts +185 -0
- package/sera-core/src/app-master.ts +275 -0
- package/sera-core/src/app-verify.ts +551 -0
- package/sera-core/src/approval.ts +131 -0
- package/sera-core/src/budget.ts +136 -0
- package/sera-core/src/command-policy.ts +808 -0
- package/sera-core/src/config.ts +135 -0
- package/sera-core/src/context-diet.ts +272 -0
- package/sera-core/src/device-id.ts +48 -0
- package/sera-core/src/dogal-arac.ts +203 -0
- package/sera-core/src/dogal-niyet.ts +173 -0
- package/sera-core/src/egress-allow.ts +52 -0
- package/sera-core/src/export.ts +124 -0
- package/sera-core/src/exposure.ts +8 -0
- package/sera-core/src/extension.ts +2416 -0
- package/sera-core/src/fs-tools.ts +444 -0
- package/sera-core/src/generated/build-rules.ts +26 -0
- package/sera-core/src/generated/zero-knowledge.ts +170 -0
- package/sera-core/src/github-agent-command.ts +133 -0
- package/sera-core/src/github-agent-engine.ts +198 -0
- package/sera-core/src/github-agent-schedule.ts +180 -0
- package/sera-core/src/github-agent.ts +669 -0
- package/sera-core/src/github-ajan-akis.ts +193 -0
- package/sera-core/src/github-ajan-gercek.ts +102 -0
- package/sera-core/src/github-tick.ts +78 -0
- package/sera-core/src/github-yedek.ts +269 -0
- package/sera-core/src/goal.ts +119 -0
- package/sera-core/src/handoff.ts +132 -0
- package/sera-core/src/hooks.ts +284 -0
- package/sera-core/src/image-tool.ts +118 -0
- package/sera-core/src/intake-brief.ts +82 -0
- package/sera-core/src/intake-core.ts +1152 -0
- package/sera-core/src/intake-hook.ts +88 -0
- package/sera-core/src/ios-build-tool.ts +134 -0
- package/sera-core/src/lazy-capability.ts +125 -0
- package/sera-core/src/lazy-mcp.ts +300 -0
- package/sera-core/src/limit-command.ts +51 -0
- package/sera-core/src/loop-brake.ts +129 -0
- package/sera-core/src/lsp.ts +618 -0
- package/sera-core/src/mcp-bridge.ts +159 -0
- package/sera-core/src/mcp-pin.ts +105 -0
- package/sera-core/src/mcp-ssrf.ts +124 -0
- package/sera-core/src/message-cap.ts +45 -0
- package/sera-core/src/no-progress.ts +177 -0
- package/sera-core/src/notebook-tool.ts +179 -0
- package/sera-core/src/ofis.ts +473 -0
- package/sera-core/src/path-guard.ts +139 -0
- package/sera-core/src/permission-bridge.ts +228 -0
- package/sera-core/src/policy-chain.ts +122 -0
- package/sera-core/src/pricing.ts +71 -0
- package/sera-core/src/proc.ts +149 -0
- package/sera-core/src/rea.ts +188 -0
- package/sera-core/src/repo-map.ts +230 -0
- package/sera-core/src/research.ts +347 -0
- package/sera-core/src/rules-memory.ts +227 -0
- package/sera-core/src/sandbox.ts +445 -0
- package/sera-core/src/server-error.ts +78 -0
- package/sera-core/src/skills.ts +268 -0
- package/sera-core/src/snapshot.ts +143 -0
- package/sera-core/src/spec-gate.ts +112 -0
- package/sera-core/src/subagent.ts +261 -0
- package/sera-core/src/teslim.ts +120 -0
- package/sera-core/src/test-fix.ts +184 -0
- package/sera-core/src/todo-question.ts +163 -0
- package/sera-core/src/turn-snapshots.ts +126 -0
- package/sera-core/src/tuval/arac.ts +338 -0
- package/sera-core/src/tuval/arsiv.ts +106 -0
- package/sera-core/src/tuval/belge.ts +216 -0
- package/sera-core/src/tuval/birlestir.ts +282 -0
- package/sera-core/src/tuval/disa.ts +235 -0
- package/sera-core/src/tuval/editor.ts +583 -0
- package/sera-core/src/tuval/film-cekirdek.ts +170 -0
- package/sera-core/src/tuval/film-disa.ts +188 -0
- package/sera-core/src/tuval/film-oynatici.ts +307 -0
- package/sera-core/src/tuval/kimlik.ts +156 -0
- package/sera-core/src/tuval/pano.ts +763 -0
- package/sera-core/src/tuval/proje.ts +728 -0
- package/sera-core/src/tuval/sistem-cekirdek.ts +167 -0
- package/sera-core/src/tuval/sistem.ts +328 -0
- package/sera-core/src/tuval/sunucu.ts +413 -0
- package/sera-core/src/tuval/uretim.ts +24 -0
- package/sera-core/src/tuval/veri-cekirdek.ts +477 -0
- package/sera-core/src/tuval/xlsx.ts +215 -0
- package/sera-core/src/tuval/zip.ts +163 -0
- package/sera-core/src/untrusted.ts +201 -0
- package/sera-core/src/video-edit-tool.ts +411 -0
- package/sera-core/src/video-tool.ts +217 -0
- package/sera-core/src/web-tools.ts +257 -0
- package/sera-core/src/zk.ts +104 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sera-veri-gorsel
|
|
3
|
+
description: Kullanıcı veriden grafik, pano, rapor ya da "bu sayılar ne diyor" istediğinde kullan; doğru grafik türünü seçmeyi, renk ve eksen/etiket kurallarını ve yanıltıcı grafikten kaçınma kontrol listesini içerir. Pano kurmak için sera-tasarim becerisinin pano bölümüyle birlikte oku.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sera veri görselleştirme becerisi
|
|
7
|
+
|
|
8
|
+
Kullanıcı teknik değil: "ordinal", "kategorik" gibi kelimeler kullanma. Önce sorusunu bir cümleye indir ("Hangi bölge daha çok satıyor?", "Satışlar artıyor mu?"). Grafik o soruya cevap vermiyorsa yanlıştır.
|
|
9
|
+
|
|
10
|
+
## 1. Soru → grafik türü
|
|
11
|
+
|
|
12
|
+
| Kullanıcı ne öğrenmek istiyor | Tür (`pano.json` `tur`) | Not |
|
|
13
|
+
| --- | --- | --- |
|
|
14
|
+
| Gruplar arası karşılaştırma (bölge, ürün) | `cubuk` | Çok grup ya da uzun ad varsa yatay çizilir. En büyükten küçüğe sıralı gelir. |
|
|
15
|
+
| Zaman içinde değişim | `cizgi` | Tarih sütunu + `grupla: ay`. Eksik ay varsa çizgi yanıltır; kullanıcıya söyle. |
|
|
16
|
+
| Zaman içinde değişim + toplam büyüklük hissi | `alan` | Yalnız tek seri için. |
|
|
17
|
+
| Bütünün parçaları (pay) | `halka` | En fazla 5–7 dilim; fazlası "Diğer" olur. Dilimler birbirine yakınsa çubuk kullan. |
|
|
18
|
+
| İki sayı arasında ilişki | `dagilim` | İki sayısal sütun; nokta başına bir satır. |
|
|
19
|
+
| Tek bir önemli sayı | sayı kartı (`kartlar`) | Grafik çizme, büyük sayı + açıklama yeter. |
|
|
20
|
+
| Tam değerler / arama | `tablolar` | Hassas değer okunacaksa tablo daha dürüsttür. |
|
|
21
|
+
|
|
22
|
+
Kısa kurallar:
|
|
23
|
+
- Bir grafikte tek soru. İki soru = iki grafik.
|
|
24
|
+
- 3D, çift eksen, radar, balon, gösterge-ibresi kullanma; kullanıcı istemedikçe.
|
|
25
|
+
- Pasta/halka zaman için, iki seri karşılaştırmak için kullanılmaz.
|
|
26
|
+
- 20'den fazla çubuk ya da 7'den fazla dilim varsa gruplamayı değiştir (üst 10 + Diğer) ya da tablo ver.
|
|
27
|
+
|
|
28
|
+
## 2. Renk
|
|
29
|
+
|
|
30
|
+
- Panodaki palet renk körü dostudur (mavi, turuncu, yeşil, pembe…) ve açık/koyu temada ayrı ayarlıdır. Kendi renk ekleme; paleti değiştirmen gerekirse yalnız `--p1`…`--p8` değişkenlerini aynı anda her iki temada değiştir.
|
|
31
|
+
- Tek seri = tek renk. Rengi süs için değiştirme; renk bir şey söylemeli (kategori ya da vurgu).
|
|
32
|
+
- Rengi tek başına anlam taşıtma: halkada dilim adı ve yüzde yazıyla da verilir; hata/başarı yanında yazı ya da simge olsun.
|
|
33
|
+
- Kırmızı/yeşil çiftiyle iyi/kötü anlatma. Gerekirse mavi/turuncu kullan.
|
|
34
|
+
- Yazı rengi zeminde en az 4,5:1 kontrast taşımalı (tasarım sistemi kullanıyorsan rozet bunu denetler).
|
|
35
|
+
|
|
36
|
+
## 3. Eksen, etiket, biçim
|
|
37
|
+
|
|
38
|
+
- Her grafikte başlık bir cümle olsun ve neyin neyin üzerinden gösterildiğini söylesin: "Bölgeye göre toplam tutar", "Aylara göre satış". Bu cümleyi `baslik`a yaz.
|
|
39
|
+
- Sayı eksenleri okunur adımlarda (500, 1.000, 1.500…) ve tekrar eden etiket içermez. Birimi belirt: para için `bicim: para`, oran için `yuzde`.
|
|
40
|
+
- Türkçe biçim: binlik nokta, ondalık virgül, `15 Ocak 2024`. Elle biçimleme; pano Intl tr-TR ile yapar.
|
|
41
|
+
- Etiketler doğrudan çubuğun/noktanın yanında; ayrı gösterge aramaya mecbur bırakma. Uzun adları kısaltma ama anlamını bozma.
|
|
42
|
+
- Veriyi tablo olarak da göster (pano her grafiğin altında "Verileri tablo olarak göster" verir); ekran okuyucu ve kontrol için gerekli.
|
|
43
|
+
|
|
44
|
+
## 4. Yanıltıcı grafikten kaçınma kontrol listesi
|
|
45
|
+
|
|
46
|
+
Teslimden önce her grafiği şunlarla geç:
|
|
47
|
+
|
|
48
|
+
- [ ] **Çubuk ve alan grafiklerinin ekseni sıfırdan başlıyor mu?** Başlamıyorsa farklar olduğundan büyük görünür. (Pano çubuk/alan/çizgiyi her zaman sıfırdan başlatır; bunu bozma.)
|
|
49
|
+
- [ ] Çizgi grafikte zaman adımları eşit mi? Eksik ayları sessizce atlama; "Mart verisi yok" de.
|
|
50
|
+
- [ ] Hesap doğru payda üzerinden mi? Toplam ile ortalamayı karıştırma ("ortalama sepet" ≠ "toplam satış"). Başlık hangisi olduğunu söylüyor mu?
|
|
51
|
+
- [ ] Kısmi dönemi tam dönemle kıyaslıyor muyum? Bu ayın ilk 10 günü, geçen ayın tamamıyla yan yana konmaz.
|
|
52
|
+
- [ ] Filtre uygulanmışken başlıkta durum görünüyor mu? Pano özet satırında "3 / 8 satır gösteriliyor" yazar; kullanıcıya "şu an yalnız Marmara'ya bakıyorsunuz" cümlesini de söyle.
|
|
53
|
+
- [ ] Küçük örneklem: 5 satırdan çıkan yüzde ya da eğilim büyük konuşmaz; satır sayısını belirt ("5 satırdan").
|
|
54
|
+
- [ ] Aşırı uç değer (bir tek 1 milyonluk satır) çubukları ezmiyor mu? Kaynak izine tıklayıp o satırı göster; veri hatası olabilir.
|
|
55
|
+
- [ ] Dilimler 100%'ü anlatıyor mu? Yüzdeler toplamı için tüm parçalar gösterilmeli ("Diğer" dahil).
|
|
56
|
+
- [ ] İki eksenli ya da iki farklı ölçekli çizim yok.
|
|
57
|
+
- [ ] Neden-sonuç iddiası var mı? "Satışlar arttı çünkü reklam" diye yazma; grafik ilişkiyi gösterir, nedeni kanıtlamaz.
|
|
58
|
+
- [ ] Veride okunamayan değer uyarısı çıktı mı (örn. "tutar sütununda 3 değer okunamadı")? Çıktıysa kullanıcıya söyle ve hesaba katılmadığını belirt.
|
|
59
|
+
|
|
60
|
+
## 5. Doğrulama
|
|
61
|
+
|
|
62
|
+
- Kartlardan birine tıkla: açılan kaynak satırlar toplam ile uyuşuyor mu? Bir sayıyı elle kontrol et (en az bir kart ve bir grafik noktası).
|
|
63
|
+
- Süzgeci değiştir, sayıların değiştiğini gör, süzgeci temizle ve ilk değerlere dönüldüğünü gör.
|
|
64
|
+
- 390 px genişlikte (telefon) kontrol et: taşma, okunmayan etiket olmamalı.
|
|
65
|
+
- Kullanıcıya her sayının kaynağına tıklanabileceğini söyle; güven burada kazanılır.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sera-web-test
|
|
3
|
+
description: Kullanıcı bir web sayfası/uygulamanın gerçekten çalıştığını kanıtlamak istediğinde (tarayıcıda test, ekran görüntüsü, çalışıyor mu, önce/sonra görsel, Playwright, başsız/headless tarayıcı, konsol hatası, mobil görünüm, arayüz testi). Serve→başsız tarayıcı→ekran+konsol kontrol→etkileşim; görsel değişiklikte önce/sonra sahibe.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sera web test becerisi
|
|
7
|
+
|
|
8
|
+
Amaç: "çalışıyor" demeden önce sayfayı **gerçek tarayıcıda** açıp kanıt üretmek.
|
|
9
|
+
|
|
10
|
+
## Yöntem
|
|
11
|
+
|
|
12
|
+
1. **Yerelde serve et.** Projenin kendi dev/serve komutunu kullan (yoksa statik dosya sunucusu). Canlı siteyi ya da canlı veriyi kirletme. Adresi ve portu not et.
|
|
13
|
+
2. **Başsız tarayıcıyla aç.** Playwright varsa onu, yoksa kurulu Chrome/Edge'i başsız modda kullan. Projeye yeni bağımlılık ekleme; gerekirse geçici bir dizinde kullan.
|
|
14
|
+
3. **Ekran görüntüsü al.** Masaüstü (ör. 1280 geniş) ve mobil (ör. 390 geniş) için ayrı ayrı. Dosyayı kaydet, yolunu bildir.
|
|
15
|
+
4. **Konsol ve sayfa hatalarını denetle.** `console.error`, yakalanmamış istisna, başarısız ağ isteği (4xx/5xx) listelenir. Hatasız olduğunu çıktıyla göster.
|
|
16
|
+
5. **Etkileşimi simüle et.** Düğmeye tıkla, forma yaz, gönder; sonucu (metin, adres, görünen öğe) doğrula; sonra tekrar ekran görüntüsü al.
|
|
17
|
+
6. **Sahibe göster.** Görüntüleri raporla. Görsel değişiklikte **önce/sonra** ekran görüntüsü şart: sahibin onayı olmadan birleştirme/yayın yapma.
|
|
18
|
+
|
|
19
|
+
## Kurallar
|
|
20
|
+
|
|
21
|
+
- Sayfanın yüklendiğini bekle (ağ boşta / öğe görünür), yoksa boş ekran görüntüsü alırsın.
|
|
22
|
+
- Görüntüyü kendin gözle kontrol et: boş, taşan, kırık düzen var mı.
|
|
23
|
+
- Kapı/şifre yüzünden canlıya girilemiyorsa yerelde çalıştırıp kanıtla ve bunu açıkça belirt.
|
|
24
|
+
- İş bitince sunucuyu ve tarayıcıyı kapat.
|
|
25
|
+
|
|
26
|
+
Ayrıntı: `referanslar/web-test.md`.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Web test başvurusu
|
|
2
|
+
|
|
3
|
+
## Serve + başsız tarayıcı akışı
|
|
4
|
+
1. Sunucu: projenin komutu (`npm run dev`, `npm start`) ya da statik klasör için `npx serve .` / `python -m http.server 8080`. Arka planda başlat, hazır olana kadar bekle (`curl -sf http://localhost:PORT` döngüsü).
|
|
5
|
+
2. Betik (Playwright, örnek):
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
const { chromium } = require('playwright');
|
|
9
|
+
(async () => {
|
|
10
|
+
const b = await chromium.launch();
|
|
11
|
+
const p = await b.newPage({ viewport: { width: 1280, height: 800 } });
|
|
12
|
+
const hatalar = [];
|
|
13
|
+
p.on('console', m => m.type() === 'error' && hatalar.push(m.text()));
|
|
14
|
+
p.on('pageerror', e => hatalar.push(String(e)));
|
|
15
|
+
p.on('requestfailed', r => hatalar.push('AG: ' + r.url()));
|
|
16
|
+
await p.goto('http://localhost:8080', { waitUntil: 'networkidle' });
|
|
17
|
+
await p.screenshot({ path: 'masaustu.png', fullPage: true });
|
|
18
|
+
console.log('hatalar:', hatalar);
|
|
19
|
+
await b.close();
|
|
20
|
+
})();
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
3. Playwright yoksa: `chrome --headless --screenshot=out.png --window-size=1280,800 URL` (Edge de aynı bayrakları destekler).
|
|
24
|
+
4. İş bitince sunucu sürecini sonlandır.
|
|
25
|
+
|
|
26
|
+
## Konsol hatası ayıklama
|
|
27
|
+
- `console.error`, `pageerror` ve başarısız istekleri topla; her birini dosya/satırıyla not et.
|
|
28
|
+
- Sık nedenler: 404 olan dosya yolu, CORS, eksik ortam değişkeni, tanımsız değişken, bozuk JSON.
|
|
29
|
+
- Düzelt, tekrar aç, hata listesinin boş olduğunu göster. Genel yöntem için `sera-hata-ayikla`.
|
|
30
|
+
|
|
31
|
+
## Ekran görüntüsü kanıtı
|
|
32
|
+
- Adlandır: `once-masaustu.png`, `sonra-masaustu.png`, `sonra-mobil.png`.
|
|
33
|
+
- Görsel değişiklikte iki görüntüyü yan yana sun, ne değiştiğini bir cümleyle yaz.
|
|
34
|
+
- Görüntüyü açıp kendin bak: boş sayfa, kayan öğe, kesik metin, okunmayan renk.
|
|
35
|
+
- Sahibin onayı gelmeden birleştirme/yayın yok.
|
|
36
|
+
|
|
37
|
+
## Mobil / masaüstü genişlik
|
|
38
|
+
- Masaüstü 1280x800, tablet 768x1024, mobil 390x844.
|
|
39
|
+
- Mobilde yatay kaydırma çıkmamalı (`document.documentElement.scrollWidth <= innerWidth`).
|
|
40
|
+
- Dokunma hedefleri yeterince büyük, metin okunur olmalı.
|
|
41
|
+
|
|
42
|
+
## Etkileşim
|
|
43
|
+
- `await p.click('text=Gönder')`, `await p.fill('#ad', 'deneme')`, ardından beklenen öğeyi `await p.waitForSelector(...)` ile doğrula.
|
|
44
|
+
- Her adımdan sonra durumu (metin/adres) oku ve raporla.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sera-zamanli-gorev
|
|
3
|
+
description: Kullanıcı tekrarlayan/zamanlanmış iş istediğinde (her gün/hafta/saat çalıştır, zamanla, hatırlat, otomatik çalışsın, cron, schtasks, Görev Zamanlayıcı, periyodik, her gece yedek al, sabah 9'da). OS zamanlayıcısıyla (Windows schtasks, Linux cron/systemd) kurar, bir kez doğrular, durdurma yolunu söyler. Yeni bağımlılık yok.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sera zamanlı görev becerisi
|
|
7
|
+
|
|
8
|
+
Kullanıcı teknik değil. "Her sabah 9'da çalışacak şekilde kurdum; durdurmak isterseniz söyleyin" yeterli. Yeni program/bağımlılık kurma; işletim sisteminin kendi zamanlayıcısı yeter.
|
|
9
|
+
|
|
10
|
+
## Adımlar
|
|
11
|
+
1. **İşi tanımla.** Ne çalışacak? Ne zaman/ne sıklıkla? Çıktı nereye? Bilgi eksikse makul varsayım yap ve söyle (ör. "saat verilmedi, 09:00 aldım").
|
|
12
|
+
2. **Uygunluğu bak.** `referanslar/zamanli-gorev.md` "Hangi işler uygun" bölümü. Bilgisayar kapalıyken çalışması gerekiyorsa açıkça uyar.
|
|
13
|
+
3. **Betik yaz.** Komutu tek bir betik dosyasına koy (`.ps1`/`.bat` ya da `.sh`), tam yollarla, çıktısını log dosyasına yazsın. Betiği kalıcı bir klasöre koy (ör. `~/sera-gorevler/`).
|
|
14
|
+
4. **Zamanlayıcıyı kur.** Windows: `schtasks`. Linux/macOS: `cron` (ya da `systemd timer`). Görev adı anlamlı ve `Sera-` önekli olsun.
|
|
15
|
+
5. **Doğrula.** Betiği bir kez elle çalıştır; log dosyasını oku. Windows'ta `schtasks /run` + `schtasks /query`, Linux'ta `crontab -l`. Kanıtsız "kuruldu" deme.
|
|
16
|
+
6. **Durdurmayı söyle.** Durdurma/silme komutunu düz dille ver (referansta var) ve görev adını, betik yolunu, log yolunu yaz.
|
|
17
|
+
|
|
18
|
+
## Güvenlik
|
|
19
|
+
- Yalnız kullanıcının istediğini kur; yönetici (admin) yetkisi isteme, kullanıcı düzeyinde kur.
|
|
20
|
+
- Şifre/anahtarı betiğe düz yazma; ortam değişkeni kullan.
|
|
21
|
+
- Silme/gönderme gibi geri alınamaz işleri zamanlamadan önce kullanıcıdan onay al.
|
|
22
|
+
- Çok sık çalışan görevlerde (dakikada bir gibi) gereksiz yükü uyar.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Zamanlı görev referansı
|
|
2
|
+
|
|
3
|
+
## Hangi işler uygun
|
|
4
|
+
Uygun: yedek alma, dosya temizliği, rapor/CSV üretme, sayfa/API kontrolü, hatırlatma bildirimi, düzenli indirme.
|
|
5
|
+
Dikkat: bilgisayar kapalı/uykudaysa çalışmaz (Windows'ta "kaçırılırsa çalıştır" seçeneği vardır). Ekran/oturum gerektiren işler (tarayıcı otomasyonu) zamanlanmış çalışmada sorun çıkarabilir. Çok sık (dakikada bir) ve geri alınamaz işlerden kaçın.
|
|
6
|
+
|
|
7
|
+
## Windows: schtasks
|
|
8
|
+
```
|
|
9
|
+
schtasks /create /tn "Sera-Yedek" /tr "powershell -NoProfile -File C:\Users\Ad\sera-gorevler\yedek.ps1" /sc daily /st 09:00
|
|
10
|
+
schtasks /create /tn "Sera-Haftalik" /tr "C:\...\is.bat" /sc weekly /d MON /st 08:30
|
|
11
|
+
schtasks /create /tn "Sera-Saatlik" /tr "..." /sc hourly /mo 1
|
|
12
|
+
schtasks /create /tn "Sera-15dk" /tr "..." /sc minute /mo 15
|
|
13
|
+
schtasks /create /tn "Sera-Acilista" /tr "..." /sc onlogon
|
|
14
|
+
```
|
|
15
|
+
Aynı adı değiştirmek için `/f` ekle. Kendi kullanıcınız için admin gerekmez (`/ru SYSTEM` kullanma).
|
|
16
|
+
- Elle çalıştır: `schtasks /run /tn "Sera-Yedek"`
|
|
17
|
+
- Durum: `schtasks /query /tn "Sera-Yedek" /v /fo list`
|
|
18
|
+
- Geçici durdur: `schtasks /change /tn "Sera-Yedek" /disable` (açmak için `/enable`)
|
|
19
|
+
- Kalıcı sil: `schtasks /delete /tn "Sera-Yedek" /f`
|
|
20
|
+
- Liste: `schtasks /query /fo table | findstr Sera-`
|
|
21
|
+
|
|
22
|
+
İç içe tırnak sorunu olursa komutu `.ps1`/`.bat` içine koy, `/tr`'ye yalnız betik yolunu ver.
|
|
23
|
+
|
|
24
|
+
## Linux/macOS: cron
|
|
25
|
+
Satır ekleme: `(crontab -l 2>/dev/null; echo "0 9 * * * /home/ad/sera-gorevler/is.sh >> /home/ad/sera-gorevler/is.log 2>&1") | crontab -`
|
|
26
|
+
Alanlar: `dakika saat gün ay haftanın-günü`
|
|
27
|
+
|
|
28
|
+
| Periyot | Yazım |
|
|
29
|
+
|---|---|
|
|
30
|
+
| Her dakika | `* * * * *` |
|
|
31
|
+
| Her 15 dk | `*/15 * * * *` |
|
|
32
|
+
| Her saat başı | `0 * * * *` |
|
|
33
|
+
| Her gün 09:00 | `0 9 * * *` |
|
|
34
|
+
| Hafta içi 08:30 | `30 8 * * 1-5` |
|
|
35
|
+
| Pazartesi 07:00 | `0 7 * * 1` |
|
|
36
|
+
| Ayın 1'i 06:00 | `0 6 1 * *` |
|
|
37
|
+
| Açılışta | `@reboot` |
|
|
38
|
+
|
|
39
|
+
cron ortamı çıplaktır: tam yol kullan, `PATH`'e güvenme, betiğe `chmod +x`.
|
|
40
|
+
Durdur/sil: `crontab -e` ile satırı sil ya da başına `#` koy. `crontab -r` TÜM satırları siler, kullanma.
|
|
41
|
+
|
|
42
|
+
## systemd timer (alternatif, kullanıcı düzeyi)
|
|
43
|
+
`~/.config/systemd/user/sera-is.service` (`ExecStart=/tam/yol/is.sh`) ve `sera-is.timer` (`OnCalendar=*-*-* 09:00:00`, `Persistent=true`, `[Install] WantedBy=timers.target`).
|
|
44
|
+
- Aç: `systemctl --user daemon-reload && systemctl --user enable --now sera-is.timer`
|
|
45
|
+
- Durdur: `systemctl --user disable --now sera-is.timer`
|
|
46
|
+
- Liste: `systemctl --user list-timers`
|
|
47
|
+
|
|
48
|
+
## Log ve çıktı yakalama
|
|
49
|
+
Windows .ps1: `... *>> "$PSScriptRoot\is.log"`; .bat: `komut >> is.log 2>&1`. Başına tarih yaz: `Get-Date -Format s`.
|
|
50
|
+
Linux: `>> is.log 2>&1`. Log büyümesin: son N satırı tut ya da haftalık döndür.
|
|
51
|
+
Sonuç dosyası (rapor, CSV) sabit bir klasöre yazılsın; kullanıcıya yolunu söyle.
|
|
52
|
+
|
|
53
|
+
## Hatırlatma
|
|
54
|
+
Windows: betikte `msg * "Hatırlat: ..."` ya da PowerShell bildirimi. Linux: `notify-send "Hatırlat" "..."`.
|
|
55
|
+
Tek seferlik: `schtasks /create ... /sc once /st 15:00 /sd 2026-11-10` ya da Linux'ta `at 15:00`.
|
|
56
|
+
|
|
57
|
+
## Doğrulama
|
|
58
|
+
1) Betiği elle çalıştır, log'u oku. 2) Görev listede mi (`schtasks /query` / `crontab -l`). 3) Mümkünse zamanlayıcıyla bir kez tetikle (`schtasks /run`). 4) Kullanıcıya: ad, zaman, betik yolu, log yolu, durdurma komutu.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Jesse Vincent
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: systematic-debugging
|
|
3
|
+
description: "Hata ayıklarken: kök nedeni bulmadan düzeltme önerme."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Systematic Debugging
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
**Core principle:** ALWAYS find root cause before attempting fixes. Symptom fixes are failure.
|
|
11
|
+
|
|
12
|
+
**Violating the letter of this process is violating the spirit of debugging.**
|
|
13
|
+
|
|
14
|
+
## The Iron Law
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If you haven't completed Phase 1, you cannot propose fixes.
|
|
21
|
+
|
|
22
|
+
## When to Use
|
|
23
|
+
|
|
24
|
+
Use for ANY technical issue:
|
|
25
|
+
- Test failures
|
|
26
|
+
- Bugs in production
|
|
27
|
+
- Unexpected behavior
|
|
28
|
+
- Performance problems
|
|
29
|
+
- Build failures
|
|
30
|
+
- Integration issues
|
|
31
|
+
|
|
32
|
+
**Use this ESPECIALLY when:**
|
|
33
|
+
- Under time pressure (emergencies make guessing tempting)
|
|
34
|
+
- "Just one quick fix" seems obvious
|
|
35
|
+
- You've already tried multiple fixes
|
|
36
|
+
- Previous fix didn't work
|
|
37
|
+
- You don't fully understand the issue
|
|
38
|
+
|
|
39
|
+
**Don't skip when:**
|
|
40
|
+
- Issue seems simple (simple bugs have root causes too)
|
|
41
|
+
- You're in a hurry (rushing guarantees rework)
|
|
42
|
+
- Manager wants it fixed NOW (systematic is faster than thrashing)
|
|
43
|
+
|
|
44
|
+
## The Four Phases
|
|
45
|
+
|
|
46
|
+
You MUST complete each phase before proceeding to the next.
|
|
47
|
+
|
|
48
|
+
### Phase 1: Root Cause Investigation
|
|
49
|
+
|
|
50
|
+
**BEFORE attempting ANY fix:**
|
|
51
|
+
|
|
52
|
+
1. **Read Error Messages Carefully**
|
|
53
|
+
- Don't skip past errors or warnings
|
|
54
|
+
- They often contain the exact solution
|
|
55
|
+
- Read stack traces completely
|
|
56
|
+
- Note line numbers, file paths, error codes
|
|
57
|
+
|
|
58
|
+
2. **Reproduce Consistently**
|
|
59
|
+
- Can you trigger it reliably?
|
|
60
|
+
- What are the exact steps?
|
|
61
|
+
- Does it happen every time?
|
|
62
|
+
- If not reproducible → gather more data, don't guess
|
|
63
|
+
|
|
64
|
+
3. **Check Recent Changes**
|
|
65
|
+
- What changed that could cause this?
|
|
66
|
+
- Git diff, recent commits
|
|
67
|
+
- New dependencies, config changes
|
|
68
|
+
- Environmental differences
|
|
69
|
+
|
|
70
|
+
4. **Gather Evidence in Multi-Component Systems**
|
|
71
|
+
|
|
72
|
+
**WHEN system has multiple components (CI → build → signing, API → service → database):**
|
|
73
|
+
|
|
74
|
+
**BEFORE proposing fixes, add diagnostic instrumentation:**
|
|
75
|
+
```
|
|
76
|
+
For EACH component boundary:
|
|
77
|
+
- Log what data enters component
|
|
78
|
+
- Log what data exits component
|
|
79
|
+
- Verify environment/config propagation
|
|
80
|
+
- Check state at each layer
|
|
81
|
+
|
|
82
|
+
Run once to gather evidence showing WHERE it breaks
|
|
83
|
+
THEN analyze evidence to identify failing component
|
|
84
|
+
THEN investigate that specific component
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Example (multi-layer system):**
|
|
88
|
+
```bash
|
|
89
|
+
# Layer 1: Workflow
|
|
90
|
+
echo "=== Secrets available in workflow: ==="
|
|
91
|
+
echo "IDENTITY: $([ -n "${IDENTITY:-}" ] && echo SET || echo UNSET)"
|
|
92
|
+
|
|
93
|
+
# Layer 2: Build script
|
|
94
|
+
echo "=== Env vars in build script: ==="
|
|
95
|
+
printenv IDENTITY >/dev/null 2>&1 && echo "IDENTITY in environment" || echo "IDENTITY not in environment"
|
|
96
|
+
|
|
97
|
+
# Layer 3: Signing script
|
|
98
|
+
echo "=== Keychain state: ==="
|
|
99
|
+
security list-keychains
|
|
100
|
+
security find-identity -v
|
|
101
|
+
|
|
102
|
+
# Layer 4: Actual signing
|
|
103
|
+
codesign --sign "$IDENTITY" --verbose=4 "$APP"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**This reveals:** Which layer fails (secrets → workflow ✓, workflow → build ✗)
|
|
107
|
+
|
|
108
|
+
5. **Trace Data Flow**
|
|
109
|
+
|
|
110
|
+
**WHEN error is deep in call stack:**
|
|
111
|
+
|
|
112
|
+
See `root-cause-tracing.md` in this directory for the complete backward tracing technique.
|
|
113
|
+
|
|
114
|
+
**Quick version:**
|
|
115
|
+
- Where does bad value originate?
|
|
116
|
+
- What called this with bad value?
|
|
117
|
+
- Keep tracing up until you find the source
|
|
118
|
+
- Fix at source, not at symptom
|
|
119
|
+
|
|
120
|
+
### Phase 2: Pattern Analysis
|
|
121
|
+
|
|
122
|
+
**Find the pattern before fixing:**
|
|
123
|
+
|
|
124
|
+
1. **Find Working Examples**
|
|
125
|
+
- Locate similar working code in same codebase
|
|
126
|
+
- What works that's similar to what's broken?
|
|
127
|
+
|
|
128
|
+
2. **Compare Against References**
|
|
129
|
+
- If implementing pattern, read reference implementation COMPLETELY
|
|
130
|
+
- Don't skim - read every line
|
|
131
|
+
- Understand the pattern fully before applying
|
|
132
|
+
|
|
133
|
+
3. **Identify Differences**
|
|
134
|
+
- What's different between working and broken?
|
|
135
|
+
- List every difference, however small
|
|
136
|
+
- Don't assume "that can't matter"
|
|
137
|
+
|
|
138
|
+
4. **Understand Dependencies**
|
|
139
|
+
- What other components does this need?
|
|
140
|
+
- What settings, config, environment?
|
|
141
|
+
- What assumptions does it make?
|
|
142
|
+
|
|
143
|
+
### Phase 3: Hypothesis and Testing
|
|
144
|
+
|
|
145
|
+
**Scientific method:**
|
|
146
|
+
|
|
147
|
+
1. **Form Single Hypothesis**
|
|
148
|
+
- State clearly: "I think X is the root cause because Y"
|
|
149
|
+
- Write it down
|
|
150
|
+
- Be specific, not vague
|
|
151
|
+
|
|
152
|
+
2. **Test Minimally**
|
|
153
|
+
- Make the SMALLEST possible change to test hypothesis
|
|
154
|
+
- One variable at a time
|
|
155
|
+
- Don't fix multiple things at once
|
|
156
|
+
|
|
157
|
+
3. **Verify Before Continuing**
|
|
158
|
+
- Did it work? Yes → Phase 4
|
|
159
|
+
- Didn't work? Form NEW hypothesis
|
|
160
|
+
- DON'T add more fixes on top
|
|
161
|
+
|
|
162
|
+
4. **When You Don't Know**
|
|
163
|
+
- Say "I don't understand X"
|
|
164
|
+
- Don't pretend to know
|
|
165
|
+
- Ask for help
|
|
166
|
+
- Research more
|
|
167
|
+
|
|
168
|
+
### Phase 4: Implementation
|
|
169
|
+
|
|
170
|
+
**Fix the root cause, not the symptom:**
|
|
171
|
+
|
|
172
|
+
1. **Create Failing Test Case**
|
|
173
|
+
- Simplest possible reproduction
|
|
174
|
+
- Automated test if possible
|
|
175
|
+
- One-off test script if no framework
|
|
176
|
+
- MUST have before fixing
|
|
177
|
+
- Use the `superpowers:test-driven-development` skill for writing proper failing tests
|
|
178
|
+
|
|
179
|
+
2. **Implement Single Fix**
|
|
180
|
+
- Address the root cause identified
|
|
181
|
+
- ONE change at a time
|
|
182
|
+
- No "while I'm here" improvements
|
|
183
|
+
- No bundled refactoring
|
|
184
|
+
|
|
185
|
+
3. **Verify Fix**
|
|
186
|
+
- Test passes now?
|
|
187
|
+
- No other tests broken?
|
|
188
|
+
- Issue actually resolved?
|
|
189
|
+
- Use the `superpowers:verification-before-completion` skill before claiming success
|
|
190
|
+
|
|
191
|
+
4. **If Fix Doesn't Work**
|
|
192
|
+
- STOP
|
|
193
|
+
- Count: How many fixes have you tried?
|
|
194
|
+
- If < 3: Return to Phase 1, re-analyze with new information
|
|
195
|
+
- **If ≥ 3: STOP and question the architecture (step 5 below)**
|
|
196
|
+
- DON'T attempt Fix #4 without architectural discussion
|
|
197
|
+
|
|
198
|
+
5. **If 3+ Fixes Failed: Question Architecture**
|
|
199
|
+
|
|
200
|
+
**Pattern indicating architectural problem:**
|
|
201
|
+
- Each fix reveals new shared state/coupling/problem in different place
|
|
202
|
+
- Fixes require "massive refactoring" to implement
|
|
203
|
+
- Each fix creates new symptoms elsewhere
|
|
204
|
+
|
|
205
|
+
**STOP and question fundamentals:**
|
|
206
|
+
- Is this pattern fundamentally sound?
|
|
207
|
+
- Are we "sticking with it through sheer inertia"?
|
|
208
|
+
- Should we refactor architecture vs. continue fixing symptoms?
|
|
209
|
+
|
|
210
|
+
**Discuss with your human partner before attempting more fixes**
|
|
211
|
+
|
|
212
|
+
This is NOT a failed hypothesis - this is a wrong architecture.
|
|
213
|
+
|
|
214
|
+
## Red Flags - STOP and Follow Process
|
|
215
|
+
|
|
216
|
+
If you catch yourself thinking:
|
|
217
|
+
- "Quick fix for now, investigate later"
|
|
218
|
+
- "Just try changing X and see if it works"
|
|
219
|
+
- "Add multiple changes, run tests"
|
|
220
|
+
- "Skip the test, I'll manually verify"
|
|
221
|
+
- "It's probably X, let me fix that"
|
|
222
|
+
- "I don't fully understand but this might work"
|
|
223
|
+
- "Pattern says X but I'll adapt it differently"
|
|
224
|
+
- "Here are the main problems: [lists fixes without investigation]"
|
|
225
|
+
- Proposing solutions before tracing data flow
|
|
226
|
+
- **"One more fix attempt" (when already tried 2+)**
|
|
227
|
+
- **Each fix reveals new problem in different place**
|
|
228
|
+
|
|
229
|
+
**ALL of these mean: STOP. Return to Phase 1.**
|
|
230
|
+
|
|
231
|
+
**If 3+ fixes failed:** Question the architecture (see Phase 4.5)
|
|
232
|
+
|
|
233
|
+
## your human partner's Signals You're Doing It Wrong
|
|
234
|
+
|
|
235
|
+
**Watch for these redirections:**
|
|
236
|
+
- "Is that not happening?" - You assumed without verifying
|
|
237
|
+
- "Will it show us...?" - You should have added evidence gathering
|
|
238
|
+
- "Stop guessing" - You're proposing fixes without understanding
|
|
239
|
+
- "Ultra-think this" - Question fundamentals, not just symptoms
|
|
240
|
+
- "We're stuck?" (frustrated) - Your approach isn't working
|
|
241
|
+
|
|
242
|
+
**When you see these:** STOP. Return to Phase 1.
|
|
243
|
+
|
|
244
|
+
## Common Rationalizations
|
|
245
|
+
|
|
246
|
+
| Excuse | Reality |
|
|
247
|
+
|--------|---------|
|
|
248
|
+
| "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
|
|
249
|
+
| "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
|
|
250
|
+
| "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
|
|
251
|
+
| "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
|
|
252
|
+
| "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
|
|
253
|
+
| "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
|
|
254
|
+
| "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
|
|
255
|
+
| "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question pattern, don't fix again. |
|
|
256
|
+
|
|
257
|
+
## Quick Reference
|
|
258
|
+
|
|
259
|
+
| Phase | Key Activities | Success Criteria |
|
|
260
|
+
|-------|---------------|------------------|
|
|
261
|
+
| **1. Root Cause** | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY |
|
|
262
|
+
| **2. Pattern** | Find working examples, compare | Identify differences |
|
|
263
|
+
| **3. Hypothesis** | Form theory, test minimally | Confirmed or new hypothesis |
|
|
264
|
+
| **4. Implementation** | Create test, fix, verify | Bug resolved, tests pass |
|
|
265
|
+
|
|
266
|
+
## When Process Reveals "No Root Cause"
|
|
267
|
+
|
|
268
|
+
If systematic investigation reveals issue is truly environmental, timing-dependent, or external:
|
|
269
|
+
|
|
270
|
+
1. You've completed the process
|
|
271
|
+
2. Document what you investigated
|
|
272
|
+
3. Implement appropriate handling (retry, timeout, error message)
|
|
273
|
+
4. Add monitoring/logging for future investigation
|
|
274
|
+
|
|
275
|
+
**But:** 95% of "no root cause" cases are incomplete investigation.
|
|
276
|
+
|
|
277
|
+
## Supporting Techniques
|
|
278
|
+
|
|
279
|
+
These techniques are part of systematic debugging and available in this directory:
|
|
280
|
+
|
|
281
|
+
- **`root-cause-tracing.md`** - Trace bugs backward through call stack to find original trigger
|
|
282
|
+
- **`defense-in-depth.md`** - Add validation at multiple layers after finding root cause
|
|
283
|
+
- **`condition-based-waiting.md`** - Replace arbitrary timeouts with condition polling
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Condition-Based Waiting
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Flaky tests often guess at timing with arbitrary delays. This creates race conditions where tests pass on fast machines but fail under load or in CI.
|
|
6
|
+
|
|
7
|
+
**Core principle:** Wait for the actual condition you care about, not a guess about how long it takes.
|
|
8
|
+
|
|
9
|
+
## When to Use
|
|
10
|
+
|
|
11
|
+
```dot
|
|
12
|
+
digraph when_to_use {
|
|
13
|
+
"Test uses setTimeout/sleep?" [shape=diamond];
|
|
14
|
+
"Testing timing behavior?" [shape=diamond];
|
|
15
|
+
"Document WHY timeout needed" [shape=box];
|
|
16
|
+
"Use condition-based waiting" [shape=box];
|
|
17
|
+
|
|
18
|
+
"Test uses setTimeout/sleep?" -> "Testing timing behavior?" [label="yes"];
|
|
19
|
+
"Testing timing behavior?" -> "Document WHY timeout needed" [label="yes"];
|
|
20
|
+
"Testing timing behavior?" -> "Use condition-based waiting" [label="no"];
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Use when:**
|
|
25
|
+
- Tests have arbitrary delays (`setTimeout`, `sleep`, `time.sleep()`)
|
|
26
|
+
- Tests are flaky (pass sometimes, fail under load)
|
|
27
|
+
- Tests timeout when run in parallel
|
|
28
|
+
- Waiting for async operations to complete
|
|
29
|
+
|
|
30
|
+
**Don't use when:**
|
|
31
|
+
- Testing actual timing behavior (debounce, throttle intervals)
|
|
32
|
+
- Always document WHY if using arbitrary timeout
|
|
33
|
+
|
|
34
|
+
## Core Pattern
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
// ❌ BEFORE: Guessing at timing
|
|
38
|
+
await new Promise(r => setTimeout(r, 50));
|
|
39
|
+
const result = getResult();
|
|
40
|
+
expect(result).toBeDefined();
|
|
41
|
+
|
|
42
|
+
// ✅ AFTER: Waiting for condition
|
|
43
|
+
await waitFor(() => getResult() !== undefined);
|
|
44
|
+
const result = getResult();
|
|
45
|
+
expect(result).toBeDefined();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick Patterns
|
|
49
|
+
|
|
50
|
+
| Scenario | Pattern |
|
|
51
|
+
|----------|---------|
|
|
52
|
+
| Wait for event | `waitFor(() => events.find(e => e.type === 'DONE'))` |
|
|
53
|
+
| Wait for state | `waitFor(() => machine.state === 'ready')` |
|
|
54
|
+
| Wait for count | `waitFor(() => items.length >= 5)` |
|
|
55
|
+
| Wait for file | `waitFor(() => fs.existsSync(path))` |
|
|
56
|
+
| Complex condition | `waitFor(() => obj.ready && obj.value > 10)` |
|
|
57
|
+
|
|
58
|
+
## Implementation
|
|
59
|
+
|
|
60
|
+
Generic polling function:
|
|
61
|
+
```typescript
|
|
62
|
+
async function waitFor<T>(
|
|
63
|
+
condition: () => T | undefined | null | false,
|
|
64
|
+
description: string,
|
|
65
|
+
timeoutMs = 5000
|
|
66
|
+
): Promise<T> {
|
|
67
|
+
const startTime = Date.now();
|
|
68
|
+
|
|
69
|
+
while (true) {
|
|
70
|
+
const result = condition();
|
|
71
|
+
if (result) return result;
|
|
72
|
+
|
|
73
|
+
if (Date.now() - startTime > timeoutMs) {
|
|
74
|
+
throw new Error(`Timeout waiting for ${description} after ${timeoutMs}ms`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
await new Promise(r => setTimeout(r, 10)); // Poll every 10ms
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
See `condition-based-waiting-example.ts` in this directory for complete implementation with domain-specific helpers (`waitForEvent`, `waitForEventCount`, `waitForEventMatch`) from actual debugging session.
|
|
83
|
+
|
|
84
|
+
## Common Mistakes
|
|
85
|
+
|
|
86
|
+
**❌ Polling too fast:** `setTimeout(check, 1)` - wastes CPU
|
|
87
|
+
**✅ Fix:** Poll every 10ms
|
|
88
|
+
|
|
89
|
+
**❌ No timeout:** Loop forever if condition never met
|
|
90
|
+
**✅ Fix:** Always include timeout with clear error
|
|
91
|
+
|
|
92
|
+
**❌ Stale data:** Cache state before loop
|
|
93
|
+
**✅ Fix:** Call getter inside loop for fresh data
|
|
94
|
+
|
|
95
|
+
## When Arbitrary Timeout IS Correct
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
// Tool ticks every 100ms - need 2 ticks to verify partial output
|
|
99
|
+
await waitForEvent(manager, 'TOOL_STARTED'); // First: wait for condition
|
|
100
|
+
await new Promise(r => setTimeout(r, 200)); // Then: wait for timed behavior
|
|
101
|
+
// 200ms = 2 ticks at 100ms intervals - documented and justified
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Requirements:**
|
|
105
|
+
1. First wait for triggering condition
|
|
106
|
+
2. Based on known timing (not guessing)
|
|
107
|
+
3. Comment explaining WHY
|
|
108
|
+
|
|
109
|
+
## Real-World Impact
|
|
110
|
+
|
|
111
|
+
From debugging session (2025-10-03):
|
|
112
|
+
- Fixed 15 flaky tests across 3 files
|
|
113
|
+
- Pass rate: 60% → 100%
|
|
114
|
+
- Execution time: 40% faster
|
|
115
|
+
- No more race conditions
|