@colbymchenry/codegraph 0.8.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -7
- package/npm-shim.js +43 -0
- package/package.json +13 -51
- package/LICENSE +0 -21
- package/dist/bin/codegraph.d.ts +0 -21
- package/dist/bin/codegraph.d.ts.map +0 -1
- package/dist/bin/codegraph.js +0 -1257
- package/dist/bin/codegraph.js.map +0 -1
- package/dist/bin/node-version-check.d.ts +0 -20
- package/dist/bin/node-version-check.d.ts.map +0 -1
- package/dist/bin/node-version-check.js +0 -42
- package/dist/bin/node-version-check.js.map +0 -1
- package/dist/bin/uninstall.d.ts +0 -14
- package/dist/bin/uninstall.d.ts.map +0 -1
- package/dist/bin/uninstall.js +0 -36
- package/dist/bin/uninstall.js.map +0 -1
- package/dist/config.d.ts +0 -51
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -321
- package/dist/config.js.map +0 -1
- package/dist/context/formatter.d.ts +0 -30
- package/dist/context/formatter.d.ts.map +0 -1
- package/dist/context/formatter.js +0 -244
- package/dist/context/formatter.js.map +0 -1
- package/dist/context/index.d.ts +0 -97
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -1050
- package/dist/context/index.js.map +0 -1
- package/dist/db/index.d.ts +0 -72
- package/dist/db/index.d.ts.map +0 -1
- package/dist/db/index.js +0 -200
- package/dist/db/index.js.map +0 -1
- package/dist/db/migrations.d.ts +0 -44
- package/dist/db/migrations.d.ts.map +0 -1
- package/dist/db/migrations.js +0 -131
- package/dist/db/migrations.js.map +0 -1
- package/dist/db/queries.d.ts +0 -253
- package/dist/db/queries.d.ts.map +0 -1
- package/dist/db/queries.js +0 -1207
- package/dist/db/queries.js.map +0 -1
- package/dist/db/schema.sql +0 -151
- package/dist/db/sqlite-adapter.d.ts +0 -52
- package/dist/db/sqlite-adapter.d.ts.map +0 -1
- package/dist/db/sqlite-adapter.js +0 -237
- package/dist/db/sqlite-adapter.js.map +0 -1
- package/dist/directory.d.ts +0 -57
- package/dist/directory.d.ts.map +0 -1
- package/dist/directory.js +0 -264
- package/dist/directory.js.map +0 -1
- package/dist/errors.d.ts +0 -136
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -219
- package/dist/errors.js.map +0 -1
- package/dist/extraction/dfm-extractor.d.ts +0 -31
- package/dist/extraction/dfm-extractor.d.ts.map +0 -1
- package/dist/extraction/dfm-extractor.js +0 -151
- package/dist/extraction/dfm-extractor.js.map +0 -1
- package/dist/extraction/grammars.d.ts +0 -78
- package/dist/extraction/grammars.d.ts.map +0 -1
- package/dist/extraction/grammars.js +0 -322
- package/dist/extraction/grammars.js.map +0 -1
- package/dist/extraction/index.d.ts +0 -130
- package/dist/extraction/index.d.ts.map +0 -1
- package/dist/extraction/index.js +0 -1305
- package/dist/extraction/index.js.map +0 -1
- package/dist/extraction/languages/c-cpp.d.ts +0 -4
- package/dist/extraction/languages/c-cpp.d.ts.map +0 -1
- package/dist/extraction/languages/c-cpp.js +0 -126
- package/dist/extraction/languages/c-cpp.js.map +0 -1
- package/dist/extraction/languages/csharp.d.ts +0 -3
- package/dist/extraction/languages/csharp.d.ts.map +0 -1
- package/dist/extraction/languages/csharp.js +0 -72
- package/dist/extraction/languages/csharp.js.map +0 -1
- package/dist/extraction/languages/dart.d.ts +0 -3
- package/dist/extraction/languages/dart.d.ts.map +0 -1
- package/dist/extraction/languages/dart.js +0 -192
- package/dist/extraction/languages/dart.js.map +0 -1
- package/dist/extraction/languages/go.d.ts +0 -3
- package/dist/extraction/languages/go.d.ts.map +0 -1
- package/dist/extraction/languages/go.js +0 -58
- package/dist/extraction/languages/go.js.map +0 -1
- package/dist/extraction/languages/index.d.ts +0 -10
- package/dist/extraction/languages/index.d.ts.map +0 -1
- package/dist/extraction/languages/index.js +0 -45
- package/dist/extraction/languages/index.js.map +0 -1
- package/dist/extraction/languages/java.d.ts +0 -3
- package/dist/extraction/languages/java.d.ts.map +0 -1
- package/dist/extraction/languages/java.js +0 -64
- package/dist/extraction/languages/java.js.map +0 -1
- package/dist/extraction/languages/javascript.d.ts +0 -3
- package/dist/extraction/languages/javascript.d.ts.map +0 -1
- package/dist/extraction/languages/javascript.js +0 -90
- package/dist/extraction/languages/javascript.js.map +0 -1
- package/dist/extraction/languages/kotlin.d.ts +0 -3
- package/dist/extraction/languages/kotlin.d.ts.map +0 -1
- package/dist/extraction/languages/kotlin.js +0 -253
- package/dist/extraction/languages/kotlin.js.map +0 -1
- package/dist/extraction/languages/pascal.d.ts +0 -3
- package/dist/extraction/languages/pascal.d.ts.map +0 -1
- package/dist/extraction/languages/pascal.js +0 -66
- package/dist/extraction/languages/pascal.js.map +0 -1
- package/dist/extraction/languages/php.d.ts +0 -3
- package/dist/extraction/languages/php.d.ts.map +0 -1
- package/dist/extraction/languages/php.js +0 -107
- package/dist/extraction/languages/php.js.map +0 -1
- package/dist/extraction/languages/python.d.ts +0 -3
- package/dist/extraction/languages/python.d.ts.map +0 -1
- package/dist/extraction/languages/python.js +0 -56
- package/dist/extraction/languages/python.js.map +0 -1
- package/dist/extraction/languages/ruby.d.ts +0 -3
- package/dist/extraction/languages/ruby.d.ts.map +0 -1
- package/dist/extraction/languages/ruby.js +0 -114
- package/dist/extraction/languages/ruby.js.map +0 -1
- package/dist/extraction/languages/rust.d.ts +0 -3
- package/dist/extraction/languages/rust.d.ts.map +0 -1
- package/dist/extraction/languages/rust.js +0 -109
- package/dist/extraction/languages/rust.js.map +0 -1
- package/dist/extraction/languages/scala.d.ts +0 -3
- package/dist/extraction/languages/scala.d.ts.map +0 -1
- package/dist/extraction/languages/scala.js +0 -139
- package/dist/extraction/languages/scala.js.map +0 -1
- package/dist/extraction/languages/swift.d.ts +0 -3
- package/dist/extraction/languages/swift.d.ts.map +0 -1
- package/dist/extraction/languages/swift.js +0 -91
- package/dist/extraction/languages/swift.js.map +0 -1
- package/dist/extraction/languages/typescript.d.ts +0 -3
- package/dist/extraction/languages/typescript.d.ts.map +0 -1
- package/dist/extraction/languages/typescript.js +0 -129
- package/dist/extraction/languages/typescript.js.map +0 -1
- package/dist/extraction/liquid-extractor.d.ts +0 -52
- package/dist/extraction/liquid-extractor.d.ts.map +0 -1
- package/dist/extraction/liquid-extractor.js +0 -313
- package/dist/extraction/liquid-extractor.js.map +0 -1
- package/dist/extraction/parse-worker.d.ts +0 -8
- package/dist/extraction/parse-worker.d.ts.map +0 -1
- package/dist/extraction/parse-worker.js +0 -94
- package/dist/extraction/parse-worker.js.map +0 -1
- package/dist/extraction/svelte-extractor.d.ts +0 -56
- package/dist/extraction/svelte-extractor.d.ts.map +0 -1
- package/dist/extraction/svelte-extractor.js +0 -272
- package/dist/extraction/svelte-extractor.js.map +0 -1
- package/dist/extraction/tree-sitter-helpers.d.ts +0 -28
- package/dist/extraction/tree-sitter-helpers.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-helpers.js +0 -103
- package/dist/extraction/tree-sitter-helpers.js.map +0 -1
- package/dist/extraction/tree-sitter-types.d.ts +0 -179
- package/dist/extraction/tree-sitter-types.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-types.js +0 -10
- package/dist/extraction/tree-sitter-types.js.map +0 -1
- package/dist/extraction/tree-sitter.d.ts +0 -233
- package/dist/extraction/tree-sitter.d.ts.map +0 -1
- package/dist/extraction/tree-sitter.js +0 -2393
- package/dist/extraction/tree-sitter.js.map +0 -1
- package/dist/extraction/vue-extractor.d.ts +0 -36
- package/dist/extraction/vue-extractor.d.ts.map +0 -1
- package/dist/extraction/vue-extractor.js +0 -163
- package/dist/extraction/vue-extractor.js.map +0 -1
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/graph/index.d.ts +0 -8
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js +0 -13
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/queries.d.ts +0 -106
- package/dist/graph/queries.d.ts.map +0 -1
- package/dist/graph/queries.js +0 -366
- package/dist/graph/queries.js.map +0 -1
- package/dist/graph/traversal.d.ts +0 -127
- package/dist/graph/traversal.d.ts.map +0 -1
- package/dist/graph/traversal.js +0 -493
- package/dist/graph/traversal.js.map +0 -1
- package/dist/index.d.ts +0 -447
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -825
- package/dist/index.js.map +0 -1
- package/dist/installer/claude-md-template.d.ts +0 -14
- package/dist/installer/claude-md-template.d.ts.map +0 -1
- package/dist/installer/claude-md-template.js +0 -21
- package/dist/installer/claude-md-template.js.map +0 -1
- package/dist/installer/config-writer.d.ts +0 -29
- package/dist/installer/config-writer.d.ts.map +0 -1
- package/dist/installer/config-writer.js +0 -111
- package/dist/installer/config-writer.js.map +0 -1
- package/dist/installer/index.d.ts +0 -65
- package/dist/installer/index.d.ts.map +0 -1
- package/dist/installer/index.js +0 -406
- package/dist/installer/index.js.map +0 -1
- package/dist/installer/instructions-template.d.ts +0 -28
- package/dist/installer/instructions-template.d.ts.map +0 -1
- package/dist/installer/instructions-template.js +0 -64
- package/dist/installer/instructions-template.js.map +0 -1
- package/dist/installer/targets/claude.d.ts +0 -31
- package/dist/installer/targets/claude.d.ts.map +0 -1
- package/dist/installer/targets/claude.js +0 -308
- package/dist/installer/targets/claude.js.map +0 -1
- package/dist/installer/targets/codex.d.ts +0 -18
- package/dist/installer/targets/codex.d.ts.map +0 -1
- package/dist/installer/targets/codex.js +0 -185
- package/dist/installer/targets/codex.js.map +0 -1
- package/dist/installer/targets/cursor.d.ts +0 -35
- package/dist/installer/targets/cursor.d.ts.map +0 -1
- package/dist/installer/targets/cursor.js +0 -229
- package/dist/installer/targets/cursor.js.map +0 -1
- package/dist/installer/targets/opencode.d.ts +0 -30
- package/dist/installer/targets/opencode.d.ts.map +0 -1
- package/dist/installer/targets/opencode.js +0 -235
- package/dist/installer/targets/opencode.js.map +0 -1
- package/dist/installer/targets/registry.d.ts +0 -35
- package/dist/installer/targets/registry.d.ts.map +0 -1
- package/dist/installer/targets/registry.js +0 -83
- package/dist/installer/targets/registry.js.map +0 -1
- package/dist/installer/targets/shared.d.ts +0 -77
- package/dist/installer/targets/shared.d.ts.map +0 -1
- package/dist/installer/targets/shared.js +0 -246
- package/dist/installer/targets/shared.js.map +0 -1
- package/dist/installer/targets/toml.d.ts +0 -52
- package/dist/installer/targets/toml.d.ts.map +0 -1
- package/dist/installer/targets/toml.js +0 -147
- package/dist/installer/targets/toml.js.map +0 -1
- package/dist/installer/targets/types.d.ts +0 -116
- package/dist/installer/targets/types.d.ts.map +0 -1
- package/dist/installer/targets/types.js +0 -16
- package/dist/installer/targets/types.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -94
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js +0 -453
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/server-instructions.d.ts +0 -19
- package/dist/mcp/server-instructions.d.ts.map +0 -1
- package/dist/mcp/server-instructions.js +0 -71
- package/dist/mcp/server-instructions.js.map +0 -1
- package/dist/mcp/tools.d.ts +0 -257
- package/dist/mcp/tools.d.ts.map +0 -1
- package/dist/mcp/tools.js +0 -1633
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp/transport.d.ts +0 -106
- package/dist/mcp/transport.d.ts.map +0 -1
- package/dist/mcp/transport.js +0 -233
- package/dist/mcp/transport.js.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.d.ts +0 -18
- package/dist/resolution/frameworks/cargo-workspace.d.ts.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.js +0 -225
- package/dist/resolution/frameworks/cargo-workspace.js.map +0 -1
- package/dist/resolution/frameworks/csharp.d.ts +0 -8
- package/dist/resolution/frameworks/csharp.d.ts.map +0 -1
- package/dist/resolution/frameworks/csharp.js +0 -213
- package/dist/resolution/frameworks/csharp.js.map +0 -1
- package/dist/resolution/frameworks/express.d.ts +0 -8
- package/dist/resolution/frameworks/express.d.ts.map +0 -1
- package/dist/resolution/frameworks/express.js +0 -225
- package/dist/resolution/frameworks/express.js.map +0 -1
- package/dist/resolution/frameworks/go.d.ts +0 -8
- package/dist/resolution/frameworks/go.d.ts.map +0 -1
- package/dist/resolution/frameworks/go.js +0 -158
- package/dist/resolution/frameworks/go.js.map +0 -1
- package/dist/resolution/frameworks/index.d.ts +0 -42
- package/dist/resolution/frameworks/index.d.ts.map +0 -1
- package/dist/resolution/frameworks/index.js +0 -133
- package/dist/resolution/frameworks/index.js.map +0 -1
- package/dist/resolution/frameworks/java.d.ts +0 -8
- package/dist/resolution/frameworks/java.d.ts.map +0 -1
- package/dist/resolution/frameworks/java.js +0 -177
- package/dist/resolution/frameworks/java.js.map +0 -1
- package/dist/resolution/frameworks/laravel.d.ts +0 -13
- package/dist/resolution/frameworks/laravel.d.ts.map +0 -1
- package/dist/resolution/frameworks/laravel.js +0 -248
- package/dist/resolution/frameworks/laravel.js.map +0 -1
- package/dist/resolution/frameworks/nestjs.d.ts +0 -26
- package/dist/resolution/frameworks/nestjs.d.ts.map +0 -1
- package/dist/resolution/frameworks/nestjs.js +0 -374
- package/dist/resolution/frameworks/nestjs.js.map +0 -1
- package/dist/resolution/frameworks/python.d.ts +0 -10
- package/dist/resolution/frameworks/python.d.ts.map +0 -1
- package/dist/resolution/frameworks/python.js +0 -278
- package/dist/resolution/frameworks/python.js.map +0 -1
- package/dist/resolution/frameworks/react.d.ts +0 -8
- package/dist/resolution/frameworks/react.d.ts.map +0 -1
- package/dist/resolution/frameworks/react.js +0 -272
- package/dist/resolution/frameworks/react.js.map +0 -1
- package/dist/resolution/frameworks/ruby.d.ts +0 -8
- package/dist/resolution/frameworks/ruby.d.ts.map +0 -1
- package/dist/resolution/frameworks/ruby.js +0 -198
- package/dist/resolution/frameworks/ruby.js.map +0 -1
- package/dist/resolution/frameworks/rust.d.ts +0 -8
- package/dist/resolution/frameworks/rust.d.ts.map +0 -1
- package/dist/resolution/frameworks/rust.js +0 -207
- package/dist/resolution/frameworks/rust.js.map +0 -1
- package/dist/resolution/frameworks/svelte.d.ts +0 -9
- package/dist/resolution/frameworks/svelte.d.ts.map +0 -1
- package/dist/resolution/frameworks/svelte.js +0 -249
- package/dist/resolution/frameworks/svelte.js.map +0 -1
- package/dist/resolution/frameworks/swift.d.ts +0 -10
- package/dist/resolution/frameworks/swift.d.ts.map +0 -1
- package/dist/resolution/frameworks/swift.js +0 -376
- package/dist/resolution/frameworks/swift.js.map +0 -1
- package/dist/resolution/frameworks/vue.d.ts +0 -9
- package/dist/resolution/frameworks/vue.d.ts.map +0 -1
- package/dist/resolution/frameworks/vue.js +0 -306
- package/dist/resolution/frameworks/vue.js.map +0 -1
- package/dist/resolution/import-resolver.d.ts +0 -40
- package/dist/resolution/import-resolver.d.ts.map +0 -1
- package/dist/resolution/import-resolver.js +0 -663
- package/dist/resolution/import-resolver.js.map +0 -1
- package/dist/resolution/index.d.ts +0 -106
- package/dist/resolution/index.d.ts.map +0 -1
- package/dist/resolution/index.js +0 -709
- package/dist/resolution/index.js.map +0 -1
- package/dist/resolution/name-matcher.d.ts +0 -32
- package/dist/resolution/name-matcher.d.ts.map +0 -1
- package/dist/resolution/name-matcher.js +0 -384
- package/dist/resolution/name-matcher.js.map +0 -1
- package/dist/resolution/path-aliases.d.ts +0 -68
- package/dist/resolution/path-aliases.d.ts.map +0 -1
- package/dist/resolution/path-aliases.js +0 -238
- package/dist/resolution/path-aliases.js.map +0 -1
- package/dist/resolution/strip-comments.d.ts +0 -27
- package/dist/resolution/strip-comments.d.ts.map +0 -1
- package/dist/resolution/strip-comments.js +0 -441
- package/dist/resolution/strip-comments.js.map +0 -1
- package/dist/resolution/types.d.ts +0 -172
- package/dist/resolution/types.d.ts.map +0 -1
- package/dist/resolution/types.js +0 -8
- package/dist/resolution/types.js.map +0 -1
- package/dist/search/query-parser.d.ts +0 -57
- package/dist/search/query-parser.d.ts.map +0 -1
- package/dist/search/query-parser.js +0 -177
- package/dist/search/query-parser.js.map +0 -1
- package/dist/search/query-utils.d.ts +0 -53
- package/dist/search/query-utils.d.ts.map +0 -1
- package/dist/search/query-utils.js +0 -350
- package/dist/search/query-utils.js.map +0 -1
- package/dist/sync/git-hooks.d.ts +0 -45
- package/dist/sync/git-hooks.d.ts.map +0 -1
- package/dist/sync/git-hooks.js +0 -223
- package/dist/sync/git-hooks.js.map +0 -1
- package/dist/sync/index.d.ts +0 -17
- package/dist/sync/index.d.ts.map +0 -1
- package/dist/sync/index.js +0 -28
- package/dist/sync/index.js.map +0 -1
- package/dist/sync/watch-policy.d.ts +0 -48
- package/dist/sync/watch-policy.d.ts.map +0 -1
- package/dist/sync/watch-policy.js +0 -124
- package/dist/sync/watch-policy.js.map +0 -1
- package/dist/sync/watcher.d.ts +0 -81
- package/dist/sync/watcher.d.ts.map +0 -1
- package/dist/sync/watcher.js +0 -194
- package/dist/sync/watcher.js.map +0 -1
- package/dist/types.d.ts +0 -423
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -256
- package/dist/types.js.map +0 -1
- package/dist/ui/glyphs.d.ts +0 -42
- package/dist/ui/glyphs.d.ts.map +0 -1
- package/dist/ui/glyphs.js +0 -78
- package/dist/ui/glyphs.js.map +0 -1
- package/dist/ui/shimmer-progress.d.ts +0 -11
- package/dist/ui/shimmer-progress.d.ts.map +0 -1
- package/dist/ui/shimmer-progress.js +0 -90
- package/dist/ui/shimmer-progress.js.map +0 -1
- package/dist/ui/shimmer-worker.d.ts +0 -2
- package/dist/ui/shimmer-worker.d.ts.map +0 -1
- package/dist/ui/shimmer-worker.js +0 -118
- package/dist/ui/shimmer-worker.js.map +0 -1
- package/dist/ui/types.d.ts +0 -17
- package/dist/ui/types.d.ts.map +0 -1
- package/dist/ui/types.js +0 -3
- package/dist/ui/types.js.map +0 -1
- package/dist/utils.d.ts +0 -205
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -549
- package/dist/utils.js.map +0 -1
- package/scripts/agent-eval/audit.sh +0 -68
- package/scripts/agent-eval/itrun.sh +0 -107
- package/scripts/agent-eval/parse-run.mjs +0 -45
- package/scripts/agent-eval/parse-session.mjs +0 -93
- package/scripts/agent-eval/run-agent.sh +0 -34
- package/scripts/agent-eval/run-all.sh +0 -67
- package/scripts/extract-release-notes.mjs +0 -130
- package/scripts/local-install.sh +0 -41
- package/scripts/patch-tree-sitter-dart.js +0 -112
- package/scripts/release.sh +0 -68
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Drive an INTERACTIVE Claude Code session in tmux, send a prompt, wait for the
|
|
3
|
-
# agent to finish, then print the tool-call breakdown from the session logs.
|
|
4
|
-
#
|
|
5
|
-
# Why interactive (not `claude -p`): headless print-mode picks the
|
|
6
|
-
# general-purpose subagent, while real interactive sessions delegate to the
|
|
7
|
-
# Explore subagent (or drive codegraph from the main thread). Only the
|
|
8
|
-
# interactive TUI reproduces the behavior users actually see. (Idle-detection
|
|
9
|
-
# technique borrowed from devpit's WaitForIdle.)
|
|
10
|
-
#
|
|
11
|
-
# Usage: itrun.sh <repo-path> <label> "<prompt>"
|
|
12
|
-
# Output dir: $AGENT_EVAL_OUT (default /tmp/agent-eval)
|
|
13
|
-
# Requires: tmux 3.0+, a logged-in `claude` CLI, codegraph MCP configured.
|
|
14
|
-
set -uo pipefail
|
|
15
|
-
REPO="$1"; LABEL="$2"; PROMPT="$3"
|
|
16
|
-
SESSION="cgt_${LABEL}"
|
|
17
|
-
OUT_DIR="${AGENT_EVAL_OUT:-/tmp/agent-eval}"; mkdir -p "$OUT_DIR"
|
|
18
|
-
OUT="$OUT_DIR/itrun-${LABEL}.txt"
|
|
19
|
-
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
20
|
-
|
|
21
|
-
cap() { tmux capture-pane -p -t "$SESSION" -S -40; }
|
|
22
|
-
|
|
23
|
-
tmux kill-session -t "$SESSION" 2>/dev/null
|
|
24
|
-
|
|
25
|
-
# Wide pane so the TUI doesn't hard-wrap tool lines.
|
|
26
|
-
tmux new-session -d -s "$SESSION" -x 230 -y 60
|
|
27
|
-
tmux send-keys -t "$SESSION" "cd $REPO && claude --dangerously-skip-permissions ${CLAUDE_EXTRA_ARGS:-}" Enter
|
|
28
|
-
|
|
29
|
-
# Wait for the ❯ prompt (claude drew its UI), up to 60s. NOTE: ❯ appears on the
|
|
30
|
-
# welcome screen seconds before the input actually accepts keystrokes, so this is
|
|
31
|
-
# necessary but NOT sufficient — the type-and-verify loop below is what proves
|
|
32
|
-
# the input is live.
|
|
33
|
-
ready=0
|
|
34
|
-
for _ in $(seq 1 120); do
|
|
35
|
-
cap | grep -q "❯" && { ready=1; break; }
|
|
36
|
-
sleep 0.5
|
|
37
|
-
done
|
|
38
|
-
[ "$ready" = 1 ] || { echo "claude never drew its UI"; cap; tmux kill-session -t "$SESSION" 2>/dev/null; exit 1; }
|
|
39
|
-
|
|
40
|
-
# Accept the per-folder "Is this a project you trust?" dialog if it shows (first
|
|
41
|
-
# time claude opens a given repo). Option 1 ("Yes, I trust this folder") is
|
|
42
|
-
# pre-selected, so Enter accepts. This dialog also contains ❯, so it must be
|
|
43
|
-
# cleared before the type-and-verify loop or keystrokes land on the menu.
|
|
44
|
-
for _ in $(seq 1 20); do
|
|
45
|
-
cap | grep -q "trust this folder" || break
|
|
46
|
-
tmux send-keys -t "$SESSION" Enter
|
|
47
|
-
sleep 1
|
|
48
|
-
done
|
|
49
|
-
|
|
50
|
-
# Type-and-verify: send the prompt, confirm a distinctive chunk of it actually
|
|
51
|
-
# landed in the input box, retry if it didn't (handles the early-❯ race where
|
|
52
|
-
# the welcome screen shows the prompt glyph but MCP init is still eating keys).
|
|
53
|
-
needle="${PROMPT:0:24}"
|
|
54
|
-
typed=0
|
|
55
|
-
for _ in $(seq 1 30); do
|
|
56
|
-
tmux send-keys -l -t "$SESSION" "$PROMPT"
|
|
57
|
-
sleep 1
|
|
58
|
-
if cap | grep -Fq "$needle"; then typed=1; break; fi
|
|
59
|
-
# Clear whatever partial text may have landed, then retry.
|
|
60
|
-
tmux send-keys -t "$SESSION" C-u
|
|
61
|
-
sleep 1
|
|
62
|
-
done
|
|
63
|
-
[ "$typed" = 1 ] || { echo "prompt never landed in the input box"; cap; tmux kill-session -t "$SESSION" 2>/dev/null; exit 1; }
|
|
64
|
-
sleep 0.5
|
|
65
|
-
tmux send-keys -t "$SESSION" Enter
|
|
66
|
-
|
|
67
|
-
# Busy signals. The robust one is the spinner's elapsed-time-in-parens, which
|
|
68
|
-
# EVERY working state shows — both the pre-stream thinking phase
|
|
69
|
-
# "(8s · thinking with max effort)" and the streaming phase
|
|
70
|
-
# "(24s · ↑ 2.5k tokens · …)", and it survives the 32s→"1m 3s" rollover. We OR
|
|
71
|
-
# in the token arrows, "esc to interrupt", and "Initializing" as belt-and-braces
|
|
72
|
-
# (some TUI versions/states show one but not the others).
|
|
73
|
-
BUSY_RE='esc to interrupt|↓ [0-9]|↑ [0-9]|Initializing|\(([0-9]+m )?[0-9]+s ·'
|
|
74
|
-
|
|
75
|
-
# Wait for work to START (busy indicator appears), up to 60s. If it never starts,
|
|
76
|
-
# fail loudly rather than silently reporting an empty run.
|
|
77
|
-
started=0
|
|
78
|
-
for _ in $(seq 1 120); do
|
|
79
|
-
cap | grep -qE "$BUSY_RE" && { started=1; break; }
|
|
80
|
-
sleep 0.5
|
|
81
|
-
done
|
|
82
|
-
[ "$started" = 1 ] || { echo "agent never started working"; cap; tmux kill-session -t "$SESSION" 2>/dev/null; exit 1; }
|
|
83
|
-
|
|
84
|
-
# Poll for idle: not busy AND ❯ present, for 10 consecutive polls (~5s) to ride
|
|
85
|
-
# out mid-conversation thinking gaps that briefly drop the spinner. Up to ~15min.
|
|
86
|
-
consec=0
|
|
87
|
-
for _ in $(seq 1 1800); do
|
|
88
|
-
pane=$(cap)
|
|
89
|
-
if echo "$pane" | grep -qE "$BUSY_RE"; then
|
|
90
|
-
consec=0
|
|
91
|
-
elif echo "$pane" | grep -q "❯"; then
|
|
92
|
-
consec=$((consec+1)); [ "$consec" -ge 10 ] && break
|
|
93
|
-
else
|
|
94
|
-
consec=0
|
|
95
|
-
fi
|
|
96
|
-
sleep 0.5
|
|
97
|
-
done
|
|
98
|
-
sleep 1
|
|
99
|
-
|
|
100
|
-
tmux capture-pane -p -t "$SESSION" -S - > "$OUT"
|
|
101
|
-
echo "captured $(wc -l < "$OUT") lines -> $OUT"
|
|
102
|
-
grep -oE "Done \([^)]*\)" "$OUT" | tail -1
|
|
103
|
-
grep -oE "[0-9.]+k?/[0-9.]+M" "$OUT" | tail -1 | sed 's/^/Context /'
|
|
104
|
-
tmux kill-session -t "$SESSION" 2>/dev/null
|
|
105
|
-
|
|
106
|
-
# Clean tool breakdown from the session logs (main + subagents).
|
|
107
|
-
node "$HERE/parse-session.mjs" "$REPO" 2>/dev/null || true
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Parse a Claude Code stream-json run log: tool-call sequence + token usage.
|
|
3
|
-
import { readFileSync } from 'fs';
|
|
4
|
-
const file = process.argv[2];
|
|
5
|
-
const lines = readFileSync(file, 'utf8').split('\n').filter(Boolean);
|
|
6
|
-
|
|
7
|
-
const toolCalls = [];
|
|
8
|
-
let result = null;
|
|
9
|
-
let initTools = null;
|
|
10
|
-
|
|
11
|
-
for (const line of lines) {
|
|
12
|
-
let ev;
|
|
13
|
-
try { ev = JSON.parse(line); } catch { continue; }
|
|
14
|
-
if (ev.type === 'system' && ev.subtype === 'init') {
|
|
15
|
-
initTools = (ev.tools || []).filter(t => /codegraph/.test(t));
|
|
16
|
-
}
|
|
17
|
-
if (ev.type === 'assistant' && ev.message?.content) {
|
|
18
|
-
for (const block of ev.message.content) {
|
|
19
|
-
if (block.type === 'tool_use') {
|
|
20
|
-
let detail = '';
|
|
21
|
-
if (block.name === 'Task') detail = ` [subagent_type=${block.input?.subagent_type ?? '?'}] ${(block.input?.description ?? '').slice(0,40)}`;
|
|
22
|
-
else if (/codegraph/.test(block.name)) detail = ` ${JSON.stringify(block.input?.query ?? block.input?.task ?? block.input?.symbol ?? '').slice(0,60)}`;
|
|
23
|
-
else if (block.name === 'Bash') detail = ` ${(block.input?.command ?? '').slice(0,50)}`;
|
|
24
|
-
else if (block.name === 'Read') detail = ` ${(block.input?.file_path ?? '').split('/').slice(-1)[0]}`;
|
|
25
|
-
toolCalls.push(`${block.name}${detail}`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (ev.type === 'result') result = ev;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
console.log(`\n=== ${file.split('/').pop()} ===`);
|
|
33
|
-
console.log(`codegraph tools exposed: ${initTools ? initTools.length : '?'}`);
|
|
34
|
-
console.log(`\nTool calls (${toolCalls.length}):`);
|
|
35
|
-
const counts = {};
|
|
36
|
-
for (const tc of toolCalls) { const n = tc.split(' ')[0]; counts[n] = (counts[n]||0)+1; }
|
|
37
|
-
console.log(' by type:', JSON.stringify(counts));
|
|
38
|
-
toolCalls.forEach((tc, i) => console.log(` ${i+1}. ${tc}`));
|
|
39
|
-
|
|
40
|
-
if (result) {
|
|
41
|
-
const u = result.usage || {};
|
|
42
|
-
const totalIn = (u.input_tokens||0) + (u.cache_read_input_tokens||0) + (u.cache_creation_input_tokens||0);
|
|
43
|
-
console.log(`\nResult: ${result.subtype} | duration ${(result.duration_ms/1000).toFixed(0)}s | turns ${result.num_turns}`);
|
|
44
|
-
console.log(` tokens: in=${totalIn} out=${u.output_tokens||0} | cost $${(result.total_cost_usd||0).toFixed(3)}`);
|
|
45
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Parse the newest Claude Code session log for a project + its subagent logs,
|
|
3
|
-
// and report the tool-call breakdown (main + subagents). Works for interactive
|
|
4
|
-
// runs (driven via itrun.sh) — Claude Code writes full transcripts to
|
|
5
|
-
// ~/.claude/projects/<escaped-cwd>/<session>.jsonl with subagents/ alongside.
|
|
6
|
-
import { readFileSync, readdirSync, statSync, existsSync, realpathSync } from 'fs';
|
|
7
|
-
import { join } from 'path';
|
|
8
|
-
import { homedir } from 'os';
|
|
9
|
-
|
|
10
|
-
const projectArg = process.argv[2];
|
|
11
|
-
if (!projectArg) { console.error('usage: parse-session.mjs <project-dir>'); process.exit(1); }
|
|
12
|
-
|
|
13
|
-
// Claude Code escapes the (real) cwd by replacing every "/" with "-".
|
|
14
|
-
const real = realpathSync(projectArg);
|
|
15
|
-
const escaped = real.replace(/\//g, '-');
|
|
16
|
-
const projDir = join(homedir(), '.claude', 'projects', escaped);
|
|
17
|
-
if (!existsSync(projDir)) { console.error('no session logs at', projDir); process.exit(1); }
|
|
18
|
-
|
|
19
|
-
// Newest top-level session .jsonl
|
|
20
|
-
const sessions = readdirSync(projDir)
|
|
21
|
-
.filter(f => f.endsWith('.jsonl'))
|
|
22
|
-
.map(f => ({ f, m: statSync(join(projDir, f)).mtimeMs }))
|
|
23
|
-
.sort((a, b) => b.m - a.m);
|
|
24
|
-
if (sessions.length === 0) { console.error('no .jsonl sessions in', projDir); process.exit(1); }
|
|
25
|
-
const sessionId = sessions[0].f.replace('.jsonl', '');
|
|
26
|
-
|
|
27
|
-
function tally(file) {
|
|
28
|
-
const counts = {};
|
|
29
|
-
for (const line of readFileSync(file, 'utf8').split('\n')) {
|
|
30
|
-
if (!line) continue;
|
|
31
|
-
let ev; try { ev = JSON.parse(line); } catch { continue; }
|
|
32
|
-
const content = ev.message?.content;
|
|
33
|
-
if (!Array.isArray(content)) continue;
|
|
34
|
-
for (const b of content) {
|
|
35
|
-
if (b.type === 'tool_use') counts[b.name] = (counts[b.name] || 0) + 1;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return counts;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Sum token usage from a transcript. The TUI's "Done (…Xk tokens…)" line only
|
|
42
|
-
// covers a subagent's throughput; this works for main-thread runs too and is
|
|
43
|
-
// consistent across both paths. `gen` = output, `fresh` = uncached input
|
|
44
|
-
// (input + cache_creation), `cached` = cache reads (≈free), `total` = all.
|
|
45
|
-
function sumTokens(file) {
|
|
46
|
-
const t = { gen: 0, fresh: 0, cached: 0 };
|
|
47
|
-
for (const line of readFileSync(file, 'utf8').split('\n')) {
|
|
48
|
-
if (!line) continue;
|
|
49
|
-
let ev; try { ev = JSON.parse(line); } catch { continue; }
|
|
50
|
-
const u = ev.message?.usage;
|
|
51
|
-
if (!u) continue;
|
|
52
|
-
t.gen += u.output_tokens || 0;
|
|
53
|
-
t.fresh += (u.input_tokens || 0) + (u.cache_creation_input_tokens || 0);
|
|
54
|
-
t.cached += u.cache_read_input_tokens || 0;
|
|
55
|
-
}
|
|
56
|
-
return t;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const mainCounts = tally(join(projDir, sessionId + '.jsonl'));
|
|
60
|
-
|
|
61
|
-
// Subagent transcripts live under <session>/subagents/*.jsonl
|
|
62
|
-
const subDir = join(projDir, sessionId, 'subagents');
|
|
63
|
-
const subCounts = {};
|
|
64
|
-
let subAgentFiles = 0;
|
|
65
|
-
if (existsSync(subDir)) {
|
|
66
|
-
for (const f of readdirSync(subDir).filter(f => f.endsWith('.jsonl'))) {
|
|
67
|
-
subAgentFiles++;
|
|
68
|
-
const c = tally(join(subDir, f));
|
|
69
|
-
for (const [k, v] of Object.entries(c)) subCounts[k] = (subCounts[k] || 0) + v;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const fmt = (counts) => Object.entries(counts).sort((a, b) => b[1] - a[1])
|
|
74
|
-
.map(([k, v]) => ` ${String(v).padStart(3)} ${k}`).join('\n') || ' (none)';
|
|
75
|
-
|
|
76
|
-
console.log(`session: ${sessionId}`);
|
|
77
|
-
console.log(`\nMAIN thread tools:\n${fmt(mainCounts)}`);
|
|
78
|
-
console.log(`\nSUBAGENT tools (${subAgentFiles} subagent transcript${subAgentFiles === 1 ? '' : 's'}):\n${fmt(subCounts)}`);
|
|
79
|
-
|
|
80
|
-
const explore = subCounts['mcp__codegraph__codegraph_explore'] || mainCounts['mcp__codegraph__codegraph_explore'] || 0;
|
|
81
|
-
const reads = (subCounts['Read'] || 0) + (mainCounts['Read'] || 0);
|
|
82
|
-
const greps = (subCounts['Grep'] || 0) + (mainCounts['Grep'] || 0) + (subCounts['Bash'] || 0) + (mainCounts['Bash'] || 0);
|
|
83
|
-
console.log(`\nVERDICT: codegraph_explore used ${explore}x | Read ${reads} | Grep/Bash ${greps}`);
|
|
84
|
-
|
|
85
|
-
// Token totals (main + subagents), consistent across main-thread and subagent runs.
|
|
86
|
-
const tok = { gen: 0, fresh: 0, cached: 0 };
|
|
87
|
-
const addTok = (t) => { tok.gen += t.gen; tok.fresh += t.fresh; tok.cached += t.cached; };
|
|
88
|
-
addTok(sumTokens(join(projDir, sessionId + '.jsonl')));
|
|
89
|
-
if (existsSync(subDir)) {
|
|
90
|
-
for (const f of readdirSync(subDir).filter(f => f.endsWith('.jsonl'))) addTok(sumTokens(join(subDir, f)));
|
|
91
|
-
}
|
|
92
|
-
const k = (n) => (n / 1000).toFixed(1) + 'k';
|
|
93
|
-
console.log(`TOKENS: gen ${k(tok.gen)} | fresh-in ${k(tok.fresh)} | cached-in ${k(tok.cached)} | billable≈ ${k(tok.gen + tok.fresh)}`);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Headless Claude Code run against a repo with codegraph MCP, capturing the
|
|
3
|
-
# full stream-json so we can see tool calls + token usage. Complements the
|
|
4
|
-
# interactive itrun.sh: headless gives a clean per-tool breakdown + exact
|
|
5
|
-
# tokens/cost, but defaults to the general-purpose subagent (not Explore).
|
|
6
|
-
# To force the Explore path, ask for it in the prompt.
|
|
7
|
-
#
|
|
8
|
-
# Usage: run-agent.sh <repo-path> <label> "<prompt>"
|
|
9
|
-
# Env: AGENT_EVAL_OUT (default /tmp/agent-eval), CG_BIN (codegraph dist binary)
|
|
10
|
-
set -uo pipefail
|
|
11
|
-
|
|
12
|
-
REPO="$1"; LABEL="$2"; PROMPT="$3"
|
|
13
|
-
CG_BIN="${CG_BIN:-$(command -v codegraph || echo /usr/local/bin/codegraph)}"
|
|
14
|
-
OUT_DIR="${AGENT_EVAL_OUT:-/tmp/agent-eval}"; mkdir -p "$OUT_DIR"
|
|
15
|
-
OUT="$OUT_DIR/run-${LABEL}.jsonl"
|
|
16
|
-
|
|
17
|
-
MCP_CONFIG=$(cat <<JSON
|
|
18
|
-
{"mcpServers":{"codegraph":{"command":"${CG_BIN}","args":["serve","--mcp","--path","${REPO}"]}}}
|
|
19
|
-
JSON
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
echo "→ running [$LABEL] in $REPO"
|
|
23
|
-
cd "$REPO" || exit 1
|
|
24
|
-
|
|
25
|
-
claude -p "$PROMPT" \
|
|
26
|
-
--output-format stream-json --verbose \
|
|
27
|
-
--permission-mode bypassPermissions \
|
|
28
|
-
--model opus \
|
|
29
|
-
--max-budget-usd 2 \
|
|
30
|
-
--strict-mcp-config --mcp-config "$MCP_CONFIG" \
|
|
31
|
-
> "$OUT" 2>"$OUT_DIR/run-${LABEL}.err"
|
|
32
|
-
|
|
33
|
-
echo "exit: $? | wrote $OUT ($(wc -l < "$OUT") lines)"
|
|
34
|
-
node "$(cd "$(dirname "$0")" && pwd)/parse-run.mjs" "$OUT" 2>/dev/null || true
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# With/without A/B (and optional interactive) eval for a codegraph version on a
|
|
3
|
-
# repo. Codegraph is the ONLY variable: both arms launch claude with
|
|
4
|
-
# --strict-mcp-config — with = codegraph-only MCP (pointed at $CG_BIN),
|
|
5
|
-
# without = empty MCP. Built-in Read/Grep/Bash stay available in both arms.
|
|
6
|
-
#
|
|
7
|
-
# Usage: run-all.sh <repo-path> "<question>" [headless|tmux|all]
|
|
8
|
-
# Env: CG_BIN codegraph binary (default: command -v codegraph)
|
|
9
|
-
# AGENT_EVAL_OUT output dir (default: /tmp/agent-eval)
|
|
10
|
-
set -uo pipefail
|
|
11
|
-
|
|
12
|
-
REPO="${1:?usage: run-all.sh <repo-path> \"<question>\" [headless|tmux|all]}"
|
|
13
|
-
Q="${2:?question required}"
|
|
14
|
-
MODE="${3:-headless}"
|
|
15
|
-
CG_BIN="${CG_BIN:-$(command -v codegraph)}"
|
|
16
|
-
OUT="${AGENT_EVAL_OUT:-/tmp/agent-eval}"
|
|
17
|
-
HARNESS="$(cd "$(dirname "$0")" && pwd)"
|
|
18
|
-
mkdir -p "$OUT"
|
|
19
|
-
|
|
20
|
-
[ -n "$CG_BIN" ] || { echo "no codegraph binary on PATH (set CG_BIN)"; exit 1; }
|
|
21
|
-
[ -d "$REPO/.codegraph" ] || { echo "no .codegraph index at $REPO — index it first"; exit 1; }
|
|
22
|
-
case "$MODE" in headless|tmux|all) ;; *) echo "mode must be headless|tmux|all (got '$MODE')"; exit 1;; esac
|
|
23
|
-
|
|
24
|
-
# MCP config files (path form avoids inline-JSON quoting through tmux).
|
|
25
|
-
cat > "$OUT/mcp-codegraph.json" <<JSON
|
|
26
|
-
{"mcpServers":{"codegraph":{"command":"$CG_BIN","args":["serve","--mcp","--path","$REPO"]}}}
|
|
27
|
-
JSON
|
|
28
|
-
echo '{"mcpServers":{}}' > "$OUT/mcp-empty.json"
|
|
29
|
-
|
|
30
|
-
echo "###### codegraph: $CG_BIN"
|
|
31
|
-
echo "###### repo: $REPO"
|
|
32
|
-
echo "###### question: $Q"
|
|
33
|
-
echo
|
|
34
|
-
|
|
35
|
-
# Headless arm: claude -p with stream-json -> exact tool sequence + tokens/cost.
|
|
36
|
-
headless() {
|
|
37
|
-
local label="$1" cfg="$2"
|
|
38
|
-
echo "############################## HEADLESS [$label] ##############################"
|
|
39
|
-
( cd "$REPO" && claude -p "$Q" \
|
|
40
|
-
--output-format stream-json --verbose \
|
|
41
|
-
--permission-mode bypassPermissions \
|
|
42
|
-
--model opus \
|
|
43
|
-
--max-budget-usd 4 \
|
|
44
|
-
--strict-mcp-config --mcp-config "$cfg" \
|
|
45
|
-
> "$OUT/run-$label.jsonl" 2>"$OUT/run-$label.err" )
|
|
46
|
-
echo "exit $? -> $OUT/run-$label.jsonl ($(wc -l < "$OUT/run-$label.jsonl" | tr -d ' ') lines)"
|
|
47
|
-
tail -2 "$OUT/run-$label.err" 2>/dev/null
|
|
48
|
-
node "$HARNESS/parse-run.mjs" "$OUT/run-$label.jsonl" 2>&1 || true
|
|
49
|
-
echo
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if [ "$MODE" = headless ] || [ "$MODE" = all ]; then
|
|
53
|
-
headless "headless-with" "$OUT/mcp-codegraph.json"
|
|
54
|
-
headless "headless-without" "$OUT/mcp-empty.json"
|
|
55
|
-
fi
|
|
56
|
-
|
|
57
|
-
if [ "$MODE" = tmux ] || [ "$MODE" = all ]; then
|
|
58
|
-
echo "############################## INTERACTIVE [with] ##############################"
|
|
59
|
-
CLAUDE_EXTRA_ARGS="--model opus --strict-mcp-config --mcp-config $OUT/mcp-codegraph.json" \
|
|
60
|
-
bash "$HARNESS/itrun.sh" "$REPO" "int-with" "$Q" 2>&1 || echo "[itrun WITH failed]"
|
|
61
|
-
echo
|
|
62
|
-
echo "############################## INTERACTIVE [without] ##############################"
|
|
63
|
-
CLAUDE_EXTRA_ARGS="--model opus --strict-mcp-config --mcp-config $OUT/mcp-empty.json" \
|
|
64
|
-
bash "$HARNESS/itrun.sh" "$REPO" "int-without" "$Q" 2>&1 || echo "[itrun WITHOUT failed]"
|
|
65
|
-
echo
|
|
66
|
-
fi
|
|
67
|
-
echo "############################## RUN-ALL COMPLETE ##############################"
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Extract a release-notes block from CHANGELOG.md for a given version
|
|
4
|
-
* (or unwrap text supplied on stdin), then join hard-wrapped paragraphs.
|
|
5
|
-
*
|
|
6
|
-
* Why: GitHub renders release-note Markdown with GFM hard breaks, so
|
|
7
|
-
* every `\n` becomes `<br>`. The CHANGELOG is hard-wrapped at ~75
|
|
8
|
-
* chars for readable diffs, which then renders as awkward visible
|
|
9
|
-
* line breaks on the release page. This script joins indented
|
|
10
|
-
* continuation lines into a single line per bullet so the GFM
|
|
11
|
-
* renderer produces clean paragraphs.
|
|
12
|
-
*
|
|
13
|
-
* Repo-level CHANGELOG.md viewing is unaffected (CommonMark treats
|
|
14
|
-
* newlines as spaces there).
|
|
15
|
-
*
|
|
16
|
-
* Usage:
|
|
17
|
-
* extract-release-notes.mjs <version> # read CHANGELOG.md
|
|
18
|
-
* extract-release-notes.mjs --stdin # read from stdin (any text)
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
import { readFileSync } from 'fs';
|
|
22
|
-
|
|
23
|
-
const arg = process.argv[2];
|
|
24
|
-
if (!arg) {
|
|
25
|
-
console.error('usage: extract-release-notes.mjs <version> | --stdin');
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let block;
|
|
30
|
-
if (arg === '--stdin') {
|
|
31
|
-
block = readFileSync(0, 'utf8').replace(/\r\n?/g, '\n').split('\n');
|
|
32
|
-
} else {
|
|
33
|
-
const version = arg;
|
|
34
|
-
const escaped = version.replace(/\./g, '\\.');
|
|
35
|
-
const headerRe = new RegExp(`^## \\[${escaped}\\]`);
|
|
36
|
-
const anyHeaderRe = /^## \[/;
|
|
37
|
-
const lines = readFileSync('CHANGELOG.md', 'utf8').split('\n');
|
|
38
|
-
const start = lines.findIndex((l) => headerRe.test(l));
|
|
39
|
-
if (start === -1) {
|
|
40
|
-
console.error(`no '## [${version}]' entry found in CHANGELOG.md`);
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
const after = lines.findIndex((l, i) => i > start && anyHeaderRe.test(l));
|
|
44
|
-
block = lines.slice(start, after === -1 ? lines.length : after);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Track a stack of `{ indent: number }` frames so a continuation line
|
|
48
|
-
// can attach to the right ancestor. Handles the post-nested-list
|
|
49
|
-
// continuation pattern:
|
|
50
|
-
//
|
|
51
|
-
// - top-level
|
|
52
|
-
// - nested
|
|
53
|
-
// back to top-level <- 2-space indent, joins the top-level bullet
|
|
54
|
-
const out = [];
|
|
55
|
-
let buf = '';
|
|
56
|
-
let stack = [];
|
|
57
|
-
|
|
58
|
-
function flushBuf() {
|
|
59
|
-
if (buf !== '') {
|
|
60
|
-
out.push(buf);
|
|
61
|
-
buf = '';
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function leadingSpaces(s) {
|
|
66
|
-
const m = s.match(/^(\s*)/);
|
|
67
|
-
return m ? m[1].length : 0;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Bullets: `-`, `*`, `digit.` only. `+` is intentionally excluded — the
|
|
71
|
-
// CHANGELOG uses literal `+` inline (`config + instructions`) and we
|
|
72
|
-
// don't want to misread those as nested bullets.
|
|
73
|
-
const listItemRe = /^(\s*)([-*]|\d+\.)\s+/;
|
|
74
|
-
const fenceRe = /^\s*```/;
|
|
75
|
-
|
|
76
|
-
let inFence = false;
|
|
77
|
-
|
|
78
|
-
for (const line of block) {
|
|
79
|
-
// Fenced code blocks: pass through verbatim, no joining.
|
|
80
|
-
if (fenceRe.test(line)) {
|
|
81
|
-
flushBuf();
|
|
82
|
-
stack = [];
|
|
83
|
-
out.push(line);
|
|
84
|
-
inFence = !inFence;
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
if (inFence) {
|
|
88
|
-
out.push(line);
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
if (/^\s*$/.test(line)) {
|
|
92
|
-
flushBuf();
|
|
93
|
-
out.push('');
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (/^#/.test(line)) {
|
|
97
|
-
flushBuf();
|
|
98
|
-
stack = [];
|
|
99
|
-
out.push(line);
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
const itemMatch = line.match(listItemRe);
|
|
103
|
-
if (itemMatch) {
|
|
104
|
-
flushBuf();
|
|
105
|
-
const indent = itemMatch[1].length;
|
|
106
|
-
while (stack.length > 0 && stack[stack.length - 1].indent >= indent) {
|
|
107
|
-
stack.pop();
|
|
108
|
-
}
|
|
109
|
-
stack.push({ indent });
|
|
110
|
-
buf = line;
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
if (/^\s/.test(line)) {
|
|
114
|
-
const indent = leadingSpaces(line);
|
|
115
|
-
while (stack.length > 1 && stack[stack.length - 1].indent >= indent) {
|
|
116
|
-
flushBuf();
|
|
117
|
-
stack.pop();
|
|
118
|
-
}
|
|
119
|
-
const trimmed = line.replace(/^\s+/, '');
|
|
120
|
-
buf = buf === '' ? trimmed : `${buf} ${trimmed}`;
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
flushBuf();
|
|
124
|
-
stack = [];
|
|
125
|
-
out.push(line);
|
|
126
|
-
}
|
|
127
|
-
flushBuf();
|
|
128
|
-
|
|
129
|
-
process.stdout.write(out.join('\n'));
|
|
130
|
-
if (!out[out.length - 1]?.endsWith('\n')) process.stdout.write('\n');
|
package/scripts/local-install.sh
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Build the current branch and link it as the global `codegraph` for
|
|
3
|
-
# hands-on testing. Replaces any existing global install for as long
|
|
4
|
-
# as the symlink is in place.
|
|
5
|
-
#
|
|
6
|
-
# Usage:
|
|
7
|
-
# ./scripts/local-install.sh # build + link
|
|
8
|
-
# ./scripts/local-install.sh --undo # unlink + restore the published version
|
|
9
|
-
|
|
10
|
-
set -euo pipefail
|
|
11
|
-
|
|
12
|
-
cd "$(dirname "$0")/.."
|
|
13
|
-
|
|
14
|
-
PKG=$(node -p "require('./package.json').name")
|
|
15
|
-
VERSION=$(node -p "require('./package.json').version")
|
|
16
|
-
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
17
|
-
|
|
18
|
-
if [ "${1:-}" = "--undo" ]; then
|
|
19
|
-
echo "→ unlinking ${PKG}"
|
|
20
|
-
npm unlink -g "${PKG}" >/dev/null 2>&1 || true
|
|
21
|
-
echo "→ reinstalling published ${PKG}"
|
|
22
|
-
npm install -g "${PKG}"
|
|
23
|
-
echo "done: global codegraph -> $(command -v codegraph)"
|
|
24
|
-
exit 0
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
echo "→ building ${PKG} ${VERSION} (${BRANCH})"
|
|
28
|
-
npm run build
|
|
29
|
-
|
|
30
|
-
echo "→ linking globally"
|
|
31
|
-
npm link
|
|
32
|
-
|
|
33
|
-
LINKED=$(command -v codegraph || echo "(not on PATH)")
|
|
34
|
-
echo
|
|
35
|
-
echo "✓ global codegraph now points to this branch"
|
|
36
|
-
echo " binary: ${LINKED}"
|
|
37
|
-
echo " branch: ${BRANCH}"
|
|
38
|
-
echo " version: ${VERSION}"
|
|
39
|
-
echo
|
|
40
|
-
echo "To restore the published version:"
|
|
41
|
-
echo " ./scripts/local-install.sh --undo"
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Patches tree-sitter-dart to use NAPI bindings compatible with tree-sitter 0.22+
|
|
4
|
-
*
|
|
5
|
-
* tree-sitter-dart v1.0.0 ships with NAN-style bindings that are incompatible
|
|
6
|
-
* with tree-sitter 0.22+ which expects NAPI-style bindings with type-tagged
|
|
7
|
-
* externals. This script rewrites the binding files and rebuilds.
|
|
8
|
-
*/
|
|
9
|
-
const { writeFileSync, existsSync } = require('fs');
|
|
10
|
-
const { join } = require('path');
|
|
11
|
-
const { execSync } = require('child_process');
|
|
12
|
-
|
|
13
|
-
const DART_DIR = join(__dirname, '..', 'node_modules', 'tree-sitter-dart');
|
|
14
|
-
|
|
15
|
-
if (!existsSync(DART_DIR)) {
|
|
16
|
-
// tree-sitter-dart not installed, skip
|
|
17
|
-
process.exit(0);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Check if already patched (look for NAPI-style binding)
|
|
21
|
-
const bindingPath = join(DART_DIR, 'bindings', 'node', 'binding.cc');
|
|
22
|
-
const { readFileSync } = require('fs');
|
|
23
|
-
try {
|
|
24
|
-
const existing = readFileSync(bindingPath, 'utf8');
|
|
25
|
-
if (existing.includes('napi.h')) {
|
|
26
|
-
// Already patched, check if build exists
|
|
27
|
-
const buildPath = join(DART_DIR, 'build', 'Release', 'tree_sitter_dart_binding.node');
|
|
28
|
-
if (existsSync(buildPath)) {
|
|
29
|
-
console.log('tree-sitter-dart: already patched and built.');
|
|
30
|
-
process.exit(0);
|
|
31
|
-
}
|
|
32
|
-
// Patched but not built, fall through to rebuild
|
|
33
|
-
}
|
|
34
|
-
} catch {
|
|
35
|
-
// Can't read, continue with patch
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
console.log('Patching tree-sitter-dart for NAPI compatibility...');
|
|
39
|
-
|
|
40
|
-
// Write NAPI-compatible binding.cc
|
|
41
|
-
const bindingCC = `#include <napi.h>
|
|
42
|
-
|
|
43
|
-
typedef struct TSLanguage TSLanguage;
|
|
44
|
-
|
|
45
|
-
extern "C" TSLanguage *tree_sitter_dart();
|
|
46
|
-
|
|
47
|
-
// "tree-sitter", "language" hashed with BLAKE2
|
|
48
|
-
const napi_type_tag LANGUAGE_TYPE_TAG = {
|
|
49
|
-
0x8AF2E5212AD58ABF, 0xD5006CAD83ABBA16
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
|
53
|
-
exports["name"] = Napi::String::New(env, "dart");
|
|
54
|
-
auto language = Napi::External<TSLanguage>::New(env, tree_sitter_dart());
|
|
55
|
-
language.TypeTag(&LANGUAGE_TYPE_TAG);
|
|
56
|
-
exports["language"] = language;
|
|
57
|
-
return exports;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
NODE_API_MODULE(tree_sitter_dart_binding, Init)
|
|
61
|
-
`;
|
|
62
|
-
writeFileSync(bindingPath, bindingCC);
|
|
63
|
-
|
|
64
|
-
// Write NAPI-compatible binding.gyp
|
|
65
|
-
const bindingGyp = `{
|
|
66
|
-
"targets": [
|
|
67
|
-
{
|
|
68
|
-
"target_name": "tree_sitter_dart_binding",
|
|
69
|
-
"dependencies": [
|
|
70
|
-
"<!(node -p \\"require('node-addon-api').targets\\"):node_addon_api_except"
|
|
71
|
-
],
|
|
72
|
-
"include_dirs": [
|
|
73
|
-
"src"
|
|
74
|
-
],
|
|
75
|
-
"sources": [
|
|
76
|
-
"src/parser.c",
|
|
77
|
-
"bindings/node/binding.cc",
|
|
78
|
-
"src/scanner.c"
|
|
79
|
-
],
|
|
80
|
-
"conditions": [
|
|
81
|
-
["OS!='win'", {
|
|
82
|
-
"cflags_c": [
|
|
83
|
-
"-std=c99"
|
|
84
|
-
]
|
|
85
|
-
}, {
|
|
86
|
-
"cflags_c": [
|
|
87
|
-
"/std:c11",
|
|
88
|
-
"/utf-8"
|
|
89
|
-
]
|
|
90
|
-
}]
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
`;
|
|
96
|
-
writeFileSync(join(DART_DIR, 'binding.gyp'), bindingGyp);
|
|
97
|
-
|
|
98
|
-
// Rebuild native module
|
|
99
|
-
try {
|
|
100
|
-
execSync('npx node-gyp rebuild', {
|
|
101
|
-
cwd: DART_DIR,
|
|
102
|
-
stdio: 'pipe',
|
|
103
|
-
timeout: 120000,
|
|
104
|
-
});
|
|
105
|
-
console.log('tree-sitter-dart: patched and rebuilt successfully.');
|
|
106
|
-
} catch (error) {
|
|
107
|
-
console.error('Warning: Failed to rebuild tree-sitter-dart native module.');
|
|
108
|
-
console.error('Dart language support may not work.');
|
|
109
|
-
if (process.env.DEBUG) {
|
|
110
|
-
console.error(error.stderr?.toString());
|
|
111
|
-
}
|
|
112
|
-
}
|