Skip to content

v1.0.214

Choose a tag to compare

@github-actions github-actions released this 26 May 03:32
· 65 commits to main since this release

✨ New: Four CodeGraph analytics endpoints + cock affected CLI

/cg mode gains a second tier of endpoints — alongside the original six (search / callers / callees / impact / file / coedit), the project graph now exposes ranked, signal-annotated outputs designed for both LLM analysis and CI pipelines:

  • /api/projectGraph/context — multi-source semantic retrieval. Combine query, cursor, and openFiles; get back the Top-K relevant coordinates ranked by PPR + TF-IDF + PageRank with explainable signals[] (query-match / ppr / pagerank / open). Useful when you don't know the symbol name yet, only the intent.
  • /api/projectGraph/related — broader than callers/callees. Each result carries a relations[] tag explaining why it surfaced: direct caller / callee, PPR neighbour, frequent-coedit partner, or sibling-in-community (Louvain). One call replaces the three you used to make.
  • /api/projectGraph/risk — risk-scored impact. Wraps /impact and overlays callFreq + coeditProb + hasTest + pagerank per node, with adaptive weights when coedit is unavailable. Returns highRisk (sorted, capped) + suggestedTests + an echo of the target's coedit history so callers don't re-fetch.
  • /api/projectGraph/affected — file-level reverse-import closure. Sister to /risk: pass a SET of changed files (git diff --name-only), get back the test files transitively affected. Recall-oriented (catch every relevant test) where /risk is precision-oriented (highlight the few that matter most).

Cursor tolerance got real: cursor accepts <file>::<qname>, <file>.<qname> (.::), bare qname (global lookup), case-insensitive fallback, and <file>:<line> with ±5 line fuzzing. Misses come back with a cursorResolution block listing suggestions, so the LLM can retry instead of silently dropping the strongest seed.

Degraded responses always return 200 + degradedReason, never 5xx — coedit-unavailable for squash-style projects (coedit now auto-falls back to merge-granularity), analytics-warming while the index precomputes in the background.

cock affected — for selective test runs

# Inside your project:
git diff --name-only main | cock affected --stdin              # newline-separated test paths
git diff --name-only      | cock affected --stdin --as-jest    # → `jest "a.test.ts" "b.test.ts" …`
cock affected src/auth.ts --filter "**/*.e2e.ts"               # restrict to e2e
cock affected --stdin --json                                    # full byInput + stats

The CLI is a thin shim over /api/projectGraph/affected — it shares the live CodeIndex (no per-invocation parse), exits 1 when no tests are affected (so you can short-circuit in a Makefile), and 3 when Cockpit isn't running.

✨ New: cock terminal reshaped as a read-only log analyser

The terminal CLI used to dump the whole ring buffer on every read — fine for humans, a flood for AI agents trying to analyse a npm run dev log. It's now four self-describing subcommands:

cock terminal list                          # discover terminals
cock terminal <id>                          # status + full cheat sheet (entry point)
cock terminal <id> output [flags]           # read + filter + cursor
cock terminal <id> wait <mode> [flags]      # block until pattern / idle / exit / timeout

Server-side filtering — --grep, --since, --around, --tail, --head, --max-bytes — runs against the buffer; you only ship the bytes you actually want. A monotonic global line counter stays stable across ring-buffer churn and server restarts, so --since <lineno> keeps working even after the oldest lines have been evicted (the response tells you firstAvailable and truncated so you can detect the gap).

AI-friendly defaults: ANSI stripped and \r collapsed by default (turborepo's \r\r\n no longer empties every line). Pass --keep-ansi / --keep-cr when you want raw bytes.

The write-side intentionally goes away: no more stdin / kill / signal / follow. If you need to spawn a process, that's the Bash tool's job. If you need to drive an interactive REPL, use the web UI. The CLI is purely for observing running processes.

End-to-end example used during development:

cock terminal list                                  # find the make admin id
cock terminal <id> output --grep '"level":"error"'  # 3 lines, global line numbers
cock terminal <id> output --around 4127 --context 10  # context around the first DrizzleQueryError
cock terminal <id> wait idle --timeout 30s          # block until quiet

📚 Docs: /cg slash command extended

The /cg exploration mode prompt now teaches the four new endpoints in the same voice as the original six — including the relations / signals / tags vocabulary, the ambiguousIn disambiguation hint, the coedit echo on risk / related, and the difference between risk (analysis, precision) and affected (CI, recall). Both Chinese and English bodies updated.

📦 Misc

Two new runtime dependencies — graphology and graphology-communities-louvain — pull in Louvain community detection for the sibling-in-community relation. Both are pure JS, no native bindings, no model files; the analytics layer remains zero-training, zero-network.