@r1z4x/tezgah 1.9.2 → 1.13.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/CHANGELOG.md +415 -1
- package/MANIFEST +404 -144
- package/README.de.md +1 -1
- package/README.es.md +1 -1
- package/README.fr.md +1 -1
- package/README.md +5 -4
- package/README.tr.md +1 -1
- package/bin/codegen +5 -2
- package/bin/tezgah-design +288 -1
- package/bin/tezgah-docs +1 -1
- package/bin/tezgah-doctor +39 -2
- package/bin/tezgah-import-ai-research +26 -12
- package/bin/tezgah-ocr-review +296 -0
- package/bin/tezgah-research +255 -44
- package/bin/tezgah-review-quote +185 -0
- package/bin/tezgah-setup +1365 -55
- package/bin/tezgah-skill +1 -1
- package/bin/tezgah-status +201 -3
- package/bin/tezgah-task +258 -20
- package/commands/adhd.md +2 -2
- package/commands/ponytail.md +4 -4
- package/docs/architecture.md +2 -2
- package/docs/citations-baseline.json +3 -3
- package/docs/clarity-baseline.json +11 -5
- package/docs/contract.md +91 -43
- package/docs/environment.md +5 -2
- package/docs/evidence.md +109 -17
- package/docs/feature-audit.md +2 -2
- package/docs/gate.md +60 -33
- package/docs/glossary.md +6 -3
- package/docs/hosts.md +313 -17
- package/docs/index.json +34 -8
- package/docs/judge.md +4 -2
- package/docs/layers.md +4 -4
- package/docs/models.md +37 -9
- package/docs/operations.md +141 -5
- package/docs/research.md +815 -8
- package/docs/skills.md +137 -13
- package/docs/status-line.md +121 -1
- package/docs/testing.md +3 -1
- package/hooks/hooks.json +2 -2
- package/hooks/lang/en.json +21 -0
- package/hooks/lang/tr.json +22 -1
- package/hooks/projects-stop.py +2 -1
- package/hooks/tezgah_agents.py +65 -25
- package/hooks/tezgah_apps.py +18 -0
- package/hooks/tezgah_attest.py +79 -10
- package/hooks/tezgah_components.py +4 -0
- package/hooks/tezgah_context.py +207 -55
- package/hooks/tezgah_extension.py +337 -0
- package/hooks/tezgah_gate.py +267 -79
- package/hooks/tezgah_integrity.py +864 -143
- package/hooks/tezgah_judge.py +6 -4
- package/hooks/tezgah_models.py +59 -19
- package/hooks/tezgah_orca.py +1 -1
- package/hooks/tezgah_paths.py +145 -8
- package/hooks/tezgah_policy.py +128 -57
- package/hooks/tezgah_rank.py +9 -6
- package/hooks/tezgah_replay.py +12 -6
- package/hooks/tezgah_research.py +1414 -76
- package/hooks/tezgah_research_capture.py +1544 -0
- package/hooks/tezgah_research_evidence.py +842 -0
- package/hooks/tezgah_research_stats.py +258 -0
- package/hooks/tezgah_skill_pick.py +408 -106
- package/hooks/tezgah_stack.py +236 -1
- package/hooks/tezgah_stopspec.py +8 -1
- package/hooks/tezgah_task.py +14 -5
- package/hooks/tezgah_taste_ledger.py +1 -1
- package/hosts/amp/hook.py +217 -0
- package/hosts/amp/tezgah-plugin.ts.in +386 -0
- package/hosts/antigravity/hook.py +255 -0
- package/hosts/codex/hook.py +2 -1
- package/hosts/commandcode/hook.py +239 -0
- package/hosts/copilot/hook.py +284 -0
- package/hosts/cursor/hook.py +31 -3
- package/hosts/droid/hook.py +259 -0
- package/hosts/dsh/hooks.json +1 -1
- package/hosts/gemini/hook.py +213 -0
- package/hosts/goose/hook.py +145 -0
- package/hosts/omp/hook.py +4 -1
- package/hosts/omp/tezgah-hook.ts.in +30 -7
- package/hosts/opencode/plugins/tezgah.js +309 -48
- package/hosts/opencode/tui/cli/tui.tsx +100 -0
- package/hosts/opencode/tui/tezgah-tui.tsx +2 -1
- package/hosts/qwen/hook.py +206 -0
- package/output-styles/tezgah.md +20 -15
- package/package.json +1 -1
- package/skills/ai-research/SKILL.md +21 -14
- package/skills/ai-research/SOURCE +7 -5
- package/skills/ai-research/index/1-frame.md +6 -6
- package/skills/ai-research/index/2-data.md +9 -9
- package/skills/ai-research/index/3-train.md +36 -36
- package/skills/ai-research/index/4-measure.md +13 -13
- package/skills/ai-research/index/5-run.md +11 -11
- package/skills/ai-research/index/6-write.md +23 -23
- package/skills/ai-research/library.json +104 -104
- package/skills/analyze-app/SKILL.md +17 -12
- package/skills/design-contract/SKILL.md +42 -7
- package/skills/design-contract/data-views.md +2 -2
- package/skills/design-library/EVALS.md +1 -1
- package/skills/design-library/INDEX.md +39 -39
- package/skills/design-library/SKILL.md +19 -13
- package/skills/design-library/SOURCE +45 -43
- package/skills/feature-audit/SKILL.md +20 -14
- package/skills/hallmark/LICENSE +21 -0
- package/skills/hallmark/SKILL.md +154 -0
- package/skills/hallmark/SOURCE +207 -0
- package/skills/hallmark/agents/openai.yaml +13 -0
- package/skills/hallmark/references/anatomy.md +71 -0
- package/skills/hallmark/references/brand-truth.md +40 -0
- package/skills/hallmark/references/comp.md +104 -0
- package/skills/hallmark/references/craft.md +116 -0
- package/skills/hallmark/references/dark-mode.md +49 -0
- package/skills/hallmark/references/data-viz.md +48 -0
- package/skills/hallmark/references/design-md.md +53 -0
- package/skills/hallmark/references/direction.md +52 -0
- package/skills/hallmark/references/export-formats.md +80 -0
- package/skills/hallmark/references/flow.md +131 -0
- package/skills/hallmark/references/fonts.md +58 -0
- package/skills/hallmark/references/gates.md +243 -0
- package/skills/hallmark/references/genres/atmospheric.md +24 -0
- package/skills/hallmark/references/genres/editorial.md +24 -0
- package/skills/hallmark/references/genres/modern-minimal.md +24 -0
- package/skills/hallmark/references/genres/playful.md +24 -0
- package/skills/hallmark/references/imagery.md +99 -0
- package/skills/hallmark/references/interaction-and-states.md +89 -0
- package/skills/hallmark/references/layout.md +104 -0
- package/skills/hallmark/references/macrostructures/01-bento-grid.md +21 -0
- package/skills/hallmark/references/macrostructures/02-long-document.md +35 -0
- package/skills/hallmark/references/macrostructures/03-marquee-hero.md +21 -0
- package/skills/hallmark/references/macrostructures/04-stat-led.md +21 -0
- package/skills/hallmark/references/macrostructures/05-workbench.md +21 -0
- package/skills/hallmark/references/macrostructures/06-conversational-faq.md +28 -0
- package/skills/hallmark/references/macrostructures/07-manifesto.md +28 -0
- package/skills/hallmark/references/macrostructures/08-photographic.md +21 -0
- package/skills/hallmark/references/macrostructures/09-quote-led.md +21 -0
- package/skills/hallmark/references/macrostructures/10-specimen.md +21 -0
- package/skills/hallmark/references/macrostructures/11-catalogue.md +21 -0
- package/skills/hallmark/references/macrostructures/12-letter.md +21 -0
- package/skills/hallmark/references/macrostructures/13-index-first.md +21 -0
- package/skills/hallmark/references/macrostructures/14-narrative-workflow.md +21 -0
- package/skills/hallmark/references/macrostructures/15-split-studio.md +21 -0
- package/skills/hallmark/references/macrostructures/16-feature-stack.md +23 -0
- package/skills/hallmark/references/macrostructures/17-type-specimen.md +19 -0
- package/skills/hallmark/references/macrostructures/18-portfolio-grid.md +21 -0
- package/skills/hallmark/references/macrostructures/19-map-diagram.md +21 -0
- package/skills/hallmark/references/macrostructures/20-ecosystem-index.md +19 -0
- package/skills/hallmark/references/macrostructures/21-component-playground.md +21 -0
- package/skills/hallmark/references/macrostructures.md +119 -0
- package/skills/hallmark/references/microinteractions.md +80 -0
- package/skills/hallmark/references/patterns.md +202 -0
- package/skills/hallmark/references/redesign.md +88 -0
- package/skills/hallmark/references/responsive.md +46 -0
- package/skills/hallmark/references/review-finish.md +19 -0
- package/skills/hallmark/references/review-hero.md +20 -0
- package/skills/hallmark/references/scroll-choreography.md +110 -0
- package/skills/hallmark/references/texture.md +90 -0
- package/skills/hallmark/references/themes/README.md +58 -0
- package/skills/hallmark/references/themes/almanac.jpg +0 -0
- package/skills/hallmark/references/themes/almanac.md +103 -0
- package/skills/hallmark/references/themes/arcade.jpg +0 -0
- package/skills/hallmark/references/themes/arcade.md +102 -0
- package/skills/hallmark/references/themes/atelier.jpg +0 -0
- package/skills/hallmark/references/themes/atelier.md +98 -0
- package/skills/hallmark/references/themes/bloom.jpg +0 -0
- package/skills/hallmark/references/themes/bloom.md +102 -0
- package/skills/hallmark/references/themes/blueprint.jpg +0 -0
- package/skills/hallmark/references/themes/blueprint.md +103 -0
- package/skills/hallmark/references/themes/broadside.jpg +0 -0
- package/skills/hallmark/references/themes/broadside.md +108 -0
- package/skills/hallmark/references/themes/brutal.jpg +0 -0
- package/skills/hallmark/references/themes/brutal.md +95 -0
- package/skills/hallmark/references/themes/carnival.jpg +0 -0
- package/skills/hallmark/references/themes/carnival.md +104 -0
- package/skills/hallmark/references/themes/cobalt.jpg +0 -0
- package/skills/hallmark/references/themes/cobalt.md +101 -0
- package/skills/hallmark/references/themes/console.jpg +0 -0
- package/skills/hallmark/references/themes/console.md +99 -0
- package/skills/hallmark/references/themes/coral.jpg +0 -0
- package/skills/hallmark/references/themes/coral.md +102 -0
- package/skills/hallmark/references/themes/darkroom.jpg +0 -0
- package/skills/hallmark/references/themes/darkroom.md +99 -0
- package/skills/hallmark/references/themes/dose.jpg +0 -0
- package/skills/hallmark/references/themes/dose.md +98 -0
- package/skills/hallmark/references/themes/dusk.jpg +0 -0
- package/skills/hallmark/references/themes/dusk.md +105 -0
- package/skills/hallmark/references/themes/editorial.jpg +0 -0
- package/skills/hallmark/references/themes/editorial.md +97 -0
- package/skills/hallmark/references/themes/formwork.jpg +0 -0
- package/skills/hallmark/references/themes/formwork.md +107 -0
- package/skills/hallmark/references/themes/furrow.jpg +0 -0
- package/skills/hallmark/references/themes/furrow.md +98 -0
- package/skills/hallmark/references/themes/garden.jpg +0 -0
- package/skills/hallmark/references/themes/garden.md +97 -0
- package/skills/hallmark/references/themes/grid.jpg +0 -0
- package/skills/hallmark/references/themes/grid.md +101 -0
- package/skills/hallmark/references/themes/halftone.jpg +0 -0
- package/skills/hallmark/references/themes/halftone.md +106 -0
- package/skills/hallmark/references/themes/hedgerow.jpg +0 -0
- package/skills/hallmark/references/themes/hedgerow.md +104 -0
- package/skills/hallmark/references/themes/hum.jpg +0 -0
- package/skills/hallmark/references/themes/hum.md +99 -0
- package/skills/hallmark/references/themes/index.json +2191 -0
- package/skills/hallmark/references/themes/ink.jpg +0 -0
- package/skills/hallmark/references/themes/ink.md +106 -0
- package/skills/hallmark/references/themes/kiln.jpg +0 -0
- package/skills/hallmark/references/themes/kiln.md +108 -0
- package/skills/hallmark/references/themes/loom.jpg +0 -0
- package/skills/hallmark/references/themes/loom.md +106 -0
- package/skills/hallmark/references/themes/lumen.jpg +0 -0
- package/skills/hallmark/references/themes/lumen.md +103 -0
- package/skills/hallmark/references/themes/manifesto.jpg +0 -0
- package/skills/hallmark/references/themes/manifesto.md +101 -0
- package/skills/hallmark/references/themes/midnight.jpg +0 -0
- package/skills/hallmark/references/themes/midnight.md +97 -0
- package/skills/hallmark/references/themes/newsprint.jpg +0 -0
- package/skills/hallmark/references/themes/newsprint.md +102 -0
- package/skills/hallmark/references/themes/overprint.jpg +0 -0
- package/skills/hallmark/references/themes/overprint.md +101 -0
- package/skills/hallmark/references/themes/pasteup.jpg +0 -0
- package/skills/hallmark/references/themes/pasteup.md +100 -0
- package/skills/hallmark/references/themes/piste.jpg +0 -0
- package/skills/hallmark/references/themes/piste.md +99 -0
- package/skills/hallmark/references/themes/ribbon.jpg +0 -0
- package/skills/hallmark/references/themes/ribbon.md +106 -0
- package/skills/hallmark/references/themes/rim.jpg +0 -0
- package/skills/hallmark/references/themes/rim.md +96 -0
- package/skills/hallmark/references/themes/riso.jpg +0 -0
- package/skills/hallmark/references/themes/riso.md +98 -0
- package/skills/hallmark/references/themes/solstice.jpg +0 -0
- package/skills/hallmark/references/themes/solstice.md +104 -0
- package/skills/hallmark/references/themes/specimen.jpg +0 -0
- package/skills/hallmark/references/themes/specimen.md +100 -0
- package/skills/hallmark/references/themes/spore.jpg +0 -0
- package/skills/hallmark/references/themes/spore.md +104 -0
- package/skills/hallmark/references/themes/sport.jpg +0 -0
- package/skills/hallmark/references/themes/sport.md +101 -0
- package/skills/hallmark/references/themes/squeeze.jpg +0 -0
- package/skills/hallmark/references/themes/squeeze.md +99 -0
- package/skills/hallmark/references/themes/sticker.jpg +0 -0
- package/skills/hallmark/references/themes/sticker.md +106 -0
- package/skills/hallmark/references/themes/studio.jpg +0 -0
- package/skills/hallmark/references/themes/studio.md +99 -0
- package/skills/hallmark/references/themes/terminal.jpg +0 -0
- package/skills/hallmark/references/themes/terminal.md +96 -0
- package/skills/hallmark/references/themes/terrazzo.jpg +0 -0
- package/skills/hallmark/references/themes/terrazzo.md +106 -0
- package/skills/hallmark/references/themes/ultraviolet.jpg +0 -0
- package/skills/hallmark/references/themes/ultraviolet.md +106 -0
- package/skills/hallmark/references/themes/vellum.jpg +0 -0
- package/skills/hallmark/references/themes/vellum.md +105 -0
- package/skills/hallmark/references/themes/wayfind.jpg +0 -0
- package/skills/hallmark/references/themes/wayfind.md +105 -0
- package/skills/hallmark/references/themes/werkstatt.jpg +0 -0
- package/skills/hallmark/references/themes/werkstatt.md +105 -0
- package/skills/hallmark/scripts/capture.mjs +125 -0
- package/skills/hallmark/scripts/fixtures/exemplars/atmospheric.html +324 -0
- package/skills/hallmark/scripts/fixtures/exemplars/editorial.html +363 -0
- package/skills/hallmark/scripts/fixtures/exemplars/modern-minimal.html +527 -0
- package/skills/hallmark/scripts/fixtures/exemplars/playful.html +353 -0
- package/skills/hallmark/scripts/fixtures/eyebrow-fail/index.html +118 -0
- package/skills/hallmark/scripts/fixtures/eyebrow-pass/index.html +137 -0
- package/skills/hallmark/scripts/fixtures/kept/after.html +27 -0
- package/skills/hallmark/scripts/fixtures/kept/before.html +26 -0
- package/skills/hallmark/scripts/fixtures/slopped.html +145 -0
- package/skills/hallmark/scripts/fixtures/tailwind-fail/Feature.vue +14 -0
- package/skills/hallmark/scripts/fixtures/tailwind-fail/Hero.tsx +33 -0
- package/skills/hallmark/scripts/fixtures/tailwind-fail/index.html +74 -0
- package/skills/hallmark/scripts/fixtures/tailwind-fail/style.css +6 -0
- package/skills/hallmark/scripts/fixtures/tailwind-pass/Hero.tsx +33 -0
- package/skills/hallmark/scripts/fixtures/tailwind-pass/index.html +57 -0
- package/skills/hallmark/scripts/fixtures/tailwind-pass/style.css +15 -0
- package/skills/hallmark/scripts/fixtures/waiver/index.html +54 -0
- package/skills/hallmark/scripts/imagegen.mjs +85 -0
- package/skills/hallmark/scripts/install-hook.mjs +70 -0
- package/skills/hallmark/scripts/install.mjs +141 -0
- package/skills/hallmark/scripts/lint-hook.mjs +49 -0
- package/skills/hallmark/scripts/photos.json +1 -0
- package/skills/hallmark/scripts/picture.mjs +71 -0
- package/skills/hallmark/scripts/refcheck.mjs +352 -0
- package/skills/hallmark/scripts/sloplint-render.mjs +1252 -0
- package/skills/hallmark/scripts/sloplint.mjs +4422 -0
- package/skills/hallmark/scripts/theme.mjs +650 -0
- package/skills/harness/SKILL.md +17 -8
- package/skills/i-have-adhd/SKILL.md +32 -12
- package/skills/no-ai-slop/SKILL.md +15 -1
- package/skills/plan-add/SKILL.md +38 -27
- package/skills/plan-status/SKILL.md +13 -7
- package/skills/plan-sync/SKILL.md +18 -12
- package/skills/pm-frameworks/SKILL.md +19 -10
- package/skills/pm-frameworks/SOURCE +7 -5
- package/skills/ponytail/SKILL.md +19 -14
- package/skills/product-analysis/SKILL.md +22 -18
- package/skills/product-flow/SKILL.md +14 -9
- package/skills/research/SKILL.md +97 -48
- package/skills/rl-env/SKILL.md +25 -13
- package/skills/rl-env/SOURCE +8 -6
- package/skills/tezgah-contract/SKILL.md +65 -47
- package/statusline.py +20 -9
- package/workflows/graph-review.js +14 -2
- package/bin/tezgah-skill.py +0 -59
- /package/skills/ai-research/0-autoresearch-skill/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/01-model-architecture/litgpt/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/01-model-architecture/mamba/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/01-model-architecture/nanogpt/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/01-model-architecture/rwkv/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/01-model-architecture/torchtitan/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/02-tokenization/huggingface-tokenizers/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/02-tokenization/sentencepiece/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/03-fine-tuning/axolotl/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/03-fine-tuning/llama-factory/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/03-fine-tuning/peft/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/03-fine-tuning/unsloth/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/04-mechanistic-interpretability/nnsight/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/04-mechanistic-interpretability/pyvene/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/04-mechanistic-interpretability/saelens/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/04-mechanistic-interpretability/transformer-lens/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/05-data-processing/nemo-curator/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/05-data-processing/ray-data/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/06-post-training/grpo-rl-training/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/06-post-training/miles/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/06-post-training/openrlhf/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/06-post-training/simpo/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/06-post-training/slime/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/06-post-training/torchforge/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/06-post-training/trl-fine-tuning/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/06-post-training/verl/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/07-safety-alignment/constitutional-ai/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/07-safety-alignment/llamaguard/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/07-safety-alignment/nemo-guardrails/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/07-safety-alignment/prompt-guard/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/08-distributed-training/accelerate/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/08-distributed-training/deepspeed/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/08-distributed-training/megatron-core/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/08-distributed-training/pytorch-fsdp2/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/08-distributed-training/pytorch-lightning/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/08-distributed-training/ray-train/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/09-infrastructure/lambda-labs/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/09-infrastructure/modal/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/09-infrastructure/skypilot/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/10-optimization/awq/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/10-optimization/bitsandbytes/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/10-optimization/flash-attention/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/10-optimization/gguf/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/10-optimization/gptq/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/10-optimization/hqq/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/10-optimization/ml-training-recipes/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/11-evaluation/bigcode-evaluation-harness/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/11-evaluation/lm-evaluation-harness/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/11-evaluation/nemo-evaluator/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/12-inference-serving/llama-cpp/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/12-inference-serving/sglang/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/12-inference-serving/tensorrt-llm/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/12-inference-serving/vllm/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/13-mlops/mlflow/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/13-mlops/swanlab/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/13-mlops/tensorboard/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/13-mlops/weights-and-biases/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/14-agents/a-evolve/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/14-agents/autogpt/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/14-agents/crewai/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/14-agents/langchain/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/14-agents/llamaindex/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/15-rag/chroma/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/15-rag/faiss/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/15-rag/pinecone/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/15-rag/qdrant/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/15-rag/sentence-transformers/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/16-prompt-engineering/dspy/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/16-prompt-engineering/guidance/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/16-prompt-engineering/instructor/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/16-prompt-engineering/outlines/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/17-observability/langsmith/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/17-observability/phoenix/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/18-multimodal/audiocraft/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/18-multimodal/blip-2/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/18-multimodal/clip/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/18-multimodal/cosmos-policy/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/18-multimodal/llava/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/18-multimodal/openpi/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/18-multimodal/openvla-oft/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/18-multimodal/segment-anything/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/18-multimodal/stable-diffusion/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/18-multimodal/whisper/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/19-emerging-techniques/knowledge-distillation/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/19-emerging-techniques/long-context/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/19-emerging-techniques/model-merging/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/19-emerging-techniques/model-pruning/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/19-emerging-techniques/moe-training/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/19-emerging-techniques/speculative-decoding/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/20-ml-paper-writing/academic-plotting/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/20-ml-paper-writing/ml-paper-writing/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/20-ml-paper-writing/presenting-conference-talks/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/20-ml-paper-writing/systems-paper-writing/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/21-research-ideation/brainstorming-research-ideas/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/21-research-ideation/creative-thinking-for-research/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/22-agent-native-research-artifact/compiler/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/22-agent-native-research-artifact/research-manager/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/ai-research/22-agent-native-research-artifact/rigor-reviewer/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/adaptive-interfaces/skills/colour-independence/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/adaptive-interfaces/skills/flexible-typography/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/adaptive-interfaces/skills/information-density/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/adaptive-interfaces/skills/preference-audit/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/adaptive-interfaces/skills/responsive-accessibility/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/adaptive-interfaces/skills/responsive-review/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/adaptive-interfaces/skills/simplified-views/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/adaptive-interfaces/skills/specify/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/adaptive-interfaces/skills/user-preference-respect/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/cognitive-accessibility/skills/adaptive-personalisation/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/cognitive-accessibility/skills/assess-load/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/cognitive-accessibility/skills/cognitive-load-assessment/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/cognitive-accessibility/skills/contextual-help-design/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/cognitive-accessibility/skills/error-prevention-recovery/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/cognitive-accessibility/skills/focus-attention-design/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/cognitive-accessibility/skills/memory-load-reduction/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/cognitive-accessibility/skills/plain-language-design/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/cognitive-accessibility/skills/review/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/cognitive-accessibility/skills/simplify/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/cognitive-accessibility/skills/wayfinding-navigation/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/design-research/skills/behavioural-analytics/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/design-research/skills/qual-quant-triangulation/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/inclusive-interaction/skills/audit/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/inclusive-interaction/skills/design-flow/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/inclusive-interaction/skills/feedback-and-status/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/inclusive-interaction/skills/gesture-alternatives/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/inclusive-interaction/skills/keyboard-navigation/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/inclusive-interaction/skills/keyboard-review/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/inclusive-interaction/skills/motion-sensitivity/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/inclusive-interaction/skills/multi-modal-input/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/inclusive-interaction/skills/touch-target-design/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/inclusive-interaction/skills/voice-interaction/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/visual-critique/skills/critique-affordance/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/visual-critique/skills/critique-brand-consistency/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/visual-critique/skills/critique-color/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/visual-critique/skills/critique-composition/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/visual-critique/skills/critique-information-density/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/visual-critique/skills/critique-typography/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/design-library/visual-critique/skills/critique-visual-hierarchy/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/pm-frameworks/intended-vs-implemented/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/pm-frameworks/opportunity-solution-tree/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/rl-env/generate-nemo-gym-env/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/rl-env/generate-openenv-env/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/rl-env/generate-ors-env/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/rl-env/generate-verifiers-env/{SKILL.md → ENTRY.md} +0 -0
- /package/skills/rl-env/rl-env-from-description/{SKILL.md → ENTRY.md} +0 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""tezgah-ocr-review - open-code-review's own review loop on omp's model.
|
|
3
|
+
|
|
4
|
+
tezgah-ocr-review [--repo DIR] [--from REF --to REF | --commit SHA]
|
|
5
|
+
[--model SELECTOR] [--output FILE] [--allow-secrets]
|
|
6
|
+
|
|
7
|
+
Runs `ocr review --format json` against a loopback HTTP shim that forwards
|
|
8
|
+
POST /v1/chat/completions and GET /v1/models to one `omp auth-gateway stdio`
|
|
9
|
+
child, so OCR reviews on omp's model and no OCR provider config is written
|
|
10
|
+
anywhere. The shim answers only a request carrying the run's random bearer
|
|
11
|
+
token (handed to OCR as OCR_LLM_TOKEN). Prints OCR's JSON (or writes --output).
|
|
12
|
+
No mode flag reviews the workspace.
|
|
13
|
+
|
|
14
|
+
Only the OCR process gets a scrubbed env: no OCR_*/ANTHROPIC_*/OPENAI_* and a
|
|
15
|
+
private empty HOME (removed afterwards), because OCR reads
|
|
16
|
+
~/.opencodereview/config.json and shell rc files before OCR_LLM_*. Git under
|
|
17
|
+
OCR still sees the user's own config and global excludes: GIT_CONFIG_GLOBAL
|
|
18
|
+
points at ~/.gitconfig, XDG_CONFIG_HOME at the user's config dir, and a
|
|
19
|
+
core.excludesFile resolved with the user's HOME is passed in absolute. The omp
|
|
20
|
+
child keeps the user's env - it needs its own credentials.
|
|
21
|
+
|
|
22
|
+
Exit 0 ok; 2 when `ocr` or `omp` is missing; 3 when a path OCR could read looks
|
|
23
|
+
like a secret (its file_read could send it to the model; --allow-secrets skips
|
|
24
|
+
the check) - the working tree with untracked and ignored files, or the tree of
|
|
25
|
+
--to / --commit; 4 when the runner's own setup fails (not a git repository, git
|
|
26
|
+
missing, omp cannot be spawned or never reports ready), one stderr line; any
|
|
27
|
+
other non-zero is OCR's own, its stderr passed through.
|
|
28
|
+
"""
|
|
29
|
+
import argparse
|
|
30
|
+
import hmac
|
|
31
|
+
import itertools
|
|
32
|
+
import json
|
|
33
|
+
import os
|
|
34
|
+
import secrets
|
|
35
|
+
import shutil
|
|
36
|
+
import subprocess
|
|
37
|
+
import sys
|
|
38
|
+
import tempfile
|
|
39
|
+
import threading
|
|
40
|
+
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
41
|
+
|
|
42
|
+
HERE = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
|
43
|
+
sys.path.insert(0, os.path.join(HERE, "hooks"))
|
|
44
|
+
import tezgah_paths as tp # noqa: E402
|
|
45
|
+
|
|
46
|
+
# alibaba/open-code-review 375f64c internal/config/allowlist/default_secret_patterns.json
|
|
47
|
+
SECRET_PATTERNS = ["**/.ssh/**", "**/id_rsa", "**/id_dsa", "**/id_ecdsa", "**/id_ed25519",
|
|
48
|
+
"**/.netrc", "**/_netrc", "**/.npmrc", "**/.pypirc", "**/.dockercfg"]
|
|
49
|
+
# ... and secret_path.go there: `.env` / `.env.*` is a secret except these templates
|
|
50
|
+
ENV_TEMPLATES = {".env.example", ".env.sample", ".env.template"}
|
|
51
|
+
ROUTES = {("POST", "/v1/chat/completions"), ("GET", "/v1/models")}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def is_secret(path):
|
|
55
|
+
"""OCR's IsSecretPath for the two pattern shapes its list uses."""
|
|
56
|
+
parts = path.lower().split("/")
|
|
57
|
+
base = parts[-1]
|
|
58
|
+
if base not in ENV_TEMPLATES and (base == ".env" or base.startswith(".env.")):
|
|
59
|
+
return True
|
|
60
|
+
for pattern in SECRET_PATTERNS:
|
|
61
|
+
name = pattern[len("**/"):]
|
|
62
|
+
if name.endswith("/**"):
|
|
63
|
+
if name[:-3] in parts:
|
|
64
|
+
return True
|
|
65
|
+
elif base == name:
|
|
66
|
+
return True
|
|
67
|
+
return False
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
assert is_secret("a/.ssh/config") and is_secret("id_rsa") and is_secret("x/.env.local")
|
|
71
|
+
assert not is_secret(".env.example") and not is_secret("src/id_rsa.pub")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class SetupError(Exception):
|
|
75
|
+
"""The runner's own failure: exit 4 with one stderr line."""
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def git(repo, *args):
|
|
79
|
+
try:
|
|
80
|
+
r = subprocess.run(["git", "-C", repo, *args], capture_output=True)
|
|
81
|
+
except OSError as e:
|
|
82
|
+
raise SetupError("git cannot run: %s" % e)
|
|
83
|
+
if r.returncode:
|
|
84
|
+
err = r.stderr.decode("utf-8", "replace").strip().splitlines()
|
|
85
|
+
raise SetupError("git %s failed in %s: %s"
|
|
86
|
+
% (args[0], repo, err[-1] if err else "exit %d" % r.returncode))
|
|
87
|
+
return r.stdout.decode("utf-8", "surrogateescape")
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def first_secret(root, ref):
|
|
91
|
+
"""The first secret-looking path OCR could read: the tree of `ref`, or with
|
|
92
|
+
no ref the working tree, tracked, untracked and ignored alike."""
|
|
93
|
+
if ref:
|
|
94
|
+
out = git(root, "ls-tree", "-r", "-z", "--name-only", ref)
|
|
95
|
+
else:
|
|
96
|
+
out = git(root, "ls-files", "-z", "--cached", "--others")
|
|
97
|
+
return next((p for p in out.split("\0") if p and is_secret(p)), None)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class Gateway:
|
|
101
|
+
"""One `omp auth-gateway stdio` child; call() is one JSON-lines round trip."""
|
|
102
|
+
|
|
103
|
+
def __init__(self, omp, timeout):
|
|
104
|
+
try:
|
|
105
|
+
self.child = subprocess.Popen([omp, "auth-gateway", "stdio"], stdin=subprocess.PIPE,
|
|
106
|
+
stdout=subprocess.PIPE, text=True, bufsize=1)
|
|
107
|
+
except OSError as e:
|
|
108
|
+
raise SetupError("cannot spawn omp: %s" % e)
|
|
109
|
+
self.waiting, self.lock, self.ids = {}, threading.Lock(), itertools.count(1)
|
|
110
|
+
ready = threading.Event()
|
|
111
|
+
threading.Thread(target=self._read, args=(ready,), daemon=True).start()
|
|
112
|
+
if not ready.wait(timeout):
|
|
113
|
+
self.close()
|
|
114
|
+
raise SetupError("omp auth-gateway stdio did not report ready within %gs"
|
|
115
|
+
% timeout)
|
|
116
|
+
|
|
117
|
+
def _read(self, ready):
|
|
118
|
+
for line in self.child.stdout:
|
|
119
|
+
try:
|
|
120
|
+
msg = json.loads(line)
|
|
121
|
+
except ValueError:
|
|
122
|
+
continue
|
|
123
|
+
if not ready.is_set():
|
|
124
|
+
if msg.get("ready"):
|
|
125
|
+
ready.set()
|
|
126
|
+
continue
|
|
127
|
+
slot = self.waiting.pop(msg.get("id"), None)
|
|
128
|
+
if slot:
|
|
129
|
+
slot[1] = msg
|
|
130
|
+
slot[0].set()
|
|
131
|
+
for slot in list(self.waiting.values()): # child gone: fail the open requests
|
|
132
|
+
slot[0].set()
|
|
133
|
+
|
|
134
|
+
def call(self, req):
|
|
135
|
+
req["id"] = next(self.ids)
|
|
136
|
+
slot = [threading.Event(), None]
|
|
137
|
+
self.waiting[req["id"]] = slot
|
|
138
|
+
try:
|
|
139
|
+
with self.lock:
|
|
140
|
+
self.child.stdin.write(json.dumps(req) + "\n")
|
|
141
|
+
self.child.stdin.flush()
|
|
142
|
+
except (BrokenPipeError, OSError, ValueError):
|
|
143
|
+
self.waiting.pop(req["id"], None)
|
|
144
|
+
return None
|
|
145
|
+
slot[0].wait()
|
|
146
|
+
return slot[1]
|
|
147
|
+
|
|
148
|
+
def close(self):
|
|
149
|
+
try:
|
|
150
|
+
self.child.stdin.close()
|
|
151
|
+
except OSError:
|
|
152
|
+
pass
|
|
153
|
+
try:
|
|
154
|
+
self.child.wait(5)
|
|
155
|
+
except subprocess.TimeoutExpired:
|
|
156
|
+
self.child.kill()
|
|
157
|
+
self.child.wait()
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def handler(gateway, token):
|
|
161
|
+
bearer = ("Bearer " + token).encode()
|
|
162
|
+
|
|
163
|
+
class Handler(BaseHTTPRequestHandler):
|
|
164
|
+
def _call(self, method):
|
|
165
|
+
auth = self.headers.get("Authorization", "").encode("utf-8", "surrogateescape")
|
|
166
|
+
if not hmac.compare_digest(auth, bearer):
|
|
167
|
+
return self._send(401, {"error": "missing or wrong bearer token"})
|
|
168
|
+
if (method, self.path.split("?", 1)[0]) not in ROUTES:
|
|
169
|
+
return self._send(404, {"error": "not found"})
|
|
170
|
+
n = int(self.headers.get("Content-Length") or 0)
|
|
171
|
+
req = {"method": method, "path": self.path}
|
|
172
|
+
if n:
|
|
173
|
+
try:
|
|
174
|
+
req["body"] = json.loads(self.rfile.read(n))
|
|
175
|
+
except ValueError:
|
|
176
|
+
return self._send(400, {"error": "request body is not JSON"})
|
|
177
|
+
msg = gateway.call(req) or {"status": 502, "body": {"error": "omp gateway gone"}}
|
|
178
|
+
self._send(msg.get("status", 502), msg.get("body"))
|
|
179
|
+
|
|
180
|
+
def _send(self, status, body):
|
|
181
|
+
sse = isinstance(body, str)
|
|
182
|
+
data = (body if sse else json.dumps(body)).encode()
|
|
183
|
+
self.send_response(status)
|
|
184
|
+
self.send_header("Content-Type", "text/event-stream" if sse else "application/json")
|
|
185
|
+
self.send_header("Content-Length", str(len(data)))
|
|
186
|
+
self.end_headers()
|
|
187
|
+
self.wfile.write(data)
|
|
188
|
+
|
|
189
|
+
def do_POST(self):
|
|
190
|
+
self._call("POST")
|
|
191
|
+
|
|
192
|
+
def do_GET(self):
|
|
193
|
+
self._call("GET")
|
|
194
|
+
|
|
195
|
+
def log_message(self, *args):
|
|
196
|
+
pass
|
|
197
|
+
|
|
198
|
+
return Handler
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def main(argv=None):
|
|
202
|
+
ap = argparse.ArgumentParser(prog="tezgah-ocr-review")
|
|
203
|
+
ap.add_argument("--repo", default=".")
|
|
204
|
+
ap.add_argument("--from", dest="base")
|
|
205
|
+
ap.add_argument("--to", dest="head")
|
|
206
|
+
ap.add_argument("--commit")
|
|
207
|
+
ap.add_argument("--model", default="@default")
|
|
208
|
+
ap.add_argument("--output")
|
|
209
|
+
ap.add_argument("--allow-secrets", action="store_true")
|
|
210
|
+
args = ap.parse_args(argv)
|
|
211
|
+
if args.commit and (args.base or args.head):
|
|
212
|
+
ap.error("--commit and --from/--to are exclusive")
|
|
213
|
+
repo = os.path.abspath(args.repo)
|
|
214
|
+
|
|
215
|
+
ocr, omp = tp.ocr_bin(), tp.omp_bin()
|
|
216
|
+
if not ocr or not omp:
|
|
217
|
+
print("tezgah-ocr-review: `%s` not found" % ("ocr" if not ocr else "omp"),
|
|
218
|
+
file=sys.stderr)
|
|
219
|
+
return 2
|
|
220
|
+
try:
|
|
221
|
+
return run(args, repo, ocr, omp)
|
|
222
|
+
except SetupError as e:
|
|
223
|
+
print("tezgah-ocr-review: %s" % e, file=sys.stderr)
|
|
224
|
+
return 4
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def run(args, repo, ocr, omp):
|
|
228
|
+
root = git(repo, "rev-parse", "--show-toplevel").strip()
|
|
229
|
+
if not args.allow_secrets:
|
|
230
|
+
secret = first_secret(root, args.commit or args.head)
|
|
231
|
+
if secret:
|
|
232
|
+
print("tezgah-ocr-review: secret-looking path %s - OCR could send it to"
|
|
233
|
+
" the model; pass --allow-secrets to review anyway" % secret, file=sys.stderr)
|
|
234
|
+
return 3
|
|
235
|
+
|
|
236
|
+
cmd = [ocr, "review", "--format", "json", "--color", "never"]
|
|
237
|
+
for flag, value in (("--from", args.base), ("--to", args.head), ("--commit", args.commit)):
|
|
238
|
+
if value:
|
|
239
|
+
cmd += [flag, value]
|
|
240
|
+
env = {k: v for k, v in os.environ.items()
|
|
241
|
+
if not k.startswith(("OCR_", "ANTHROPIC_", "OPENAI_"))}
|
|
242
|
+
# OCR's HOME is private (below); git resolves its config and its default
|
|
243
|
+
# excludes ($XDG_CONFIG_HOME|$HOME/.config/git/ignore) through HOME, so
|
|
244
|
+
# both are pinned to the user's own here
|
|
245
|
+
env.setdefault("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
|
|
246
|
+
gitconfig = os.path.expanduser("~/.gitconfig")
|
|
247
|
+
if os.path.isfile(gitconfig): # an explicit GIT_CONFIG_GLOBAL still wins
|
|
248
|
+
env.setdefault("GIT_CONFIG_GLOBAL", gitconfig)
|
|
249
|
+
excludes = subprocess.run(["git", "-C", root, "config", "--path", "--get",
|
|
250
|
+
"core.excludesFile"], capture_output=True, text=True)
|
|
251
|
+
if excludes.returncode == 0 and excludes.stdout.strip():
|
|
252
|
+
n = int(env.get("GIT_CONFIG_COUNT") or 0)
|
|
253
|
+
env.update({"GIT_CONFIG_COUNT": str(n + 1),
|
|
254
|
+
"GIT_CONFIG_KEY_%d" % n: "core.excludesFile",
|
|
255
|
+
"GIT_CONFIG_VALUE_%d" % n: excludes.stdout.strip()})
|
|
256
|
+
token = secrets.token_urlsafe(32)
|
|
257
|
+
try:
|
|
258
|
+
timeout = float(os.environ.get("TEZGAH_OCR_REVIEW_READY_TIMEOUT") or 30)
|
|
259
|
+
except ValueError:
|
|
260
|
+
raise SetupError("TEZGAH_OCR_REVIEW_READY_TIMEOUT is not a number")
|
|
261
|
+
|
|
262
|
+
gateway = server = proc = out = home = None
|
|
263
|
+
try:
|
|
264
|
+
gateway = Gateway(omp, timeout)
|
|
265
|
+
server = ThreadingHTTPServer(("127.0.0.1", 0), handler(gateway, token))
|
|
266
|
+
threading.Thread(target=server.serve_forever, daemon=True).start()
|
|
267
|
+
home = tempfile.mkdtemp(prefix="tezgah-ocr-home-")
|
|
268
|
+
env.update(HOME=home, OCR_LLM_URL="http://127.0.0.1:%d/v1" % server.server_address[1],
|
|
269
|
+
OCR_LLM_MODEL=args.model, OCR_LLM_PROTOCOL="openai",
|
|
270
|
+
OCR_LLM_TOKEN=token, OCR_NO_UPDATE="1")
|
|
271
|
+
try:
|
|
272
|
+
out = open(args.output, "w", encoding="utf-8") if args.output else None
|
|
273
|
+
proc = subprocess.Popen(cmd, cwd=repo, env=env, stdout=out)
|
|
274
|
+
except OSError as e:
|
|
275
|
+
raise SetupError("cannot start ocr or write --output: %s" % e)
|
|
276
|
+
return proc.wait()
|
|
277
|
+
finally:
|
|
278
|
+
if proc and proc.poll() is None:
|
|
279
|
+
proc.terminate()
|
|
280
|
+
proc.wait()
|
|
281
|
+
if out:
|
|
282
|
+
out.close()
|
|
283
|
+
if server:
|
|
284
|
+
server.shutdown()
|
|
285
|
+
server.server_close()
|
|
286
|
+
if gateway:
|
|
287
|
+
gateway.close()
|
|
288
|
+
if home:
|
|
289
|
+
shutil.rmtree(home, ignore_errors=True)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
if __name__ == "__main__":
|
|
293
|
+
try:
|
|
294
|
+
sys.exit(main())
|
|
295
|
+
except KeyboardInterrupt:
|
|
296
|
+
sys.exit(130)
|