Skip to content

Commit cb3f8cd

Browse files
docs(readme): update usage block; add docs/USAGE.md and MANUAL.md + links (#24)
* docs(readme): update usage block; add docs/USAGE.md and MANUAL.md + links * docs: trigger CI
1 parent a7c817e commit cb3f8cd

File tree

5 files changed

+125
-18
lines changed

5 files changed

+125
-18
lines changed

README.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# ⭐ diff-risk-dashboard — APV → Risk Summary (Python CLI)
22

3+
4+
[![Manual](https://img.shields.io/badge/Manual-User%20Guide-blue?style=for-the-badge)](docs/MANUAL.md)
35
A lean, production-grade **Python CLI** that ingests **ai-patch-verifier (APV)** JSON and outputs a clear **risk summary** (table / JSON / Markdown).
46
Designed for **always-green CI**, with strict checks and exit codes per risk level to gate merges professionally.
57

@@ -37,35 +39,41 @@ Designed for **always-green CI**, with strict checks and exit codes per risk lev
3739

3840
<!-- diff-risk:usage:start -->
3941

40-
## 🚀 Usage (short aliases)
42+
## 🚀 Usage
43+
44+
### Short commands
45+
- `drt <apv.json | raw-json>` – color table (TTY)
46+
- `drb <apv.json | raw-json>` – text bars (logs)
47+
- `drj <apv.json | raw-json>` – JSON (CI)
48+
- `drmd <apv.json | raw-json>` – Markdown (stdout)
4149

42-
### CLI (recommended colorful table)
4350
```bash
44-
# green panel (empty sample)
45-
./bin/drt examples/sample_apv.empty.json
51+
# Demo (bundled sample)
52+
drt examples/sample_apv.json
4653

47-
# real example with findings
48-
./bin/drt examples/sample_apv.json
49-
```
54+
# Inline JSON (single quotes outside, double inside)
55+
drt '{"by_severity":{"CRITICAL":0,"HIGH":1,"MEDIUM":1,"LOW":1,"INFO":0}}'
5056

51-
Other formats:
52-
```bash
53-
./bin/drb examples/sample_apv.json # text bars
54-
./bin/drj examples/sample_apv.json # JSON (CI/machines)
55-
./bin/drmd examples/sample_apv.json _intel/report.md # Markdown file
56-
```
57+
# Your real file
58+
APV="/absolute/path/to/your_apv.json"; drt "$APV"
5759

58-
Tip: to call aliases without `./bin/` temporarily:
59-
```bash
60-
export PATH="$PWD/bin:$PATH"
61-
drt examples/sample_apv.json
60+
# Other formats with the same input
61+
drb "$APV" # bars (logs)
62+
drj "$APV" # JSON (CI)
63+
drmd "$APV" > report.md # Markdown to file
64+
65+
# Force colors for recordings
66+
script -qfc "drt $APV" /dev/null
6267
```
6368

64-
**Exit codes**: `0=green`, `1=yellow`, `2=red` (`--no-exit-by-risk` forces `0` for demos).
69+
> Exit codes: wrappers return `0` thanks to `--no-exit-by-risk`.
70+
> CLI raw (without wrappers) sets exit code by risk unless you add `--no-exit-by-risk`.
6571
6672
<!-- diff-risk:usage:end -->
6773

6874

75+
76+
6977
> Sin cambios en tu sistema ni shell. Usa el proyecto como **app Python** con su comando **`diff-risk`** tras instalarlo.
7078
7179
```bash

README_USAGE_BLOCK.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!-- diff-risk:usage:start -->
2+
3+
## 🚀 Usage
4+
5+
### Short commands
6+
- `drt <apv.json | raw-json>` – color table (TTY)
7+
- `drb <apv.json | raw-json>` – text bars (logs)
8+
- `drj <apv.json | raw-json>` – JSON (CI)
9+
- `drmd <apv.json | raw-json>` – Markdown (stdout)
10+
11+
```bash
12+
# Demo (bundled sample)
13+
drt examples/sample_apv.json
14+
15+
# Inline JSON (single quotes outside, double inside)
16+
drt '{"by_severity":{"CRITICAL":0,"HIGH":1,"MEDIUM":1,"LOW":1,"INFO":0}}'
17+
18+
# Your real file
19+
APV="/absolute/path/to/your_apv.json"; drt "$APV"
20+
21+
# Other formats with the same input
22+
drb "$APV" # bars (logs)
23+
drj "$APV" # JSON (CI)
24+
drmd "$APV" > report.md # Markdown to file
25+
26+
# Force colors for recordings
27+
script -qfc "drt $APV" /dev/null
28+
```
29+
30+
> Exit codes: wrappers return `0` thanks to `--no-exit-by-risk`.
31+
> CLI raw (without wrappers) sets exit code by risk unless you add `--no-exit-by-risk`.
32+
33+
<!-- diff-risk:usage:end -->

docs/MANUAL.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Diff Risk Dashboard — Manual
2+
3+
This manual complements **docs/USAGE.md** with project context.
4+
- Quick usage & CLI examples: see **docs/USAGE.md**.
5+
- Short wrappers: drt/drb/drj/drmd (file or inline JSON).
6+
- Exit codes: 0 (green), 1 (yellow), 2 (red). Use `--no-exit-by-risk` to force 0.
7+
8+
More sections to expand:
9+
1) Installation & environment
10+
2) Input format (APV JSON)
11+
3) Output formats (table, bar, json, md)
12+
4) CI usage & exit codes
13+
5) Troubleshooting

docs/USAGE.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!-- diff-risk:usage:start -->
2+
3+
## 🚀 Usage
4+
5+
### Short commands
6+
- `drt <apv.json | raw-json>` – color table (TTY)
7+
- `drb <apv.json | raw-json>` – text bars (logs)
8+
- `drj <apv.json | raw-json>` – JSON (CI)
9+
- `drmd <apv.json | raw-json>` – Markdown (stdout)
10+
11+
```bash
12+
# Demo (bundled sample)
13+
drt examples/sample_apv.json
14+
15+
# Inline JSON (single quotes outside, double inside)
16+
drt '{"by_severity":{"CRITICAL":0,"HIGH":1,"MEDIUM":1,"LOW":1,"INFO":0}}'
17+
18+
# Your real file
19+
APV="/absolute/path/to/your_apv.json"; drt "$APV"
20+
21+
# Other formats with the same input
22+
drb "$APV" # bars (logs)
23+
drj "$APV" # JSON (CI)
24+
drmd "$APV" > report.md # Markdown to file
25+
26+
# Force colors for recordings
27+
script -qfc "drt $APV" /dev/null
28+
```
29+
30+
> Exit codes: wrappers return `0` thanks to `--no-exit-by-risk`.
31+
> CLI raw (without wrappers) sets exit code by risk unless you add `--no-exit-by-risk`.
32+
33+
<!-- diff-risk:usage:end -->

update_readme_usage.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
# Usage: ./update_readme_usage.sh [USAGE_BLOCK] [README]
3+
BLK="${1:-README_USAGE_BLOCK.md}"
4+
READ="${2:-README.md}"
5+
TMP="$READ.tmp"
6+
7+
# Replace existing block delimited by markers, or append if not present.
8+
if grep -q '<!-- diff-risk:usage:start -->' "$READ"; then
9+
awk -v F="$BLK" '
10+
BEGIN { while ((getline l < F) > 0) blk = blk l ORS; close(F) }
11+
/<!-- diff-risk:usage:start -->/ { print blk; inside=1; next }
12+
/<!-- diff-risk:usage:end -->/ { inside=0; next }
13+
!inside { print }
14+
' "$READ" > "$TMP" && mv "$TMP" "$READ"
15+
else
16+
printf '\n' >> "$READ"
17+
cat "$BLK" >> "$READ"
18+
fi
19+
20+
echo "README usage block updated ✅"

0 commit comments

Comments
 (0)