specrig 0.1.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.
Files changed (139) hide show
  1. specrig-0.1.0/.github/workflows/release.yml +44 -0
  2. specrig-0.1.0/.gitignore +8 -0
  3. specrig-0.1.0/LICENSE +21 -0
  4. specrig-0.1.0/Makefile +34 -0
  5. specrig-0.1.0/PKG-INFO +603 -0
  6. specrig-0.1.0/README.md +576 -0
  7. specrig-0.1.0/docs/design.md +163 -0
  8. specrig-0.1.0/pyproject.toml +68 -0
  9. specrig-0.1.0/samples/docs/billing.yaml +89 -0
  10. specrig-0.1.0/samples/reminders/AGENTS.md +10 -0
  11. specrig-0.1.0/samples/reminders/CLAUDE.md +1 -0
  12. specrig-0.1.0/samples/reminders/config/__init__.py +0 -0
  13. specrig-0.1.0/samples/reminders/config/settings.py +33 -0
  14. specrig-0.1.0/samples/reminders/config/urls.py +7 -0
  15. specrig-0.1.0/samples/reminders/config/wsgi.py +7 -0
  16. specrig-0.1.0/samples/reminders/manage.py +9 -0
  17. specrig-0.1.0/samples/reminders/pyproject.toml +13 -0
  18. specrig-0.1.0/samples/reminders/reminders/__init__.py +0 -0
  19. specrig-0.1.0/samples/reminders/reminders/billing.py +17 -0
  20. specrig-0.1.0/samples/reminders/reminders/jobs.py +25 -0
  21. specrig-0.1.0/samples/reminders/reminders/management/__init__.py +0 -0
  22. specrig-0.1.0/samples/reminders/reminders/management/commands/__init__.py +0 -0
  23. specrig-0.1.0/samples/reminders/reminders/management/commands/remind.py +10 -0
  24. specrig-0.1.0/samples/reminders/reminders/migrations/0001_initial.py +17 -0
  25. specrig-0.1.0/samples/reminders/reminders/migrations/__init__.py +0 -0
  26. specrig-0.1.0/samples/reminders/reminders/models.py +7 -0
  27. specrig-0.1.0/samples/reminders/reminders/views.py +20 -0
  28. specrig-0.1.0/samples/reminders/specrig.md +504 -0
  29. specrig-0.1.0/samples/reminders/specrig.yaml +4 -0
  30. specrig-0.1.0/samples/reminders/tests/checks.yaml +12 -0
  31. specrig-0.1.0/samples/reminders/tests/features/history.feature +17 -0
  32. specrig-0.1.0/samples/reminders/tests/features/reminders.feature +27 -0
  33. specrig-0.1.0/samples/reminders/tests/flows.yaml +48 -0
  34. specrig-0.1.0/samples/reminders/tests/internal/boot.feature +4 -0
  35. specrig-0.1.0/samples/reminders/tests/internal/harness.py +15 -0
  36. specrig-0.1.0/samples/reminders/tests/internal/test_cases.py +3 -0
  37. specrig-0.1.0/samples/reminders/tests/steps/history.py +44 -0
  38. specrig-0.1.0/samples/reminders/tests/steps/reminders.py +54 -0
  39. specrig-0.1.0/samples/reminders/tests/surface.yaml +12 -0
  40. specrig-0.1.0/samples/shop/AGENTS.md +10 -0
  41. specrig-0.1.0/samples/shop/CLAUDE.md +1 -0
  42. specrig-0.1.0/samples/shop/alembic.ini +24 -0
  43. specrig-0.1.0/samples/shop/migrations/env.py +15 -0
  44. specrig-0.1.0/samples/shop/migrations/versions/0001_orders.py +18 -0
  45. specrig-0.1.0/samples/shop/pyproject.toml +18 -0
  46. specrig-0.1.0/samples/shop/shop/__init__.py +0 -0
  47. specrig-0.1.0/samples/shop/shop/billing.py +20 -0
  48. specrig-0.1.0/samples/shop/shop/cli.py +21 -0
  49. specrig-0.1.0/samples/shop/shop/db.py +19 -0
  50. specrig-0.1.0/samples/shop/shop/jobs.py +15 -0
  51. specrig-0.1.0/samples/shop/shop/main.py +61 -0
  52. specrig-0.1.0/samples/shop/shop/settings.py +10 -0
  53. specrig-0.1.0/samples/shop/specrig.md +504 -0
  54. specrig-0.1.0/samples/shop/specrig.yaml +5 -0
  55. specrig-0.1.0/samples/shop/tests/checks.yaml +8 -0
  56. specrig-0.1.0/samples/shop/tests/features/orders.feature +23 -0
  57. specrig-0.1.0/samples/shop/tests/features/placing.feature +24 -0
  58. specrig-0.1.0/samples/shop/tests/flows.yaml +59 -0
  59. specrig-0.1.0/samples/shop/tests/internal/boot.feature +4 -0
  60. specrig-0.1.0/samples/shop/tests/internal/harness.py +12 -0
  61. specrig-0.1.0/samples/shop/tests/internal/test_cases.py +3 -0
  62. specrig-0.1.0/samples/shop/tests/steps/orders.py +51 -0
  63. specrig-0.1.0/samples/shop/tests/steps/placing.py +64 -0
  64. specrig-0.1.0/samples/shop/tests/surface.yaml +16 -0
  65. specrig-0.1.0/src/specrig/__init__.py +7 -0
  66. specrig-0.1.0/src/specrig/__main__.py +5 -0
  67. specrig-0.1.0/src/specrig/_yaml.py +117 -0
  68. specrig-0.1.0/src/specrig/asgi.py +120 -0
  69. specrig-0.1.0/src/specrig/backend.py +153 -0
  70. specrig-0.1.0/src/specrig/clock.py +41 -0
  71. specrig-0.1.0/src/specrig/code/__init__.py +31 -0
  72. specrig-0.1.0/src/specrig/code/calls.py +61 -0
  73. specrig-0.1.0/src/specrig/code/django.py +118 -0
  74. specrig-0.1.0/src/specrig/code/fastapi.py +129 -0
  75. specrig-0.1.0/src/specrig/code/index.py +477 -0
  76. specrig-0.1.0/src/specrig/code/settings.py +132 -0
  77. specrig-0.1.0/src/specrig/contract.py +106 -0
  78. specrig-0.1.0/src/specrig/django/__init__.py +188 -0
  79. specrig-0.1.0/src/specrig/docker.py +133 -0
  80. specrig-0.1.0/src/specrig/fastapi/__init__.py +244 -0
  81. specrig-0.1.0/src/specrig/flows.py +285 -0
  82. specrig-0.1.0/src/specrig/gate.py +95 -0
  83. specrig-0.1.0/src/specrig/http.py +168 -0
  84. specrig-0.1.0/src/specrig/postgres.py +278 -0
  85. specrig-0.1.0/src/specrig/protocol/agents/contributing.md +6 -0
  86. specrig-0.1.0/src/specrig/protocol/agents/header.md +5 -0
  87. specrig-0.1.0/src/specrig/protocol/agents/reference.md +1 -0
  88. specrig-0.1.0/src/specrig/protocol/agents/rule11.md +423 -0
  89. specrig-0.1.0/src/specrig/protocol/agents/short.md +19 -0
  90. specrig-0.1.0/src/specrig/protocol/modes.yaml +55 -0
  91. specrig-0.1.0/src/specrig/proxy.py +73 -0
  92. specrig-0.1.0/src/specrig/py.typed +0 -0
  93. specrig-0.1.0/src/specrig/records.py +48 -0
  94. specrig-0.1.0/src/specrig/redis.py +154 -0
  95. specrig-0.1.0/src/specrig/resource.py +49 -0
  96. specrig-0.1.0/src/specrig/rig.py +370 -0
  97. specrig-0.1.0/src/specrig/run.py +22 -0
  98. specrig-0.1.0/src/specrig/standins.py +112 -0
  99. specrig-0.1.0/src/specrig/suite.py +239 -0
  100. specrig-0.1.0/src/specrig/surface.py +87 -0
  101. specrig-0.1.0/src/specrig/tool/__init__.py +0 -0
  102. specrig-0.1.0/src/specrig/tool/agents.py +150 -0
  103. specrig-0.1.0/src/specrig/tool/cli.py +137 -0
  104. specrig-0.1.0/src/specrig/tool/init.py +244 -0
  105. specrig-0.1.0/src/specrig/tool/modes.py +54 -0
  106. specrig-0.1.0/src/specrig/tool/service.py +209 -0
  107. specrig-0.1.0/src/specrig/tool/templates.py +196 -0
  108. specrig-0.1.0/tests/fixtures/django/manage.py +8 -0
  109. specrig-0.1.0/tests/fixtures/django/pyproject.toml +4 -0
  110. specrig-0.1.0/tests/fixtures/django/stock/__init__.py +0 -0
  111. specrig-0.1.0/tests/fixtures/django/stock/api.py +9 -0
  112. specrig-0.1.0/tests/fixtures/django/stock/settings.py +14 -0
  113. specrig-0.1.0/tests/fixtures/django/stock/urls.py +8 -0
  114. specrig-0.1.0/tests/fixtures/django/stock/views.py +28 -0
  115. specrig-0.1.0/tests/fixtures/django/stock/warehouse.py +11 -0
  116. specrig-0.1.0/tests/fixtures/fastapi/.env.example +2 -0
  117. specrig-0.1.0/tests/fixtures/fastapi/gateway/__init__.py +0 -0
  118. specrig-0.1.0/tests/fixtures/fastapi/gateway/config.py +17 -0
  119. specrig-0.1.0/tests/fixtures/fastapi/gateway/crm.py +17 -0
  120. specrig-0.1.0/tests/fixtures/fastapi/gateway/main.py +18 -0
  121. specrig-0.1.0/tests/fixtures/fastapi/gateway/routes/__init__.py +0 -0
  122. specrig-0.1.0/tests/fixtures/fastapi/gateway/routes/orders.py +13 -0
  123. specrig-0.1.0/tests/fixtures/fastapi/gateway/sessions.py +14 -0
  124. specrig-0.1.0/tests/fixtures/fastapi/pyproject.toml +4 -0
  125. specrig-0.1.0/tests/fixtures/protocol/agents/verdicts.yaml +122 -0
  126. specrig-0.1.0/tests/fixtures/protocol/markers/areas.yaml +119 -0
  127. specrig-0.1.0/tests/fixtures/protocol/records/reminders.flows.yaml +40 -0
  128. specrig-0.1.0/tests/fixtures/protocol/records/reminders.trace.json +34 -0
  129. specrig-0.1.0/tests/fixtures/protocol/records/shop.flows.yaml +53 -0
  130. specrig-0.1.0/tests/fixtures/protocol/records/shop.trace.json +37 -0
  131. specrig-0.1.0/tests/test_agents.py +96 -0
  132. specrig-0.1.0/tests/test_backend.py +109 -0
  133. specrig-0.1.0/tests/test_flows.py +78 -0
  134. specrig-0.1.0/tests/test_format.py +28 -0
  135. specrig-0.1.0/tests/test_gate.py +17 -0
  136. specrig-0.1.0/tests/test_harness.py +466 -0
  137. specrig-0.1.0/tests/test_init.py +200 -0
  138. specrig-0.1.0/tests/test_rules.py +106 -0
  139. specrig-0.1.0/tests/test_surface.py +100 -0
