{"id":48622344,"url":"https://github.com/gitpod-io/xterm-go","last_synced_at":"2026-04-09T04:06:38.356Z","repository":{"id":347129809,"uuid":"1192908901","full_name":"gitpod-io/xterm-go","owner":"gitpod-io","description":"A port of xterm.js to Go","archived":false,"fork":false,"pushed_at":"2026-04-08T14:07:49.000Z","size":227,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-08T16:11:46.384Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitpod-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-26T17:20:48.000Z","updated_at":"2026-04-08T14:08:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gitpod-io/xterm-go","commit_stats":null,"previous_names":["gitpod-io/xterm-go"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gitpod-io/xterm-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitpod-io%2Fxterm-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitpod-io%2Fxterm-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitpod-io%2Fxterm-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitpod-io%2Fxterm-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitpod-io","download_url":"https://codeload.github.com/gitpod-io/xterm-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitpod-io%2Fxterm-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31584860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"online","status_checked_at":"2026-04-09T02:00:06.848Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-04-09T04:06:37.698Z","updated_at":"2026-04-09T04:06:38.348Z","avatar_url":"https://github.com/gitpod-io.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xterm-go\n\nA pure-Go headless terminal emulator ported from [xterm.js](https://github.com/xtermjs/xterm.js).\n\nIt processes VT/ANSI escape sequences and maintains terminal buffer state without requiring a browser, DOM, or any rendering. This enables server-side terminal state tracking, screen content extraction, and headless terminal testing.\n\nThe implementation follows the VT500 specification and is a direct port of the headless subset of xterm.js (MIT license).\n\n## Install\n\n```\ngo get github.com/gitpod-io/xterm-go\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\txterm \"github.com/gitpod-io/xterm-go\"\n)\n\nfunc main() {\n\tterm := xterm.New(xterm.WithCols(80), xterm.WithRows(24))\n\tdefer term.Dispose()\n\n\tterm.WriteString(\"Hello, world!\\r\\n\")\n\tterm.WriteString(\"\\x1b[1;31mRed bold text\\x1b[0m\\r\\n\")\n\n\tfmt.Println(term.String())\n\tfmt.Printf(\"Cursor: (%d, %d)\\n\", term.CursorX(), term.CursorY())\n}\n```\n\n## Features\n\n- Full VT500 escape sequence parsing (CSI, OSC, DCS, APC)\n- Normal and alternate screen buffers with scrollback\n- Text attributes: bold, italic, underline, strikethrough, blink, inverse, dim, overline\n- 16-color, 256-color, and 24-bit RGB color support\n- Terminal resize with reflow\n- Serialize addon for terminal state snapshots\n- Conformance tests against xterm.js golden data\n\n## API\n\n### Terminal\n\n```go\n// Create a terminal with options.\nterm := xterm.New(\n    xterm.WithCols(80),\n    xterm.WithRows(24),\n    xterm.WithScrollback(1000),\n)\n\n// Write data (implements io.Writer).\nterm.Write([]byte(\"\\x1b[2J\"))\nterm.WriteString(\"text\")\n\n// Read state.\nterm.Cols()              // terminal width\nterm.Rows()              // terminal height\nterm.CursorX()           // cursor column\nterm.CursorY()           // cursor row\nterm.GetLine(y)          // text content of line y\nterm.String()            // full screen content\nterm.Buffer()            // active buffer\nterm.NormalBuffer()      // normal screen buffer\nterm.AltBuffer()         // alternate screen buffer\nterm.IsAltBufferActive() // whether alt buffer is active\n\n// Resize.\nterm.Resize(cols, rows)\n\n// Events.\nterm.OnData(func(s string) { })       // terminal response data (DA, DSR)\nterm.OnBell(func() { })               // BEL character\nterm.OnTitleChange(func(s string) { }) // OSC title change\nterm.OnLineFeed(func() { })            // line feed\n\n// Cleanup.\nterm.Dispose()\n```\n\n### SerializeAddon\n\nProduces compact escape-sequence snapshots of terminal state for reconnection:\n\n```go\naddon := xterm.NewSerializeAddon(term)\nsnapshot := addon.Serialize(nil) // []byte of escape sequences\n```\n\n## Conformance\n\nCross-implementation tests verify the Go port produces identical behavior to xterm.js. See [`conformance/README.md`](conformance/README.md).\n\n```bash\ngo test -run TestConformance -v\n```\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n\nThe original xterm.js is also MIT licensed: https://github.com/xtermjs/xterm.js/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitpod-io%2Fxterm-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitpod-io%2Fxterm-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitpod-io%2Fxterm-go/lists"}