{"id":18764904,"url":"https://github.com/psygo/sgf-tree-parser","last_synced_at":"2026-05-15T22:39:27.584Z","repository":{"id":214115988,"uuid":"735718915","full_name":"psygo/sgf-tree-parser","owner":"psygo","description":"A readable SGF tree and parser","archived":false,"fork":false,"pushed_at":"2024-04-27T12:54:56.000Z","size":86,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-01T20:45:39.998Z","etag":null,"topics":["baduk","go","igo","sgf","tree","weiqi"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/psygo.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-26T00:11:30.000Z","updated_at":"2024-04-27T12:54:59.000Z","dependencies_parsed_at":"2024-01-02T15:00:14.712Z","dependency_job_id":"f0143d92-a581-4503-a491-7571e7fdb1cb","html_url":"https://github.com/psygo/sgf-tree-parser","commit_stats":null,"previous_names":["psygo/sgf-parser","psygo/sgf-tree-parser"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/psygo/sgf-tree-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psygo%2Fsgf-tree-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psygo%2Fsgf-tree-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psygo%2Fsgf-tree-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psygo%2Fsgf-tree-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psygo","download_url":"https://codeload.github.com/psygo/sgf-tree-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psygo%2Fsgf-tree-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33082185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T20:25:35.270Z","status":"ssl_error","status_checked_at":"2026-05-15T20:25:34.732Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["baduk","go","igo","sgf","tree","weiqi"],"created_at":"2024-11-07T18:31:59.578Z","updated_at":"2026-05-15T22:39:27.566Z","avatar_url":"https://github.com/psygo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SGF Tree Parser\n\nAn SGF is basically a text encoding of a tree data structure, and its grammar is described [here](https://homepages.cwi.nl/~aeb/go/misc/sgf.html).\n\n## Usage\n\nBasic parsing:\n\n```ts\nimport { SgfTree } from \"../sgf_tree\"\n\nconst sgfTree = SgfTree.parseSgf(\"...\")\n```\n\nThe tree's type is equivalent to this type in the end:\n\n```ts\ntype SgfTree = {\n  data: SgfProperties\n  children: SgfTree[]\n}\n```\n\nSome useful methods:\n\n```ts\ntree.toSgf()\ntree.toJson()\ntree.toPrettyJsonString()\ntree.toArray()\n```\n\nTypical SGF tree operations:\n\n```ts\nconst newNode = new SgfTree({ B: \"jj\" }, [])\n\nsgfTrees.add(newNode, {\n  down: 3,\n  right: 3,\n})\n\nsgfTrees.remove({ down: 3, right: 2 })\n\nsgfTrees.shift({ down: 3, right: 3 }, true)\n```\n\nYou can find out more about how to use these methods from the test files.\n\n## References\n\n- [Go Pattern Search](https://github.com/psygo/go_pattern_search?tab=readme-ov-file)\n- [Sabaki's SGF Parser](https://github.com/SabakiHQ/sgf)\n- SGF Docs\n  - [Red Bean - SGF](https://www.red-bean.com/sgf/)\n  - [CWI - SGF Format](https://homepages.cwi.nl/~aeb/go/misc/sgf.html)\n- [Stack Overflow - How to Parse SGF Metadata with JS Regexes](https://stackoverflow.com/q/77717462/4756173)\n- [Stack Overflow - Recursive Regex for Parsing SGF with JS](https://stackoverflow.com/q/77718740/4756173)\n- [Peg.js - A package for parsing any grammar](https://pegjs.org/)\n- [LaTeX Stack Exchange - Parsing the Main Branch of Single-Branched SGF Files (with Regex?)](https://tex.stackexchange.com/a/709698/64441)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsygo%2Fsgf-tree-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsygo%2Fsgf-tree-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsygo%2Fsgf-tree-parser/lists"}