{"id":25449812,"url":"https://github.com/brylee10/wtg","last_synced_at":"2025-05-16T09:08:31.893Z","repository":{"id":277693478,"uuid":"931907347","full_name":"brylee10/wtg","owner":"brylee10","description":"What The GPT (wtg), a CLI to chat with your program logs","archived":false,"fork":false,"pushed_at":"2025-02-13T23:12:27.000Z","size":21,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-14T02:59:54.898Z","etag":null,"topics":["cli","gpt","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/wtg","language":"Rust","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/brylee10.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}},"created_at":"2025-02-13T03:40:31.000Z","updated_at":"2025-03-01T04:13:35.000Z","dependencies_parsed_at":"2025-02-16T20:31:14.778Z","dependency_job_id":null,"html_url":"https://github.com/brylee10/wtg","commit_stats":null,"previous_names":["brylee10/wtg"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brylee10%2Fwtg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brylee10%2Fwtg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brylee10%2Fwtg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brylee10%2Fwtg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brylee10","download_url":"https://codeload.github.com/brylee10/wtg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254501551,"owners_count":22081529,"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","gpt","rust"],"created_at":"2025-02-17T21:19:16.813Z","updated_at":"2025-05-16T09:08:31.620Z","avatar_url":"https://github.com/brylee10.png","language":"Rust","funding_links":[],"categories":["\u003ca name=\"ai\"\u003e\u003c/a\u003eAI / ChatGPT"],"sub_categories":[],"readme":"# WTG (What The GPT) ❓\nChat with your program logs!\n\nA command line program that allows you to pass the terminal output of the last command run to a GPT as context for a one time question or an extended chat. Supports Unix like OSes.\n\nWhy `wtg`? Relevant, expresses questioning, and typeable with one hand (in fact, all the subcommands are)! \n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://i.imgur.com/h2t2gR2.gif\" alt=\"WTG Demo\" width=\"800\"/\u003e\n\u003c/p\u003e\n\n# Installation\nEnsure Rust is installed on your machine and then install `wtg` as a local binary crate\n```shell\ncargo install wtg\n```\n\n# Usage\n`wtg` supports queries (one time questions) and chats (multiple follow ups). Both can be done inside or outside a `wtg` session. Logs are only recorded inside `wtg` sessions.\n\n## Starting a `wtg` session\nStart a `wtg` session in a terminal.  \n```shell\nwtg s /path/to/log/file\n```\nUnder the hood, this starts a new pseudo terminal where `wtg` appends commands' `stdout` and `stderr` for a log file (closely mirroring `script` in UNIX). Additionally, `wtg` adds delimiters in the log to indicate the start and end of different commands' output. This sets the `WTG_LOG` env variable to the provided log file.\n\nTo ask a model about the last run's output\n```shell\nwtg q\n```\nIf no file name is provided, this implicitly queries the file specified by the `WTG_LOG` environment variable.\n\nStart an extended chat about the last run's output\n```shell\nwtg c\n```\nThis has similar logfile semantics as `wtg q`.\n\nEnd a `wtg` session (a nested shell session) with the typical `exit` command.\n\n## Running commands outside of a session\nNot all commands need to be run in a `wtg` session. You can run a query against any explicitly specified log file\n```shell\nwtg q -l /path/to/log/file\n``` \nIf no log file is provided, this falls back to using the file specified in `WTG_LOG`.\n\n`wtg c` for chat can be used in a similar way.\n\n`wtg q` can also take `stdout/stderr` from another command via pipe.\n```shell\nsome_program 2\u003e\u00261 | wtg q\n``` \nChats cannot \n\n## Additional CLI Options\nQueries (`wtg q`) are run with a default prompt. This prompt can be customized per run\n```shell\nwtg q -p \"A custom prompt\"\n```\n\nThe model queries and prompts can also be specified\n```shell\nwtg c -m \"o3-mini\"\n```\n\n## Environment Variables\nEnvironment variables are used so users can customize default behavior of `wtg` commands while reducing typing of redundant CLI args.\n\n- `WTG_OPENAI_KEY`: Required. The OpenAI API key to use for any queries or chats.\n- `WTG_LOG`: Optional for queries and chats. Specifies the absolute (recommended) or relative log file to use for queries and chats. If not specified, `logfile` arg must be provided.\n- `WTG_LLM`: Optional. The model to use for the session (default: gpt-4o, also valid: gpt-4o-mini, o3-mini)\n- `WTG_PROMPT`: Optional. The default prompt to use for `query` if none is provided by the user.\n\n`wtg` queries and chats use the below environment variables. For equivalent options, the fallback order is (1) the parameter CLI argument (if applicable), (2) the environment variable, (3) the hard coded default (if applicable).\n\nFor example, the prompt used in `query` (not applicable to `chat`, since all prompts are user provided) the model will be (1) the `-p` parameter if provided, (2) the `WTG_PROMPT` env var if set, (3) the default prompt `DEFAULT_QUERY`.\n\nSimilarly, the log file used for contexts in queries and chats will be (1) the `-l` parameter if provided, (2) the `WTG_LOG` variable if set, (3) N/A as the log file does not have a default. \n\nLastly, the model used is selected by, (1) the `-m` if provided, (2) the `WTG_LLM` env var if set, (3) the default `DEFAULT_LLM`. \n\nThese environment variables can be added to `~/.bashrc`,  `~/.zshrc` or similar shell configuration files.\n\n## Notes\nIf using `wtl` with `tmux`, it's more convenient to start the `tmux` session first and then start `wtl`. If done in the reverse order, `tmux` may clear the `WTG_LOG` env var (which the `wtl` session sets). You would need to reinitialize this variable or pass the logfile to the `q` and `c` subcommands.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrylee10%2Fwtg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrylee10%2Fwtg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrylee10%2Fwtg/lists"}