feat: init_jupyter_analysis v1.1.0 — soporte --project, --desc, --tags

Nueva funcion write_analysis_md_bash_infra genera analysis.md con frontmatter.
El pipeline ahora acepta --project para crear analisis directamente en
projects/{proyecto}/analysis/{nombre}/, valida que el proyecto exista,
genera analysis.md con dir_path correcto y ejecuta fn index al final.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-17 15:39:20 +02:00
parent 69b626a426
commit 814262130d
7 changed files with 252 additions and 52 deletions
+9 -5
View File
@@ -36,12 +36,16 @@ def _resolve_collab_username(server_url: str, token: str) -> str:
def _notebook_exists(notebook_path: str, server_url: str, token: str) -> bool:
"""Comprueba si un notebook existe en el servidor Jupyter via HEAD /api/contents."""
"""Comprueba si un notebook existe en el servidor Jupyter via GET /api/contents.
Usa GET con ?content=0 (metadata only). HEAD no es soportado universalmente
(Jupyter 4.x devuelve 405 Method Not Allowed en /api/contents/{path}).
"""
headers = {"Accept": "application/json"}
if token:
headers["Authorization"] = f"token {token}"
check_url = f"{server_url}/api/contents/{notebook_path}"
req = Request(check_url, headers=headers, method="HEAD")
check_url = f"{server_url}/api/contents/{notebook_path}?content=0"
req = Request(check_url, headers=headers, method="GET")
try:
with urlopen(req, timeout=5):
return True
@@ -340,9 +344,9 @@ def jupyter_create_notebook(
if token:
headers["Authorization"] = f"token {token}"
# Verificar si ya existe (HEAD request)
# Verificar si ya existe (GET con content=0; HEAD no esta soportado en Jupyter 4.x)
check_url = f"{server_url}/api/contents/{notebook_path}"
check_req = Request(check_url, headers=headers, method="HEAD")
check_req = Request(f"{check_url}?content=0", headers=headers, method="GET")
already_exists = False
try:
with urlopen(check_req, timeout=5):