Skip to content

Support external commands for custom jobs #27

Description

@ho991217

Context

Allow custom transformers written in other languages while keeping pull-up responsible for collecting inputs, comparing results, and writing outputs.

This builds on YAML configuration support.

Proposed work

#26 must be implemented before this.

Add type: custom with an executable and argument array:

jobs:
  ownership:
    type: custom
    command: "python3 scripts/ownership.py"
    input: ["packages/**/ownership.yaml"]
    output: ".github/CODEOWNERS"

Run one process per custom job from the repository root, without shell interpretation. Send a single UTF-8 JSON document through stdin:

{
  "protocolVersion": 1,
  "sources": [
    {
      "path": "packages/example/ownership.yaml",
      "contents": "owners: [\"@example-team\"]\n"
    }
  ],
  "context": {
    "rootDir": "/workspace/repo",
    "outputPath": "/workspace/repo/.github/CODEOWNERS"
  }
}

Source paths are repository-relative; context paths are absolute. Stdout contains generated contents, and stderr contains diagnostics. Transformers return contents without modifying files directly; consuming repositories provide the required runtimes.

Acceptance criteria

  • Each sync, check, or sync --dry-run invocation runs the transformer. Only sync writes changed outputs.
  • Deduplicate sources and sort paths by UTF-8 bytes. Preserve contents exactly, allow empty sources/output, and reject invalid UTF-8.
  • Report startup, stdin delivery, nonzero exit, signal, and output-read failures. Accept results only after complete input delivery and output collection.
  • Complete all input collection and transformations before writing outputs. Failures or cancellation leave outputs unchanged and clean up active processes.
  • Document migration from callback-based jobs and provide a working transformer example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions