02eed13913
Sincronizan el repo principal y todos los sub-repos git anidados (apps
externalizadas, projects con repo propio) y luego ejecutan fn sync para
sincronizar metadata no regenerable contra registry_api.
Credenciales para fn sync vienen de pass (registry/{api-token,
basicauth-user,basicauth-pass}).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
81 lines
2.9 KiB
Markdown
81 lines
2.9 KiB
Markdown
# /full-git-push — Push de fn_registry + todos los sub-repos + fn sync
|
|
|
|
Pushea el repo principal `fn_registry` y todos los sub-repos git anidados (apps externalizadas como `registry_dashboard`, projects con repo propio, etc.), y luego ejecuta `fn sync` para empujar la metadata no regenerable (proposals, apps, projects, analysis, vaults, pc_locations) al `registry_api`.
|
|
|
|
## Argumento
|
|
|
|
`$ARGUMENTS` — opcional. Si se pasa texto, se usa como mensaje de commit por defecto cuando algún repo tenga cambios sin commitear y el usuario apruebe commitear durante el flujo. Sin argumento, se pregunta el mensaje al detectar dirty tree.
|
|
|
|
## Pasos
|
|
|
|
### 1. Descubrir repos git en el workspace
|
|
|
|
```bash
|
|
cd /home/egutierrez/fn_registry
|
|
REPOS=$(find . -name ".git" -type d \
|
|
-not -path "./.git/*" \
|
|
-not -path "*/node_modules/*" \
|
|
-not -path "*/.venv/*" \
|
|
-not -path "*/cpp/vendor/*" \
|
|
-not -path "*/cpp/build/*" \
|
|
-not -path "*/sources/*" \
|
|
-not -path "*/temp/*" 2>/dev/null | sed 's|/.git$||')
|
|
# Añadir la raíz al principio
|
|
REPOS=". $REPOS"
|
|
```
|
|
|
|
### 2. Para cada repo, mostrar estado
|
|
|
|
```bash
|
|
for r in $REPOS; do
|
|
echo "=== $r ==="
|
|
( cd "$r" && git status -sb && echo "" )
|
|
done
|
|
```
|
|
|
|
### 3. Manejar dirty trees
|
|
|
|
- Si **algún repo** tiene cambios sin commitear: lista los archivos al usuario y **pregunta** qué hacer:
|
|
- (a) commitear todo con un mensaje (usar `$ARGUMENTS` si está, si no preguntar)
|
|
- (b) stashear y seguir solo con los commits ahead
|
|
- (c) abortar
|
|
- Nunca commitear sin permiso explícito.
|
|
|
|
### 4. Push de cada repo
|
|
|
|
```bash
|
|
for r in $REPOS; do
|
|
( cd "$r" \
|
|
&& BRANCH=$(git rev-parse --abbrev-ref HEAD) \
|
|
&& if git rev-parse --abbrev-ref --symbolic-full-name @{u} >/dev/null 2>&1; then
|
|
git push origin "$BRANCH" 2>&1 | tail -3
|
|
else
|
|
echo "[$r] no upstream para '$BRANCH' — saltado"
|
|
fi
|
|
)
|
|
done
|
|
```
|
|
|
|
### 5. fn sync con credenciales de pass
|
|
|
|
```bash
|
|
USER=$(pass registry/basicauth-user | head -1)
|
|
PASSWD=$(pass registry/basicauth-pass | head -1)
|
|
TOKEN=$(pass registry/api-token | head -1)
|
|
export FN_REGISTRY_API="https://${USER}:${PASSWD}@registry.organic-machine.com"
|
|
export REGISTRY_API_TOKEN="$TOKEN"
|
|
./fn sync
|
|
```
|
|
|
|
Si `pass` falla con "decryption failed" → gpg-agent locked. Pedir al usuario que ejecute `pass show registry/api-token` en su terminal real (Bash tool no tiene TTY) y reintentar.
|
|
|
|
### 6. Resumen
|
|
|
|
Imprimir tabla concisa: para cada repo, branch, commits pusheados o "ya estaba al día". Y resultado de `fn sync` (sent / received / imported).
|
|
|
|
## Notas
|
|
|
|
- Es responsabilidad del comando **pushear**, no decidir qué commitear. Solo commitea si el usuario lo aprueba explícitamente.
|
|
- Los submodules del directorio `cpp/vendor/` (imgui, implot, glfw, tracy, implot3d) se ignoran (son mirrors upstream, no se pushean desde aquí).
|
|
- Si una rama va `behind` el remote, abortar el push de ese repo y avisar para correr `/full-git-pull` primero.
|