feat(plugins): add prompt_newline plugin with /prompt_newline toggle#321
Merged
mpfaffenberger merged 1 commit intompfaffenberger:mainfrom May 6, 2026
Merged
Conversation
Tiny ergonomics hack: when enabled, drops user input onto a fresh line below the puppy/agent/model/cwd prompt chrome so long cwd paths don't squeeze the typing area. * New plugin: code_puppy/plugins/prompt_newline/ * Hooks: startup (monkey-patches get_prompt_with_active_model), custom_command (/prompt_newline [on|off|toggle]), custom_command_help * Persisted via puppy.cfg key 'prompt_newline'. Default: OFF. * Toggle takes effect immediately (no restart) since the wrapper checks is_enabled() at call time. * Tests: tests/plugins/test_prompt_newline_plugin.py (12 cases)
mpfaffenberger
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🐶 feat(plugins): add
prompt_newlineplugin with/prompt_newlinetoggleWhat
Adds a tiny opt-in ergonomics plugin that drops user input onto a fresh line below the puppy/agent/model/cwd prompt chrome. Helpful when your
cwdis a 90-character monstrosity and there's no horizontal room left to type.Before (default, unchanged):
After enabling
/prompt_newline on:Why
Long working-directory paths squeeze the input area to nothing on standard terminal widths. A trailing newline on the prompt is the cheapest possible fix without redesigning the chrome. Some folks love it, some hate it — so it's off by default and toggleable per user, persisted in
puppy.cfg.How (per CONTRIBUTING.md)
This is a plugin, not a core change. Lives entirely under
code_puppy/plugins/prompt_newline/and uses three documented hooks fromcode_puppy/callbacks.py:startupget_prompt_with_active_modelto optionally append("", "\n")to the returnedFormattedText. The wrapper re-checksis_enabled()at call time, so the slash-command toggle takes effect immediately — no restart.custom_command/prompt_newline [on|off|toggle]. Bare/prompt_newlineflips the current state.custom_command_help/help.State is persisted to
puppy.cfgvia the existingget_value/set_config_valuehelpers (mirrors thedbos_durable_execplugin pattern). Default is OFF — opting in is a one-line PR-from-the-user's perspective.The monkey-patch is idempotent (guarded by a sentinel attribute) and fail-soft (any exception in the wrapper falls back to the original
FormattedText, never crashes the prompt).Files
Total: 378 LOC (well under the 600-line cap; no file approaches it).
Tests
12 new test cases in
tests/plugins/test_prompt_newline_plugin.pycovering:/helpentry registrationon/off/true/false/1/0/yes/no/enable/disable/toggle)_append_newlinepurity (doesn't mutate the originalFormattedText)_install_prompt_patchidempotency + original-function preservationis_enabled()returns Trueonpersists topuppy.cfg/prompt_newlineflips state correctly(Also re-ran
tests/test_prompt_toolkit_completion.pyto confirm zero regressions in the patched module.)Lint
ruff check --fixandruff formatboth clean.Backwards compatibility
✅ Zero behavior change for existing users. Default is OFF; users must opt in with
/prompt_newline on.Future work (not in this PR)
If demand materializes, the same plugin could grow:
CODE_PUPPY_PROMPT_NEWLINE=1)/set prompt_newline trueintegration via the existing settings completer↵glyph)Intentionally YAGNI'd for now.