Skip to content

Commit

Permalink
feat!: rename to beeai-framework, switch to monorepo
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Dvorak <[email protected]>
  • Loading branch information
Tomas2D committed Feb 19, 2025
1 parent 77a6c34 commit 5f28d70
Show file tree
Hide file tree
Showing 369 changed files with 1,228 additions and 760 deletions.
50 changes: 50 additions & 0 deletions .githooks/hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh

set -e

HOOK_NAME=$(basename "$0")
STAGED_FILES=$(git diff --staged --name-only)
if [ -z "$STAGED_FILES" ] && [ "$HOOK_NAME" = "pre-commit" ]; then
echo "Error: Stash is empty. Aborting."
exit 1
fi

COMMIT_MSG_FILE="$1"
HOOK_ARGS=${COMMIT_MSG_FILE:-$STAGED_FILES}

TS_DIR="typescript"
HAS_TS_FILES=$(echo "$STAGED_FILES" | grep -q "^$TS_DIR/" && echo 1 || echo 0)

PY_DIR="python"
HAS_PY_FILES=$(echo "$STAGED_FILES" | grep -q "^$PY_DIR/" && echo 1 || echo 0)

if [ "$HAS_TS_FILES" -eq 1 ] && [ "$HAS_PY_FILES" -eq 1 ]; then
echo "Error: Cannot commit changes in both $TS_DIR and $PY_DIR at the same time."
exit 1
fi

# Run hooks based on staged files
if [ "$HAS_TS_FILES" -eq 1 ] && grep -q "\"git:$HOOK_NAME\"" "$TS_DIR/package.json"; then
echo "Running $HOOK_NAME hook in $TS_DIR..."
(cd "$TS_DIR" && npm run "git:$HOOK_NAME" "$HOOK_ARGS") || exit $?
fi

if [ "$HAS_PY_FILES" -eq 1 ]; then
echo "Running Python $HOOK_NAME hook..."
(cd "$PY_DIR" && poetry run poe git --hook "$HOOK_NAME" "$HOOK_ARGS") || exit $?
fi

# General commit style check
if [ "$HAS_TS_FILES" -eq 0 ] && [ "$HAS_PY_FILES" -eq 0 ]; then
if [ "$HOOK_NAME" = "commit-msg" ] ; then
COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
CONVENTIONAL_COMMIT_REGEX="^(chore|ci|docs|revert)(\(\w+\))?!?: .+"

if ! echo "$COMMIT_MSG" | grep -qE "$CONVENTIONAL_COMMIT_REGEX"; then
echo "Error: The provided commit message does not adhere to conventional commit style!"
echo "Validation Regex: $CONVENTIONAL_COMMIT_REGEX"
echo "Your commit message: $COMMIT_MSG"
exit 1
fi
fi
fi
18 changes: 18 additions & 0 deletions .githooks/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

set -e

GIT_ROOT_DIR=`git rev-parse --show-toplevel`
SCRIPT_DIR=`(cd "$(dirname "$0")" && pwd)`

WRAPPER_SCRIPT="${SCRIPT_DIR}/hook.sh"
chmod +x "$WRAPPER_SCRIPT"

HOOK_NAMES="pre-commit commit-msg pre-push post-merge pre-rebase post-checkout post-commit post-rewrite"
for HOOK in $HOOK_NAMES; do
TARGET="$GIT_ROOT_DIR/.git/hooks/$HOOK"
cp -f "$WRAPPER_SCRIPT" "$TARGET"
chmod u+x "$TARGET"
done

echo "All Git hooks are now set up!"
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Closes: #

<!-- For completed items, change [ ] to [x]. -->

- [ ] I have read the [contributor guide](https://github.com/i-am-bee/bee-agent-framework/blob/main/CONTRIBUTING.md)
- [ ] I have [signed off](https://github.com/i-am-bee/bee-agent-framework/blob/main/CONTRIBUTING.md#developer-certificate-of-origin-dco) on my commit
- [ ] I have read the [contributor guide](https://github.com/i-am-bee/beeai-framework/blob/main/CONTRIBUTING.md)
- [ ] I have [signed off](https://github.com/i-am-bee/beeai-framework/blob/main/CONTRIBUTING.md#developer-certificate-of-origin-dco) on my commit
- [ ] Linting passes: `yarn lint` or `yarn lint:fix`
- [ ] Formatting is applied: `yarn format` or `yarn format:fix`
- [ ] Unit tests pass: `yarn test:unit`
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build documentation

on:
workflow_dispatch:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Copy root
run: cp *.md docs/

- name: Copy TypeScript Documentation
run: cp -r ./typescript/docs docs/typescript

- name: Upload Documentation Artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs

deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write

steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
name: E2E Tests
name: TypeScript - E2E Tests

on:
workflow_dispatch:
push:
branches: ["main"]
paths:
- 'typescript/**'
paths-ignore:
- "**/*.md"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
working-directory: typescript

jobs:
test:
name: Tests
Expand All @@ -31,6 +37,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache-dependency-path: "typescript/yarn.lock"
- name: Install dependencies
run: yarn install --immutable
- name: E2E Tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: E2E Examples
name: TypeScript - E2E Examples

on:
# TODO: ollama hangs
#push:
# branches: ["main"]
# paths:
# - 'typescript/**'
# paths-ignore:
# - "**/*.md"
workflow_dispatch:
Expand All @@ -12,6 +14,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
working-directory: typescript

jobs:
test:
name: Tests
Expand All @@ -32,6 +38,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache-dependency-path: "typescript/yarn.lock"
- name: Install dependencies
run: yarn install --immutable
- name: Install ollama
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/main.yml → .github/workflows/ts_main.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
name: Lint, Build, Test
name: TypeScript - Lint, Build, Test

on:
workflow_dispatch:
push:
branches: ["main"]
paths:
- 'typescript/**'
pull_request:
branches: ["main"]
paths:
- 'typescript/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
working-directory: typescript

jobs:
main:
timeout-minutes: 20
Expand All @@ -24,8 +33,9 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
node-version-file: "typescript/.nvmrc"
cache: "yarn"
cache-dependency-path: "typescript/yarn.lock"
- name: Setup Go
uses: actions/setup-go@v3
with:
Expand All @@ -39,7 +49,7 @@ jobs:
- name: Code Format
run: yarn format
- name: Commits Lint
run: yarn commitlint --verbose --from "${{ github.event.pull_request.base.sha || github.event.commits[0].id }}" --to "${{ github.event.pull_request.head.sha || github.event.head_commit.id }}"
run: yarn commitlint --verbose --from "${{ github.event.pull_request.base.sha || github.event.commits[0].id || github.event.before || github.sha }}" --to "${{ github.event.pull_request.head.sha || github.event.head_commit.id || github.sha }}"
- name: Documentation - code snippet embeddings
run: yarn docs:check
- name: Build
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,7 @@ dist
/experiments
.npmrc
.DS_Store

/docs/typescript
/docs/python
/docs/README.md
1 change: 0 additions & 1 deletion .husky/commit-msg

This file was deleted.

8 changes: 0 additions & 8 deletions .husky/pre-commit

This file was deleted.

4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cff-version: 1.2.0
title: Bee Agent Framework
title: BeeAI Framework
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- name: IBM Research
repository-code: "https://github.com/i-am-bee/bee-agent-framework"
repository-code: "https://github.com/i-am-bee/beeai-framework"
url: "https://github.com/i-am-bee"
license: Apache-2.0
date-released: "2024-08-23"
Loading

0 comments on commit 5f28d70

Please sign in to comment.