{"id":13592530,"url":"https://github.com/hirokidaichi/wanna","last_synced_at":"2025-04-13T04:25:48.251Z","repository":{"id":99507633,"uuid":"608074354","full_name":"hirokidaichi/wanna","owner":"hirokidaichi","description":"Shell command launcher with natural language","archived":false,"fork":false,"pushed_at":"2023-04-02T00:26:00.000Z","size":202,"stargazers_count":144,"open_issues_count":1,"forks_count":5,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-04-20T19:51:51.059Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/hirokidaichi.png","metadata":{"files":{"readme":"README-ja.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}},"created_at":"2023-03-01T09:10:59.000Z","updated_at":"2024-04-18T03:11:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"a68256e4-ca8d-481e-a426-2e4d0460a2c6","html_url":"https://github.com/hirokidaichi/wanna","commit_stats":{"total_commits":22,"total_committers":1,"mean_commits":22.0,"dds":0.0,"last_synced_commit":"47689d991235ab99fdf8ead10e2efe4c0cab98ad"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirokidaichi%2Fwanna","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirokidaichi%2Fwanna/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirokidaichi%2Fwanna/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirokidaichi%2Fwanna/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hirokidaichi","download_url":"https://codeload.github.com/hirokidaichi/wanna/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248662564,"owners_count":21141594,"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-08-01T16:01:10.433Z","updated_at":"2025-04-13T04:25:48.222Z","avatar_url":"https://github.com/hirokidaichi.png","language":"Python","funding_links":[],"categories":["CLIs","ChatGPT","Python"],"sub_categories":["Transformer based models"],"readme":"# wanna\nChatGPTを用いた自然言語によるシェルコマンドランチャー\n\n![wanna](https://user-images.githubusercontent.com/95184/222627802-1df02ee6-e07b-47dc-8fe0-0787a1e63097.gif)\n\n## 概要\n`wanna`コマンドは、ChatGPTを用いた自然言語によるシェルコマンドランチャーです。自然言語によって、shell commandを生成して実行し、名付けし、管理できます。\n\nコマンドライン上での操作は簡単に多くのことを行うことができるため、非常に便利です。しかし、多くのコマンドやオプションの組み合わせを覚えておくのは熟練したプログラマでもむずかしく、Google検索や`man`コマンドなどを駆使して思い出しながら実行することも多くあるでしょう。\n\nたとえば、**「このディレクトリの配下にあるすべての.pyファイルを再帰的に発見して、それらの行数の合計を出力する」** といったタスクを行おうとするとき、`find`や`xargs`、 `wc`などのコマンドをどのように組み合わせたら良いのかを一発で思い出すのは中々難しいです。\n\n### wanna think \n\nこのようなときに`wanna think`コマンドを使います。\n\n```bash\n$ wanna think このディレクトリの配下にあるすべての.pyファイルを再帰的に発見して、それらの行数の合計を出力する\n```\nと打てば、AIアシスタントが自動的に次のようなbash scriptを生成します。\n\n```bash\n#!/usr/bin/env bash\nfind . -name \"*.py\" -exec cat {} + | wc -l\n```\nあなたはただ、それをみて、実行するかしないかを決めれば良いだけです。\n```\n? What's next? (Use arrow keys)\n » Do\n   Save\n   Additonal Request\n   Another Question\n   Exit\n```\nあなたの依頼に対して、AIはスクリプトを生成し、その解説をします。\n`Do`を選べば、提案されたスクリプトを実際に実行してその結果を表示します。\n実行後に問題なく動作することを確認したら、保存をすることができます。\n```\n? I thought of the following names. Which one do you like? (Use arrow keys)\n » count_py_lines\n   py_line_counter\n   recursive_py_counter\n   py_line_sum\n```\nそういえば、「コンピュータサイエンスで最も難しいことは\"命名\"である」とフィルカールトンも言っていました。\nこのAIは、生成したスクリプトに丁度良い名前も提案してくれます。あなたは、コードレビューアとして良さそうな名前を選ぶだけです。\n\n### wanna do\n`wanna do`コマンドを使えば、過去に保存したコマンドを実行することができます。\nただ単に`wanna do`と入力すればインクリメンタルに保存済のコマンドを選び、実行できます。\n```zsh\n$ wanna do\n```\n![wanna-do](https://user-images.githubusercontent.com/95184/222663648-50325d6a-1e5e-451a-a90e-9aff6a914fc1.gif)\n\n\n```\n$ wanna do random_passwords\n```\nのようにコマンド名を直接打って実行することもできます。\n\n## wanna list \n記録済のスクリプトをリストアップします。\n```\n$ wanna list \ncount_py_lines      :このディレクトリの配下にあるすべての.pyファイルを再帰的に発見して、それらの行数の合計を出力する\ntop_memory_usage    :メモリ使用量の多いプロセスを上位10個出力する\nrandom_passwords    :ランダムに10個のパスワードを生成する\n```\n\nこれを用いると、たとえば、こんなことができます。\n```\n$ wanna list | peco | xargs wanna do\n```\n![wanna-list-peco](https://user-images.githubusercontent.com/95184/222663840-67983f47-b477-4168-81db-6abae9caf311.gif)\n\n\n## インストール\nインストールは、pipを用いて簡単にできます。python3.10以上の環境で動作します。\n```bash\npip install wanna\n```\nまた、OEPNAI_API_KEYを使うため、ご自身のアカウントでtokenを取得してください。\n```bash\nexport OPENAI_API_KEY = \"sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhirokidaichi%2Fwanna","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhirokidaichi%2Fwanna","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhirokidaichi%2Fwanna/lists"}