feat: externalize apps/analysis to Gitea repos, add analysis table
- Migration 007: repo_url on apps table + analysis table with FTS5 - Analysis struct, parser, CRUD, validation, hash computation - Selective purge: remote-only apps/analysis preserved across fn index - CLI: fn app list/clone/pull, fn analysis list/clone/pull - search/show/list now include analysis results - Apps removed from git tracking (content lives in Gitea repos) - .gitkeep for apps/ and analysis/ dirs - Bash functions: jupyter analysis pipeline, shell utilities - Browser domain: CDP functions moved from infra to browser Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
---
|
||||
name: cdp_connect
|
||||
kind: function
|
||||
lang: go
|
||||
domain: browser
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func CdpConnect(port int) (*CDPConn, error)"
|
||||
description: "Se conecta al endpoint CDP en localhost:{port}. Obtiene el webSocketDebuggerUrl via HTTP /json/version, realiza el handshake WebSocket RFC 6455 sobre TCP puro (sin dependencias externas) y retorna una CDPConn lista para usar. Inicia goroutine de lectura de mensajes."
|
||||
tags: [chrome, cdp, browser, automation, websocket, devtools]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: [fmt, net, net/url, strings]
|
||||
tested: true
|
||||
tests: ["TestChromeLaunchAndConnect"]
|
||||
test_file_path: "functions/infra/chrome_launch_test.go"
|
||||
file_path: "functions/infra/cdp_connect.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
conn, err := CdpConnect(9222)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer CdpClose(conn, 0)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
El WebSocket se implementa desde cero usando `net.Dial` + handshake HTTP Upgrade + framing RFC 6455. Esto evita dependencias externas. Solo soporta frames no fragmentados (suficiente para CDP que envia mensajes completos).
|
||||
|
||||
El struct `CDPConn` y toda la infraestructura WebSocket/CDP se define en `cdp_conn.go` dentro del mismo paquete `infra`.
|
||||
|
||||
La goroutine `readLoop` enruta respuestas a channels por ID de mensaje. Los eventos CDP sin ID son ignorados (las funciones que necesitan eventos usan polling).
|
||||
Reference in New Issue
Block a user