CLI utilities for csrd service generation and feature augmentation
Project description
csrd-utils
CLI and runtime helpers for generating csrd services and augmenting existing services with optional features.
Install
pip install "csrd-utils @ git+https://github.com/csrd-api/fastapi-common.git#subdirectory=packages/utils"
CLI
csrd --help
csrd --version
# Workspace-level generation (compose-based)
csrd generate # interactive menu (context-aware)
csrd generate workspace --name my-ws # create empty workspace
csrd generate preset --name my-ws # create workspace from preset
csrd generate add-service --name inventory # add service to current workspace
csrd generate rename-service --service-name old-service --new-name new-service
csrd generate remove-service --service-name old # remove service from spec
csrd generate add-infra --infra-type postgres # add infra to workspace
csrd generate remove-infra --infra-type postgres # remove infra from workspace
csrd generate add-augment # interactive augment selection
csrd generate list-augments # list available augments
# Feature augmentation
csrd feature list
csrd feature plan workers --service .
csrd feature plan workers --service . --json
csrd feature add workers --service .
# Diagnostics
csrd doctor --service .
csrd audit # workspace-aware: scans all services
csrd audit --service . # explicitly audit one service path
# Shell completion
csrd completion bash # print bash completion script
csrd completion install # install to ~/.local/share/bash-completion/
csrd completion uninstall # remove installed completion
feature plan --json is useful for CI or tooling wrappers.
Bash tab completion
Install completion (one-time, persists across shells):
csrd completion install
This writes a completion script to ~/.local/share/bash-completion/completions/csrd,
which bash auto-loads — no .bashrc edit needed. To remove: csrd completion uninstall.
Manual alternative:
source <(csrd completion bash)
Non-TTY mode
Set CSRD_NO_TTY=1 to force numbered-fallback prompts instead of the
arrow-key TUI. Useful for manual testing or piping input:
CSRD_NO_TTY=1 csrd generate
Interactive generation behavior
csrd generateshows a context-aware menu (workspace actions when inside a workspace, workspace creation otherwise).- Services, augments, and infra are managed via
csrd-compose.yaml(the workspace spec). csrd generate rename-servicerenames the service in the spec, renamessrc/,tests/, andDockerfile.*, and rewrites Python imports and string references.- All yes/no prompts default to
No(y/N).
Typical workflow
# 0) Create a workspace and add services
csrd generate workspace --name local-dev
cd local-dev
csrd generate add-service --name inventory --features database --port 8081
csrd generate add-service --name pricing --port 8082
# 1) Verify service compatibility
csrd doctor --service .
# 1b) Audit for weak/insecure defaults
csrd audit
# 2) Inspect available bundled features
csrd feature list
# 3) Dry-run a feature
csrd feature plan workers --service .
# 4) Apply feature files/merges
csrd feature add workers --service .
# 5) Rename a service
csrd generate rename-service --service-name pricing-service --new-name billing-service
Bundled assets
features/workers/feature manifests and fragmentstemplates/service/template starter
Python API
from pathlib import Path
from csrd_utils import ServiceAugmentor
from csrd_utils.resources import features_path
with features_path() as feature_lib:
augmentor = ServiceAugmentor(Path("."), feature_lib)
ok, changes = augmentor.add_feature("workers", plan=True)
Documentation
docs/CLI_REFERENCE.md- full command/flag referencedocs/FEATURES.md- bundled feature catalog and behaviordocs/FUTURE_WORK.md- remaining provider-specific CI wiring work (Phase 5B)docs/AGENT_SMOKE_TESTS.md- copy/paste validation flow for clean workspacesdocs/COMMAND_MATRIX.yaml- machine-readable command matrix for automationAGENTS.md- package-local rules for autonomous agents
CLI-only agent mode
If an agent can only see the installed CLI (not source files), use this exploration sequence:
csrd --help
csrd generate --help
csrd feature --help
csrd doctor --help
csrd audit --help
csrd completion --help
csrd feature list
csrd generate list-augments
Then run a clean smoke flow:
mkdir -p /tmp/csrd-smoke && cd /tmp/csrd-smoke
csrd generate workspace --name ws
cd ws
csrd generate add-service --name demo-svc --port 8080
csrd doctor --service .
csrd audit
csrd feature plan workers --service .
csrd feature add workers --service .
csrd generate rename-service --service-name demo-svc-service --new-name renamed-svc
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file csrd_utils-0.5.22.tar.gz.
File metadata
- Download URL: csrd_utils-0.5.22.tar.gz
- Upload date:
- Size: 113.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1477703b9cda48703f35742bf1dee2a8aff9a0997b1d61e804c04afc1a8345e
|
|
| MD5 |
4d3a89f322dbf56c25857aeaceea0fe3
|
|
| BLAKE2b-256 |
e7cee3dd7ea4018e9fdb83419742f16c967e9e76cdd90af4c476a4118d60cc31
|
Provenance
The following attestation bundles were made for csrd_utils-0.5.22.tar.gz:
Publisher:
release.yml on csrd-api/fastapi-common
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
csrd_utils-0.5.22.tar.gz -
Subject digest:
f1477703b9cda48703f35742bf1dee2a8aff9a0997b1d61e804c04afc1a8345e - Sigstore transparency entry: 1495645533
- Sigstore integration time:
-
Permalink:
csrd-api/fastapi-common@9332003a2f2cebfe9ee7101bfa61ad630dca61e5 -
Branch / Tag:
refs/tags/v0.5.22 - Owner: https://github.com/csrd-api
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9332003a2f2cebfe9ee7101bfa61ad630dca61e5 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file csrd_utils-0.5.22-py3-none-any.whl.
File metadata
- Download URL: csrd_utils-0.5.22-py3-none-any.whl
- Upload date:
- Size: 160.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edc30db8c66e59ca9918e02b7c668c2381ce0a20bc7e0e7c2f442891a56fdd2b
|
|
| MD5 |
3deae6ad43f8d060274839c09fe0b7ae
|
|
| BLAKE2b-256 |
5f8a3e2bd9a38a9d2479368ee1615efb9db5001d6d6696b612c17829507f1037
|
Provenance
The following attestation bundles were made for csrd_utils-0.5.22-py3-none-any.whl:
Publisher:
release.yml on csrd-api/fastapi-common
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
csrd_utils-0.5.22-py3-none-any.whl -
Subject digest:
edc30db8c66e59ca9918e02b7c668c2381ce0a20bc7e0e7c2f442891a56fdd2b - Sigstore transparency entry: 1495646823
- Sigstore integration time:
-
Permalink:
csrd-api/fastapi-common@9332003a2f2cebfe9ee7101bfa61ad630dca61e5 -
Branch / Tag:
refs/tags/v0.5.22 - Owner: https://github.com/csrd-api
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9332003a2f2cebfe9ee7101bfa61ad630dca61e5 -
Trigger Event:
workflow_dispatch
-
Statement type: