@stupidloud/codegraph 0.7.14 → 0.7.20

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.
Files changed (136) hide show
  1. package/README.md +44 -10
  2. package/README.zh-CN.md +3 -8
  3. package/dist/bin/codegraph.js +102 -24
  4. package/dist/bin/codegraph.js.map +1 -1
  5. package/dist/bin/node-version-check.d.ts +3 -0
  6. package/dist/bin/node-version-check.d.ts.map +1 -1
  7. package/dist/bin/node-version-check.js +5 -2
  8. package/dist/bin/node-version-check.js.map +1 -1
  9. package/dist/bin/uninstall.d.ts +7 -7
  10. package/dist/bin/uninstall.d.ts.map +1 -1
  11. package/dist/bin/uninstall.js +23 -135
  12. package/dist/bin/uninstall.js.map +1 -1
  13. package/dist/config.d.ts.map +1 -1
  14. package/dist/config.js +0 -2
  15. package/dist/config.js.map +1 -1
  16. package/dist/context/index.d.ts.map +1 -1
  17. package/dist/context/index.js +4 -2
  18. package/dist/context/index.js.map +1 -1
  19. package/dist/db/migrations.d.ts +1 -1
  20. package/dist/db/migrations.d.ts.map +1 -1
  21. package/dist/db/migrations.js +22 -8
  22. package/dist/db/migrations.js.map +1 -1
  23. package/dist/db/queries.d.ts.map +1 -1
  24. package/dist/db/queries.js +7 -1
  25. package/dist/db/queries.js.map +1 -1
  26. package/dist/db/schema.sql +0 -1
  27. package/dist/extraction/index.d.ts +1 -1
  28. package/dist/extraction/index.d.ts.map +1 -1
  29. package/dist/index.d.ts +0 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +3 -3
  32. package/dist/index.js.map +1 -1
  33. package/dist/installer/claude-md-template.d.ts +10 -6
  34. package/dist/installer/claude-md-template.d.ts.map +1 -1
  35. package/dist/installer/claude-md-template.js +15 -40
  36. package/dist/installer/claude-md-template.js.map +1 -1
  37. package/dist/installer/config-writer.d.ts +17 -24
  38. package/dist/installer/config-writer.d.ts.map +1 -1
  39. package/dist/installer/config-writer.js +44 -239
  40. package/dist/installer/config-writer.js.map +1 -1
  41. package/dist/installer/index.d.ts +45 -4
  42. package/dist/installer/index.d.ts.map +1 -1
  43. package/dist/installer/index.js +216 -79
  44. package/dist/installer/index.js.map +1 -1
  45. package/dist/installer/instructions-template.d.ts +28 -0
  46. package/dist/installer/instructions-template.d.ts.map +1 -0
  47. package/dist/installer/instructions-template.js +63 -0
  48. package/dist/installer/instructions-template.js.map +1 -0
  49. package/dist/installer/targets/claude.d.ts +27 -0
  50. package/dist/installer/targets/claude.d.ts.map +1 -0
  51. package/dist/installer/targets/claude.js +246 -0
  52. package/dist/installer/targets/claude.js.map +1 -0
  53. package/dist/installer/targets/codex.d.ts +18 -0
  54. package/dist/installer/targets/codex.d.ts.map +1 -0
  55. package/dist/installer/targets/codex.js +185 -0
  56. package/dist/installer/targets/codex.js.map +1 -0
  57. package/dist/installer/targets/cursor.d.ts +35 -0
  58. package/dist/installer/targets/cursor.d.ts.map +1 -0
  59. package/dist/installer/targets/cursor.js +229 -0
  60. package/dist/installer/targets/cursor.js.map +1 -0
  61. package/dist/installer/targets/opencode.d.ts +30 -0
  62. package/dist/installer/targets/opencode.d.ts.map +1 -0
  63. package/dist/installer/targets/opencode.js +235 -0
  64. package/dist/installer/targets/opencode.js.map +1 -0
  65. package/dist/installer/targets/registry.d.ts +35 -0
  66. package/dist/installer/targets/registry.d.ts.map +1 -0
  67. package/dist/installer/targets/registry.js +83 -0
  68. package/dist/installer/targets/registry.js.map +1 -0
  69. package/dist/installer/targets/shared.d.ts +77 -0
  70. package/dist/installer/targets/shared.d.ts.map +1 -0
  71. package/dist/installer/targets/shared.js +246 -0
  72. package/dist/installer/targets/shared.js.map +1 -0
  73. package/dist/installer/targets/toml.d.ts +52 -0
  74. package/dist/installer/targets/toml.d.ts.map +1 -0
  75. package/dist/installer/targets/toml.js +147 -0
  76. package/dist/installer/targets/toml.js.map +1 -0
  77. package/dist/installer/targets/types.d.ts +116 -0
  78. package/dist/installer/targets/types.d.ts.map +1 -0
  79. package/dist/installer/targets/types.js +16 -0
  80. package/dist/installer/targets/types.js.map +1 -0
  81. package/dist/mcp/index.d.ts +4 -0
  82. package/dist/mcp/index.d.ts.map +1 -1
  83. package/dist/mcp/index.js +34 -9
  84. package/dist/mcp/index.js.map +1 -1
  85. package/dist/mcp/server-instructions.d.ts +1 -1
  86. package/dist/mcp/server-instructions.d.ts.map +1 -1
  87. package/dist/mcp/server-instructions.js +6 -6
  88. package/dist/mcp/tools.d.ts +61 -5
  89. package/dist/mcp/tools.d.ts.map +1 -1
  90. package/dist/mcp/tools.js +389 -81
  91. package/dist/mcp/tools.js.map +1 -1
  92. package/dist/search/query-utils.d.ts.map +1 -1
  93. package/dist/search/query-utils.js +29 -26
  94. package/dist/search/query-utils.js.map +1 -1
  95. package/dist/semantic-config-prompt.d.ts.map +1 -1
  96. package/dist/semantic-config-prompt.js +2 -3
  97. package/dist/semantic-config-prompt.js.map +1 -1
  98. package/dist/types.d.ts +0 -2
  99. package/dist/types.d.ts.map +1 -1
  100. package/dist/types.js +1 -2
  101. package/dist/types.js.map +1 -1
  102. package/dist/ui/glyphs.d.ts +42 -0
  103. package/dist/ui/glyphs.d.ts.map +1 -0
  104. package/dist/ui/glyphs.js +78 -0
  105. package/dist/ui/glyphs.js.map +1 -0
  106. package/dist/ui/shimmer-progress.d.ts +1 -0
  107. package/dist/ui/shimmer-progress.d.ts.map +1 -1
  108. package/dist/ui/shimmer-progress.js +7 -0
  109. package/dist/ui/shimmer-progress.js.map +1 -1
  110. package/dist/ui/shimmer-worker.js +20 -11
  111. package/dist/ui/shimmer-worker.js.map +1 -1
  112. package/dist/ui/types.d.ts +1 -0
  113. package/dist/ui/types.d.ts.map +1 -1
  114. package/dist/vectors/embedder.d.ts +15 -8
  115. package/dist/vectors/embedder.d.ts.map +1 -1
  116. package/dist/vectors/embedder.js +81 -53
  117. package/dist/vectors/embedder.js.map +1 -1
  118. package/dist/vectors/index.d.ts +1 -1
  119. package/dist/vectors/index.d.ts.map +1 -1
  120. package/dist/vectors/index.js.map +1 -1
  121. package/dist/vectors/manager.d.ts +5 -1
  122. package/dist/vectors/manager.d.ts.map +1 -1
  123. package/dist/vectors/manager.js +47 -28
  124. package/dist/vectors/manager.js.map +1 -1
  125. package/dist/vectors/search.d.ts +1 -1
  126. package/dist/vectors/search.d.ts.map +1 -1
  127. package/dist/vectors/search.js +9 -16
  128. package/dist/vectors/search.js.map +1 -1
  129. package/package.json +3 -2
  130. package/scripts/agent-eval/itrun.sh +107 -0
  131. package/scripts/agent-eval/parse-run.mjs +45 -0
  132. package/scripts/agent-eval/parse-session.mjs +93 -0
  133. package/scripts/agent-eval/run-agent.sh +34 -0
  134. package/scripts/extract-release-notes.mjs +130 -0
  135. package/scripts/local-install.sh +41 -0
  136. package/scripts/release.sh +68 -0
