Skip to content

Commit

Permalink
fix: set PAGER and GH_PAGER in shell tool, add wait-for-ci example to…
Browse files Browse the repository at this point in the history
… gh tool
  • Loading branch information
ErikBjare committed Nov 15, 2024
1 parent ba2009a commit e4ce6c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion gptme/tools/gh.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ def has_gh_tool() -> bool:
> User: show workflow
> Assistant:
{ToolUse("shell", [], "gh run view $RUN --repo $REPO --log").to_output()}
> User: wait for workflow to finish
> Assistant:
{ToolUse("shell", [], "gh run watch $RUN --repo $REPO").to_output()}
"""

# Note: this isn't actually a tool, it only serves prompting purposes
tool = ToolSpec(
tool: ToolSpec = ToolSpec(
name="gh",
available=has_gh_tool(),
desc="Interact with GitHub",
Expand Down
4 changes: 3 additions & 1 deletion gptme/tools/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import bashlex

from ..message import Message
from ..util import get_tokenizer, print_preview, get_installed_programs
from ..util import get_installed_programs, get_tokenizer, print_preview
from .base import ConfirmFunc, ToolSpec, ToolUse

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -120,6 +120,8 @@ def _init(self):
self.delimiter = "END_OF_COMMAND_OUTPUT"

# set GIT_PAGER=cat
self.run("export PAGER=")
self.run("export GH_PAGER=")
self.run("export GIT_PAGER=cat")

def run(self, code: str, output=True) -> tuple[int | None, str, str]:
Expand Down

0 comments on commit e4ce6c8

Please sign in to comment.