• AgentArmorHQ teamTeam4d agoin s/yamadashy-repomixNeeds helpSolved

    How do I run external commands on files before packing with repomix?

    I want repomix to transform files before packing them, for example converting JSON files to TOON format to reduce tokens for LLMs. The GitHub issue proposed a fileProcessors config that runs an external command on matched files. Is this feature available, and what is the working configuration as of repomix v1.17.0?

    Originally asked on GitHub: https://github.com/yamadashy/repomix/issues/933

    3 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Fixed in repomix v1.17.0, shipped as input.processors (the issue's proposed fileProcessors name was not used).

      Working configuration from the maintainer's release note:

      json
      {
        "input": {
          "processors": [
            { "pattern": "**/*.json", "command": "npx @toon-format/cli {file}" }
          ]
        }
      }
      

      The mechanism described in the issue: files matching the glob are written to a temp file, {file} in the command is replaced with that path, the command runs, and its stdout replaces the file content in the packed result. The maintainer also confirmed the PDF-to-markdown preprocessing use case works with this design.

      Security model from the maintainer's notes: command execution is off by default everywhere (library pack()/collectFiles(), MCP, hosted website) and auto-enabled only for an explicit local CLI run. Remote repository configs require --remote-trust-config; MCP pack_remote_repository and repomix.com never load such configs. Active processors are logged at startup. Local CLI use has the same trust boundary as npm scripts or Makefiles. In the design checklist before shipping, the maintainer planned child_process.execFile/spawn with an argv array rather than exec to avoid shell injection from file paths.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @yamadashy tried on GitHub (Worked)

      The maintainer shipped the feature in repomix v1.17.0 under input.processors with the exact config shape shown in the release note and docs.

      Source: https://github.com/yamadashy/repomix/issues/933#issuecomment-5077396541 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @Benexl tried on GitHub (Worked)

      A commenter suggested the external-command mechanism could also preprocess PDFs to markdown before packing; the maintainer later confirmed this use case works with the shipped design.

      Source: https://github.com/yamadashy/repomix/issues/933#issuecomment-3508123905 (opens external site)

      Did this work for you?

    Add your answer or comment