bazis-cli 2.4.1__tar.gz → 2.5.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.
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/.github/workflows/tests.yml +2 -10
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/.gitignore +1 -0
- bazis_cli-2.5.0/CLAUDE.md +66 -0
- bazis_cli-2.5.0/PKG-INFO +152 -0
- bazis_cli-2.5.0/README.md +124 -0
- bazis_cli-2.5.0/bazis/contrib/cli/AGENTS.md +89 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/bazis/contrib/cli/_version.py +3 -3
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/bazis/contrib/cli/agent.py +123 -49
- bazis_cli-2.5.0/bazis/contrib/cli/bazis_manifest.toml +54 -0
- bazis_cli-2.5.0/bazis/contrib/cli/main.py +300 -0
- bazis_cli-2.5.0/bazis_cli.egg-info/PKG-INFO +152 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/bazis_cli.egg-info/SOURCES.txt +7 -2
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/bazis_cli.egg-info/requires.txt +2 -1
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/bazis_cli.egg-info/scm_file_list.json +7 -2
- bazis_cli-2.5.0/bazis_cli.egg-info/scm_version.json +8 -0
- bazis_cli-2.5.0/docs/releases/2.5.0.md +170 -0
- bazis_cli-2.5.0/evals/grade.py +397 -0
- bazis_cli-2.5.0/evals/run.py +168 -0
- bazis_cli-2.5.0/evals/tasks.toml +80 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/pyproject.toml +5 -2
- bazis_cli-2.5.0/tests/__init__.py +13 -0
- bazis_cli-2.5.0/tests/test_cli.py +610 -0
- bazis_cli-2.5.0/tests/test_evals.py +253 -0
- bazis_cli-2.4.1/CLAUDE.md +0 -47
- bazis_cli-2.4.1/PKG-INFO +0 -93
- bazis_cli-2.4.1/README.md +0 -66
- bazis_cli-2.4.1/bazis/contrib/cli/AGENTS.md +0 -33
- bazis_cli-2.4.1/bazis/contrib/cli/bazis_manifest.toml +0 -32
- bazis_cli-2.4.1/bazis/contrib/cli/main.py +0 -180
- bazis_cli-2.4.1/bazis/contrib/cli/scaffold.py +0 -274
- bazis_cli-2.4.1/bazis_cli.egg-info/PKG-INFO +0 -93
- bazis_cli-2.4.1/bazis_cli.egg-info/scm_version.json +0 -8
- bazis_cli-2.4.1/tests/test_cli.py +0 -284
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/.dockerignore +0 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/.github/workflows/build-publish.yml +0 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/.github/workflows/release.yml +0 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/.github/workflows/update-licenses.yml +0 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/bazis/contrib/cli/__init__.py +0 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/bazis_cli.egg-info/dependency_links.txt +0 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/bazis_cli.egg-info/entry_points.txt +0 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/bazis_cli.egg-info/top_level.txt +0 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/docs/releases/2.4.0.md +0 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/docs/releases/2.4.1.md +0 -0
- {bazis_cli-2.4.1/tests → bazis_cli-2.5.0/evals}/__init__.py +0 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/setup.cfg +0 -0
- {bazis_cli-2.4.1 → bazis_cli-2.5.0}/tests/conftest.py +0 -0
|
@@ -20,7 +20,7 @@ jobs:
|
|
|
20
20
|
steps:
|
|
21
21
|
- uses: actions/checkout@v4
|
|
22
22
|
- uses: astral-sh/setup-uv@v6
|
|
23
|
-
- run: uvx ruff check bazis tests
|
|
23
|
+
- run: uvx ruff check bazis tests evals
|
|
24
24
|
|
|
25
25
|
tests:
|
|
26
26
|
name: tests (python ${{ matrix.python }}, ${{ matrix.resolution }})
|
|
@@ -36,18 +36,10 @@ jobs:
|
|
|
36
36
|
- python: '3.12'
|
|
37
37
|
resolution: lowest-direct
|
|
38
38
|
|
|
39
|
-
# the tests
|
|
39
|
+
# the tests write a project without PostgreSQL, Redis or GDAL: no services
|
|
40
40
|
steps:
|
|
41
41
|
- uses: actions/checkout@v4
|
|
42
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
43
|
- uses: astral-sh/setup-uv@v6
|
|
52
44
|
with:
|
|
53
45
|
python-version: ${{ matrix.python }}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# bazis-cli
|
|
2
|
+
|
|
3
|
+
The `bazis` command (`bazis new`, `bazis add`, `bazis audit`, `bazis change`): 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 (`bazis.contrib.mcp.rules.RULES`).
|
|
6
|
+
|
|
7
|
+
- `bazis/contrib/cli/main.py` — the commands, with the tasks of `bazis.contrib.mcp.prompts`
|
|
8
|
+
(and the prompt of `bazis audit`);
|
|
9
|
+
- `bazis/contrib/cli/agent.py` — the options of the agent (tools, permissions, MCP server),
|
|
10
|
+
the permission prompt in the terminal and the output. Of the tools of bazis-mcp only
|
|
11
|
+
those with `readOnlyHint` (read from the server it imports) are allowed in advance; the
|
|
12
|
+
others, for a client without a shell, a new one too, are never given to the agent, which
|
|
13
|
+
runs commands and edits files itself (`MCP_RULE` tells it that the instructions of the
|
|
14
|
+
server about them do not apply).
|
|
15
|
+
|
|
16
|
+
The skeleton of a new project and its `.venv` (bazis-front in its requirements and apps
|
|
17
|
+
unless `--no-frontend`, its languages: `--language`, else English until the agent sets the
|
|
18
|
+
language of the description, the check of Node.js), the rules and the tasks of the agent
|
|
19
|
+
are in bazis-mcp (`bazis.contrib.mcp.scaffold`, `rules`, `prompts`), with their tests.
|
|
20
|
+
`--language` is checked by the Django of the Python of the CLI (bazis is its dependency),
|
|
21
|
+
before anything is written.
|
|
22
|
+
|
|
23
|
+
The frontend of a product is made by bazis-front (`manage.py bazis_front ...`) and read by
|
|
24
|
+
the tools of bazis-mcp (`front_check`, `front_status`, `front_catalog`): bazis-cli only
|
|
25
|
+
orders the work with the prompts (`prompts.FRONTEND_STEPS`) and rules
|
|
26
|
+
(`rules.FRONTEND_RULES`) of bazis-mcp, it has no frontend code of its own.
|
|
27
|
+
|
|
28
|
+
Commits, tags and pull requests are authored by the maintainer, Ilya Kharyn
|
|
29
|
+
<ilya.tt07@gmail.com>, never by an AI assistant (see the CLAUDE.md of the core).
|
|
30
|
+
|
|
31
|
+
## Running the tests
|
|
32
|
+
|
|
33
|
+
The tests replace the Claude Agent SDK with a fake: they spend no credits and need no
|
|
34
|
+
account; neither PostgreSQL nor Redis is needed:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
python -m pytest tests -p no:cacheprovider
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`evals/` builds projects with the real agent (`python -m evals.run --budget N`); its task
|
|
41
|
+
with a frontend also needs Node.js and, before the release of bazis-front,
|
|
42
|
+
`BAZIS_FRONT_REQUIREMENT`.
|
|
43
|
+
|
|
44
|
+
Lint: `ruff check bazis tests evals`. A real run (`bazis audit --budget 0.5` in a project) spends
|
|
45
|
+
credits of the Claude Code account: do it only when asked.
|
|
46
|
+
|
|
47
|
+
## Releasing
|
|
48
|
+
|
|
49
|
+
A release is the tag `vX.Y.Z` on `main`: the Build and Publish workflow builds the package
|
|
50
|
+
(the version comes from the tag through setuptools-scm) and publishes it to PyPI
|
|
51
|
+
(pre-releases `-alphaN`/`-betaN`/`-rcN` go to Test PyPI) and creates the GitHub release.
|
|
52
|
+
|
|
53
|
+
Claude Code sessions cannot push tags. Release through the **Release** workflow instead:
|
|
54
|
+
|
|
55
|
+
1. Make sure the changes are merged into `main` and the Tests workflow is green on the
|
|
56
|
+
`main` head commit (the Release workflow checks this and refuses otherwise).
|
|
57
|
+
2. Add the release notes as `docs/releases/X.Y.Z.md` in the change being released.
|
|
58
|
+
3. Start the workflow `release.yml` on `ref: main` with the input `version: X.Y.Z`
|
|
59
|
+
(GitHub API: `POST /repos/ecofuture-tech/bazis-cli/actions/workflows/release.yml/dispatches`;
|
|
60
|
+
with the GitHub MCP tools: `actions_run_trigger`, method `run_workflow`).
|
|
61
|
+
4. The Release run creates the annotated tag and starts Build and Publish on it. Check
|
|
62
|
+
that both runs succeed and that the version appears on https://pypi.org/project/bazis-cli/.
|
|
63
|
+
|
|
64
|
+
bazis-cli is released after bazis-mcp (and bazis-mcp after bazis-front). Pick the version by semver: breaking changes
|
|
65
|
+
(commands or options renamed or removed) bump the minor version while the project is
|
|
66
|
+
below 3.0.
|
bazis_cli-2.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bazis-cli
|
|
3
|
+
Version: 2.5.0
|
|
4
|
+
Summary: The bazis command: creates, extends and audits Bazis products, backend and frontend, 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>=2.16.0
|
|
22
|
+
Requires-Dist: bazis-mcp>=2.5.0
|
|
23
|
+
Requires-Dist: claude-agent-sdk>=0.2.163
|
|
24
|
+
Provides-Extra: test
|
|
25
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: ruff; extra == "dev"
|
|
28
|
+
|
|
29
|
+
# bazis-cli
|
|
30
|
+
|
|
31
|
+
The `bazis` command creates, extends and audits [Bazis](https://github.com/ecofuture-tech/bazis)
|
|
32
|
+
projects with Claude. It runs Claude Code (the [Claude Agent SDK](https://code.claude.com/docs/en/agent-sdk))
|
|
33
|
+
in the project with the MCP server [bazis-mcp](https://github.com/ecofuture-tech/bazis-mcp),
|
|
34
|
+
so the agent chooses the Bazis packages from their catalog, follows their guides and checks
|
|
35
|
+
the result with the system checks of the project instead of relying on its memory.
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install bazis-cli # or: uv tool install bazis-cli
|
|
41
|
+
claude login # or set ANTHROPIC_API_KEY
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The agent uses the account of Claude Code and spends its credits; limit a run with
|
|
45
|
+
`--budget`.
|
|
46
|
+
|
|
47
|
+
## Commands
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# a new product, backend and frontend, from a description
|
|
51
|
+
bazis new shop "An online shop: products with categories, orders of users, \
|
|
52
|
+
users see only their own orders"
|
|
53
|
+
|
|
54
|
+
# only the backend
|
|
55
|
+
bazis new shop "..." --no-frontend
|
|
56
|
+
|
|
57
|
+
# a product in Russian (by default in the language of the description), always also in English
|
|
58
|
+
bazis new shop "..." --language ru
|
|
59
|
+
|
|
60
|
+
# a Bazis package for an existing project (run in the directory of manage.py)
|
|
61
|
+
bazis add bazis-statusy "orders go through new -> paid -> shipped"
|
|
62
|
+
|
|
63
|
+
# a review against the guides and checks of the packages; --fix also fixes
|
|
64
|
+
bazis audit
|
|
65
|
+
bazis audit --fix
|
|
66
|
+
|
|
67
|
+
# go on changing the project, in the session of the last run of bazis in it
|
|
68
|
+
bazis change "loans of rare books need an approval of a librarian"
|
|
69
|
+
bazis change # the changes typed one after another; an empty line ends
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- `bazis new DIR DESCRIPTION` writes the skeleton of a project: the project package
|
|
73
|
+
(settings, root router, ASGI app), `project.env`, `.env` with a generated secret key,
|
|
74
|
+
`requirements.txt`, `requirements-dev.txt`, `tests/`, `.mcp.json` and `AGENTS.md`, and
|
|
75
|
+
chooses free ports for the servers of the project (`.bazis/ports.json`). It creates
|
|
76
|
+
`.venv` with Bazis and bazis-mcp (with uv if it is installed; `--no-venv` skips it),
|
|
77
|
+
raises the minimums of the requirements to the installed releases, and the database of `.env` with PostGIS when PostgreSQL is reachable (else it says
|
|
78
|
+
so and goes on; a database of that name with the data of another project is left as it
|
|
79
|
+
is, and the first free `<name>_N` is created and set in `.env` instead). Then the agent chooses the Bazis packages, creates the apps, models,
|
|
80
|
+
routes, migrations and tests, and runs the checks.
|
|
81
|
+
- By default `bazis new` builds the whole product with its frontend, made by
|
|
82
|
+
[bazis-front](https://github.com/ecofuture-tech/bazis-front): the specs of the product
|
|
83
|
+
(`spec/`: roles, entities, workflows, access, scenarios, screens, design), the backend
|
|
84
|
+
that satisfies them, the contract exported from it (`contract/`), a React + TypeScript
|
|
85
|
+
frontend (`frontend/`) with the screens composed from the components of bazis-front,
|
|
86
|
+
and the end-to-end tests of the scenarios run against the backend. It needs Node.js
|
|
87
|
+
22.12 or newer with npm, and PostgreSQL for the contract and the end-to-end tests;
|
|
88
|
+
`--no-frontend` builds only the backend.
|
|
89
|
+
- The product is in the language of its description and in English, the language of the
|
|
90
|
+
msgids of the code (`BS_LANGUAGES`, `BS_LANGUAGE_CODE`); `--language CODE` (a code of
|
|
91
|
+
Django such as `ru` or `pt-br`) chooses it instead. The texts of the backend are
|
|
92
|
+
translated in its gettext catalog and those of the screens in the dictionaries of the
|
|
93
|
+
frontend.
|
|
94
|
+
- `bazis add PACKAGE [GOAL]` installs a Bazis package with the Bazis packages it requires
|
|
95
|
+
and sets them up as their guides say, in the frontend too when the project has one.
|
|
96
|
+
`bazis add bazis-front` builds the frontend of a backend.
|
|
97
|
+
- `bazis audit [--fix]` reports the problems of the project by severity, with the checks
|
|
98
|
+
of the frontend when it has one. Without `--fix` the agent can only read.
|
|
99
|
+
- `bazis change [REQUEST]` changes the project as the request says, in the session of
|
|
100
|
+
Claude Code of the last run of bazis in the project (`bazis new` prints the command):
|
|
101
|
+
the agent remembers what it built and what was asked before. Without a request the
|
|
102
|
+
changes are typed in the terminal one after another, each in the same session; an
|
|
103
|
+
empty line, `exit` or Ctrl-D ends, Ctrl-C stops the change that runs. `--new-session`
|
|
104
|
+
(or a session whose transcript is not on this machine) starts a new session, in which
|
|
105
|
+
the agent first learns the project. `--budget` limits every change.
|
|
106
|
+
|
|
107
|
+
Every command writes the facts of its run (session, turns, cost, duration, tokens, calls
|
|
108
|
+
of each tool) to `.bazis/run.json` of the project; `.bazis/` is never committed.
|
|
109
|
+
|
|
110
|
+
Options of every command: `--project-dir` (`add`, `audit`, `change`; default: the current
|
|
111
|
+
directory), `--model` (default `claude-opus-5-5`), `--effort` (`low` ... `max`, default
|
|
112
|
+
`high`), `--budget USD`, `--yes`.
|
|
113
|
+
|
|
114
|
+
## Permissions
|
|
115
|
+
|
|
116
|
+
- The agent edits the files of the project directory without asking.
|
|
117
|
+
- Everything else is shown in full and asked in the terminal: every shell command
|
|
118
|
+
(installing packages, migrations, tests), edits and reads outside the project, web access.
|
|
119
|
+
`y` allows it, `a` allows the rest of the run. `--yes` allows all of it; without a
|
|
120
|
+
terminal and without `--yes` it is denied.
|
|
121
|
+
- The agent cannot read `.env` and cannot commit, push or reset with git: review the changes
|
|
122
|
+
and commit them yourself.
|
|
123
|
+
- Only the settings of bazis-cli apply: the Claude Code settings, hooks and MCP servers of
|
|
124
|
+
the project and of the user are not loaded.
|
|
125
|
+
- The agent calls only the tools of bazis-mcp that read (`readOnlyHint`: the catalog, the
|
|
126
|
+
guides, the facts and checks of the project, its files), without asking. Those for a
|
|
127
|
+
client without a shell, which run commands or change files, are not given to it, a tool
|
|
128
|
+
of a newer bazis-mcp that does not only read too: its commands and edits are those above.
|
|
129
|
+
- `bazis audit` without `--fix` can only read the project and call the tools of bazis-mcp
|
|
130
|
+
that read. bazis-mcp runs the system checks of the project, that is the project code with
|
|
131
|
+
its `.venv`: run the commands only in projects you trust.
|
|
132
|
+
|
|
133
|
+
The tests of a project need PostgreSQL with PostGIS and Redis (settings in `.env`); without
|
|
134
|
+
them the agent creates the migrations and runs the system checks, and says that the tests
|
|
135
|
+
did not run.
|
|
136
|
+
|
|
137
|
+
The roles of a product are declared in `<app>/roles.py` and its statuses and transits in
|
|
138
|
+
`<app>/workflow.py`; `migrate` applies them. The end-to-end tests of
|
|
139
|
+
the frontend run against the backend with the test data of `python manage.py e2e_data`
|
|
140
|
+
(the e2e data command recommended by bazis-front): the test users of the roles, with the
|
|
141
|
+
password of `E2E_PASSWORD`, and the records the scenarios need, on the ports of
|
|
142
|
+
`.bazis/ports.json` (`frontend/.env.local` sends `/api` to the backend with `BAZIS_API_URL`):
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
E2E_PASSWORD=... .venv/bin/python manage.py e2e_data
|
|
146
|
+
.venv/bin/uvicorn shop.main:app --port <backend> &
|
|
147
|
+
cd frontend && E2E_PORT=<e2e> E2E_PASSWORD=... npm run e2e
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
To try a bazis-front that is not on PyPI yet, point `BAZIS_FRONT_REQUIREMENT` to a wheel,
|
|
151
|
+
a checkout or a URL: it replaces the requirement of bazis-front in `requirements.txt` of
|
|
152
|
+
the new product, and uv builds it again instead of reusing the build of an older commit.
|
|
@@ -0,0 +1,124 @@
|
|
|
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 product, backend and frontend, 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
|
+
# only the backend
|
|
27
|
+
bazis new shop "..." --no-frontend
|
|
28
|
+
|
|
29
|
+
# a product in Russian (by default in the language of the description), always also in English
|
|
30
|
+
bazis new shop "..." --language ru
|
|
31
|
+
|
|
32
|
+
# a Bazis package for an existing project (run in the directory of manage.py)
|
|
33
|
+
bazis add bazis-statusy "orders go through new -> paid -> shipped"
|
|
34
|
+
|
|
35
|
+
# a review against the guides and checks of the packages; --fix also fixes
|
|
36
|
+
bazis audit
|
|
37
|
+
bazis audit --fix
|
|
38
|
+
|
|
39
|
+
# go on changing the project, in the session of the last run of bazis in it
|
|
40
|
+
bazis change "loans of rare books need an approval of a librarian"
|
|
41
|
+
bazis change # the changes typed one after another; an empty line ends
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- `bazis new DIR DESCRIPTION` writes the skeleton of a project: the project package
|
|
45
|
+
(settings, root router, ASGI app), `project.env`, `.env` with a generated secret key,
|
|
46
|
+
`requirements.txt`, `requirements-dev.txt`, `tests/`, `.mcp.json` and `AGENTS.md`, and
|
|
47
|
+
chooses free ports for the servers of the project (`.bazis/ports.json`). It creates
|
|
48
|
+
`.venv` with Bazis and bazis-mcp (with uv if it is installed; `--no-venv` skips it),
|
|
49
|
+
raises the minimums of the requirements to the installed releases, and the database of `.env` with PostGIS when PostgreSQL is reachable (else it says
|
|
50
|
+
so and goes on; a database of that name with the data of another project is left as it
|
|
51
|
+
is, and the first free `<name>_N` is created and set in `.env` instead). Then the agent chooses the Bazis packages, creates the apps, models,
|
|
52
|
+
routes, migrations and tests, and runs the checks.
|
|
53
|
+
- By default `bazis new` builds the whole product with its frontend, made by
|
|
54
|
+
[bazis-front](https://github.com/ecofuture-tech/bazis-front): the specs of the product
|
|
55
|
+
(`spec/`: roles, entities, workflows, access, scenarios, screens, design), the backend
|
|
56
|
+
that satisfies them, the contract exported from it (`contract/`), a React + TypeScript
|
|
57
|
+
frontend (`frontend/`) with the screens composed from the components of bazis-front,
|
|
58
|
+
and the end-to-end tests of the scenarios run against the backend. It needs Node.js
|
|
59
|
+
22.12 or newer with npm, and PostgreSQL for the contract and the end-to-end tests;
|
|
60
|
+
`--no-frontend` builds only the backend.
|
|
61
|
+
- The product is in the language of its description and in English, the language of the
|
|
62
|
+
msgids of the code (`BS_LANGUAGES`, `BS_LANGUAGE_CODE`); `--language CODE` (a code of
|
|
63
|
+
Django such as `ru` or `pt-br`) chooses it instead. The texts of the backend are
|
|
64
|
+
translated in its gettext catalog and those of the screens in the dictionaries of the
|
|
65
|
+
frontend.
|
|
66
|
+
- `bazis add PACKAGE [GOAL]` installs a Bazis package with the Bazis packages it requires
|
|
67
|
+
and sets them up as their guides say, in the frontend too when the project has one.
|
|
68
|
+
`bazis add bazis-front` builds the frontend of a backend.
|
|
69
|
+
- `bazis audit [--fix]` reports the problems of the project by severity, with the checks
|
|
70
|
+
of the frontend when it has one. Without `--fix` the agent can only read.
|
|
71
|
+
- `bazis change [REQUEST]` changes the project as the request says, in the session of
|
|
72
|
+
Claude Code of the last run of bazis in the project (`bazis new` prints the command):
|
|
73
|
+
the agent remembers what it built and what was asked before. Without a request the
|
|
74
|
+
changes are typed in the terminal one after another, each in the same session; an
|
|
75
|
+
empty line, `exit` or Ctrl-D ends, Ctrl-C stops the change that runs. `--new-session`
|
|
76
|
+
(or a session whose transcript is not on this machine) starts a new session, in which
|
|
77
|
+
the agent first learns the project. `--budget` limits every change.
|
|
78
|
+
|
|
79
|
+
Every command writes the facts of its run (session, turns, cost, duration, tokens, calls
|
|
80
|
+
of each tool) to `.bazis/run.json` of the project; `.bazis/` is never committed.
|
|
81
|
+
|
|
82
|
+
Options of every command: `--project-dir` (`add`, `audit`, `change`; default: the current
|
|
83
|
+
directory), `--model` (default `claude-opus-5-5`), `--effort` (`low` ... `max`, default
|
|
84
|
+
`high`), `--budget USD`, `--yes`.
|
|
85
|
+
|
|
86
|
+
## Permissions
|
|
87
|
+
|
|
88
|
+
- The agent edits the files of the project directory without asking.
|
|
89
|
+
- Everything else is shown in full and asked in the terminal: every shell command
|
|
90
|
+
(installing packages, migrations, tests), edits and reads outside the project, web access.
|
|
91
|
+
`y` allows it, `a` allows the rest of the run. `--yes` allows all of it; without a
|
|
92
|
+
terminal and without `--yes` it is denied.
|
|
93
|
+
- The agent cannot read `.env` and cannot commit, push or reset with git: review the changes
|
|
94
|
+
and commit them yourself.
|
|
95
|
+
- Only the settings of bazis-cli apply: the Claude Code settings, hooks and MCP servers of
|
|
96
|
+
the project and of the user are not loaded.
|
|
97
|
+
- The agent calls only the tools of bazis-mcp that read (`readOnlyHint`: the catalog, the
|
|
98
|
+
guides, the facts and checks of the project, its files), without asking. Those for a
|
|
99
|
+
client without a shell, which run commands or change files, are not given to it, a tool
|
|
100
|
+
of a newer bazis-mcp that does not only read too: its commands and edits are those above.
|
|
101
|
+
- `bazis audit` without `--fix` can only read the project and call the tools of bazis-mcp
|
|
102
|
+
that read. bazis-mcp runs the system checks of the project, that is the project code with
|
|
103
|
+
its `.venv`: run the commands only in projects you trust.
|
|
104
|
+
|
|
105
|
+
The tests of a project need PostgreSQL with PostGIS and Redis (settings in `.env`); without
|
|
106
|
+
them the agent creates the migrations and runs the system checks, and says that the tests
|
|
107
|
+
did not run.
|
|
108
|
+
|
|
109
|
+
The roles of a product are declared in `<app>/roles.py` and its statuses and transits in
|
|
110
|
+
`<app>/workflow.py`; `migrate` applies them. The end-to-end tests of
|
|
111
|
+
the frontend run against the backend with the test data of `python manage.py e2e_data`
|
|
112
|
+
(the e2e data command recommended by bazis-front): the test users of the roles, with the
|
|
113
|
+
password of `E2E_PASSWORD`, and the records the scenarios need, on the ports of
|
|
114
|
+
`.bazis/ports.json` (`frontend/.env.local` sends `/api` to the backend with `BAZIS_API_URL`):
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
E2E_PASSWORD=... .venv/bin/python manage.py e2e_data
|
|
118
|
+
.venv/bin/uvicorn shop.main:app --port <backend> &
|
|
119
|
+
cd frontend && E2E_PORT=<e2e> E2E_PASSWORD=... npm run e2e
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
To try a bazis-front that is not on PyPI yet, point `BAZIS_FRONT_REQUIREMENT` to a wheel,
|
|
123
|
+
a checkout or a URL: it replaces the requirement of bazis-front in `requirements.txt` of
|
|
124
|
+
the new product, and uv builds it again instead of reusing the build of an older commit.
|
|
@@ -0,0 +1,89 @@
|
|
|
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 product 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`, `.bazis/ports.json` with free
|
|
12
|
+
ports of this machine for the backend, the dev server of the frontend and that of the
|
|
13
|
+
end-to-end tests), creates `.venv` with Bazis and bazis-mcp (`--no-venv` skips it), raises
|
|
14
|
+
the minimums of the requirements to the installed releases (`X.Y.Z`) and the database of the settings of the project (`.env`,
|
|
15
|
+
the `BS_DATABASES__DEFAULT__*` variables) with the extension PostGIS when PostgreSQL is
|
|
16
|
+
reachable and the database is missing (it says when it cannot, when PostGIS could not be
|
|
17
|
+
installed, and when an existing database has tables, probably of another project, and
|
|
18
|
+
goes on; the agent is told what it did), then the agent chooses the Bazis packages and builds the apps,
|
|
19
|
+
migrations and tests. By default the product also gets its frontend: bazis-front
|
|
20
|
+
is in `requirements.txt` and `BS_INSTALLED_APPS`, and the agent follows the order of the
|
|
21
|
+
guide of bazis-front (`bazis_front init`, the specs in `spec/`, the backend that
|
|
22
|
+
satisfies them with the roles, statuses and transits declared in `roles.py` and
|
|
23
|
+
`workflow.py` and the test users of `manage.py e2e_data`, migrate, `contract`, `check` until no errors, `add`, the
|
|
24
|
+
screens, `design`, `e2e` run against the backend, the final checks). It needs Node.js
|
|
25
|
+
22.12 or newer with npm (checked before anything is written); `--no-frontend` builds
|
|
26
|
+
only the backend. The product is in the language of the description (the agent sets
|
|
27
|
+
`BS_LANGUAGES` and `BS_LANGUAGE_CODE`) or of `--language CODE` (written by the
|
|
28
|
+
skeleton), and always in English: English msgids with `gettext_lazy`, the catalogs of
|
|
29
|
+
the project `locale/<language>/LC_MESSAGES/django.po` made, filled and compiled by
|
|
30
|
+
`manage.py bazis_messages` (`make`, the translations in `locale/translations.json`,
|
|
31
|
+
`apply`; a msgid of the packages that `bazis.W004` names declared with `gettext_noop` in
|
|
32
|
+
`<project>/translations.py` and translated so too), the texts of the screens through
|
|
33
|
+
`t()` of bazis-front, a `bazis.W005` reported. The `tests/conftest.py` of the
|
|
34
|
+
skeleton gives the cache keys of the tests a prefix of their own: the tests never flush
|
|
35
|
+
the shared Redis; the pytest plugin of bazis-test-utils installs the triggers of the test
|
|
36
|
+
database and `migrate` applies the declared roles and workflows, so it has no other
|
|
37
|
+
fixture.
|
|
38
|
+
- `bazis add PACKAGE ["what for"]` installs a Bazis package and its Bazis dependencies and
|
|
39
|
+
sets them up as their guides say. In a project with a frontend
|
|
40
|
+
(`frontend/bazis-front.lock.json`) it then exports the contract, fixes `check`, copies
|
|
41
|
+
the components of the new capability and runs the final checks; `bazis add
|
|
42
|
+
bazis-front` builds the frontend of a backend.
|
|
43
|
+
- `bazis audit [--fix]` reviews the project against the guides and checks of its packages
|
|
44
|
+
and, with a frontend, `front_check`, `front_status` and the guides of bazis-front;
|
|
45
|
+
without `--fix` the agent can only read (it lists the frontend commands it could not run).
|
|
46
|
+
- `bazis change ["what to change"]` changes the project in the session of Claude Code of
|
|
47
|
+
the last run of bazis in it (`session_id` of `.bazis/run.json`, resumed when Claude Code
|
|
48
|
+
has its transcript on this machine), so the agent keeps what it built and was asked;
|
|
49
|
+
without a request the changes are typed in the terminal one after another, each in the
|
|
50
|
+
same session (an empty line, `exit` or Ctrl-D ends; Ctrl-C stops the running change and
|
|
51
|
+
keeps the session; without a terminal the request is needed). A new session
|
|
52
|
+
(`--new-session`, or none to resume) first reads `project_info` and the guides of the
|
|
53
|
+
packages concerned and, with a frontend, follows the steps of `bazis add`. A resumed
|
|
54
|
+
session gets the rules of the current run, and `--budget` limits each change.
|
|
55
|
+
|
|
56
|
+
The agent reads the introduction of a guide and its sections when a step needs them, reads
|
|
57
|
+
the sources of the packages only for a fact the guides lack, runs the final checks once
|
|
58
|
+
(again only those that failed) and ends with a summary in fixed sections: Built, Packages,
|
|
59
|
+
Run, Outside the files, Left for you, Guide gaps. The servers of a project use its ports
|
|
60
|
+
of `.bazis/ports.json` (`frontend/.env.local` has `BAZIS_API_URL`), and its files go to
|
|
61
|
+
`media/` and `static/` of the project (`BS_MEDIA_ROOT`, `BS_STATIC_ROOT` in `.env`).
|
|
62
|
+
Every command writes the facts of its run to `.bazis/run.json`: the session, the turns, the
|
|
63
|
+
cost (in a resumed session, that of the run, and `session_cost_usd` that of the session),
|
|
64
|
+
the duration, the usage of the tokens and the calls of each tool. `.bazis/` ignores itself in
|
|
65
|
+
Git.
|
|
66
|
+
|
|
67
|
+
bazis-cli only orchestrates: the frontend logic (template, contract, specs, components,
|
|
68
|
+
design, end-to-end tests) is in bazis-front and its `manage.py bazis_front` commands, the
|
|
69
|
+
read-only tools in bazis-mcp (`front_check`, `front_status`, `front_catalog`); the CLI adds
|
|
70
|
+
the order of the work, with the skeleton, the prompts and the rules of bazis-mcp
|
|
71
|
+
(`bazis.contrib.mcp.scaffold`, `prompts`, `rules`). `BAZIS_FRONT_REQUIREMENT` (a path to a
|
|
72
|
+
wheel or a checkout, or a URL) replaces the requirement of bazis-front in a new product, to
|
|
73
|
+
try a version that is not on PyPI.
|
|
74
|
+
|
|
75
|
+
Options: `--project-dir` (`add`, `audit`, `change`; default: the current directory), `--model` (default
|
|
76
|
+
`claude-opus-5-5`), `--effort` (default `high`), `--budget USD`, `--yes` (run shell commands
|
|
77
|
+
without asking).
|
|
78
|
+
|
|
79
|
+
## Rules
|
|
80
|
+
|
|
81
|
+
- Edits of the files of the project are accepted; every shell command and every other tool
|
|
82
|
+
call (edits or reads outside the project, web) is asked in the terminal (`a` allows the
|
|
83
|
+
rest of the run) unless `--yes`; without a terminal and `--yes` they are denied.
|
|
84
|
+
- `.env` cannot be read; git cannot commit, push, reset or rebase: the user reviews and
|
|
85
|
+
commits the changes.
|
|
86
|
+
- Only the MCP server bazis-mcp and no Claude Code settings of the project or the user are
|
|
87
|
+
loaded. The checks of bazis-mcp run the project code: use the commands in trusted
|
|
88
|
+
projects.
|
|
89
|
+
- Credentials are those of Claude Code: `claude login` or `ANTHROPIC_API_KEY`.
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '2.
|
|
22
|
-
__version_tuple__ = version_tuple = (2,
|
|
21
|
+
__version__ = version = '2.5.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 5, 0)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'g7cba9682b'
|