Skip to content

Commit f773577

Browse files
committed
chore: maintain homebrew tap as well as homebrew core formulas
Signed-off-by: Taylor Price <[email protected]>
1 parent daef472 commit f773577

File tree

15 files changed

+399
-5
lines changed

15 files changed

+399
-5
lines changed

.github/workflows/release.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ jobs:
4040
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4141
GH_PROJECT_TOKEN: ${{ secrets.GH_PROJECT_TOKEN }}
4242
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
43+
homebrew-release:
44+
needs: release-tag
45+
if: "! contains(github.ref_name, '-rc')"
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Update Homebrew formula
49+
uses: dawidd6/action-homebrew-bump-formula@v3
50+
with:
51+
token: ${{secrets.BREW_GH_TOKEN}}
52+
formula: gptscript
4353
winget-release:
4454
needs: release-tag
4555
if: "! contains(github.ref_name, '-rc')"

.goreleaser.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ release:
5252
prerelease: auto
5353

5454
brews:
55-
- description: "GPTScript CLI"
55+
- name: gptscript
56+
description: "GPTScript CLI"
5657
install: |
5758
bin.install "gptscript"
58-
generate_completions_from_executable(bin/"gptscript", "completion", shells: [:bash, :zsh, :fish])
59+
generate_completions_from_executable(bin/"gptscript", "completion")
5960
homepage: "https://github.com/gptscript-ai/gptscript"
6061
skip_upload: false
61-
folder: "Formula"
62+
directory: "Formula"
6263
repository:
6364
owner: gptscript-ai
6465
name: homebrew-tap

docs/docs/01-overview.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,21 @@ Here are some sample use cases of GPTScript:
2121

