mednotes-opencode 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/.opencode/agents/med-chat-triager.md +204 -0
- package/.opencode/agents/med-flashcard-maker.md +63 -0
- package/.opencode/agents/med-knowledge-architect.md +230 -0
- package/.opencode/agents/med-link-graph-curator.md +177 -0
- package/.opencode/agents/med-publish-guard.md +62 -0
- package/.opencode/commands/flashcards.md +25 -0
- package/.opencode/commands/mednotes/create.md +25 -0
- package/.opencode/commands/mednotes/enrich.md +27 -0
- package/.opencode/commands/mednotes/fix-wiki.md +27 -0
- package/.opencode/commands/mednotes/history.md +22 -0
- package/.opencode/commands/mednotes/link-body.md +25 -0
- package/.opencode/commands/mednotes/link-related.md +27 -0
- package/.opencode/commands/mednotes/link.md +27 -0
- package/.opencode/commands/mednotes/pdf-library.md +27 -0
- package/.opencode/commands/mednotes/process-chats.md +23 -0
- package/.opencode/commands/mednotes/setup.md +21 -0
- package/.opencode/commands/mednotes/status.md +27 -0
- package/.opencode/commands/mednotes/telemetry.md +27 -0
- package/.opencode/commands/report.md +26 -0
- package/.opencode/mednotes/AGENTS.md +57 -0
- package/.opencode/mednotes/agents/med-chat-triager.md +197 -0
- package/.opencode/mednotes/agents/med-flashcard-maker.md +56 -0
- package/.opencode/mednotes/agents/med-knowledge-architect.md +224 -0
- package/.opencode/mednotes/agents/med-link-graph-curator.md +171 -0
- package/.opencode/mednotes/agents/med-publish-guard.md +55 -0
- package/.opencode/mednotes/contracts/.gitkeep +1 -0
- package/.opencode/mednotes/contracts/agents.json +116 -0
- package/.opencode/mednotes/contracts/opencode-plugin.json +70 -0
- package/.opencode/mednotes/docs/agent-prompt-hardening.md +567 -0
- package/.opencode/mednotes/docs/agent-role-contracts.md +94 -0
- package/.opencode/mednotes/docs/anki-mcp-twenty-rules.md +214 -0
- package/.opencode/mednotes/docs/anki-templates/README.md +39 -0
- package/.opencode/mednotes/docs/anki-templates/cloze.back.html +23 -0
- package/.opencode/mednotes/docs/anki-templates/cloze.front.html +14 -0
- package/.opencode/mednotes/docs/anki-templates/qa.back.html +24 -0
- package/.opencode/mednotes/docs/anki-templates/qa.front.html +14 -0
- package/.opencode/mednotes/docs/anki-templates/style.css +182 -0
- package/.opencode/mednotes/docs/atomicity-splitting-policy.md +113 -0
- package/.opencode/mednotes/docs/extension-docs.md +40 -0
- package/.opencode/mednotes/docs/flashcard-ingestion.md +278 -0
- package/.opencode/mednotes/docs/knowledge-architect.md +208 -0
- package/.opencode/mednotes/docs/merge-policy.md +110 -0
- package/.opencode/mednotes/docs/public-vocabulary.md +104 -0
- package/.opencode/mednotes/docs/semantic-linker.md +141 -0
- package/.opencode/mednotes/docs/taxonomy-policy.md +90 -0
- package/.opencode/mednotes/docs/triage-policy.md +187 -0
- package/.opencode/mednotes/docs/vault-version-control.md +758 -0
- package/.opencode/mednotes/docs/vocabulary-db-recovery.md +58 -0
- package/.opencode/mednotes/docs/workflow-output-contract.md +779 -0
- package/.opencode/mednotes/hooks/hooks.json +79 -0
- package/.opencode/mednotes/package-lock.json +6361 -0
- package/.opencode/mednotes/package.json +15 -0
- package/.opencode/mednotes/pyproject.toml +48 -0
- package/.opencode/mednotes/scripts/bootstrap_windows_python_uv.cmd +13 -0
- package/.opencode/mednotes/scripts/bootstrap_windows_python_uv.ps1 +172 -0
- package/.opencode/mednotes/scripts/enrich_notes.py +23 -0
- package/.opencode/mednotes/scripts/full_reset_windows_python_uv.cmd +13 -0
- package/.opencode/mednotes/scripts/hooks/antigravity_hook_status.mjs +212 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/adapters/antigravity.mjs +169 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/adapters/harness_payload.mjs +103 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/adapters/opencode_plugin.mjs +341 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/adapters/opencode_user_config_sync.mjs +177 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/anki_preflight.mjs +214 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/cli.mjs +143 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/diagnostics.mjs +11 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/domain/agent_directive_core.mjs +160 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/fsm_directive.mjs +1470 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/hook_errors.mjs +120 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/retention.mjs +114 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/runtime.mjs +174 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/telemetry_capture.mjs +511 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook/vault_guard.mjs +624 -0
- package/.opencode/mednotes/scripts/hooks/mednotes_hook.mjs +5 -0
- package/.opencode/mednotes/scripts/mednotes/_runtime_paths.py +24 -0
- package/.opencode/mednotes/scripts/mednotes/anki_model_validator.py +18 -0
- package/.opencode/mednotes/scripts/mednotes/capture_extension_diff.py +1562 -0
- package/.opencode/mednotes/scripts/mednotes/feedback_report.py +16 -0
- package/.opencode/mednotes/scripts/mednotes/flashcard_index.py +18 -0
- package/.opencode/mednotes/scripts/mednotes/flashcard_pipeline.py +18 -0
- package/.opencode/mednotes/scripts/mednotes/flashcard_report.py +18 -0
- package/.opencode/mednotes/scripts/mednotes/flashcard_sources.py +18 -0
- package/.opencode/mednotes/scripts/mednotes/obsidian/README.md +6 -0
- package/.opencode/mednotes/scripts/mednotes/obsidian_note_utils.py +20 -0
- package/.opencode/mednotes/scripts/mednotes/pdf_library/cli.py +16 -0
- package/.opencode/mednotes/scripts/mednotes/project_fsm.py +229 -0
- package/.opencode/mednotes/scripts/mednotes/setup_telemetry_email.py +404 -0
- package/.opencode/mednotes/scripts/mednotes/sync_anki_twenty_rules.py +18 -0
- package/.opencode/mednotes/scripts/mednotes/sync_opencode_user_config.py +36 -0
- package/.opencode/mednotes/scripts/mednotes/wiki/cli.py +20 -0
- package/.opencode/mednotes/scripts/mednotes/wiki_graph.py +18 -0
- package/.opencode/mednotes/scripts/mednotes/wiki_tree.py +134 -0
- package/.opencode/mednotes/scripts/reset_windows_python_uv.ps1 +625 -0
- package/.opencode/mednotes/scripts/run_python.mjs +109 -0
- package/.opencode/mednotes/scripts/vault/vault_commit.ps1 +19 -0
- package/.opencode/mednotes/scripts/vault/vault_commit.sh +18 -0
- package/.opencode/mednotes/scripts/vault/vault_git.ps1 +19 -0
- package/.opencode/mednotes/scripts/vault/vault_git.py +3107 -0
- package/.opencode/mednotes/scripts/vault/vault_git.sh +18 -0
- package/.opencode/mednotes/scripts/vault/vault_precommit.ps1 +19 -0
- package/.opencode/mednotes/scripts/vault/vault_precommit.sh +18 -0
- package/.opencode/mednotes/skills/THIRD_PARTY_NOTICES.md +45 -0
- package/.opencode/mednotes/skills/create-medical-flashcards/SKILL.md +113 -0
- package/.opencode/mednotes/skills/create-medical-note/SKILL.md +90 -0
- package/.opencode/mednotes/skills/enrich-medical-note/SKILL.md +120 -0
- package/.opencode/mednotes/skills/fix-medical-wiki/SKILL.md +559 -0
- package/.opencode/mednotes/skills/link-medical-wiki/SKILL.md +224 -0
- package/.opencode/mednotes/skills/obsidian-cli/SKILL.md +118 -0
- package/.opencode/mednotes/skills/obsidian-markdown/SKILL.md +207 -0
- package/.opencode/mednotes/skills/obsidian-markdown/references/CALLOUTS.md +58 -0
- package/.opencode/mednotes/skills/obsidian-markdown/references/EMBEDS.md +63 -0
- package/.opencode/mednotes/skills/obsidian-markdown/references/PROPERTIES.md +61 -0
- package/.opencode/mednotes/skills/obsidian-ops/SKILL.md +136 -0
- package/.opencode/mednotes/skills/pdf-library/SKILL.md +45 -0
- package/.opencode/mednotes/skills/process-medical-chats/SKILL.md +246 -0
- package/.opencode/mednotes/skills/workflow-report/SKILL.md +100 -0
- package/.opencode/mednotes/src/mednotes/__init__.py +5 -0
- package/.opencode/mednotes/src/mednotes/domains/__init__.py +5 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/README.md +26 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/__init__.py +2 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/build_demo_apkg.py +177 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/contracts.py +385 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/flashcards_machine.py +522 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/fsm.py +817 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/index.py +630 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/install_models.py +445 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/model.py +359 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/obsidian_links.py +135 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/obsidian_note_utils.py +546 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/pipeline.py +580 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/report.py +510 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/sources.py +682 -0
- package/.opencode/mednotes/src/mednotes/domains/flashcards/sync_rules.py +184 -0
- package/.opencode/mednotes/src/mednotes/domains/history/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/history/history_fsm.py +852 -0
- package/.opencode/mednotes/src/mednotes/domains/history/history_machine.py +453 -0
- package/.opencode/mednotes/src/mednotes/domains/setup/__init__.py +7 -0
- package/.opencode/mednotes/src/mednotes/domains/setup/setup_fsm.py +808 -0
- package/.opencode/mednotes/src/mednotes/domains/setup/setup_machine.py +973 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/README.md +64 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/api.py +668 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/batch_state.py +102 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/atomicity/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/atomicity/atomicity.py +877 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/body_link/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/body_link/body_linker.py +1562 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/effects/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/effects/effect_adapters.py +949 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/effects/fix_wiki_runtime_adapters.py +433 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/graph/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/graph/coverage.py +413 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/graph/graph.py +396 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/graph/graph_fixes.py +161 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/hygiene/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/hygiene/hygiene.py +483 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/illustrate/__init__.py +2 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/illustrate/anchors.py +185 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/illustrate/core/__init__.py +0 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/illustrate/core/cache.py +223 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/illustrate/core/config.py +131 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/illustrate/core/download.py +224 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/illustrate/core/frontmatter.py +59 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/illustrate/core/insert.py +227 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/illustrate/core/local_import.py +54 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/illustrate/sources/__init__.py +42 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/illustrate/sources/web_profiles.py +99 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/illustrate/sources/web_search.py +203 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/illustrate/sources/wikimedia.py +102 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/markdown/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/markdown/markdown_db_adapter.mjs +434 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/markdown/markdown_node_runtime.py +274 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/markdown/markdown_query.py +227 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/artifacts.py +605 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/canonical_merge.py +277 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/markdown_zones.py +85 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/meaning_planner.py +307 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/note_iter.py +67 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/note_merge.py +278 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/note_plan.py +409 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/note_policy.py +22 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/note_style/__init__.py +79 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/note_style/fixes.py +264 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/note_style/frontmatter.py +435 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/note_style/models.py +208 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/note_style/prompts.py +37 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/note_style/tables.py +236 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/note_style/validate.py +404 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/provenance.py +478 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/raw_chats.py +273 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/notes/sources_backfill.py +235 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/__init__.py +10 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/anchors.py +16 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/captions.py +47 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/cli.py +179 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/cloud.py +52 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/config.py +196 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/context_packets.py +76 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/db.py +81 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/doctor.py +102 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/figure_ids.py +42 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/ingest.py +326 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/insert.py +316 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/mentions.py +57 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/ocr.py +71 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/paths.py +35 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/pdf_engine.py +77 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/schema.py +155 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/search.py +188 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/tui/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/tui/app.py +89 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/tui/image_backend.py +29 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/pdf/tui/state.py +65 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/publish/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/publish/publish.py +1139 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/publish/publish_receipts.py +365 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/publish/publish_recovery.py +240 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/quality/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/quality/agent_behavior_corpus.py +2069 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/quality/agent_report_validation.py +4448 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/quality/agent_run_audit.py +852 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/quality/architect_prompt_eval.py +341 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/quality/body_linker_eval.py +240 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/quality/curator_output_validation.py +175 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/quality/curator_prompt_eval.py +865 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/quality/triager_prompt_eval.py +1295 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/related_notes/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/related_notes/related_notes.py +1920 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/related_notes/related_notes_headless.py +1186 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/specialist/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/specialist/plan_attestation.py +148 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/specialist/specialist_receipts.py +360 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/specialist/specialist_runtime.py +52 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/specialist/specialist_task_runner.py +2470 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/style/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/style/style.py +1952 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/subagents/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/subagents/agents.py +1767 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/alias_projection.py +331 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/link_terms.py +151 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/llm_disambiguation.py +182 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/taxonomy/__init__.py +116 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/taxonomy/audit.py +201 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/taxonomy/migration.py +314 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/taxonomy/normalize.py +72 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/taxonomy/policy.py +135 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/taxonomy/resolve.py +413 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/taxonomy/schema.py +157 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/taxonomy/status.py +137 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/vocabulary_bootstrap.py +509 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/vocabulary_curator_batch.py +1115 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/vocabulary_ingestion.py +632 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/vocabulary_map.py +930 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/capabilities/vocabulary/vocabulary_recovery.py +1388 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/cli.py +6665 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/common.py +69 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/config.py +210 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/__init__.py +74 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/agent_report.py +242 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/agent_run_audit.py +196 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/agents.py +601 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/curator.py +256 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/effect_payloads.py +519 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/happy_path.py +190 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/link_git.py +110 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/link_runtime_artifact.py +52 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/note_plan.py +75 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/paths.py +114 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/public_report.py +53 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/publish.py +111 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/raw_coverage.py +217 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/related_notes.py +136 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/related_notes_headless.py +153 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/related_notes_runtime.py +395 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/schema_registry.py +637 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/specialist.py +432 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/status.py +62 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/style_rewrite.py +568 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/vocabulary_ingestion.py +223 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/workflow_blockers.py +510 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/workflow_guardrails.py +637 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/workflow_outcomes.py +121 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/contracts/workflow_receipts.py +100 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/__main__.py +4 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/cli.py +275 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/workflow/__init__.py +2 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/workflow/candidates.py +193 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/workflow/cli.py +189 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/workflow/gemini.py +220 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/workflow/inputs.py +120 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/workflow/models.py +34 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/workflow/parsing.py +48 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/workflow/prompts.py +216 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/workflow/quality.py +54 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/workflow/reporting.py +24 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/workflow/runner.py +433 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/workflow/utils.py +39 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/enrich/workflow/vault_guard_bridge.py +17 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/fix_wiki/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/fix_wiki/fix_wiki_context_packets.py +454 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/fix_wiki/fix_wiki_decision_projection.py +133 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/fix_wiki/fix_wiki_effects.py +1260 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/fix_wiki/fix_wiki_fsm.py +2768 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/fix_wiki/fix_wiki_machine.py +1588 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/fix_wiki/fix_wiki_plan.py +306 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/fix_wiki/fix_wiki_primary_objective.py +316 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/fix_wiki/fix_wiki_problem.py +153 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/fix_wiki/fix_wiki_receipt_evidence.py +306 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/fix_wiki/fix_wiki_states.py +290 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/fix_wiki/fix_wiki_user_report.py +342 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/fix_wiki/health.py +6332 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/link/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/link/link_fsm.py +1119 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/link/link_git.py +638 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/link/link_machine.py +1106 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/link/link_retry_governance.py +374 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/link/link_runtime_result.py +485 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/link/link_triggers.py +183 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/link/linking.py +2758 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/link/reference_repair.py +718 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/link/related_notes_fsm.py +1855 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/link_related/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/link_related/link_related_machine.py +834 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/process_chats/__init__.py +1 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/process_chats/process_chats_fsm.py +1592 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/process_chats/process_chats_machine.py +3097 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/process_chats/process_chats_primary_objective.py +28 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/flows/process_chats/process_chats_runtime_result.py +185 -0
- package/.opencode/mednotes/src/mednotes/domains/wiki/performance.py +97 -0
- package/.opencode/mednotes/src/mednotes/kernel/__init__.py +6 -0
- package/.opencode/mednotes/src/mednotes/kernel/agent_directive.py +336 -0
- package/.opencode/mednotes/src/mednotes/kernel/base.py +51 -0
- package/.opencode/mednotes/src/mednotes/kernel/blockers.py +39 -0
- package/.opencode/mednotes/src/mednotes/kernel/effect_executor.py +55 -0
- package/.opencode/mednotes/src/mednotes/kernel/effect_intent.py +69 -0
- package/.opencode/mednotes/src/mednotes/kernel/effects.py +160 -0
- package/.opencode/mednotes/src/mednotes/kernel/errors.py +38 -0
- package/.opencode/mednotes/src/mednotes/kernel/fsm_event.py +35 -0
- package/.opencode/mednotes/src/mednotes/kernel/fsm_model.py +55 -0
- package/.opencode/mednotes/src/mednotes/kernel/fsm_transition_result.py +75 -0
- package/.opencode/mednotes/src/mednotes/kernel/guardrails.py +188 -0
- package/.opencode/mednotes/src/mednotes/kernel/progress.py +319 -0
- package/.opencode/mednotes/src/mednotes/kernel/public_report.py +346 -0
- package/.opencode/mednotes/src/mednotes/kernel/state_machine.py +164 -0
- package/.opencode/mednotes/src/mednotes/kernel/workflow.py +619 -0
- package/.opencode/mednotes/src/mednotes/platform/__init__.py +5 -0
- package/.opencode/mednotes/src/mednotes/platform/backup_policy.py +382 -0
- package/.opencode/mednotes/src/mednotes/platform/feedback/__init__.py +62 -0
- package/.opencode/mednotes/src/mednotes/platform/feedback/cli.py +275 -0
- package/.opencode/mednotes/src/mednotes/platform/feedback/contracts.py +83 -0
- package/.opencode/mednotes/src/mednotes/platform/feedback/core.py +4168 -0
- package/.opencode/mednotes/src/mednotes/platform/feedback/integrity.py +989 -0
- package/.opencode/mednotes/src/mednotes/platform/feedback/operational_contract.py +2293 -0
- package/.opencode/mednotes/src/mednotes/platform/feedback/telemetry.py +875 -0
- package/.opencode/mednotes/src/mednotes/platform/feedback/telemetry_config.py +65 -0
- package/.opencode/mednotes/src/mednotes/platform/opencode_runtime_config.py +182 -0
- package/.opencode/mednotes/src/mednotes/platform/paths/__init__.py +1560 -0
- package/.opencode/mednotes/src/mednotes/platform/secrets.py +89 -0
- package/.opencode/mednotes/src/mednotes/platform/user_config.py +103 -0
- package/.opencode/mednotes/src/mednotes/platform/vault_guard.py +214 -0
- package/.opencode/mednotes/uv.lock +932 -0
- package/.opencode/mednotes.generated.json +395 -0
- package/.opencode/opencode.json +31 -0
- package/.opencode/plugins/mednotes-fsm.mjs +7 -0
- package/.opencode/plugins/mednotes_hook/adapters/antigravity.mjs +169 -0
- package/.opencode/plugins/mednotes_hook/adapters/harness_payload.mjs +103 -0
- package/.opencode/plugins/mednotes_hook/adapters/opencode_plugin.mjs +341 -0
- package/.opencode/plugins/mednotes_hook/adapters/opencode_user_config_sync.mjs +177 -0
- package/.opencode/plugins/mednotes_hook/anki_preflight.mjs +214 -0
- package/.opencode/plugins/mednotes_hook/cli.mjs +143 -0
- package/.opencode/plugins/mednotes_hook/diagnostics.mjs +11 -0
- package/.opencode/plugins/mednotes_hook/domain/agent_directive_core.mjs +160 -0
- package/.opencode/plugins/mednotes_hook/fsm_directive.mjs +1470 -0
- package/.opencode/plugins/mednotes_hook/hook_errors.mjs +120 -0
- package/.opencode/plugins/mednotes_hook/retention.mjs +114 -0
- package/.opencode/plugins/mednotes_hook/runtime.mjs +174 -0
- package/.opencode/plugins/mednotes_hook/telemetry_capture.mjs +511 -0
- package/.opencode/plugins/mednotes_hook/vault_guard.mjs +624 -0
- package/AGENTS.md +57 -0
- package/README.md +194 -0
- package/adapters/antigravity/agents.json +80 -0
- package/adapters/antigravity/templates/med-chat-triager.md +214 -0
- package/adapters/antigravity/templates/med-flashcard-maker.md +72 -0
- package/adapters/antigravity/templates/med-knowledge-architect.md +241 -0
- package/adapters/antigravity/templates/med-link-graph-curator.md +187 -0
- package/adapters/antigravity/templates/med-publish-guard.md +71 -0
- package/adapters/gemini-cli/gemini-extension.json +14 -0
- package/adapters/gemini-cli/package.json +15 -0
- package/adapters/gemini-cli/pyproject.toml +48 -0
- package/bin/mednotes-opencode.mjs +155 -0
- package/contracts/agents.json +116 -0
- package/core/agents/med-chat-triager.md +197 -0
- package/core/agents/med-flashcard-maker.md +56 -0
- package/core/agents/med-knowledge-architect.md +224 -0
- package/core/agents/med-link-graph-curator.md +171 -0
- package/core/agents/med-publish-guard.md +55 -0
- package/core/commands/flashcards.toml +22 -0
- package/core/commands/mednotes/create.toml +22 -0
- package/core/commands/mednotes/enrich.toml +24 -0
- package/core/commands/mednotes/fix-wiki.toml +24 -0
- package/core/commands/mednotes/history.toml +19 -0
- package/core/commands/mednotes/link-body.toml +22 -0
- package/core/commands/mednotes/link-related.toml +24 -0
- package/core/commands/mednotes/link.toml +24 -0
- package/core/commands/mednotes/pdf-library.toml +24 -0
- package/core/commands/mednotes/process-chats.toml +20 -0
- package/core/commands/mednotes/setup.toml +18 -0
- package/core/commands/mednotes/status.toml +24 -0
- package/core/commands/mednotes/telemetry.toml +24 -0
- package/core/commands/report.toml +23 -0
- package/core/skills/THIRD_PARTY_NOTICES.md +45 -0
- package/core/skills/create-medical-flashcards/SKILL.md +113 -0
- package/core/skills/create-medical-note/SKILL.md +90 -0
- package/core/skills/enrich-medical-note/SKILL.md +120 -0
- package/core/skills/fix-medical-wiki/SKILL.md +559 -0
- package/core/skills/link-medical-wiki/SKILL.md +224 -0
- package/core/skills/obsidian-cli/SKILL.md +118 -0
- package/core/skills/obsidian-markdown/SKILL.md +207 -0
- package/core/skills/obsidian-markdown/references/CALLOUTS.md +58 -0
- package/core/skills/obsidian-markdown/references/EMBEDS.md +63 -0
- package/core/skills/obsidian-markdown/references/PROPERTIES.md +61 -0
- package/core/skills/obsidian-ops/SKILL.md +136 -0
- package/core/skills/pdf-library/SKILL.md +45 -0
- package/core/skills/process-medical-chats/SKILL.md +246 -0
- package/core/skills/workflow-report/SKILL.md +100 -0
- package/package.json +45 -0
|
@@ -0,0 +1,625 @@
|
|
|
1
|
+
#Requires -Version 5.1
|
|
2
|
+
<#
|
|
3
|
+
.SYNOPSIS
|
|
4
|
+
Reset the Medical Notes Workbench Python environment on Windows and rebuild it with uv.
|
|
5
|
+
|
|
6
|
+
.DESCRIPTION
|
|
7
|
+
By default this script resets only the Medical Notes Workbench environment.
|
|
8
|
+
Pass -RemoveGlobalPython -YesReallyRemoveGlobalPython to uninstall global
|
|
9
|
+
Python Software Foundation installs and the Python Launcher, clean Python PATH
|
|
10
|
+
entries, then rebuild everything with uv-managed Python.
|
|
11
|
+
Pass -FullReset for the one-command workflow: ensure standalone uv, remove
|
|
12
|
+
global Python/launcher, clean WindowsApps aliases from PATH, sync, and check.
|
|
13
|
+
#>
|
|
14
|
+
|
|
15
|
+
[CmdletBinding(SupportsShouldProcess = $true)]
|
|
16
|
+
param(
|
|
17
|
+
[string] $ExtensionRoot,
|
|
18
|
+
[string] $StateDir = (Join-Path $HOME ".gemini\medical-notes-workbench"),
|
|
19
|
+
[string] $PythonVersion = "3.12",
|
|
20
|
+
[switch] $FullReset,
|
|
21
|
+
[switch] $RemoveGlobalPython,
|
|
22
|
+
[switch] $YesReallyRemoveGlobalPython,
|
|
23
|
+
[switch] $RemoveWindowsAppsFromPath,
|
|
24
|
+
[switch] $Dev,
|
|
25
|
+
[switch] $Pdf,
|
|
26
|
+
[switch] $SkipChecks
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
$ErrorActionPreference = "Stop"
|
|
30
|
+
|
|
31
|
+
function Resolve-WorkbenchExtensionRoot {
|
|
32
|
+
if ($ExtensionRoot) {
|
|
33
|
+
return (Resolve-Path $ExtensionRoot).Path
|
|
34
|
+
}
|
|
35
|
+
if ($PSScriptRoot) {
|
|
36
|
+
$candidate = Resolve-Path (Join-Path $PSScriptRoot "..") -ErrorAction SilentlyContinue
|
|
37
|
+
if ($candidate -and (Test-Path (Join-Path $candidate.Path "pyproject.toml"))) {
|
|
38
|
+
return $candidate.Path
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
$default = Join-Path $HOME ".gemini\extensions\medical-notes-workbench"
|
|
42
|
+
if (Test-Path (Join-Path $default "pyproject.toml")) {
|
|
43
|
+
return $default
|
|
44
|
+
}
|
|
45
|
+
throw "Nao encontrei a extensao medical-notes-workbench. Passe -ExtensionRoot com a raiz instalada."
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
$ResolvedExtensionRoot = Resolve-WorkbenchExtensionRoot
|
|
49
|
+
|
|
50
|
+
if ($FullReset) {
|
|
51
|
+
$RemoveGlobalPython = $true
|
|
52
|
+
$YesReallyRemoveGlobalPython = $true
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function Write-Step {
|
|
56
|
+
param([string] $Message)
|
|
57
|
+
Write-Host ""
|
|
58
|
+
Write-Host "==> $Message" -ForegroundColor Cyan
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function Invoke-Checked {
|
|
62
|
+
param(
|
|
63
|
+
[string] $FilePath,
|
|
64
|
+
[string[]] $Arguments
|
|
65
|
+
)
|
|
66
|
+
& $FilePath @Arguments
|
|
67
|
+
if ($LASTEXITCODE -ne 0) {
|
|
68
|
+
throw "Command failed ($LASTEXITCODE): $FilePath $($Arguments -join ' ')"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function Get-PythonUninstallEntries {
|
|
73
|
+
$roots = @(
|
|
74
|
+
"HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*",
|
|
75
|
+
"HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*",
|
|
76
|
+
"HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
foreach ($root in $roots) {
|
|
80
|
+
Get-ItemProperty -Path $root -ErrorAction SilentlyContinue |
|
|
81
|
+
Where-Object {
|
|
82
|
+
$name = [string] $_.DisplayName
|
|
83
|
+
$publisher = [string] $_.Publisher
|
|
84
|
+
$name -and (
|
|
85
|
+
$publisher -match "Python Software Foundation" -or
|
|
86
|
+
$name -match "^Python( \d| Launcher|$)"
|
|
87
|
+
)
|
|
88
|
+
} |
|
|
89
|
+
ForEach-Object {
|
|
90
|
+
[pscustomobject] @{
|
|
91
|
+
DisplayName = [string] $_.DisplayName
|
|
92
|
+
Publisher = [string] $_.Publisher
|
|
93
|
+
QuietUninstallString = [string] $_.QuietUninstallString
|
|
94
|
+
UninstallString = [string] $_.UninstallString
|
|
95
|
+
RegistryPath = [string] $_.PSPath
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function Get-PythonInstallRoots {
|
|
102
|
+
$roots = @(
|
|
103
|
+
"HKCU:\Software\Python\PythonCore\*\InstallPath",
|
|
104
|
+
"HKLM:\Software\Python\PythonCore\*\InstallPath",
|
|
105
|
+
"HKLM:\Software\WOW6432Node\Python\PythonCore\*\InstallPath"
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
foreach ($root in $roots) {
|
|
109
|
+
Get-ItemProperty -Path $root -ErrorAction SilentlyContinue |
|
|
110
|
+
ForEach-Object {
|
|
111
|
+
if ($_.ExecutablePath) {
|
|
112
|
+
Split-Path -Parent ([string] $_.ExecutablePath)
|
|
113
|
+
}
|
|
114
|
+
elseif ($_.PSChildName) {
|
|
115
|
+
[string] $_.PSChildName
|
|
116
|
+
}
|
|
117
|
+
elseif ($_.InstallPath) {
|
|
118
|
+
[string] $_.InstallPath
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function Get-CommandPaths {
|
|
125
|
+
param([string[]] $Names)
|
|
126
|
+
|
|
127
|
+
foreach ($name in $Names) {
|
|
128
|
+
$output = & cmd.exe /d /c "where.exe $name 2>nul"
|
|
129
|
+
if ($LASTEXITCODE -eq 0) {
|
|
130
|
+
$output | Where-Object { $_ }
|
|
131
|
+
}
|
|
132
|
+
elseif ($LASTEXITCODE -eq 1) {
|
|
133
|
+
continue
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
Write-Warning "where.exe retornou codigo $LASTEXITCODE para $name"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function ConvertTo-QuietUninstallCommand {
|
|
142
|
+
param([object] $Entry)
|
|
143
|
+
|
|
144
|
+
$cmdLine = if ($Entry.QuietUninstallString) {
|
|
145
|
+
$Entry.QuietUninstallString
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
$Entry.UninstallString
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (-not $cmdLine) {
|
|
152
|
+
return $null
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if ($cmdLine -match "\{[0-9A-Fa-f-]{36}\}") {
|
|
156
|
+
return "msiexec.exe /x $($Matches[0]) /qn /norestart"
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (-not $Entry.QuietUninstallString -and $cmdLine -notmatch "(?i)(/quiet|/qn|/passive)") {
|
|
160
|
+
$cmdLine = "$cmdLine /quiet"
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return $cmdLine
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function Invoke-GlobalPythonRemoval {
|
|
167
|
+
param([string[]] $KnownRoots)
|
|
168
|
+
|
|
169
|
+
$entries = @(Get-PythonUninstallEntries | Sort-Object RegistryPath -Unique)
|
|
170
|
+
Write-Step "Inventario de Python global"
|
|
171
|
+
|
|
172
|
+
$commandPaths = @(Get-CommandPaths @("python", "python3", "py") | Sort-Object -Unique)
|
|
173
|
+
if ($commandPaths.Count -gt 0) {
|
|
174
|
+
Write-Host "Comandos encontrados no PATH:"
|
|
175
|
+
$commandPaths | ForEach-Object { Write-Host " $_" }
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
Write-Host "Nenhum python/python3/py encontrado no PATH."
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if ($entries.Count -gt 0) {
|
|
182
|
+
Write-Host "Instalacoes registradas para remocao:"
|
|
183
|
+
$entries | ForEach-Object { Write-Host " $($_.DisplayName) [$($_.Publisher)]" }
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
Write-Host "Nenhuma instalacao PSF/Python Launcher registrada para remocao."
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (-not $YesReallyRemoveGlobalPython) {
|
|
190
|
+
throw "Remocao global bloqueada. Rode novamente com -RemoveGlobalPython -YesReallyRemoveGlobalPython para confirmar."
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
foreach ($entry in $entries) {
|
|
194
|
+
$cmdLine = ConvertTo-QuietUninstallCommand $entry
|
|
195
|
+
if (-not $cmdLine) {
|
|
196
|
+
Write-Warning "Sem comando de uninstall para $($entry.DisplayName). Pulei."
|
|
197
|
+
continue
|
|
198
|
+
}
|
|
199
|
+
if ($PSCmdlet.ShouldProcess($entry.DisplayName, "Uninstall global Python")) {
|
|
200
|
+
Write-Step "Removendo $($entry.DisplayName)"
|
|
201
|
+
$process = Start-Process -FilePath "cmd.exe" -ArgumentList @("/d", "/s", "/c", $cmdLine) -Wait -PassThru
|
|
202
|
+
if ($process.ExitCode -ne 0) {
|
|
203
|
+
Write-Warning "Uninstall retornou codigo $($process.ExitCode): $($entry.DisplayName)"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
Remove-PythonEnvironmentVariables
|
|
209
|
+
Disable-PythonWindowsAppAliases
|
|
210
|
+
Remove-PythonPathEntries -KnownRoots $KnownRoots
|
|
211
|
+
Remove-ResidualPythonDirectories -KnownRoots $KnownRoots
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function Disable-PythonWindowsAppAliases {
|
|
215
|
+
$windowsApps = Join-Path $env:LOCALAPPDATA "Microsoft\WindowsApps"
|
|
216
|
+
if (-not (Test-Path $windowsApps)) {
|
|
217
|
+
return
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
foreach ($name in @("python.exe", "python3.exe")) {
|
|
221
|
+
$aliasPath = Join-Path $windowsApps $name
|
|
222
|
+
if (Test-Path $aliasPath) {
|
|
223
|
+
try {
|
|
224
|
+
if ($PSCmdlet.ShouldProcess($aliasPath, "Remove Windows Python app execution alias")) {
|
|
225
|
+
Remove-Item -LiteralPath $aliasPath -Force -ErrorAction Stop
|
|
226
|
+
Write-Host "Alias WindowsApps removido: $aliasPath"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
Write-Warning "Nao consegui remover alias $aliasPath. Desative em Settings > Apps > Advanced app settings > App execution aliases."
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function Remove-PythonEnvironmentVariables {
|
|
237
|
+
foreach ($target in @("User", "Machine")) {
|
|
238
|
+
foreach ($name in @("PYTHONHOME", "PYTHONPATH", "PYLAUNCHER_ALLOW_INSTALL", "PYLAUNCHER_NO_SEARCH_PATH")) {
|
|
239
|
+
try {
|
|
240
|
+
if ([Environment]::GetEnvironmentVariable($name, $target)) {
|
|
241
|
+
if ($PSCmdlet.ShouldProcess("$target $name", "Remove Python environment variable")) {
|
|
242
|
+
[Environment]::SetEnvironmentVariable($name, $null, $target)
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
Write-Warning "Nao consegui limpar $target ${name}: $($_.Exception.Message)"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function Test-PythonPathEntry {
|
|
254
|
+
param(
|
|
255
|
+
[string] $Entry,
|
|
256
|
+
[string[]] $KnownRoots
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
if (-not $Entry) {
|
|
260
|
+
return $false
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
$expanded = [Environment]::ExpandEnvironmentVariables($Entry).Trim('"').TrimEnd("\")
|
|
264
|
+
if (-not $expanded) {
|
|
265
|
+
return $false
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if ($RemoveWindowsAppsFromPath -and $expanded -like "*\Microsoft\WindowsApps") {
|
|
269
|
+
return $true
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
foreach ($root in $KnownRoots) {
|
|
273
|
+
if ($root) {
|
|
274
|
+
$normalizedRoot = [Environment]::ExpandEnvironmentVariables($root).Trim('"').TrimEnd("\")
|
|
275
|
+
if ($normalizedRoot -and $expanded.StartsWith($normalizedRoot, [StringComparison]::OrdinalIgnoreCase)) {
|
|
276
|
+
return $true
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return ($expanded -match "(?i)\\Programs\\Python\\Python\d+" -or
|
|
282
|
+
$expanded -match "(?i)\\Python\d+(\\Scripts)?$" -or
|
|
283
|
+
$expanded -match "(?i)\\PythonCore\\" -or
|
|
284
|
+
$expanded -match "(?i)\\Python\\Launcher$")
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function Remove-PythonPathEntries {
|
|
288
|
+
param([string[]] $KnownRoots)
|
|
289
|
+
|
|
290
|
+
foreach ($target in @("User", "Machine")) {
|
|
291
|
+
try {
|
|
292
|
+
$pathValue = [Environment]::GetEnvironmentVariable("Path", $target)
|
|
293
|
+
if (-not $pathValue) {
|
|
294
|
+
continue
|
|
295
|
+
}
|
|
296
|
+
$entries = @($pathValue -split ";" | Where-Object { $_ -ne "" })
|
|
297
|
+
$kept = @()
|
|
298
|
+
$removed = @()
|
|
299
|
+
foreach ($entry in $entries) {
|
|
300
|
+
if (Test-PythonPathEntry -Entry $entry -KnownRoots $KnownRoots) {
|
|
301
|
+
$removed += $entry
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
$kept += $entry
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if ($removed.Count -gt 0) {
|
|
308
|
+
if ($PSCmdlet.ShouldProcess("$target PATH", "Remove Python PATH entries")) {
|
|
309
|
+
[Environment]::SetEnvironmentVariable("Path", ($kept -join ";"), $target)
|
|
310
|
+
}
|
|
311
|
+
Write-Host "PATH ${target}: removido"
|
|
312
|
+
$removed | ForEach-Object { Write-Host " $_" }
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
catch {
|
|
316
|
+
Write-Warning "Nao consegui editar PATH ${target}: $($_.Exception.Message)"
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function Remove-ResidualPythonDirectories {
|
|
322
|
+
param([string[]] $KnownRoots)
|
|
323
|
+
|
|
324
|
+
$candidates = @()
|
|
325
|
+
$candidates += $KnownRoots
|
|
326
|
+
if ($env:LOCALAPPDATA) {
|
|
327
|
+
$candidates += Get-ChildItem -Path (Join-Path $env:LOCALAPPDATA "Programs\Python") -Directory -ErrorAction SilentlyContinue |
|
|
328
|
+
Select-Object -ExpandProperty FullName
|
|
329
|
+
}
|
|
330
|
+
if ($env:ProgramFiles) {
|
|
331
|
+
$candidates += Get-ChildItem -Path $env:ProgramFiles -Directory -Filter "Python*" -ErrorAction SilentlyContinue |
|
|
332
|
+
Select-Object -ExpandProperty FullName
|
|
333
|
+
}
|
|
334
|
+
if (${env:ProgramFiles(x86)}) {
|
|
335
|
+
$candidates += Get-ChildItem -Path ${env:ProgramFiles(x86)} -Directory -Filter "Python*" -ErrorAction SilentlyContinue |
|
|
336
|
+
Select-Object -ExpandProperty FullName
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
$safeCandidates = $candidates |
|
|
340
|
+
Where-Object { $_ -and (Test-Path $_) } |
|
|
341
|
+
Sort-Object -Unique |
|
|
342
|
+
Where-Object {
|
|
343
|
+
$_ -match "(?i)\\Programs\\Python\\Python\d+" -or
|
|
344
|
+
$_ -match "(?i)\\Python\d+$" -or
|
|
345
|
+
$_ -match "(?i)\\Python\\Launcher$"
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
foreach ($dir in $safeCandidates) {
|
|
349
|
+
if ($PSCmdlet.ShouldProcess($dir, "Remove residual Python directory")) {
|
|
350
|
+
Write-Step "Removendo diretorio residual: $dir"
|
|
351
|
+
Remove-Item -LiteralPath $dir -Recurse -Force -ErrorAction SilentlyContinue
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function Add-UvCandidatePaths {
|
|
357
|
+
$paths = @(
|
|
358
|
+
(Join-Path $HOME ".local\bin"),
|
|
359
|
+
(Join-Path $env:USERPROFILE ".local\bin"),
|
|
360
|
+
(Join-Path $env:LOCALAPPDATA "Programs\uv")
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
foreach ($path in $paths) {
|
|
364
|
+
if ($path -and (Test-Path $path) -and (($env:Path -split ";") -notcontains $path)) {
|
|
365
|
+
$env:Path = "$path;$env:Path"
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
$wingetRoot = Join-Path $env:LOCALAPPDATA "Microsoft\WinGet\Packages"
|
|
370
|
+
if (Test-Path $wingetRoot) {
|
|
371
|
+
Get-ChildItem -Path $wingetRoot -Recurse -Filter "uv.exe" -ErrorAction SilentlyContinue |
|
|
372
|
+
Select-Object -ExpandProperty DirectoryName -Unique |
|
|
373
|
+
ForEach-Object {
|
|
374
|
+
if (($env:Path -split ";") -notcontains $_) {
|
|
375
|
+
$env:Path = "$_;$env:Path"
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function Find-UvExecutable {
|
|
382
|
+
Add-UvCandidatePaths
|
|
383
|
+
$command = Get-Command uv -ErrorAction SilentlyContinue
|
|
384
|
+
if ($command) {
|
|
385
|
+
return $command.Source
|
|
386
|
+
}
|
|
387
|
+
return $null
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function Invoke-UvInstallerUrl {
|
|
391
|
+
param([string] $Url)
|
|
392
|
+
|
|
393
|
+
Write-Step "Tentando instalador uv: $Url"
|
|
394
|
+
try {
|
|
395
|
+
$command = "[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; irm '$Url' | iex"
|
|
396
|
+
powershell -NoProfile -ExecutionPolicy Bypass -Command $command
|
|
397
|
+
if ($LASTEXITCODE -eq 0) {
|
|
398
|
+
return $true
|
|
399
|
+
}
|
|
400
|
+
Write-Warning "Instalador uv retornou codigo $LASTEXITCODE."
|
|
401
|
+
}
|
|
402
|
+
catch {
|
|
403
|
+
Write-Warning "Instalador uv falhou: $($_.Exception.Message)"
|
|
404
|
+
}
|
|
405
|
+
return $false
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function Install-UvWithWinget {
|
|
409
|
+
$winget = Get-Command winget -ErrorAction SilentlyContinue
|
|
410
|
+
if (-not $winget) {
|
|
411
|
+
return $false
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
Write-Step "Tentando instalar uv via winget"
|
|
415
|
+
try {
|
|
416
|
+
& $winget.Source install --id astral-sh.uv -e --accept-package-agreements --accept-source-agreements --silent
|
|
417
|
+
if ($LASTEXITCODE -eq 0) {
|
|
418
|
+
return $true
|
|
419
|
+
}
|
|
420
|
+
Write-Warning "winget retornou codigo $LASTEXITCODE."
|
|
421
|
+
}
|
|
422
|
+
catch {
|
|
423
|
+
Write-Warning "winget falhou: $($_.Exception.Message)"
|
|
424
|
+
}
|
|
425
|
+
return $false
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function Install-UvFromReleaseZip {
|
|
429
|
+
Write-Step "Tentando instalar uv pelo zip do GitHub Releases"
|
|
430
|
+
try {
|
|
431
|
+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
432
|
+
$arch = if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") {
|
|
433
|
+
"aarch64"
|
|
434
|
+
}
|
|
435
|
+
elseif ([Environment]::Is64BitOperatingSystem) {
|
|
436
|
+
"x86_64"
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
"i686"
|
|
440
|
+
}
|
|
441
|
+
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/astral-sh/uv/releases/latest" -UseBasicParsing
|
|
442
|
+
$assetName = "uv-$arch-pc-windows-msvc.zip"
|
|
443
|
+
$asset = $release.assets | Where-Object { $_.name -eq $assetName } | Select-Object -First 1
|
|
444
|
+
if (-not $asset) {
|
|
445
|
+
throw "Asset nao encontrado: $assetName"
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
$binDir = Join-Path $env:USERPROFILE ".local\bin"
|
|
449
|
+
$tmpDir = Join-Path $env:TEMP ("uv-release-" + [guid]::NewGuid().ToString("N"))
|
|
450
|
+
$zipPath = Join-Path $env:TEMP $assetName
|
|
451
|
+
New-Item -ItemType Directory -Force $binDir | Out-Null
|
|
452
|
+
New-Item -ItemType Directory -Force $tmpDir | Out-Null
|
|
453
|
+
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $zipPath -UseBasicParsing
|
|
454
|
+
Expand-Archive -LiteralPath $zipPath -DestinationPath $tmpDir -Force
|
|
455
|
+
|
|
456
|
+
foreach ($exeName in @("uv.exe", "uvx.exe")) {
|
|
457
|
+
$exe = Get-ChildItem -Path $tmpDir -Recurse -Filter $exeName -ErrorAction SilentlyContinue | Select-Object -First 1
|
|
458
|
+
if ($exe) {
|
|
459
|
+
$destination = Join-Path $binDir $exeName
|
|
460
|
+
try {
|
|
461
|
+
Copy-Item -LiteralPath $exe.FullName -Destination $destination -Force
|
|
462
|
+
}
|
|
463
|
+
catch {
|
|
464
|
+
if (Test-Path $destination) {
|
|
465
|
+
Write-Warning "$exeName ja existe e esta em uso; mantendo executavel existente."
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
throw
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
Remove-Item -LiteralPath $tmpDir -Recurse -Force -ErrorAction SilentlyContinue
|
|
474
|
+
Remove-Item -LiteralPath $zipPath -Force -ErrorAction SilentlyContinue
|
|
475
|
+
|
|
476
|
+
if (($env:Path -split ";") -notcontains $binDir) {
|
|
477
|
+
$env:Path = "$binDir;$env:Path"
|
|
478
|
+
}
|
|
479
|
+
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
480
|
+
if (($userPath -split ";") -notcontains $binDir) {
|
|
481
|
+
[Environment]::SetEnvironmentVariable("Path", "$binDir;$userPath", "User")
|
|
482
|
+
}
|
|
483
|
+
return $true
|
|
484
|
+
}
|
|
485
|
+
catch {
|
|
486
|
+
Write-Warning "Download direto do uv falhou: $($_.Exception.Message)"
|
|
487
|
+
}
|
|
488
|
+
return $false
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
function Install-UvStandalone {
|
|
492
|
+
Write-Step "Instalando/atualizando uv"
|
|
493
|
+
$installed = $false
|
|
494
|
+
foreach ($url in @(
|
|
495
|
+
"https://astral.sh/uv/install.ps1",
|
|
496
|
+
"https://releases.astral.sh/github/uv/releases/download/0.11.8/uv-installer.ps1"
|
|
497
|
+
)) {
|
|
498
|
+
if (Invoke-UvInstallerUrl $url) {
|
|
499
|
+
$installed = $true
|
|
500
|
+
break
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
if (-not $installed) {
|
|
504
|
+
$installed = Install-UvWithWinget
|
|
505
|
+
}
|
|
506
|
+
if (-not $installed) {
|
|
507
|
+
$installed = Install-UvFromReleaseZip
|
|
508
|
+
}
|
|
509
|
+
if (-not $installed) {
|
|
510
|
+
throw "Falha ao instalar uv por instalador oficial, winget e zip direto."
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
function Resolve-Uv {
|
|
515
|
+
param([switch] $ForceInstall)
|
|
516
|
+
|
|
517
|
+
$uv = Find-UvExecutable
|
|
518
|
+
if ($uv -and $uv -notmatch "(?i)\\Python\d+\\Scripts\\") {
|
|
519
|
+
return $uv
|
|
520
|
+
}
|
|
521
|
+
if ($ForceInstall) {
|
|
522
|
+
Write-Step "Garantindo uv standalone antes do reset global"
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
Install-UvStandalone
|
|
526
|
+
|
|
527
|
+
$uv = Find-UvExecutable
|
|
528
|
+
if ($uv) {
|
|
529
|
+
return $uv
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
throw "uv foi instalado, mas nao entrou no PATH desta sessao. Abra um novo PowerShell e rode novamente."
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (-not (Test-Path (Join-Path $ResolvedExtensionRoot "pyproject.toml"))) {
|
|
536
|
+
throw "ExtensionRoot invalido: nao encontrei pyproject.toml em $ResolvedExtensionRoot"
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
$knownPythonRoots = @(Get-PythonInstallRoots | Where-Object { $_ } | Sort-Object -Unique)
|
|
540
|
+
|
|
541
|
+
Write-Step "Preparando diretorio persistente"
|
|
542
|
+
New-Item -ItemType Directory -Force $StateDir | Out-Null
|
|
543
|
+
|
|
544
|
+
$configPath = Join-Path $StateDir "config.toml"
|
|
545
|
+
if (-not (Test-Path $configPath)) {
|
|
546
|
+
$configExample = Join-Path $ResolvedExtensionRoot "config.example.toml"
|
|
547
|
+
if (Test-Path $configExample) {
|
|
548
|
+
Copy-Item $configExample $configPath
|
|
549
|
+
Write-Host "config.toml criado em $configPath"
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
$envPath = Join-Path $StateDir ".env"
|
|
554
|
+
if (-not (Test-Path $envPath)) {
|
|
555
|
+
$envExample = Join-Path $ResolvedExtensionRoot ".env.example"
|
|
556
|
+
if (Test-Path $envExample) {
|
|
557
|
+
Copy-Item $envExample $envPath
|
|
558
|
+
Write-Host ".env criado em $envPath"
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
$uv = Resolve-Uv -ForceInstall:$FullReset
|
|
563
|
+
Write-Step "Usando uv: $uv"
|
|
564
|
+
Invoke-Checked $uv @("--version")
|
|
565
|
+
|
|
566
|
+
if ($RemoveGlobalPython) {
|
|
567
|
+
Invoke-GlobalPythonRemoval -KnownRoots $knownPythonRoots
|
|
568
|
+
$env:Path = [Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [Environment]::GetEnvironmentVariable("Path", "User")
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
Write-Step "Instalando Python gerenciado pelo uv ($PythonVersion)"
|
|
572
|
+
Invoke-Checked $uv @("python", "install", $PythonVersion)
|
|
573
|
+
|
|
574
|
+
$persistentVenv = Join-Path $StateDir ".venv"
|
|
575
|
+
$bundleVenv = Join-Path $ResolvedExtensionRoot ".venv"
|
|
576
|
+
foreach ($venv in @($persistentVenv, $bundleVenv)) {
|
|
577
|
+
if (Test-Path $venv) {
|
|
578
|
+
if ($PSCmdlet.ShouldProcess($venv, "Remove project virtual environment")) {
|
|
579
|
+
Write-Step "Removendo ambiente antigo: $venv"
|
|
580
|
+
Remove-Item -LiteralPath $venv -Recurse -Force
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
$env:UV_PROJECT_ENVIRONMENT = $persistentVenv
|
|
586
|
+
$syncArgs = @("sync", "--project", $ResolvedExtensionRoot, "--python", $PythonVersion)
|
|
587
|
+
if ($Dev) {
|
|
588
|
+
$syncArgs += @("--extra", "dev")
|
|
589
|
+
}
|
|
590
|
+
if ($Pdf) {
|
|
591
|
+
$syncArgs += @("--extra", "pdf")
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
Write-Step "Sincronizando dependencias com uv"
|
|
595
|
+
Push-Location $ResolvedExtensionRoot
|
|
596
|
+
try {
|
|
597
|
+
# Equivalent command: uv sync --project "$ResolvedExtensionRoot"
|
|
598
|
+
Invoke-Checked $uv $syncArgs
|
|
599
|
+
|
|
600
|
+
if (-not $SkipChecks) {
|
|
601
|
+
Write-Step "Rodando checks basicos"
|
|
602
|
+
Invoke-Checked $uv @("run", "python", "-m", "enricher", "--help")
|
|
603
|
+
Invoke-Checked $uv @("run", "python", "scripts\mednotes\wiki\cli.py", "validate", "--config", $configPath)
|
|
604
|
+
Invoke-Checked $uv @("run", "python", "scripts\mednotes\wiki\cli.py", "run-linker", "--help")
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
finally {
|
|
608
|
+
Pop-Location
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
Write-Host ""
|
|
612
|
+
Write-Host "Pronto. Ambiente Python do workbench reconstruido com uv." -ForegroundColor Green
|
|
613
|
+
Write-Host "ExtensionRoot: $ResolvedExtensionRoot"
|
|
614
|
+
Write-Host "StateDir: $StateDir"
|
|
615
|
+
Write-Host "Venv uv: $persistentVenv"
|
|
616
|
+
Write-Host ""
|
|
617
|
+
Write-Host "Para comandos manuais nesta sessao:"
|
|
618
|
+
Write-Host ('$env:UV_PROJECT_ENVIRONMENT = "{0}"' -f $persistentVenv)
|
|
619
|
+
Write-Host 'uv run python scripts\mednotes\wiki\cli.py fix-wiki --dry-run --json'
|
|
620
|
+
if ($RemoveGlobalPython) {
|
|
621
|
+
Write-Host ""
|
|
622
|
+
Write-Host "Se 'where python' ainda apontar para Microsoft\\WindowsApps, desative o alias"
|
|
623
|
+
Write-Host "python.exe/python3.exe em Settings > Apps > Advanced app settings > App execution aliases,"
|
|
624
|
+
Write-Host "ou rode novamente com -RemoveWindowsAppsFromPath para remover WindowsApps do PATH."
|
|
625
|
+
}
|