ucgen 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.
- ucgen-0.1.0/.gitignore +18 -0
- ucgen-0.1.0/.ucgenrc.toml.example +21 -0
- ucgen-0.1.0/CONTRIBUTING.md +22 -0
- ucgen-0.1.0/LICENSE +21 -0
- ucgen-0.1.0/PKG-INFO +129 -0
- ucgen-0.1.0/README.md +96 -0
- ucgen-0.1.0/core/data-flow.json +87 -0
- ucgen-0.1.0/core/overview.json +98 -0
- ucgen-0.1.0/ideas-10.txt +10 -0
- ucgen-0.1.0/index.json +218 -0
- ucgen-0.1.0/knowledge/all-knowledge.json +131 -0
- ucgen-0.1.0/memory/CONVENTIONS +2 -0
- ucgen-0.1.0/memory/HEAD +11 -0
- ucgen-0.1.0/memory/README.json +63 -0
- ucgen-0.1.0/memory/decisions/D-001.json +1 -0
- ucgen-0.1.0/memory/decisions/D-002.json +1 -0
- ucgen-0.1.0/memory/decisions/D-003.json +1 -0
- ucgen-0.1.0/memory/decisions/D-004.json +1 -0
- ucgen-0.1.0/memory/decisions/D-005.json +1 -0
- ucgen-0.1.0/memory/decisions.idx +6 -0
- ucgen-0.1.0/memory/mistakes/M-001.json +11 -0
- ucgen-0.1.0/memory/mistakes.idx +2 -0
- ucgen-0.1.0/modules/cli.json +128 -0
- ucgen-0.1.0/modules/core-modules.json +100 -0
- ucgen-0.1.0/modules/errors.json +42 -0
- ucgen-0.1.0/modules/providers-and-utils.json +112 -0
- ucgen-0.1.0/preferences/conventions.json +59 -0
- ucgen-0.1.0/prompts/all-stages.json +53 -0
- ucgen-0.1.0/pyproject.toml +58 -0
- ucgen-0.1.0/schema/all-models.json +192 -0
- ucgen-0.1.0/templates/index.json +49 -0
- ucgen-0.1.0/tests/__init__.py +1 -0
- ucgen-0.1.0/tests/conftest.py +105 -0
- ucgen-0.1.0/tests/test_assembler.py +29 -0
- ucgen-0.1.0/tests/test_cli.py +15 -0
- ucgen-0.1.0/tests/test_generator.py +117 -0
- ucgen-0.1.0/tests/test_schema.py +53 -0
- ucgen-0.1.0/tests/test_utils.py +42 -0
- ucgen-0.1.0/ucgen/__init__.py +3 -0
- ucgen-0.1.0/ucgen/__main__.py +14 -0
- ucgen-0.1.0/ucgen/assembler.py +153 -0
- ucgen-0.1.0/ucgen/cli.py +803 -0
- ucgen-0.1.0/ucgen/config.py +88 -0
- ucgen-0.1.0/ucgen/errors.py +73 -0
- ucgen-0.1.0/ucgen/exporter.py +176 -0
- ucgen-0.1.0/ucgen/generator.py +231 -0
- ucgen-0.1.0/ucgen/project_runner.py +294 -0
- ucgen-0.1.0/ucgen/prompts/stage1_intake.md +77 -0
- ucgen-0.1.0/ucgen/prompts/stage2_sections.md +200 -0
- ucgen-0.1.0/ucgen/prompts/stage3_entities.md +21 -0
- ucgen-0.1.0/ucgen/prompts/system_base.md +6 -0
- ucgen-0.1.0/ucgen/providers/__init__.py +5 -0
- ucgen-0.1.0/ucgen/providers/anthropic_provider.py +96 -0
- ucgen-0.1.0/ucgen/providers/base.py +40 -0
- ucgen-0.1.0/ucgen/providers/factory.py +46 -0
- ucgen-0.1.0/ucgen/providers/ollama.py +72 -0
- ucgen-0.1.0/ucgen/providers/openai_provider.py +78 -0
- ucgen-0.1.0/ucgen/reporter.py +214 -0
- ucgen-0.1.0/ucgen/schema.py +309 -0
- ucgen-0.1.0/ucgen/templates/api.md.j2 +24 -0
- ucgen-0.1.0/ucgen/templates/cockburn-full.md.j2 +55 -0
- ucgen-0.1.0/ucgen/templates/default.md.j2 +45 -0
- ucgen-0.1.0/ucgen/templates/enterprise.md.j2 +52 -0
- ucgen-0.1.0/ucgen/templates/minimal.md.j2 +12 -0
- ucgen-0.1.0/ucgen/templates/report.html.j2 +198 -0
- ucgen-0.1.0/ucgen/utils/__init__.py +8 -0
- ucgen-0.1.0/ucgen/utils/id_counter.py +29 -0
- ucgen-0.1.0/ucgen/utils/json_extract.py +35 -0
- ucgen-0.1.0/ucgen/utils/prompt_loader.py +38 -0
- ucgen-0.1.0/ucgen/utils/table_formatter.py +32 -0
- ucgen-0.1.0/ucgen/validator.py +54 -0
- ucgen-0.1.0/ucgen-test-checklist.md +411 -0
- ucgen-0.1.0/ucgen.yaml +53 -0
- ucgen-0.1.0/ucgen.yaml.example +57 -0
ucgen-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# ucgen configuration example
|
|
2
|
+
# Copy this file to .ucgenrc.toml and customize values.
|
|
3
|
+
|
|
4
|
+
[defaults]
|
|
5
|
+
provider = "ollama"
|
|
6
|
+
model = "mistral" # or "qwen3:8b" — better JSON reliability
|
|
7
|
+
output_dir = "./use-cases"
|
|
8
|
+
template = "default"
|
|
9
|
+
id_prefix = "UC"
|
|
10
|
+
temperature = 0.3
|
|
11
|
+
max_tokens = 4000 # increase if sections are truncated,
|
|
12
|
+
# decrease if your hardware is slow
|
|
13
|
+
|
|
14
|
+
[providers]
|
|
15
|
+
ollama_base_url = "http://localhost:11434"
|
|
16
|
+
custom_base_url = ""
|
|
17
|
+
custom_prompts_dir = ""
|
|
18
|
+
|
|
19
|
+
[hooks]
|
|
20
|
+
on_generate = ""
|
|
21
|
+
on_batch_complete = ""
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## Setup
|
|
2
|
+
|
|
3
|
+
Requires Python 3.11+ and uv.
|
|
4
|
+
|
|
5
|
+
pip install uv
|
|
6
|
+
uv sync --extra dev
|
|
7
|
+
uv run pytest tests/ -v
|
|
8
|
+
|
|
9
|
+
## Linting and type checking
|
|
10
|
+
|
|
11
|
+
python -m ruff check ucgen/
|
|
12
|
+
python -m ruff format --check ucgen/
|
|
13
|
+
python -m mypy ucgen/ --ignore-missing-imports
|
|
14
|
+
|
|
15
|
+
## Local models (Ollama)
|
|
16
|
+
|
|
17
|
+
Recommended models:
|
|
18
|
+
- qwen3:8b — better structured JSON output, recommended
|
|
19
|
+
- mistral — lighter, faster, occasional type mismatches
|
|
20
|
+
|
|
21
|
+
ollama pull qwen3:8b
|
|
22
|
+
ollama pull mistral
|
ucgen-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aureum01
|
|
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.
|
ucgen-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ucgen
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Generate structured use case documents from natural language input.
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Requires-Dist: aiofiles>=23.0
|
|
8
|
+
Requires-Dist: anthropic>=0.30
|
|
9
|
+
Requires-Dist: httpx>=0.27
|
|
10
|
+
Requires-Dist: jinja2>=3.1
|
|
11
|
+
Requires-Dist: openai>=1.40
|
|
12
|
+
Requires-Dist: pydantic>=2.7
|
|
13
|
+
Requires-Dist: rich>=13.7
|
|
14
|
+
Requires-Dist: typer[all]>=0.12
|
|
15
|
+
Provides-Extra: all
|
|
16
|
+
Requires-Dist: mypy>=1.10; extra == 'all'
|
|
17
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'all'
|
|
18
|
+
Requires-Dist: pytest-mock>=3.12; extra == 'all'
|
|
19
|
+
Requires-Dist: pytest>=8.0; extra == 'all'
|
|
20
|
+
Requires-Dist: pyyaml>=6.0; extra == 'all'
|
|
21
|
+
Requires-Dist: ruff>=0.5; extra == 'all'
|
|
22
|
+
Requires-Dist: types-pyyaml>=6.0; extra == 'all'
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest-mock>=3.12; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
29
|
+
Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
|
|
30
|
+
Provides-Extra: project
|
|
31
|
+
Requires-Dist: pyyaml>=6.0; extra == 'project'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# ucgen
|
|
35
|
+
|
|
36
|
+
CLI tool that generates structured Cockburn-style use case documents from natural language using local or cloud LLMs.
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+

