Split token scan and compare commands

This commit is contained in:
mpabi
2026-04-27 20:23:04 +02:00
parent 2ab1a428e7
commit 147468c48d
4 changed files with 135 additions and 24 deletions
+23 -12
View File
@@ -13,7 +13,7 @@ W praktyce oznacza to:
- `r1` w repo `rv-launcher` jest miejscem startowym do pobrania tokena z remote
- `tokens.json` jest lokalnym store sekretow i metadanych tokenow
- karty pracy dostaja remote na podstawie ustawien launchera i komend typu `submission`
- `tokens scan` jest read-only i niczego nie zapisuje
- `tokens scan` i `tokens compare` sa read-only i niczego nie zapisuja
## Zrodlo Prawdy
@@ -109,7 +109,7 @@ Pola pobierane z API przez `tokens update r1`:
## Porownanie
`tokens scan` porownuje git remote i `tokens.json` po:
`tokens compare` porownuje git remote i `tokens.json` po:
```text
server.endpoint + id + user + value + org + repo
@@ -189,9 +189,10 @@ W repo `rv-launcher`:
```bash
git remote add r1 http://u1:TOKEN@77.90.8.171:3001/edu-tools/rv-launcher.git
./rvctl tokens scan
./rvctl tokens compare
./rvctl tokens sync remote r1
./rvctl tokens update r1
./rvctl tokens scan
./rvctl tokens compare
```
Po `sync remote` sekret jest w `tokens.json`. Po `update` `rvctl` dopisuje
@@ -205,37 +206,47 @@ Jesli chcesz tylko zobaczyc jedno zrodlo, bez porownywania:
./rvctl tokens list both
```
Jesli remote ma byc bez sekretu, a token ma zostac tylko w `tokens.json`:
Jesli token ma zostac tylko w `tokens.json`, usun git remote:
```bash
./rvctl tokens remove remote r1
git remote add r1 http://77.90.8.171:3001/edu-tools/rv-launcher.git
```
Jesli trzeba ponownie wpisac sekret ze store do remota:
Jesli trzeba ponownie utworzyc remote z sekretem ze store:
```bash
./rvctl tokens sync store r1
./rvctl tokens sync store r1 --url http://77.90.8.171:3001/edu-tools/rv-launcher.git
```
## Komendy
### `tokens scan`
Read-only. Czyta git remote i `tokens.json`, laczy wpisy w pary i wypisuje
tabele `tokens`. Nie tworzy i nie modyfikuje `tokens.json`. Bez `--repo`
czyta repo zawierajace `rvctl`.
Read-only. Czyta git remotes i wypisuje diagnostyczna tabele URL-i:
`auth`, `plain` i `unsupported`. Nie porownuje ich z `tokens.json`. Bez
`--repo` czyta repo zawierajace `rvctl`.
```bash
./rvctl tokens scan
./rvctl tokens scan --repo ~/dev/workspace/rv/tools/rv-launcher
```
### `tokens compare`
Read-only. Czyta git remote i `tokens.json`, laczy wpisy w pary i wypisuje
tabele `tokens`. Nie tworzy i nie modyfikuje `tokens.json`. Bez `--repo`
czyta repo zawierajace `rvctl`.
```bash
./rvctl tokens compare
./rvctl tokens compare --repo ~/dev/workspace/rv/tools/rv-launcher
```
### `tokens list store|remote|both`
Read-only. Wypisuje jedno zrodlo bez porownywania go z drugim. To odroznia
`list` od `scan`: `list` odpowiada na pytanie "co jest zapisane tutaj", a
`scan` odpowiada na pytanie "czy store i remote sa zgodne".
`list` od `compare`: `list` odpowiada na pytanie "co jest zapisane tutaj", a
`compare` odpowiada na pytanie "czy store i remote sa zgodne".
```bash
./rvctl tokens list store