Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 99 additions & 98 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,109 +2,110 @@ name: Pre-commit

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
workflow_dispatch: # Allow manual triggering
branches: [main]
workflow_dispatch: # Allow manual triggering

jobs:
pre-commit:
runs-on: ubuntu-latest
name: Run pre-commit hooks check file lint

steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for pre-commit

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'

- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: 23

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.90
components: rustfmt, clippy

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
make \
build-essential \
pkg-config
npm install -g markdownlint-cli
pip install --user yamllint codespell
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.5.0

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
candle-binding/target/
key: ${{ runner.os }}-cargo-precommit-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-precommit-

- name: Cache Go dependencies
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
key: ${{ runner.os }}-go-precommit-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-precommit-

- name: Cache Node dependencies
uses: actions/cache@v4
with:
path: |
~/.npm
key: ${{ runner.os }}-node-precommit-${{ hashFiles('website/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-precommit-

- name: Cache pre-commit environments
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-precommit-

- name: Install pre-commit
run: make precommit-install

- name: Run Code Spell Check
run: make codespell

- name: Run pre-commit check
run: make precommit-check
env:
CI: true

- name: Show pre-commit results
if: failure()
run: |
echo "::error::Pre-commit hooks failed. Please fix the issues and commit again."
echo "To run pre-commit locally:"
echo " pip install pre-commit"
echo " pre-commit install"
echo " pre-commit run --all-files"
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for pre-commit

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"

- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: 23

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.90
components: rustfmt, clippy

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
make \
build-essential \
pkg-config \
shellcheck
npm install -g markdownlint-cli
pip install --user yamllint codespell
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.5.0

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
candle-binding/target/
key: ${{ runner.os }}-cargo-precommit-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-precommit-

- name: Cache Go dependencies
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
key: ${{ runner.os }}-go-precommit-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-precommit-

- name: Cache Node dependencies
uses: actions/cache@v4
with:
path: |
~/.npm
key: ${{ runner.os }}-node-precommit-${{ hashFiles('website/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-precommit-

- name: Cache pre-commit environments
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-precommit-

- name: Install pre-commit
run: make precommit-install

- name: Run Code Spell Check
run: make codespell

- name: Run pre-commit check
run: make precommit-check
env:
CI: true

- name: Show pre-commit results
if: failure()
run: |
echo "::error::Pre-commit hooks failed. Please fix the issues and commit again."
echo "To run pre-commit locally:"
echo " pip install pre-commit"
echo " pre-commit install"
echo " pre-commit run --all-files"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

An **Mixture-of-Models** (MoM) router that intelligently directs OpenAI API requests to the most suitable models from a defined pool based on **Semantic Understanding** of the request's intent (Complexity, Task, Tools).

![](./website/static/img/mom-overview.png)
![mom-overview](./website/static/img/mom-overview.png)

Conceptually similar to Mixture-of-Experts (MoE) which lives *within* a model, this system selects the best *entire model* for the nature of the task.

Expand Down
4 changes: 3 additions & 1 deletion scripts/quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ typewriter() {
# Function to show ASCII art with animation
show_ascii_art() {
# Skip clear in CI environments (no proper terminal)
[ -z "${CI:-}" ] && clear || true
if [ -z "${CI:-}" ]; then
clear || true
fi
echo
echo
print_color "$CYAN" " ██╗ ██╗██╗ ██╗ ███╗ ███╗"
Expand Down
4 changes: 4 additions & 0 deletions tools/make/envs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# = Environment Makefile, refer for other makefile =
# ====================== envs.mk ======================

# CI environment flag (set by CI/CD systems like GitHub Actions)
# Can be overridden: CI=true make build
CI ?=

# Container runtime (docker or podman)
CONTAINER_RUNTIME ?= docker

Expand Down
23 changes: 14 additions & 9 deletions tools/make/linter.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@

##@ Linter

docs-lint: docs-install ## Lint documentation in website/
@$(LOG_TARGET)
cd website && npm run lint

docs-lint-fix: docs-install ## Auto-fix documentation lint issues in website/
@$(LOG_TARGET)
cd website && npm run lint:fix

markdown-lint: ## Lint all markdown files in the project
@$(LOG_TARGET)
markdownlint -c tools/linter/markdown/markdownlint.yaml "**/*.md" \
Expand Down Expand Up @@ -40,4 +32,17 @@ codespell: ## Check for common misspellings in code and docs

shellcheck: ## Lint all shell scripts in the project
@$(LOG_TARGET)
shellcheck --rcfile=tools/linter/shellcheck/.shellcheckrc $(shell find . -type f -name "*.sh" -not -path "./node_modules/*" -not -path "./website/node_modules/*" -not -path "./dashboard/frontend/node_modules/*" -not -path "./models/*" -not -path "./.venv/*")
@if ! command -v shellcheck >/dev/null 2>&1; then \
echo "❌ Error: shellcheck is not installed"; \
echo ""; \
echo "To install shellcheck:"; \
echo " macOS: brew install shellcheck"; \
echo " Ubuntu: sudo apt-get install shellcheck"; \
echo " Fedora: sudo dnf install shellcheck"; \
echo ""; \
echo "Or skip shellcheck in pre-commit by running:"; \
echo " SKIP=shellcheck pre-commit run --all-files"; \
exit 1; \
fi
@echo "Running shellcheck with config from tools/linter/shellcheck/.shellcheckrc"
@shellcheck -e SC2155,SC2034,SC1091 $(shell find . -type f -name "*.sh" -not -path "./node_modules/*" -not -path "./website/node_modules/*" -not -path "./dashboard/frontend/node_modules/*" -not -path "./models/*" -not -path "./.venv/*")
4 changes: 2 additions & 2 deletions tools/make/pre-commit.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ precommit-install:

precommit-check: ## Run pre-commit checks on all relevant files
precommit-check:
@FILES=$$(find . -type f \( -name "*.go" -o -name "*.rs" -o -name "*.py" -o -name "*.js" -o -name "*.md" -o -name "*.yaml" -o -name "*.yml" \) \
@FILES=$$(find . -type f \( -name "*.go" -o -name "*.rs" -o -name "*.py" -o -name "*.js" -o -name "*.sh" -o -name "*.md" -o -name "*.yaml" -o -name "*.yml" \) \
! -path "./target/*" \
! -path "./candle-binding/target/*" \
! -path "./website/node_modules/*" \
Expand All @@ -24,7 +24,7 @@ precommit-check:
echo "Running pre-commit on files: $$FILES"; \
pre-commit run --files $$FILES; \
else \
echo "No Go, Rust, JavaScript, Markdown, Yaml, or Python files found to check"; \
echo "No Go, Rust, JavaScript, Shell, Markdown, Yaml, or Python files found to check"; \
fi

# Run pre-commit hooks in a Docker container,
Expand Down
Loading