{"id":16319237,"url":"https://github.com/craigmayhew/pipe-gpt","last_synced_at":"2025-03-16T14:30:58.033Z","repository":{"id":219734397,"uuid":"747410090","full_name":"craigmayhew/pipe-gpt","owner":"craigmayhew","description":"Pipe content directly to GPT4o!","archived":false,"fork":false,"pushed_at":"2024-05-29T16:29:02.000Z","size":686,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T17:52:08.125Z","etag":null,"topics":["cli","command-line","command-line-tool","gpt-4","gpt-4o","rust","rust-crate"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/pipe-gpt","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/craigmayhew.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":"2024-01-23T21:44:33.000Z","updated_at":"2025-02-17T19:02:49.000Z","dependencies_parsed_at":"2024-02-08T11:32:28.181Z","dependency_job_id":"33dfb577-e2e2-4495-8473-43e5ab178067","html_url":"https://github.com/craigmayhew/pipe-gpt","commit_stats":null,"previous_names":["craigmayhew/pipe-gpt"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigmayhew%2Fpipe-gpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigmayhew%2Fpipe-gpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigmayhew%2Fpipe-gpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigmayhew%2Fpipe-gpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craigmayhew","download_url":"https://codeload.github.com/craigmayhew/pipe-gpt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243818195,"owners_count":20352629,"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","command-line","command-line-tool","gpt-4","gpt-4o","rust","rust-crate"],"created_at":"2024-10-10T22:26:18.653Z","updated_at":"2025-03-16T14:30:57.498Z","avatar_url":"https://github.com/craigmayhew.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pipe-gpt\nPipe your content to gpt directly from the command line. A concept that allows for a lot of possibilities.\n\nInstallation via cargo `cargo install pipe-gpt`, build it locally via `cargo build --release`, or download from the releases page.\n\nPlease note you will need an [OpenAI API Key](https://platform.openai.com/account/api-keys).\n\n### Set the open api key env var\n - in linux: `export OPENAI_API_KEY=sk-12345abc`\n - in windows powershell `$env:OPENAI_API_KEY = 'sk-12345abc'`\n\n## Use cases\n\n### Local command-line usage\n- `tail -30 /var/httpd.log | pipe-gpt --p \"Is there anything in the http log file I should fix?\"`\n- `cat main.rs | pipe-gpt -p \"How would you improve this code? Include line numbers in your comments so I can tell where you mean.\"`\n- `cat main.rs | pipe-gpt -p \"Is this code production ready? If yes reply 'Yes'. If no, then explain why not. Be concise.\"`\n- `cat file.json | pipe-gpt -p \"Convert this JSON to YAML\" \u003e file.yaml`\n- `cat french.txt | pipe-gpt -p \"Translate this to English please.\"` \n- `git diff --staged | pipe-gpt -p \"Code review this code change\"`\n - `cat src/main.rs | pipe-gpt -p \"improve the code and only output the replacement code as I will pipe the output directly back into a file, no explanations, just pure code please\" \u003e src/main.new.rs`\n\n### pipe-gpt for local dev\n\n```\nuser@computer:/GitHub/pipe-gpt$ cat src/main.rs | pipe-gpt -p \"how would you improve this code? include line numbers in your comments so I can tell where you mean\"\n\nHere are some suggestions to improve your code:\n\n1. Line 2, 3: You can combine these two lines into one as follows:\n`use openai_api_rust::{*, chat::*};`\n\n2. Line 6-16: You can simplify the creation of `conversation_messages` by using a `Vec::new()` and then pushing messages as needed. This way, you avoid creating an unnecessary `Message` when `prepend` is empty.\n\n3. Line 18-19: Instead of using `unwrap()`, it's better to handle the error properly. You can use `?` to propagate the error up.\n\n4. Line 20-33: You can create a function to initialize `ChatBody` to make the code cleaner.\n\n5. Line 35-38: Instead of using `unwrap()`, it's better to handle the error properly. You can use `match` to handle the possible `None` case.\n```\n\n### pipe-gpt for CI\n\n```yaml\njobs:\n  build:\n\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v3\n    - name: Build\n      run: cargo build --verbose\n    - name: Run tests\n      run: cargo test --verbose\n    - name: GPT Code Review\n      env:\n        OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}\n      run: pwd \u0026\u0026 find . -path './target' -prune -o -name '*.rs' -exec echo {} \\; -exec cat {} \\; | ./target/debug/pipe-gpt -p \"how would you improve this code? include line numbers in your comments so I can tell where you mean\"\n```\n\nWhich gives this output in Github Actions CI:\n![Pipe GPT used in CI to give code review recomendations](./imgs/github-workflow-gpt-code-review-markdown.png)\n\n## Roadmap\n - [ ] graceful API throttling\n - [ ] secrets and config files\n - [ ] loading custom prompts as short arguments\n - [ ] namespaced roles/prompts\n - [ ] reduce dependencies\n\n## Contributing\nIf you wish to contribute to the codebase, please see [CONTRIBUTE.md](./CONTRIBUTE.md)\n\n## Useful links\n - https://platform.openai.com/account/usage\n - https://platform.openai.com/docs/api-reference/chat/create\n - https://platform.openai.com/docs/models/overview\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigmayhew%2Fpipe-gpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraigmayhew%2Fpipe-gpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigmayhew%2Fpipe-gpt/lists"}