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
+34 -4
View File
@@ -206,6 +206,7 @@ Komendy:
- `list-series`
- `list-cards [series]`
- `tokens scan`
- `tokens compare`
- `tokens read`
- `tokens stats`
- `tokens write`
@@ -292,6 +293,35 @@ Przyklady:
## `tokens scan`
Czyta remote URL-e w repo i pokazuje diagnostyczna tabele git remotes:
`auth`, `plain` i `unsupported`. Nie porownuje ich z `tokens.json`. Komenda
jest read-only.
Przelaczniki:
- `--repo PATH`
Sciezka wewnatrz docelowego repo. Domyslnie repo zawierajace `rvctl`.
- `--server ENDPOINT`
Pokazuje tylko wpisy z danego endpointu.
Typowy wynik:
```text
remotes
item remote kind server proto host org repo user token result url
---- ------ ----------- ------ ----- ------------------ --------- ----------- ---- ------------ -------------- --------------------------------------
1 r1 auth gitea http 77.90.8.171:3001 edu-tools rv-launcher u1 e59cc...13be found http://77.90.8.171:3001/edu-tools/...
```
Przyklad:
```bash
./rvctl tokens scan
./rvctl tokens scan --repo ~/dev/workspace/rv/series/inf/03
```
## `tokens compare`
Czyta remote URL-e w repo oraz lokalny `tokens.json`, laczy wpisy w pary po
endpoincie, nazwie remota, token id, wartosci tokena, org i repo, a potem
pokazuje jeden logiczny wiersz na token. Komenda jest read-only.
@@ -307,7 +337,7 @@ Typowy wynik:
tokens
item server proto host org repo user remote token_ref token valid scope org repo
---- ------ ----- ------------------ --------- ----------- ---- ------ --------- ------------ ------------------- aAimnopru oawrc- oawr--
1 gitea http 77.90.8.171:3001 edu-tools rv-launcher u1 r1 r1 * e59cc...13be forever -----w--- +++++ ++++
1 gitea http 77.90.8.171:3001 edu-tools rv-launcher u1 r1 r1 * e59cc...13be forever wwwwwwwww +++++ ++++
```
`token_ref` jest komorka stalej szerokosci: nazwa tokena jest po lewej, a marker
@@ -327,15 +357,15 @@ Maski uprawnien:
Przyklad:
```bash
./rvctl tokens scan
./rvctl tokens scan --repo ~/dev/workspace/rv/series/inf/03
./rvctl tokens compare
./rvctl tokens compare --repo ~/dev/workspace/rv/series/inf/03
```
## `tokens list store|remote|both`
Wypisuje jedno zrodlo bez porownywania go z drugim. `list` jest read-only:
pokazuje co jest w `tokens.json`, co jest w git remote albo oba zrodla jako
osobne wiersze. `scan` sluzy do porownania zgodnosci.
osobne wiersze. `compare` sluzy do porownania zgodnosci.
Przelaczniki:
+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