Skip to content

Commit 706b3df

Browse files
Copilotchefgs
andcommitted
fix: proper process-first CLI invocation instructions and input validation
Co-authored-by: chefgs <7605658+chefgs@users.noreply.github.com>
1 parent 90c61c3 commit 706b3df

3 files changed

Lines changed: 72 additions & 13 deletions

File tree

README.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,28 @@ source .venv/bin/activate # macOS / Linux
9191
pip install -r cli/requirements.txt
9292
```
9393

94-
### 2 — Generate a GitHub Actions workflow
94+
### 2 — Learn the Process-First philosophy *(recommended first step)*
95+
96+
DevOps-OS is built on the **Process-First** SDLC philosophy from [cloudenginelabs.io](https://cloudenginelabs.io). Run the `process-first` command to understand *why* each tool exists before you start using it:
97+
98+
```bash
99+
# Full overview — what Process-First is, how it maps to DevOps-OS, and learning tips
100+
python -m cli.devopsos process-first
101+
102+
# Just the 5 core principles
103+
python -m cli.devopsos process-first --section what
104+
105+
# Table: which scaffold command encodes which principle
106+
python -m cli.devopsos process-first --section mapping
107+
108+
# AI prompts and book recommendations for beginners
109+
python -m cli.devopsos process-first --section tips
110+
```
111+
112+
> **Tip:** Run `--section mapping` to see exactly which `devopsos scaffold` command to use for each DevOps goal before generating any config.
113+
> See [docs/PROCESS-FIRST.md](docs/PROCESS-FIRST.md) for the full reference.
114+
115+
### 3 — Generate a GitHub Actions workflow
95116

96117
```bash
97118
# Complete CI/CD for a Python + JavaScript project
@@ -101,7 +122,7 @@ python -m cli.scaffold_gha --name my-app --languages python,javascript --type co
101122
python -m cli.scaffold_gha --name my-app --languages python --kubernetes --k8s-method kustomize
102123
```
103124

104-
### 3 — Generate other pipelines & configs
125+
### 4 — Generate other pipelines & configs
105126

106127
```bash
107128
# Jenkins pipeline → Jenkinsfile
@@ -128,7 +149,7 @@ python kubernetes/k8s-config-generator.py --name my-app --image ghcr.io/myorg/my
128149

129150
> See [CLI Commands Reference](docs/CLI-COMMANDS-REFERENCE.md) for the full option tables and every default output path.
130151
131-
### 4 — Interactive wizard (all-in-one)
152+
### 5 — Interactive wizard (all-in-one)
132153

133154
```bash
134155
python -m cli.devopsos init # interactive project configurator
@@ -138,15 +159,9 @@ python -m cli.devopsos scaffold jenkins # scaffold Jenkins
138159
python -m cli.devopsos scaffold argocd # scaffold ArgoCD / Flux
139160
python -m cli.devopsos scaffold sre # scaffold SRE configs
140161
python -m cli.devopsos scaffold devcontainer # scaffold dev container config
141-
142-
# Learn the Process-First philosophy and how it maps to DevOps-OS tooling
143-
python -m cli.devopsos process-first # full overview
144-
python -m cli.devopsos process-first --section what # ideology & core principles
145-
python -m cli.devopsos process-first --section mapping # principle → tool mapping
146-
python -m cli.devopsos process-first --section tips # AI prompts for beginners
147162
```
148163

149-
### 5 — Use with AI (MCP Server)
164+
### 6 — Use with AI (MCP Server)
150165

151166
```bash
152167
pip install -r mcp_server/requirements.txt

cli/devopsos.py

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import enum
12
import typer
23
from InquirerPy import inquirer
34
import json
@@ -14,6 +15,14 @@
1415
import cli.scaffold_devcontainer as scaffold_devcontainer
1516
import cli.process_first as process_first
1617

18+
class ProcessFirstSection(str, enum.Enum):
19+
"""Valid sections for the process-first command."""
20+
what = "what"
21+
mapping = "mapping"
22+
tips = "tips"
23+
all = "all"
24+
25+
1726
app = typer.Typer(help="Unified DevOps-OS CLI tool")
1827

1928
@app.command()
@@ -154,10 +163,34 @@ def scaffold(
154163

155164
@app.command("process-first")
156165
def process_first_cmd(
157-
section: str = typer.Option("all", help="Section to display: what | mapping | tips | all"),
166+
section: ProcessFirstSection = typer.Option(
167+
ProcessFirstSection.all,
168+
help=(
169+
"Section to display:\n\n"
170+
" 'what' — What Process-First is and its 5 core principles\n\n"
171+
" 'mapping' — How each principle maps to a devopsos scaffold command\n\n"
172+
" 'tips' — AI prompts and book recommendations for DevOps beginners\n\n"
173+
" 'all' — All sections combined (default)"
174+
),
175+
show_choices=True,
176+
),
158177
):
159-
"""Learn about the Process-First SDLC philosophy and how it maps to DevOps-OS tooling."""
160-
process_first.display(section)
178+
"""Learn about the Process-First SDLC philosophy and how it maps to DevOps-OS tooling.
179+
180+
\b
181+
Quick invocation guide:
182+
183+
python -m cli.devopsos process-first # full overview
184+
python -m cli.devopsos process-first --section what # core principles
185+
python -m cli.devopsos process-first --section mapping # tool mapping table
186+
python -m cli.devopsos process-first --section tips # AI prompts for beginners
187+
188+
You can also run the module directly:
189+
190+
python -m cli.process_first
191+
python -m cli.process_first --section mapping
192+
"""
193+
process_first.display(section.value)
161194

162195

163196
if __name__ == "__main__":

cli/test_cli.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,14 @@ def test_process_first_module_section_mapping():
358358
assert result.returncode == 0
359359
assert "scaffold" in result.stdout.lower()
360360

361+
362+
def test_process_first_invalid_section_clean_error():
363+
"""Invalid --section value gives a clean CLI error, not a Python traceback."""
364+
result = _run(["-m", "cli.devopsos", "process-first", "--section", "invalid"])
365+
assert result.returncode != 0
366+
combined = result.stdout + result.stderr
367+
# Typer enum validation produces: "Invalid value for '--section': 'invalid' is not one of ..."
368+
assert "Traceback" not in combined, "Expected clean CLI error, not a Python traceback"
369+
assert "ValueError" not in combined, "Expected clean CLI error, not a ValueError"
370+
assert "is not one of" in combined or "Invalid value" in combined
371+

0 commit comments

Comments
 (0)