2222
<Tabs>
2323
<TabItem value="MacOS and Linux (Homebrew)">
24+
## Homebrew Tap
25+
___
2426
```shell
2527
brew install gptscript-ai/tap/gptscript
2628
gptscript github.com/gptscript-ai/llm-basics-demo
2729
```
30+
## Homebrew
31+
___
32+
:::warning
33+
The [formula in homebrew-core](https://github.com/Homebrew/homebrew-core/blob/master/Formula/g/gptscript.rb) might be slightly outdated. Use our homebrew tap to always get the latest updates.
34+
:::
35+
```
36+
brew install gptscript
37+
gptscript github.com/gptscript-ai/llm-basics-demo
38+
```
2839
</TabItem>
2940
<TabItem value="MacOS and Linux (install.sh)">
3041
```shell

examples/gptreview.gpt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Name: Code Reviewer
2+
Description: A tool to help you perform code review of open PRs
3+
Context: learn-gh
4+
Tools: sys.exec, sys.http.html2text?, sys.find, sys.read, sys.write
5+
Args: PR_URL: The GitHub PR_URL
6+
chat:true
7+
8+
You have the gh cli available to you. Use it to perform code review for a pr.
9+
10+
Perform the following steps in order:
11+
1. Ask the user for the ($PR_URL) and save it.
12+
2. Identify the files changed in the pull request ($PR_URL) using the pr number and perform a diff.
13+
1. Analyze the complete code of each identified file and perform a detailed line by line code review.
14+
2. Repeat the process for each changed file in the pr.
15+
3. Share your review comments separately for each file.
16+
4. In a new line write "Code: Approved" or "Code: Require Changes" based on the review.
17+
---
18+
Name: learn-gh
19+
Description: A tool to help you learn gh cli
20+
21+
#!/usr/bin/env bash
22+
23+
echo "The following is the help text for the gh cli and some of its sub-commands. Use these when figuring out how to construct new commands. Note that the --search flag is used for filtering and sorting as well; there is no dedicated --sort flag."
24+
gh --help
25+
gh repo --help
26+
gh pr --help
27+
gh pr checkout --help
28+
gh pr diff --help

pkg/engine/engine.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ func NewContext(ctx context.Context, prg *types.Program, input string) (Context,
207207
}
208208

209209
callCtx.AgentGroup = agentGroup
210+
211+
if callCtx.Tool.IsAgentsOnly() && len(callCtx.AgentGroup) > 0 {
212+
callCtx.Tool = callCtx.Program.ToolSet[callCtx.AgentGroup[0].ToolID]
213+
}
214+
210215
return callCtx, nil
211216
}
212217

pkg/input/input.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ package input
33
import (
44
"fmt"
55
"io"
6+
"io/fs"
67
"os"
78
"path/filepath"
89
"strings"
910

11+
"github.com/gptscript-ai/gptscript/internal"
1012
"github.com/gptscript-ai/gptscript/pkg/loader"
1113
"github.com/gptscript-ai/gptscript/pkg/types"
1214
)
@@ -33,7 +35,7 @@ func FromFile(file string) (string, error) {
3335
}
3436
return string(data), nil
3537
} else if file != "" {
36-
if s, err := os.Stat(file); err == nil && s.IsDir() {
38+
if s, err := fs.Stat(internal.FS, file); err == nil && s.IsDir() {
3739
for _, ext := range types.DefaultFiles {
3840
if _, err := os.Stat(filepath.Join(file, ext)); err == nil {
3941
file = filepath.Join(file, ext)
@@ -42,7 +44,7 @@ func FromFile(file string) (string, error) {
4244
}
4345
}
4446
log.Debugf("reading file %s", file)
45-
data, err := os.ReadFile(file)
47+
data, err := fs.ReadFile(internal.FS, file)
4648
if err != nil {
4749
return "", fmt.Errorf("reading %s: %w", file, err)
4850
}

pkg/parser/parser.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ func (c *context) finish(tools *[]Node) {
199199
len(c.tool.GlobalTools) > 0 ||
200200
len(c.tool.ExportInputFilters) > 0 ||
201201
len(c.tool.ExportOutputFilters) > 0 ||
202+
len(c.tool.Agents) > 0 ||
202203
c.tool.Chat {
203204
*tools = append(*tools, Node{
204205
ToolNode: &ToolNode{

pkg/tests/runner_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,26 @@ func TestExport(t *testing.T) {
800800
assert.Equal(t, "TEST RESULT CALL: 3", x)
801801
}
802802

803+
func TestAgentOnly(t *testing.T) {
804+
r := tester.NewRunner(t)
805+
806+
prg, err := r.Load("")
807+
require.NoError(t, err)
808+
809+
r.RespondWith(tester.Result{
810+
Func: types.CompletionFunctionCall{
811+
Name: "agent2",
812+
Arguments: "Agent 2 input",
813+
},
814+
})
815+
816+
resp, err := r.Chat(context.Background(), nil, prg, nil, "Input 1")
817+
require.NoError(t, err)
818+
r.AssertResponded(t)
819+
assert.False(t, resp.Done)
820+
autogold.Expect("TEST RESULT CALL: 2").Equal(t, resp.Content)
821+
autogold.ExpectFile(t, toJSONString(t, resp), autogold.Name(t.Name()+"/step1"))
822+
}
803823
func TestAgents(t *testing.T) {
804824
r := tester.NewRunner(t)
805825

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
`{
2+
"role": "assistant",
3+
"content": [
4+
{
5+
"toolCall": {
6+
"index": 0,
7+
"id": "call_1",
8+
"function": {
9+
"name": "agent2",
10+
"arguments": "Agent 2 input"
11+
}
12+
}
13+
}
14+
],
15+
"usage": {}
16+
}`
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
`{
2+
"model": "gpt-4o",
3+
"internalSystemPrompt": false,
4+
"tools": [
5+
{
6+
"function": {
7+
"toolID": "testdata/TestAgentOnly/test.gpt:agent2",
8+
"name": "agent2",
9+
"parameters": {
10+
"properties": {
11+
"defaultPromptParameter": {
12+
"description": "Prompt to send to the assistant. This may be an instruction or question.",
13+
"type": "string"
14+
}
15+
},
16+
"type": "object"
17+
}
18+
}
19+
}
20+
],
21+
"messages": [
22+
{
23+
"role": "system",
24+
"content": [
25+
{
26+
"text": "I am agent1"
27+
}
28+
],
29+
"usage": {}
30+
},
31+
{
32+
"role": "user",
33+
"content": [
34+
{
35+
"text": "Input 1"
36+
}
37+
],
38+
"usage": {}
39+
}
40+
],
41+
"chat": true
42+
}`

0 commit comments

Comments
 (0)