bazis-cli 2.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ .gitlab-ci.yml
2
+ .gitignore
3
+ .dockerignore
@@ -0,0 +1,20 @@
1
+ name: Build and Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*'
7
+ # started by the Release workflow on the tag it creates: a tag pushed with the
8
+ # workflow token does not trigger the push event above
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: write
13
+
14
+ jobs:
15
+ build:
16
+ if: startsWith(github.ref, 'refs/tags/v')
17
+ uses: ecofuture-tech/.github/.github/workflows/reusable-build-publish.yml@main
18
+ secrets:
19
+ PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
20
+ TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
@@ -0,0 +1,77 @@
1
+ name: Release
2
+
3
+ # Creates the release tag vX.Y.Z on the current main commit and starts Build and Publish
4
+ # for it. Run it from the Actions tab (or through the GitHub API) on the main branch.
5
+
6
+ on:
7
+ workflow_dispatch:
8
+ inputs:
9
+ version:
10
+ description: 'Version without the "v" prefix, e.g. 2.3.0 or 2.4.0-rc1'
11
+ required: true
12
+ type: string
13
+
14
+ permissions:
15
+ contents: write
16
+ actions: write
17
+
18
+ concurrency:
19
+ group: release
20
+ cancel-in-progress: false
21
+
22
+ jobs:
23
+ release:
24
+ runs-on: ubuntu-latest
25
+ timeout-minutes: 10
26
+ if: github.ref == 'refs/heads/main'
27
+ env:
28
+ GH_TOKEN: ${{ github.token }}
29
+ VERSION: ${{ inputs.version }}
30
+ steps:
31
+ - uses: actions/checkout@v4
32
+ with:
33
+ fetch-depth: 0
34
+
35
+ - name: Validate the version
36
+ run: |
37
+ if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)[0-9]+)?$ ]]; then
38
+ echo "::error::Invalid version '$VERSION', expected e.g. 2.3.0 or 2.4.0-rc1"
39
+ exit 1
40
+ fi
41
+ if git rev-parse -q --verify "refs/tags/v$VERSION" >/dev/null; then
42
+ echo "::error::Tag v$VERSION already exists"
43
+ exit 1
44
+ fi
45
+ # versionsort.suffix: a pre-release (v2.4.0-rc1) sorts before its release (v2.4.0)
46
+ LAST_TAG=$(git -c versionsort.suffix=- tag --list 'v*' --sort=-v:refname | head -n 1)
47
+ echo "Last release: ${LAST_TAG:-none}, new release: v$VERSION"
48
+ # sort -V orders "~" before anything, as versionsort.suffix does with "-"
49
+ NEWEST=$(printf '%s\n%s\n' "${LAST_TAG#v}" "$VERSION" | sed 's/-/~/' | sort -V | tail -n 1)
50
+ if [ -n "$LAST_TAG" ] && [ "$NEWEST" != "${VERSION/-/\~}" ]; then
51
+ echo "::error::Version $VERSION is not newer than $LAST_TAG"
52
+ exit 1
53
+ fi
54
+
55
+ - name: Require green tests on this commit
56
+ run: |
57
+ CONCLUSION=$(gh run list --workflow tests.yml --commit "$GITHUB_SHA" --status completed \
58
+ --json conclusion --jq 'map(.conclusion) | first // "none"')
59
+ echo "Tests on $GITHUB_SHA: $CONCLUSION"
60
+ if [ "$CONCLUSION" != "success" ]; then
61
+ echo "::error::The Tests workflow has not succeeded on $GITHUB_SHA ($CONCLUSION)"
62
+ exit 1
63
+ fi
64
+
65
+ - name: Create the tag
66
+ run: |
67
+ git config user.name 'github-actions[bot]'
68
+ git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
69
+ git tag -a "v$VERSION" -m "${{ github.event.repository.name }} $VERSION" "$GITHUB_SHA"
70
+ git push origin "v$VERSION"
71
+
72
+ - name: Start Build and Publish
73
+ run: gh workflow run build-publish.yml --ref "v$VERSION"
74
+
75
+ - name: Summary
76
+ run: |
77
+ echo "Tagged \`v$VERSION\` at \`$GITHUB_SHA\` and started Build and Publish." >> "$GITHUB_STEP_SUMMARY"
@@ -0,0 +1,60 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: tests-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ lint:
18
+ runs-on: ubuntu-latest
19
+ timeout-minutes: 10
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - uses: astral-sh/setup-uv@v6
23
+ - run: uvx ruff check bazis tests
24
+
25
+ tests:
26
+ name: tests (python ${{ matrix.python }}, ${{ matrix.resolution }})
27
+ runs-on: ubuntu-latest
28
+ timeout-minutes: 30
29
+ strategy:
30
+ fail-fast: false
31
+ matrix:
32
+ python: ['3.12', '3.13', '3.14']
33
+ resolution: [highest]
34
+ include:
35
+ # the lowest versions allowed by pyproject.toml
36
+ - python: '3.12'
37
+ resolution: lowest-direct
38
+
39
+ # the tests build a project and check it without PostgreSQL or Redis: no services
40
+ steps:
41
+ - uses: actions/checkout@v4
42
+
43
+ - name: Install GDAL (required by the PostGIS database backend)
44
+ # a stalled Ubuntu mirror must fail the step quickly instead of hanging the job
45
+ timeout-minutes: 10
46
+ run: |
47
+ APT="sudo apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30"
48
+ $APT update
49
+ $APT install -y --no-install-recommends gdal-bin
50
+
51
+ - uses: astral-sh/setup-uv@v6
52
+ with:
53
+ python-version: ${{ matrix.python }}
54
+ activate-environment: true
55
+
56
+ - name: Install dependencies
57
+ run: uv pip install --resolution ${{ matrix.resolution }} -e '.[test]'
58
+
59
+ - name: Run tests
60
+ run: python -m pytest tests -p no:cacheprovider
@@ -0,0 +1,18 @@
1
+ name: Update Licenses
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - '**.py'
9
+ - 'pyproject.toml'
10
+
11
+ permissions:
12
+ contents: write
13
+
14
+ jobs:
15
+ update-licenses:
16
+ uses: ecofuture-tech/.github/.github/workflows/reusable-update-licenses.yml@main
17
+ secrets:
18
+ WORKFLOW_LICENSE_TOKEN: ${{ secrets.WORKFLOW_LICENSE_TOKEN }}
@@ -0,0 +1,44 @@
1
+ .idea
2
+ .ipynb_checkpoints
3
+ .mypy_cache
4
+ .vscode
5
+ __pycache__
6
+ .pytest_cache
7
+ htmlcov
8
+ dist
9
+ site
10
+ .coverage
11
+ coverage.xml
12
+ .netlify
13
+ test.db
14
+ log.txt
15
+ Pipfile.lock
16
+ env3.*
17
+ env
18
+ docs_build
19
+ venv
20
+ .venv
21
+ docs.zip
22
+ archive.zip
23
+
24
+ .env
25
+ local.env
26
+ */.env*
27
+
28
+ # vim temporary files
29
+ *~
30
+ .*.sw?
31
+ *.DS_Store
32
+
33
+ *.egg-info
34
+ build
35
+ dist
36
+
37
+ docs/_autosummary
38
+ docs/_build
39
+ *.DS_Store
40
+ *.log
41
+ my-*
42
+ My*
43
+ */**/_version.py
44
+ /uv.lock
@@ -0,0 +1,47 @@
1
+ # bazis-cli
2
+
3
+ The `bazis` command (`bazis new`, `bazis add`, `bazis audit`): Claude Code through the
4
+ Claude Agent SDK, run in a Bazis project with the MCP server bazis-mcp and the rules of
5
+ Bazis (`agent.RULES`).
6
+
7
+ - `bazis/contrib/cli/main.py` — the commands and their prompts;
8
+ - `bazis/contrib/cli/agent.py` — the options of the agent (tools, permissions, MCP server),
9
+ the permission prompt in the terminal and the output;
10
+ - `bazis/contrib/cli/scaffold.py` — the skeleton of a new project and its `.venv`.
11
+
12
+ Commits, tags and pull requests are authored by the maintainer, Ilya Kharyn
13
+ <ilya.tt07@gmail.com>, never by an AI assistant (see the CLAUDE.md of the core).
14
+
15
+ ## Running the tests
16
+
17
+ The tests replace the Claude Agent SDK with a fake: they spend no credits and need no
18
+ account. The scaffold test runs `bazis_doctor` in a generated project (GDAL is needed for
19
+ the PostGIS backend; neither PostgreSQL nor Redis):
20
+
21
+ ```bash
22
+ python -m pytest tests -p no:cacheprovider
23
+ ```
24
+
25
+ Lint: `ruff check bazis tests`. A real run (`bazis audit --budget 0.5` in a project) spends
26
+ credits of the Claude Code account: do it only when asked.
27
+
28
+ ## Releasing
29
+
30
+ A release is the tag `vX.Y.Z` on `main`: the Build and Publish workflow builds the package
31
+ (the version comes from the tag through setuptools-scm) and publishes it to PyPI
32
+ (pre-releases `-alphaN`/`-betaN`/`-rcN` go to Test PyPI) and creates the GitHub release.
33
+
34
+ Claude Code sessions cannot push tags. Release through the **Release** workflow instead:
35
+
36
+ 1. Make sure the changes are merged into `main` and the Tests workflow is green on the
37
+ `main` head commit (the Release workflow checks this and refuses otherwise).
38
+ 2. Add the release notes as `docs/releases/X.Y.Z.md` in the change being released.
39
+ 3. Start the workflow `release.yml` on `ref: main` with the input `version: X.Y.Z`
40
+ (GitHub API: `POST /repos/ecofuture-tech/bazis-cli/actions/workflows/release.yml/dispatches`;
41
+ with the GitHub MCP tools: `actions_run_trigger`, method `run_workflow`).
42
+ 4. The Release run creates the annotated tag and starts Build and Publish on it. Check
43
+ that both runs succeed and that the version appears on https://pypi.org/project/bazis-cli/.
44
+
45
+ bazis-cli is released after bazis-mcp. Pick the version by semver: breaking changes
46
+ (commands or options renamed or removed) bump the minor version while the project is
47
+ below 3.0.
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: bazis-cli
3
+ Version: 2.4.0
4
+ Summary: The bazis command: creates, extends and audits Bazis projects with Claude (Claude Agent SDK).
5
+ Author-email: Ilya Kharyn <ilya.tt07@gmail.com>
6
+ Maintainer-email: Ilya Kharyn <ilya.tt07@gmail.com>
7
+ License-Expression: Apache-2.0
8
+ Project-URL: Home, https://github.com/ecofuture-tech/bazis-cli
9
+ Keywords: bazis,django,fastapi,pydantic,framework,jsonapi,cli,ai,agents,claude
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Framework :: Django
18
+ Classifier: Framework :: FastAPI
19
+ Requires-Python: >=3.12
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: bazis-mcp>=2.4.1
22
+ Requires-Dist: claude-agent-sdk>=0.2.163
23
+ Provides-Extra: test
24
+ Requires-Dist: pytest>=8; extra == "test"
25
+ Provides-Extra: dev
26
+ Requires-Dist: ruff; extra == "dev"
27
+
28
+ # bazis-cli
29
+
30
+ The `bazis` command creates, extends and audits [Bazis](https://github.com/ecofuture-tech/bazis)
31
+ projects with Claude. It runs Claude Code (the [Claude Agent SDK](https://code.claude.com/docs/en/agent-sdk))
32
+ in the project with the MCP server [bazis-mcp](https://github.com/ecofuture-tech/bazis-mcp),
33
+ so the agent chooses the Bazis packages from their catalog, follows their guides and checks
34
+ the result with the system checks of the project instead of relying on its memory.
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ pip install bazis-cli # or: uv tool install bazis-cli
40
+ claude login # or set ANTHROPIC_API_KEY
41
+ ```
42
+
43
+ The agent uses the account of Claude Code and spends its credits; limit a run with
44
+ `--budget`.
45
+
46
+ ## Commands
47
+
48
+ ```bash
49
+ # a new project from a description
50
+ bazis new shop "An online shop: products with categories, orders of users, \
51
+ users see only their own orders"
52
+
53
+ # a Bazis package for an existing project (run in the directory of manage.py)
54
+ bazis add bazis-statusy "orders go through new -> paid -> shipped"
55
+
56
+ # a review against the guides and checks of the packages; --fix also fixes
57
+ bazis audit
58
+ bazis audit --fix
59
+ ```
60
+
61
+ - `bazis new DIR DESCRIPTION` writes the skeleton of a project: the project package
62
+ (settings, root router, ASGI app), `project.env`, `.env` with a generated secret key,
63
+ `requirements.txt`, `requirements-dev.txt`, `tests/`, `.mcp.json` and `AGENTS.md`. It
64
+ creates `.venv` with Bazis and bazis-mcp (with uv if it is installed; `--no-venv` skips
65
+ it). Then the agent chooses the Bazis packages, creates the apps, models, routes,
66
+ migrations and tests, and runs the checks.
67
+ - `bazis add PACKAGE [GOAL]` installs a Bazis package with the Bazis packages it requires
68
+ and sets them up as their guides say.
69
+ - `bazis audit [--fix]` reports the problems of the project by severity. Without `--fix`
70
+ the agent can only read.
71
+
72
+ Options of every command: `--project-dir` (`add`, `audit`; default: the current
73
+ directory), `--model` (default `claude-opus-5-5`), `--effort` (`low` ... `max`, default
74
+ `high`), `--budget USD`, `--yes`.
75
+
76
+ ## Permissions
77
+
78
+ - The agent edits the files of the project directory without asking.
79
+ - Everything else is shown in full and asked in the terminal: every shell command
80
+ (installing packages, migrations, tests), edits and reads outside the project, web access.
81
+ `y` allows it, `a` allows the rest of the run. `--yes` allows all of it; without a
82
+ terminal and without `--yes` it is denied.
83
+ - The agent cannot read `.env` and cannot commit, push or reset with git: review the changes
84
+ and commit them yourself.
85
+ - Only the settings of bazis-cli apply: the Claude Code settings, hooks and MCP servers of
86
+ the project and of the user are not loaded.
87
+ - `bazis audit` without `--fix` can only read the project and call bazis-mcp. bazis-mcp
88
+ runs the system checks of the project, that is the project code with its `.venv`: run
89
+ the commands only in projects you trust.
90
+
91
+ The tests of a project need PostgreSQL with PostGIS and Redis (settings in `.env`); without
92
+ them the agent creates the migrations and runs the system checks, and says that the tests
93
+ did not run.
@@ -0,0 +1,66 @@
1
+ # bazis-cli
2
+
3
+ The `bazis` command creates, extends and audits [Bazis](https://github.com/ecofuture-tech/bazis)
4
+ projects with Claude. It runs Claude Code (the [Claude Agent SDK](https://code.claude.com/docs/en/agent-sdk))
5
+ in the project with the MCP server [bazis-mcp](https://github.com/ecofuture-tech/bazis-mcp),
6
+ so the agent chooses the Bazis packages from their catalog, follows their guides and checks
7
+ the result with the system checks of the project instead of relying on its memory.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install bazis-cli # or: uv tool install bazis-cli
13
+ claude login # or set ANTHROPIC_API_KEY
14
+ ```
15
+
16
+ The agent uses the account of Claude Code and spends its credits; limit a run with
17
+ `--budget`.
18
+
19
+ ## Commands
20
+
21
+ ```bash
22
+ # a new project from a description
23
+ bazis new shop "An online shop: products with categories, orders of users, \
24
+ users see only their own orders"
25
+
26
+ # a Bazis package for an existing project (run in the directory of manage.py)
27
+ bazis add bazis-statusy "orders go through new -> paid -> shipped"
28
+
29
+ # a review against the guides and checks of the packages; --fix also fixes
30
+ bazis audit
31
+ bazis audit --fix
32
+ ```
33
+
34
+ - `bazis new DIR DESCRIPTION` writes the skeleton of a project: the project package
35
+ (settings, root router, ASGI app), `project.env`, `.env` with a generated secret key,
36
+ `requirements.txt`, `requirements-dev.txt`, `tests/`, `.mcp.json` and `AGENTS.md`. It
37
+ creates `.venv` with Bazis and bazis-mcp (with uv if it is installed; `--no-venv` skips
38
+ it). Then the agent chooses the Bazis packages, creates the apps, models, routes,
39
+ migrations and tests, and runs the checks.
40
+ - `bazis add PACKAGE [GOAL]` installs a Bazis package with the Bazis packages it requires
41
+ and sets them up as their guides say.
42
+ - `bazis audit [--fix]` reports the problems of the project by severity. Without `--fix`
43
+ the agent can only read.
44
+
45
+ Options of every command: `--project-dir` (`add`, `audit`; default: the current
46
+ directory), `--model` (default `claude-opus-5-5`), `--effort` (`low` ... `max`, default
47
+ `high`), `--budget USD`, `--yes`.
48
+
49
+ ## Permissions
50
+
51
+ - The agent edits the files of the project directory without asking.
52
+ - Everything else is shown in full and asked in the terminal: every shell command
53
+ (installing packages, migrations, tests), edits and reads outside the project, web access.
54
+ `y` allows it, `a` allows the rest of the run. `--yes` allows all of it; without a
55
+ terminal and without `--yes` it is denied.
56
+ - The agent cannot read `.env` and cannot commit, push or reset with git: review the changes
57
+ and commit them yourself.
58
+ - Only the settings of bazis-cli apply: the Claude Code settings, hooks and MCP servers of
59
+ the project and of the user are not loaded.
60
+ - `bazis audit` without `--fix` can only read the project and call bazis-mcp. bazis-mcp
61
+ runs the system checks of the project, that is the project code with its `.venv`: run
62
+ the commands only in projects you trust.
63
+
64
+ The tests of a project need PostgreSQL with PostGIS and Redis (settings in `.env`); without
65
+ them the agent creates the migrations and runs the system checks, and says that the tests
66
+ did not run.
@@ -0,0 +1,33 @@
1
+ # bazis-cli — guide for AI agents
2
+
3
+ The command `bazis` creates, extends and audits Bazis projects with Claude: it runs Claude
4
+ Code (Claude Agent SDK) in the project with the MCP server bazis-mcp and the rules of
5
+ Bazis. It is a tool for the developer's machine, not a dependency of a project.
6
+
7
+ ## Commands
8
+
9
+ - `bazis new DIR "what the project does"` writes the skeleton of a project (package with
10
+ settings, root router and ASGI app, `project.env`, `.env` with a generated secret key,
11
+ `requirements*.txt`, `tests/`, `.mcp.json`, `AGENTS.md`), creates `.venv` with Bazis and
12
+ bazis-mcp (`--no-venv` skips it), then the agent chooses the Bazis packages and builds the
13
+ apps, migrations and tests.
14
+ - `bazis add PACKAGE ["what for"]` installs a Bazis package and its Bazis dependencies and
15
+ sets them up as their guides say.
16
+ - `bazis audit [--fix]` reviews the project against the guides and checks of its packages;
17
+ without `--fix` the agent can only read.
18
+
19
+ Options: `--project-dir` (default: the current directory), `--model` (default
20
+ `claude-opus-5-5`), `--effort` (default `high`), `--budget USD`, `--yes` (run shell commands
21
+ without asking).
22
+
23
+ ## Rules
24
+
25
+ - Edits of the files of the project are accepted; every shell command and every other tool
26
+ call (edits or reads outside the project, web) is asked in the terminal (`a` allows the
27
+ rest of the run) unless `--yes`; without a terminal and `--yes` they are denied.
28
+ - `.env` cannot be read; git cannot commit, push, reset or rebase: the user reviews and
29
+ commits the changes.
30
+ - Only the MCP server bazis-mcp and no Claude Code settings of the project or the user are
31
+ loaded. The checks of bazis-mcp run the project code: use the commands in trusted
32
+ projects.
33
+ - Credentials are those of Claude Code: `claude login` or `ANTHROPIC_API_KEY`.
@@ -0,0 +1,19 @@
1
+ # Copyright 2026 EcoFuture Technology Services LLC and contributors
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ try:
16
+ from importlib.metadata import PackageNotFoundError, version
17
+ __version__ = version('bazis-cli')
18
+ except PackageNotFoundError:
19
+ __version__ = 'dev'
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '2.4.0'
22
+ __version_tuple__ = version_tuple = (2, 4, 0)
23
+
24
+ __commit_id__ = commit_id = 'g2d504c4db'