diff --git a/docs/automation.rst b/docs/automation.rst index 275f4ba1..1363fd95 100644 --- a/docs/automation.rst +++ b/docs/automation.rst @@ -8,12 +8,11 @@ We will be using shell scripts, cron jobs, and other tools to automate the workf .. note:: - This is a work in progress. We intend to make gptme more powerful for automations, see `issue #1 `_ for more details on this plan. + This is a work in progress. We intend to make gptme more powerful for automations, see `issue #143 `_ for more details on this plan. -Example: Implement feature --------------------------- +.. rubric:: Example: Implement feature This example demonstrates how to implement a feature in a codebase using gptme, making sure the code is correct before creating a pull request. diff --git a/docs/automation/example_activity_summary.rst b/docs/automation/example_activity_summary.rst index 5e0f62a4..b2e1459c 100644 --- a/docs/automation/example_activity_summary.rst +++ b/docs/automation/example_activity_summary.rst @@ -1,5 +1,4 @@ -Example: Daily Activity Summary -------------------------------- +.. rubric:: Example: Daily Activity Summary Here's an example of how to use gptme to generate a daily summary based on ActivityWatch data using a shell script: diff --git a/docs/automation/example_code_review.rst b/docs/automation/example_code_review.rst index 289b6db2..5b677f10 100644 --- a/docs/automation/example_code_review.rst +++ b/docs/automation/example_code_review.rst @@ -1,5 +1,4 @@ -Example: Automated Code Review ------------------------------- +.. rubric:: Example: Automated Code Review This example demonstrates a simple and composable approach to automated code review using gptme and shell scripting. @@ -8,7 +7,6 @@ This example demonstrates a simple and composable approach to automated code rev .. code-block:: bash #!/bin/bash - # Usage: ./review_pr.sh repo=$1 diff --git a/docs/cli.rst b/docs/cli.rst index 16314968..c0a1857a 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -10,30 +10,14 @@ gptme provides the following commands: This is the full CLI reference. For a more concise version, run ``gptme --help``. -.. rubric:: gptme - -You can skip confirmation prompts and run in non-interactive mode to terminate when all prompts have been completed: - -.. code-block:: bash - - gptme --non-interactive --no-confirm 'create a snake game using curses in snake.py, dont run it' '-' 'make the snake green and the apple red' - -This should make it first write snake.py, then make the change in a following prompt. - -The '-' is special "multiprompt" syntax that tells the assistant to wait for the assistant to finish work on the next prompt (run until no more tool calls) before continuing. - .. click:: gptme.cli:main :prog: gptme :nested: full -.. rubric:: gptme-server - .. click:: gptme.server:main :prog: gptme-server :nested: full -.. rubric:: gptme-eval - .. click:: gptme.eval:main :prog: gptme-eval :nested: full diff --git a/docs/conf.py b/docs/conf.py index 4b318b8d..4061b9e4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -90,6 +90,7 @@ def setup(app): "sphinx.ext.autosectionlabel", "sphinx_click", "sphinxcontrib.programoutput", + "sphinxcontrib.asciinema", ] diff --git a/docs/demos.rst b/docs/demos.rst index e8f8c209..dc90e249 100644 --- a/docs/demos.rst +++ b/docs/demos.rst @@ -10,80 +10,64 @@ Demos :local: :backlinks: none -Snake with curses ------------------ -Generate a snake game that runs in the terminal using curses, and then modify it to add color. - -.. raw:: html +.. rubric:: Snake with curses - - - +Generate a snake game that runs in the terminal using curses, and then modify it to add color. +.. asciinema:: 621992 + :autoplay: true Steps -- Create a snake game with curses to snake.py -- Running fails, ask gptme to fix a bug -- Game runs -- Ask gptme to add color -- Minor struggles -- Finished game with green snake and red apple pie! +#. Create a snake game with curses to snake.py +#. Running fails, ask gptme to fix a bug +#. Game runs +#. Ask gptme to add color +#. Minor struggles +#. Finished game with green snake and red apple pie! -Mandelbrot with curses ----------------------- +.. rubric:: Mandelbrot with curses Generate a program that renders mandelbrot with curses, and then modify it to add color. -.. raw:: html - - - - +.. asciinema:: 621991 + :autoplay: true Steps -- Render mandelbrot with curses to mandelbrot_curses.py -- Program runs -- Add color +#. Render mandelbrot with curses to mandelbrot_curses.py +#. Program runs +#. Add color -Fibonacci (old) ---------------- +.. rubric:: Fibonacci An old demo showing off basic code execution and shell interaction. -.. raw:: html - - - - +.. asciinema:: 606375 + :autoplay: true Steps -- Create a new dir 'gptme-test-fib' and git init -- Write a fib function to fib.py, commit -- Create a public repo and push to GitHub +#. Create a new dir 'gptme-test-fib' and git init +#. Write a fib function to fib.py, commit +#. Create a public repo and push to GitHub -Answer question from URL ------------------------- -Showing off basic URL loading from the prompt, and answering questions based on the content. +.. rubric:: Answer question from URL -.. raw:: html +Showing off basic URL loading from the prompt, and answering questions based on the content. - - - +.. asciinema:: 621997 + :autoplay: true Steps -- Ask who the CEO of Superuser Labs is, passing website URL -- gptme browses the website, and answers correctly +#. Ask who the CEO of Superuser Labs is, passing website URL +#. gptme browses the website, and answers correctly -Edit history with /edit ------------------------ +.. rubric:: Edit history with /edit TODO diff --git a/docs/examples.rst b/docs/examples.rst index 61a1d38c..5fef1c97 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -5,7 +5,6 @@ A list of things you can do with gptme. To see example output without running the commands yourself, check out the :doc:`demos`. - .. code-block:: bash gptme 'write a web app to particles.html which shows off an impressive and colorful particle effect using three.js' @@ -25,19 +24,28 @@ To see example output without running the commands yourself, check out the :doc: # it can read files using tools, if contents not provided in prompt gptme 'suggest improvements to my vimrc' - Do you have a cool example? Share it with us in the `Discussions `_! -Commit Message Generator ------------------------- +.. rubric:: Skip confirmation and run in non-interactive mode + +You can skip confirmation prompts and run in non-interactive mode to terminate when all prompts have been completed. + +This should make it first write snake.py, then make the change in a following prompt: + +.. code-block:: bash + + gptme --non-interactive --no-confirm 'create a snake game using curses in snake.py, dont run it' '-' 'make the snake green and the apple red' + +The '-' is special "multiprompt" syntax that tells the assistant to wait for the assistant to finish work on the next prompt (run until no more tool calls) before continuing. For more such non-interactive examples, see :doc:`automation`. + + +.. rubric:: Generate Commit Messages Generate meaningful commit messages based on your git diff: .. code-block:: bash - #!/bin/bash - # Usage: git-commit-auto msg_file=$(mktemp) git diff --cached | gptme --non-interactive "Write a concise, meaningful commit message for this diff to `$msg_file`. @@ -46,18 +54,14 @@ Generate meaningful commit messages based on your git diff: git commit -F "$msg_file" -Generate Documentation ----------------------- -Generate docstrings for all functions in a file: +.. rubric:: Generate Documentation -.. TODO: not automation, move to examples. +Generate docstrings for all functions in a file: .. code-block:: bash - #!/bin/bash gptme --non-interactive "Patch these files to include concise docstrings for all functions, skip functions that already have docstrings. Include: brief description, parameters." $@ - These examples demonstrate how gptme can be used to create simple yet powerful automation tools. Each script can be easily customized and expanded to fit specific project needs. diff --git a/poetry.lock b/poetry.lock index fcc82bee..7a253bc1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2788,6 +2788,19 @@ lint = ["mypy", "ruff (==0.5.5)", "types-docutils"] standalone = ["Sphinx (>=5)"] test = ["pytest"] +[[package]] +name = "sphinxcontrib-asciinema" +version = "0.4.2" +description = "Embed asciinema casts in your Sphinx docs" +optional = false +python-versions = "*" +files = [ + {file = "sphinxcontrib.asciinema-0.4.2.tar.gz", hash = "sha256:ab38b3e376f335d3e87f445e3ecbd0524e61bab380760c54c32ee4d4a95c3a59"}, +] + +[package.dependencies] +sphinx = "*" + [[package]] name = "sphinxcontrib-devhelp" version = "2.0.0" @@ -3307,4 +3320,4 @@ server = ["flask"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "3e9395bf2f53ec31a9aea8879de99b01e2709338510854a8d71862938d08875a" +content-hash = "954c64862ceb61d678f9a6ca3b89c2886cbb3db363a7696072f342faf955baf2" diff --git a/pyproject.toml b/pyproject.toml index d3639603..4c047d96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,6 +71,7 @@ sphinx = "^8.0" sphinx-click = "^6.0" sphinx-book-theme = "^1.0.1" sphinxcontrib-programoutput = "^0.17" +sphinxcontrib-asciinema = "^0.4.2" myst-parser = "*" # types