@@ -0,0 +1,44 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags: ["v*"]
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ timeout-minutes: 15
15
+ steps:
16
+ - uses: actions/checkout@v5
17
+ - uses: actions/setup-python@v6
18
+ with:
19
+ python-version: "3.13"
20
+ - run: make generate
21
+ - run: make lint
22
+ - run: make test
23
+ - name: the records are the code's
24
+ run: git diff --exit-code
25
+
26
+ publish:
27
+ if: startsWith(github.ref, 'refs/tags/v')
28
+ needs: test
29
+ runs-on: ubuntu-latest
30
+ environment: pypi
31
+ permissions:
32
+ id-token: write
33
+ steps:
34
+ - uses: actions/checkout@v5
35
+ - uses: actions/setup-python@v6
36
+ with:
37
+ python-version: "3.13"
38
+ - name: the tag names the version
39
+ run: |
40
+ version=$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')
41
+ test "v$version" = "$GITHUB_REF_NAME"
42
+ - run: python -m pip install build
43
+ - run: python -m build
44
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,8 @@
1
+ .idea/
2
+ .venv/
3
+ __pycache__/
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ build/
7
+ dist/
8
+ *.egg-info/
specrig-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Denis Daschenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
specrig-0.1.0/Makefile ADDED
@@ -0,0 +1,34 @@
1
+ PROTOCOL ?= $(abspath $(CURDIR)/../protocol)
2
+ PYTHON ?= python3
3
+ VENV := $(CURDIR)/.venv
4
+
5
+ $(VENV):
6
+ $(PYTHON) -m venv $(VENV)
7
+ $(VENV)/bin/pip install -q --upgrade pip
8
+
9
+ install: $(VENV)
10
+ $(VENV)/bin/pip install -q -e ".[fastapi,django,postgres]" --group dev
11
+
12
+ generate: install
13
+ cd samples/shop && $(VENV)/bin/specrig surface && $(VENV)/bin/specrig agents
14
+ cd samples/reminders && $(VENV)/bin/specrig surface && $(VENV)/bin/specrig agents
15
+
16
+ test: install
17
+ $(VENV)/bin/pytest -q
18
+ cd samples/shop && $(VENV)/bin/pytest -q tests/internal
19
+ cd samples/reminders && $(VENV)/bin/pytest -q tests/internal
20
+
21
+ lint: install
22
+ $(VENV)/bin/ruff check src tests samples
23
+ $(VENV)/bin/ruff format --check src tests samples
24
+
25
+ protocol:
26
+ rm -rf src/specrig/protocol tests/fixtures/protocol
27
+ mkdir -p src/specrig/protocol/agents tests/fixtures/protocol/records tests/fixtures/protocol/agents tests/fixtures/protocol/markers
28
+ cp $(PROTOCOL)/modes.yaml src/specrig/protocol/
29
+ cp $(PROTOCOL)/agents/*.md src/specrig/protocol/agents/
30
+ cp $(PROTOCOL)/fixtures/records/* tests/fixtures/protocol/records/
31
+ cp $(PROTOCOL)/fixtures/agents/*.yaml tests/fixtures/protocol/agents/
32
+ cp $(PROTOCOL)/fixtures/markers/*.yaml tests/fixtures/protocol/markers/
33
+
34
+ .PHONY: install generate test lint protocol