|
|
40
|
+

|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
## What it does
|
|
44
|
+
|
|
45
|
+
`ucgen` closes the gap between a rough feature idea and a structured use case specification that developers can review and implement. It runs a staged generation pipeline that produces consistent Cockburn-style sections instead of free-form prose. Output is written as Markdown documents with frontmatter plus self-contained HTML reports for review and sharing.
|
|
46
|
+
|
|
47
|
+
## Quick start
|
|
48
|
+
|
|
49
|
+
### With Ollama (free, local)
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install ucgen
|
|
53
|
+
ollama pull qwen3:8b
|
|
54
|
+
ucgen generate "warehouse picker scans barcode to confirm item before adding to shipment"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### With Anthropic
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install ucgen
|
|
61
|
+
export ANTHROPIC_API_KEY=sk-ant-... # Windows: $env:ANTHROPIC_API_KEY=...
|
|
62
|
+
ucgen generate "warehouse picker scans barcode to confirm item before adding to shipment" --provider anthropic --model claude-sonnet-4-6
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Troubleshooting
|
|
66
|
+
|
|
67
|
+
- **Provider unavailable:** run `ucgen version` to check provider status.
|
|
68
|
+
- **Anthropic auth errors:** confirm `ANTHROPIC_API_KEY` is set in the same shell session.
|
|
69
|
+
- **Ollama connection errors:** start Ollama with `ollama serve` and verify model exists with `ollama list`.
|
|
70
|
+
- **No report output:** ensure generation completed and rerun with `--report`, or run `ucgen report`.
|
|
71
|
+
|
|
72
|
+
## Output
|
|
73
|
+
|
|
74
|
+
For the warehouse picker example, `ucgen` creates a per-use-case folder with Markdown, JSON, and optional single-report HTML.
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
use-cases/
|
|
78
|
+
report.html
|
|
79
|
+
standalone/
|
|
80
|
+
UC-2026-0049-warehouse-picker-scans-barcode/
|
|
81
|
+
UC-2026-0049-warehouse-picker-scans-barcode.md
|
|
82
|
+
UC-2026-0049-warehouse-picker-scans-barcode.json
|
|
83
|
+
report.html
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- `*.md`: human-readable use case document
|
|
87
|
+
- `*.json`: full structured `UseCaseDocument`
|
|
88
|
+
- `report.html`: self-contained HTML report (single-use-case when generated with `--report`)
|
|
89
|
+
|
|
90
|
+
## Configuration
|
|
91
|
+
|
|
92
|
+
Initialize local config:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
ucgen init
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Example `.ucgenrc.toml`:
|
|
99
|
+
|
|
100
|
+
```toml
|
|
101
|
+
[defaults]
|
|
102
|
+
provider = "ollama"
|
|
103
|
+
model = "qwen3:8b"
|
|
104
|
+
output_dir = "./use-cases"
|
|
105
|
+
template = "default"
|
|
106
|
+
temperature = 0.3
|
|
107
|
+
max_tokens = 4000
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Commands
|
|
111
|
+
|
|
112
|
+
| Command | Description |
|
|
113
|
+
|---|---|
|
|
114
|
+
| `ucgen generate "<idea>"` | Generate one use case |
|
|
115
|
+
| `ucgen generate "<idea>" --report` | Generate one use case and a single report in the UC folder |
|
|
116
|
+
| `ucgen batch <ideas.txt>` | Generate from a text/yaml batch file |
|
|
117
|
+
| `ucgen report` | Build portfolio report from all JSON docs in `output_dir` |
|
|
118
|
+
| `ucgen run` | Generate from `ucgen.yaml` project file |
|
|
119
|
+
| `ucgen status` | Show project generation status |
|
|
120
|
+
| `ucgen validate <path>` | Validate generated markdown files |
|
|
121
|
+
| `ucgen init` | Create `.ucgenrc.toml` |
|
|
122
|
+
| `ucgen init-project "<name>"` | Scaffold `ucgen.yaml` |
|
|
123
|
+
| `ucgen log` | Record a mistake in memory |
|
|
124
|
+
| `ucgen gc` | Archive/graduate memory entries |
|
|
125
|
+
| `ucgen version` | Show version and provider availability |
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT — see [LICENSE](LICENSE).
|
ucgen-0.1.0/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# ucgen
|
|
2
|
+
|
|
3
|
+
CLI tool that generates structured Cockburn-style use case documents from natural language using local or cloud LLMs.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
## What it does
|
|
11
|
+
|
|
12
|
+
`ucgen` closes the gap between a rough feature idea and a structured use case specification that developers can review and implement. It runs a staged generation pipeline that produces consistent Cockburn-style sections instead of free-form prose. Output is written as Markdown documents with frontmatter plus self-contained HTML reports for review and sharing.
|
|
13
|
+
|
|
14
|
+
## Quick start
|
|
15
|
+
|
|
16
|
+
### With Ollama (free, local)
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install ucgen
|
|
20
|
+
ollama pull qwen3:8b
|
|
21
|
+
ucgen generate "warehouse picker scans barcode to confirm item before adding to shipment"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### With Anthropic
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install ucgen
|
|
28
|
+
export ANTHROPIC_API_KEY=sk-ant-... # Windows: $env:ANTHROPIC_API_KEY=...
|
|
29
|
+
ucgen generate "warehouse picker scans barcode to confirm item before adding to shipment" --provider anthropic --model claude-sonnet-4-6
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Troubleshooting
|
|
33
|
+
|
|
34
|
+
- **Provider unavailable:** run `ucgen version` to check provider status.
|
|
35
|
+
- **Anthropic auth errors:** confirm `ANTHROPIC_API_KEY` is set in the same shell session.
|
|
36
|
+
- **Ollama connection errors:** start Ollama with `ollama serve` and verify model exists with `ollama list`.
|
|
37
|
+
- **No report output:** ensure generation completed and rerun with `--report`, or run `ucgen report`.
|
|
38
|
+
|
|
39
|
+
## Output
|
|
40
|
+
|
|
41
|
+
For the warehouse picker example, `ucgen` creates a per-use-case folder with Markdown, JSON, and optional single-report HTML.
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
use-cases/
|
|
45
|
+
report.html
|
|
46
|
+
standalone/
|
|
47
|
+
UC-2026-0049-warehouse-picker-scans-barcode/
|
|
48
|
+
UC-2026-0049-warehouse-picker-scans-barcode.md
|
|
49
|
+
UC-2026-0049-warehouse-picker-scans-barcode.json
|
|
50
|
+
report.html
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- `*.md`: human-readable use case document
|
|
54
|
+
- `*.json`: full structured `UseCaseDocument`
|
|
55
|
+
- `report.html`: self-contained HTML report (single-use-case when generated with `--report`)
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
Initialize local config:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
ucgen init
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Example `.ucgenrc.toml`:
|
|
66
|
+
|
|
67
|
+
```toml
|
|
68
|
+
[defaults]
|
|
69
|
+
provider = "ollama"
|
|
70
|
+
model = "qwen3:8b"
|
|
71
|
+
output_dir = "./use-cases"
|
|
72
|
+
template = "default"
|
|
73
|
+
temperature = 0.3
|
|
74
|
+
max_tokens = 4000
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Commands
|
|
78
|
+
|
|
79
|
+
| Command | Description |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `ucgen generate "<idea>"` | Generate one use case |
|
|
82
|
+
| `ucgen generate "<idea>" --report` | Generate one use case and a single report in the UC folder |
|
|
83
|
+
| `ucgen batch <ideas.txt>` | Generate from a text/yaml batch file |
|
|
84
|
+
| `ucgen report` | Build portfolio report from all JSON docs in `output_dir` |
|
|
85
|
+
| `ucgen run` | Generate from `ucgen.yaml` project file |
|
|
86
|
+
| `ucgen status` | Show project generation status |
|
|
87
|
+
| `ucgen validate <path>` | Validate generated markdown files |
|
|
88
|
+
| `ucgen init` | Create `.ucgenrc.toml` |
|
|
89
|
+
| `ucgen init-project "<name>"` | Scaffold `ucgen.yaml` |
|
|
90
|
+
| `ucgen log` | Record a mistake in memory |
|
|
91
|
+
| `ucgen gc` | Archive/graduate memory entries |
|
|
92
|
+
| `ucgen version` | Show version and provider availability |
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"file": "core/data-flow.json",
|
|
3
|
+
"purpose": "Step-by-step data flow for happy path, all error paths, and YAML project run path",
|
|
4
|
+
|
|
5
|
+
"happy_path_single": [
|
|
6
|
+
{"step": 1, "actor": "cli.py", "action": "Parse CLI args. Load Config. Apply flag overrides. Check ucgen.yaml absent for single mode."},
|
|
7
|
+
{"step": 2, "actor": "cli.py", "action": "ProviderFactory.create(config) -> provider. Call provider.is_available(). Exit with clear message if False."},
|
|
8
|
+
{"step": 3, "actor": "cli.py", "action": "asyncio.run(generator.generate(idea, config, provider))"},
|
|
9
|
+
{"step": 4, "actor": "generator.py", "action": "id_counter.next_id(config.output_dir) -> uc_id"},
|
|
10
|
+
{"step": 5, "actor": "generator.py", "action": "await _run_intake(idea, uc_id, config, provider) -> IntakeResult"},
|
|
11
|
+
{"step": 6, "actor": "generator.py", "action": "await _run_sections(intake, config, provider) -> SectionsResult"},
|
|
12
|
+
{"step": 7, "actor": "generator.py", "action": "await _run_entities(intake, sections, config, provider) -> EntitiesResult"},
|
|
13
|
+
{"step": 8, "actor": "generator.py", "action": "assembler.assemble(intake, sections, entities, config) -> raw_markdown string"},
|
|
14
|
+
{"step": 9, "actor": "generator.py", "action": "Return UseCaseDocument with all results + timing"},
|
|
15
|
+
{"step": 10, "actor": "cli.py", "action": "Write .md file to output_dir. Run on_generate hook if configured."},
|
|
16
|
+
{"step": 11, "actor": "cli.py", "action": "Print Rich summary: file path, UC ID, provider, model, duration_ms"}
|
|
17
|
+
],
|
|
18
|
+
|
|
19
|
+
"yaml_project_run_path": [
|
|
20
|
+
{"step": 1, "actor": "cli.py (run command)", "action": "project_runner.load_project(Path('ucgen.yaml')) -> ProjectDefinition. Fail clearly if PyYAML not installed."},
|
|
21
|
+
{"step": 2, "actor": "cli.py", "action": "Merge project.defaults into Config. Apply filter_id or filter_tag if passed."},
|
|
22
|
+
{"step": 3, "actor": "project_runner.py", "action": "Filter use_cases by id/tag/status=pending. Show Rich progress bar."},
|
|
23
|
+
{"step": 4, "actor": "project_runner.py", "action": "For each use case: asyncio.run(generator.generate(uc.goal, config, provider))"},
|
|
24
|
+
{"step": 5, "actor": "project_runner.py", "action": "Write file. Update ucgen.yaml use_case status to 'generated'."},
|
|
25
|
+
{"step": 6, "actor": "cli.py", "action": "Run on_batch_complete hook. Print summary table."}
|
|
26
|
+
],
|
|
27
|
+
|
|
28
|
+
"yaml_frontmatter_in_output": {
|
|
29
|
+
"note": "Every generated .md file starts with YAML frontmatter block",
|
|
30
|
+
"format": "--- ... ---",
|
|
31
|
+
"fields": ["uc_id", "title", "actor", "goal_level", "domain", "system_boundary", "trigger", "priority", "status", "generator", "provider", "model", "generated_at", "duration_ms", "tags", "stakeholders", "nfr", "scale_hints"],
|
|
32
|
+
"why": "Machine-readable for ucgen validate, ucgen status, CI tooling, and documentation site generators"
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
"error_paths": {
|
|
36
|
+
"provider_unavailable": "Exit before pipeline. Rich error panel with diagnostic: is Ollama running? Is API key set?",
|
|
37
|
+
"stage_parse_failure": "Log WARNING with raw output. Retry once at temp=0.1. On second failure: write raw to .ucgen_debug/. Raise GenerationError.",
|
|
38
|
+
"entity_stage_failure": "Fallback to minimal entities from intake.related_entities. Log WARNING. Continue to assemble.",
|
|
39
|
+
"template_render_failure": "Raise AssemblerError — should never happen with valid schema models.",
|
|
40
|
+
"file_write_failure": "Print generated markdown to stdout as fallback. Log ERROR.",
|
|
41
|
+
"yaml_project_not_found": "Exit with clear message: 'No ucgen.yaml found. Run ucgen init-project or specify --file.'",
|
|
42
|
+
"yaml_dep_missing": "Exit with: 'Project files require PyYAML. Run: pip install ucgen[project]'"
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
"data_contracts": {
|
|
46
|
+
"IntakeResult": {
|
|
47
|
+
"uc_id": "str — UC-{YYYY}-{NNNN}",
|
|
48
|
+
"title": "str — proper use case title",
|
|
49
|
+
"goal_level": "str — summary | user_goal | subfunction",
|
|
50
|
+
"actor": "str — role, never a person name",
|
|
51
|
+
"supporting_actors": "list[str] — external systems or roles called by this use case",
|
|
52
|
+
"stakeholders": "list[dict] — [{name, interest}]",
|
|
53
|
+
"domain": "str",
|
|
54
|
+
"system_boundary": "str | None — which service/component owns this",
|
|
55
|
+
"trigger": "str — specific event",
|
|
56
|
+
"goal": "str — one sentence",
|
|
57
|
+
"related_entities": "list[str]",
|
|
58
|
+
"scale_hints": "dict | None — {frequency, concurrent_users, data_volume}",
|
|
59
|
+
"raw_input": "str"
|
|
60
|
+
},
|
|
61
|
+
"SectionsResult": {
|
|
62
|
+
"preconditions": "list[str] — 3-6 verifiable states",
|
|
63
|
+
"minimal_guarantee": "str — what system promises even on failure (Cockburn)",
|
|
64
|
+
"success_guarantee": "str — what is true for all stakeholders after success",
|
|
65
|
+
"normal_course": "list[NormalCourseStep]",
|
|
66
|
+
"alternative_courses": "list[AlternativeCourse]",
|
|
67
|
+
"postconditions": "list[str]",
|
|
68
|
+
"information_requirements": "list[InfoRequirement]",
|
|
69
|
+
"nfr": "list[dict] | None — [{type, requirement, threshold}]",
|
|
70
|
+
"state_machine": "list[dict] | None — [{state, transitions}] when entity has lifecycle",
|
|
71
|
+
"open_issues": "list[str] | None — Cockburn open issues field"
|
|
72
|
+
},
|
|
73
|
+
"EntitiesResult": {
|
|
74
|
+
"entities": "list[Entity]"
|
|
75
|
+
},
|
|
76
|
+
"UseCaseDocument": {
|
|
77
|
+
"metadata": "IntakeResult",
|
|
78
|
+
"sections": "SectionsResult",
|
|
79
|
+
"entities": "EntitiesResult",
|
|
80
|
+
"raw_markdown": "str — final assembled document including YAML frontmatter",
|
|
81
|
+
"generated_at": "datetime UTC",
|
|
82
|
+
"provider": "str",
|
|
83
|
+
"model": "str",
|
|
84
|
+
"duration_ms": "int"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"file": "core/overview.json",
|
|
3
|
+
"purpose": "Design philosophy, pipeline stages, and module map in one file",
|
|
4
|
+
|
|
5
|
+
"design_philosophy": {
|
|
6
|
+
"principles": [
|
|
7
|
+
"Each generation stage is a separate focused LLM call — never one giant prompt",
|
|
8
|
+
"Providers are fully interchangeable — same BaseProvider interface, different backends",
|
|
9
|
+
"Prompts are external .md files loaded at runtime — never inline Python strings",
|
|
10
|
+
"Templates are Jinja2 .j2 files — never f-strings for document assembly",
|
|
11
|
+
"Assembler stage is pure Python — no LLM in final document construction",
|
|
12
|
+
"All LLM calls are async — asyncio.run() called exactly once in cli.py",
|
|
13
|
+
"Fail loud: never write a partial document, always surface errors with full context",
|
|
14
|
+
"Three extension seams only: BaseProvider, Jinja2 templates, lifecycle hooks"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
"pipeline_stages": [
|
|
19
|
+
{
|
|
20
|
+
"id": 1,
|
|
21
|
+
"name": "intake",
|
|
22
|
+
"input": "raw string from user",
|
|
23
|
+
"output_type": "IntakeResult",
|
|
24
|
+
"prompt_file": "ucgen/prompts/stage1_intake.md",
|
|
25
|
+
"llm_required": true,
|
|
26
|
+
"retry": {"max": 1, "temperature": 0.1},
|
|
27
|
+
"on_failure": "raise IntakeParseError with raw_output attached"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": 2,
|
|
31
|
+
"name": "sections",
|
|
32
|
+
"input": "IntakeResult",
|
|
33
|
+
"output_type": "SectionsResult",
|
|
34
|
+
"prompt_file": "ucgen/prompts/stage2_sections.md",
|
|
35
|
+
"llm_required": true,
|
|
36
|
+
"retry": {"max": 1, "temperature": 0.1},
|
|
37
|
+
"on_failure": "raise SectionsParseError"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": 3,
|
|
41
|
+
"name": "entities",
|
|
42
|
+
"input": "IntakeResult + SectionsResult",
|
|
43
|
+
"output_type": "EntitiesResult",
|
|
44
|
+
"prompt_file": "ucgen/prompts/stage3_entities.md",
|
|
45
|
+
"llm_required": true,
|
|
46
|
+
"retry": {"max": 1, "temperature": 0.1},
|
|
47
|
+
"on_failure": "fallback to minimal entities from IntakeResult.related_entities — log WARNING, do not raise"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": 4,
|
|
51
|
+
"name": "assemble",
|
|
52
|
+
"input": "IntakeResult + SectionsResult + EntitiesResult + Config",
|
|
53
|
+
"output_type": "UseCaseDocument",
|
|
54
|
+
"prompt_file": null,
|
|
55
|
+
"llm_required": false,
|
|
56
|
+
"on_failure": "raise AssemblerError — should never happen with valid inputs"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
|
|
60
|
+
"module_map": {
|
|
61
|
+
"ucgen/__init__.py": "Package version export only. __version__ = '0.1.0'",
|
|
62
|
+
"ucgen/cli.py": "Typer CLI. All commands. Zero business logic — delegates entirely.",
|
|
63
|
+
"ucgen/generator.py": "Orchestrates 4-stage pipeline. Only module that calls providers.",
|
|
64
|
+
"ucgen/assembler.py": "Pure Python Jinja2 renderer. No LLM. Takes all stage results, returns markdown string.",
|
|
65
|
+
"ucgen/schema.py": "All Pydantic v2 models. Single source of truth for data shapes.",
|
|
66
|
+
"ucgen/config.py": "Loads .ucgenrc.toml project then home. Returns typed Config object.",
|
|
67
|
+
"ucgen/project_runner.py": "Reads ucgen.yaml, orchestrates multi-use-case runs. Tier 2 feature.",
|
|
68
|
+
"ucgen/validator.py": "Validates existing .md use case files against ucgen schema.",
|
|
69
|
+
"ucgen/exporter.py": "Converts UseCaseDocument to JSON or YAML string.",
|
|
70
|
+
"ucgen/errors.py": "All custom exception classes. Single file.",
|
|
71
|
+
"ucgen/providers/__init__.py": "Exports ProviderFactory only.",
|
|
72
|
+
"ucgen/providers/base.py": "Abstract BaseProvider + GenerationResult dataclass.",
|
|
73
|
+
"ucgen/providers/ollama.py": "OllamaProvider — async httpx to local Ollama REST API.",
|
|
74
|
+
"ucgen/providers/anthropic_provider.py": "AnthropicProvider — official anthropic SDK via asyncio.to_thread.",
|
|
75
|
+
"ucgen/providers/openai_provider.py": "OpenAICompatibleProvider — openai AsyncClient. Covers OpenAI, Groq, Together, LM Studio.",
|
|
76
|
+
"ucgen/providers/factory.py": "ProviderFactory.create(config) -> BaseProvider.",
|
|
77
|
+
"ucgen/utils/json_extract.py": "extract_json(raw) — robustly extracts JSON from LLM output with commentary.",
|
|
78
|
+
"ucgen/utils/id_counter.py": "next_id(output_dir) — reads/increments .ucgen_counter file.",
|
|
79
|
+
"ucgen/utils/table_formatter.py": "format_table(raw) — normalizes markdown table column widths.",
|
|
80
|
+
"ucgen/utils/prompt_loader.py": "load_prompt(name) — loads and caches prompt .md files.",
|
|
81
|
+
"ucgen/prompts/system_base.md": "Shared persona injected into every stage system prompt.",
|
|
82
|
+
"ucgen/prompts/stage1_intake.md": "Stage 1 prompt content.",
|
|
83
|
+
"ucgen/prompts/stage2_sections.md": "Stage 2 prompt content.",
|
|
84
|
+
"ucgen/prompts/stage3_entities.md": "Stage 3 prompt content.",
|
|
85
|
+
"ucgen/templates/default.md.j2": "Standard full use case template.",
|
|
86
|
+
"ucgen/templates/minimal.md.j2": "Quick capture template.",
|
|
87
|
+
"ucgen/templates/api.md.j2": "API-focused use case template.",
|
|
88
|
+
"ucgen/templates/cockburn-full.md.j2": "Full Cockburn format with all fields.",
|
|
89
|
+
"ucgen/templates/enterprise.md.j2": "Enterprise format with NFRs, scale hints, state machine."
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
"provider_quality_tiers": [
|
|
93
|
+
{"provider": "ollama", "models": ["mistral", "qwen2.5:14b"], "quality": "Good", "cost": "Free", "recommended_for": "Tier 1 offline"},
|
|
94
|
+
{"provider": "groq", "models": ["llama-3.3-70b-versatile"], "quality": "Excellent", "cost": "Free tier generous", "recommended_for": "Tier 1/2 free cloud"},
|
|
95
|
+
{"provider": "anthropic", "models": ["claude-sonnet-4-6", "claude-haiku-4-5-20251001"], "quality": "Best consistency", "cost": "~$0.003/doc", "recommended_for": "Tier 2/3 production"},
|
|
96
|
+
{"provider": "openai", "models": ["gpt-4o-mini", "gpt-4o"], "quality": "Excellent", "cost": "~$0.001/doc", "recommended_for": "Tier 2/3 production"}
|
|
97
|
+
]
|
|
98
|
+
}
|
ucgen-0.1.0/ideas-10.txt
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
customer pays for order at checkout using saved card
|
|
2
|
+
warehouse picker receives batch orders on handheld device and scans items
|
|
3
|
+
AI agent monitors competitor websites every 6 hours and alerts sales team via Slack when price drops exceed 10 percent
|
|
4
|
+
Danish farmer submits EU crop rotation subsidy claim with field maps and crop types
|
|
5
|
+
startup founder upgrades team from free plan to Pro and system processes prorated Stripe payment
|
|
6
|
+
property buyer makes offer on listing and system tracks counter-offers with version history
|
|
7
|
+
patient with chronic condition books follow-up with specialist after insurance verification
|
|
8
|
+
driver picks up parcel from warehouse and marks items as collected on mobile device
|
|
9
|
+
user invites new team member to workspace and system sends onboarding email with role permissions
|
|
10
|
+
system sends automated low stock alert to procurement team when inventory drops below threshold
|