Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Code Formatter Plugin

Formats code/text outputs with lightweight, dependency-free normalization:

  • Trim trailing whitespace
  • Normalize indentation (tabs → spaces)
  • Ensure single trailing newline
  • Optional JSON pretty-printing
  • Optional Markdown/code fence cleanup

Hooks

  • tool_post_invoke
  • resource_post_fetch

Configuration (example)

- name: "CodeFormatter"
  kind: "plugins.code_formatter.code_formatter.CodeFormatterPlugin"
  hooks: ["tool_post_invoke", "resource_post_fetch"]
  mode: "permissive"
  priority: 180
  config:
    languages: ["python", "json", "markdown", "shell"]
    tab_width: 4
    trim_trailing: true
    ensure_newline: true
    dedent_code: true
    format_json: true
    max_size_kb: 512

Notes

  • No external formatters are invoked; it's safe and fast.
  • For JSON, the plugin attempts to parse then pretty-print; on failure it falls back to generic normalization.
  • The plugin respects max_size_kb to avoid large payload overhead.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.