Skip to content

Commit 5a38626

Browse files
authored
Merge pull request #432 from drpebcak/gen-cli-docs
2 parents 3aa1ab7 + 00568f1 commit 5a38626

File tree

12 files changed

+367
-1
lines changed

12 files changed

+367
-1
lines changed

.github/workflows/validate-docs.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Validate docs build
2+
on:
3+
push:
4+
paths:
5+
- docs/**
6+
branches:
7+
- main
8+
pull_request:
9+
paths:
10+
- docs/**
11+
branches:
12+
- main
13+
14+
jobs:
15+
validate-docs:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- uses: actions/setup-go@v4
22+
with:
23+
cache: false
24+
go-version: "1.22"
25+
- run: make init-docs
26+
- run: make validate-docs

.golangci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ run:
22
timeout: 5m
33

44
output:
5-
format: github-actions
5+
formats:
6+
- github-actions
67

78
linters:
89
disable-all: true

Makefile

+16
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,19 @@ ci: build
4444

4545
serve-docs:
4646
(cd docs && npm i && npm start)
47+
48+
49+
# This will initialize the node_modules needed to run the docs dev server. Run this before running serve-docs
50+
init-docs:
51+
docker run --rm --workdir=/docs -v $${PWD}/docs:/docs node:18-buster yarn install
52+
53+
# Ensure docs build without errors. Makes sure generated docs are in-sync with CLI.
54+
validate-docs:
55+
docker run --rm --workdir=/docs -v $${PWD}/docs:/docs node:18-buster yarn build
56+
go run tools/gendocs/main.go
57+
if [ -n "$$(git status --porcelain --untracked-files=no)" ]; then \
58+
git status --porcelain --untracked-files=no; \
59+
echo "Encountered dirty repo!"; \
60+
git diff; \
61+
exit 1 \
62+
;fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: "gptscript"
3+
---
4+
## gptscript
5+
6+
7+
8+
```
9+
gptscript [flags] PROGRAM_FILE [INPUT...]
10+
```
11+
12+
### Options
13+
14+
```
15+
--cache-dir string Directory to store cache (default: $XDG_CACHE_HOME/gptscript) ($GPTSCRIPT_CACHE_DIR)
16+
--chat-state string The chat state to continue, or null to start a new chat and return the state ($GPTSCRIPT_CHAT_STATE)
17+
-C, --chdir string Change current working directory ($GPTSCRIPT_CHDIR)
18+
--color Use color in output (default true) ($GPTSCRIPT_COLOR)
19+
--config string Path to GPTScript config file ($GPTSCRIPT_CONFIG)
20+
--confirm Prompt before running potentially dangerous commands ($GPTSCRIPT_CONFIRM)
21+
--credential-context string Context name in which to store credentials ($GPTSCRIPT_CREDENTIAL_CONTEXT) (default "default")
22+
--credential-override string Credentials to override (ex: --credential-override github.com/example/cred-tool:API_TOKEN=1234) ($GPTSCRIPT_CREDENTIAL_OVERRIDE)
23+
--debug Enable debug logging ($GPTSCRIPT_DEBUG)
24+
--debug-messages Enable logging of chat completion calls ($GPTSCRIPT_DEBUG_MESSAGES)
25+
--default-model string Default LLM model to use ($GPTSCRIPT_DEFAULT_MODEL) (default "gpt-4o")
26+
--disable-cache Disable caching of LLM API responses ($GPTSCRIPT_DISABLE_CACHE)
27+
--disable-tui Don't use chat TUI but instead verbose output ($GPTSCRIPT_DISABLE_TUI)
28+
--dump-state string Dump the internal execution state to a file ($GPTSCRIPT_DUMP_STATE)
29+
--events-stream-to string Stream events to this location, could be a file descriptor/handle (e.g. fd://2), filename, or named pipe (e.g. \\.\pipe\my-pipe) ($GPTSCRIPT_EVENTS_STREAM_TO)
30+
--force-chat Force an interactive chat session if even the top level tool is not a chat tool ($GPTSCRIPT_FORCE_CHAT)
31+
--force-sequential Force parallel calls to run sequentially ($GPTSCRIPT_FORCE_SEQUENTIAL)
32+
-h, --help help for gptscript
33+
-f, --input string Read input from a file ("-" for stdin) ($GPTSCRIPT_INPUT)
34+
--list-models List the models available and exit ($GPTSCRIPT_LIST_MODELS)
35+
--list-tools List built-in tools and exit ($GPTSCRIPT_LIST_TOOLS)
36+
--listen-address string Server listen address ($GPTSCRIPT_LISTEN_ADDRESS) (default "127.0.0.1:9090")
37+
--no-trunc Do not truncate long log messages ($GPTSCRIPT_NO_TRUNC)
38+
--openai-api-key string OpenAI API KEY ($OPENAI_API_KEY)
39+
--openai-base-url string OpenAI base URL ($OPENAI_BASE_URL)
40+
--openai-org-id string OpenAI organization ID ($OPENAI_ORG_ID)
41+
-o, --output string Save output to a file, or - for stdout ($GPTSCRIPT_OUTPUT)
42+
-q, --quiet No output logging (set --quiet=false to force on even when there is no TTY) ($GPTSCRIPT_QUIET)
43+
--server Start server ($GPTSCRIPT_SERVER)
44+
--sub-tool string Use tool of this name, not the first tool in file ($GPTSCRIPT_SUB_TOOL)
45+
--ui Launch the UI ($GPTSCRIPT_UI)
46+
--workspace string Directory to use for the workspace, if specified it will not be deleted on exit ($GPTSCRIPT_WORKSPACE)
47+
```
48+
49+
### SEE ALSO
50+
51+
* [gptscript credential](gptscript_credential.md) - List stored credentials
52+
* [gptscript eval](gptscript_eval.md) -
53+
* [gptscript fmt](gptscript_fmt.md) -
54+
* [gptscript parse](gptscript_parse.md) -
55+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: "gptscript credential"
3+
---
4+
## gptscript credential
5+
6+
List stored credentials
7+
8+
```
9+
gptscript credential [flags]
10+
```
11+
12+
### Options
13+
14+
```
15+
--all-contexts List credentials for all contexts ($GPTSCRIPT_CREDENTIAL_ALL_CONTEXTS)
16+
-h, --help help for credential
17+
--show-env-vars Show names of environment variables in each credential ($GPTSCRIPT_CREDENTIAL_SHOW_ENV_VARS)
18+
```
19+
20+
### Options inherited from parent commands
21+
22+
```
23+
--credential-context string Context name in which to store credentials ($GPTSCRIPT_CREDENTIAL_CONTEXT) (default "default")
24+
```
25+
26+
### SEE ALSO
27+
28+
* [gptscript](gptscript.md) -
29+
* [gptscript credential delete](gptscript_credential_delete.md) - Delete a stored credential
30+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: "gptscript credential delete"
3+
---
4+
## gptscript credential delete
5+
6+
Delete a stored credential
7+
8+
```
9+
gptscript credential delete <tool name> [flags]
10+
```
11+
12+
### Options
13+
14+
```
15+
-h, --help help for delete
16+
```
17+
18+
### Options inherited from parent commands
19+
20+
```
21+
--credential-context string Context name in which to store credentials ($GPTSCRIPT_CREDENTIAL_CONTEXT) (default "default")
22+
```
23+
24+
### SEE ALSO
25+
26+
* [gptscript credential](gptscript_credential.md) - List stored credentials
27+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: "gptscript eval"
3+
---
4+
## gptscript eval
5+
6+
7+
8+
```
9+
gptscript eval [flags]
10+
```
11+
12+
### Options
13+
14+
```
15+
--chat Enable chat ($GPTSCRIPT_EVAL_CHAT)
16+
-h, --help help for eval
17+
--internal-prompt ($GPTSCRIPT_EVAL_INTERNAL_PROMPT)
18+
--json Output JSON ($GPTSCRIPT_EVAL_JSON)
19+
--max-tokens int Maximum number of tokens to output ($GPTSCRIPT_EVAL_MAX_TOKENS)
20+
--model string The model to use ($GPTSCRIPT_EVAL_MODEL)
21+
--temperature string Set the temperature, "creativity" ($GPTSCRIPT_EVAL_TEMPERATURE)
22+
--tools strings Tools available to call ($GPTSCRIPT_EVAL_TOOLS)
23+
```
24+
25+
### Options inherited from parent commands
26+
27+
```
28+
--cache-dir string Directory to store cache (default: $XDG_CACHE_HOME/gptscript) ($GPTSCRIPT_CACHE_DIR)
29+
--chat-state string The chat state to continue, or null to start a new chat and return the state ($GPTSCRIPT_CHAT_STATE)
30+
-C, --chdir string Change current working directory ($GPTSCRIPT_CHDIR)
31+
--color Use color in output (default true) ($GPTSCRIPT_COLOR)
32+
--config string Path to GPTScript config file ($GPTSCRIPT_CONFIG)
33+
--confirm Prompt before running potentially dangerous commands ($GPTSCRIPT_CONFIRM)
34+
--credential-context string Context name in which to store credentials ($GPTSCRIPT_CREDENTIAL_CONTEXT) (default "default")
35+
--credential-override string Credentials to override (ex: --credential-override github.com/example/cred-tool:API_TOKEN=1234) ($GPTSCRIPT_CREDENTIAL_OVERRIDE)
36+
--debug Enable debug logging ($GPTSCRIPT_DEBUG)
37+
--debug-messages Enable logging of chat completion calls ($GPTSCRIPT_DEBUG_MESSAGES)
38+
--default-model string Default LLM model to use ($GPTSCRIPT_DEFAULT_MODEL) (default "gpt-4o")
39+
--disable-cache Disable caching of LLM API responses ($GPTSCRIPT_DISABLE_CACHE)
40+
--dump-state string Dump the internal execution state to a file ($GPTSCRIPT_DUMP_STATE)
41+
--events-stream-to string Stream events to this location, could be a file descriptor/handle (e.g. fd://2), filename, or named pipe (e.g. \\.\pipe\my-pipe) ($GPTSCRIPT_EVENTS_STREAM_TO)
42+
--force-chat Force an interactive chat session if even the top level tool is not a chat tool ($GPTSCRIPT_FORCE_CHAT)
43+
--force-sequential Force parallel calls to run sequentially ($GPTSCRIPT_FORCE_SEQUENTIAL)
44+
-f, --input string Read input from a file ("-" for stdin) ($GPTSCRIPT_INPUT)
45+
--no-trunc Do not truncate long log messages ($GPTSCRIPT_NO_TRUNC)
46+
--openai-api-key string OpenAI API KEY ($OPENAI_API_KEY)
47+
--openai-base-url string OpenAI base URL ($OPENAI_BASE_URL)
48+
--openai-org-id string OpenAI organization ID ($OPENAI_ORG_ID)
49+
-o, --output string Save output to a file, or - for stdout ($GPTSCRIPT_OUTPUT)
50+
-q, --quiet No output logging (set --quiet=false to force on even when there is no TTY) ($GPTSCRIPT_QUIET)
51+
--workspace string Directory to use for the workspace, if specified it will not be deleted on exit ($GPTSCRIPT_WORKSPACE)
52+
```
53+
54+
### SEE ALSO
55+
56+
* [gptscript](gptscript.md) -
57+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: "gptscript fmt"
3+
---
4+
## gptscript fmt
5+
6+
7+
8+
```
9+
gptscript fmt [flags]
10+
```
11+
12+
### Options
13+
14+
```
15+
-h, --help help for fmt
16+
-w, --write Write output to file instead of stdout ($GPTSCRIPT_FMT_WRITE)
17+
```
18+
19+
### Options inherited from parent commands
20+
21+
```
22+
--cache-dir string Directory to store cache (default: $XDG_CACHE_HOME/gptscript) ($GPTSCRIPT_CACHE_DIR)
23+
--chat-state string The chat state to continue, or null to start a new chat and return the state ($GPTSCRIPT_CHAT_STATE)
24+
-C, --chdir string Change current working directory ($GPTSCRIPT_CHDIR)
25+
--color Use color in output (default true) ($GPTSCRIPT_COLOR)
26+
--config string Path to GPTScript config file ($GPTSCRIPT_CONFIG)
27+
--confirm Prompt before running potentially dangerous commands ($GPTSCRIPT_CONFIRM)
28+
--credential-context string Context name in which to store credentials ($GPTSCRIPT_CREDENTIAL_CONTEXT) (default "default")
29+
--credential-override string Credentials to override (ex: --credential-override github.com/example/cred-tool:API_TOKEN=1234) ($GPTSCRIPT_CREDENTIAL_OVERRIDE)
30+
--debug Enable debug logging ($GPTSCRIPT_DEBUG)
31+
--debug-messages Enable logging of chat completion calls ($GPTSCRIPT_DEBUG_MESSAGES)
32+
--default-model string Default LLM model to use ($GPTSCRIPT_DEFAULT_MODEL) (default "gpt-4o")
33+
--disable-cache Disable caching of LLM API responses ($GPTSCRIPT_DISABLE_CACHE)
34+
--dump-state string Dump the internal execution state to a file ($GPTSCRIPT_DUMP_STATE)
35+
--events-stream-to string Stream events to this location, could be a file descriptor/handle (e.g. fd://2), filename, or named pipe (e.g. \\.\pipe\my-pipe) ($GPTSCRIPT_EVENTS_STREAM_TO)
36+
--force-chat Force an interactive chat session if even the top level tool is not a chat tool ($GPTSCRIPT_FORCE_CHAT)
37+
--force-sequential Force parallel calls to run sequentially ($GPTSCRIPT_FORCE_SEQUENTIAL)
38+
-f, --input string Read input from a file ("-" for stdin) ($GPTSCRIPT_INPUT)
39+
--no-trunc Do not truncate long log messages ($GPTSCRIPT_NO_TRUNC)
40+
--openai-api-key string OpenAI API KEY ($OPENAI_API_KEY)
41+
--openai-base-url string OpenAI base URL ($OPENAI_BASE_URL)
42+
--openai-org-id string OpenAI organization ID ($OPENAI_ORG_ID)
43+
-o, --output string Save output to a file, or - for stdout ($GPTSCRIPT_OUTPUT)
44+
-q, --quiet No output logging (set --quiet=false to force on even when there is no TTY) ($GPTSCRIPT_QUIET)
45+
--workspace string Directory to use for the workspace, if specified it will not be deleted on exit ($GPTSCRIPT_WORKSPACE)
46+
```
47+
48+
### SEE ALSO
49+
50+
* [gptscript](gptscript.md) -
51+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: "gptscript parse"
3+
---
4+
## gptscript parse
5+
6+
7+
8+
```
9+
gptscript parse [flags]
10+
```
11+
12+
### Options
13+
14+
```
15+
-h, --help help for parse
16+
-p, --pretty-print Indent the json output ($GPTSCRIPT_PARSE_PRETTY_PRINT)
17+
```
18+
19+
### Options inherited from parent commands
20+
21+
```
22+
--cache-dir string Directory to store cache (default: $XDG_CACHE_HOME/gptscript) ($GPTSCRIPT_CACHE_DIR)
23+
--chat-state string The chat state to continue, or null to start a new chat and return the state ($GPTSCRIPT_CHAT_STATE)
24+
-C, --chdir string Change current working directory ($GPTSCRIPT_CHDIR)
25+
--color Use color in output (default true) ($GPTSCRIPT_COLOR)
26+
--config string Path to GPTScript config file ($GPTSCRIPT_CONFIG)
27+
--confirm Prompt before running potentially dangerous commands ($GPTSCRIPT_CONFIRM)
28+
--credential-context string Context name in which to store credentials ($GPTSCRIPT_CREDENTIAL_CONTEXT) (default "default")
29+
--credential-override string Credentials to override (ex: --credential-override github.com/example/cred-tool:API_TOKEN=1234) ($GPTSCRIPT_CREDENTIAL_OVERRIDE)
30+
--debug Enable debug logging ($GPTSCRIPT_DEBUG)
31+
--debug-messages Enable logging of chat completion calls ($GPTSCRIPT_DEBUG_MESSAGES)
32+
--default-model string Default LLM model to use ($GPTSCRIPT_DEFAULT_MODEL) (default "gpt-4o")
33+
--disable-cache Disable caching of LLM API responses ($GPTSCRIPT_DISABLE_CACHE)
34+
--dump-state string Dump the internal execution state to a file ($GPTSCRIPT_DUMP_STATE)
35+
--events-stream-to string Stream events to this location, could be a file descriptor/handle (e.g. fd://2), filename, or named pipe (e.g. \\.\pipe\my-pipe) ($GPTSCRIPT_EVENTS_STREAM_TO)
36+
--force-chat Force an interactive chat session if even the top level tool is not a chat tool ($GPTSCRIPT_FORCE_CHAT)
37+
--force-sequential Force parallel calls to run sequentially ($GPTSCRIPT_FORCE_SEQUENTIAL)
38+
-f, --input string Read input from a file ("-" for stdin) ($GPTSCRIPT_INPUT)
39+
--no-trunc Do not truncate long log messages ($GPTSCRIPT_NO_TRUNC)
40+
--openai-api-key string OpenAI API KEY ($OPENAI_API_KEY)
41+
--openai-base-url string OpenAI base URL ($OPENAI_BASE_URL)
42+
--openai-org-id string OpenAI organization ID ($OPENAI_ORG_ID)
43+
-o, --output string Save output to a file, or - for stdout ($GPTSCRIPT_OUTPUT)
44+
-q, --quiet No output logging (set --quiet=false to force on even when there is no TTY) ($GPTSCRIPT_QUIET)
45+
--workspace string Directory to use for the workspace, if specified it will not be deleted on exit ($GPTSCRIPT_WORKSPACE)
46+
```
47+
48+
### SEE ALSO
49+
50+
* [gptscript](gptscript.md) -
51+

go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ require (
5252
github.com/charmbracelet/x/ansi v0.1.1 // indirect
5353
github.com/connesc/cipherio v0.2.1 // indirect
5454
github.com/containerd/console v1.0.4 // indirect
55+
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
5556
github.com/davecgh/go-spew v1.1.1 // indirect
5657
github.com/dlclark/regexp2 v1.4.0 // indirect
5758
github.com/dsnet/compress v0.0.1 // indirect
@@ -93,6 +94,7 @@ require (
9394
github.com/pmezard/go-difflib v1.0.0 // indirect
9495
github.com/pterm/pterm v0.12.79 // indirect
9596
github.com/rivo/uniseg v0.4.7 // indirect
97+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
9698
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
9799
github.com/therootcompany/xz v1.0.1 // indirect
98100
github.com/tidwall/match v1.1.1 // indirect

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ github.com/connesc/cipherio v0.2.1/go.mod h1:ukY0MWJDFnJEbXMQtOcn2VmTpRfzcTz4OoV
8787
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
8888
github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro=
8989
github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
90+
github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM=
9091
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
9192
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
9293
github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI=
@@ -302,6 +303,7 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU
302303
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
303304
github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po=
304305
github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
306+
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
305307
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
306308
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk=
307309
github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM=

0 commit comments

Comments
 (0)