Giter Site home page Giter Site logo

english2bash's Introduction

Examples

alex@laptop:~/english2bash$ ai make a commit with current working directory in a new branch, then move to where HEAD was before making the new commit
AI says:
(0): git checkout -b new_branch && git commit -m "Committing current working directory" && git checkout -
(1): git checkout -b new_branch && git commit -m "New commit with current working directory" && git checkout -
Execute (default git checkout -b new_branch && git commit -m "Committing current working directory" && git checkout -) [0/1]

AI> git checkout -b new_branch && git commit -m "Committing current working directory" && git checkout -
[new_branch 4f2fe1b] Committing current working directory
 1 file changed, 79 insertions(+)
 create mode 100755 openai_prompt.py


STDERR
Switched to a new branch 'new_branch'
Switched to branch 'master'
alex@laptop:~/english2bash$ ai show tree of all git branches and commits
AI says:
git log --all --graph --decorate --oneline
Execute? [Y/n]
AI> git log --all --graph --decorate --oneline
* 4f2fe1b (new_branch) Committing current working directory
* 8d9c3b1 (HEAD -> master) .

It has colors:

Installation:

Get an OpenAI API key and put it in env variable $OPENAI_API_KEY. I have export OPENAI_API_KEY="sk-<the key>" in my .bashrc. Then run the openai_prompt.py script. I haven't added a requirements.txt, but it's colorama and openai. Do pip install colorama openai. I renamed the script to ai, made it executable and put in somewhere in PATH:

mkdir -p ~/.local/bin
# Add `export PATH=~/.local/bin:$PATH` to .bashrc
chmod a+x openai_prompt.py
ln -s $(pwd)/openai_prompt.py ~/.local/bin/ai

Prompt

Inspired by https://github.com/atinylittleshell/aicmd/blob/main/packages/web/utils/openai.ts

  model=MODEL,
  messages=[
    {"role": "system",
     "content": "You are an ubuntu shell assistant. "
     "You will be asked to generate shell commands and "
     "short shell scripts. "
     "You can only respond with a single-line shell command in "
     "a single code block. " 
     "Do not write anything outside of the code block.",
     },
    {"role": "user", "content": USER_ARGS},
  ],
  temperature=0.2,

english2bash's People

Contributors

aleloi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.