{"id":22325983,"url":"https://github.com/vdbulcke/json-patcher","last_synced_at":"2025-03-26T06:11:37.914Z","repository":{"id":107608732,"uuid":"609549338","full_name":"vdbulcke/json-patcher","owner":"vdbulcke","description":"CLI tool to apply JSON Patch (RFC 6902)","archived":false,"fork":false,"pushed_at":"2023-11-01T11:07:53.000Z","size":617,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T07:31:51.990Z","etag":null,"topics":["cli","json-patch","rfc-6902","tui"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vdbulcke.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-04T14:14:22.000Z","updated_at":"2023-03-25T10:15:07.000Z","dependencies_parsed_at":"2023-11-01T12:30:11.229Z","dependency_job_id":null,"html_url":"https://github.com/vdbulcke/json-patcher","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdbulcke%2Fjson-patcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdbulcke%2Fjson-patcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdbulcke%2Fjson-patcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdbulcke%2Fjson-patcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vdbulcke","download_url":"https://codeload.github.com/vdbulcke/json-patcher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245598320,"owners_count":20641884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","json-patch","rfc-6902","tui"],"created_at":"2024-12-04T02:14:54.844Z","updated_at":"2025-03-26T06:11:37.896Z","avatar_url":"https://github.com/vdbulcke.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON Patcher\n\n## Description \n\n`json-patcher` is a CLI tools to applying a list of JSON patch (rfc6902) from a declarative config file. Think of it as [kustomize patch](https://kubectl.docs.kubernetes.io/references/kustomize/builtins/#_patchesjson6902_) but for arbitrary JSON files. \n\nAt it's core it is using the [\"github.com/evanphx/json-patch/v5\"](https://github.com/evanphx/json-patch) library.\n\n## Install \n\nDownload the binaries from the [releases](https://github.com/vdbulcke/json-patcher/releases) page. \n\n### Validate Signature With Cosign\n\nMake sure you have `cosign` installed locally (see [Cosign Install](https://docs.sigstore.dev/cosign/installation/)).\n\n\nThen you can use the `./verify_signature.sh` in this repo: \n\n```bash\n./verify_signature.sh PATH_TO_DOWNLOADED_ARCHIVE TAG_VERSION\n```\nfor example\n```bash\n$ ./verify_signature.sh ~/Downloads/json-patcher_0.1.0_Linux_x86_64.tar.gz v0.1.0\n\nChecking Signature for version: v0.1.0\nVerified OK\n\n```\n\n\n### Add To PATH \n\n\n\n```bash\nsudo mv json-patcher /usr/local/bin/\n```\n\n## Getting Started\n\n\n\nCreate a patch file `patch.yaml`: \n```yaml\n---\n## List of patches\npatches:\n\n## Patch on a source and a destination\n- \n  ## source:  same as '{}' as source file\n  source: NEW\n  ## destination: where the json should be written after \n  ##              all patches have been applied\n  destination: ./generated.json\n  json_patch: |-\n    ## this is a first patch \n    - op: add\n      path: \"/foo\"\n      value: \"baz\"\n    ## this is a second patch \n    - op: add\n      path: \"/hello\"\n      value: \"world\"\n\n## You can add here another list of json_patch to another sources and/or destinations\n```\n\n\nApply the patch\n```bash\njson-patcher apply -p patch.yaml\n```\n\nSee the result\n```bash\n$ cat generated.json \n{\"foo\":\"baz\",\"hello\":\"world\"}\n```\n\nSee [./example/patch.yaml](./example/patch.yaml) for details information about configuration of patches.\n\n\n## CLI Usage \n\nSee [json-patcher](./doc/json-patcher.md) for CLI usage.\n\n## Completion \n\nSee [json-patcher completion](./doc/json-patcher_completion.md).\n\n\n## Interactive Terminal UI \n\n`json-patcher interactive` leverages [charmbracelet/bubbletea](https://github.com/charmbracelet/bubbletea) to display an interactive applications within your terminal. \n\n\nStart the TUI with:\n```bash\njson-patcher interactive -p patch.yaml\n```\n\u003e NOTE: `json-patcher interactive` supports the same arguments as `json-patcher apply` subcommand\n\n\u003cimg  src=./example/demo.gif width=\"700\"/\u003e\n\n\u003e The above example was generated with VHS ([view source](./example/demo.tape)).\n\n\n### List View\n\nThe list view will display the list of patches (filtered by `source_not_exist` and `--skip-tags`).\n\nKey Binding\n\n| Key | Action |\n|  -- | -- | \n| Arrow UP | Move up the list |\n| Arrow DOWN | Move Down the list |\n| Arrow LEFT | Move left the pager |\n| Arrow RIGHT | Move right the pager |\n| ENTER | View Current Patch |\n| x | Delete patch from list |\n| / | Trigger fuzzy filter  |\n| ? | Help | \n| q | Quit | \n| CTRL+C | Quit |\n\n### Current Patch View\n\nKey Binding\n\n| Key | Action |\n|  -- | -- | \n| Arrow UP | Move up the pager |\n| Arrow DOWN | Move Down the pager |\n| p | Preview Current Patch |\n| t | Toggle `--allow-unescaped-html` flag |\n| a | Apply current Patch **(*)**  |\n| q | Back |\n| ESC | Back |\n| CTRL+C | Quit |\n\n\u003e **(*)** If teh current patch's Destination is STDOUT \"applying\" the patch is the same as \"previewing\" the patch\n\n\u003e NOTE: same Key binding for \"Current Patch Info\", \"Preview Patch\", and \"Apply Patch Result\" view.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdbulcke%2Fjson-patcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvdbulcke%2Fjson-patcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdbulcke%2Fjson-patcher/lists"}