code-puppy-core-plugins 0.0.2__py3-none-any.whl
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.
- code_puppy_core_plugins/__init__.py +5 -0
- code_puppy_core_plugins/acp/README.md +266 -0
- code_puppy_core_plugins/acp/__init__.py +8 -0
- code_puppy_core_plugins/acp/agent.py +494 -0
- code_puppy_core_plugins/acp/bridge.py +309 -0
- code_puppy_core_plugins/acp/capabilities.py +73 -0
- code_puppy_core_plugins/acp/commands.py +116 -0
- code_puppy_core_plugins/acp/content.py +115 -0
- code_puppy_core_plugins/acp/io_delegation.py +231 -0
- code_puppy_core_plugins/acp/mcp_config.py +66 -0
- code_puppy_core_plugins/acp/permissions.py +159 -0
- code_puppy_core_plugins/acp/persistence.py +197 -0
- code_puppy_core_plugins/acp/register_callbacks.py +110 -0
- code_puppy_core_plugins/acp/replay.py +114 -0
- code_puppy_core_plugins/acp/session.py +329 -0
- code_puppy_core_plugins/acp/session_config.py +179 -0
- code_puppy_core_plugins/acp/state.py +135 -0
- code_puppy_core_plugins/agent_skills/__init__.py +22 -0
- code_puppy_core_plugins/agent_skills/config.py +208 -0
- code_puppy_core_plugins/agent_skills/discovery.py +337 -0
- code_puppy_core_plugins/agent_skills/downloader.py +392 -0
- code_puppy_core_plugins/agent_skills/enabled_skills.py +82 -0
- code_puppy_core_plugins/agent_skills/installer.py +22 -0
- code_puppy_core_plugins/agent_skills/metadata.py +219 -0
- code_puppy_core_plugins/agent_skills/prompt_builder.py +49 -0
- code_puppy_core_plugins/agent_skills/provider.py +52 -0
- code_puppy_core_plugins/agent_skills/register_callbacks.py +309 -0
- code_puppy_core_plugins/agent_skills/remote_catalog.py +322 -0
- code_puppy_core_plugins/agent_skills/skill_catalog.py +257 -0
- code_puppy_core_plugins/agent_skills/skill_commands.py +102 -0
- code_puppy_core_plugins/agent_skills/skills_install_menu.py +698 -0
- code_puppy_core_plugins/agent_skills/skills_menu.py +794 -0
- code_puppy_core_plugins/aws_bedrock/__init__.py +14 -0
- code_puppy_core_plugins/aws_bedrock/config.py +101 -0
- code_puppy_core_plugins/aws_bedrock/register_callbacks.py +243 -0
- code_puppy_core_plugins/aws_bedrock/utils.py +186 -0
- code_puppy_core_plugins/azure_foundry/README.md +238 -0
- code_puppy_core_plugins/azure_foundry/__init__.py +15 -0
- code_puppy_core_plugins/azure_foundry/config.py +126 -0
- code_puppy_core_plugins/azure_foundry/discovery.py +189 -0
- code_puppy_core_plugins/azure_foundry/register_callbacks.py +506 -0
- code_puppy_core_plugins/azure_foundry/token.py +182 -0
- code_puppy_core_plugins/azure_foundry/utils.py +375 -0
- code_puppy_core_plugins/btw/__init__.py +1 -0
- code_puppy_core_plugins/btw/inline_view.py +135 -0
- code_puppy_core_plugins/btw/register_callbacks.py +106 -0
- code_puppy_core_plugins/btw/side_query.py +91 -0
- code_puppy_core_plugins/chatgpt_oauth/IMAGEGEN_SKILL.md +83 -0
- code_puppy_core_plugins/chatgpt_oauth/__init__.py +8 -0
- code_puppy_core_plugins/chatgpt_oauth/config.py +52 -0
- code_puppy_core_plugins/chatgpt_oauth/image_generation.py +253 -0
- code_puppy_core_plugins/chatgpt_oauth/image_tool.py +70 -0
- code_puppy_core_plugins/chatgpt_oauth/oauth_flow.py +461 -0
- code_puppy_core_plugins/chatgpt_oauth/register_callbacks.py +288 -0
- code_puppy_core_plugins/chatgpt_oauth/test_plugin.py +663 -0
- code_puppy_core_plugins/chatgpt_oauth/usage.py +113 -0
- code_puppy_core_plugins/chatgpt_oauth/utils.py +534 -0
- code_puppy_core_plugins/claude_code_hooks/__init__.py +1 -0
- code_puppy_core_plugins/claude_code_hooks/config.py +137 -0
- code_puppy_core_plugins/claude_code_hooks/register_callbacks.py +383 -0
- code_puppy_core_plugins/claude_code_oauth/README.md +167 -0
- code_puppy_core_plugins/claude_code_oauth/SETUP.md +93 -0
- code_puppy_core_plugins/claude_code_oauth/__init__.py +25 -0
- code_puppy_core_plugins/claude_code_oauth/config.py +59 -0
- code_puppy_core_plugins/claude_code_oauth/fast_mode.py +122 -0
- code_puppy_core_plugins/claude_code_oauth/prompt_handler.py +64 -0
- code_puppy_core_plugins/claude_code_oauth/register_callbacks.py +719 -0
- code_puppy_core_plugins/claude_code_oauth/test_plugin.py +285 -0
- code_puppy_core_plugins/claude_code_oauth/token_refresh_heartbeat.py +240 -0
- code_puppy_core_plugins/claude_code_oauth/utils.py +663 -0
- code_puppy_core_plugins/code_puppy_agent/AGENTS_AND_TOOLS.md +155 -0
- code_puppy_core_plugins/code_puppy_agent/MODELS_AND_MCP.md +104 -0
- code_puppy_core_plugins/code_puppy_agent/PLUGINS_AND_CALLBACKS.md +147 -0
- code_puppy_core_plugins/code_puppy_agent/SESSIONS_AND_HISTORY.md +39 -0
- code_puppy_core_plugins/code_puppy_agent/SKILL.md +180 -0
- code_puppy_core_plugins/code_puppy_agent/SKILLS_SYSTEM.md +136 -0
- code_puppy_core_plugins/code_puppy_agent/SYSTEM_PROMPT_CONFIG_AND_I18N.md +160 -0
- code_puppy_core_plugins/code_puppy_agent/__init__.py +5 -0
- code_puppy_core_plugins/code_puppy_agent/register_callbacks.py +46 -0
- code_puppy_core_plugins/computer_use/NativeCapture.swift +123 -0
- code_puppy_core_plugins/computer_use/README.md +109 -0
- code_puppy_core_plugins/computer_use/__init__.py +1 -0
- code_puppy_core_plugins/computer_use/accessibility.py +163 -0
- code_puppy_core_plugins/computer_use/activation.py +75 -0
- code_puppy_core_plugins/computer_use/backend.py +584 -0
- code_puppy_core_plugins/computer_use/backend_types.py +5 -0
- code_puppy_core_plugins/computer_use/capture.py +110 -0
- code_puppy_core_plugins/computer_use/commands.py +62 -0
- code_puppy_core_plugins/computer_use/geometry.py +81 -0
- code_puppy_core_plugins/computer_use/inline_image.py +56 -0
- code_puppy_core_plugins/computer_use/keycodes.py +47 -0
- code_puppy_core_plugins/computer_use/policy.py +144 -0
- code_puppy_core_plugins/computer_use/register_callbacks.py +96 -0
- code_puppy_core_plugins/computer_use/safety.py +18 -0
- code_puppy_core_plugins/computer_use/settle.py +64 -0
- code_puppy_core_plugins/computer_use/state.py +86 -0
- code_puppy_core_plugins/computer_use/tools.py +469 -0
- code_puppy_core_plugins/context_indicator/__init__.py +14 -0
- code_puppy_core_plugins/context_indicator/register_callbacks.py +249 -0
- code_puppy_core_plugins/context_indicator/usage.py +40 -0
- code_puppy_core_plugins/copilot_auth/__init__.py +11 -0
- code_puppy_core_plugins/copilot_auth/config.py +93 -0
- code_puppy_core_plugins/copilot_auth/reasoning_client.py +409 -0
- code_puppy_core_plugins/copilot_auth/register_callbacks.py +460 -0
- code_puppy_core_plugins/copilot_auth/utils.py +587 -0
- code_puppy_core_plugins/customizable_commands/__init__.py +0 -0
- code_puppy_core_plugins/customizable_commands/register_callbacks.py +464 -0
- code_puppy_core_plugins/dbos_durable_exec/__init__.py +1 -0
- code_puppy_core_plugins/dbos_durable_exec/cancel.py +15 -0
- code_puppy_core_plugins/dbos_durable_exec/commands.py +31 -0
- code_puppy_core_plugins/dbos_durable_exec/config.py +31 -0
- code_puppy_core_plugins/dbos_durable_exec/lifecycle.py +83 -0
- code_puppy_core_plugins/dbos_durable_exec/register_callbacks.py +45 -0
- code_puppy_core_plugins/dbos_durable_exec/runtime.py +65 -0
- code_puppy_core_plugins/dbos_durable_exec/startup_lock.py +155 -0
- code_puppy_core_plugins/dbos_durable_exec/workflow_ids.py +16 -0
- code_puppy_core_plugins/dbos_durable_exec/wrapper.py +58 -0
- code_puppy_core_plugins/destructive_command_guard/AGENTS.md +79 -0
- code_puppy_core_plugins/destructive_command_guard/__init__.py +14 -0
- code_puppy_core_plugins/destructive_command_guard/detector.py +374 -0
- code_puppy_core_plugins/destructive_command_guard/register_callbacks.py +165 -0
- code_puppy_core_plugins/emoji_filter/__init__.py +12 -0
- code_puppy_core_plugins/emoji_filter/config.py +26 -0
- code_puppy_core_plugins/emoji_filter/register_callbacks.py +238 -0
- code_puppy_core_plugins/emoji_filter/stripper.py +45 -0
- code_puppy_core_plugins/empty_html_comment_filter/register_callbacks.py +116 -0
- code_puppy_core_plugins/example_custom_command/README.md +328 -0
- code_puppy_core_plugins/example_custom_command/register_callbacks.py +66 -0
- code_puppy_core_plugins/file_permission_handler/__init__.py +4 -0
- code_puppy_core_plugins/file_permission_handler/register_callbacks.py +575 -0
- code_puppy_core_plugins/flux_bootstrap/__init__.py +5 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/_docs/README.md +173 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/_docs/cheatsheet.md +86 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/_docs/pipeline.md +167 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/_docs/synopsis.md +392 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/about.md +51 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/address-feedback.md +129 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/ask.md +211 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/aug.md +181 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/auto-pilot.md +71 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/cheatsheet.md +16 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/commit.md +103 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/config.md +108 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/create-pr.md +195 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/exec.md +221 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/new.md +151 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/qa.md +208 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/rebase.md +180 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/review.md +304 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/split.md +120 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/squash-commits.md +179 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/status.md +46 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/tests.md +155 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/scripts/flux_about.py +154 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/scripts/flux_cheatsheet.py +248 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/scripts/flux_status.py +345 -0
- code_puppy_core_plugins/flux_bootstrap/installer.py +256 -0
- code_puppy_core_plugins/flux_bootstrap/register_callbacks.py +71 -0
- code_puppy_core_plugins/force_push_guard/__init__.py +5 -0
- code_puppy_core_plugins/force_push_guard/detector.py +96 -0
- code_puppy_core_plugins/force_push_guard/register_callbacks.py +161 -0
- code_puppy_core_plugins/fork/__init__.py +7 -0
- code_puppy_core_plugins/fork/register_callbacks.py +445 -0
- code_puppy_core_plugins/frontend_emitter/__init__.py +25 -0
- code_puppy_core_plugins/frontend_emitter/emitter.py +249 -0
- code_puppy_core_plugins/frontend_emitter/register_callbacks.py +412 -0
- code_puppy_core_plugins/frontend_emitter/session_context.py +50 -0
- code_puppy_core_plugins/grok_oauth/__init__.py +6 -0
- code_puppy_core_plugins/grok_oauth/config.py +49 -0
- code_puppy_core_plugins/grok_oauth/oauth_flow.py +213 -0
- code_puppy_core_plugins/grok_oauth/register_callbacks.py +132 -0
- code_puppy_core_plugins/grok_oauth/utils.py +195 -0
- code_puppy_core_plugins/herdr/README.md +168 -0
- code_puppy_core_plugins/herdr/__init__.py +9 -0
- code_puppy_core_plugins/herdr/client.py +339 -0
- code_puppy_core_plugins/herdr/register_callbacks.py +140 -0
- code_puppy_core_plugins/herdr/reporter.py +212 -0
- code_puppy_core_plugins/herdr/smoke.py +143 -0
- code_puppy_core_plugins/herdr/sources.py +133 -0
- code_puppy_core_plugins/hook_creator/__init__.py +1 -0
- code_puppy_core_plugins/hook_creator/register_callbacks.py +33 -0
- code_puppy_core_plugins/hook_manager/__init__.py +1 -0
- code_puppy_core_plugins/hook_manager/config.py +290 -0
- code_puppy_core_plugins/hook_manager/hooks_menu.py +571 -0
- code_puppy_core_plugins/hook_manager/register_callbacks.py +227 -0
- code_puppy_core_plugins/meta_oauth/__init__.py +1 -0
- code_puppy_core_plugins/meta_oauth/config.py +55 -0
- code_puppy_core_plugins/meta_oauth/oauth_flow.py +109 -0
- code_puppy_core_plugins/meta_oauth/register_callbacks.py +154 -0
- code_puppy_core_plugins/meta_oauth/utils.py +252 -0
- code_puppy_core_plugins/namespace_skill_search/README.md +118 -0
- code_puppy_core_plugins/namespace_skill_search/__init__.py +15 -0
- code_puppy_core_plugins/namespace_skill_search/namespaces.py +125 -0
- code_puppy_core_plugins/namespace_skill_search/register_callbacks.py +99 -0
- code_puppy_core_plugins/namespace_skill_search/search_tool.py +158 -0
- code_puppy_core_plugins/no_tools/__init__.py +0 -0
- code_puppy_core_plugins/no_tools/register_callbacks.py +42 -0
- code_puppy_core_plugins/oauth_pasteback.py +110 -0
- code_puppy_core_plugins/oauth_puppy_html.py +194 -0
- code_puppy_core_plugins/obsidian_agent/README.md +52 -0
- code_puppy_core_plugins/obsidian_agent/__init__.py +8 -0
- code_puppy_core_plugins/obsidian_agent/agent_obsidian.py +147 -0
- code_puppy_core_plugins/obsidian_agent/register_callbacks.py +13 -0
- code_puppy_core_plugins/ollama/__init__.py +1 -0
- code_puppy_core_plugins/ollama/register_callbacks.py +127 -0
- code_puppy_core_plugins/ollama_setup/__init__.py +5 -0
- code_puppy_core_plugins/ollama_setup/completer.py +38 -0
- code_puppy_core_plugins/ollama_setup/register_callbacks.py +419 -0
- code_puppy_core_plugins/plugin_list/__init__.py +0 -0
- code_puppy_core_plugins/plugin_list/plugin_contributions.py +348 -0
- code_puppy_core_plugins/plugin_list/plugin_meta.py +67 -0
- code_puppy_core_plugins/plugin_list/plugin_text_utils.py +173 -0
- code_puppy_core_plugins/plugin_list/plugins_menu.py +455 -0
- code_puppy_core_plugins/plugin_list/plugins_menu_layout.py +194 -0
- code_puppy_core_plugins/plugin_list/plugins_menu_render.py +431 -0
- code_puppy_core_plugins/plugin_list/project_trust_flow.py +162 -0
- code_puppy_core_plugins/plugin_list/register_callbacks.py +281 -0
- code_puppy_core_plugins/pop_command/__init__.py +1 -0
- code_puppy_core_plugins/pop_command/register_callbacks.py +191 -0
- code_puppy_core_plugins/prompt_newline/__init__.py +13 -0
- code_puppy_core_plugins/prompt_newline/config.py +21 -0
- code_puppy_core_plugins/prompt_newline/register_callbacks.py +163 -0
- code_puppy_core_plugins/prune/__init__.py +1 -0
- code_puppy_core_plugins/prune/prune_menu.py +308 -0
- code_puppy_core_plugins/prune/prune_model.py +517 -0
- code_puppy_core_plugins/prune/prune_render.py +354 -0
- code_puppy_core_plugins/prune/register_callbacks.py +388 -0
- code_puppy_core_plugins/puppy_kennel/README.md +203 -0
- code_puppy_core_plugins/puppy_kennel/__init__.py +6 -0
- code_puppy_core_plugins/puppy_kennel/commands.py +206 -0
- code_puppy_core_plugins/puppy_kennel/config.py +36 -0
- code_puppy_core_plugins/puppy_kennel/kennel.py +368 -0
- code_puppy_core_plugins/puppy_kennel/packer.py +152 -0
- code_puppy_core_plugins/puppy_kennel/recorder.py +83 -0
- code_puppy_core_plugins/puppy_kennel/register_callbacks.py +109 -0
- code_puppy_core_plugins/puppy_kennel/retriever.py +28 -0
- code_puppy_core_plugins/puppy_kennel/schema.py +78 -0
- code_puppy_core_plugins/puppy_kennel/state.py +68 -0
- code_puppy_core_plugins/puppy_kennel/tools.py +449 -0
- code_puppy_core_plugins/puppy_kennel/wings.py +110 -0
- code_puppy_core_plugins/puppy_spinner/README.md +93 -0
- code_puppy_core_plugins/puppy_spinner/__init__.py +11 -0
- code_puppy_core_plugins/puppy_spinner/builtin_frames.py +172 -0
- code_puppy_core_plugins/puppy_spinner/commands.py +116 -0
- code_puppy_core_plugins/puppy_spinner/picker.py +379 -0
- code_puppy_core_plugins/puppy_spinner/register_callbacks.py +193 -0
- code_puppy_core_plugins/puppy_spinner/spinners.py +444 -0
- code_puppy_core_plugins/quick_resume/__init__.py +0 -0
- code_puppy_core_plugins/quick_resume/register_callbacks.py +77 -0
- code_puppy_core_plugins/review_pr/__init__.py +1 -0
- code_puppy_core_plugins/review_pr/register_callbacks.py +162 -0
- code_puppy_core_plugins/shell_safety/__init__.py +6 -0
- code_puppy_core_plugins/shell_safety/agent_shell_safety.py +69 -0
- code_puppy_core_plugins/shell_safety/command_cache.py +156 -0
- code_puppy_core_plugins/shell_safety/register_callbacks.py +203 -0
- code_puppy_core_plugins/stack_dump/__init__.py +1 -0
- code_puppy_core_plugins/stack_dump/register_callbacks.py +79 -0
- code_puppy_core_plugins/statusline/__init__.py +14 -0
- code_puppy_core_plugins/statusline/config.py +68 -0
- code_puppy_core_plugins/statusline/payload.py +138 -0
- code_puppy_core_plugins/statusline/prompt_patch.py +76 -0
- code_puppy_core_plugins/statusline/register_callbacks.py +45 -0
- code_puppy_core_plugins/statusline/runner.py +122 -0
- code_puppy_core_plugins/statusline/statusline_command.py +197 -0
- code_puppy_core_plugins/steer_queue/__init__.py +10 -0
- code_puppy_core_plugins/steer_queue/queue_menu.py +444 -0
- code_puppy_core_plugins/steer_queue/register_callbacks.py +138 -0
- code_puppy_core_plugins/subagent_panel/README.md +102 -0
- code_puppy_core_plugins/subagent_panel/__init__.py +24 -0
- code_puppy_core_plugins/subagent_panel/coalesce_patch.py +242 -0
- code_puppy_core_plugins/subagent_panel/panel_render.py +145 -0
- code_puppy_core_plugins/subagent_panel/register_callbacks.py +535 -0
- code_puppy_core_plugins/subagent_panel/resume_repaint.py +112 -0
- code_puppy_core_plugins/subagent_panel/state.py +231 -0
- code_puppy_core_plugins/switch_agent_resume/__init__.py +5 -0
- code_puppy_core_plugins/switch_agent_resume/register_callbacks.py +314 -0
- code_puppy_core_plugins/theme/README.md +86 -0
- code_puppy_core_plugins/theme/__init__.py +14 -0
- code_puppy_core_plugins/theme/bundled_palettes.py +346 -0
- code_puppy_core_plugins/theme/content_styles.py +146 -0
- code_puppy_core_plugins/theme/osc_palette.py +178 -0
- code_puppy_core_plugins/theme/picker.py +358 -0
- code_puppy_core_plugins/theme/prompt_toolkit_theme.py +113 -0
- code_puppy_core_plugins/theme/register_callbacks.py +348 -0
- code_puppy_core_plugins/theme/rich_themes.py +202 -0
- code_puppy_core_plugins/theme/themes.py +720 -0
- code_puppy_core_plugins/timestamp_heartbeat/__init__.py +1 -0
- code_puppy_core_plugins/timestamp_heartbeat/register_callbacks.py +114 -0
- code_puppy_core_plugins/token_ratio_learner/__init__.py +5 -0
- code_puppy_core_plugins/token_ratio_learner/ratios.py +208 -0
- code_puppy_core_plugins/token_ratio_learner/register_callbacks.py +213 -0
- code_puppy_core_plugins/universal_constructor/__init__.py +13 -0
- code_puppy_core_plugins/universal_constructor/models.py +138 -0
- code_puppy_core_plugins/universal_constructor/provider.py +62 -0
- code_puppy_core_plugins/universal_constructor/register_callbacks.py +75 -0
- code_puppy_core_plugins/universal_constructor/registry.py +302 -0
- code_puppy_core_plugins/universal_constructor/sandbox.py +584 -0
- code_puppy_core_plugins/wide_completion_menu/__init__.py +6 -0
- code_puppy_core_plugins/wide_completion_menu/register_callbacks.py +165 -0
- code_puppy_core_plugins/wiggum/__init__.py +1 -0
- code_puppy_core_plugins/wiggum/goal_runs.py +91 -0
- code_puppy_core_plugins/wiggum/judge.py +299 -0
- code_puppy_core_plugins/wiggum/judge_config.py +249 -0
- code_puppy_core_plugins/wiggum/judges_menu.py +814 -0
- code_puppy_core_plugins/wiggum/register_callbacks.py +569 -0
- code_puppy_core_plugins/wiggum/state.py +89 -0
- code_puppy_core_plugins/yolo_cli/__init__.py +1 -0
- code_puppy_core_plugins/yolo_cli/register_callbacks.py +41 -0
- code_puppy_core_plugins-0.0.2.dist-info/METADATA +64 -0
- code_puppy_core_plugins-0.0.2.dist-info/RECORD +313 -0
- code_puppy_core_plugins-0.0.2.dist-info/WHEEL +4 -0
- code_puppy_core_plugins-0.0.2.dist-info/entry_points.txt +55 -0
- code_puppy_core_plugins-0.0.2.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
"""Bundled terminal palettes for OSC-level theming.
|
|
2
|
+
|
|
3
|
+
Each palette ships:
|
|
4
|
+
bg = #rrggbb default background
|
|
5
|
+
fg = #rrggbb default foreground
|
|
6
|
+
ansi = list of 16 #rrggbb hex strings (ANSI slots 0-15)
|
|
7
|
+
|
|
8
|
+
The Catppuccin / Tokyo Night palettes are the canonical
|
|
9
|
+
upstream specs (same ones mure ships). The original theme
|
|
10
|
+
palettes (ocean/forest/sunset/vaporwave) are coherent extensions
|
|
11
|
+
of their existing Rich color schemes.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
# --- Mure-port bundled palettes ---------------------------------------------
|
|
17
|
+
|
|
18
|
+
CATPPUCCIN_MOCHA = {
|
|
19
|
+
"bg": "#1e1e2e",
|
|
20
|
+
"fg": "#cdd6f4",
|
|
21
|
+
"ansi": [
|
|
22
|
+
"#45475a",
|
|
23
|
+
"#f38ba8",
|
|
24
|
+
"#a6e3a1",
|
|
25
|
+
"#f9e2af",
|
|
26
|
+
"#89b4fa",
|
|
27
|
+
"#f5c2e7",
|
|
28
|
+
"#94e2d5",
|
|
29
|
+
"#bac2de",
|
|
30
|
+
"#585b70",
|
|
31
|
+
"#f38ba8",
|
|
32
|
+
"#a6e3a1",
|
|
33
|
+
"#f9e2af",
|
|
34
|
+
"#89b4fa",
|
|
35
|
+
"#f5c2e7",
|
|
36
|
+
"#94e2d5",
|
|
37
|
+
"#a6adc8",
|
|
38
|
+
],
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
CATPPUCCIN_LATTE = {
|
|
42
|
+
"bg": "#eff1f5",
|
|
43
|
+
"fg": "#4c4f69",
|
|
44
|
+
"ansi": [
|
|
45
|
+
"#4c4f69",
|
|
46
|
+
"#d20f39",
|
|
47
|
+
"#40a02b",
|
|
48
|
+
"#df8e1d",
|
|
49
|
+
"#1e66f5",
|
|
50
|
+
"#8839ef",
|
|
51
|
+
"#179299",
|
|
52
|
+
"#acb0be",
|
|
53
|
+
"#5c5f77",
|
|
54
|
+
"#e64553",
|
|
55
|
+
"#a6d189",
|
|
56
|
+
"#fe640b",
|
|
57
|
+
"#7287fd",
|
|
58
|
+
"#ea76cb",
|
|
59
|
+
"#94e2d5",
|
|
60
|
+
"#bcc0cc",
|
|
61
|
+
],
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
TOKYO_NIGHT = {
|
|
65
|
+
"bg": "#1a1b26",
|
|
66
|
+
"fg": "#c0caf5",
|
|
67
|
+
"ansi": [
|
|
68
|
+
"#15161e",
|
|
69
|
+
"#f7768e",
|
|
70
|
+
"#9ece6a",
|
|
71
|
+
"#e0af68",
|
|
72
|
+
"#7aa2f7",
|
|
73
|
+
"#bb9af7",
|
|
74
|
+
"#7dcfff",
|
|
75
|
+
"#a9b1d6",
|
|
76
|
+
"#414868",
|
|
77
|
+
"#f7768e",
|
|
78
|
+
"#9ece6a",
|
|
79
|
+
"#e0af68",
|
|
80
|
+
"#7aa2f7",
|
|
81
|
+
"#bb9af7",
|
|
82
|
+
"#7dcfff",
|
|
83
|
+
"#c0caf5",
|
|
84
|
+
],
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
GREEN_SCREEN = {
|
|
88
|
+
# llxprt-code's Green Screen palette: black glass, green phosphor, and one
|
|
89
|
+
# intentionally eye-searing highlight.
|
|
90
|
+
"bg": "#000000",
|
|
91
|
+
"fg": "#6a9955",
|
|
92
|
+
"ansi": [
|
|
93
|
+
"#000000", # 0 black — CRT glass
|
|
94
|
+
"#6a9955", # 1 red — phosphor green
|
|
95
|
+
"#6a9955", # 2 green — phosphor green
|
|
96
|
+
"#6a9955", # 3 yellow — phosphor green
|
|
97
|
+
"#6a9955", # 4 blue — phosphor green
|
|
98
|
+
"#6a9955", # 5 magenta — phosphor green
|
|
99
|
+
"#6a9955", # 6 cyan — phosphor green
|
|
100
|
+
"#6a9955", # 7 white — phosphor green
|
|
101
|
+
"#3a5945", # 8 bright black — dark phosphor
|
|
102
|
+
"#6a9955", # 9 bright red
|
|
103
|
+
"#00ff00", # 10 bright green — radioactive highlight
|
|
104
|
+
"#6a9955", # 11 bright yellow
|
|
105
|
+
"#6a9955", # 12 bright blue
|
|
106
|
+
"#6a9955", # 13 bright magenta
|
|
107
|
+
"#6a9955", # 14 bright cyan
|
|
108
|
+
"#00ff00", # 15 bright white — radioactive highlight
|
|
109
|
+
],
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
DEEP_BLACK = {
|
|
113
|
+
"bg": "#050505",
|
|
114
|
+
"fg": "#e6e6e6",
|
|
115
|
+
"ansi": [
|
|
116
|
+
"#050505",
|
|
117
|
+
"#ff6b6b",
|
|
118
|
+
"#94d82d",
|
|
119
|
+
"#ffd166",
|
|
120
|
+
"#4dabf7",
|
|
121
|
+
"#b197fc",
|
|
122
|
+
"#63e6be",
|
|
123
|
+
"#adb5bd",
|
|
124
|
+
"#1f1f1f",
|
|
125
|
+
"#ff8787",
|
|
126
|
+
"#a9e34b",
|
|
127
|
+
"#ffe066",
|
|
128
|
+
"#74c0fc",
|
|
129
|
+
"#d0bfff",
|
|
130
|
+
"#96f2d7",
|
|
131
|
+
"#f1f3f5",
|
|
132
|
+
],
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
# --- Light-mode bundled palettes -------------------------------------------
|
|
136
|
+
|
|
137
|
+
SOLARIZED_LIGHT = {
|
|
138
|
+
"bg": "#fdf6e3",
|
|
139
|
+
"fg": "#657b83",
|
|
140
|
+
"ansi": [
|
|
141
|
+
"#073642",
|
|
142
|
+
"#dc322f",
|
|
143
|
+
"#859900",
|
|
144
|
+
"#b58900",
|
|
145
|
+
"#268bd2",
|
|
146
|
+
"#d33682",
|
|
147
|
+
"#2aa198",
|
|
148
|
+
"#eee8d5",
|
|
149
|
+
"#fdf6e3",
|
|
150
|
+
"#cb4b16",
|
|
151
|
+
"#93a1a1",
|
|
152
|
+
"#839496",
|
|
153
|
+
"#657b83",
|
|
154
|
+
"#6c71c4",
|
|
155
|
+
"#586e75",
|
|
156
|
+
"#002b36",
|
|
157
|
+
],
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
GITHUB_LIGHT = {
|
|
161
|
+
"bg": "#ffffff",
|
|
162
|
+
"fg": "#24292e",
|
|
163
|
+
"ansi": [
|
|
164
|
+
"#24292e",
|
|
165
|
+
"#d73a49",
|
|
166
|
+
"#28a745",
|
|
167
|
+
"#dbab09",
|
|
168
|
+
"#0366d6",
|
|
169
|
+
"#6f42c1",
|
|
170
|
+
"#1b7c83",
|
|
171
|
+
"#6a737d",
|
|
172
|
+
"#586069",
|
|
173
|
+
"#cb2431",
|
|
174
|
+
"#22863a",
|
|
175
|
+
"#b08800",
|
|
176
|
+
"#005cc5",
|
|
177
|
+
"#5a32a3",
|
|
178
|
+
"#3192aa",
|
|
179
|
+
"#d1d5da",
|
|
180
|
+
],
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
ROSE_PINE_DAWN = {
|
|
184
|
+
"bg": "#faf4ed",
|
|
185
|
+
"fg": "#575279",
|
|
186
|
+
"ansi": [
|
|
187
|
+
"#f2e9e1",
|
|
188
|
+
"#b4637a",
|
|
189
|
+
"#56949f",
|
|
190
|
+
"#ea9d34",
|
|
191
|
+
"#286983",
|
|
192
|
+
"#907aa9",
|
|
193
|
+
"#d7827e",
|
|
194
|
+
"#575279",
|
|
195
|
+
"#9893a5",
|
|
196
|
+
"#b4637a",
|
|
197
|
+
"#56949f",
|
|
198
|
+
"#ea9d34",
|
|
199
|
+
"#286983",
|
|
200
|
+
"#907aa9",
|
|
201
|
+
"#d7827e",
|
|
202
|
+
"#cecacd",
|
|
203
|
+
],
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
# --- Coherent palettes for the original 4 themes ---------------------------
|
|
207
|
+
|
|
208
|
+
OCEAN = {
|
|
209
|
+
"bg": "#0a1929",
|
|
210
|
+
"fg": "#d6eaf8",
|
|
211
|
+
"ansi": [
|
|
212
|
+
"#0a1929",
|
|
213
|
+
"#e74c3c",
|
|
214
|
+
"#48c9b0",
|
|
215
|
+
"#f4d03f",
|
|
216
|
+
"#3498db",
|
|
217
|
+
"#1abc9c",
|
|
218
|
+
"#5dade2",
|
|
219
|
+
"#aed6f1",
|
|
220
|
+
"#34495e",
|
|
221
|
+
"#ec7063",
|
|
222
|
+
"#1abc9c",
|
|
223
|
+
"#f7dc6f",
|
|
224
|
+
"#5499c7",
|
|
225
|
+
"#48c9b0",
|
|
226
|
+
"#85c1e9",
|
|
227
|
+
"#ebf5fb",
|
|
228
|
+
],
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
FOREST = {
|
|
232
|
+
"bg": "#1a2310",
|
|
233
|
+
"fg": "#e3eecc",
|
|
234
|
+
"ansi": [
|
|
235
|
+
"#1a2310",
|
|
236
|
+
"#c0392b",
|
|
237
|
+
"#27ae60",
|
|
238
|
+
"#d4ac0d",
|
|
239
|
+
"#7d6608",
|
|
240
|
+
"#16a085",
|
|
241
|
+
"#1e8449",
|
|
242
|
+
"#aed581",
|
|
243
|
+
"#52682d",
|
|
244
|
+
"#cd6155",
|
|
245
|
+
"#52be80",
|
|
246
|
+
"#f4d03f",
|
|
247
|
+
"#7d6608",
|
|
248
|
+
"#48c9b0",
|
|
249
|
+
"#7dcea0",
|
|
250
|
+
"#eaf2cf",
|
|
251
|
+
],
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
SUNSET = {
|
|
255
|
+
"bg": "#2d1b0e",
|
|
256
|
+
"fg": "#ffe4cc",
|
|
257
|
+
"ansi": [
|
|
258
|
+
"#2d1b0e",
|
|
259
|
+
"#e74c3c",
|
|
260
|
+
"#d35400",
|
|
261
|
+
"#f39c12",
|
|
262
|
+
"#7d3c98",
|
|
263
|
+
"#c0392b",
|
|
264
|
+
"#e67e22",
|
|
265
|
+
"#fad7a0",
|
|
266
|
+
"#5d4037",
|
|
267
|
+
"#ec7063",
|
|
268
|
+
"#e67e22",
|
|
269
|
+
"#f9e79f",
|
|
270
|
+
"#a93226",
|
|
271
|
+
"#d35400",
|
|
272
|
+
"#f5b041",
|
|
273
|
+
"#fdebd0",
|
|
274
|
+
],
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
VAPORWAVE = {
|
|
278
|
+
"bg": "#16002a",
|
|
279
|
+
"fg": "#ffe0ff",
|
|
280
|
+
"ansi": [
|
|
281
|
+
"#16002a",
|
|
282
|
+
"#ff6ec7",
|
|
283
|
+
"#48c9b0",
|
|
284
|
+
"#f7dc6f",
|
|
285
|
+
"#bb6bd9",
|
|
286
|
+
"#ec407a",
|
|
287
|
+
"#7fdbff",
|
|
288
|
+
"#e8daef",
|
|
289
|
+
"#5b2c6f",
|
|
290
|
+
"#ff79c6",
|
|
291
|
+
"#80deea",
|
|
292
|
+
"#fff59d",
|
|
293
|
+
"#d7bde2",
|
|
294
|
+
"#f06292",
|
|
295
|
+
"#80deea",
|
|
296
|
+
"#fce4ec",
|
|
297
|
+
],
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
PURPLE_PUPPY = {
|
|
301
|
+
# Purple puppy mascot colors: violet fur, lavender muzzle, pink tongue, and
|
|
302
|
+
# an inky background.
|
|
303
|
+
"bg": "#1c0630",
|
|
304
|
+
"fg": "#f0e3ff",
|
|
305
|
+
"ansi": [
|
|
306
|
+
"#2a0a45", # 0 black — dark plum outline
|
|
307
|
+
"#ff5c8a", # 1 red — tongue pink-red
|
|
308
|
+
"#c986ff", # 2 green — bright orchid fur highlight
|
|
309
|
+
"#f5c26b", # 3 yellow — warm gold (warnings still warn)
|
|
310
|
+
"#9b30d9", # 4 blue — vivid violet fur
|
|
311
|
+
"#ff7fa8", # 5 magenta — tongue pink
|
|
312
|
+
"#d9a7f5", # 6 cyan — soft lilac
|
|
313
|
+
"#f0e3ff", # 7 white — muzzle lavender-white
|
|
314
|
+
"#a98aca", # 8 bright black — readable muted lavender
|
|
315
|
+
"#ff7fa8", # 9 bright red
|
|
316
|
+
"#dba1ff", # 10 bright green
|
|
317
|
+
"#ffd58f", # 11 bright yellow
|
|
318
|
+
"#b06be8", # 12 bright blue
|
|
319
|
+
"#ff9fd2", # 13 bright magenta
|
|
320
|
+
"#e8ccff", # 14 bright cyan
|
|
321
|
+
"#fdf7ff", # 15 bright white — muzzle shine
|
|
322
|
+
],
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
BUBBLEGUM_PINK = {
|
|
326
|
+
"bg": "#2a0f1f",
|
|
327
|
+
"fg": "#fff1f7",
|
|
328
|
+
"ansi": [
|
|
329
|
+
"#2a0f1f",
|
|
330
|
+
"#ff5fa2",
|
|
331
|
+
"#ff8ec7",
|
|
332
|
+
"#ffd1e8",
|
|
333
|
+
"#ff4f93",
|
|
334
|
+
"#d96cff",
|
|
335
|
+
"#ff9fd2",
|
|
336
|
+
"#fff1f7",
|
|
337
|
+
"#4d1d39",
|
|
338
|
+
"#ff7ab2",
|
|
339
|
+
"#ffb3da",
|
|
340
|
+
"#ffe0ef",
|
|
341
|
+
"#ff6fb0",
|
|
342
|
+
"#eb8cff",
|
|
343
|
+
"#ffc4e1",
|
|
344
|
+
"#fff8fb",
|
|
345
|
+
],
|
|
346
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"""Content-text style theming (level 1).
|
|
2
|
+
|
|
3
|
+
The banner plugin already paints the banner headers. This module paints the
|
|
4
|
+
body text underneath by mutating the `RichConsoleRenderer`'s style maps.
|
|
5
|
+
|
|
6
|
+
Two upstream knobs:
|
|
7
|
+
code_puppy.messaging.rich_renderer.DEFAULT_STYLES (MessageLevel -> style)
|
|
8
|
+
code_puppy.messaging.rich_renderer.DIFF_STYLES ({add,remove,context} -> style)
|
|
9
|
+
|
|
10
|
+
These dicts are **copied** by `RichConsoleRenderer.__init__`. Mutating them
|
|
11
|
+
after construction won't affect already-running renderers, so we also reach
|
|
12
|
+
into live renderer instances (via gc) and update their `_styles` dict in place.
|
|
13
|
+
|
|
14
|
+
Pure logic + a small amount of surgical monkey patching. Config-persisted so
|
|
15
|
+
preferences survive restarts.
|
|
16
|
+
|
|
17
|
+
Zen: namespaces are one honking great idea; we keep everything in one place.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
import gc
|
|
23
|
+
from typing import Callable
|
|
24
|
+
|
|
25
|
+
from code_puppy.config import get_value, set_config_value
|
|
26
|
+
from code_puppy.messaging import rich_renderer
|
|
27
|
+
from code_puppy.messaging.messages import MessageLevel
|
|
28
|
+
|
|
29
|
+
# --- The 8 themable content keys -------------------------------------------
|
|
30
|
+
# We expose a flat string-keyed namespace so config persistence is trivial.
|
|
31
|
+
CONTENT_KEYS: tuple[str, ...] = (
|
|
32
|
+
"info",
|
|
33
|
+
"warning",
|
|
34
|
+
"success",
|
|
35
|
+
"error",
|
|
36
|
+
"debug",
|
|
37
|
+
"diff_add",
|
|
38
|
+
"diff_remove",
|
|
39
|
+
"diff_context",
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
_LEVEL_KEYS: dict[str, MessageLevel] = {
|
|
43
|
+
"info": MessageLevel.INFO,
|
|
44
|
+
"warning": MessageLevel.WARNING,
|
|
45
|
+
"success": MessageLevel.SUCCESS,
|
|
46
|
+
"error": MessageLevel.ERROR,
|
|
47
|
+
"debug": MessageLevel.DEBUG,
|
|
48
|
+
}
|
|
49
|
+
_DIFF_KEYS: dict[str, str] = {
|
|
50
|
+
"diff_add": "add",
|
|
51
|
+
"diff_remove": "remove",
|
|
52
|
+
"diff_context": "context",
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# Snapshot taken at import time (before any mutation). This becomes our
|
|
56
|
+
# "factory default" for restore.
|
|
57
|
+
DEFAULT_CONTENT_STYLES: dict[str, str] = {
|
|
58
|
+
**{k: rich_renderer.DEFAULT_STYLES[lvl] for k, lvl in _LEVEL_KEYS.items()},
|
|
59
|
+
**{k: rich_renderer.DIFF_STYLES[v] for k, v in _DIFF_KEYS.items()},
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_CONFIG_PREFIX = "content_style_"
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# --- Persistence helpers ----------------------------------------------------
|
|
66
|
+
def _config_key(name: str) -> str:
|
|
67
|
+
return f"{_CONFIG_PREFIX}{name}"
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def get_content_style(name: str) -> str:
|
|
71
|
+
"""Return current style for `name`, falling back to the factory default."""
|
|
72
|
+
if name not in DEFAULT_CONTENT_STYLES:
|
|
73
|
+
raise KeyError(f"Unknown content style: {name!r}")
|
|
74
|
+
return get_value(_config_key(name)) or DEFAULT_CONTENT_STYLES[name]
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def get_all_content_styles() -> dict[str, str]:
|
|
78
|
+
"""Return the current effective mapping for every content key."""
|
|
79
|
+
return {name: get_content_style(name) for name in CONTENT_KEYS}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _persist(mapping: dict[str, str]) -> None:
|
|
83
|
+
for name, style in mapping.items():
|
|
84
|
+
set_config_value(_config_key(name), style)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# --- Mutation -------------------------------------------------------------
|
|
88
|
+
def _push_to_renderers(mapping: dict[str, str]) -> None:
|
|
89
|
+
"""Push a {content_key: style} mapping into module dicts AND live renderers.
|
|
90
|
+
|
|
91
|
+
Live renderers copy `DEFAULT_STYLES` at __init__, so mutating the module
|
|
92
|
+
dict isn't enough — we walk live instances and patch them too.
|
|
93
|
+
"""
|
|
94
|
+
# 1. Module-level dicts (in case fresh renderers spawn later)
|
|
95
|
+
for k, lvl in _LEVEL_KEYS.items():
|
|
96
|
+
rich_renderer.DEFAULT_STYLES[lvl] = mapping[k]
|
|
97
|
+
for k, diff_key in _DIFF_KEYS.items():
|
|
98
|
+
rich_renderer.DIFF_STYLES[diff_key] = mapping[k]
|
|
99
|
+
|
|
100
|
+
# 2. Live renderer instances (the ones actually painting your terminal)
|
|
101
|
+
try:
|
|
102
|
+
for obj in gc.get_objects():
|
|
103
|
+
if isinstance(obj, rich_renderer.RichConsoleRenderer):
|
|
104
|
+
styles = getattr(obj, "_styles", None)
|
|
105
|
+
if isinstance(styles, dict):
|
|
106
|
+
for k, lvl in _LEVEL_KEYS.items():
|
|
107
|
+
styles[lvl] = mapping[k]
|
|
108
|
+
except Exception:
|
|
109
|
+
# gc walks can be flaky in odd interpreters; never let that nuke UX
|
|
110
|
+
pass
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def apply_content_styles(
|
|
114
|
+
mapping: dict[str, str],
|
|
115
|
+
persist: bool = True,
|
|
116
|
+
setter: Callable[[dict[str, str]], None] | None = None,
|
|
117
|
+
) -> None:
|
|
118
|
+
"""Apply a content style mapping live + (optionally) persist it.
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
mapping: dict with every key in CONTENT_KEYS.
|
|
122
|
+
persist: if True, write to config so it survives restarts.
|
|
123
|
+
setter: injectable for tests; defaults to the real persister.
|
|
124
|
+
"""
|
|
125
|
+
missing = set(CONTENT_KEYS) - mapping.keys()
|
|
126
|
+
if missing:
|
|
127
|
+
raise ValueError(f"Content style mapping missing keys: {sorted(missing)}")
|
|
128
|
+
|
|
129
|
+
_push_to_renderers(mapping)
|
|
130
|
+
if persist:
|
|
131
|
+
(setter or _persist)(mapping)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def restore_defaults(persist: bool = True) -> dict[str, str]:
|
|
135
|
+
"""Restore factory-default content styles. Returns the mapping applied."""
|
|
136
|
+
apply_content_styles(DEFAULT_CONTENT_STYLES, persist=persist)
|
|
137
|
+
return dict(DEFAULT_CONTENT_STYLES)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def reapply_from_config() -> None:
|
|
141
|
+
"""On plugin load, push any persisted overrides into the live renderer.
|
|
142
|
+
|
|
143
|
+
Safe to call multiple times; no-op if config has no overrides
|
|
144
|
+
(since get_content_style falls back to defaults).
|
|
145
|
+
"""
|
|
146
|
+
_push_to_renderers(get_all_content_styles())
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"""Terminal-level palette swap via OSC escape sequences.
|
|
2
|
+
|
|
3
|
+
This module reaches *past* Code Puppy and recolors the whole terminal window
|
|
4
|
+
(bg, fg, ANSI palette slots) using widely-supported xterm OSC sequences:
|
|
5
|
+
|
|
6
|
+
OSC 10 ; spec BEL -> set default foreground
|
|
7
|
+
OSC 11 ; spec BEL -> set default background
|
|
8
|
+
OSC 4 ; N ; spec BEL -> set ANSI palette slot N (0..15)
|
|
9
|
+
OSC 110 BEL -> reset foreground
|
|
10
|
+
OSC 111 BEL -> reset background
|
|
11
|
+
OSC 104 BEL -> reset whole palette
|
|
12
|
+
|
|
13
|
+
Supported by iTerm2, Terminal.app, Alacritty, kitty, VS Code, GNOME
|
|
14
|
+
Terminal, Windows Terminal. Unsupported terminals silently ignore them.
|
|
15
|
+
|
|
16
|
+
We always register an atexit handler so the terminal is restored when
|
|
17
|
+
Code Puppy quits, even if the user forgets to /theme default first.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
import atexit
|
|
23
|
+
import json
|
|
24
|
+
import sys
|
|
25
|
+
from typing import Optional, Sequence
|
|
26
|
+
|
|
27
|
+
from code_puppy.config import get_value, set_config_value
|
|
28
|
+
|
|
29
|
+
BEL = "\007"
|
|
30
|
+
ESC = "\033"
|
|
31
|
+
|
|
32
|
+
_CONFIG_KEY = "osc_palette_json"
|
|
33
|
+
_atexit_registered = False
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# --- Low-level emit ---------------------------------------------------------
|
|
37
|
+
def _emit(seq: str) -> None:
|
|
38
|
+
"""Write an escape sequence to stdout, ignoring failures (closed tty etc.)."""
|
|
39
|
+
try:
|
|
40
|
+
sys.stdout.write(seq)
|
|
41
|
+
sys.stdout.flush()
|
|
42
|
+
except Exception:
|
|
43
|
+
pass
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _osc(code: str, *args: str) -> str:
|
|
47
|
+
"""Build an OSC escape: ESC ] code ; args... BEL"""
|
|
48
|
+
payload = ";".join((code,) + args)
|
|
49
|
+
return f"{ESC}]{payload}{BEL}"
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# --- Public escape builders -------------------------------------------------
|
|
53
|
+
def set_bg(color: str) -> None:
|
|
54
|
+
_emit(_osc("11", color))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def set_fg(color: str) -> None:
|
|
58
|
+
_emit(_osc("10", color))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def set_ansi_slot(slot: int, color: str) -> None:
|
|
62
|
+
if not 0 <= slot <= 15:
|
|
63
|
+
return
|
|
64
|
+
_emit(_osc("4", str(slot), color))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def reset_bg() -> None:
|
|
68
|
+
_emit(_osc("111"))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def reset_fg() -> None:
|
|
72
|
+
_emit(_osc("110"))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def reset_ansi() -> None:
|
|
76
|
+
_emit(_osc("104"))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# --- High-level API ---------------------------------------------------------
|
|
80
|
+
def apply_palette(
|
|
81
|
+
palette: dict, persist: bool = True, register_reset: bool = True
|
|
82
|
+
) -> None:
|
|
83
|
+
"""Apply a palette dict to the live terminal.
|
|
84
|
+
|
|
85
|
+
Palette shape:
|
|
86
|
+
{
|
|
87
|
+
"bg": "#rrggbb", # optional
|
|
88
|
+
"fg": "#rrggbb", # optional
|
|
89
|
+
"ansi": ["#rrggbb", ...] # optional, 0..16 entries
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
`persist=True` writes the palette to config so the next Code Puppy
|
|
93
|
+
session can replay it. `register_reset=True` ensures we always
|
|
94
|
+
restore the terminal at process exit.
|
|
95
|
+
"""
|
|
96
|
+
if not isinstance(palette, dict):
|
|
97
|
+
return
|
|
98
|
+
|
|
99
|
+
bg = palette.get("bg")
|
|
100
|
+
fg = palette.get("fg")
|
|
101
|
+
ansi: Sequence[str] = palette.get("ansi") or []
|
|
102
|
+
|
|
103
|
+
if bg:
|
|
104
|
+
set_bg(bg)
|
|
105
|
+
if fg:
|
|
106
|
+
set_fg(fg)
|
|
107
|
+
for i, color in enumerate(ansi[:16]):
|
|
108
|
+
if color:
|
|
109
|
+
set_ansi_slot(i, color)
|
|
110
|
+
|
|
111
|
+
if persist:
|
|
112
|
+
try:
|
|
113
|
+
set_config_value(_CONFIG_KEY, json.dumps(palette))
|
|
114
|
+
except Exception:
|
|
115
|
+
pass
|
|
116
|
+
|
|
117
|
+
if register_reset:
|
|
118
|
+
_ensure_atexit_registered()
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def reset_palette(persist: bool = True) -> None:
|
|
122
|
+
"""Restore the terminal's original bg/fg/ANSI palette."""
|
|
123
|
+
reset_ansi()
|
|
124
|
+
reset_bg()
|
|
125
|
+
reset_fg()
|
|
126
|
+
if persist:
|
|
127
|
+
try:
|
|
128
|
+
set_config_value(_CONFIG_KEY, "")
|
|
129
|
+
except Exception:
|
|
130
|
+
pass
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def get_saved_palette() -> Optional[dict]:
|
|
134
|
+
"""Read the persisted palette (or None if nothing saved)."""
|
|
135
|
+
raw = get_value(_CONFIG_KEY)
|
|
136
|
+
if not raw:
|
|
137
|
+
return None
|
|
138
|
+
try:
|
|
139
|
+
data = json.loads(raw)
|
|
140
|
+
if isinstance(data, dict):
|
|
141
|
+
return data
|
|
142
|
+
except Exception:
|
|
143
|
+
pass
|
|
144
|
+
return None
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def reapply_from_config() -> None:
|
|
148
|
+
"""On plugin load, re-fire any persisted palette into the terminal."""
|
|
149
|
+
palette = get_saved_palette()
|
|
150
|
+
if palette:
|
|
151
|
+
apply_palette(palette, persist=False)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
# --- Cleanup ----------------------------------------------------------------
|
|
155
|
+
def _at_exit_reset() -> None:
|
|
156
|
+
"""Best-effort terminal restore on Python exit.
|
|
157
|
+
|
|
158
|
+
We DON'T touch persisted config here — if the user wants the palette
|
|
159
|
+
next session, they get it; this just makes sure the live terminal
|
|
160
|
+
doesn't stay stuck in a weird color after Code Puppy dies.
|
|
161
|
+
"""
|
|
162
|
+
try:
|
|
163
|
+
reset_ansi()
|
|
164
|
+
reset_bg()
|
|
165
|
+
reset_fg()
|
|
166
|
+
except Exception:
|
|
167
|
+
pass
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def _ensure_atexit_registered() -> None:
|
|
171
|
+
global _atexit_registered
|
|
172
|
+
if _atexit_registered:
|
|
173
|
+
return
|
|
174
|
+
try:
|
|
175
|
+
atexit.register(_at_exit_reset)
|
|
176
|
+
_atexit_registered = True
|
|
177
|
+
except Exception:
|
|
178
|
+
pass
|