-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
8,231 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Codecov | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'agentstack/**/*.py' | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'agentstack/**/*.py' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install tox | ||
- name: Run tests with tox | ||
run: tox | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./coverage.xml | ||
flags: unittests | ||
name: codecov-umbrella | ||
fail_ci_if_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Mintlify Documentation Check | ||
on: | ||
pull_request: | ||
paths: | ||
- 'docs/**' # Only trigger on changes to docs directory | ||
- 'mint.json' # Also trigger on mintlify config changes | ||
|
||
jobs: | ||
build-docs: | ||
name: Build Documentation | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18' | ||
|
||
- name: Install Mintlify | ||
run: npm install -g mintlify | ||
|
||
- name: Test documentation | ||
run: | | ||
cd docs | ||
# If mintlify dev has errors, it will exit with status 1 | ||
# If it starts successfully, kill it after 5 seconds | ||
timeout 5s mintlify dev || exit_status=$? | ||
if [ $exit_status -eq 124 ]; then | ||
# timeout exit code 124 means the process was killed after starting successfully | ||
echo "Documentation built successfully!" | ||
exit 0 | ||
else | ||
echo "Documentation failed to build! Try running `mintlify dev` from the docs dir locally" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .cli import init_project_builder, configure_default_model, export_template | ||
from .cli import init_project_builder, configure_default_model, export_template, welcome_message | ||
from .init import init_project | ||
from .tools import list_tools, add_tool | ||
from .run import run_project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import os, sys | ||
from typing import Optional | ||
from pathlib import Path | ||
from agentstack import conf | ||
from agentstack import packaging | ||
from agentstack.cli import welcome_message, init_project_builder | ||
from agentstack.utils import term_color | ||
|
||
|
||
# TODO move the rest of the CLI init tooling into this file | ||
|
||
|
||
def require_uv(): | ||
try: | ||
uv_bin = packaging.get_uv_bin() | ||
assert os.path.exists(uv_bin) | ||
except (AssertionError, ImportError): | ||
print(term_color("Error: uv is not installed.", 'red')) | ||
print("Full installation instructions at: https://docs.astral.sh/uv/getting-started/installation") | ||
match sys.platform: | ||
case 'linux' | 'darwin': | ||
print("Hint: run `curl -LsSf https://astral.sh/uv/install.sh | sh`") | ||
case _: | ||
pass | ||
sys.exit(1) | ||
|
||
|
||
def init_project( | ||
slug_name: Optional[str] = None, | ||
template: Optional[str] = None, | ||
use_wizard: bool = False, | ||
): | ||
""" | ||
Initialize a new project in the current directory. | ||
- create a new virtual environment | ||
- copy project skeleton | ||
- install dependencies | ||
""" | ||
require_uv() | ||
|
||
# TODO prevent the user from passing the --path arguent to init | ||
if slug_name: | ||
conf.set_path(conf.PATH / slug_name) | ||
else: | ||
print("Error: No project directory specified.") | ||
print("Run `agentstack init <project_name>`") | ||
sys.exit(1) | ||
|
||
if os.path.exists(conf.PATH): # cookiecutter requires the directory to not exist | ||
print(f"Error: Directory already exists: {conf.PATH}") | ||
sys.exit(1) | ||
|
||
welcome_message() | ||
print(term_color("🦾 Creating a new AgentStack project...", 'blue')) | ||
print(f"Using project directory: {conf.PATH.absolute()}") | ||
|
||
# copy the project skeleton, create a virtual environment, and install dependencies | ||
init_project_builder(slug_name, template, use_wizard) | ||
packaging.create_venv() | ||
packaging.install_project() | ||
|
||
print( | ||
"\n" | ||
"🚀 \033[92mAgentStack project generated successfully!\033[0m\n\n" | ||
" To get started, activate the virtual environment with:\n" | ||
f" cd {conf.PATH}\n" | ||
" source .venv/bin/activate\n\n" | ||
" Run your new agent with:\n" | ||
" agentstack run\n\n" | ||
" Or, run `agentstack quickstart` or `agentstack docs` for more next steps.\n" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.