Skip to content

Commit

Permalink
docs: add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
b4nst committed Aug 18, 2024
1 parent 45829c3 commit 9eb759c
Show file tree
Hide file tree
Showing 20 changed files with 3,571 additions and 4 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,36 @@ jobs:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

doc:
runs-on: ubuntu-latest
permissions:
contents: write # To push a branch
pages: write # To push to a GitHub Pages site
id-token: write # To update the deployment status
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install latest mdbook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir mdbook
curl -sSL $url | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Build Book
run: |
# This assumes your book is in the root of your repository.
# Just add a `cd` here if you need to change to another directory.
mdbook build -d ../dist/docs docs/
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: 'dist/docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@ all: build

# Build the Go project
.PHONY: build
build: ## Build the Go project
build-go: ## Build the Go project
@mkdir -p $(BUILD_DIR)
go build -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/ayo

# Build the Documentation
.PHONY: build-docs
build-docs: ## Build the Documentation
mdbook build -d ../$(BUILD_DIR)/docs docs/

# Build the project
.PHONY: build
build: build-go build-docs ## Build the project

# Run the Go project
.PHONY: run
run: build ## Build and run the Go project
Expand Down
4 changes: 2 additions & 2 deletions cmd/ayo/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ type Chat struct {
func (c *Chat) Run(ctx context.Context, cli *CLI) error {
log := log.FromContext(ctx).With("caller", logPackagePrefix+"Chat:Run")

log.Debug("loading tools", "dir", cli.ToolDir)
tools, err := tool.LoadTools(cli.ToolDir)
log.Debug("loading tools", "dir", cli.Toolbox)
tools, err := tool.LoadTools(cli.Toolbox)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ayo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const logPackagePrefix = "main::"
type CLI struct {
Verbose bool `help:"Enable verbose mode." short:"v" default:"false"`
LogFormat string `help:"Log format to use." enum:"json,pretty,logfmt" default:"pretty"`
ToolDir string `help:"The directory to load tools from" default:"~/.config/ayo/tools" type:"existingdir"`
Toolbox string `help:"The directory to load tools from" default:"~/.config/ayo/toolbox" type:"existingdir" env:"AYO_TOOLBOX"`

Chat Chat `cmd:"" help:"Send a message to the chatbot" default:"withargs"`
}
Expand Down
13 changes: 13 additions & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[book]
authors = ["banst"]
language = "en"
multilingual = false
src = "src"
title = "ayo"

[build]
extra-watch-dirs = ["plugins/whichlang"]

[output.html]
additional-css = ["plugins/whichlang/whichlang.css", "devicon.css"]
additional-js = ["plugins/whichlang/whichlang.js"]
1 change: 1 addition & 0 deletions docs/devicon.css

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions docs/plugins/whichlang/whichlang.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.wl-codeblockheader {
background-color: color-mix(in srgb, var(--bg), #777 20%);
color: var(--fg);
margin-bottom: -16px;
padding: .7rem;
display: flex;
justify-content: space-between;
}

.wl-codeblockheader>span:not(.wl-icon) {
font-size: .8em;
font-family: "Open Sans", sans-serif;
}

.wl-codeblockheader>span,
.wl-codeblockheader>.wl-langinfo>span {
padding: 0 9px;
}

.wl-codeblockheader>span.wl-filepath {
text-align: right;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.wl-lang-name {
font-family: "Open Sans", sans-serif;
}
Loading

0 comments on commit 9eb759c

Please sign in to comment.