@@ -0,0 +1,130 @@
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');
@@ -0,0 +1,41 @@
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"
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env bash
2
+ # Tag the current commit with the version in package.json and publish a
3
+ # matching GitHub Release whose body is the corresponding CHANGELOG.md entry.
4
+ #
5
+ # Run AFTER you have:
6
+ # - bumped package.json
7
+ # - added a `## [X.Y.Z] - YYYY-MM-DD` block at the top of CHANGELOG.md
8
+ # - committed, pushed to origin, and run `npm publish`
9
+ #
10
+ # Idempotent: safe to re-run after a partial failure. Skips steps that are
11
+ # already done (tag created, tag pushed, release published).
12
+ #
13
+ # Usage: ./scripts/release.sh
14
+
15
+ set -euo pipefail
16
+
17
+ cd "$(dirname "$0")/.."
18
+
19
+ VERSION=$(node -p "require('./package.json').version")
20
+ TAG="v${VERSION}"
21
+
22
+ REPO=$(git remote get-url origin | sed -E 's|.*github\.com[:/]||; s|\.git$||')
23
+ if [ -z "${REPO}" ]; then
24
+ echo "error: could not derive owner/repo from origin remote URL" >&2
25
+ exit 1
26
+ fi
27
+
28
+ if ! grep -q "^## \[${VERSION}\]" CHANGELOG.md; then
29
+ echo "error: no '## [${VERSION}]' entry found in CHANGELOG.md" >&2
30
+ exit 1
31
+ fi
32
+
33
+ # Extract notes with paragraph unwrapping — GitHub Releases render with
34
+ # GFM hard-breaks, so the CHANGELOG's hard-wrapped lines would show as
35
+ # visible `<br>` breaks otherwise. The helper joins continuation lines
36
+ # into a single line per bullet.
37
+ NOTES=$(node scripts/extract-release-notes.mjs "${VERSION}")
38
+
39
+ if [ -z "${NOTES}" ]; then
40
+ echo "error: failed to extract changelog notes for ${VERSION}" >&2
41
+ exit 1
42
+ fi
43
+
44
+ if git rev-parse "${TAG}" >/dev/null 2>&1; then
45
+ echo "✓ tag ${TAG} already exists locally"
46
+ else
47
+ echo "→ tagging ${TAG}"
48
+ git tag "${TAG}"
49
+ fi
50
+
51
+ if git ls-remote --exit-code --tags origin "${TAG}" >/dev/null 2>&1; then
52
+ echo "✓ tag ${TAG} already on origin"
53
+ else
54
+ echo "→ pushing ${TAG} to origin"
55
+ git push origin "${TAG}"
56
+ fi
57
+
58
+ if gh release view "${TAG}" --repo "${REPO}" >/dev/null 2>&1; then
59
+ echo "✓ release ${TAG} already published"
60
+ else
61
+ echo "→ creating GitHub Release ${TAG} on ${REPO}"
62
+ gh release create "${TAG}" \
63
+ --repo "${REPO}" \
64
+ --title "${TAG}" \
65
+ --notes "${NOTES}"
66
+ fi
67
+
68
+ echo "done: https://github.com/${REPO}/releases/tag/${TAG}"