{"id":15707171,"url":"https://github.com/smacker/gum","last_synced_at":"2025-05-12T19:27:35.702Z","repository":{"id":57502490,"uuid":"179563614","full_name":"smacker/gum","owner":"smacker","description":"Gum is a library to compute differences between ASTs using gum tree-diff algorithm.","archived":false,"fork":false,"pushed_at":"2019-12-10T20:21:02.000Z","size":141,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T02:46:30.899Z","etag":null,"topics":[],"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/smacker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-04T19:28:04.000Z","updated_at":"2022-08-13T02:43:52.000Z","dependencies_parsed_at":"2022-09-13T07:02:18.995Z","dependency_job_id":null,"html_url":"https://github.com/smacker/gum","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smacker%2Fgum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smacker%2Fgum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smacker%2Fgum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smacker%2Fgum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smacker","download_url":"https://codeload.github.com/smacker/gum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253807589,"owners_count":21967389,"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":[],"created_at":"2024-10-03T20:37:40.425Z","updated_at":"2025-05-12T19:27:35.675Z","avatar_url":"https://github.com/smacker.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gum\n\nGum is a library to compute differences between ASTs using gum-tree-diff algorithm.\n\n## Usage\n\nAPI: https://godoc.org/github.com/smacker/gum\n\n```go\nimport \"github.com/smacker/gum\"\n\n// list of matched nodes in both trees\nmapping := gum.Match(srcTree, dstTree)\n// list of actions to transform srcTree to dstTree\nactions := gum.Patch(srcTree, dstTree, mapping)\n```\n\n## Parsers\n\n### Bblfsh\n\nThe library provides basic integration with bblfsh.\n\n### Golang\n\nThe library contains incomplete integration with native Go parser.\n\n### Custom\n\nAny other parser can be used but would require transformation into `gum.Tree`:\n\n```go\nt := \u0026gum.Tree{\n    Type:     \"string\", // type of a node\n    Value:    \"string\", // value/token/label of a node\n    Children: []*gum.Tree{}, // list of children\n    Meta:     n, // optional pointer to the original node\n}\n\nt.Refresh() // update internal state of the tree\n```\n\n## Cli\n\nTo explore how library works use built-in command line interface.\n\nNodes matching:\n```\ngum match srcFile dstFile\n```\n\nPatch generation:\n```\ngum diff srcFile dstFile\n```\n\nHighlighted diff:\n```\ngum webdiff srcFile dstFile\n```\n\n![webdiff](docs/webdiff.png)\n\n## Developement\n\n### Testing\n\n(Optional) Get and prepare samples to compare results with reference implementation:\n\n```bash\ngit submodule update\nJAVA_GUM_BIN=/path/to/gumtree-2.1.2/bin ./testdata/process_samples.sh\n```\n\nRun the tests:\n\n```bash\ngo test -v ./...\n```\n\n## Credits\n\n- Based on the paper [Fine-grained and Accurate Source Code Differencing](https://hal.archives-ouvertes.fr/hal-01054552/document) by Jean-Rémy Falleri, Floréal Morandat, Xavier Blanc, Matias Martinez and Martin Monperrus.\n- And reference java implementation [GumTreeDiff/gumtree](https://github.com/GumTreeDiff/gumtree).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmacker%2Fgum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmacker%2Fgum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmacker%2Fgum/lists"}