csrd-utils 0.1.10__tar.gz → 0.3.4__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.
- csrd_utils-0.3.4/.gitignore +217 -0
- csrd_utils-0.3.4/PKG-INFO +113 -0
- csrd_utils-0.3.4/README.md +100 -0
- csrd_utils-0.3.4/pyproject.toml +34 -0
- csrd_utils-0.3.4/src/csrd_utils/__init__.py +7 -0
- csrd_utils-0.3.4/src/csrd_utils/__main__.py +330 -0
- csrd_utils-0.3.4/src/csrd_utils/augmentor.py +454 -0
- csrd_utils-0.3.4/src/csrd_utils/doctor.py +46 -0
- csrd_utils-0.3.4/src/csrd_utils/features/workers/conftest.fragment.py +14 -0
- csrd_utils-0.3.4/src/csrd_utils/features/workers/docker-compose.fragment.yaml +22 -0
- csrd_utils-0.3.4/src/csrd_utils/features/workers/manifest.yaml +24 -0
- csrd_utils-0.3.4/src/csrd_utils/features/workers/requirements.fragment +2 -0
- csrd_utils-0.3.4/src/csrd_utils/features/workers/settings.fragment.py +3 -0
- csrd_utils-0.3.4/src/csrd_utils/features/workers/src/app/workers/__init__.py +6 -0
- csrd_utils-0.3.4/src/csrd_utils/features/workers/src/app/workers/celery_app.py +21 -0
- csrd_utils-0.3.4/src/csrd_utils/features/workers/src/app/workers/tasks.py +29 -0
- csrd_utils-0.3.4/src/csrd_utils/features/workers/tests/test_workers.py +20 -0
- csrd_utils-0.3.4/src/csrd_utils/fragments.py +334 -0
- csrd_utils-0.3.4/src/csrd_utils/generator.py +107 -0
- csrd_utils-0.3.4/src/csrd_utils/resources.py +26 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/README.md +53 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/cookiecutter.json +27 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/hooks/post_gen_project.py +83 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/.dockerignore +7 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/.env.example +38 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/Dockerfile +13 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/README.md +46 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/docker-compose.yml +107 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/requirements.txt +38 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/__init__.py +32 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/cache.py +14 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/delegates/__init__.py +7 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/delegates/upstreams.py +10 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/dependencies/__init__.py +19 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/dependencies/delegates.py +13 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/dependencies/item_repository.py +55 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/dependencies/worker_broker.py +12 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/middleware/__init__.py +7 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/middleware/logging.py +22 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/repositories/__init__.py +7 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/repositories/item_repository.py +94 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/settings.py +54 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/views/__init__.py +3 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/views/unversioned/__init__.py +15 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/views/unversioned/health_view.py +8 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/views/unversioned/items_view.py +70 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/workers/__init__.py +7 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/src/app/workers/tasks.py +17 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/tests/__init__.py +0 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/tests/conftest.py +37 -0
- csrd_utils-0.3.4/src/csrd_utils/templates/cookiecutter-service/{{cookiecutter.service_name}}/tests/test_items.py +32 -0
- csrd_utils-0.1.10/PKG-INFO +0 -16
- csrd_utils-0.1.10/README.md +0 -2
- csrd_utils-0.1.10/pyproject.toml +0 -18
- csrd_utils-0.1.10/src/csrd_utils/__init__.py +0 -1
- csrd_utils-0.1.10/src/csrd_utils/config/__init__.py +0 -3
- csrd_utils-0.1.10/src/csrd_utils/config/_config.py +0 -20
- csrd_utils-0.1.10/src/csrd_utils/string_utils.py +0 -44
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
/env/
|
|
142
|
+
/venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
208
|
+
|
|
209
|
+
*.db
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
# Import linter cache
|
|
213
|
+
.import_linter_cache/
|
|
214
|
+
|
|
215
|
+
# IDE
|
|
216
|
+
.idea/
|
|
217
|
+
.idea/*
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: csrd-utils
|
|
3
|
+
Version: 0.3.4
|
|
4
|
+
Summary: CLI utilities for csrd service generation and feature augmentation
|
|
5
|
+
Project-URL: Repository, https://github.com/csrd-api/fastapi-common
|
|
6
|
+
Project-URL: Documentation, https://github.com/csrd-api/fastapi-common/tree/main/packages/utils
|
|
7
|
+
Project-URL: Changelog, https://github.com/csrd-api/fastapi-common/blob/main/CHANGELOG.md
|
|
8
|
+
License: MIT
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Requires-Dist: cookiecutter<3,>=2.6
|
|
11
|
+
Requires-Dist: pyyaml<7,>=6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# csrd-utils
|
|
15
|
+
|
|
16
|
+
CLI and runtime helpers for generating csrd services and augmenting existing services with optional features.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install "csrd-utils @ git+https://github.com/csrd-api/fastapi-common.git#subdirectory=packages/utils"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## CLI
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
csrd --help
|
|
28
|
+
csrd new service # interactive prompts
|
|
29
|
+
csrd new service --interactive --name items # pre-fills name prompt with 'items'
|
|
30
|
+
csrd new service --name inventory --no-interactive --output .
|
|
31
|
+
csrd feature list
|
|
32
|
+
csrd feature plan workers --service .
|
|
33
|
+
csrd feature plan workers --service . --json
|
|
34
|
+
csrd feature add workers --service .
|
|
35
|
+
csrd doctor --service .
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`feature plan --json` is useful for CI or tooling wrappers.
|
|
39
|
+
|
|
40
|
+
### Interactive generation behavior
|
|
41
|
+
|
|
42
|
+
- `csrd new service` runs interactive prompts by default.
|
|
43
|
+
- Passing `--name <value>` in interactive mode uses that value as the name prompt default.
|
|
44
|
+
- You can still overwrite the default by entering a different value at the prompt.
|
|
45
|
+
- Use `--no-interactive` for fully flag-driven generation.
|
|
46
|
+
|
|
47
|
+
## Typical workflow
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# 0) Generate a new service from bundled template
|
|
51
|
+
csrd new service --name inventory --output . --database postgres --workers
|
|
52
|
+
|
|
53
|
+
# 1) Verify service compatibility
|
|
54
|
+
csrd doctor --service ./inventory
|
|
55
|
+
|
|
56
|
+
# 2) Inspect available bundled features
|
|
57
|
+
csrd feature list
|
|
58
|
+
|
|
59
|
+
# 3) Dry-run a feature
|
|
60
|
+
csrd feature plan workers --service ./inventory
|
|
61
|
+
|
|
62
|
+
# 4) Apply feature files/merges
|
|
63
|
+
csrd feature add workers --service ./inventory
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Bundled assets
|
|
67
|
+
|
|
68
|
+
- `features/workers/` feature manifests and fragments
|
|
69
|
+
- `templates/cookiecutter-service/` template starter
|
|
70
|
+
|
|
71
|
+
## Python API
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from pathlib import Path
|
|
75
|
+
from csrd_utils import ServiceAugmentor
|
|
76
|
+
from csrd_utils.resources import features_path
|
|
77
|
+
|
|
78
|
+
with features_path() as feature_lib:
|
|
79
|
+
augmentor = ServiceAugmentor(Path("."), feature_lib)
|
|
80
|
+
ok, changes = augmentor.add_feature("workers", plan=True)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Documentation
|
|
84
|
+
|
|
85
|
+
- `docs/CLI_REFERENCE.md` - full command/flag reference
|
|
86
|
+
- `docs/FEATURES.md` - bundled feature catalog and behavior
|
|
87
|
+
- `docs/AGENT_SMOKE_TESTS.md` - copy/paste validation flow for clean workspaces
|
|
88
|
+
- `docs/COMMAND_MATRIX.yaml` - machine-readable command matrix for automation
|
|
89
|
+
- `AGENTS.md` - package-local rules for autonomous agents
|
|
90
|
+
|
|
91
|
+
## CLI-only agent mode
|
|
92
|
+
|
|
93
|
+
If an agent can only see the installed CLI (not source files), use this exploration sequence:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
csrd --help
|
|
97
|
+
csrd new --help
|
|
98
|
+
csrd feature --help
|
|
99
|
+
csrd doctor --help
|
|
100
|
+
csrd feature list
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Then run a clean smoke flow:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
mkdir -p /tmp/csrd-smoke
|
|
107
|
+
cd /tmp/csrd-smoke
|
|
108
|
+
csrd new service --name demo-svc --output . --no-interactive
|
|
109
|
+
cd demo-svc
|
|
110
|
+
csrd doctor
|
|
111
|
+
csrd feature plan workers
|
|
112
|
+
csrd feature add workers
|
|
113
|
+
```
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# csrd-utils
|
|
2
|
+
|
|
3
|
+
CLI and runtime helpers for generating csrd services and augmenting existing services with optional features.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install "csrd-utils @ git+https://github.com/csrd-api/fastapi-common.git#subdirectory=packages/utils"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## CLI
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
csrd --help
|
|
15
|
+
csrd new service # interactive prompts
|
|
16
|
+
csrd new service --interactive --name items # pre-fills name prompt with 'items'
|
|
17
|
+
csrd new service --name inventory --no-interactive --output .
|
|
18
|
+
csrd feature list
|
|
19
|
+
csrd feature plan workers --service .
|
|
20
|
+
csrd feature plan workers --service . --json
|
|
21
|
+
csrd feature add workers --service .
|
|
22
|
+
csrd doctor --service .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`feature plan --json` is useful for CI or tooling wrappers.
|
|
26
|
+
|
|
27
|
+
### Interactive generation behavior
|
|
28
|
+
|
|
29
|
+
- `csrd new service` runs interactive prompts by default.
|
|
30
|
+
- Passing `--name <value>` in interactive mode uses that value as the name prompt default.
|
|
31
|
+
- You can still overwrite the default by entering a different value at the prompt.
|
|
32
|
+
- Use `--no-interactive` for fully flag-driven generation.
|
|
33
|
+
|
|
34
|
+
## Typical workflow
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# 0) Generate a new service from bundled template
|
|
38
|
+
csrd new service --name inventory --output . --database postgres --workers
|
|
39
|
+
|
|
40
|
+
# 1) Verify service compatibility
|
|
41
|
+
csrd doctor --service ./inventory
|
|
42
|
+
|
|
43
|
+
# 2) Inspect available bundled features
|
|
44
|
+
csrd feature list
|
|
45
|
+
|
|
46
|
+
# 3) Dry-run a feature
|
|
47
|
+
csrd feature plan workers --service ./inventory
|
|
48
|
+
|
|
49
|
+
# 4) Apply feature files/merges
|
|
50
|
+
csrd feature add workers --service ./inventory
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Bundled assets
|
|
54
|
+
|
|
55
|
+
- `features/workers/` feature manifests and fragments
|
|
56
|
+
- `templates/cookiecutter-service/` template starter
|
|
57
|
+
|
|
58
|
+
## Python API
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from pathlib import Path
|
|
62
|
+
from csrd_utils import ServiceAugmentor
|
|
63
|
+
from csrd_utils.resources import features_path
|
|
64
|
+
|
|
65
|
+
with features_path() as feature_lib:
|
|
66
|
+
augmentor = ServiceAugmentor(Path("."), feature_lib)
|
|
67
|
+
ok, changes = augmentor.add_feature("workers", plan=True)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Documentation
|
|
71
|
+
|
|
72
|
+
- `docs/CLI_REFERENCE.md` - full command/flag reference
|
|
73
|
+
- `docs/FEATURES.md` - bundled feature catalog and behavior
|
|
74
|
+
- `docs/AGENT_SMOKE_TESTS.md` - copy/paste validation flow for clean workspaces
|
|
75
|
+
- `docs/COMMAND_MATRIX.yaml` - machine-readable command matrix for automation
|
|
76
|
+
- `AGENTS.md` - package-local rules for autonomous agents
|
|
77
|
+
|
|
78
|
+
## CLI-only agent mode
|
|
79
|
+
|
|
80
|
+
If an agent can only see the installed CLI (not source files), use this exploration sequence:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
csrd --help
|
|
84
|
+
csrd new --help
|
|
85
|
+
csrd feature --help
|
|
86
|
+
csrd doctor --help
|
|
87
|
+
csrd feature list
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Then run a clean smoke flow:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
mkdir -p /tmp/csrd-smoke
|
|
94
|
+
cd /tmp/csrd-smoke
|
|
95
|
+
csrd new service --name demo-svc --output . --no-interactive
|
|
96
|
+
cd demo-svc
|
|
97
|
+
csrd doctor
|
|
98
|
+
csrd feature plan workers
|
|
99
|
+
csrd feature add workers
|
|
100
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "csrd-utils"
|
|
3
|
+
version = "0.3.4"
|
|
4
|
+
description = "CLI utilities for csrd service generation and feature augmentation"
|
|
5
|
+
license = { text = "MIT" }
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"cookiecutter>=2.6,<3",
|
|
9
|
+
"PyYAML>=6,<7",
|
|
10
|
+
]
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
|
|
13
|
+
[project.scripts]
|
|
14
|
+
csrd = "csrd_utils.__main__:main"
|
|
15
|
+
csrd-utils = "csrd_utils.__main__:main"
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Repository = "https://github.com/csrd-api/fastapi-common"
|
|
19
|
+
Documentation = "https://github.com/csrd-api/fastapi-common/tree/main/packages/utils"
|
|
20
|
+
Changelog = "https://github.com/csrd-api/fastapi-common/blob/main/CHANGELOG.md"
|
|
21
|
+
|
|
22
|
+
[build-system]
|
|
23
|
+
requires = ["hatchling"]
|
|
24
|
+
build-backend = "hatchling.build"
|
|
25
|
+
|
|
26
|
+
[tool.hatch.build.targets.wheel]
|
|
27
|
+
packages = ["src/csrd_utils"]
|
|
28
|
+
|
|
29
|
+
[tool.hatch.build.targets.sdist]
|
|
30
|
+
include = [
|
|
31
|
+
"src/csrd_utils/**",
|
|
32
|
+
"README.md",
|
|
33
|
+
"pyproject.toml",
|
|
34
|
+
]
|