Skip to content

Commit

Permalink
Enhance git tool descriptions and update GitHub actions handling
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Oct 3, 2024
1 parent 22294c4 commit f4dd56d
Show file tree
Hide file tree
Showing 25 changed files with 104 additions and 81 deletions.
1 change: 0 additions & 1 deletion docs/genaisrc/genaiscript.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions docs/src/components/BuiltinTools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ import { LinkCard } from '@astrojs/starlight/components';
<LinkCard title="fs_diff_files" description="Computes a diff between two files." href="/genaiscript/reference/scripts/system#systemfs_diff_files" />
<LinkCard title="fs_find_files" description="Finds file matching a glob pattern. Use pattern to specify a regular expression to search for in the file content." href="/genaiscript/reference/scripts/system#systemfs_find_files" />
<LinkCard title="fs_read_file" description="Reads a file as text from the file system. Returns undefined if the file does not exist." href="/genaiscript/reference/scripts/system#systemfs_read_file" />
<LinkCard title="git_branch_current" description="Gets the current branch." href="/genaiscript/reference/scripts/system#systemgit" />
<LinkCard title="git_branch_list" description="List all branches." href="/genaiscript/reference/scripts/system#systemgit" />
<LinkCard title="git_diff" description="Generates concise file diffs." href="/genaiscript/reference/scripts/system#systemgit" />
<LinkCard title="git_log" description="Generates a log of commits." href="/genaiscript/reference/scripts/system#systemgit" />
<LinkCard title="git_status" description="Generates a status of the repository." href="/genaiscript/reference/scripts/system#systemgit" />
<LinkCard title="git_last_tag" description="Gets the last tag." href="/genaiscript/reference/scripts/system#systemgit" />
<LinkCard title="git_branch_current" description="Gets the current branch using git." href="/genaiscript/reference/scripts/system#systemgit" />
<LinkCard title="git_branch_list" description="List all branches using git." href="/genaiscript/reference/scripts/system#systemgit" />
<LinkCard title="git_diff" description="Generates concise file diffs using git." href="/genaiscript/reference/scripts/system#systemgit" />
<LinkCard title="git_log" description="Generates a log of commits using git." href="/genaiscript/reference/scripts/system#systemgit" />
<LinkCard title="git_status" description="Generates a status of the repository using git." href="/genaiscript/reference/scripts/system#systemgit" />
<LinkCard title="git_last_tag" description="Gets the last tag using git." href="/genaiscript/reference/scripts/system#systemgit" />
<LinkCard title="github_actions_workflows_list" description="List all workflows as a list of 'id: name' pair." href="/genaiscript/reference/scripts/system#systemgithub_actions" />
<LinkCard title="github_actions_runs_list" description="List all runs for a workflow or the entire repository. Use 'git_actions_list_workflows' to list workflows. Omit 'workflow_id' to list all runs." href="/genaiscript/reference/scripts/system#systemgithub_actions" />
<LinkCard title="github_actions_jobs_list" description="List all jobs for a run." href="/genaiscript/reference/scripts/system#systemgithub_actions" />
<LinkCard title="github_actions_job_logs_get" description="Download workflow job log. If the log is too large, use 'github_actions_job_logs_diff' to compare logs." href="/genaiscript/reference/scripts/system#systemgithub_actions" />
<LinkCard title="github_actions_job_logs_diff" description="Diffs two workflow job logsr." href="/genaiscript/reference/scripts/system#systemgithub_actions" />
Expand Down
81 changes: 49 additions & 32 deletions docs/src/content/docs/reference/scripts/system.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,13 @@ defTool(
(_) => {
_.def("QUERY", query)

_.$`Your are a helpfull LLM agent that can query Git to accomplish tasks.
_.$`Your are a helpfull LLM agent that can use git tools to query a repository.
Analyze and answer QUERY.
- Assume that your answer will be analyzed by an LLM, not a human.
- If you cannot answer the query, return an empty string.
- If you are missing information, reply "MISSING_INFO: <what is missing>".
- If you cannot answer the query, return "NO_ANSWER: <reason>".
`
},
{
Expand Down Expand Up @@ -853,43 +854,49 @@ defTool(
git read operations
Various tools to explore git.
Tools to query a git repository.
- tool `git_branch_current`: Gets the current branch.
- tool `git_branch_list`: List all branches.
- tool `git_diff`: Generates concise file diffs.
- tool `git_log`: Generates a log of commits.
- tool `git_status`: Generates a status of the repository.
- tool `git_last_tag`: Gets the last tag.
- tool `git_branch_current`: Gets the current branch using git.
- tool `git_branch_list`: List all branches using git.
- tool `git_diff`: Generates concise file diffs using git.
- tool `git_log`: Generates a log of commits using git.
- tool `git_status`: Generates a status of the repository using git.
- tool `git_last_tag`: Gets the last tag using git.
`````js wrap title="system.git"
system({
title: "git read operations",
description: "Various tools to explore git.",
description: "Tools to query a git repository.",
})

defTool("git_branch_current", "Gets the current branch.", {}, async () => {
return await git.branch()
})
defTool(
"git_branch_current",
"Gets the current branch using git.",
{},
async () => {
return await git.branch()
}
)

defTool("git_branch_list", "List all branches.", {}, async () => {
defTool("git_branch_list", "List all branches using git.", {}, async () => {
return await git.exec("branch")
})

defTool(
"git_diff",
"Generates concise file diffs.",
"Generates concise file diffs using git.",
{
type: "object",
properties: {
base: {
type: "string",
description:
"Base branch to compare against. Use 'BASE' to compare against the repository default branch.",
"Base branch, ref, commit sha to compare against. Use 'DEFAULT' to compare against the repository default branch.",
},
head: {
type: "string",
description: "Head branch to compare",
description:
"Head branch, ref, commit sha to compare. Use 'HEAD' to compare against the current branch.",
},
staged: {
type: "boolean",
Expand All @@ -915,7 +922,7 @@ defTool(

defTool(
"git_log",
"Generates a log of commits.",
"Generates a log of commits using git.",
{
type: "object",
properties: {
Expand Down Expand Up @@ -944,11 +951,16 @@ defTool(
}
)

defTool("git_status", "Generates a status of the repository.", {}, async () => {
return await git.exec(["status", "--porcelain"])
})
defTool(
"git_status",
"Generates a status of the repository using git.",
{},
async () => {
return await git.exec(["status", "--porcelain"])
}
)

defTool("git_last_tag", "Gets the last tag.", {}, async () => {
defTool("git_last_tag", "Gets the last tag using git.", {}, async () => {
return await git.lastTag()
})

Expand All @@ -962,7 +974,6 @@ github workflows
Queries results from workflows in GitHub actions.
- tool `github_actions_workflows_list`: List all workflows as a list of 'id: name' pair.
- tool `github_actions_runs_list`: List all runs for a workflow or the entire repository. Use 'git_actions_list_workflows' to list workflows. Omit 'workflow_id' to list all runs.
- tool `github_actions_jobs_list`: List all jobs for a run.
- tool `github_actions_job_logs_get`: Download workflow job log. If the log is too large, use 'github_actions_job_logs_diff' to compare logs.
- tool `github_actions_job_logs_diff`: Diffs two workflow job logsr.
Expand Down Expand Up @@ -990,7 +1001,10 @@ defTool(

defTool(
"github_actions_runs_list",
"List all runs for a workflow or the entire repository. Use 'git_actions_list_workflows' to list workflows. Omit 'workflow_id' to list all runs.",
`List all runs for a workflow or the entire repository.
Use 'git_actions_list_workflows' to list workflows.
Omit 'workflow_id' to list all runs.
head_sha is the commit hash.`,
{
type: "object",
properties: {
Expand All @@ -1006,8 +1020,7 @@ defTool(
status: {
type: "string",
enum: ["success", "failure"],
description:
"Filter runs by completion status: success, failured.",
description: "Filter runs by completion status",
},
},
},
Expand Down Expand Up @@ -1201,6 +1214,7 @@ defTool(
properties: {
state: {
type: "string",
enum: ["open", "closed", "all"],
description:
"state of the issue from 'open, 'closed', 'all'. Default is 'open'.",
},
Expand All @@ -1210,12 +1224,13 @@ defTool(
},
sort: {
type: "string",
description:
"What to sort by: 'created', 'updated', 'comments'",
enum: ["created", "updated", "comments"],
description: "What to sort by",
},
direction: {
type: "string",
description: "Direction to sort: 'asc', 'desc'",
enum: ["asc", "desc"],
description: "Direction to sort",
},
},
},
Expand Down Expand Up @@ -1313,6 +1328,7 @@ defTool(
properties: {
state: {
type: "string",
enum: ["open", "closed", "all"],
description:
"state of the pull request from 'open, 'closed', 'all'. Default is 'open'.",
},
Expand All @@ -1322,12 +1338,13 @@ defTool(
},
sort: {
type: "string",
description:
"What to sort by: 'created', 'updated', 'comments'",
enum: ["created", "updated", "comments"],
description: "What to sort by",
},
direction: {
type: "string",
description: "Direction to sort: 'asc', 'desc'",
enum: ["asc", "desc"],
description: "Direction to sort",
},
},
},
Expand Down
1 change: 0 additions & 1 deletion genaisrc/genaiscript.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/auto/genaiscript.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/core/src/genaisrc/genaiscript.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions packages/core/src/genaisrc/system.agent_git.genai.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ defTool(
(_) => {
_.def("QUERY", query)

_.$`Your are a helpfull LLM agent that can query Git to accomplish tasks.
_.$`Your are a helpfull LLM agent that can use git tools to query a repository.
Analyze and answer QUERY.
- Assume that your answer will be analyzed by an LLM, not a human.
- If you cannot answer the query, return an empty string.
- If you are missing information, reply "MISSING_INFO: <what is missing>".
- If you cannot answer the query, return "NO_ANSWER: <reason>".
`
},
{
Expand Down
37 changes: 24 additions & 13 deletions packages/core/src/genaisrc/system.git.genai.mjs
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
system({
title: "git read operations",
description: "Various tools to explore git.",
description: "Tools to query a git repository.",
})

defTool("git_branch_current", "Gets the current branch.", {}, async () => {
return await git.branch()
})
defTool(
"git_branch_current",
"Gets the current branch using git.",
{},
async () => {
return await git.branch()
}
)

defTool("git_branch_list", "List all branches.", {}, async () => {
defTool("git_branch_list", "List all branches using git.", {}, async () => {
return await git.exec("branch")
})

defTool(
"git_diff",
"Generates concise file diffs.",
"Generates concise file diffs using git.",
{
type: "object",
properties: {
base: {
type: "string",
description:
"Base branch to compare against. Use 'BASE' to compare against the repository default branch.",
"Base branch, ref, commit sha to compare against. Use 'DEFAULT' to compare against the repository default branch.",
},
head: {
type: "string",
description: "Head branch to compare",
description:
"Head branch, ref, commit sha to compare. Use 'HEAD' to compare against the current branch.",
},
staged: {
type: "boolean",
Expand All @@ -50,7 +56,7 @@ defTool(

defTool(
"git_log",
"Generates a log of commits.",
"Generates a log of commits using git.",
{
type: "object",
properties: {
Expand Down Expand Up @@ -79,10 +85,15 @@ defTool(
}
)

defTool("git_status", "Generates a status of the repository.", {}, async () => {
return await git.exec(["status", "--porcelain"])
})
defTool(
"git_status",
"Generates a status of the repository using git.",
{},
async () => {
return await git.exec(["status", "--porcelain"])
}
)

defTool("git_last_tag", "Gets the last tag.", {}, async () => {
defTool("git_last_tag", "Gets the last tag using git.", {}, async () => {
return await git.lastTag()
})
8 changes: 5 additions & 3 deletions packages/core/src/genaisrc/system.github_actions.genai.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ defTool(

defTool(
"github_actions_runs_list",
"List all runs for a workflow or the entire repository. Use 'git_actions_list_workflows' to list workflows. Omit 'workflow_id' to list all runs.",
`List all runs for a workflow or the entire repository.
Use 'git_actions_list_workflows' to list workflows.
Omit 'workflow_id' to list all runs.
head_sha is the commit hash.`,
{
type: "object",
properties: {
Expand All @@ -36,8 +39,7 @@ defTool(
status: {
type: "string",
enum: ["success", "failure"],
description:
"Filter runs by completion status: success, failured.",
description: "Filter runs by completion status",
},
},
},
Expand Down
8 changes: 5 additions & 3 deletions packages/core/src/genaisrc/system.github_issues.genai.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ defTool(
properties: {
state: {
type: "string",
enum: ["open", "closed", "all"],
description:
"state of the issue from 'open, 'closed', 'all'. Default is 'open'.",
},
Expand All @@ -19,12 +20,13 @@ defTool(
},
sort: {
type: "string",
description:
"What to sort by: 'created', 'updated', 'comments'",
enum: ["created", "updated", "comments"],
description: "What to sort by",
},
direction: {
type: "string",
description: "Direction to sort: 'asc', 'desc'",
enum: ["asc", "desc"],
description: "Direction to sort",
},
},
},
Expand Down
Loading

0 comments on commit f4dd56d

Please sign in to comment.