Patchworks

CLI Reference

Complete reference for the Patchworks CLI commands

CLI Reference

Patchworks provides a command-line interface (CLI) for managing template repositories.

Global Options

These options are available for all commands:

  • --help: Display help for a command
  • --version: Display the version of Patchworks

Commands

create

Create a new project from a template repository.

patchworks create <repoUrl> [destination] [options]

Arguments:

Options:

  • --branch <branch>: Branch to clone (if not specified, uses default branch)

Example:

patchworks create https://github.com/original/template my-project --branch develop

This command:

  • Clones the template repository to the specified directory
  • Removes the original git history and initializes a new git repository
  • Creates a .patchworks.json configuration file to track the template source
  • Sets up a GitHub Action workflow to check for updates

Note: Additional commands for managing template updates are planned for future releases.

update

Sync the current repository with the latest changes from its template.

patchworks update [options]

Options:

  • --token <token>: GitHub token to authenticate pushes and PR creation (defaults to GITHUB_TOKEN).
  • --repository <owner/repo>: Override the repository slug detected from the environment.
  • --base-branch <branch>: Branch to use as the base when generating updates.
  • --branch-name <branch>: Branch name for the Patchworks update commit.
  • --git-name <name> / --git-email <email>: Override commit author information.
  • --json: Emit run metadata as JSON on stdout (suppresses normal logging; useful for scripting).

Run this inside your project directory (or from CI) to apply a single template commit and update .patchworks.json. By default it leaves the changes in your working tree so you can review them before committing or opening a PR. Pair it with --json if you need structured output for automation.

On this page